本文整理汇总了C++中scintilla_send_message函数的典型用法代码示例。如果您正苦于以下问题:C++ scintilla_send_message函数的具体用法?C++ scintilla_send_message怎么用?C++ scintilla_send_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scintilla_send_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rmwhspln
/* Remove Whitespace Lines */
gint
rmwhspln(ScintillaObject *sci, gint line_num, gint end_line_num)
{
gint indent; /* indent position */
gint changed = 0; /* number of lines removed */
while(line_num <= end_line_num) /* loop through lines */
{
indent = scintilla_send_message(sci,
SCI_GETLINEINDENTPOSITION,
line_num, 0);
/* check if the posn of indentation is also the end of line posn */
if(indent -
sci_get_position_from_line(sci, line_num) ==
sci_get_line_end_position (sci, line_num) -
sci_get_position_from_line(sci, line_num))
{
scintilla_send_message(sci,
SCI_DELETERANGE,
sci_get_position_from_line(sci, line_num),
sci_get_line_length(sci, line_num));
line_num--;
end_line_num--;
changed++;
}
line_num++;
}
/* return the number of lines deleted */
return -changed;
}
示例2: editor_open_position
/*
* opens position in a editor
*/
void editor_open_position(const gchar *filename, int line)
{
GeanyDocument* doc = NULL;
gboolean already_open = (doc = document_get_current()) && !strcmp(DOC_FILENAME(doc), filename);
if (!already_open)
doc = document_open_file(filename, FALSE, NULL, NULL);
if (doc)
{
/* temporarily set debug caret policy */
scintilla_send_message(doc->editor->sci, SCI_SETYCARETPOLICY, CARET_SLOP | CARET_JUMPS | CARET_EVEN, 3);
sci_goto_line(doc->editor->sci, line - 1, TRUE);
/* revert to default edit caret policy */
scintilla_send_message(doc->editor->sci, SCI_SETYCARETPOLICY, CARET_EVEN, 0);
scintilla_send_message(doc->editor->sci, SCI_SETFOCUS, TRUE, 0);
}
else
{
dialogs_show_msgbox(GTK_MESSAGE_ERROR, _("Can't find a source file \"%s\""), filename);
}
}
示例3: create_selection
static void create_selection(ScintillaObject *sci, int anchor, int anchor_space,
gboolean rectangle)
{
int cursor = sci_get_current_position(sci);
int cursor_space = sci_get_cursor_space(sci);
if (rectangle)
{
sci_set_selection_mode(sci, SC_SEL_RECTANGLE);
sci_set_anchor(sci, anchor);
/* sci_set_current_position() sets anchor = cursor, bypass */
scintilla_send_message(sci, SCI_SETCURRENTPOS, cursor, 0);
}
else
{
sci_set_selection_mode(sci, SC_SEL_STREAM);
scintilla_send_message(sci, SCI_SETSEL, anchor, cursor);
}
sci_set_anchor_space(sci, anchor_space);
sci_set_cursor_space(sci, cursor_space);
/* SCI bug: CANCEL may reduce a rectangle selection to a single line */
if (rectangle)
sci_set_selection_mode(sci, SC_SEL_RECTANGLE);
else
sci_send_command(sci, SCI_CANCEL);
}
示例4: on_mouse_leave
static gboolean on_mouse_leave(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
ScintillaObject *so = (ScintillaObject*)widget;
if (scintilla_send_message (so, SCI_CALLTIPACTIVE, 0, 0))
{
g_signal_handler_disconnect(G_OBJECT(widget), leave_signal);
scintilla_send_message (so, SCI_CALLTIPCANCEL, 0, 0);
}
return FALSE;
}
示例5: highlight_tag
static void highlight_tag(ScintillaObject *sci, gint openingBracket,
gint closingBracket, gint color)
{
scintilla_send_message(sci, SCI_SETINDICATORCURRENT, INDICATOR_TAGMATCH, 0);
scintilla_send_message(sci, SCI_INDICSETSTYLE,
INDICATOR_TAGMATCH, INDIC_ROUNDBOX);
scintilla_send_message(sci, SCI_INDICSETFORE, INDICATOR_TAGMATCH, rgb2bgr(color));
scintilla_send_message(sci, SCI_INDICSETALPHA, INDICATOR_TAGMATCH, 60);
scintilla_send_message(sci, SCI_INDICATORFILLRANGE,
openingBracket, closingBracket-openingBracket+1);
}
示例6: prefs_apply
void prefs_apply(GeanyDocument *doc)
{
gint i;
ScintillaObject *sci = doc->editor->sci;
MarkerStyle *style = pref_marker_styles;
for (i = pref_sci_marker_first; i < pref_sci_marker_first + MARKER_COUNT; i++, style++)
{
scintilla_send_message(sci, SCI_MARKERDEFINE, i, style->mark);
scintilla_send_message(sci, SCI_MARKERSETFORE, i, style->fore);
scintilla_send_message(sci, SCI_MARKERSETBACK, i, style->back);
scintilla_send_message(sci, SCI_MARKERSETALPHA, i, style->alpha);
}
}
示例7: DeleteMarker
static void DeleteMarker(GeanyDocument* doc,gint bookmarkNumber,gint markerNumber)
{
guint32 *markers;
ScintillaObject *sci=doc->editor->sci;
/* remove marker */
scintilla_send_message(sci,SCI_MARKERDELETEALL,markerNumber,0);
scintilla_send_message(sci,SCI_MARKERDEFINE,markerNumber,SC_MARK_AVAILABLE);
/* update record of which markers are being used */
markers=GetMarkersUsed(sci);
(*markers)-=1<<markerNumber;
g_object_set_data(G_OBJECT(sci),"Geany_Numbered_Bookmarks_Used",(gpointer)markers);
}
示例8: geany_xml_encode_selection
/* geany_xml_encode_selection
*
* Encode the XML entities in the current selection.
*/
void geany_xml_encode_selection()
{
GeanyDocument* document = document_get_current();
if (document)
{
ScintillaObject* sci = document->editor->sci;
unsigned long sel_beg = scintilla_send_message(sci, SCI_GETSELECTIONSTART, 0, 0);
unsigned long sel_end = scintilla_send_message(sci, SCI_GETSELECTIONEND, 0, 0);
int replaced = geany_xml_encode(document, sel_beg, sel_end);
// Display notification in status area.
geany_xml_encode_notify(document, replaced);
}
}
示例9: rmemtyln
/* Remove Empty Lines */
gint
rmemtyln(ScintillaObject *sci, gint line_num, gint end_line_num)
{
gint changed = 0; /* number of lines removed */
while(line_num <= end_line_num) /* loop through lines */
{
/* check if the first posn of the line is also the end of line posn */
if(sci_get_position_from_line(sci, line_num) ==
sci_get_line_end_position (sci, line_num))
{
scintilla_send_message(sci,
SCI_DELETERANGE,
sci_get_position_from_line(sci, line_num),
sci_get_line_length(sci, line_num));
line_num--;
end_line_num--;
changed++;
}
line_num++;
}
/* return the number of lines deleted */
return -changed;
}
示例10: ApplyBookmarks
static void ApplyBookmarks(GeanyDocument* doc,FileData *fd)
{
gint i,iLineCount,m;
GtkWidget *dialog;
ScintillaObject* sci=doc->editor->sci;
iLineCount=scintilla_send_message(sci,SCI_GETLINECOUNT,0,0);
for(i=0;i<10;i++)
if(fd->iBookmark[i]!=-1 && fd->iBookmark[i]<iLineCount)
{
m=NextFreeMarker(doc);
/* if run out of markers report this */
if(m==-1)
{
dialog=gtk_message_dialog_new(GTK_WINDOW(geany->main_widgets->window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,GTK_BUTTONS_NONE,
_("Unable to apply all markers to '%s' as all being used."),
doc->file_name);
gtk_dialog_add_button(GTK_DIALOG(dialog),_("_Okay"),GTK_RESPONSE_OK);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
return;
}
/* otherwise ok to set marker */
SetMarker(doc,i,m,fd->iBookmark[i]);
}
}
示例11: on_sci_notify
static void on_sci_notify(ScintillaObject *sci, gint param,
SCNotification *nt, gpointer data)
{
gint line;
switch (nt->nmhdr.code)
{
/* adapted from editor.c: on_margin_click() */
case SCN_MARGINCLICK:
/* left click to marker margin toggles marker */
if (nt->margin == 1)
{
gboolean set;
gint marker = 1;
line = sci_get_line_from_position(sci, nt->position);
set = sci_is_marker_set_at_line(sci, line, marker);
if (!set)
sci_set_marker_at_line(sci, line, marker);
else
sci_delete_marker_at_line(sci, line, marker);
}
/* left click on the folding margin to toggle folding state of current line */
if (nt->margin == 2)
{
line = sci_get_line_from_position(sci, nt->position);
scintilla_send_message(sci, SCI_TOGGLEFOLD, line, 0);
}
break;
default:
break;
}
}
示例12: on_query_tooltip
static gboolean on_query_tooltip(G_GNUC_UNUSED GtkWidget *widget, gint x, gint y,
gboolean keyboard_mode, GtkTooltip *tooltip, GeanyEditor *editor)
{
gint pos = keyboard_mode ? sci_get_current_position(editor->sci) :
scintilla_send_message(editor->sci, SCI_POSITIONFROMPOINT, x, y);
if (pos >= 0)
{
if (pos == last_pos)
{
gtk_tooltip_set_text(tooltip, output);
return show;
}
else if (pos != peek_pos)
{
if (query_id)
g_source_remove(query_id);
else
scid_gen++;
peek_pos = pos;
query_id = plugin_timeout_add(geany_plugin, pref_tooltips_send_delay * 10,
tooltip_launch, editor);
}
}
return FALSE;
}
示例13: IupScintillaSendMessage
sptr_t IupScintillaSendMessage(Ihandle* ih, unsigned int iMessage, uptr_t wParam, sptr_t lParam)
{
#ifdef GTK
return scintilla_send_message(SCINTILLA(ih->handle), iMessage, wParam, lParam);
#else
return SendMessage(ih->handle, iMessage, wParam, lParam);
#endif
}
示例14: sc_speller_process_line
gint sc_speller_process_line(GeanyDocument *doc, gint line_number, const gchar *line)
{
gint pos_start, pos_end;
gint wstart, wend;
GString *str;
gint suggestions_found = 0;
gchar c;
g_return_val_if_fail(sc_speller_dict != NULL, 0);
g_return_val_if_fail(doc != NULL, 0);
g_return_val_if_fail(line != NULL, 0);
str = g_string_sized_new(256);
pos_start = sci_get_position_from_line(doc->editor->sci, line_number);
pos_end = sci_get_position_from_line(doc->editor->sci, line_number + 1);
while (pos_start < pos_end)
{
wstart = scintilla_send_message(doc->editor->sci, SCI_WORDSTARTPOSITION, pos_start, TRUE);
wend = scintilla_send_message(doc->editor->sci, SCI_WORDENDPOSITION, wstart, FALSE);
if (wstart == wend)
break;
c = sci_get_char_at(doc->editor->sci, wstart);
/* hopefully it's enough to check for these both */
if (ispunct(c) || isspace(c))
{
pos_start++;
continue;
}
/* ensure the string has enough allocated memory */
if (str->len < (guint)(wend - wstart))
g_string_set_size(str, wend - wstart);
sci_get_text_range(doc->editor->sci, wstart, wend, str->str);
suggestions_found += sc_speller_check_word(doc, line_number, str->str, wstart, wend);
pos_start = wend + 1;
}
g_string_free(str, TRUE);
return suggestions_found;
}
示例15: on_document_open
/*
* Occures on document opening.
* Used to set breaks markers
*/
void on_document_open(GObject *obj, GeanyDocument *doc, gpointer user_data)
{
/*set markers*/
markers_set_for_document(doc->editor->sci);
/*set dwell interval*/
scintilla_send_message(doc->editor->sci, SCI_SETMOUSEDWELLTIME, 500, 0);
/* set tab size for calltips */
scintilla_send_message(doc->editor->sci, SCI_CALLTIPUSESTYLE, 20, (long)NULL);
/* set breakpoint and frame markers */
set_markers_for_file(DOC_FILENAME(doc));
/* if debug is active - tell the debug module that a file was opened */
if (DBS_IDLE != debug_get_state())
debug_on_file_open(doc);
}