Rename GeanyEditor::scintilla to GeanyEditor::sci.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/editor-struct@2776 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2008-07-14 11:13:54 +00:00
parent 82d63e09b0
commit 7db4bfe493
21 changed files with 540 additions and 529 deletions

View File

@ -1,3 +1,14 @@
2008-07-14 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/keybindings.c, src/printing.c, src/tools.c, src/navqueue.c,
src/treeviews.c, src/callbacks.c, src/notebook.c, src/keyfile.c,
src/filetypes.c, src/search.c, src/document.c, src/main.c,
src/editor.c, src/symbols.c, src/editor.h, src/ui_utils.c,
plugins/export.c, plugins/vcdiff.c, plugins/htmlchars.c,
plugins/classbuilder.c:
Rename GeanyEditor::scintilla to GeanyEditor::sci.
2008-07-11 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/document.c, src/editor.c, src/editor.h, src/ui_utils.c:

View File

@ -733,7 +733,7 @@ static void cc_dlg_on_create_class(CreateClassDialog *cc_dlg)
{
text = get_template_class_source(class_info);
doc = p_document->new_file(class_info->source, NULL, NULL);
p_sci->set_text(doc->editor->scintilla, text);
p_sci->set_text(doc->editor->sci, text);
g_free(text);
}
@ -741,7 +741,7 @@ static void cc_dlg_on_create_class(CreateClassDialog *cc_dlg)
{
text = get_template_class_header(class_info);
doc = p_document->new_file(class_info->header, NULL, NULL);
p_sci->set_text(doc->editor->scintilla, text);
p_sci->set_text(doc->editor->sci, text);
g_free(text);
}

View File

