Skip to content

Commit

Permalink
Change all scintilla_send_message calls to use SSM macro
Browse files Browse the repository at this point in the history
  • Loading branch information
codebrainz committed Aug 4, 2017
1 parent 6c6eccd commit 6d663cb
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ void on_toggle_case1_activate(GtkMenuItem *menuitem, gpointer user_data)
{
gchar *result = NULL;
gint cmd = SCI_LOWERCASE;
gboolean rectsel = (gboolean) scintilla_send_message(sci, SCI_SELECTIONISRECTANGLE, 0, 0);
gboolean rectsel = (gboolean) SSM(sci, SCI_SELECTIONISRECTANGLE, 0, 0);
gchar *text = sci_get_selection_contents(sci);

if (utils_str_has_upper(text))
Expand Down
2 changes: 1 addition & 1 deletion src/document.c
Original file line number Diff line number Diff line change
Expand Up @@ -2687,7 +2687,7 @@ void document_update_tags(GeanyDocument *doc)
/* Parse Scintilla's buffer directly using TagManager
* Note: this buffer *MUST NOT* be modified */
len = sci_get_length(doc->editor->sci);
buffer_ptr = (guchar *) scintilla_send_message(doc->editor->sci, SCI_GETCHARACTERPOINTER, 0, 0);
buffer_ptr = (guchar *) SSM(doc->editor->sci, SCI_GETCHARACTERPOINTER, 0, 0);
tm_workspace_update_source_file_buffer(doc->tm_file, buffer_ptr, len);

sidebar_update_tag_list(doc, TRUE);
Expand Down
6 changes: 3 additions & 3 deletions src/editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -2146,7 +2146,7 @@ static GSList *get_doc_words(ScintillaObject *sci, gchar *root, gsize rootlen)
flags = SCFIND_WORDSTART | SCFIND_MATCHCASE;

/* search the whole document for the word root and collect results */
pos_find = scintilla_send_message(sci, SCI_FINDTEXT, flags, (uptr_t) &ttf);
pos_find = SSM(sci, SCI_FINDTEXT, flags, (uptr_t) &ttf);
while (pos_find >= 0 && pos_find < len)
{
word_end = pos_find + rootlen;
Expand All @@ -2172,7 +2172,7 @@ static GSList *get_doc_words(ScintillaObject *sci, gchar *root, gsize rootlen)
}
}
ttf.chrg.cpMin = word_end;
pos_find = scintilla_send_message(sci, SCI_FINDTEXT, flags, (uptr_t) &ttf);
pos_find = SSM(sci, SCI_FINDTEXT, flags, (uptr_t) &ttf);
}

