Revision: 2195 http://geany.svn.sourceforge.net/geany/?rev=2195&view=rev Author: ntrel Date: 2008-01-28 09:27:39 -0800 (Mon, 28 Jan 2008)
Log Message: ----------- Add new macros for plugin API functions that use a 'p_' prefix to prevent conflicts with other tags whilst keeping the same first word as core function names, and update plugins to use them. The old plugin macros are still available, but will be removed after the next release. Compiling with -DGEANY_DISABLE_DEPRECATED in CFLAGS will disable the old macros.
Modified Paths: -------------- trunk/ChangeLog trunk/plugins/autosave.c trunk/plugins/classbuilder.c trunk/plugins/demoplugin.c trunk/plugins/export.c trunk/plugins/filebrowser.c trunk/plugins/htmlchars.c trunk/plugins/pluginmacros.h trunk/plugins/vcdiff.c trunk/src/plugindata.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-01-27 18:27:33 UTC (rev 2194) +++ trunk/ChangeLog 2008-01-28 17:27:39 UTC (rev 2195) @@ -1,3 +1,15 @@ +2008-01-28 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * plugins/pluginmacros.h, src/plugindata.h, plugins/*.c: + Add new macros for plugin API functions that use a 'p_' prefix to + prevent conflicts with other tags whilst keeping the same first word + as core function names, and update plugins to use them. + The old plugin macros are still available, but will be removed + after the next release. + Compiling with -DGEANY_DISABLE_DEPRECATED in CFLAGS will disable + the old macros. + + 2008-01-27 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/printing.c:
Modified: trunk/plugins/autosave.c =================================================================== --- trunk/plugins/autosave.c 2008-01-27 18:27:33 UTC (rev 2194) +++ trunk/plugins/autosave.c 2008-01-28 17:27:39 UTC (rev 2195) @@ -50,7 +50,7 @@
gboolean auto_save(gpointer data) { - gint cur_idx = documents->get_cur_idx(); + gint cur_idx = p_document->get_cur_idx(); gint i, idx, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)); gint saved_files = 0;
@@ -58,22 +58,22 @@ { for (i = 0; i < max; i++) { - idx = documents->get_n_idx(i); + idx = p_document->get_n_idx(i);
// skip current file to save it lastly, skip files without name if (idx != cur_idx && doc_list[idx].file_name != NULL) - if (documents->save_file(idx, FALSE)) + if (p_document->save_file(idx, FALSE)) saved_files++; } } // finally save current file, do it after all other files to get correct window title and // symbol list if (doc_list[cur_idx].file_name != NULL) - if (documents->save_file(cur_idx, FALSE)) + if (p_document->save_file(cur_idx, FALSE)) saved_files++;
if (saved_files > 0 && print_msg) - ui->set_statusbar(FALSE, _("Autosave: Saved %d files automatically."), saved_files); + p_ui->set_statusbar(FALSE, _("Autosave: Saved %d files automatically."), saved_files);
return TRUE; } @@ -118,7 +118,7 @@ dialog = gtk_dialog_new_with_buttons(_("Auto Save"), GTK_WINDOW(parent), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - vbox = ui->dialog_vbox_new(GTK_DIALOG(dialog)); + vbox = p_ui->dialog_vbox_new(GTK_DIALOG(dialog)); gtk_widget_set_name(dialog, "GeanyDialog"); gtk_box_set_spacing(GTK_BOX(vbox), 6);
@@ -173,16 +173,16 @@ g_key_file_set_boolean(config, "autosave", "print_messages", print_msg); g_key_file_set_boolean(config, "autosave", "save_all", save_all);
- if (! g_file_test(config_dir, G_FILE_TEST_IS_DIR) && utils->mkdir(config_dir, TRUE) != 0) + if (! g_file_test(config_dir, G_FILE_TEST_IS_DIR) && p_utils->mkdir(config_dir, TRUE) != 0) { - dialogs->show_msgbox(GTK_MESSAGE_ERROR, + p_dialogs->show_msgbox(GTK_MESSAGE_ERROR, _("Plugin configuration directory could not be created.")); } else { // write config to file data = g_key_file_to_data(config, NULL, NULL); - utils->write_file(config_file, data); + p_utils->write_file(config_file, data); g_free(data); }
Modified: trunk/plugins/classbuilder.c =================================================================== --- trunk/plugins/classbuilder.c 2008-01-27 18:27:33 UTC (rev 2194) +++ trunk/plugins/classbuilder.c 2008-01-28 17:27:39 UTC (rev 2195) @@ -251,30 +251,30 @@ switch (class_info->type) { case GEANY_CLASS_TYPE_CPP: - fileheader = templates->get_template_fileheader(GEANY_FILETYPES_CPP, class_info->header); + fileheader = p_templates->get_template_fileheader(GEANY_FILETYPES_CPP, class_info->header); template = g_string_new(templates_cpp_class_header); - utils->string_replace_all(template, "{fileheader}", fileheader); - utils->string_replace_all(template, "{header_guard}", class_info->header_guard); - utils->string_replace_all(template, "{base_include}", class_info->base_include); - utils->string_replace_all(template, "{class_name}", class_info->class_name); - utils->string_replace_all(template, "{base_decl}", class_info->base_decl); - utils->string_replace_all(template, "{constructor_decl}", + p_utils->string_replace_all(template, "{fileheader}", fileheader); + p_utils->string_replace_all(template, "{header_guard}", class_info->header_guard); + p_utils->string_replace_all(template, "{base_include}", class_info->base_include); + p_utils->string_replace_all(template, "{class_name}", class_info->class_name); + p_utils->string_replace_all(template, "{base_decl}", class_info->base_decl); + p_utils->string_replace_all(template, "{constructor_decl}", class_info->constructor_decl); - utils->string_replace_all(template, "{destructor_decl}", + p_utils->string_replace_all(template, "{destructor_decl}", class_info->destructor_decl); break;
case GEANY_CLASS_TYPE_GTK: - fileheader = templates->get_template_fileheader(GEANY_FILETYPES_C, class_info->header); + fileheader = p_templates->get_template_fileheader(GEANY_FILETYPES_C, class_info->header); template = g_string_new(templates_gtk_class_header); - utils->string_replace_all(template, "{fileheader}", fileheader); - utils->string_replace_all(template, "{header_guard}", class_info->header_guard); - utils->string_replace_all(template, "{base_include}", class_info->base_include); - utils->string_replace_all(template, "{class_name}", class_info->class_name); - utils->string_replace_all(template, "{class_name_up}", class_info->class_name_up); - utils->string_replace_all(template, "{class_name_low}", class_info->class_name_low); - utils->string_replace_all(template, "{base_name}", class_info->base_name); - utils->string_replace_all(template, "{constructor_decl}", + p_utils->string_replace_all(template, "{fileheader}", fileheader); + p_utils->string_replace_all(template, "{header_guard}", class_info->header_guard); + p_utils->string_replace_all(template, "{base_include}", class_info->base_include); + p_utils->string_replace_all(template, "{class_name}", class_info->class_name); + p_utils->string_replace_all(template, "{class_name_up}", class_info->class_name_up); + p_utils->string_replace_all(template, "{class_name_low}", class_info->class_name_low); + p_utils->string_replace_all(template, "{base_name}", class_info->base_name); + p_utils->string_replace_all(template, "{constructor_decl}", class_info->constructor_decl); break; } @@ -297,35 +297,35 @@ switch (class_info->type) { case GEANY_CLASS_TYPE_CPP: - fileheader = templates->get_template_fileheader(GEANY_FILETYPES_CPP, class_info->source); + fileheader = p_templates->get_template_fileheader(GEANY_FILETYPES_CPP, class_info->source); template = g_string_new(templates_cpp_class_source); - utils->string_replace_all(template, "{fileheader}", fileheader); - utils->string_replace_all(template, "{header}", class_info->header); - utils->string_replace_all(template, "{class_name}", class_info->class_name); - utils->string_replace_all(template, "{base_include}", class_info->base_include); - utils->string_replace_all(template, "{base_name}", class_info->base_name); - utils->string_replace_all(template, "{constructor_impl}", + p_utils->string_replace_all(template, "{fileheader}", fileheader); + p_utils->string_replace_all(template, "{header}", class_info->header); + p_utils->string_replace_all(template, "{class_name}", class_info->class_name); + p_utils->string_replace_all(template, "{base_include}", class_info->base_include); + p_utils->string_replace_all(template, "{base_name}", class_info->base_name); + p_utils->string_replace_all(template, "{constructor_impl}", class_info->constructor_impl); - utils->string_replace_all(template, "{destructor_impl}", + p_utils->string_replace_all(template, "{destructor_impl}", class_info->destructor_impl); break;
case GEANY_CLASS_TYPE_GTK: - fileheader = templates->get_template_fileheader(GEANY_FILETYPES_C, class_info->source); + fileheader = p_templates->get_template_fileheader(GEANY_FILETYPES_C, class_info->source); template = g_string_new(templates_gtk_class_source); - utils->string_replace_all(template, "{fileheader}", fileheader); - utils->string_replace_all(template, "{header}", class_info->header); - utils->string_replace_all(template, "{class_name}", class_info->class_name); - utils->string_replace_all(template, "{class_name_up}", class_info->class_name_up); - utils->string_replace_all(template, "{class_name_low}", class_info->class_name_low); - utils->string_replace_all(template, "{base_name}", class_info->base_name); - utils->string_replace_all(template, "{base_gtype}", class_info->base_gtype); - utils->string_replace_all(template, "{destructor_decl}", class_info->destructor_decl); - utils->string_replace_all(template, "{constructor_impl}", + p_utils->string_replace_all(template, "{fileheader}", fileheader); + p_utils->string_replace_all(template, "{header}", class_info->header); + p_utils->string_replace_all(template, "{class_name}", class_info->class_name); + p_utils->string_replace_all(template, "{class_name_up}", class_info->class_name_up); + p_utils->string_replace_all(template, "{class_name_low}", class_info->class_name_low); + p_utils->string_replace_all(template, "{base_name}", class_info->base_name); + p_utils->string_replace_all(template, "{base_gtype}", class_info->base_gtype); + p_utils->string_replace_all(template, "{destructor_decl}", class_info->destructor_decl); + p_utils->string_replace_all(template, "{constructor_impl}", class_info->constructor_impl); - utils->string_replace_all(template, "{destructor_impl}", + p_utils->string_replace_all(template, "{destructor_impl}", class_info->destructor_impl); - utils->string_replace_all(template, "{gtk_destructor_registration}", + p_utils->string_replace_all(template, "{gtk_destructor_registration}", class_info->gtk_destructor_registration); break; } @@ -361,9 +361,9 @@ g_signal_connect_swapped(G_OBJECT(cc_dlg->dialog), "destroy", G_CALLBACK(g_free), (gpointer)cc_dlg);
- main_box = ui->dialog_vbox_new(GTK_DIALOG(cc_dlg->dialog)); + main_box = p_ui->dialog_vbox_new(GTK_DIALOG(cc_dlg->dialog));
- frame = ui->frame_new_with_alignment(_("Class"), &align); + frame = p_ui->frame_new_with_alignment(_("Class"), &align); gtk_container_add(GTK_CONTAINER(main_box), frame);
vbox = gtk_vbox_new(FALSE, 10); @@ -398,7 +398,7 @@ cc_dlg->source_entry = gtk_entry_new(); gtk_container_add(GTK_CONTAINER(hbox), cc_dlg->source_entry);
- frame = ui->frame_new_with_alignment(_("Inheritance"), &align); + frame = p_ui->frame_new_with_alignment(_("Inheritance"), &align); gtk_container_add(GTK_CONTAINER(main_box), frame);
vbox = gtk_vbox_new(FALSE, 10); @@ -445,7 +445,7 @@ gtk_container_add(GTK_CONTAINER(hbox), cc_dlg->base_gtype_entry); }
- frame = ui->frame_new_with_alignment(_("Options"), &align); + frame = p_ui->frame_new_with_alignment(_("Options"), &align); gtk_container_add(GTK_CONTAINER(main_box), frame);
vbox = gtk_vbox_new(FALSE, 10); @@ -556,7 +556,7 @@ base_name_splitted = str_case_split(gtk_entry_get_text(GTK_ENTRY(entry)), '_'); if (! g_ascii_strncasecmp(gtk_entry_get_text(GTK_ENTRY(entry)), "gtk", 3)) tmp = g_strconcat("gtk/", gtk_entry_get_text(GTK_ENTRY(entry)), ".h", NULL); - else if (utils->str_equal(gtk_entry_get_text(GTK_ENTRY(entry)), "GObject")) + else if (p_utils->str_equal(gtk_entry_get_text(GTK_ENTRY(entry)), "GObject")) tmp = g_strdup("glib-object.h"); else tmp = g_strconcat(gtk_entry_get_text(GTK_ENTRY(entry)), ".h", NULL); @@ -572,7 +572,7 @@ tmp = g_strdup_printf("%.3s_TYPE%s", base_name_splitted, base_name_splitted + 3); - else if (utils->str_equal(gtk_entry_get_text(GTK_ENTRY(entry)), "GObject")) + else if (p_utils->str_equal(gtk_entry_get_text(GTK_ENTRY(entry)), "GObject")) tmp = g_strdup("G_TYPE_OBJECT"); else tmp = g_strconcat(base_name_splitted, "_TYPE", NULL); @@ -597,7 +597,7 @@
g_return_if_fail(cc_dlg != NULL);
- if (utils->str_equal(gtk_entry_get_text(GTK_ENTRY(cc_dlg->class_name_entry)), "")) + if (p_utils->str_equal(gtk_entry_get_text(GTK_ENTRY(cc_dlg->class_name_entry)), "")) return;
class_info = g_new0(ClassInfo, 1); @@ -606,7 +606,7 @@ tmp = str_case_split(class_info->class_name, '_'); class_info->class_name_up = g_ascii_strup(tmp, -1); class_info->class_name_low = g_ascii_strdown(class_info->class_name_up, -1); - if (! utils->str_equal(gtk_entry_get_text(GTK_ENTRY(cc_dlg->base_name_entry)), "")) + if (! p_utils->str_equal(gtk_entry_get_text(GTK_ENTRY(cc_dlg->base_name_entry)), "")) { class_info->base_name = g_strdup(gtk_entry_get_text(GTK_ENTRY(cc_dlg->base_name_entry))); class_info->base_include = g_strdup_printf("\n#include %c%s%c\n", @@ -629,7 +629,7 @@ case GEANY_CLASS_TYPE_CPP: { class_info->source = g_strdup(gtk_entry_get_text(GTK_ENTRY(cc_dlg->source_entry))); - if (! utils->str_equal(class_info->base_name, "")) + if (! p_utils->str_equal(class_info->base_name, "")) class_info->base_decl = g_strdup_printf(": public %s", class_info->base_name); else class_info->base_decl = g_strdup(""); @@ -637,7 +637,7 @@ { gchar *base_constructor;
- if (utils->str_equal(class_info->base_name, "")) + if (p_utils->str_equal(class_info->base_name, "")) base_constructor = g_strdup(""); else base_constructor = g_strdup_printf("\t: %s()\n", class_info->base_name); @@ -726,19 +726,19 @@ }
// only create the files if the filename is not empty - if (! utils->str_equal(class_info->source, "")) + if (! p_utils->str_equal(class_info->source, "")) { text = get_template_class_source(class_info); - idx = documents->new_file(class_info->source, NULL, NULL); - scintilla->set_text(doc_list[idx].sci, text); + idx = p_document->new_file(class_info->source, NULL, NULL); + p_sci->set_text(doc_list[idx].sci, text); g_free(text); }
- if (! utils->str_equal(class_info->header, "")) + if (! p_utils->str_equal(class_info->header, "")) { text = get_template_class_header(class_info); - idx = documents->new_file(class_info->header, NULL, NULL); - scintilla->set_text(doc_list[idx].sci, text); + idx = p_document->new_file(class_info->header, NULL, NULL); + p_sci->set_text(doc_list[idx].sci, text); g_free(text); }
Modified: trunk/plugins/demoplugin.c =================================================================== --- trunk/plugins/demoplugin.c 2008-01-27 18:27:33 UTC (rev 2194) +++ trunk/plugins/demoplugin.c 2008-01-28 17:27:39 UTC (rev 2195) @@ -111,7 +111,7 @@ dialog = gtk_dialog_new_with_buttons(_("Demo"), GTK_WINDOW(parent), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - vbox = ui->dialog_vbox_new(GTK_DIALOG(dialog)); + vbox = p_ui->dialog_vbox_new(GTK_DIALOG(dialog)); gtk_widget_set_name(dialog, "GeanyDialog"); gtk_box_set_spacing(GTK_BOX(vbox), 6);
Modified: trunk/plugins/export.c =================================================================== --- trunk/plugins/export.c 2008-01-27 18:27:33 UTC (rev 2194) +++ trunk/plugins/export.c 2008-01-28 17:27:39 UTC (rev 2195) @@ -160,8 +160,8 @@ if (extension == NULL) return;
- idx = documents->get_cur_idx(); - tooltips = GTK_TOOLTIPS(support->lookup_widget(app->window, "tooltips")); + idx = p_document->get_cur_idx(); + tooltips = GTK_TOOLTIPS(p_support->lookup_widget(app->window, "tooltips"));
exi = g_new(ExportInfo, 1); exi->idx = idx; @@ -210,7 +210,7 @@ if (doc_list[idx].file_name != NULL) { gchar *base_name = g_path_get_basename(doc_list[idx].file_name); - gchar *short_name = utils->remove_ext_from_filename(base_name); + gchar *short_name = p_utils->remove_ext_from_filename(base_name); gchar *file_name; gchar *locale_filename; gchar *locale_dirname; @@ -220,7 +220,7 @@ suffix = "_export";
file_name = g_strconcat(short_name, suffix, extension, NULL); - locale_filename = utils->get_locale_from_utf8(doc_list[idx].file_name); + locale_filename = p_utils->get_locale_from_utf8(doc_list[idx].file_name); locale_dirname = g_path_get_dirname(locale_filename); // set the current name to base_name.html which probably doesn't exist yet so // gtk_file_chooser_set_filename() can't be used and we need @@ -243,7 +243,7 @@ // use default startup directory(if set) if no files are open if (NZV(default_open_path) && g_path_is_absolute(default_open_path)) { - gchar *locale_path = utils->get_locale_from_utf8(default_open_path); + gchar *locale_path = p_utils->get_locale_from_utf8(default_open_path); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), locale_path); g_free(locale_path); } @@ -267,13 +267,13 @@
static void write_data(const gchar *filename, const gchar *data) { - gint error_nr = utils->write_file(filename, data); - gchar *utf8_filename = utils->get_utf8_from_locale(filename); + gint error_nr = p_utils->write_file(filename, data); + gchar *utf8_filename = p_utils->get_utf8_from_locale(filename);
if (error_nr == 0) - ui->set_statusbar(TRUE, _("Document successfully exported as '%s'."), utf8_filename); + p_ui->set_statusbar(TRUE, _("Document successfully exported as '%s'."), utf8_filename); else - ui->set_statusbar(TRUE, _("File '%s' could not be written (%s)."), + p_ui->set_statusbar(TRUE, _("File '%s' could not be written (%s)."), utf8_filename, g_strerror(error_nr));
g_free(utf8_filename); @@ -321,15 +321,15 @@ if (exi->have_zoom_level_checkbox) { use_zoom_level = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( - support->lookup_widget(GTK_WIDGET(dialog), "check_zoom_level"))); + p_support->lookup_widget(GTK_WIDGET(dialog), "check_zoom_level"))); }
- utf8_filename = utils->get_utf8_from_locale(new_filename); + utf8_filename = p_utils->get_utf8_from_locale(new_filename);
// check if file exists and ask whether to overwrite or not if (g_file_test(new_filename, G_FILE_TEST_EXISTS)) { - if (dialogs->show_question( + if (p_dialogs->show_question( _("The file '%s' already exists. Do you want to overwrite it?"), utf8_filename) == FALSE) return; @@ -355,25 +355,25 @@ GString *body; GString *cmds; GString *latex; - gint style_max = pow(2, scintilla->send_message(doc_list[idx].sci, SCI_GETSTYLEBITS, 0, 0)); + gint style_max = pow(2, p_sci->send_message(doc_list[idx].sci, SCI_GETSTYLEBITS, 0, 0));
// first read all styles from Scintilla for (i = 0; i < style_max; i++) { - styles[i][FORE] = scintilla->send_message(doc_list[idx].sci, SCI_STYLEGETFORE, i, 0); - styles[i][BACK] = scintilla->send_message(doc_list[idx].sci, SCI_STYLEGETBACK, i, 0); - styles[i][BOLD] = scintilla->send_message(doc_list[idx].sci, SCI_STYLEGETBOLD, i, 0); - styles[i][ITALIC] = scintilla->send_message(doc_list[idx].sci, SCI_STYLEGETITALIC, i, 0); + styles[i][FORE] = p_sci->send_message(doc_list[idx].sci, SCI_STYLEGETFORE, i, 0); + styles[i][BACK] = p_sci->send_message(doc_list[idx].sci, SCI_STYLEGETBACK, i, 0); + styles[i][BOLD] = p_sci->send_message(doc_list[idx].sci, SCI_STYLEGETBOLD, i, 0); + styles[i][ITALIC] = p_sci->send_message(doc_list[idx].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 < scintilla->get_length(doc_list[idx].sci); i++) + for (i = 0; i < p_sci->get_length(doc_list[idx].sci); i++) { - style = scintilla->get_style_at(doc_list[idx].sci, i); - c = scintilla->get_char_at(doc_list[idx].sci, i); - c_next = scintilla->get_char_at(doc_list[idx].sci, i + 1); + style = p_sci->get_style_at(doc_list[idx].sci, i); + c = p_sci->get_char_at(doc_list[idx].sci, i); + c_next = p_sci->get_char_at(doc_list[idx].sci, i + 1);
if (style != old_style || ! block_open) { @@ -533,13 +533,13 @@
// write all latex = g_string_new(TEMPLATE_LATEX); - utils->string_replace_all(latex, "{export_content}", body->str); - utils->string_replace_all(latex, "{export_styles}", cmds->str); - utils->string_replace_all(latex, "{export_date}", get_date(DATE_TYPE_DEFAULT)); + p_utils->string_replace_all(latex, "{export_content}", body->str); + p_utils->string_replace_all(latex, "{export_styles}", cmds->str); + p_utils->string_replace_all(latex, "{export_date}", get_date(DATE_TYPE_DEFAULT)); if (doc_list[idx].file_name == NULL) - utils->string_replace_all(latex, "{export_filename}", GEANY_STRING_UNTITLED); + p_utils->string_replace_all(latex, "{export_filename}", GEANY_STRING_UNTITLED); else - utils->string_replace_all(latex, "{export_filename}", doc_list[idx].file_name); + p_utils->string_replace_all(latex, "{export_filename}", doc_list[idx].file_name);
write_data(filename, latex->str);
@@ -562,15 +562,15 @@ GString *body; GString *css; GString *html; - gint style_max = pow(2, scintilla->send_message(doc_list[idx].sci, SCI_GETSTYLEBITS, 0, 0)); + gint style_max = pow(2, p_sci->send_message(doc_list[idx].sci, SCI_GETSTYLEBITS, 0, 0));
// first read all styles from Scintilla for (i = 0; i < style_max; i++) { - styles[i][FORE] = ROTATE_RGB(scintilla->send_message(doc_list[idx].sci, SCI_STYLEGETFORE, i, 0)); - styles[i][BACK] = ROTATE_RGB(scintilla->send_message(doc_list[idx].sci, SCI_STYLEGETBACK, i, 0)); - styles[i][BOLD] = scintilla->send_message(doc_list[idx].sci, SCI_STYLEGETBOLD, i, 0); - styles[i][ITALIC] = scintilla->send_message(doc_list[idx].sci, SCI_STYLEGETITALIC, i, 0); + styles[i][FORE] = ROTATE_RGB(p_sci->send_message(doc_list[idx].sci, SCI_STYLEGETFORE, i, 0)); + styles[i][BACK] = ROTATE_RGB(p_sci->send_message(doc_list[idx].sci, SCI_STYLEGETBACK, i, 0)); + styles[i][BOLD] = p_sci->send_message(doc_list[idx].sci, SCI_STYLEGETBOLD, i, 0); + styles[i][ITALIC] = p_sci->send_message(doc_list[idx].sci, SCI_STYLEGETITALIC, i, 0); styles[i][USED] = 0; }
@@ -579,18 +579,18 @@ 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 = scintilla->send_message(doc_list[idx].sci, SCI_STYLEGETSIZE, 0, 0); + font_size = p_sci->send_message(doc_list[idx].sci, SCI_STYLEGETSIZE, 0, 0); if (use_zoom) - font_size += scintilla->send_message(doc_list[idx].sci, SCI_GETZOOM, 0, 0); + font_size += p_sci->send_message(doc_list[idx].sci, SCI_GETZOOM, 0, 0);
// read the document and write the HTML body body = g_string_new(""); - for (i = 0; i < scintilla->get_length(doc_list[idx].sci); i++) + for (i = 0; i < p_sci->get_length(doc_list[idx].sci); i++) { - style = scintilla->get_style_at(doc_list[idx].sci, i); - c = scintilla->get_char_at(doc_list[idx].sci, i); - // scintilla->get_char_at() takes care of index boundaries and return 0 if i is too high - c_next = scintilla->get_char_at(doc_list[idx].sci, i + 1); + style = p_sci->get_style_at(doc_list[idx].sci, i); + c = p_sci->get_char_at(doc_list[idx].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_list[idx].sci, i + 1);
if ((style != old_style || ! span_open) && ! isspace(c)) { @@ -685,13 +685,13 @@
// write all html = g_string_new(TEMPLATE_HTML); - utils->string_replace_all(html, "{export_date}", get_date(DATE_TYPE_HTML)); - utils->string_replace_all(html, "{export_content}", body->str); - utils->string_replace_all(html, "{export_styles}", css->str); + p_utils->string_replace_all(html, "{export_date}", get_date(DATE_TYPE_HTML)); + p_utils->string_replace_all(html, "{export_content}", body->str); + p_utils->string_replace_all(html, "{export_styles}", css->str); if (doc_list[idx].file_name == NULL) - utils->string_replace_all(html, "{export_filename}", GEANY_STRING_UNTITLED); + p_utils->string_replace_all(html, "{export_filename}", GEANY_STRING_UNTITLED); else - utils->string_replace_all(html, "{export_filename}", doc_list[idx].file_name); + p_utils->string_replace_all(html, "{export_filename}", doc_list[idx].file_name);
write_data(filename, html->str);
Modified: trunk/plugins/filebrowser.c =================================================================== --- trunk/plugins/filebrowser.c 2008-01-27 18:27:33 UTC (rev 2194) +++ trunk/plugins/filebrowser.c 2008-01-28 17:27:39 UTC (rev 2195) @@ -109,7 +109,7 @@ { const gchar *ext = exts[i];
- if (utils->str_equal(&base_name[len - strlen(ext)], ext)) + if (p_utils->str_equal(&base_name[len - strlen(ext)], ext)) return TRUE; } } @@ -145,7 +145,7 @@ else gtk_list_store_append(file_store, &iter);
- utf8_name = utils->get_utf8_from_locale(name); + utf8_name = p_utils->get_utf8_from_locale(name);
gtk_list_store_set(file_store, &iter, FILEVIEW_COLUMN_ICON, (dir) ? GTK_STOCK_DIRECTORY : GTK_STOCK_FILE, @@ -158,7 +158,7 @@ { g_return_val_if_fail(dir && strlen(dir) > ROOT_OFFSET, FALSE);
- return (utils->str_equal(dir + ROOT_OFFSET, G_DIR_SEPARATOR_S)); + return (p_utils->str_equal(dir + ROOT_OFFSET, G_DIR_SEPARATOR_S)); }
@@ -201,11 +201,11 @@
clear();
- utf8_dir = utils->get_utf8_from_locale(current_dir); + utf8_dir = p_utils->get_utf8_from_locale(current_dir); gtk_entry_set_text(GTK_ENTRY(path_entry), utf8_dir); g_free(utf8_dir);
- list = utils->get_file_list(current_dir, NULL, NULL); + list = p_utils->get_file_list(current_dir, NULL, NULL); if (list != NULL) { add_top_level_entry(); @@ -231,7 +231,7 @@ if (project) dir = project->base_path; if (NZV(dir)) - return utils->get_locale_from_utf8(dir); + return p_utils->get_locale_from_utf8(dir);
return g_get_current_dir(); } @@ -241,7 +241,7 @@ { gchar *fname; gchar *dir; - gint idx = documents->get_cur_idx(); + gint idx = p_document->get_cur_idx();
if (! DOC_IDX_VALID(idx) || doc_list[idx].file_name == NULL || ! g_path_is_absolute(doc_list[idx].file_name)) @@ -251,7 +251,7 @@ return; } fname = doc_list[idx].file_name; - fname = utils->get_locale_from_utf8(fname); + fname = p_utils->get_locale_from_utf8(fname); dir = g_path_get_dirname(fname); g_free(fname);
@@ -273,7 +273,7 @@ if (gtk_tree_selection_count_selected_rows(treesel) == 1) return TRUE;
- ui->set_statusbar(FALSE, _("Too many items selected!")); + p_ui->set_statusbar(FALSE, _("Too many items selected!")); return FALSE; }
@@ -295,7 +295,7 @@ gtk_tree_model_get_iter(model, &iter, treepath); gtk_tree_model_get(model, &iter, FILEVIEW_COLUMN_ICON, &icon, -1);
- if (utils->str_equal(icon, GTK_STOCK_DIRECTORY)) + if (p_utils->str_equal(icon, GTK_STOCK_DIRECTORY)) { dir_found = TRUE; g_free(icon); @@ -317,13 +317,13 @@ gtk_tree_model_get_iter(model, &iter, treepath); gtk_tree_model_get(model, &iter, FILEVIEW_COLUMN_NAME, &name, -1);
- if (utils->str_equal(name, "..")) + if (p_utils->str_equal(name, "..")) { fname = g_path_get_dirname(current_dir); } else { - setptr(name, utils->get_locale_from_utf8(name)); + setptr(name, p_utils->get_locale_from_utf8(name)); fname = g_build_filename(current_dir, name, NULL); } g_free(name); @@ -345,18 +345,18 @@ else dir = g_strdup(fname);
- utils->string_replace_all(cmd_str, "%f", fname); - utils->string_replace_all(cmd_str, "%d", dir); + p_utils->string_replace_all(cmd_str, "%f", fname); + p_utils->string_replace_all(cmd_str, "%d", dir);
cmd = g_string_free(cmd_str, FALSE); - locale_cmd = utils->get_locale_from_utf8(cmd); + locale_cmd = p_utils->get_locale_from_utf8(cmd); if (! g_spawn_command_line_async(locale_cmd, &error)) { gchar *c = strchr(cmd, ' ');
if (c != NULL) *c = '\0'; - ui->set_statusbar(TRUE, + p_ui->set_statusbar(TRUE, _("Could not execute configured external command '%s' (%s)."), cmd, error->message); g_error_free(error); @@ -398,7 +398,7 @@ }
-/* We use documents->open_files() as it's more efficient. */ +/* We use p_document->open_files() as it's more efficient. */ static void open_selected_files(GList *list) { GSList *files = NULL; @@ -411,7 +411,7 @@
files = g_slist_append(files, fname); } - documents->open_files(files, FALSE, NULL, NULL); + p_document->open_files(files, FALSE, NULL, NULL); g_slist_foreach(files, (GFunc) g_free, NULL); // free filenames g_slist_free(files); } @@ -482,8 +482,8 @@ g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL); g_list_free(list);
- setptr(dir, utils->get_utf8_from_locale(dir)); - search->show_find_in_files_dialog(dir); + setptr(dir, p_utils->get_utf8_from_locale(dir)); + p_search->show_find_in_files_dialog(dir); g_free(dir); }
@@ -546,7 +546,7 @@ gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); g_signal_connect_swapped((gpointer) item, "activate", - G_CALLBACK(keybindings->send_command), + G_CALLBACK(p_keybindings->send_command), GINT_TO_POINTER(GEANY_KEYS_MENU_SIDEBAR));
return menu; @@ -619,7 +619,7 @@ on_go_up(); return; } - new_dir = utils->get_locale_from_utf8(new_dir); + new_dir = p_utils->get_locale_from_utf8(new_dir); } else new_dir = g_strdup(g_get_home_dir()); @@ -674,7 +674,7 @@ static GtkWidget *make_toolbar() { GtkWidget *wid, *toolbar; - GtkTooltips *tooltips = GTK_TOOLTIPS(support->lookup_widget( + GtkTooltips *tooltips = GTK_TOOLTIPS(p_support->lookup_widget( app->window, "tooltips"));
toolbar = gtk_toolbar_new(); @@ -718,7 +718,7 @@ gtk_tree_model_get(GTK_TREE_MODEL(file_store), iter, FILEVIEW_COLUMN_ICON, &icon, FILEVIEW_COLUMN_NAME, &str, -1);
- if (str != NULL && icon != NULL && utils->str_equal(icon, GTK_STOCK_DIRECTORY) && + if (str != NULL && icon != NULL && p_utils->str_equal(icon, GTK_STOCK_DIRECTORY) && ! g_str_has_suffix(key, G_DIR_SEPARATOR_S)) { // key is something like "/tmp/te" and str is a filename like "test", @@ -838,7 +838,7 @@ dialog = gtk_dialog_new_with_buttons(_("File Browser"), GTK_WINDOW(parent), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - vbox = ui->dialog_vbox_new(GTK_DIALOG(dialog)); + vbox = p_ui->dialog_vbox_new(GTK_DIALOG(dialog)); gtk_widget_set_name(dialog, "GeanyDialog"); gtk_box_set_spacing(GTK_BOX(vbox), 6);
@@ -892,16 +892,16 @@ g_key_file_set_boolean(config, "filebrowser", "show_hidden_files", show_hidden_files); g_key_file_set_boolean(config, "filebrowser", "hide_object_files", hide_object_files);
- if (! g_file_test(config_dir, G_FILE_TEST_IS_DIR) && utils->mkdir(config_dir, TRUE) != 0) + if (! g_file_test(config_dir, G_FILE_TEST_IS_DIR) && p_utils->mkdir(config_dir, TRUE) != 0) { - dialogs->show_msgbox(GTK_MESSAGE_ERROR, + p_dialogs->show_msgbox(GTK_MESSAGE_ERROR, _("Plugin configuration directory could not be created.")); } else { // write config to file data = g_key_file_to_data(config, NULL, NULL); - utils->write_file(config_file, data); + p_utils->write_file(config_file, data); g_free(data); }
Modified: trunk/plugins/htmlchars.c =================================================================== --- trunk/plugins/htmlchars.c 2008-01-27 18:27:33 UTC (rev 2194) +++ trunk/plugins/htmlchars.c 2008-01-28 17:27:39 UTC (rev 2195) @@ -74,7 +74,7 @@ _("Special Characters"), GTK_WINDOW(app->window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, _("_Insert"), GTK_RESPONSE_OK, NULL); - vbox = ui->dialog_vbox_new(GTK_DIALOG(sc_dialog)); + vbox = p_ui->dialog_vbox_new(GTK_DIALOG(sc_dialog)); gtk_box_set_spacing(GTK_BOX(vbox), 6); gtk_widget_set_name(sc_dialog, "GeanyDialog");
@@ -425,18 +425,18 @@ * returns only TRUE if a valid selection(i.e. no category) could be found */ static gboolean sc_insert(GtkTreeModel *model, GtkTreeIter *iter) { - gint idx = documents->get_cur_idx(); + gint idx = p_document->get_cur_idx(); gboolean result = FALSE;
if (DOC_IDX_VALID(idx)) { gchar *str; - gint pos = scintilla->get_current_position(doc_list[idx].sci); + gint pos = p_sci->get_current_position(doc_list[idx].sci);
gtk_tree_model_get(model, iter, COLUMN_HTML_NAME, &str, -1); if (str && *str) { - scintilla->insert_text(doc_list[idx].sci, pos, str); + p_sci->insert_text(doc_list[idx].sci, pos, str); g_free(str); result = TRUE; } @@ -495,7 +495,7 @@ item_activate(GtkMenuItem *menuitem, gpointer gdata) { // refuse opening the dialog if we don't have an active tab - gint idx = documents->get_cur_idx(); + gint idx = p_document->get_cur_idx();
if (idx == -1 || ! doc_list[idx].is_valid) return;
Modified: trunk/plugins/pluginmacros.h =================================================================== --- trunk/plugins/pluginmacros.h 2008-01-27 18:27:33 UTC (rev 2194) +++ trunk/plugins/pluginmacros.h 2008-01-28 17:27:39 UTC (rev 2195) @@ -32,6 +32,42 @@ #define prefs geany_data->prefs #define project app->project
+#ifdef GEANY_DISABLE_DEPRECATED + +/* These macros are named the same as the first word in the core function name, + * but with a 'p_' prefix to prevent conflicts with other tag names. + * Example: document_open_file() -> p_document->open_file() */ +#define p_dialogs geany_data->dialogs +#define p_document geany_data->documents +#define p_encoding geany_data->encoding +#define p_highlighting geany_data->highlighting +#define p_keybindings geany_data->keybindings +#define p_msgwindow geany_data->msgwindow +#define p_sci geany_data->sci +#define p_search geany_data->search +#define p_support geany_data->support +#define p_templates geany_data->templates +#define p_tm geany_data->tm +#define p_ui geany_data->ui +#define p_utils geany_data->utils + +#else + +#define p_dialogs dialogs +#define p_document documents +#define p_encoding encodings +#define p_highlighting highlighting +#define p_keybindings keybindings +#define p_msgwindow msgwindow +#define p_sci scintilla +#define p_search search +#define p_support support +#define p_templates templates +#define p_tm tagmanager +#define p_ui ui +#define p_utils utils + +/* Temporary source compatibility macros - do not use these in new code. */ #define dialogs geany_data->dialogs #define documents geany_data->documents // avoids conflict with document typedef #define encodings geany_data->encoding // avoids conflict with document::encoding @@ -47,3 +83,5 @@ #define utils geany_data->utils
#endif + +#endif
Modified: trunk/plugins/vcdiff.c =================================================================== --- trunk/plugins/vcdiff.c 2008-01-27 18:27:33 UTC (rev 2194) +++ trunk/plugins/vcdiff.c 2008-01-28 17:27:39 UTC (rev 2195) @@ -270,37 +270,37 @@ // UTF-8 because internally Geany always needs UTF-8 if (force_encoding) { - text = encodings->convert_to_utf8_from_charset( + text = p_encoding->convert_to_utf8_from_charset( std_output, -1, force_encoding, TRUE); } else { - text = encodings->convert_to_utf8(std_output, -1, &detect_enc); + text = p_encoding->convert_to_utf8(std_output, -1, &detect_enc); } if (text) { idx = find_by_filename(filename); if ( idx == -1) { - idx = documents->new_file(filename, + idx = p_document->new_file(filename, geany_data->filetypes[GEANY_FILETYPES_DIFF], text); } else { - scintilla->set_text(doc_list[idx].sci, text); + p_sci->set_text(doc_list[idx].sci, text); book = GTK_NOTEBOOK(app->notebook); page = gtk_notebook_page_num(book, GTK_WIDGET(doc_list[idx].sci)); gtk_notebook_set_current_page(book, page); doc_list[idx].changed = FALSE; - documents->set_text_changed(idx); + p_document->set_text_changed(idx); }
- documents->set_encoding(idx, + p_document->set_encoding(idx, force_encoding ? force_encoding : detect_enc); } else { - ui->set_statusbar(FALSE, _("Could not parse the output of the diff")); + p_ui->set_statusbar(FALSE, _("Could not parse the output of the diff")); } g_free(text); g_free(detect_enc); @@ -339,7 +339,7 @@ // CVS dump stuff to stderr when diff nested dirs if (strcmp(argv[0], "cvs") != 0 && NZV(std_error)) { - dialogs->show_msgbox(1, + p_dialogs->show_msgbox(1, _("%s exited with an error: \n%s."), argv[0], g_strstrip(std_error)); } else if (NZV(std_output)) @@ -348,12 +348,12 @@ } else { - ui->set_statusbar(FALSE, _("No changes were made.")); + p_ui->set_statusbar(FALSE, _("No changes were made.")); } } else { - ui->set_statusbar(FALSE, + p_ui->set_statusbar(FALSE, _("Something went really wrong.")); } g_free(dir); @@ -372,16 +372,16 @@ gchar *locale_filename = NULL; gchar *text;
- idx = documents->get_cur_idx(); + idx = p_document->get_cur_idx();
g_return_if_fail(DOC_IDX_VALID(idx) && doc_list[idx].file_name != NULL);
if (doc_list[idx].changed) { - documents->save_file(idx, FALSE); + p_document->save_file(idx, FALSE); }
- locale_filename = utils->get_locale_from_utf8(doc_list[idx].file_name); + locale_filename = p_utils->get_locale_from_utf8(doc_list[idx].file_name); base_name = g_path_get_dirname(locale_filename);
text = make_diff(base_name, VC_COMMAND_DIFF_DIR); @@ -403,16 +403,16 @@ gchar *locale_filename = NULL; gchar *text;
- idx = documents->get_cur_idx(); + idx = p_document->get_cur_idx();
g_return_if_fail(project != NULL && NZV(project->base_path));
if (DOC_IDX_VALID(idx) && doc_list[idx].changed && doc_list[idx].file_name != NULL) { - documents->save_file(idx, FALSE); + p_document->save_file(idx, FALSE); }
- locale_filename = utils->get_locale_from_utf8(project->base_path); + locale_filename = p_utils->get_locale_from_utf8(project->base_path); text = make_diff(locale_filename, VC_COMMAND_DIFF_PROJECT); if (text) { @@ -429,16 +429,16 @@ gint idx; gchar *locale_filename, *text;
- idx = documents->get_cur_idx(); + idx = p_document->get_cur_idx();
g_return_if_fail(DOC_IDX_VALID(idx) && doc_list[idx].file_name != NULL);
if (doc_list[idx].changed) { - documents->save_file(idx, FALSE); + p_document->save_file(idx, FALSE); }
- locale_filename = utils->get_locale_from_utf8(doc_list[idx].file_name); + locale_filename = p_utils->get_locale_from_utf8(doc_list[idx].file_name);
text = make_diff(locale_filename, VC_COMMAND_DIFF_FILE); if (text) @@ -460,7 +460,7 @@ gboolean have_file; gboolean have_vc = FALSE;
- doc = documents->get_current(); + doc = p_document->get_current(); have_file = doc && doc->file_name && g_path_is_absolute(doc->file_name); if (find_cmd_env(VC_COMMAND_DIFF_FILE, TRUE, doc->file_name)) have_vc = TRUE;
Modified: trunk/src/plugindata.h =================================================================== --- trunk/src/plugindata.h 2008-01-27 18:27:33 UTC (rev 2194) +++ trunk/src/plugindata.h 2008-01-28 17:27:39 UTC (rev 2195) @@ -93,7 +93,7 @@
/* The API version should be incremented whenever any plugin data types below are * modified or appended to. */ -static const gint api_version = 39; +static const gint api_version = 40;
/* The ABI version should be incremented whenever existing fields in the plugin * data types below have to be changed or reordered. It should stay the same if fields
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.