@ -357,25 +357,25 @@ static void write_latex_file(GeanyDocument *doc, const gchar *filename, gboolean
GString *body;
GString *cmds;
GString *latex;
gint style_max = pow(2, p_sci->send_message(doc->editor->scintilla, SCI_GETSTYLEBITS, 0, 0));
gint style_max = pow(2, p_sci->send_message(doc->editor->sci, SCI_GETSTYLEBITS, 0, 0));
/* first read all styles from Scintilla */
for (i = 0; i < style_max; i++)
{
styles[i][FORE] = p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETFORE, i, 0);
styles[i][BACK] = p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETBACK, i, 0);
styles[i][BOLD] = p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETBOLD, i, 0);
styles[i][ITALIC] = p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETITALIC, i, 0);
styles[i][FORE] = p_sci->send_message(doc->editor->sci, SCI_STYLEGETFORE, i, 0);
styles[i][BACK] = p_sci->send_message(doc->editor->sci, SCI_STYLEGETBACK, i, 0);
styles[i][BOLD] = p_sci->send_message(doc->editor->sci, SCI_STYLEGETBOLD, i, 0);
styles[i][ITALIC] = p_sci->send_message(doc->editor->sci, SCI_STYLEGETITALIC, i, 0);
styles[i][USED] = 0;
}
/* read the document and write the LaTeX code */
body = g_string_new("");
for (i = 0; i < p_sci->get_length(doc->editor->scintilla); i++)
for (i = 0; i < p_sci->get_length(doc->editor->sci); i++)
{
style = p_sci->get_style_at(doc->editor->scintilla, i);
c = p_sci->get_char_at(doc->editor->scintilla, i);
c_next = p_sci->get_char_at(doc->editor->scintilla, i + 1);
style = p_sci->get_style_at(doc->editor->sci, i);
c = p_sci->get_char_at(doc->editor->sci, i);
c_next = p_sci->get_char_at(doc->editor->sci, i + 1);
if (style != old_style || ! block_open)
{
@ -564,15 +564,15 @@ static void write_html_file(GeanyDocument *doc, const gchar *filename, gboolean
GString *body;
GString *css;
GString *html;
gint style_max = pow(2, p_sci->send_message(doc->editor->scintilla, SCI_GETSTYLEBITS, 0, 0));
gint style_max = pow(2, p_sci->send_message(doc->editor->sci, SCI_GETSTYLEBITS, 0, 0));
/* first read all styles from Scintilla */
for (i = 0; i < style_max; i++)
{
styles[i][FORE] = ROTATE_RGB(p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETFORE, i, 0));
styles[i][BACK] = ROTATE_RGB(p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETBACK, i, 0));
styles[i][BOLD] = p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETBOLD, i, 0);
styles[i][ITALIC] = p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETITALIC, i, 0);
styles[i][FORE] = ROTATE_RGB(p_sci->send_message(doc->editor->sci, SCI_STYLEGETFORE, i, 0));
styles[i][BACK] = ROTATE_RGB(p_sci->send_message(doc->editor->sci, SCI_STYLEGETBACK, i, 0));
styles[i][BOLD] = p_sci->send_message(doc->editor->sci, SCI_STYLEGETBOLD, i, 0);
styles[i][ITALIC] = p_sci->send_message(doc->editor->sci, SCI_STYLEGETITALIC, i, 0);
styles[i][USED] = 0;
}
@ -581,18 +581,18 @@ static void write_html_file(GeanyDocument *doc, const gchar *filename, gboolean
font_name = pango_font_description_get_family(font_desc);
/*font_size = pango_font_description_get_size(font_desc) / PANGO_SCALE;*/
/* take the zoom level also into account */
font_size = p_sci->send_message(doc->editor->scintilla, SCI_STYLEGETSIZE, 0, 0);
font_size = p_sci->send_message(doc->editor->sci, SCI_STYLEGETSIZE, 0, 0);
if (use_zoom)
font_size += p_sci->send_message(doc->editor->scintilla, SCI_GETZOOM, 0, 0);
font_size += p_sci->send_message(doc->editor->sci, SCI_GETZOOM, 0, 0);
/* read the document and write the HTML body */
body = g_string_new("");
for (i = 0; i < p_sci->get_length(doc->editor->scintilla); i++)
for (i = 0; i < p_sci->get_length(doc->editor->sci); i++)
{
style = p_sci->get_style_at(doc->editor->scintilla, i);
c = p_sci->get_char_at(doc->editor->scintilla, i);
style = p_sci->get_style_at(doc->editor->sci, i);
c = p_sci->get_char_at(doc->editor->sci, i);
/* p_sci->get_char_at() takes care of index boundaries and return 0 if i is too high */
c_next = p_sci->get_char_at(doc->editor->scintilla, i + 1);
c_next = p_sci->get_char_at(doc->editor->sci, i + 1);
if ((style != old_style || ! span_open) && ! isspace(c))
{

View File

@ -446,12 +446,12 @@ static gboolean sc_insert(GtkTreeModel *model, GtkTreeIter *iter)
if (doc != NULL)
{
gchar *str;
gint pos = p_sci->get_current_position(doc->editor->scintilla);
gint pos = p_sci->get_current_position(doc->editor->sci);
gtk_tree_model_get(model, iter, COLUMN_HTML_NAME, &str, -1);
if (NZV(str))
{
p_sci->insert_text(doc->editor->scintilla, pos, str);
p_sci->insert_text(doc->editor->sci, pos, str);
g_free(str);
result = TRUE;
}

View File

@ -285,9 +285,9 @@ static void show_output(const gchar *std_output, const gchar *utf8_name_prefix,
}
else
{
p_sci->set_text(doc->editor->scintilla, text);
p_sci->set_text(doc->editor->sci, text);
book = GTK_NOTEBOOK(geany->main_widgets->notebook);
page = gtk_notebook_page_num(book, GTK_WIDGET(doc->editor->scintilla));
page = gtk_notebook_page_num(book, GTK_WIDGET(doc->editor->sci));
gtk_notebook_set_current_page(book, page);
p_document->set_text_changed(doc, FALSE);
}

View File

@ -112,7 +112,7 @@ static void verify_click_pos(GeanyDocument *doc)
{
if (insert_callback_from_menu)
{
editor_info.click_pos = sci_get_current_position(doc->editor->scintilla);
editor_info.click_pos = sci_get_current_position(doc->editor->sci);
insert_callback_from_menu = FALSE;
}
}
@ -305,7 +305,7 @@ on_cut1_activate (GtkMenuItem *menuitem,
gtk_editable_cut_clipboard(GTK_EDITABLE(focusw));
else
if (IS_SCINTILLA(focusw) && doc != NULL)
sci_cut(doc->editor->scintilla);
sci_cut(doc->editor->sci);
else
if (GTK_IS_TEXT_VIEW(focusw))
{
@ -327,7 +327,7 @@ on_copy1_activate (GtkMenuItem *menuitem,
gtk_editable_copy_clipboard(GTK_EDITABLE(focusw));
else
if (IS_SCINTILLA(focusw) && doc != NULL)
sci_copy(doc->editor->scintilla);
sci_copy(doc->editor->sci);
else
if (GTK_IS_TEXT_VIEW(focusw))
{
@ -360,12 +360,12 @@ on_paste1_activate (GtkMenuItem *menuitem,
gchar *content = gtk_clipboard_wait_for_text(gtk_clipboard_get(GDK_NONE));
if (content != NULL)
{
sci_replace_sel(doc->editor->scintilla, content);
sci_replace_sel(doc->editor->sci, content);
g_free(content);
}
}
#else
sci_paste(doc->editor->scintilla);
sci_paste(doc->editor->sci);
#endif
}
else
@ -390,7 +390,7 @@ on_delete1_activate (GtkMenuItem *menuitem,
gtk_editable_delete_selection(GTK_EDITABLE(focusw));
else
if (IS_SCINTILLA(focusw) && doc != NULL)
sci_clear(doc->editor->scintilla);
sci_clear(doc->editor->sci);
else
if (GTK_IS_TEXT_VIEW(focusw))
{
@ -658,9 +658,9 @@ on_zoom_in1_activate (GtkMenuItem *menuitem,
if (doc != NULL)
{
if (done++ % 3 == 0)
sci_set_line_numbers(doc->editor->scintilla, editor_prefs.show_linenumber_margin,
(sci_get_zoom(doc->editor->scintilla) / 2));
sci_zoom_in(doc->editor->scintilla);
sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin,
(sci_get_zoom(doc->editor->sci) / 2));
sci_zoom_in(doc->editor->sci);
}
}
@ -672,9 +672,9 @@ on_zoom_out1_activate (GtkMenuItem *menuitem,
GeanyDocument *doc = document_get_current();
if (doc != NULL)
{
if (sci_get_zoom(doc->editor->scintilla) == 0)
sci_set_line_numbers(doc->editor->scintilla, editor_prefs.show_linenumber_margin, 0);
sci_zoom_out(doc->editor->scintilla);
if (sci_get_zoom(doc->editor->sci) == 0)
sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
sci_zoom_out(doc->editor->sci);
}
}
@ -686,8 +686,8 @@ on_normal_size1_activate (GtkMenuItem *menuitem,
GeanyDocument *doc = document_get_current();
if (doc != NULL)
{
sci_zoom_off(doc->editor->scintilla);
sci_set_line_numbers(doc->editor->scintilla, editor_prefs.show_linenumber_margin, 0);
sci_zoom_off(doc->editor->sci);
sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
}
}
@ -779,8 +779,8 @@ on_crlf_activate (GtkMenuItem *menuitem,
{
GeanyDocument *doc = document_get_current();
if (ignore_callback || doc == NULL) return;
sci_convert_eols(doc->editor->scintilla, SC_EOL_CRLF);
sci_set_eol_mode(doc->editor->scintilla, SC_EOL_CRLF);
sci_convert_eols(doc->editor->sci, SC_EOL_CRLF);
sci_set_eol_mode(doc->editor->sci, SC_EOL_CRLF);
}
@ -790,8 +790,8 @@ on_lf_activate (GtkMenuItem *menuitem,
{
GeanyDocument *doc = document_get_current();
if (ignore_callback || doc == NULL) return;
sci_convert_eols(doc->editor->scintilla, SC_EOL_LF);
sci_set_eol_mode(doc->editor->scintilla, SC_EOL_LF);
sci_convert_eols(doc->editor->sci, SC_EOL_LF);
sci_set_eol_mode(doc->editor->sci, SC_EOL_LF);
}
@ -801,8 +801,8 @@ on_cr_activate (GtkMenuItem *menuitem,
{
GeanyDocument *doc = document_get_current();
if (ignore_callback || doc == NULL) return;
sci_convert_eols(doc->editor->scintilla, SC_EOL_CR);
sci_set_eol_mode(doc->editor->scintilla, SC_EOL_CR);
sci_convert_eols(doc->editor->sci, SC_EOL_CR);
sci_set_eol_mode(doc->editor->sci, SC_EOL_CR);
}
@ -863,7 +863,7 @@ void on_toggle_case1_activate(GtkMenuItem *menuitem, gpointer user_data)
if (doc == NULL)
return;
sci = doc->editor->scintilla;
sci = doc->editor->sci;
if (! sci_can_copy(sci))
{
keybindings_send_command(GEANY_KEY_GROUP_SELECT, GEANY_KEYS_SELECT_WORD);
@ -984,7 +984,7 @@ on_set_file_readonly1_toggled (GtkCheckMenuItem *checkmenuitem,
if (doc == NULL)
return;
doc->readonly = ! doc->readonly;
sci_set_readonly(doc->editor->scintilla, doc->readonly);
sci_set_readonly(doc->editor->sci, doc->readonly);
ui_update_tab_status(doc);
ui_update_statusbar(doc, -1);
}
@ -1015,10 +1015,10 @@ on_find_usage1_activate (GtkMenuItem *menuitem,
if (doc == NULL)
return;
if (sci_can_copy(doc->editor->scintilla))
if (sci_can_copy(doc->editor->sci))
{ /* take selected text if there is a selection */
search_text = g_malloc(sci_get_selected_text_length(doc->editor->scintilla) + 1);
sci_get_selected_text(doc->editor->scintilla, search_text);
search_text = g_malloc(sci_get_selected_text_length(doc->editor->sci) + 1);
sci_get_selected_text(doc->editor->sci, search_text);
flags = SCFIND_MATCHCASE;
}
else
@ -1042,7 +1042,7 @@ on_goto_tag_activate (GtkMenuItem *menuitem,
g_return_if_fail(doc != NULL);
sci_set_current_position(doc->editor->scintilla, editor_info.click_pos, FALSE);
sci_set_current_position(doc->editor->sci, editor_info.click_pos, FALSE);
symbols_goto_tag(editor_info.current_word, definition);
}
@ -1066,8 +1066,8 @@ on_show_color_chooser1_activate (GtkMenuItem *menuitem,
if (doc == NULL)
return;
pos = sci_get_current_position(doc->editor->scintilla);
editor_find_current_word(doc->editor->scintilla, pos, colour, sizeof colour, GEANY_WORDCHARS"#");
pos = sci_get_current_position(doc->editor->sci);
editor_find_current_word(doc->editor->sci, pos, colour, sizeof colour, GEANY_WORDCHARS"#");
tools_color_chooser(colour);
}
@ -1186,12 +1186,12 @@ on_goto_line_dialog_response (GtkDialog *dialog,
GeanyDocument *doc = document_get_current();
gint line = strtol(gtk_entry_get_text(GTK_ENTRY(user_data)), NULL, 10);
if (doc != NULL && line > 0 && line <= sci_get_line_count(doc->editor->scintilla))
if (doc != NULL && line > 0 && line <= sci_get_line_count(doc->editor->sci))
{
gint pos;
line--; /* the user counts lines from 1, we begin at 0 so bring the user line to our one */
pos = sci_get_position_from_line(doc->editor->scintilla, line);
pos = sci_get_position_from_line(doc->editor->sci, line);
editor_goto_pos(doc->editor, pos, TRUE);
}
else
@ -1291,11 +1291,11 @@ on_comments_function_activate (GtkMenuItem *menuitem,
/* symbols_get_current_function returns -1 on failure, so sci_get_position_from_line
* returns the current position, so it should be safe */
line = symbols_get_current_function(doc, &cur_tag);
pos = sci_get_position_from_line(doc->editor->scintilla, line - 1);
pos = sci_get_position_from_line(doc->editor->sci, line - 1);
text = templates_get_template_function(doc->file_type->id, cur_tag);
sci_insert_text(doc->editor->scintilla, pos, text);
sci_insert_text(doc->editor->sci, pos, text);
g_free(text);
}
@ -1333,7 +1333,7 @@ on_comments_gpl_activate (GtkMenuItem *menuitem,
verify_click_pos(doc); /* make sure that the click_pos is valid */
sci_insert_text(doc->editor->scintilla, editor_info.click_pos, text);
sci_insert_text(doc->editor->sci, editor_info.click_pos, text);
g_free(text);
}
@ -1353,7 +1353,7 @@ on_comments_bsd_activate (GtkMenuItem *menuitem,
verify_click_pos(doc); /* make sure that the click_pos is valid */
sci_insert_text(doc->editor->scintilla, editor_info.click_pos, text);
sci_insert_text(doc->editor->sci, editor_info.click_pos, text);
g_free(text);
}
@ -1370,10 +1370,10 @@ on_comments_changelog_activate (GtkMenuItem *menuitem,
return;
text = templates_get_template_changelog();
sci_insert_text(doc->editor->scintilla, 0, text);
sci_insert_text(doc->editor->sci, 0, text);
/* sets the cursor to the right position to type the changelog text,
* the template has 21 chars + length of name and email */
sci_goto_pos(doc->editor->scintilla, 21 + strlen(template_prefs.developer) + strlen(template_prefs.mail), TRUE);
sci_goto_pos(doc->editor->sci, 21 + strlen(template_prefs.developer) + strlen(template_prefs.mail), TRUE);
g_free(text);
}
@ -1394,8 +1394,8 @@ on_comments_fileheader_activate (GtkMenuItem *menuitem,
fname = doc->file_name;
text = templates_get_template_fileheader(FILETYPE_ID(ft), fname);
sci_insert_text(doc->editor->scintilla, 0, text);
sci_goto_pos(doc->editor->scintilla, 0, FALSE);
sci_insert_text(doc->editor->sci, 0, text);
sci_goto_pos(doc->editor->sci, 0, FALSE);
g_free(text);
}
@ -1456,8 +1456,8 @@ on_insert_date_activate (GtkMenuItem *menuitem,
{
verify_click_pos(doc); /* make sure that the click_pos is valid */
sci_insert_text(doc->editor->scintilla, editor_info.click_pos, time_str);
sci_goto_pos(doc->editor->scintilla, editor_info.click_pos + strlen(time_str), FALSE);
sci_insert_text(doc->editor->sci, editor_info.click_pos, time_str);
sci_goto_pos(doc->editor->sci, editor_info.click_pos + strlen(time_str), FALSE);
}
else
{
@ -1490,10 +1490,10 @@ on_insert_include_activate (GtkMenuItem *menuitem,
text = g_strconcat("#include <", user_data, ">\n", NULL);
}
sci_insert_text(doc->editor->scintilla, editor_info.click_pos, text);
sci_insert_text(doc->editor->sci, editor_info.click_pos, text);
g_free(text);
if (pos >= 0)
sci_goto_pos(doc->editor->scintilla, pos, FALSE);
sci_goto_pos(doc->editor->sci, pos, FALSE);
}
@ -1591,7 +1591,7 @@ on_menu_select_all1_activate (GtkMenuItem *menuitem,
GeanyDocument *doc = document_get_current();
if (doc != NULL)
sci_select_all(doc->editor->scintilla);
sci_select_all(doc->editor->sci);
}
@ -1695,24 +1695,24 @@ on_menu_increase_indent1_activate (GtkMenuItem *menuitem,
if (doc == NULL)
return;
if (sci_get_lines_selected(doc->editor->scintilla) > 1)
if (sci_get_lines_selected(doc->editor->sci) > 1)
{
sci_cmd(doc->editor->scintilla, SCI_TAB);
sci_cmd(doc->editor->sci, SCI_TAB);
}
else
{
gint line, ind_pos, old_pos, new_pos, step;
old_pos = sci_get_current_position(doc->editor->scintilla);
line = sci_get_line_from_position(doc->editor->scintilla, old_pos);
ind_pos = sci_get_line_indent_position(doc->editor->scintilla, line);
old_pos = sci_get_current_position(doc->editor->sci);
line = sci_get_line_from_position(doc->editor->sci, old_pos);
ind_pos = sci_get_line_indent_position(doc->editor->sci, line);
/* when using tabs increase cur pos by 1, when using space increase it by tab_width */
step = (doc->editor->use_tabs) ? 1 : editor_prefs.tab_width;
new_pos = (old_pos > ind_pos) ? old_pos + step : old_pos;
sci_set_current_position(doc->editor->scintilla, ind_pos, TRUE);
sci_cmd(doc->editor->scintilla, SCI_TAB);
sci_set_current_position(doc->editor->scintilla, new_pos, TRUE);
sci_set_current_position(doc->editor->sci, ind_pos, TRUE);
sci_cmd(doc->editor->sci, SCI_TAB);
sci_set_current_position(doc->editor->sci, new_pos, TRUE);
}
}
@ -1725,31 +1725,31 @@ on_menu_decrease_indent1_activate (GtkMenuItem *menuitem,
if (doc == NULL)
return;
if (sci_get_lines_selected(doc->editor->scintilla) > 1)
if (sci_get_lines_selected(doc->editor->sci) > 1)
{
sci_cmd(doc->editor->scintilla, SCI_BACKTAB);
sci_cmd(doc->editor->sci, SCI_BACKTAB);
}
else
{
gint line, ind_pos, old_pos, new_pos, step, indent;
old_pos = sci_get_current_position(doc->editor->scintilla);
line = sci_get_line_from_position(doc->editor->scintilla, old_pos);
ind_pos = sci_get_line_indent_position(doc->editor->scintilla, line);
old_pos = sci_get_current_position(doc->editor->sci);
line = sci_get_line_from_position(doc->editor->sci, old_pos);
ind_pos = sci_get_line_indent_position(doc->editor->sci, line);
step = (doc->editor->use_tabs) ? 1 : editor_prefs.tab_width;
new_pos = (old_pos >= ind_pos) ? old_pos - step : old_pos;
if (ind_pos == sci_get_position_from_line(doc->editor->scintilla, line))
if (ind_pos == sci_get_position_from_line(doc->editor->sci, line))
return;
sci_set_current_position(doc->editor->scintilla, ind_pos, TRUE);
indent = sci_get_line_indentation(doc->editor->scintilla, line);
sci_set_current_position(doc->editor->sci, ind_pos, TRUE);
indent = sci_get_line_indentation(doc->editor->sci, line);
indent -= editor_prefs.tab_width;
if (indent < 0)
indent = 0;
sci_set_line_indentation(doc->editor->scintilla, line, indent);
sci_set_line_indentation(doc->editor->sci, line, indent);
sci_set_current_position(doc->editor->scintilla, new_pos, TRUE);
sci_set_current_position(doc->editor->sci, new_pos, TRUE);
}
}
@ -1923,8 +1923,8 @@ on_remove_markers1_activate (GtkMenuItem *menuitem,
if (doc == NULL)
return;
sci_marker_delete_all(doc->editor->scintilla, 0); /* delete the yellow tag marker */
sci_marker_delete_all(doc->editor->scintilla, 1); /* delete user markers */
sci_marker_delete_all(doc->editor->sci, 0); /* delete the yellow tag marker */
sci_marker_delete_all(doc->editor->sci, 1); /* delete user markers */
}
@ -1947,10 +1947,10 @@ on_context_action1_activate (GtkMenuItem *menuitem,
if (doc == NULL)
return;
if (sci_can_copy(doc->editor->scintilla))
if (sci_can_copy(doc->editor->sci))
{ /* take selected text if there is a selection */
word = g_malloc(sci_get_selected_text_length(doc->editor->scintilla) + 1);
sci_get_selected_text(doc->editor->scintilla, word);
word = g_malloc(sci_get_selected_text_length(doc->editor->sci) + 1);
sci_get_selected_text(doc->editor->sci, word);
}
else
{

View File

@ -192,7 +192,7 @@ GeanyDocument *document_find_by_sci(ScintillaObject *sci)
for (i = 0; i < documents_array->len; i++)
{
if (documents[i]->is_valid && documents[i]->editor->scintilla == sci)
if (documents[i]->is_valid && documents[i]->editor->sci == sci)
return documents[i];
}
return NULL;
@ -206,7 +206,7 @@ gint document_get_notebook_page(GeanyDocument *doc)
return -1;
return gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook),
GTK_WIDGET(doc->editor->scintilla));
GTK_WIDGET(doc->editor->sci));
}
@ -296,7 +296,7 @@ void document_apply_update_prefs(GeanyDocument *doc)
g_return_if_fail(doc != NULL);
sci = doc->editor->scintilla;
sci = doc->editor->sci;
sci_set_mark_long_lines(sci, editor_prefs.long_line_type,
editor_prefs.long_line_column, editor_prefs.long_line_color);
@ -376,7 +376,7 @@ static void queue_colourise(GeanyDocument *doc)
* document), we need to force a redraw, so the expose event is triggered.
* This ensures we don't start colourising before all documents are opened/saved,
* only once the editor is drawn. */
gtk_widget_queue_draw(GTK_WIDGET(doc->editor->scintilla));
gtk_widget_queue_draw(GTK_WIDGET(doc->editor->sci));
}
@ -546,21 +546,21 @@ GeanyDocument *document_new_file(const gchar *filename, GeanyFiletype *ft, const
g_assert(doc != NULL);
sci_set_undo_collection(doc->editor->scintilla, FALSE); /* avoid creation of an undo action */
sci_set_undo_collection(doc->editor->sci, FALSE); /* avoid creation of an undo action */
if (text)
sci_set_text(doc->editor->scintilla, text);
sci_set_text(doc->editor->sci, text);
else
sci_clear_all(doc->editor->scintilla);
sci_clear_all(doc->editor->sci);
sci_set_eol_mode(doc->editor->scintilla, file_prefs.default_eol_character);
sci_set_eol_mode(doc->editor->sci, file_prefs.default_eol_character);
/* convert the eol chars in the template text in case they are different from
* from file_prefs.default_eol */
if (text != NULL)
sci_convert_eols(doc->editor->scintilla, file_prefs.default_eol_character);
sci_convert_eols(doc->editor->sci, file_prefs.default_eol_character);
editor_set_use_tabs(doc->editor, editor_prefs.use_tabs);
sci_set_undo_collection(doc->editor->scintilla, TRUE);
sci_empty_undo_buffer(doc->editor->scintilla);
sci_set_undo_collection(doc->editor->sci, TRUE);
sci_empty_undo_buffer(doc->editor->sci);
doc->mtime = time(NULL);
@ -574,18 +574,18 @@ GeanyDocument *document_new_file(const gchar *filename, GeanyFiletype *ft, const
document_set_filetype(doc, ft); /* also clears taglist */
if (ft == NULL)
highlighting_set_styles(doc->editor->scintilla, GEANY_FILETYPES_NONE);
highlighting_set_styles(doc->editor->sci, GEANY_FILETYPES_NONE);
ui_set_window_title(doc);
build_menu_update(doc);
document_update_tag_list(doc, FALSE);
document_set_text_changed(doc, FALSE);
ui_document_show_hide(doc); /* update the document menu */
sci_set_line_numbers(doc->editor->scintilla, editor_prefs.show_linenumber_margin, 0);
sci_goto_pos(doc->editor->scintilla, 0, TRUE);
sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
sci_goto_pos(doc->editor->sci, 0, TRUE);
/* "the" SCI signal (connect after initial setup(i.e. adding text)) */
g_signal_connect((GtkWidget*) doc->editor->scintilla, "sci-notify", G_CALLBACK(on_editor_notification), doc);
g_signal_connect((GtkWidget*) doc->editor->sci, "sci-notify", G_CALLBACK(on_editor_notification), doc);
if (geany_object)
{
@ -850,20 +850,20 @@ static void set_cursor_position(GeanyEditor *editor, gint pos)
{
if (cl_options.goto_line >= 0)
{ /* goto line which was specified on command line and then undefine the line */
sci_goto_line(editor->scintilla, cl_options.goto_line - 1, TRUE);
sci_goto_line(editor->sci, cl_options.goto_line - 1, TRUE);
editor->scroll_percent = 0.5F;
cl_options.goto_line = -1;
}
else if (pos > 0)
{
sci_set_current_position(editor->scintilla, pos, FALSE);
sci_set_current_position(editor->sci, pos, FALSE);
editor->scroll_percent = 0.5F;
}
if (cl_options.goto_column >= 0)
{ /* goto column which was specified on command line and then undefine the column */
gint cur_pos = sci_get_current_position(editor->scintilla);
sci_set_current_position(editor->scintilla, cur_pos + cl_options.goto_column, FALSE);
gint cur_pos = sci_get_current_position(editor->sci);
sci_set_current_position(editor->sci, cur_pos + cl_options.goto_column, FALSE);
editor->scroll_percent = 0.5F;
cl_options.goto_column = -1;
}
@ -911,7 +911,7 @@ static void set_indentation(GeanyDocument *doc)
editor_set_use_tabs(doc->editor, editor_prefs.use_tabs);
else
{ /* detect & set tabs/spaces */
gboolean use_tabs = detect_use_tabs(doc->editor->scintilla);
gboolean use_tabs = detect_use_tabs(doc->editor->sci);
if (use_tabs != editor_prefs.use_tabs)
ui_set_statusbar(TRUE, _("Setting %s indentation mode."),
@ -970,7 +970,7 @@ GeanyDocument *document_open_file_full(GeanyDocument *doc, const gchar *filename
ui_add_recent_file(utf8_filename); /* either add or reorder recent item */
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook),
(GtkWidget*) doc->editor->scintilla));
(GtkWidget*) doc->editor->sci));
g_free(utf8_filename);
g_free(locale_filename);
document_check_disk_status(doc, TRUE); /* force a file changed check */
@ -993,20 +993,20 @@ GeanyDocument *document_open_file_full(GeanyDocument *doc, const gchar *filename
if (! reload) doc = document_create(utf8_filename);
g_return_val_if_fail(doc != NULL, NULL); /* really should not happen */
sci_set_undo_collection(doc->editor->scintilla, FALSE); /* avoid creation of an undo action */
sci_empty_undo_buffer(doc->editor->scintilla);
sci_set_undo_collection(doc->editor->sci, FALSE); /* avoid creation of an undo action */
sci_empty_undo_buffer(doc->editor->sci);
/* add the text to the ScintillaObject */
sci_set_readonly(doc->editor->scintilla, FALSE); /* to allow replacing text */
sci_set_text(doc->editor->scintilla, filedata.data); /* NULL terminated data */
sci_set_readonly(doc->editor->sci, FALSE); /* to allow replacing text */
sci_set_text(doc->editor->sci, filedata.data); /* NULL terminated data */
queue_colourise(doc); /* Ensure the document gets colourised. */
/* detect & set line endings */
editor_mode = utils_get_line_endings(filedata.data, filedata.len);
sci_set_eol_mode(doc->editor->scintilla, editor_mode);
sci_set_eol_mode(doc->editor->sci, editor_mode);
g_free(filedata.data);
sci_set_undo_collection(doc->editor->scintilla, TRUE);
sci_set_undo_collection(doc->editor->sci, TRUE);
doc->mtime = filedata.mtime; /* get the modification time from file and keep it */
g_free(doc->encoding); /* if reloading, free old encoding */
@ -1015,10 +1015,10 @@ GeanyDocument *document_open_file_full(GeanyDocument *doc, const gchar *filename
store_saved_encoding(doc); /* store the opened encoding for undo/redo */
doc->readonly = readonly || filedata.readonly;
sci_set_readonly(doc->editor->scintilla, doc->readonly);
sci_set_readonly(doc->editor->sci, doc->readonly);
/* update line number margin width */
sci_set_line_numbers(doc->editor->scintilla, editor_prefs.show_linenumber_margin, 0);
sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
/* set the cursor position according to pos, cl_options.goto_line and cl_options.goto_column */
set_cursor_position(doc->editor, pos);
@ -1030,7 +1030,7 @@ GeanyDocument *document_open_file_full(GeanyDocument *doc, const gchar *filename
doc->real_path = get_real_path_from_utf8(doc->file_name);
/* "the" SCI signal (connect after initial setup(i.e. adding text)) */
g_signal_connect((GtkWidget*) doc->editor->scintilla, "sci-notify",
g_signal_connect((GtkWidget*) doc->editor->sci, "sci-notify",
G_CALLBACK(on_editor_notification), doc);
use_ft = (ft != NULL) ? ft : filetypes_detect_from_file(doc);
@ -1149,7 +1149,7 @@ gboolean document_reload_file(GeanyDocument *doc, const gchar *forced_enc)
return FALSE;
/* try to set the cursor to the position before reloading */
pos = sci_get_current_position(doc->editor->scintilla);
pos = sci_get_current_position(doc->editor->sci);
new_doc = document_open_file_full(doc, NULL, pos, doc->readonly,
doc->file_type, forced_enc);
return (new_doc != NULL);
@ -1186,8 +1186,8 @@ static void get_line_column_from_pos(GeanyDocument *doc, guint byte_pos, gint *l
gint line_start;
/* for some reason we can use byte count instead of character count here */
*line = sci_get_line_from_position(doc->editor->scintilla, byte_pos);
line_start = sci_get_position_from_line(doc->editor->scintilla, *line);
*line = sci_get_line_from_position(doc->editor->sci, byte_pos);
line_start = sci_get_position_from_line(doc->editor->sci, *line);
/* get the column in the line */
*column = byte_pos - line_start;
@ -1195,7 +1195,7 @@ static void get_line_column_from_pos(GeanyDocument *doc, guint byte_pos, gint *l
* skip one byte(i++) and decrease the column number which is based on byte count */
for (i = line_start; i < (line_start + *column); i++)
{
if (sci_get_char_at(doc->editor->scintilla, i) < 0)
if (sci_get_char_at(doc->editor->sci, i) < 0)
{
(*column)--;
i++;
@ -1217,14 +1217,14 @@ static void replace_header_filename(GeanyDocument *doc)
/* only search the first 3 lines */
ttf.chrg.cpMin = 0;
ttf.chrg.cpMax = sci_get_position_from_line(doc->editor->scintilla, 3);
ttf.chrg.cpMax = sci_get_position_from_line(doc->editor->sci, 3);
ttf.lpstrText = (gchar*)filebase;
if (sci_find_text(doc->editor->scintilla, SCFIND_MATCHCASE, &ttf) != -1)
if (sci_find_text(doc->editor->sci, SCFIND_MATCHCASE, &ttf) != -1)
{
sci_target_start(doc->editor->scintilla, ttf.chrgText.cpMin);
sci_target_end(doc->editor->scintilla, ttf.chrgText.cpMax);
sci_target_replace(doc->editor->scintilla, filename, FALSE);
sci_target_start(doc->editor->sci, ttf.chrgText.cpMin);
sci_target_end(doc->editor->sci, ttf.chrgText.cpMax);
sci_target_replace(doc->editor->sci, filename, FALSE);
}
g_free(filebase);
@ -1305,7 +1305,7 @@ _("An error occurred while converting the file from UTF-8 in \"%s\". The file re
/* don't read over the doc length */
gint max_len = MIN((gint)bytes_read + 6, (gint)*len - 1);
context = g_malloc(7); /* read 6 bytes from Sci + '\0' */
sci_get_text_range(doc->editor->scintilla, bytes_read, max_len, context);
sci_get_text_range(doc->editor->sci, bytes_read, max_len, context);
/* take only one valid Unicode character from the context and discard the leftover */
unic = g_utf8_get_char_validated(context, -1);
@ -1410,7 +1410,7 @@ gboolean document_save_file(GeanyDocument *doc, gboolean force)
if (file_prefs.final_new_line)
editor_ensure_final_newline(doc);
len = sci_get_length(doc->editor->scintilla) + 1;
len = sci_get_length(doc->editor->sci) + 1;
if (doc->has_bom && encodings_is_unicode_charset(doc->encoding))
{ /* always write a UTF-8 BOM because in this moment the text itself is still in UTF-8
* encoding, it will be converted to doc->encoding below and this conversion
@ -1419,13 +1419,13 @@ gboolean document_save_file(GeanyDocument *doc, gboolean force)
data[0] = (gchar) 0xef;
data[1] = (gchar) 0xbb;
data[2] = (gchar) 0xbf;
sci_get_text(doc->editor->scintilla, len, data + 3);
sci_get_text(doc->editor->sci, len, data + 3);
len += 3;
}
else
{
data = (gchar*) g_malloc(len);
sci_get_text(doc->editor->scintilla, len, data);
sci_get_text(doc->editor->sci, len, data);
}
/* save in original encoding, skip when it is already UTF-8 or has the encoding "None" */
@ -1470,8 +1470,8 @@ gboolean document_save_file(GeanyDocument *doc, gboolean force)
/* set line numbers again, to reset the margin width, if
* there are more lines than before */
sci_set_line_numbers(doc->editor->scintilla, editor_prefs.show_linenumber_margin, 0);
sci_set_savepoint(doc->editor->scintilla);
sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
sci_set_savepoint(doc->editor->sci);
/* stat the file to get the timestamp, otherwise on Windows the actual
* timestamp can be ahead of time(NULL) */
@ -1515,38 +1515,38 @@ gboolean document_search_bar_find(GeanyDocument *doc, const gchar *text, gint fl
if (! *text)
return TRUE;
start_pos = (inc) ? sci_get_selection_start(doc->editor->scintilla) :
sci_get_selection_end(doc->editor->scintilla); /* equal if no selection */
start_pos = (inc) ? sci_get_selection_start(doc->editor->sci) :
sci_get_selection_end(doc->editor->sci); /* equal if no selection */
/* search cursor to end */
ttf.chrg.cpMin = start_pos;
ttf.chrg.cpMax = sci_get_length(doc->editor->scintilla);
ttf.chrg.cpMax = sci_get_length(doc->editor->sci);
ttf.lpstrText = (gchar *)text;
search_pos = sci_find_text(doc->editor->scintilla, flags, &ttf);
search_pos = sci_find_text(doc->editor->sci, flags, &ttf);
/* if no match, search start to cursor */
if (search_pos == -1)
{
ttf.chrg.cpMin = 0;
ttf.chrg.cpMax = start_pos + strlen(text);
search_pos = sci_find_text(doc->editor->scintilla, flags, &ttf);
search_pos = sci_find_text(doc->editor->sci, flags, &ttf);
}
if (search_pos != -1)
{
gint line = sci_get_line_from_position(doc->editor->scintilla, ttf.chrgText.cpMin);
gint line = sci_get_line_from_position(doc->editor->sci, ttf.chrgText.cpMin);
/* unfold maybe folded results */
sci_ensure_line_is_visible(doc->editor->scintilla, line);
sci_ensure_line_is_visible(doc->editor->sci, line);
sci_set_selection_start(doc->editor->scintilla, ttf.chrgText.cpMin);
sci_set_selection_end(doc->editor->scintilla, ttf.chrgText.cpMax);
sci_set_selection_start(doc->editor->sci, ttf.chrgText.cpMin);
sci_set_selection_end(doc->editor->sci, ttf.chrgText.cpMax);
if (! editor_line_in_view(doc->editor->scintilla, line))
if (! editor_line_in_view(doc->editor->sci, line))
{ /* we need to force scrolling in case the cursor is outside of the current visible area
* GeanyDocument::scroll_percent doesn't work because sci isn't always updated
* while searching */
editor_scroll_to_line(doc->editor->scintilla, -1, 0.3F);
editor_scroll_to_line(doc->editor->sci, -1, 0.3F);
}
return TRUE;
}
@ -1557,7 +1557,7 @@ gboolean document_search_bar_find(GeanyDocument *doc, const gchar *text, gint fl
ui_set_statusbar(FALSE, _("\"%s\" was not found."), text);
}
utils_beep();
sci_goto_pos(doc->editor->scintilla, start_pos, FALSE); /* clear selection */
sci_goto_pos(doc->editor->sci, start_pos, FALSE); /* clear selection */
return FALSE;
}
}
@ -1577,33 +1577,33 @@ gint document_find_text(GeanyDocument *doc, const gchar *text, gint flags, gbool
if (flags & SCFIND_REGEXP)
search_backwards = FALSE;
selection_start = sci_get_selection_start(doc->editor->scintilla);
selection_end = sci_get_selection_end(doc->editor->scintilla);
selection_start = sci_get_selection_start(doc->editor->sci);
selection_end = sci_get_selection_end(doc->editor->sci);
if ((selection_end - selection_start) > 0)
{ /* there's a selection so go to the end */
if (search_backwards)
sci_goto_pos(doc->editor->scintilla, selection_start, TRUE);
sci_goto_pos(doc->editor->sci, selection_start, TRUE);
else
sci_goto_pos(doc->editor->scintilla, selection_end, TRUE);
sci_goto_pos(doc->editor->sci, selection_end, TRUE);
}
sci_set_search_anchor(doc->editor->scintilla);
sci_set_search_anchor(doc->editor->sci);
if (search_backwards)
search_pos = sci_search_prev(doc->editor->scintilla, flags, text);
search_pos = sci_search_prev(doc->editor->sci, flags, text);
else
search_pos = sci_search_next(doc->editor->scintilla, flags, text);
search_pos = sci_search_next(doc->editor->sci, flags, text);
if (search_pos != -1)
{
/* unfold maybe folded results */
sci_ensure_line_is_visible(doc->editor->scintilla,
sci_get_line_from_position(doc->editor->scintilla, search_pos));
sci_ensure_line_is_visible(doc->editor->sci,
sci_get_line_from_position(doc->editor->sci, search_pos));
if (scroll)
doc->editor->scroll_percent = 0.3F;
}
else
{
gint sci_len = sci_get_length(doc->editor->scintilla);
gint sci_len = sci_get_length(doc->editor->sci);
/* if we just searched the whole text, give up searching. */
if ((selection_end == 0 && ! search_backwards) ||
@ -1621,11 +1621,11 @@ gint document_find_text(GeanyDocument *doc, const gchar *text, gint flags, gbool
{
gint ret;
sci_set_current_position(doc->editor->scintilla, (search_backwards) ? sci_len : 0, FALSE);
sci_set_current_position(doc->editor->sci, (search_backwards) ? sci_len : 0, FALSE);
ret = document_find_text(doc, text, flags, search_backwards, scroll, parent);
if (ret == -1)
{ /* return to original cursor position if not found */
sci_set_current_position(doc->editor->scintilla, selection_start, FALSE);
sci_set_current_position(doc->editor->sci, selection_start, FALSE);
}
return ret;
}
@ -1648,8 +1648,8 @@ gint document_replace_text(GeanyDocument *doc, const gchar *find_text, const gch
if (flags & SCFIND_REGEXP)
search_backwards = FALSE;
selection_start = sci_get_selection_start(doc->editor->scintilla);
selection_end = sci_get_selection_end(doc->editor->scintilla);
selection_start = sci_get_selection_start(doc->editor->sci);
selection_end = sci_get_selection_end(doc->editor->sci);
if (selection_end == selection_start)
{
/* no selection so just find the next match */
@ -1659,9 +1659,9 @@ gint document_replace_text(GeanyDocument *doc, const gchar *find_text, const gch
/* there's a selection so go to the start before finding to search through it
* this ensures there is a match */
if (search_backwards)
sci_goto_pos(doc->editor->scintilla, selection_end, TRUE);
sci_goto_pos(doc->editor->sci, selection_end, TRUE);
else
sci_goto_pos(doc->editor->scintilla, selection_start, TRUE);
sci_goto_pos(doc->editor->sci, selection_start, TRUE);
search_pos = document_find_text(doc, find_text, flags, search_backwards, TRUE, NULL);
/* return if the original selected text did not match (at the start of the selection) */
@ -1672,11 +1672,11 @@ gint document_replace_text(GeanyDocument *doc, const gchar *find_text, const gch
{
gint replace_len;
/* search next/prev will select matching text, which we use to set the replace target */
sci_target_from_selection(doc->editor->scintilla);
replace_len = sci_target_replace(doc->editor->scintilla, replace_text, flags & SCFIND_REGEXP);
sci_target_from_selection(doc->editor->sci);
replace_len = sci_target_replace(doc->editor->sci, replace_text, flags & SCFIND_REGEXP);
/* select the replacement - find text will skip past the selected text */
sci_set_selection_start(doc->editor->scintilla, search_pos);
sci_set_selection_end(doc->editor->scintilla, search_pos + replace_len);
sci_set_selection_start(doc->editor->sci, search_pos);
sci_set_selection_end(doc->editor->sci, search_pos + replace_len);
}
else
{
@ -1741,7 +1741,7 @@ document_replace_range(GeanyDocument *doc, const gchar *find_text, const gchar *
g_return_val_if_fail(doc != NULL && find_text != NULL && replace_text != NULL, 0);
if (! *find_text || doc->readonly) return 0;
sci = doc->editor->scintilla;
sci = doc->editor->sci;
sci_start_undo_action(sci);
ttf.chrg.cpMin = start;
@ -1815,8 +1815,8 @@ void document_replace_sel(GeanyDocument *doc, const gchar *find_text, const gcha
g_return_if_fail(doc != NULL && find_text != NULL && replace_text != NULL);
if (! *find_text) return;
selection_start = sci_get_selection_start(doc->editor->scintilla);
selection_end = sci_get_selection_end(doc->editor->scintilla);
selection_start = sci_get_selection_start(doc->editor->sci);
selection_end = sci_get_selection_end(doc->editor->sci);
/* do we have a selection? */
if ((selection_end - selection_start) == 0)
{
@ -1824,24 +1824,24 @@ void document_replace_sel(GeanyDocument *doc, const gchar *find_text, const gcha
return;
}
selection_mode = sci_get_selection_mode(doc->editor->scintilla);
selected_lines = sci_get_lines_selected(doc->editor->scintilla);
selection_mode = sci_get_selection_mode(doc->editor->sci);
selected_lines = sci_get_lines_selected(doc->editor->sci);
/* handle rectangle, multi line selections (it doesn't matter on a single line) */
if (selection_mode == SC_SEL_RECTANGLE && selected_lines > 1)
{
gint first_line, line;
sci_start_undo_action(doc->editor->scintilla);
sci_start_undo_action(doc->editor->sci);
first_line = sci_get_line_from_position(doc->editor->scintilla, selection_start);
first_line = sci_get_line_from_position(doc->editor->sci, selection_start);
/* Find the last line with chars selected (not EOL char) */
last_line = sci_get_line_from_position(doc->editor->scintilla,
last_line = sci_get_line_from_position(doc->editor->sci,
selection_end - editor_get_eol_char_len(doc));
last_line = MAX(first_line, last_line);
for (line = first_line; line < (first_line + selected_lines); line++)
{
gint line_start = sci_get_pos_at_line_sel_start(doc->editor->scintilla, line);
gint line_end = sci_get_pos_at_line_sel_end(doc->editor->scintilla, line);
gint line_start = sci_get_pos_at_line_sel_start(doc->editor->sci, line);
gint line_end = sci_get_pos_at_line_sel_end(doc->editor->sci, line);
/* skip line if there is no selection */
if (line_start != INVALID_POSITION)
@ -1856,11 +1856,11 @@ void document_replace_sel(GeanyDocument *doc, const gchar *find_text, const gcha
replaced = TRUE;
/* this gets the greatest column within the selection after replacing */
max_column = MAX(max_column,
new_sel_end - sci_get_position_from_line(doc->editor->scintilla, line));
new_sel_end - sci_get_position_from_line(doc->editor->sci, line));
}
}
}
sci_end_undo_action(doc->editor->scintilla);
sci_end_undo_action(doc->editor->sci);
}
else /* handle normal line selection */
{
@ -1876,26 +1876,26 @@ void document_replace_sel(GeanyDocument *doc, const gchar *find_text, const gcha
if (selection_mode == SC_SEL_RECTANGLE && selected_lines > 1)
{
/* now we can scroll to the selection and destroy it because we rebuild it later */
/*sci_goto_pos(doc->editor->scintilla, selection_start, FALSE);*/
/*sci_goto_pos(doc->editor->sci, selection_start, FALSE);*/
/* Note: the selection will be wrapped to last_line + 1 if max_column is greater than
* the highest column on the last line. The wrapped selection is completely different
* from the original one, so skip the selection at all */
/* TODO is there a better way to handle the wrapped selection? */
if ((sci_get_line_length(doc->editor->scintilla, last_line) - 1) >= max_column)
if ((sci_get_line_length(doc->editor->sci, last_line) - 1) >= max_column)
{ /* for keeping and adjusting the selection in multi line rectangle selection we
* need the last line of the original selection and the greatest column number after
* replacing and set the selection end to the last line at the greatest column */
sci_set_selection_start(doc->editor->scintilla, selection_start);
sci_set_selection_end(doc->editor->scintilla,
sci_get_position_from_line(doc->editor->scintilla, last_line) + max_column);
sci_set_selection_mode(doc->editor->scintilla, selection_mode);
sci_set_selection_start(doc->editor->sci, selection_start);
sci_set_selection_end(doc->editor->sci,
sci_get_position_from_line(doc->editor->sci, last_line) + max_column);
sci_set_selection_mode(doc->editor->sci, selection_mode);
}
}
else
{
sci_set_selection_start(doc->editor->scintilla, selection_start);
sci_set_selection_end(doc->editor->scintilla, selection_end);
sci_set_selection_start(doc->editor->sci, selection_start);
sci_set_selection_end(doc->editor->sci, selection_end);
}
}
else /* no replacements */
@ -1913,7 +1913,7 @@ gboolean document_replace_all(GeanyDocument *doc, const gchar *find_text, const
g_return_val_if_fail(doc != NULL && find_text != NULL && replace_text != NULL, FALSE);
if (! *find_text) return FALSE;
len = sci_get_length(doc->editor->scintilla);
len = sci_get_length(doc->editor->sci);
count = document_replace_range(
doc, find_text, replace_text, flags, 0, len, TRUE, NULL);
@ -2016,7 +2016,7 @@ static gboolean update_type_keywords(GeanyDocument *doc, gint lang)
gboolean ret = FALSE;
guint n;
const GString *s;
ScintillaObject *sci = doc ? doc->editor->scintilla : NULL;
ScintillaObject *sci = doc ? doc->editor->sci : NULL;
if (sci != NULL && editor_lexer_get_type_keyword_idx(sci_get_lexer(sci)) == -1)
return FALSE;
@ -2038,7 +2038,7 @@ static gboolean update_type_keywords(GeanyDocument *doc, gint lang)
{
if (documents[n]->is_valid)
{
ScintillaObject *wid = documents[n]->editor->scintilla;
ScintillaObject *wid = documents[n]->editor->sci;
gint keyword_idx = editor_lexer_get_type_keyword_idx(sci_get_lexer(wid));
if (keyword_idx > 0)
@ -2079,7 +2079,7 @@ void document_set_filetype(GeanyDocument *doc, GeanyFiletype *type)
tm_workspace_remove_object(doc->tm_file, TRUE, TRUE);
doc->tm_file = NULL;
}
highlighting_set_styles(doc->editor->scintilla, type->id);
highlighting_set_styles(doc->editor->sci, type->id);
build_menu_update(doc);
queue_colourise(doc);
}
@ -2192,7 +2192,7 @@ gboolean document_can_undo(GeanyDocument *doc)
if (doc == NULL)
return FALSE;
if (g_trash_stack_height(&fdoc->undo_actions) > 0 || sci_can_undo(doc->editor->scintilla))
if (g_trash_stack_height(&fdoc->undo_actions) > 0 || sci_can_undo(doc->editor->sci))
return TRUE;
else
return FALSE;
@ -2204,7 +2204,7 @@ static void update_changed_state(GeanyDocument *doc)
Document *fdoc = DOCUMENT(doc);
doc->changed =
(sci_is_modified(doc->editor->scintilla) ||
(sci_is_modified(doc->editor->sci) ||
doc->has_bom != fdoc->saved_encoding.has_bom ||
! utils_str_equal(doc->encoding, fdoc->saved_encoding.encoding));
document_set_text_changed(doc, doc->changed);
@ -2225,7 +2225,7 @@ void document_undo(GeanyDocument *doc)
{
/* fallback, should not be necessary */
geany_debug("%s: fallback used", __func__);
sci_undo(doc->editor->scintilla);
sci_undo(doc->editor->sci);
}
else
{
@ -2235,7 +2235,7 @@ void document_undo(GeanyDocument *doc)
{
document_redo_add(doc, UNDO_SCINTILLA, NULL);
sci_undo(doc->editor->scintilla);
sci_undo(doc->editor->sci);
break;
}
case UNDO_BOM:
@ -2279,7 +2279,7 @@ gboolean document_can_redo(GeanyDocument *doc)
if (doc == NULL)
return FALSE;
if (g_trash_stack_height(&fdoc->redo_actions) > 0 || sci_can_redo(doc->editor->scintilla))
if (g_trash_stack_height(&fdoc->redo_actions) > 0 || sci_can_redo(doc->editor->sci))
return TRUE;
else
return FALSE;
@ -2300,7 +2300,7 @@ void document_redo(GeanyDocument *doc)
{
/* fallback, should not be necessary */
geany_debug("%s: fallback used", __func__);
sci_redo(doc->editor->scintilla);
sci_redo(doc->editor->sci);
}
else
{
@ -2310,7 +2310,7 @@ void document_redo(GeanyDocument *doc)
{
document_undo_add(doc, UNDO_SCINTILLA, NULL);
sci_redo(doc->editor->scintilla);
sci_redo(doc->editor->sci);
break;
}
case UNDO_BOM:
@ -2402,9 +2402,9 @@ GeanyDocument *document_clone(GeanyDocument *old_doc, const gchar *utf8_filename
gchar *text;
GeanyDocument *doc;
len = sci_get_length(old_doc->editor->scintilla) + 1;
len = sci_get_length(old_doc->editor->sci) + 1;
text = (gchar*) g_malloc(len);
sci_get_text(old_doc->editor->scintilla, len, text);
sci_get_text(old_doc->editor->sci, len, text);
/* use old file type (or maybe NULL for auto detect would be better?) */
doc = document_new_file(utf8_filename, old_doc->file_type, text);
g_free(text);
@ -2414,8 +2414,8 @@ GeanyDocument *document_clone(GeanyDocument *old_doc, const gchar *utf8_filename
doc->readonly = old_doc->readonly;
doc->has_bom = old_doc->has_bom;
document_set_encoding(doc, old_doc->encoding);
sci_set_lines_wrapped(doc->editor->scintilla, doc->editor->line_wrapping);
sci_set_readonly(doc->editor->scintilla, doc->readonly);
sci_set_lines_wrapped(doc->editor->sci, doc->editor->line_wrapping);
sci_set_readonly(doc->editor->sci, doc->readonly);
ui_document_show_hide(doc);
return doc;

File diff suppressed because it is too large Load Diff

View File

@ -102,13 +102,13 @@ extern GeanyEditorPrefs editor_prefs;
/** Editor-owned fields for each document. */
typedef struct GeanyEditor
{
GeanyDocument *document; /**< The document associated with the editor. */
ScintillaObject *scintilla; /**< The Scintilla editor @c GtkWidget. */
GeanyDocument *document; /**< The document associated with the editor. */
ScintillaObject *sci; /**< The Scintilla editor @c GtkWidget. */
gboolean line_wrapping; /**< @c TRUE if line wrapping is enabled. */
gboolean auto_indent; /**< @c TRUE if auto-indentation is enabled. */
/** Percentage to scroll view by on paint, if positive. */
gfloat scroll_percent;
gboolean use_tabs; /**< @c TRUE if tabs are used for indentation. */
gboolean use_tabs; /**< @c TRUE if tabs are used for indentation. */
gboolean line_breaking; /**< Whether to split long lines as you type. */
}
GeanyEditor;

View File

@ -667,7 +667,7 @@ GeanyFiletype *filetypes_detect_from_file(GeanyDocument *doc)
if (doc == NULL)
return filetypes[GEANY_FILETYPES_NONE];
line = sci_get_line(doc->editor->scintilla, 0);
line = sci_get_line(doc->editor->sci, 0);
ft = filetypes_detect_from_file_internal(doc->file_name, line);
g_free(line);
return ft;

View File

@ -816,9 +816,9 @@ static gboolean check_snippet_completion(guint keyval, guint state)
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
/* keybinding only valid when scintilla widget has focus */
if (doc != NULL && focusw == GTK_WIDGET(doc->editor->scintilla))
if (doc != NULL && focusw == GTK_WIDGET(doc->editor->sci))
{
ScintillaObject *sci = doc->editor->scintilla;
ScintillaObject *sci = doc->editor->sci;
gint pos = sci_get_current_position(sci);
if (editor_prefs.complete_snippets)
@ -1174,9 +1174,9 @@ static gboolean check_current_word(void)
if (doc == NULL)
return FALSE;
pos = sci_get_current_position(doc->editor->scintilla);
pos = sci_get_current_position(doc->editor->sci);
editor_find_current_word(doc->editor->scintilla, pos,
editor_find_current_word(doc->editor->sci, pos,
editor_info.current_word, GEANY_MAX_WORD_LENGTH, NULL);
if (*editor_info.current_word == 0)
@ -1209,7 +1209,7 @@ static void cb_func_switch_action(guint key_id)
{
GeanyDocument *doc = document_get_current();
if (doc != NULL)
gtk_widget_grab_focus(GTK_WIDGET(doc->editor->scintilla));
gtk_widget_grab_focus(GTK_WIDGET(doc->editor->sci));
break;
}
case GEANY_KEYS_FOCUS_SCRIBBLE:
@ -1284,7 +1284,7 @@ static void cb_func_move_tab(guint key_id)
if (doc == NULL)
return;
sci = GTK_WIDGET(doc->editor->scintilla);
sci = GTK_WIDGET(doc->editor->sci);
switch (key_id)
{
@ -1329,14 +1329,14 @@ static void goto_matching_brace(GeanyDocument *doc)
if (doc == NULL)
return;
pos = sci_get_current_position(doc->editor->scintilla);
if (! utils_isbrace(sci_get_char_at(doc->editor->scintilla, pos), TRUE))
pos = sci_get_current_position(doc->editor->sci);
if (! utils_isbrace(sci_get_char_at(doc->editor->sci, pos), TRUE))
pos--; /* set pos to the brace */
new_pos = sci_find_bracematch(doc->editor->scintilla, pos);
new_pos = sci_find_bracematch(doc->editor->sci, pos);
if (new_pos != -1)
{ /* set the cursor at the brace */
sci_set_current_position(doc->editor->scintilla, new_pos, FALSE);
sci_set_current_position(doc->editor->sci, new_pos, FALSE);
editor_display_current_line(doc->editor, 0.5F);
}
}
@ -1361,10 +1361,10 @@ static void cb_func_clipboard(guint key_id)
on_paste1_activate(NULL, NULL);
break;
case GEANY_KEYS_CLIPBOARD_COPYLINE:
sci_cmd(doc->editor->scintilla, SCI_LINECOPY);
sci_cmd(doc->editor->sci, SCI_LINECOPY);
break;
case GEANY_KEYS_CLIPBOARD_CUTLINE:
sci_cmd(doc->editor->scintilla, SCI_LINECUT);
sci_cmd(doc->editor->sci, SCI_LINECUT);
break;
}
}
@ -1379,7 +1379,7 @@ static void cb_func_goto_action(guint key_id)
if (doc == NULL)
return;
cur_line = sci_get_current_line(doc->editor->scintilla);
cur_line = sci_get_current_line(doc->editor->sci);
switch (key_id)
{
@ -1397,29 +1397,29 @@ static void cb_func_goto_action(guint key_id)
return;
case GEANY_KEYS_GOTO_TOGGLEMARKER:
{
gboolean set = sci_is_marker_set_at_line(doc->editor->scintilla, cur_line, 1);
gboolean set = sci_is_marker_set_at_line(doc->editor->sci, cur_line, 1);
sci_set_marker_at_line(doc->editor->scintilla, cur_line, ! set, 1);
sci_set_marker_at_line(doc->editor->sci, cur_line, ! set, 1);
return;
}
case GEANY_KEYS_GOTO_NEXTMARKER:
{
gint mline = sci_marker_next(doc->editor->scintilla, cur_line + 1, 1 << 1, TRUE);
gint mline = sci_marker_next(doc->editor->sci, cur_line + 1, 1 << 1, TRUE);
if (mline != -1)
{
sci_set_current_line(doc->editor->scintilla, mline);
sci_set_current_line(doc->editor->sci, mline);
editor_display_current_line(doc->editor, 0.5F);
}
return;
}
case GEANY_KEYS_GOTO_PREVIOUSMARKER:
{
gint mline = sci_marker_previous(doc->editor->scintilla, cur_line - 1, 1 << 1, TRUE);
gint mline = sci_marker_previous(doc->editor->sci, cur_line - 1, 1 << 1, TRUE);
if (mline != -1)
{
sci_set_current_line(doc->editor->scintilla, mline);
sci_set_current_line(doc->editor->sci, mline);
editor_display_current_line(doc->editor, 0.5F);
}
return;
@ -1434,7 +1434,7 @@ static void cb_func_goto_action(guint key_id)
return;
}
/* only check editor-sensitive keybindings when editor has focus */
if (gtk_window_get_focus(GTK_WINDOW(main_widgets.window)) != GTK_WIDGET(doc->editor->scintilla))
if (gtk_window_get_focus(GTK_WINDOW(main_widgets.window)) != GTK_WIDGET(doc->editor->sci))
{
ignore_keybinding = TRUE;
return;
@ -1442,10 +1442,10 @@ static void cb_func_goto_action(guint key_id)
switch (key_id)
{
case GEANY_KEYS_GOTO_LINESTART:
sci_cmd(doc->editor->scintilla, editor_prefs.smart_home_key ? SCI_VCHOME : SCI_HOME);
sci_cmd(doc->editor->sci, editor_prefs.smart_home_key ? SCI_VCHOME : SCI_HOME);
break;
case GEANY_KEYS_GOTO_LINEEND:
sci_cmd(doc->editor->scintilla, SCI_LINEEND);
sci_cmd(doc->editor->sci, SCI_LINEEND);
break;
}
}
@ -1479,7 +1479,7 @@ static void cb_func_editor_action(guint key_id)
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
/* edit keybindings only valid when scintilla widget has focus */
if (doc == NULL || focusw != GTK_WIDGET(doc->editor->scintilla))
if (doc == NULL || focusw != GTK_WIDGET(doc->editor->sci))
return;
switch (key_id)
@ -1491,31 +1491,31 @@ static void cb_func_editor_action(guint key_id)
on_redo1_activate(NULL, NULL);
break;
case GEANY_KEYS_EDITOR_SCROLLTOLINE:
editor_scroll_to_line(doc->editor->scintilla, -1, 0.5F);
editor_scroll_to_line(doc->editor->sci, -1, 0.5F);
break;
case GEANY_KEYS_EDITOR_SCROLLLINEUP:
sci_cmd(doc->editor->scintilla, SCI_LINESCROLLUP);
sci_cmd(doc->editor->sci, SCI_LINESCROLLUP);
break;
case GEANY_KEYS_EDITOR_SCROLLLINEDOWN:
sci_cmd(doc->editor->scintilla, SCI_LINESCROLLDOWN);
sci_cmd(doc->editor->sci, SCI_LINESCROLLDOWN);
break;
case GEANY_KEYS_EDITOR_DUPLICATELINE:
duplicate_lines(doc->editor->scintilla);
duplicate_lines(doc->editor->sci);
break;
case GEANY_KEYS_EDITOR_DELETELINE:
delete_lines(doc->editor->scintilla);
delete_lines(doc->editor->sci);
break;
case GEANY_KEYS_EDITOR_TRANSPOSELINE:
sci_cmd(doc->editor->scintilla, SCI_LINETRANSPOSE);
sci_cmd(doc->editor->sci, SCI_LINETRANSPOSE);
break;
case GEANY_KEYS_EDITOR_AUTOCOMPLETE:
editor_start_auto_complete(doc, sci_get_current_position(doc->editor->scintilla), TRUE);
editor_start_auto_complete(doc, sci_get_current_position(doc->editor->sci), TRUE);
break;
case GEANY_KEYS_EDITOR_CALLTIP:
editor_show_calltip(doc, -1);
break;
case GEANY_KEYS_EDITOR_MACROLIST:
editor_show_macro_list(doc->editor->scintilla);
editor_show_macro_list(doc->editor->sci);
break;
case GEANY_KEYS_EDITOR_CONTEXTACTION:
if (check_current_word())
@ -1530,10 +1530,10 @@ static void cb_func_editor_action(guint key_id)
switch (kb->key)
{
case GDK_space:
sci_add_text(doc->editor->scintilla, " ");
sci_add_text(doc->editor->sci, " ");
break;
case GDK_Tab:
sci_cmd(doc->editor->scintilla, SCI_TAB);
sci_cmd(doc->editor->sci, SCI_TAB);
break;
default:
break;
@ -1551,7 +1551,7 @@ static void cb_func_format_action(guint key_id)
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
/* keybindings only valid when scintilla widget has focus */
if (doc == NULL || focusw != GTK_WIDGET(doc->editor->scintilla))
if (doc == NULL || focusw != GTK_WIDGET(doc->editor->sci))
return;
switch (key_id)
@ -1616,7 +1616,7 @@ static void cb_func_select_action(guint key_id)
}
/* keybindings only valid when scintilla widget has focus */
if (doc == NULL || focusw != GTK_WIDGET(doc->editor->scintilla))
if (doc == NULL || focusw != GTK_WIDGET(doc->editor->sci))
return;
switch (key_id)
@ -1625,13 +1625,13 @@ static void cb_func_select_action(guint key_id)
on_menu_select_all1_activate(NULL, NULL);
break;
case GEANY_KEYS_SELECT_WORD:
editor_select_word(doc->editor->scintilla);
editor_select_word(doc->editor->sci);
break;
case GEANY_KEYS_SELECT_LINE:
editor_select_lines(doc->editor->scintilla, FALSE);
editor_select_lines(doc->editor->sci, FALSE);
break;
case GEANY_KEYS_SELECT_PARAGRAPH:
editor_select_paragraph(doc->editor->scintilla);
editor_select_paragraph(doc->editor->sci);
break;
}
}
@ -1669,8 +1669,8 @@ static void cb_func_document_action(guint key_id)
case GEANY_KEYS_DOCUMENT_TOGGLEFOLD:
if (editor_prefs.folding)
{
gint line = sci_get_current_line(doc->editor->scintilla);
sci_toggle_fold(doc->editor->scintilla, line);
gint line = sci_get_current_line(doc->editor->sci);
sci_toggle_fold(doc->editor->sci, line);
break;
}
}
@ -1684,7 +1684,7 @@ static void cb_func_insert_action(guint key_id)
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
/* keybindings only valid when scintilla widget has focus */
if (doc == NULL || focusw != GTK_WIDGET(doc->editor->scintilla)) return;
if (doc == NULL || focusw != GTK_WIDGET(doc->editor->sci)) return;
switch (key_id)
{

View File

@ -144,7 +144,7 @@ static gchar *get_session_file_string(GeanyDocument *doc)
ft = filetypes[GEANY_FILETYPES_NONE];
fname = g_strdup_printf("%d;%s;%d;%d;%d;%d;%d;%s;",
sci_get_current_position(doc->editor->scintilla),
sci_get_current_position(doc->editor->sci),
ft->name,
doc->readonly,
encodings_get_idx_from_charset(doc->encoding),

View File

@ -910,7 +910,7 @@ gint main(gint argc, gchar **argv)
ui_save_buttons_toggle(FALSE);
doc = document_get_current();
gtk_widget_grab_focus(GTK_WIDGET(doc->editor->scintilla));
gtk_widget_grab_focus(GTK_WIDGET(doc->editor->sci));
treeviews_select_openfiles_item(doc);
build_menu_update(doc);
treeviews_update_tag_list(doc, FALSE);

View File

@ -151,12 +151,12 @@ gboolean navqueue_goto_line(GeanyDocument *old_doc, GeanyDocument *new_doc, gint
g_return_val_if_fail(new_doc != NULL, FALSE);
g_return_val_if_fail(line >= 1, FALSE);
pos = sci_get_position_from_line(new_doc->editor->scintilla, line - 1);
pos = sci_get_position_from_line(new_doc->editor->sci, line - 1);
/* first add old file position */
if (old_doc != NULL && old_doc->file_name)
{
gint cur_pos = sci_get_current_position(old_doc->editor->scintilla);
gint cur_pos = sci_get_current_position(old_doc->editor->sci);
add_new_position(old_doc->file_name, cur_pos);
}

View File

@ -85,7 +85,7 @@ static void focus_sci(GtkWidget *widget, gpointer user_data)
if (doc == NULL)
return;
gtk_widget_grab_focus(GTK_WIDGET(doc->editor->scintilla));
gtk_widget_grab_focus(GTK_WIDGET(doc->editor->sci));
}
@ -328,7 +328,7 @@ gint notebook_new_tab(GeanyDocument *this)
g_return_val_if_fail(this != NULL, -1);
page = GTK_WIDGET(this->editor->scintilla);
page = GTK_WIDGET(this->editor->sci);
title = g_path_get_basename(DOC_FILENAME(this));
fdoc->tab_label = gtk_label_new(title);

View File

@ -213,7 +213,7 @@ static gint get_page_count(GtkPrintContext *context, DocInfo *dinfo)
gint lines = 1;
gint line_width;
line_buf = sci_get_line(dinfo->doc->editor->scintilla, j);
line_buf = sci_get_line(dinfo->doc->editor->sci, j);
line_width = (g_utf8_strlen(line_buf, -1) + 1) * dinfo->font_width;
if (line_width > width)
lines = ceil(line_width / width);
@ -418,7 +418,7 @@ static void begin_print(GtkPrintOperation *operation, GtkPrintContext *context,
desc = pango_font_description_from_string(interface_prefs.editor_font);
/* init dinfo fields */
dinfo->lines = sci_get_line_count(dinfo->doc->editor->scintilla);
dinfo->lines = sci_get_line_count(dinfo->doc->editor->sci);
dinfo->lines_per_page = 0;
dinfo->cur_line = 0;
dinfo->cur_pos = 0;
@ -434,7 +434,7 @@ static void begin_print(GtkPrintOperation *operation, GtkPrintContext *context,
dinfo->n_pages = get_page_count(context, dinfo);
/* read all styles from Scintilla */
style_max = pow(2, scintilla_send_message(dinfo->doc->editor->scintilla, SCI_GETSTYLEBITS, 0, 0));
style_max = pow(2, scintilla_send_message(dinfo->doc->editor->sci, SCI_GETSTYLEBITS, 0, 0));
/* if the lexer uses only the first 32 styles(style bits = 5),
* we need to add the pre-defined styles */
if (style_max == 32)
@ -442,21 +442,21 @@ static void begin_print(GtkPrintOperation *operation, GtkPrintContext *context,
for (i = 0; i < style_max; i++)
{
dinfo->styles[i][FORE] = ROTATE_RGB(scintilla_send_message(
dinfo->doc->editor->scintilla, SCI_STYLEGETFORE, i, 0));
dinfo->doc->editor->sci, SCI_STYLEGETFORE, i, 0));
if (i == STYLE_LINENUMBER)
{ /* ignore background colour for line number margin to avoid trouble with wrapped lines */
dinfo->styles[STYLE_LINENUMBER][BACK] = ROTATE_RGB(scintilla_send_message(
dinfo->doc->editor->scintilla, SCI_STYLEGETBACK, STYLE_DEFAULT, 0));
dinfo->doc->editor->sci, SCI_STYLEGETBACK, STYLE_DEFAULT, 0));
}
else
{
dinfo->styles[i][BACK] = ROTATE_RGB(scintilla_send_message(
dinfo->doc->editor->scintilla, SCI_STYLEGETBACK, i, 0));
dinfo->doc->editor->sci, SCI_STYLEGETBACK, i, 0));
}
dinfo->styles[i][BOLD] =
scintilla_send_message(dinfo->doc->editor->scintilla, SCI_STYLEGETBOLD, i, 0);
scintilla_send_message(dinfo->doc->editor->sci, SCI_STYLEGETBOLD, i, 0);
dinfo->styles[i][ITALIC] =
scintilla_send_message(dinfo->doc->editor->scintilla, SCI_STYLEGETITALIC, i, 0);
scintilla_send_message(dinfo->doc->editor->sci, SCI_STYLEGETITALIC, i, 0);
}
if (dinfo->n_pages >= 0)
@ -550,8 +550,8 @@ static void draw_page(GtkPrintOperation *operation, GtkPrintContext *context,
/* data */
else
{
style = sci_get_style_at(dinfo->doc->editor->scintilla, dinfo->cur_pos);
c = sci_get_char_at(dinfo->doc->editor->scintilla, dinfo->cur_pos);
style = sci_get_style_at(dinfo->doc->editor->sci, dinfo->cur_pos);
c = sci_get_char_at(dinfo->doc->editor->sci, dinfo->cur_pos);
if (c == '\0' || style == -1)
{ /* if c gets 0, we are probably out of document boundaries,
* so stop to break out of outer loop */
@ -570,7 +570,7 @@ static void draw_page(GtkPrintOperation *operation, GtkPrintContext *context,
/* don't add line breaks, they are handled manually below */
else if (c == '\r' || c == '\n')
{
gchar c_next = sci_get_char_at(dinfo->doc->editor->scintilla, dinfo->cur_pos);
gchar c_next = sci_get_char_at(dinfo->doc->editor->sci, dinfo->cur_pos);
at_eol = TRUE;
if (c == '\r' && c_next == '\n')
dinfo->cur_pos++; /* skip LF part of CR/LF */
@ -586,7 +586,7 @@ static void draw_page(GtkPrintOperation *operation, GtkPrintContext *context,
* style doesn't change since it is only one character with multiple bytes. */
while (c < 0)
{
c = sci_get_char_at(dinfo->doc->editor->scintilla, dinfo->cur_pos);
c = sci_get_char_at(dinfo->doc->editor->sci, dinfo->cur_pos);
if (c < 0)
{ /* only add the byte when it is part of the UTF-8 character
* otherwise we could add e.g. a '\n' and it won't be visible in the

View File

@ -807,15 +807,15 @@ static gint search_mark(GeanyDocument *doc, const gchar *search_text, gint flags
g_return_val_if_fail(doc != NULL, 0);
ttf.chrg.cpMin = 0;
ttf.chrg.cpMax = sci_get_length(doc->editor->scintilla);
ttf.chrg.cpMax = sci_get_length(doc->editor->sci);
ttf.lpstrText = (gchar *)search_text;
while (1)
{
pos = sci_find_text(doc->editor->scintilla, flags, &ttf);
pos = sci_find_text(doc->editor->sci, flags, &ttf);
if (pos == -1) break;
line = sci_get_line_from_position(doc->editor->scintilla, pos);
sci_set_marker_at_line(doc->editor->scintilla, line, TRUE, 1);
line = sci_get_line_from_position(doc->editor->sci, pos);
sci_set_marker_at_line(doc->editor->sci, line, TRUE, 1);
ttf.chrg.cpMin = ttf.chrgText.cpMax + 1;
count++;
@ -1367,13 +1367,13 @@ static gint find_document_usage(GeanyDocument *doc, const gchar *search_text, gi
short_file_name = g_path_get_basename(DOC_FILENAME(doc));
ttf.chrg.cpMin = 0;
ttf.chrg.cpMax = sci_get_length(doc->editor->scintilla);
ttf.chrg.cpMax = sci_get_length(doc->editor->sci);
ttf.lpstrText = (gchar *)search_text;
while (1)
{
gint pos, line, start, find_len;
pos = sci_find_text(doc->editor->scintilla, flags, &ttf);
pos = sci_find_text(doc->editor->sci, flags, &ttf);
if (pos == -1)
break; /* no more matches */
find_len = ttf.chrgText.cpMax - ttf.chrgText.cpMin;
@ -1381,8 +1381,8 @@ static gint find_document_usage(GeanyDocument *doc, const gchar *search_text, gi
break; /* Ignore regex ^ or $ */
count++;
line = sci_get_line_from_position(doc->editor->scintilla, pos);
buffer = sci_get_line(doc->editor->scintilla, line);
line = sci_get_line_from_position(doc->editor->sci, pos);
buffer = sci_get_line(doc->editor->sci, line);
msgwin_msg_add_fmt(COLOR_BLACK, line + 1, doc,
"%s:%d : %s", short_file_name, line + 1, g_strstrip(buffer));
g_free(buffer);

View File

@ -1379,8 +1379,8 @@ gint symbols_get_current_function(GeanyDocument *doc, const gchar **tagname)
return tag_line;
}
line = sci_get_current_line(doc->editor->scintilla);
fold_level = sci_get_fold_level(doc->editor->scintilla, line);
line = sci_get_current_line(doc->editor->sci);
fold_level = sci_get_fold_level(doc->editor->sci, line);
/* check if the cached line and file index have changed since last time: */
if (! current_function_changed(doc, line, fold_level))
{
@ -1425,17 +1425,17 @@ gint symbols_get_current_function(GeanyDocument *doc, const gchar **tagname)
tag_line = line;
do /* find the top level fold point */
{
tag_line = sci_get_fold_parent(doc->editor->scintilla, tag_line);
fold_level = sci_get_fold_level(doc->editor->scintilla, tag_line);
tag_line = sci_get_fold_parent(doc->editor->sci, tag_line);
fold_level = sci_get_fold_level(doc->editor->sci, tag_line);
} while (tag_line >= 0 &&
(fold_level & SC_FOLDLEVELNUMBERMASK) != fn_fold);
if (tag_line >= 0)
{
if (sci_get_lexer(doc->editor->scintilla) == SCLEX_CPP)
cur_tag = parse_cpp_function_at_line(doc->editor->scintilla, tag_line);
if (sci_get_lexer(doc->editor->sci) == SCLEX_CPP)
cur_tag = parse_cpp_function_at_line(doc->editor->sci, tag_line);
else
cur_tag = parse_function_at_line(doc->editor->scintilla, tag_line);
cur_tag = parse_function_at_line(doc->editor->sci, tag_line);
if (cur_tag != NULL)
{

View File

@ -173,7 +173,7 @@ static gboolean cc_replace_sel_cb(gpointer user_data)
if (! cc_error_occurred && cc_buffer != NULL)
{ /* Command completed successfully */
sci_replace_sel(doc->editor->scintilla, cc_buffer->str);
sci_replace_sel(doc->editor->sci, cc_buffer->str);
g_string_free(cc_buffer, TRUE);
cc_buffer = NULL;
}
@ -238,7 +238,7 @@ void tools_execute_custom_command(GeanyDocument *doc, const gchar *command)
g_return_if_fail(doc != NULL && command != NULL);
if (! sci_can_copy(doc->editor->scintilla))
if (! sci_can_copy(doc->editor->sci))
return;
argv = g_strsplit(command, " ", -1);
@ -263,9 +263,9 @@ void tools_execute_custom_command(GeanyDocument *doc, const gchar *command)
FALSE, cc_iofunc_err, (gpointer)command);
/* get selection */
len = sci_get_selected_text_length(doc->editor->scintilla);
len = sci_get_selected_text_length(doc->editor->sci);
sel = g_malloc0(len + 1);
sci_get_selected_text(doc->editor->scintilla, sel);
sci_get_selected_text(doc->editor->sci, sel);
/* write data to the command */
remaining = len - 1;
@ -404,7 +404,7 @@ static void cc_on_custom_command_menu_activate(GtkMenuItem *menuitem, gpointer u
if (doc == NULL)
return;
enable = sci_can_copy(doc->editor->scintilla) && (ui_prefs.custom_commands != NULL);
enable = sci_can_copy(doc->editor->sci) && (ui_prefs.custom_commands != NULL);
children = gtk_container_get_children(GTK_CONTAINER(user_data));
len = g_list_length(children);
@ -616,16 +616,16 @@ void tools_word_count(void)
vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
gtk_widget_set_name(dialog, "GeanyDialog");
if (sci_can_copy(doc->editor->scintilla))
if (sci_can_copy(doc->editor->sci))
{
text = g_malloc0(sci_get_selected_text_length(doc->editor->scintilla) + 1);
sci_get_selected_text(doc->editor->scintilla, text);
text = g_malloc0(sci_get_selected_text_length(doc->editor->sci) + 1);
sci_get_selected_text(doc->editor->sci, text);
range = _("selection");
}
else
{
text = g_malloc(sci_get_length(doc->editor->scintilla) + 1);
sci_get_text(doc->editor->scintilla, sci_get_length(doc->editor->scintilla) + 1 , text);
text = g_malloc(sci_get_length(doc->editor->sci) + 1);
sci_get_text(doc->editor->sci, sci_get_length(doc->editor->sci) + 1 , text);
range = _("whole document");
}
word_count(text, &chars, &lines, &words);

View File

@ -578,7 +578,7 @@ static gboolean change_focus(gpointer data)
if (DOC_VALID(doc))
{
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
GtkWidget *sci = GTK_WIDGET(doc->editor->scintilla);
GtkWidget *sci = GTK_WIDGET(doc->editor->sci);
if (focusw == tv.tree_openfiles)
gtk_widget_grab_focus(sci);
@ -599,7 +599,7 @@ static void on_openfiles_tree_selection_changed(GtkTreeSelection *selection, gpo
gtk_tree_model_get(model, &iter, 1, &doc, -1);
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook),
(GtkWidget*) doc->editor->scintilla));
(GtkWidget*) doc->editor->sci));
g_idle_add((GSourceFunc) change_focus, doc);
}
}

View File

@ -144,27 +144,27 @@ void ui_update_statusbar(GeanyDocument *doc, gint pos)
if (stats_str == NULL)
stats_str = g_string_sized_new(120);
if (pos == -1) pos = sci_get_current_position(doc->editor->scintilla);
line = sci_get_line_from_position(doc->editor->scintilla, pos);
if (pos == -1) pos = sci_get_current_position(doc->editor->sci);
line = sci_get_line_from_position(doc->editor->sci, pos);
/* Add temporary fix for sci infinite loop in Document::GetColumn(int)
* when current pos is beyond document end (can occur when removing
* blocks of selected lines especially esp. brace sections near end of file). */
if (pos <= sci_get_length(doc->editor->scintilla))
col = sci_get_col_from_position(doc->editor->scintilla, pos);
if (pos <= sci_get_length(doc->editor->sci))
col = sci_get_col_from_position(doc->editor->sci, pos);
else
col = 0;
/* Status bar statistics: col = column, sel = selection. */
g_string_printf(stats_str, _("line: %d\t col: %d\t sel: %d\t "),
(line + 1), col,
sci_get_selected_text_length(doc->editor->scintilla) - 1);
sci_get_selected_text_length(doc->editor->sci) - 1);
g_string_append(stats_str,
/* RO = read-only */
(doc->readonly) ? _("RO ") :
/* OVR = overwrite/overtype, INS = insert */
(sci_get_overtype(doc->editor->scintilla) ? _("OVR") : _("INS")));
(sci_get_overtype(doc->editor->sci) ? _("OVR") : _("INS")));
g_string_append(stats_str, sp);
g_string_append(stats_str,
(doc->editor->use_tabs) ? _("TAB") : _("SP ")); /* SP = space */
@ -321,7 +321,7 @@ void ui_update_popup_copy_items(GeanyDocument *doc)
if (doc == NULL)
enable = FALSE;
else
enable = sci_can_copy(doc->editor->scintilla);
enable = sci_can_copy(doc->editor->sci);
for (i = 0; i < G_N_ELEMENTS(ui_widgets.popup_copy_items); i++)
gtk_widget_set_sensitive(ui_widgets.popup_copy_items[i], enable);
@ -343,7 +343,7 @@ void ui_update_menu_copy_items(GeanyDocument *doc)
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
if (IS_SCINTILLA(focusw))
enable = (doc == NULL) ? FALSE : sci_can_copy(doc->editor->scintilla);
enable = (doc == NULL) ? FALSE : sci_can_copy(doc->editor->sci);
else
if (GTK_IS_EDITABLE(focusw))
enable = gtk_editable_get_selection_bounds(GTK_EDITABLE(focusw), NULL, NULL);
@ -712,7 +712,7 @@ void ui_document_show_hide(GeanyDocument *doc)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), doc->has_bom);
gtk_widget_set_sensitive(item, encodings_is_unicode_charset(doc->encoding));
switch (sci_get_eol_mode(doc->editor->scintilla))
switch (sci_get_eol_mode(doc->editor->sci))
{
case SC_EOL_CR: widget_name = "cr"; break;
case SC_EOL_LF: widget_name = "lf"; break;
@ -1064,7 +1064,7 @@ void ui_show_markers_margin(void)
for(i = 0; i < max; i++)
{
doc = document_get_from_page(i);
sci_set_symbol_margin(doc->editor->scintilla, editor_prefs.show_markers_margin);
sci_set_symbol_margin(doc->editor->sci, editor_prefs.show_markers_margin);
}
}
@ -1077,7 +1077,7 @@ void ui_show_linenumber_margin(void)
for(i = 0; i < max; i++)
{
doc = document_get_from_page(i);
sci_set_line_numbers(doc->editor->scintilla, editor_prefs.show_linenumber_margin, 0);
sci_set_line_numbers(doc->editor->sci, editor_prefs.show_linenumber_margin, 0);
}
}