return g_slist_sort(words, (GCompareFunc)utils_str_casecmp);
Expand All @@ -2189,7 +2189,7 @@ static gboolean autocomplete_doc_word(GeanyEditor *editor, gchar *root, gsize ro
words = get_doc_words(sci, root, rootlen);
if (!words)
{
scintilla_send_message(sci, SCI_AUTOCCANCEL, 0, 0);
SSM(sci, SCI_AUTOCCANCEL, 0, 0);
return FALSE;
}

Expand Down
8 changes: 6 additions & 2 deletions src/keybindings.c
Original file line number Diff line number Diff line change
Expand Up @@ -1558,13 +1558,17 @@ static gboolean cb_func_search_action(guint key_id)
gint pos = sci_get_current_position(sci);

/* clear existing search indicators instead if next to cursor */
if (scintilla_send_message(sci, SCI_INDICATORVALUEAT,
if (SSM(sci, SCI_INDICATORVALUEAT,
GEANY_INDICATOR_SEARCH, pos) ||
scintilla_send_message(sci, SCI_INDICATORVALUEAT,
SSM(sci, SCI_INDICATORVALUEAT,
GEANY_INDICATOR_SEARCH, MAX(pos - 1, 0)))
{
text = NULL;
}
else
{
text = get_current_word_or_sel(doc, TRUE);
}

if (sci_has_selection(sci))
search_mark_all(doc, text, GEANY_FIND_MATCHCASE);
Expand Down
14 changes: 7 additions & 7 deletions src/printing.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,14 @@ static void begin_print(GtkPrintOperation *operation, GtkPrintContext *context,
dinfo->sci = editor_create_widget(dinfo->doc->editor);
/* since we won't add the widget to any container, assume it's ownership */
g_object_ref_sink(dinfo->sci);
scintilla_send_message(dinfo->sci, SCI_SETDOCPOINTER, 0,
scintilla_send_message(dinfo->doc->editor->sci, SCI_GETDOCPOINTER, 0, 0));
SSM(dinfo->sci, SCI_SETDOCPOINTER, 0,
SSM(dinfo->doc->editor->sci, SCI_GETDOCPOINTER, 0, 0));
highlighting_set_styles(dinfo->sci, dinfo->doc->file_type);
sci_set_line_numbers(dinfo->sci, printing_prefs.print_line_numbers);
scintilla_send_message(dinfo->sci, SCI_SETVIEWWS, SCWS_INVISIBLE, 0);
scintilla_send_message(dinfo->sci, SCI_SETVIEWEOL, FALSE, 0);
scintilla_send_message(dinfo->sci, SCI_SETEDGEMODE, EDGE_NONE, 0);
scintilla_send_message(dinfo->sci, SCI_SETPRINTCOLOURMODE, SC_PRINT_COLOURONWHITE, 0);
SSM(dinfo->sci, SCI_SETVIEWWS, SCWS_INVISIBLE, 0);
SSM(dinfo->sci, SCI_SETVIEWEOL, FALSE, 0);
SSM(dinfo->sci, SCI_SETEDGEMODE, EDGE_NONE, 0);
SSM(dinfo->sci, SCI_SETPRINTCOLOURMODE, SC_PRINT_COLOURONWHITE, 0);

/* Scintilla doesn't respect the context resolution, so we'll scale ourselves.
* Actually Scintilla simply doesn't know about the resolution since it creates its own
Expand Down Expand Up @@ -401,7 +401,7 @@ static gint format_range(DocInfo *dinfo, gboolean draw)

cairo_save(dinfo->fr.hdc);
cairo_scale(dinfo->fr.hdc, dinfo->sci_scale, dinfo->sci_scale);
pos = (gint) scintilla_send_message(dinfo->sci, SCI_FORMATRANGE, draw, (sptr_t) &dinfo->fr);
pos = (gint) SSM(dinfo->sci, SCI_FORMATRANGE, draw, (sptr_t) &dinfo->fr);
cairo_restore(dinfo->fr.hdc);

return pos;
Expand Down
4 changes: 2 additions & 2 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -1940,7 +1940,7 @@ static gint find_regex(ScintillaObject *sci, guint pos, GRegex *regex, gboolean
if (multiline)
{
/* Warning: any SCI calls will invalidate 'text' after calling SCI_GETCHARACTERPOINTER */
text = (void*)scintilla_send_message(sci, SCI_GETCHARACTERPOINTER, 0, 0);
text = (void*)SSM(sci, SCI_GETCHARACTERPOINTER, 0, 0);
g_regex_match_full(regex, text, -1, pos, 0, &minfo, NULL);
}
else /* single-line mode, manually match against each line */
Expand All @@ -1952,7 +1952,7 @@ static gint find_regex(ScintillaObject *sci, guint pos, GRegex *regex, gboolean
gint start = sci_get_position_from_line(sci, line);
gint end = sci_get_line_end_position(sci, line);

text = (void*)scintilla_send_message(sci, SCI_GETRANGEPOINTER, start, end - start);
text = (void*)SSM(sci, SCI_GETRANGEPOINTER, start, end - start);
if (g_regex_match_full(regex, text, end - start, pos - start, 0, &minfo, NULL))
{
offset = start;
Expand Down
10 changes: 5 additions & 5 deletions src/symbols.c
Original file line number Diff line number Diff line change
Expand Up @@ -1860,10 +1860,10 @@ static void goto_popup_position_func(GtkMenu *menu, gint *x, gint *y, gboolean *
GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(sci));
gint pos = sci_get_current_position(sci);
gint line = sci_get_line_from_position(sci, pos);
gint pos_x = scintilla_send_message(sci, SCI_POINTXFROMPOSITION, 0, pos);
gint pos_y = scintilla_send_message(sci, SCI_POINTYFROMPOSITION, 0, pos);
gint pos_x = SSM(sci, SCI_POINTXFROMPOSITION, 0, pos);
gint pos_y = SSM(sci, SCI_POINTYFROMPOSITION, 0, pos);

line_height = scintilla_send_message(sci, SCI_TEXTHEIGHT, line, 0);
line_height = SSM(sci, SCI_TEXTHEIGHT, line, 0);

gdk_window_get_origin(window, x, y);
*x += pos_x;
Expand Down Expand Up @@ -2285,7 +2285,7 @@ static gint get_fold_header_after(ScintillaObject *sci, gint line)
{
if (sci_get_fold_level(sci, line) & SC_FOLDLEVELHEADERFLAG)
{
const gint last_child = scintilla_send_message(sci, SCI_GETLASTCHILD, line, -1);
const gint last_child = SSM(sci, SCI_GETLASTCHILD, line, -1);
const gint line_end = sci_get_line_end_position(sci, line);
const gint lexer = sci_get_lexer(sci);
gint parenthesis_match_line = -1;
Expand Down Expand Up @@ -2354,7 +2354,7 @@ static gint get_current_tag_name(GeanyDocument *doc, gchar **tagname, TMTagType
{
const gint tag_fold = get_fold_header_after(doc->editor->sci, tag_line);
if (tag_fold >= 0)
last_child = scintilla_send_message(doc->editor->sci, SCI_GETLASTCHILD, tag_fold, -1);
last_child = SSM(doc->editor->sci, SCI_GETLASTCHILD, tag_fold, -1);
}

if (line <= last_child)
Expand Down

0 comments on commit 6d663cb

Please sign in to comment.