Revision: 2610
http://geany.svn.sourceforge.net/geany/?rev=2610&view=rev
Author: ntrel
Date: 2008-05-23 05:29:32 -0700 (Fri, 23 May 2008)
Log Message:
-----------
Make GeanyCallback, geany_callbacks deprecated, and replace with
PluginCallback, plugin_callbacks. This is because the array is owned
by the plugin, not Geany.
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/plugin-symbols.c
trunk/doc/plugins.dox
trunk/src/plugindata.h
trunk/src/plugins.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-05-22 14:41:28 UTC (rev 2609)
+++ trunk/ChangeLog 2008-05-23 12:29:32 UTC (rev 2610)
@@ -1,3 +1,12 @@
+2008-05-23 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/plugindata.h, src/plugins.c, doc/plugin-symbols.c,
+ doc/plugins.dox:
+ Make GeanyCallback, geany_callbacks deprecated, and replace with
+ PluginCallback, plugin_callbacks. This is because the array is owned
+ by the plugin, not Geany.
+
+
2008-05-22 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/templates.c, src/build.c, src/utils.c, src/ui_utils.h,
Modified: trunk/doc/plugin-symbols.c
===================================================================
--- trunk/doc/plugin-symbols.c 2008-05-22 14:41:28 UTC (rev 2609)
+++ trunk/doc/plugin-symbols.c 2008-05-23 12:29:32 UTC (rev 2610)
@@ -53,7 +53,7 @@
/** An array for connecting GeanyObject events, which should be terminated with
* @c {NULL, NULL, FALSE, NULL}. See @link signals Signal documentation @endlink. */
-GeanyCallback geany_callbacks[];
+PluginCallback plugin_callbacks[];
/** Most plugins should use the PLUGIN_KEY_GROUP() macro to define it. However,
* its fields are not read until after init() is called for the plugin, so it
Modified: trunk/doc/plugins.dox
===================================================================
--- trunk/doc/plugins.dox 2008-05-22 14:41:28 UTC (rev 2609)
+++ trunk/doc/plugins.dox 2008-05-23 12:29:32 UTC (rev 2610)
@@ -55,9 +55,9 @@
*
* @section Usage
*
- * To use plugin signals in Geany, you simply create a GeanyCallback array, list the signals
+ * To use plugin signals in Geany, you simply create a PluginCallback array, list the signals
* you want to listen to and create the appropiate signal callbacks for each signal.
- * @note The GeanyCallback array has to be ended with a final NULL entry.
+ * @note The PluginCallback array has to be ended with a final NULL entry.
*
* The following code demonstrates how to use signals in Geany plugins. The code can be inserted
* in your plugin code at any desired position.
@@ -68,7 +68,7 @@
printf("Example: %s was opened\n", DOC_FILENAME(idx));
}
-GeanyCallback geany_callbacks[] =
+PluginCallback plugin_callbacks[] =
{
{ "document-open", (GCallback) &on_document_open, FALSE, NULL },
{ NULL, NULL, FALSE, NULL }
Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h 2008-05-22 14:41:28 UTC (rev 2609)
+++ trunk/src/plugindata.h 2008-05-23 12:29:32 UTC (rev 2610)
@@ -111,7 +111,7 @@
/** callback array entry */
-typedef struct GeanyCallback
+typedef struct PluginCallback
{
/** The name of signal, must be an existing signal. For a list of available signals,
* please see the @link signals Signal documentation @endlink. */
@@ -123,7 +123,7 @@
/** The user data passed to the signal handler. */
gpointer user_data;
}
-GeanyCallback;
+PluginCallback;
@@ -442,13 +442,15 @@
#define GEANY_MAX_FILE_TYPES \
filetypes_array->len
-
#define GEANY_FILETYPES_ALL \
GEANY_FILETYPES_NONE
typedef struct _GeanyDocument document;
typedef struct _GeanyFiletype filetype;
+typedef PluginCallback GeanyCallback;
+#define geany_callbacks plugin_callbacks
+
#endif /* GEANY_DISABLE_DEPRECATED */
#endif
Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c 2008-05-22 14:41:28 UTC (rev 2609)
+++ trunk/src/plugins.c 2008-05-23 12:29:32 UTC (rev 2610)
@@ -378,9 +378,9 @@
}
-static void add_callbacks(Plugin *plugin, GeanyCallback *callbacks)
+static void add_callbacks(Plugin *plugin, PluginCallback *callbacks)
{
- GeanyCallback *cb;
+ PluginCallback *cb;
guint i, len = 0;
while (TRUE)
@@ -428,7 +428,7 @@
static void
plugin_init(Plugin *plugin)
{
- GeanyCallback *callbacks;
+ PluginCallback *callbacks;
if (plugin->init)
plugin->init(&geany_data);
@@ -439,7 +439,7 @@
gtk_widget_set_sensitive(plugin->fields.menu_item, enable);
}
- g_module_symbol(plugin->module, "geany_callbacks", (void *) &callbacks);
+ g_module_symbol(plugin->module, "plugin_callbacks", (void *) &callbacks);
if (callbacks)
add_callbacks(plugin, callbacks);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2606
http://geany.svn.sourceforge.net/geany/?rev=2606&view=rev
Author: ntrel
Date: 2008-05-21 07:08:35 -0700 (Wed, 21 May 2008)
Log Message:
-----------
Rename editor_auto_line_indentation() to
editor_smart_line_indentation().
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/editor.c
trunk/src/editor.h
trunk/src/keybindings.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-05-21 14:00:27 UTC (rev 2605)
+++ trunk/ChangeLog 2008-05-21 14:08:35 UTC (rev 2606)
@@ -2,10 +2,13 @@
* src/editor.c:
Refactor editor_auto_line_indentation().
- Make auto-line indentation set the cursor to the beginning of
+ Make Smart Line Indentation set the cursor to the beginning of
indentation for single line selections, so the user can fine-tune
indentation if necessary. For multiple line selections, select all
the lines after indenting.
+ * src/keybindings.c, src/editor.c, src/editor.h:
+ Rename editor_auto_line_indentation() to
+ editor_smart_line_indentation().
2008-05-19 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2008-05-21 14:00:27 UTC (rev 2605)
+++ trunk/src/editor.c 2008-05-21 14:08:35 UTC (rev 2606)
@@ -2672,7 +2672,7 @@
/* simple indentation to indent the current line with the same indent as the previous one */
-static void auto_line_indentation(gint idx, gint first_line, gint last_line)
+static void smart_line_indentation(gint idx, gint first_line, gint last_line)
{
gint i, sel_start = 0, sel_end = 0;
@@ -2697,7 +2697,7 @@
/* simple indentation to indent the current line with the same indent as the previous one */
-void editor_auto_line_indentation(gint idx, gint pos)
+void editor_smart_line_indentation(gint idx, gint pos)
{
gint first_line, last_line;
gint first_sel_start, first_sel_end;
@@ -2723,7 +2723,7 @@
get_indent(&doc_list[idx],
sci_get_position_from_line(doc_list[idx].sci, first_line - 1), TRUE);
- auto_line_indentation(idx, first_line, last_line);
+ smart_line_indentation(idx, first_line, last_line);
/* set cursor position if there was no selection */
if (first_sel_start == first_sel_end)
Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h 2008-05-21 14:00:27 UTC (rev 2605)
+++ trunk/src/editor.h 2008-05-21 14:08:35 UTC (rev 2606)
@@ -143,7 +143,7 @@
void editor_insert_alternative_whitespace(gint idx);
-void editor_auto_line_indentation(gint idx, gint pos);
+void editor_smart_line_indentation(gint idx, gint pos);
void editor_indentation_by_one_space(gint idx, gint pos, gboolean decrease);
Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c 2008-05-21 14:00:27 UTC (rev 2605)
+++ trunk/src/keybindings.c 2008-05-21 14:08:35 UTC (rev 2606)
@@ -1497,7 +1497,7 @@
editor_indentation_by_one_space(idx, -1, TRUE);
break;
case GEANY_KEYS_FORMAT_AUTOINDENT:
- editor_auto_line_indentation(idx, -1);
+ editor_smart_line_indentation(idx, -1);
break;
case GEANY_KEYS_FORMAT_TOGGLECASE:
on_toggle_case1_activate(NULL, NULL);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2605
http://geany.svn.sourceforge.net/geany/?rev=2605&view=rev
Author: ntrel
Date: 2008-05-21 07:00:27 -0700 (Wed, 21 May 2008)
Log Message:
-----------
Refactor editor_auto_line_indentation().
Make auto-line indentation set the cursor to the beginning of
indentation for single line selections, so the user can fine-tune
indentation if necessary. For multiple line selections, select all
the lines after indenting.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/editor.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-05-19 15:22:56 UTC (rev 2604)
+++ trunk/ChangeLog 2008-05-21 14:00:27 UTC (rev 2605)
@@ -1,3 +1,13 @@
+2008-05-21 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/editor.c:
+ Refactor editor_auto_line_indentation().
+ Make auto-line indentation set the cursor to the beginning of
+ indentation for single line selections, so the user can fine-tune
+ indentation if necessary. For multiple line selections, select all
+ the lines after indenting.
+
+
2008-05-19 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/plugindata.h, src/plugins.c, doc/plugin-symbols.c,
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2008-05-19 15:22:56 UTC (rev 2604)
+++ trunk/src/editor.c 2008-05-21 14:00:27 UTC (rev 2605)
@@ -2671,11 +2671,36 @@
}
-/* simple auto indentation to indent the current line with the same indent as the previous one */
+/* simple indentation to indent the current line with the same indent as the previous one */
+static void auto_line_indentation(gint idx, gint first_line, gint last_line)
+{
+ gint i, sel_start = 0, sel_end = 0;
+
+ for (i = first_line; i <= last_line; i++)
+ {
+ /* skip the first line or if the indentation of the previous and current line are equal */
+ if (i == 0 ||
+ SSM(doc_list[idx].sci, SCI_GETLINEINDENTATION, i - 1, 0) ==
+ SSM(doc_list[idx].sci, SCI_GETLINEINDENTATION, i, 0))
+ continue;
+
+ sel_start = SSM(doc_list[idx].sci, SCI_POSITIONFROMLINE, i, 0);
+ sel_end = SSM(doc_list[idx].sci, SCI_GETLINEINDENTPOSITION, i, 0);
+ if (sel_start < sel_end)
+ {
+ SSM(doc_list[idx].sci, SCI_SETSEL, sel_start, sel_end);
+ sci_replace_sel(doc_list[idx].sci, "");
+ }
+ sci_insert_text(doc_list[idx].sci, sel_start, indent);
+ }
+}
+
+
+/* simple indentation to indent the current line with the same indent as the previous one */
void editor_auto_line_indentation(gint idx, gint pos)
{
- gint i, first_line, last_line;
- gint first_sel_start, first_sel_end, sel_start = 0, sel_end = 0;
+ gint first_line, last_line;
+ gint first_sel_start, first_sel_end;
g_return_if_fail(DOC_IDX_VALID(idx));
@@ -2691,35 +2716,31 @@
if (pos == -1)
pos = first_sel_start;
+ SSM(doc_list[idx].sci, SCI_BEGINUNDOACTION, 0, 0);
+
/* get previous line and use it for get_indent to use that line
* (otherwise it would fail on a line only containing "{" in advanced indentation mode) */
get_indent(&doc_list[idx],
sci_get_position_from_line(doc_list[idx].sci, first_line - 1), TRUE);
- SSM(doc_list[idx].sci, SCI_BEGINUNDOACTION, 0, 0);
- for (i = first_line; i <= last_line; i++)
+ auto_line_indentation(idx, first_line, last_line);
+
+ /* set cursor position if there was no selection */
+ if (first_sel_start == first_sel_end)
{
- /* skip the first line or if the indentation of the previous and current line are equal */
- if (i == 0 ||
- SSM(doc_list[idx].sci, SCI_GETLINEINDENTATION, i - 1, 0) ==
- SSM(doc_list[idx].sci, SCI_GETLINEINDENTATION, i, 0))
- continue;
+ gint indent_pos = SSM(doc_list[idx].sci, SCI_GETLINEINDENTPOSITION, first_line, 0);
- sel_start = SSM(doc_list[idx].sci, SCI_POSITIONFROMLINE, i, 0);
- sel_end = SSM(doc_list[idx].sci, SCI_GETLINEINDENTPOSITION, i, 0);
- if (sel_start < sel_end)
- {
- SSM(doc_list[idx].sci, SCI_SETSEL, sel_start, sel_end);
- sci_replace_sel(doc_list[idx].sci, "");
- }
- sci_insert_text(doc_list[idx].sci, sel_start, indent);
+ /* use indent position as user may wish to change indentation afterwards */
+ sci_set_current_position(doc_list[idx].sci, indent_pos, FALSE);
}
+ else
+ {
+ ScintillaObject *sci = doc_list[idx].sci;
- /* set cursor position if there was no selection */
- /* TODO: implement selection handling if there was a selection */
- if (first_sel_start == first_sel_end)
- sci_set_current_position(doc_list[idx].sci,
- pos - (sel_end - sel_start) + strlen(indent), FALSE);
+ /* fully select all the lines affected */
+ sci_set_selection_start(sci, sci_get_position_from_line(sci, first_line));
+ sci_set_selection_end(sci, sci_get_position_from_line(sci, last_line + 1));
+ }
SSM(doc_list[idx].sci, SCI_ENDUNDOACTION, 0, 0);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2604
http://geany.svn.sourceforge.net/geany/?rev=2604&view=rev
Author: ntrel
Date: 2008-05-19 08:22:56 -0700 (Mon, 19 May 2008)
Log Message:
-----------
Add Main Page links to plugindata.h and pluginmacros.h.
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/plugins.dox
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-05-19 15:21:31 UTC (rev 2603)
+++ trunk/ChangeLog 2008-05-19 15:22:56 UTC (rev 2604)
@@ -32,6 +32,8 @@
* doc/Doxyfile.in, plugins/pluginmacros.h:
Add API documentation for pluginmacros.h.
Make Doxygen define GEANY_DISABLE_DEPRECATED.
+ * doc/plugins.dox:
+ Add Main Page links to plugindata.h and pluginmacros.h.
2008-05-18 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/doc/plugins.dox
===================================================================
--- trunk/doc/plugins.dox 2008-05-19 15:21:31 UTC (rev 2603)
+++ trunk/doc/plugins.dox 2008-05-19 15:22:56 UTC (rev 2604)
@@ -41,8 +41,10 @@
* To get started, see the @link howto Plugin Howto @endlink.
*
* Other pages:
+ * - @link plugindata.h Main Datatypes and Macros @endlink
+ * - @link plugin-symbols.c Plugin Symbols @endlink
+ * - @link pluginmacros.h Optional Macros @endlink
* - @link signals Plugin Signals @endlink
- * - @link plugin-symbols.c Plugin Symbols @endlink
*
* @note Some of these pages are also listed in Related Pages.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2603
http://geany.svn.sourceforge.net/geany/?rev=2603&view=rev
Author: ntrel
Date: 2008-05-19 08:21:31 -0700 (Mon, 19 May 2008)
Log Message:
-----------
Add API documentation for pluginmacros.h.
Make Doxygen define GEANY_DISABLE_DEPRECATED.
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/Doxyfile.in
trunk/plugins/pluginmacros.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-05-19 14:33:50 UTC (rev 2602)
+++ trunk/ChangeLog 2008-05-19 15:21:31 UTC (rev 2603)
@@ -29,6 +29,9 @@
* src/keybindings.c:
Fix Switch to Sidebar shortcut so that it works for whichever widget
is in the current sidebar notebook page (fixes #1967104).
+ * doc/Doxyfile.in, plugins/pluginmacros.h:
+ Add API documentation for pluginmacros.h.
+ Make Doxygen define GEANY_DISABLE_DEPRECATED.
2008-05-18 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/doc/Doxyfile.in
===================================================================
--- trunk/doc/Doxyfile.in 2008-05-19 14:33:50 UTC (rev 2602)
+++ trunk/doc/Doxyfile.in 2008-05-19 15:21:31 UTC (rev 2603)
@@ -95,7 +95,7 @@
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
-INPUT = ../src/ ./
+INPUT = ../src/ ./ ../plugins/pluginmacros.h
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.c \
*.cc \
@@ -226,7 +226,7 @@
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
# make G_GNUC_PRINTF a no-op unless doxygen would ignore functions with varargs
-PREDEFINED = "G_GNUC_PRINTF(x,y)="
+PREDEFINED = "G_GNUC_PRINTF(x,y)=" GEANY_DISABLE_DEPRECATED
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = NO
#---------------------------------------------------------------------------
Modified: trunk/plugins/pluginmacros.h
===================================================================
--- trunk/plugins/pluginmacros.h 2008-05-19 14:33:50 UTC (rev 2602)
+++ trunk/plugins/pluginmacros.h 2008-05-19 15:21:31 UTC (rev 2603)
@@ -22,43 +22,48 @@
* $Id$
*/
-/* Useful macros to avoid typing geany_data-> or geany_functions-> so often. */
+/** @file pluginmacros.h
+ * Useful macros to avoid typing @c geany_data-> or @c geany_functions-> so often.
+ *
+ * @section function_macros Function Macros
+ * 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 for @c document_open_file(): @c p_document->open_file(); */
+
#ifndef PLUGINMACROS_H
#define PLUGINMACROS_H
/* common data structs */
#define app geany_data->app
-#define doc_array geany_data->doc_array /* Allows use of doc_list[] macro */
-#define filetypes_array geany_data->filetypes_array /* Allows use of filetypes[] macro */
+#define doc_array geany_data->doc_array /**< Allows use of @c doc_list[] macro */
+#define filetypes_array geany_data->filetypes_array /**< Allows use of @c filetypes[] macro */
#define prefs geany_data->prefs
#define project app->project
-/* 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() */
-/* New macros should be added here */
-#define p_filetypes geany_functions->p_filetypes
-#define p_navqueue geany_functions->p_navqueue
-#define p_editor geany_functions->p_editor
+/* New function macros should be added here */
+#define p_filetypes geany_functions->p_filetypes /**< See filetypes.h */
+#define p_navqueue geany_functions->p_navqueue /**< See navqueue.h */
+#define p_editor geany_functions->p_editor /**< See editor.h */
#ifdef GEANY_DISABLE_DEPRECATED
-#define p_dialogs geany_functions->p_dialogs
-#define p_document geany_functions->p_document
-#define p_encodings geany_functions->p_encodings
-#define p_highlighting geany_functions->p_highlighting
-#define p_keybindings geany_functions->p_keybindings
-#define p_msgwindow geany_functions->p_msgwindow
-#define p_sci geany_functions->p_sci
-#define p_search geany_functions->p_search
-#define p_support geany_functions->p_support
-#define p_templates geany_functions->p_templates
-#define p_tm geany_functions->p_tm
-#define p_ui geany_functions->p_ui
-#define p_utils geany_functions->p_utils
+#define p_dialogs geany_functions->p_dialogs /**< See dialogs.h */
+#define p_document geany_functions->p_document /**< See document.h */
+#define p_encodings geany_functions->p_encodings /**< See encodings.h */
+#define p_highlighting geany_functions->p_highlighting /**< See highlighting.h */
+#define p_keybindings geany_functions->p_keybindings /**< See keybindings.h */
+#define p_msgwindow geany_functions->p_msgwindow /**< See msgwindow.h */
+#define p_sci geany_functions->p_sci /**< See sciwrappers.h */
+#define p_search geany_functions->p_search /**< See search.h */
+#define p_support geany_functions->p_support /**< See support.h */
+#define p_templates geany_functions->p_templates /**< See templates.h */
+#define p_tm geany_functions->p_tm /**< See the TagManager headers. */
+#define p_ui geany_functions->p_ui /**< See ui_utils.h */
+#define p_utils geany_functions->p_utils /**< See utils.h */
#else
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2602
http://geany.svn.sourceforge.net/geany/?rev=2602&view=rev
Author: ntrel
Date: 2008-05-19 07:33:50 -0700 (Mon, 19 May 2008)
Log Message:
-----------
Fix Switch to Sidebar shortcut so that it works for whichever widget
is in the current sidebar notebook page (fixes #1967104).
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/keybindings.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-05-19 12:52:38 UTC (rev 2601)
+++ trunk/ChangeLog 2008-05-19 14:33:50 UTC (rev 2602)
@@ -26,6 +26,9 @@
when using documentation comments e.g. for TODO.
* plugins/pluginmacros.h:
Add deprecated p_encoding alias for p_encodings.
+ * src/keybindings.c:
+ Fix Switch to Sidebar shortcut so that it works for whichever widget
+ is in the current sidebar notebook page (fixes #1967104).
2008-05-18 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c 2008-05-19 12:52:38 UTC (rev 2601)
+++ trunk/src/keybindings.c 2008-05-19 14:33:50 UTC (rev 2602)
@@ -1183,9 +1183,10 @@
if (ui_prefs.sidebar_visible)
{
gint page_num = gtk_notebook_get_current_page(GTK_NOTEBOOK(app->treeview_notebook));
- GtkWidget *swin = gtk_notebook_get_nth_page(GTK_NOTEBOOK(app->treeview_notebook), page_num);
+ GtkWidget *page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(app->treeview_notebook), page_num);
- gtk_widget_grab_focus(gtk_bin_get_child(GTK_BIN(swin)));
+ /* gtk_widget_grab_focus() won't work because of the scrolled window containers */
+ gtk_widget_child_focus(page, GTK_DIR_TAB_FORWARD);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.