SF.net SVN: geany: [2688] branches/document-pointer
eht16 at users.sourceforge.net
eht16 at xxxxx
Thu Jun 12 20:10:12 UTC 2008
Revision: 2688
http://geany.svn.sourceforge.net/geany/?rev=2688&view=rev
Author: eht16
Date: 2008-06-12 13:09:57 -0700 (Thu, 12 Jun 2008)
Log Message:
-----------
Note: this breaks the plugin API for msgwin and navqueue functions.
Make NavQueueFuncs and MsgWinFuncs use a GeanyDocument* instead of an integer index.
Adjust plugins to work with these changes.
Modified Paths:
--------------
branches/document-pointer/ChangeLog
branches/document-pointer/plugins/autosave.c
branches/document-pointer/plugins/classbuilder.c
branches/document-pointer/plugins/export.c
branches/document-pointer/plugins/filebrowser.c
branches/document-pointer/plugins/htmlchars.c
branches/document-pointer/plugins/vcdiff.c
branches/document-pointer/src/build.c
branches/document-pointer/src/encodings.c
branches/document-pointer/src/filetypes.c
branches/document-pointer/src/msgwindow.c
branches/document-pointer/src/msgwindow.h
branches/document-pointer/src/navqueue.c
branches/document-pointer/src/navqueue.h
branches/document-pointer/src/plugindata.h
branches/document-pointer/src/plugins.c
branches/document-pointer/src/prefs.c
branches/document-pointer/src/project.c
branches/document-pointer/src/search.c
branches/document-pointer/src/vte.c
Modified: branches/document-pointer/ChangeLog
===================================================================
--- branches/document-pointer/ChangeLog 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/ChangeLog 2008-06-12 20:09:57 UTC (rev 2688)
@@ -1,3 +1,17 @@
+2008-06-12 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/build.c, src/project.c, src/encodings.c, src/prefs.c,
+ src/navqueue.c, src/plugindata.h, src/navqueue.h, src/msgwindow.c,
+ src/msgwindow.h, src/vte.c, src/filetypes.c, src/search.c,
+ src/plugins.c, plugins/export.c, plugins/vcdiff.c,
+ plugins/filebrowser.c, plugins/htmlchars.c, plugins/autosave.c,
+ plugins/classbuilder.c:
+ Note: this breaks the plugin API for msgwin and navqueue functions.
+ Make NavQueueFuncs and MsgWinFuncs use a GeanyDocument* instead of an
+ integer index.
+ Adjust plugins to work with these changes.
+
+
2008-06-12 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/plugindata.h, src/document.c, src/plugins.c, src/document.h,
Modified: branches/document-pointer/plugins/autosave.c
===================================================================
--- branches/document-pointer/plugins/autosave.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/plugins/autosave.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -37,7 +37,7 @@
GeanyFunctions *geany_functions;
-PLUGIN_VERSION_CHECK(64)
+PLUGIN_VERSION_CHECK(69)
PLUGIN_SET_INFO(_("Auto Save"), _("Save automatically all open files in a given time interval."),
VERSION, _("The Geany developer team"))
@@ -52,26 +52,27 @@
gboolean auto_save(gpointer data)
{
- gint cur_idx = p_document->get_cur_idx();
- gint i, idx, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets->notebook));
+ GeanyDocument *doc;
+ GeanyDocument *cur_doc = p_document->get_current();
+ gint i, max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets->notebook));
gint saved_files = 0;
if (save_all)
{
for (i = 0; i < max; i++)
{
- idx = p_document->get_n_idx(i);
+ doc = p_document->get_from_page(i);
/* skip current file to save it lastly, skip files without name */
- if (idx != cur_idx && documents[idx]->file_name != NULL)
- if (p_document->save_file(idx, FALSE))
+ if (doc != cur_doc && cur_doc->file_name != NULL)
+ if (p_document->save_file(doc, FALSE))
saved_files++;
}
}
/* finally save current file, do it after all other files to get correct window title and
* symbol list */
- if (documents[cur_idx]->file_name != NULL)
- if (p_document->save_file(cur_idx, FALSE))
+ if (cur_doc->file_name != NULL)
+ if (p_document->save_file(cur_doc, FALSE))
saved_files++;
if (saved_files > 0 && print_msg)
Modified: branches/document-pointer/plugins/classbuilder.c
===================================================================
--- branches/document-pointer/plugins/classbuilder.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/plugins/classbuilder.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -39,7 +39,7 @@
GeanyFunctions *geany_functions;
-PLUGIN_VERSION_CHECK(64)
+PLUGIN_VERSION_CHECK(69)
PLUGIN_SET_INFO(_("Class Builder"), _("Creates source files for new class types."), VERSION,
"Alexander Rodin")
@@ -593,7 +593,7 @@
static void cc_dlg_on_create_class(CreateClassDialog *cc_dlg)
{
ClassInfo *class_info;
- gint idx;
+ GeanyDocument *doc;
gchar *text;
gchar *tmp;
@@ -731,16 +731,16 @@
if (! p_utils->str_equal(class_info->source, ""))
{
text = get_template_class_source(class_info);
- idx = p_document->new_file(class_info->source, NULL, NULL);
- p_sci->set_text(documents[idx]->sci, text);
+ doc = p_document->new_file(class_info->source, NULL, NULL);
+ p_sci->set_text(doc->sci, text);
g_free(text);
}
if (! p_utils->str_equal(class_info->header, ""))
{
text = get_template_class_header(class_info);
- idx = p_document->new_file(class_info->header, NULL, NULL);
- p_sci->set_text(documents[idx]->sci, text);
+ doc = p_document->new_file(class_info->header, NULL, NULL);
+ p_sci->set_text(doc->sci, text);
g_free(text);
}
Modified: branches/document-pointer/plugins/export.c
===================================================================
--- branches/document-pointer/plugins/export.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/plugins/export.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -42,7 +42,7 @@
GeanyData *geany_data;
GeanyFunctions *geany_functions;
-PLUGIN_VERSION_CHECK(64)
+PLUGIN_VERSION_CHECK(69)
PLUGIN_SET_INFO(_("Export"), _("Exports the current file into different formats."), VERSION,
_("The Geany developer team"))
@@ -105,17 +105,17 @@
DATE_TYPE_HTML
};
-typedef void (*ExportFunc) (gint idx, const gchar *filename, gboolean use_zoom);
+typedef void (*ExportFunc) (GeanyDocument *doc, const gchar *filename, gboolean use_zoom);
typedef struct
{
- gint idx;
+ GeanyDocument *doc;
gboolean have_zoom_level_checkbox;
ExportFunc export_func;
} ExportInfo;
static void on_file_save_dialog_response(GtkDialog *dialog, gint response, gpointer user_data);
-static void write_html_file(gint idx, const gchar *filename, gboolean use_zoom);
-static void write_latex_file(gint idx, const gchar *filename, gboolean use_zoom);
+static void write_html_file(GeanyDocument *doc, const gchar *filename, gboolean use_zoom);
+static void write_latex_file(GeanyDocument *doc, const gchar *filename, gboolean use_zoom);
/* converts a RGB colour into a LaTeX compatible representation, taken from SciTE */
@@ -154,19 +154,19 @@
static void create_file_save_as_dialog(const gchar *extension, ExportFunc func,
gboolean show_zoom_level_checkbox)
{
- gint idx;
GtkWidget *dialog;
GtkTooltips *tooltips;
+ GeanyDocument *doc;
ExportInfo *exi;
if (extension == NULL)
return;
- idx = p_document->get_cur_idx();
+ doc = p_document->get_current();
tooltips = GTK_TOOLTIPS(p_support->lookup_widget(main_widgets->window, "tooltips"));
exi = g_new(ExportInfo, 1);
- exi->idx = idx;
+ exi->doc = doc;
exi->export_func = func;
exi->have_zoom_level_checkbox = FALSE;
@@ -209,20 +209,20 @@
/* if the current document has a filename we use it as the default. */
gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(dialog));
- if (documents[idx]->file_name != NULL)
+ if (doc->file_name != NULL)
{
- gchar *base_name = g_path_get_basename(documents[idx]->file_name);
+ gchar *base_name = g_path_get_basename(doc->file_name);
gchar *short_name = p_utils->remove_ext_from_filename(base_name);
gchar *file_name;
gchar *locale_filename;
gchar *locale_dirname;
gchar *suffix = "";
- if (g_str_has_suffix(documents[idx]->file_name, extension))
+ if (g_str_has_suffix(doc->file_name, extension))
suffix = "_export";
file_name = g_strconcat(short_name, suffix, extension, NULL);
- locale_filename = p_utils->get_locale_from_utf8(documents[idx]->file_name);
+ locale_filename = p_utils->get_locale_from_utf8(doc->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
@@ -337,7 +337,7 @@
return;
}
- exi->export_func(exi->idx, new_filename, use_zoom_level);
+ exi->export_func(exi->doc, new_filename, use_zoom_level);
g_free(utf8_filename);
g_free(new_filename);
@@ -347,7 +347,7 @@
}
-static void write_latex_file(gint idx, const gchar *filename, gboolean use_zoom)
+static void write_latex_file(GeanyDocument *doc, const gchar *filename, gboolean use_zoom)
{
gint i, style = -1, old_style = 0, column = 0;
gchar c, c_next, *tmp;
@@ -357,25 +357,25 @@
GString *body;
GString *cmds;
GString *latex;
- gint style_max = pow(2, p_sci->send_message(documents[idx]->sci, SCI_GETSTYLEBITS, 0, 0));
+ gint style_max = pow(2, p_sci->send_message(doc->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(documents[idx]->sci, SCI_STYLEGETFORE, i, 0);
- styles[i][BACK] = p_sci->send_message(documents[idx]->sci, SCI_STYLEGETBACK, i, 0);
- styles[i][BOLD] = p_sci->send_message(documents[idx]->sci, SCI_STYLEGETBOLD, i, 0);
- styles[i][ITALIC] = p_sci->send_message(documents[idx]->sci, SCI_STYLEGETITALIC, i, 0);
+ styles[i][FORE] = p_sci->send_message(doc->sci, SCI_STYLEGETFORE, i, 0);
+ styles[i][BACK] = p_sci->send_message(doc->sci, SCI_STYLEGETBACK, i, 0);
+ styles[i][BOLD] = p_sci->send_message(doc->sci, SCI_STYLEGETBOLD, i, 0);
+ styles[i][ITALIC] = p_sci->send_message(doc->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(documents[idx]->sci); i++)
+ for (i = 0; i < p_sci->get_length(doc->sci); i++)
{
- style = p_sci->get_style_at(documents[idx]->sci, i);
- c = p_sci->get_char_at(documents[idx]->sci, i);
- c_next = p_sci->get_char_at(documents[idx]->sci, i + 1);
+ style = p_sci->get_style_at(doc->sci, i);
+ c = p_sci->get_char_at(doc->sci, i);
+ c_next = p_sci->get_char_at(doc->sci, i + 1);
if (style != old_style || ! block_open)
{
@@ -538,10 +538,10 @@
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 (documents[idx]->file_name == NULL)
+ if (doc->file_name == NULL)
p_utils->string_replace_all(latex, "{export_filename}", GEANY_STRING_UNTITLED);
else
- p_utils->string_replace_all(latex, "{export_filename}", documents[idx]->file_name);
+ p_utils->string_replace_all(latex, "{export_filename}", doc->file_name);
write_data(filename, latex->str);
@@ -551,7 +551,7 @@
}
-static void write_html_file(gint idx, const gchar *filename, gboolean use_zoom)
+static void write_html_file(GeanyDocument *doc, const gchar *filename, gboolean use_zoom)
{
gint i, style = -1, old_style = 0, column = 0;
gchar c, c_next;
@@ -564,15 +564,15 @@
GString *body;
GString *css;
GString *html;
- gint style_max = pow(2, p_sci->send_message(documents[idx]->sci, SCI_GETSTYLEBITS, 0, 0));
+ gint style_max = pow(2, p_sci->send_message(doc->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(documents[idx]->sci, SCI_STYLEGETFORE, i, 0));
- styles[i][BACK] = ROTATE_RGB(p_sci->send_message(documents[idx]->sci, SCI_STYLEGETBACK, i, 0));
- styles[i][BOLD] = p_sci->send_message(documents[idx]->sci, SCI_STYLEGETBOLD, i, 0);
- styles[i][ITALIC] = p_sci->send_message(documents[idx]->sci, SCI_STYLEGETITALIC, i, 0);
+ styles[i][FORE] = ROTATE_RGB(p_sci->send_message(doc->sci, SCI_STYLEGETFORE, i, 0));
+ styles[i][BACK] = ROTATE_RGB(p_sci->send_message(doc->sci, SCI_STYLEGETBACK, i, 0));
+ styles[i][BOLD] = p_sci->send_message(doc->sci, SCI_STYLEGETBOLD, i, 0);
+ styles[i][ITALIC] = p_sci->send_message(doc->sci, SCI_STYLEGETITALIC, i, 0);
styles[i][USED] = 0;
}
@@ -581,18 +581,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 = p_sci->send_message(documents[idx]->sci, SCI_STYLEGETSIZE, 0, 0);
+ font_size = p_sci->send_message(doc->sci, SCI_STYLEGETSIZE, 0, 0);
if (use_zoom)
- font_size += p_sci->send_message(documents[idx]->sci, SCI_GETZOOM, 0, 0);
+ font_size += p_sci->send_message(doc->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(documents[idx]->sci); i++)
+ for (i = 0; i < p_sci->get_length(doc->sci); i++)
{
- style = p_sci->get_style_at(documents[idx]->sci, i);
- c = p_sci->get_char_at(documents[idx]->sci, i);
+ style = p_sci->get_style_at(doc->sci, i);
+ c = p_sci->get_char_at(doc->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(documents[idx]->sci, i + 1);
+ c_next = p_sci->get_char_at(doc->sci, i + 1);
if ((style != old_style || ! span_open) && ! isspace(c))
{
@@ -690,10 +690,10 @@
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 (documents[idx]->file_name == NULL)
+ if (doc->file_name == NULL)
p_utils->string_replace_all(html, "{export_filename}", GEANY_STRING_UNTITLED);
else
- p_utils->string_replace_all(html, "{export_filename}", documents[idx]->file_name);
+ p_utils->string_replace_all(html, "{export_filename}", doc->file_name);
write_data(filename, html->str);
Modified: branches/document-pointer/plugins/filebrowser.c
===================================================================
--- branches/document-pointer/plugins/filebrowser.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/plugins/filebrowser.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -46,7 +46,7 @@
GeanyFunctions *geany_functions;
-PLUGIN_VERSION_CHECK(64)
+PLUGIN_VERSION_CHECK(69)
PLUGIN_SET_INFO(_("File Browser"), _("Adds a file browser tab to the sidebar."), VERSION,
_("The Geany developer team"))
@@ -275,16 +275,15 @@
{
gchar *fname;
gchar *dir;
- gint idx = p_document->get_cur_idx();
+ GeanyDocument *doc = p_document->get_current();
- if (! DOC_IDX_VALID(idx) || documents[idx]->file_name == NULL ||
- ! g_path_is_absolute(documents[idx]->file_name))
+ if (doc == NULL || doc->file_name == NULL || ! g_path_is_absolute(doc->file_name))
{
setptr(current_dir, get_default_dir());
refresh();
return;
}
- fname = documents[idx]->file_name;
+ fname = doc->file_name;
fname = p_utils->get_locale_from_utf8(fname);
dir = g_path_get_dirname(fname);
g_free(fname);
Modified: branches/document-pointer/plugins/htmlchars.c
===================================================================
--- branches/document-pointer/plugins/htmlchars.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/plugins/htmlchars.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -30,6 +30,7 @@
#include "document.h"
#include "keybindings.h"
#include "ui_utils.h"
+#include "utils.h"
#include "pluginmacros.h"
@@ -38,7 +39,7 @@
GeanyFunctions *geany_functions;
-PLUGIN_VERSION_CHECK(64)
+PLUGIN_VERSION_CHECK(69)
PLUGIN_SET_INFO(_("HTML Characters"), _("Inserts HTML character entities like '&'."), VERSION,
_("The Geany developer team"))
@@ -438,18 +439,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 = p_document->get_cur_idx();
+ GeanyDocument *doc = p_document->get_current();
gboolean result = FALSE;
- if (DOC_IDX_VALID(idx))
+ if (doc != NULL)
{
gchar *str;
- gint pos = p_sci->get_current_position(documents[idx]->sci);
+ gint pos = p_sci->get_current_position(doc->sci);
gtk_tree_model_get(model, iter, COLUMN_HTML_NAME, &str, -1);
- if (str && *str)
+ if (NZV(str))
{
- p_sci->insert_text(documents[idx]->sci, pos, str);
+ p_sci->insert_text(doc->sci, pos, str);
g_free(str);
result = TRUE;
}
@@ -507,11 +508,6 @@
static void
item_activate(GtkMenuItem *menuitem, gpointer gdata)
{
- /* refuse opening the dialog if we don't have an active tab */
- gint idx = p_document->get_cur_idx();
-
- if (idx == -1 || ! documents[idx]->is_valid) return;
-
tools_show_dialog_insert_special_chars();
}
Modified: branches/document-pointer/plugins/vcdiff.c
===================================================================
--- branches/document-pointer/plugins/vcdiff.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/plugins/vcdiff.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -45,7 +45,7 @@
GeanyFunctions *geany_functions;
-PLUGIN_VERSION_CHECK(64)
+PLUGIN_VERSION_CHECK(69)
PLUGIN_SET_INFO(_("Version Diff"), _("Creates a patch of a file against version control."), VERSION,
_("The Geany developer team"))
@@ -253,7 +253,8 @@
const gchar *force_encoding)
{
gchar *text, *detect_enc = NULL;
- gint idx, page;
+ gint page;
+ GeanyDocument *doc;
GtkNotebook *book;
gchar *filename;
@@ -273,23 +274,22 @@
}
if (text)
{
- idx = p_document->find_by_filename(filename);
- if ( idx == -1)
+ doc = p_document->find_by_filename(filename);
+ if (doc == NULL)
{
GeanyFiletype *ft = p_filetypes->lookup_by_name("Diff");
- idx = p_document->new_file(filename, ft, text);
+ doc = p_document->new_file(filename, ft, text);
}
else
{
- p_sci->set_text(documents[idx]->sci, text);
+ p_sci->set_text(doc->sci, text);
book = GTK_NOTEBOOK(main_widgets->notebook);
- page = gtk_notebook_page_num(book, GTK_WIDGET(documents[idx]->sci));
+ page = gtk_notebook_page_num(book, GTK_WIDGET(doc->sci));
gtk_notebook_set_current_page(book, page);
- documents[idx]->changed = FALSE;
- p_document->set_text_changed(idx);
+ p_document->set_text_changed(doc, FALSE);
}
- p_document->set_encoding(idx,
+ p_document->set_encoding(doc,
force_encoding ? force_encoding : detect_enc);
}
else
@@ -382,21 +382,21 @@
/* Make a diff from the current directory */
static void vcdirectory_activated(GtkMenuItem *menuitem, gpointer gdata)
{
- gint idx;
+ GeanyDocument *doc;
gchar *base_name = NULL;
gchar *locale_filename = NULL;
gchar *text;
- idx = p_document->get_cur_idx();
+ doc = p_document->get_current();
- g_return_if_fail(DOC_IDX_VALID(idx) && documents[idx]->file_name != NULL);
+ g_return_if_fail(doc != NULL && doc->file_name != NULL);
- if (documents[idx]->changed)
+ if (doc->changed)
{
- p_document->save_file(idx, FALSE);
+ p_document->save_file(doc, FALSE);
}
- locale_filename = p_utils->get_locale_from_utf8(documents[idx]->file_name);
+ locale_filename = p_utils->get_locale_from_utf8(doc->file_name);
base_name = g_path_get_dirname(locale_filename);
text = make_diff(base_name, VC_COMMAND_DIFF_DIR);
@@ -415,17 +415,17 @@
/* Callback if menu item for the current project was activated */
static void vcproject_activated(GtkMenuItem *menuitem, gpointer gdata)
{
- gint idx;
+ GeanyDocument *doc;
gchar *locale_filename = NULL;
gchar *text;
- idx = p_document->get_cur_idx();
+ doc = p_document->get_current();
g_return_if_fail(project != NULL && NZV(project->base_path));
- if (DOC_IDX_VALID(idx) && documents[idx]->changed && documents[idx]->file_name != NULL)
+ if (doc != NULL && doc->changed && doc->file_name != NULL)
{
- p_document->save_file(idx, FALSE);
+ p_document->save_file(doc, FALSE);
}
locale_filename = p_utils->get_locale_from_utf8(project->base_path);
@@ -442,24 +442,24 @@
/* Callback if menu item for a single file was activated */
static void vcfile_activated(GtkMenuItem *menuitem, gpointer gdata)
{
- gint idx;
- gchar *locale_filename, *text;
+ GeanyDocument *doc;
+ gchar *locale_filename, *text;
- idx = p_document->get_cur_idx();
+ doc = p_document->get_current();
- g_return_if_fail(DOC_IDX_VALID(idx) && documents[idx]->file_name != NULL);
+ g_return_if_fail(doc != NULL && doc->file_name != NULL);
- if (documents[idx]->changed)
+ if (doc->changed)
{
- p_document->save_file(idx, FALSE);
+ p_document->save_file(doc, FALSE);
}
- locale_filename = p_utils->get_locale_from_utf8(documents[idx]->file_name);
+ locale_filename = p_utils->get_locale_from_utf8(doc->file_name);
text = make_diff(locale_filename, VC_COMMAND_DIFF_FILE);
if (text)
{
- show_output(text, documents[idx]->file_name, documents[idx]->encoding);
+ show_output(text, doc->file_name, doc->encoding);
g_free(text);
}
g_free(locale_filename);
Modified: branches/document-pointer/src/build.c
===================================================================
--- branches/document-pointer/src/build.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/src/build.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -48,8 +48,8 @@
#include "utils.h"
#include "ui_utils.h"
#include "dialogs.h"
+#include "document.h"
#include "msgwindow.h"
-#include "document.h"
#include "filetypes.h"
#include "keybindings.h"
#include "vte.h"
Modified: branches/document-pointer/src/encodings.c
===================================================================
--- branches/document-pointer/src/encodings.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/src/encodings.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -37,6 +37,7 @@
#include "geany.h"
#include "utils.h"
#include "support.h"
+#include "document.h"
#include "msgwindow.h"
#include "encodings.h"
#include "callbacks.h"
Modified: branches/document-pointer/src/filetypes.c
===================================================================
--- branches/document-pointer/src/filetypes.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/src/filetypes.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -33,9 +33,9 @@
#include "highlighting.h"
#include "support.h"
#include "templates.h"
+#include "document.h"
#include "msgwindow.h"
#include "utils.h"
-#include "document.h"
#include "sciwrappers.h"
#include "ui_utils.h"
Modified: branches/document-pointer/src/msgwindow.c
===================================================================
--- branches/document-pointer/src/msgwindow.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/src/msgwindow.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -33,7 +33,6 @@
#include "support.h"
#include "prefs.h"
#include "callbacks.h"
-#include "msgwindow.h"
#include "ui_utils.h"
#include "utils.h"
#include "document.h"
@@ -43,6 +42,7 @@
#include "vte.h"
#include "navqueue.h"
#include "editor.h"
+#include "msgwindow.h"
#include <string.h>
#include <stdlib.h>
@@ -135,8 +135,8 @@
GtkTreeSelection *selection;
PangoFontDescription *pfd;
- /* doc idx, line, fg, str */
- msgwindow.store_msg = gtk_list_store_new(4, G_TYPE_INT, G_TYPE_INT,
+ /* line, doc, fg, str */
+ msgwindow.store_msg = gtk_list_store_new(4, G_TYPE_INT, G_TYPE_POINTER,
GDK_TYPE_COLOR, G_TYPE_STRING);
gtk_tree_view_set_model(GTK_TREE_VIEW(msgwindow.tree_msg), GTK_TREE_MODEL(msgwindow.store_msg));
@@ -269,16 +269,16 @@
/**
* Adds a new message in the messages tab treeview in the messages window.
- * If @c line and @c idx are set, clicking on this line jumps into the file which is specified
- * by @c idx into the line specified with @c line.
+ * If @c line and @c doc are set, clicking on this line jumps into the file which is specified
+ * by @c doc into the line specified with @c line.
*
* @param msg_color A color to be used for the text. It must be an element of #MsgColors.
* @param line The document's line where the message belongs to. Set to -1 to ignore.
- * @param idx The document's index in the documents_array. Set to -1 to ignore.
+ * @param doc The document. Set to @c NULL to ignore.
* @param format Printf()-style format string.
* @param ... Arguments for the @c format string.
**/
-void msgwin_msg_add_fmt(gint msg_color, gint line, gint idx, const gchar *format, ...)
+void msgwins_msg_add_fmt(gint msg_color, gint line, GeanyDocument *doc, const gchar *format, ...)
{
gchar string[512];
va_list args;
@@ -287,12 +287,12 @@
g_vsnprintf(string, 512, format, args);
va_end(args);
- msgwin_msg_add(msg_color, line, idx, string);
+ msgwins_msg_add(msg_color, line, doc, string);
}
/* adds string to the msg treeview */
-void msgwin_msg_add(gint msg_color, gint line, gint idx, const gchar *string)
+void msgwins_msg_add(gint msg_color, gint line, GeanyDocument *doc, const gchar *string)
{
GtkTreeIter iter;
const GdkColor *color = get_color(msg_color);
@@ -309,7 +309,7 @@
tmp = g_strdup(string);
gtk_list_store_append(msgwindow.store_msg, &iter);
- gtk_list_store_set(msgwindow.store_msg, &iter, 0, line, 1, idx, 2, color, 3, tmp, -1);
+ gtk_list_store_set(msgwindow.store_msg, &iter, 0, line, 1, doc, 2, color, 3, tmp, -1);
gtk_widget_set_sensitive(lookup_widget(main_widgets.window, "next_message1"), TRUE);
@@ -317,6 +317,28 @@
}
+/* temporary compatibility functions */
+void msgwin_msg_add_fmt(gint msg_color, gint line, gint idx, const gchar *format, ...)
+{
+ gchar string[512];
+ va_list args;
+
+ va_start(args, format);
+ g_vsnprintf(string, 512, format, args);
+ va_end(args);
+
+ msgwins_msg_add(msg_color, line, documents[idx], string);
+}
+
+
+void msgwin_msg_add(gint msg_color, gint line, gint idx, const gchar *string)
+{
+ if (! DOC_IDX_VALID(idx))
+ return;
+ msgwins_msg_add(msg_color, line, documents[idx], string);
+}
+
+
/**
* Log a status message *without* setting the status bar.
* (Use ui_set_statusbar() to display text on the statusbar)
Modified: branches/document-pointer/src/msgwindow.h
===================================================================
--- branches/document-pointer/src/msgwindow.h 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/src/msgwindow.h 2008-06-12 20:09:57 UTC (rev 2688)
@@ -84,6 +84,12 @@
void msgwin_clear_tab(gint tabnum);
+void msgwins_msg_add_fmt(gint msg_color, gint line, GeanyDocument *doc, const gchar *format, ...)
+ G_GNUC_PRINTF (4, 5);
+
+void msgwins_msg_add(gint msg_color, gint line, GeanyDocument *doc, const gchar *string);
+
+/* temporary compatibility functions */
void msgwin_msg_add_fmt(gint msg_color, gint line, gint idx, const gchar *format, ...) G_GNUC_PRINTF (4, 5);
void msgwin_msg_add(gint msg_color, gint line, gint idx, const gchar *string);
Modified: branches/document-pointer/src/navqueue.c
===================================================================
--- branches/document-pointer/src/navqueue.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/src/navqueue.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -28,13 +28,13 @@
#include "geany.h"
-#include "navqueue.h"
#include "sciwrappers.h"
#include "document.h"
#include "utils.h"
#include "support.h"
#include "ui_utils.h"
#include "editor.h"
+#include "navqueue.h"
/* for the navigation history queue */
@@ -137,40 +137,47 @@
/**
* Add old file position and new file position to the navqueue, then goes to the new position.
*
- * @param old_idx the %document index of the previous position, if set as invalid (-1) then no old
+ * @param old_doc The document of the previous position, if set as invalid (@c NULL) then no old
* position is set
- * @param new_idx the %document index of the new position, must be valid.
+ * @param new_doc The document of the new position, must be valid.
* @param line the line number of the new position. It is counted with 1 as the first line, not 0.
*
* @return @a TRUE if the cursor has changed the position to @a line or @a FALSE otherwise.
**/
-gboolean navqueue_goto_line(gint old_idx, gint new_idx, gint line)
+gboolean navqueues_goto_line(GeanyDocument *old_doc, GeanyDocument *new_doc, gint line)
{
gint pos;
- g_return_val_if_fail(DOC_IDX_VALID(new_idx), FALSE);
+ g_return_val_if_fail(new_doc != NULL, FALSE);
g_return_val_if_fail(line >= 1, FALSE);
- pos = sci_get_position_from_line(documents[new_idx]->sci, line - 1);
+ pos = sci_get_position_from_line(new_doc->sci, line - 1);
/* first add old file position */
- if (DOC_IDX_VALID(old_idx) && documents[old_idx]->file_name)
+ if (old_doc != NULL && old_doc->file_name)
{
- gint cur_pos = sci_get_current_position(documents[old_idx]->sci);
+ gint cur_pos = sci_get_current_position(old_doc->sci);
- add_new_position(documents[old_idx]->file_name, cur_pos);
+ add_new_position(old_doc->file_name, cur_pos);
}
/* now add new file position */
- if (documents[new_idx]->file_name)
+ if (new_doc->file_name)
{
- add_new_position(documents[new_idx]->file_name, pos);
+ add_new_position(new_doc->file_name, pos);
}
- return editor_goto_pos(new_idx, pos, TRUE);
+ return editor_goto_pos(DOC_IDX(new_doc), pos, TRUE);
}
+/* temporary compatibility function */
+gboolean navqueue_goto_line(gint old_idx, gint new_idx, gint line)
+{
+ return navqueues_goto_line(documents[old_idx], documents[new_idx], line);
+}
+
+
static gboolean goto_file_pos(const gchar *file, gint pos)
{
gint file_idx = document_find_by_filename(file);
Modified: branches/document-pointer/src/navqueue.h
===================================================================
--- branches/document-pointer/src/navqueue.h 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/src/navqueue.h 2008-06-12 20:09:57 UTC (rev 2688)
@@ -39,6 +39,9 @@
void navqueue_remove_file(const gchar *filename);
+gboolean navqueues_goto_line(GeanyDocument *old_doc, GeanyDocument *new_doc, gint line);
+
+/* temporary compatibility function */
gboolean navqueue_goto_line(gint old_idx, gint new_idx, gint line);
void navqueue_go_back(void);
Modified: branches/document-pointer/src/plugindata.h
===================================================================
--- branches/document-pointer/src/plugindata.h 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/src/plugindata.h 2008-06-12 20:09:57 UTC (rev 2688)
@@ -237,7 +237,8 @@
void (*get_text) (struct _ScintillaObject *sci, gint len, gchar* text);
gint (*get_length) (struct _ScintillaObject *sci);
gint (*get_current_position) (struct _ScintillaObject *sci);
- void (*set_current_position) (struct _ScintillaObject* sci, gint position, gboolean scroll_to_caret);
+ void (*set_current_position) (struct _ScintillaObject* sci, gint position,
+ gboolean scroll_to_caret);
gint (*get_col_from_position) (struct _ScintillaObject* sci, gint position);
gint (*get_line_from_position) (struct _ScintillaObject* sci, gint position);
gint (*get_position_from_line) (struct _ScintillaObject* sci, gint line);
@@ -342,8 +343,8 @@
/* status_add() does not set the status bar - use ui->set_statusbar() instead. */
void (*status_add) (const gchar *format, ...);
void (*compiler_add) (gint msg_color, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
- void (*msg_add) (gint msg_color, gint line, gint idx, const gchar *format, ...)
- G_GNUC_PRINTF (4, 5);
+ void (*msg_add) (gint msg_color, gint line, struct GeanyDocument *doc,
+ const gchar *format, ...) G_GNUC_PRINTF (4, 5);
void (*clear_tab) (gint tabnum);
void (*switch_tab) (gint tabnum, gboolean show);
}
@@ -417,7 +418,8 @@
/* See navqueue.h */
typedef struct NavQueueFuncs
{
- gboolean (*goto_line) (gint old_idx, gint new_idx, gint line);
+ gboolean (*goto_line) (struct GeanyDocument *old_doc, struct GeanyDocument *new_doc,
+ gint line);
}
NavQueueFuncs;
Modified: branches/document-pointer/src/plugins.c
===================================================================
--- branches/document-pointer/src/plugins.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/src/plugins.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -194,7 +194,7 @@
static MsgWinFuncs msgwin_funcs = {
&msgwin_status_add,
&msgwin_compiler_add_fmt,
- &msgwin_msg_add_fmt,
+ &msgwins_msg_add_fmt,
&msgwin_clear_tab,
&msgwin_switch_tab
};
@@ -234,7 +234,7 @@
};
static NavQueueFuncs navqueue_funcs = {
- &navqueue_goto_line
+ &navqueues_goto_line
};
static GeanyFunctions geany_functions = {
Modified: branches/document-pointer/src/prefs.c
===================================================================
--- branches/document-pointer/src/prefs.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/src/prefs.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -36,10 +36,10 @@
#include "dialogs.h"
#include "ui_utils.h"
#include "utils.h"
-#include "msgwindow.h"
#include "sciwrappers.h"
#include "document.h"
#include "documentprivate.h"
+#include "msgwindow.h"
#include "keyfile.h"
#include "keybindings.h"
#include "interface.h"
Modified: branches/document-pointer/src/project.c
===================================================================
--- branches/document-pointer/src/project.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/src/project.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -35,6 +35,7 @@
#include "support.h"
#include "utils.h"
#include "ui_utils.h"
+#include "document.h"
#include "msgwindow.h"
#include "main.h"
#include "keyfile.h"
@@ -42,7 +43,6 @@
# include "win32.h"
#endif
#include "build.h"
-#include "document.h"
#include "geanyobject.h"
Modified: branches/document-pointer/src/search.c
===================================================================
--- branches/document-pointer/src/search.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/src/search.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -33,8 +33,8 @@
#include "prefs.h"
#include "support.h"
#include "utils.h"
+#include "document.h"
#include "msgwindow.h"
-#include "document.h"
#include "sciwrappers.h"
#include "ui_utils.h"
#include "editor.h"
Modified: branches/document-pointer/src/vte.c
===================================================================
--- branches/document-pointer/src/vte.c 2008-06-12 16:50:01 UTC (rev 2687)
+++ branches/document-pointer/src/vte.c 2008-06-12 20:09:57 UTC (rev 2688)
@@ -35,12 +35,12 @@
#include <errno.h>
#include "vte.h"
-#include "msgwindow.h"
#include "support.h"
#include "prefs.h"
#include "ui_utils.h"
#include "utils.h"
#include "document.h"
+#include "msgwindow.h"
#include "callbacks.h"
#include "geanywraplabel.h"
@@ -435,9 +435,9 @@
}
case POPUP_CHANGEPATH:
{
- gint idx = document_get_cur_idx();
- if (DOC_IDX_VALID(idx))
- vte_cwd(documents[idx]->file_name, TRUE);
+ GeanyDocument *doc = document_get_current();
+ if (doc != NULL)
+ vte_cwd(doc->file_name, TRUE);
break;
}
case POPUP_RESTARTTERMINAL:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list