Branch: refs/heads/master
Author: Matthew Brush <mbrush(a)codebrainz.ca>
Committer: Matthew Brush <mbrush(a)codebrainz.ca>
Date: Mon, 27 Feb 2012 04:50:01
Commit: 3d4e8b41d419255ee1b0764fb60e45ea588bd800
https://github.com/geany/geany/commit/3d4e8b41d419255ee1b0764fb60e45ea588bd…
Log Message:
-----------
Merge pull request #25 from techee/project_patches
Project patches
Modified Paths:
--------------
doc/pluginsignals.c
src/geanyobject.c
src/geanyobject.h
src/plugindata.h
src/project.c
Modified: doc/pluginsignals.c
15 files changed, 12 insertions(+), 3 deletions(-)
===================================================================
@@ -156,18 +156,18 @@ static void on_document_open(GObject *obj, GeanyDocument *doc, gpointer user_dat
*/
signal void (*project_close)(GObject *obj, gpointer user_data);
-/** Sent after a project dialog is created but before it is displayed. Plugins
+/** Sent after a project dialog is opened but before it is displayed. Plugins
* can append their own project settings tabs by using this signal.
* @param obj a GeanyObject instance, should be ignored.
* @param notebook a GtkNotebook instance that can be used by plugins to append their
* settings tabs.
* @param user_data user data.
*/
-signal void (*project_dialog_create)(GObject *obj, GtkWidget *notebook, gpointer user_data);
+signal void (*project_dialog_open)(GObject *obj, GtkWidget *notebook, gpointer user_data);
/** Sent when the settings dialog is confirmed by the user. Plugins can use
* this signal to read the settings widgets previously added by using the
- * @c project-dialog-create signal.
+ * @c project-dialog-open signal.
* @warning The dialog will still be running afterwards if the user chose 'Apply'.
* @param obj a GeanyObject instance, should be ignored.
* @param notebook a GtkNotebook instance that can be used by plugins to read their
@@ -176,6 +176,15 @@ static void on_document_open(GObject *obj, GeanyDocument *doc, gpointer user_dat
*/
signal void (*project_dialog_confirmed)(GObject *obj, GtkWidget *notebook, gpointer user_data);
+/** Sent before project dialog is closed. By using this signal, plugins can remove
+ * tabs previously added in project-dialog-open signal handler.
+ * @param obj a GeanyObject instance, should be ignored.
+ * @param notebook a GtkNotebook instance that can be used by plugins to remove
+ * settings tabs previously added in the project-dialog-open signal handler.
+ * @param user_data user data.
+ */
+signal void (*project_dialog_close)(GObject *obj, GtkWidget *notebook, gpointer user_data);
+
/** Sent once Geany has finished all initialization and startup tasks and the GUI has been
* realized. This signal is the very last step in the startup process and is sent once
* the GTK main event loop has been entered.
Modified: src/geanyobject.c
15 files changed, 12 insertions(+), 3 deletions(-)
===================================================================
@@ -269,11 +269,11 @@ static void create_signals(GObjectClass *g_object_class)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- geany_object_signals[GCB_PROJECT_DIALOG_CREATE] = g_signal_new (
- "project-dialog-create",
+ geany_object_signals[GCB_PROJECT_DIALOG_OPEN] = g_signal_new (
+ "project-dialog-open",
G_OBJECT_CLASS_TYPE (g_object_class),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GeanyObjectClass, project_dialog_create),
+ G_STRUCT_OFFSET (GeanyObjectClass, project_dialog_open),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
@@ -287,6 +287,15 @@ static void create_signals(GObjectClass *g_object_class)
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
+ geany_object_signals[GCB_PROJECT_DIALOG_CLOSE] = g_signal_new (
+ "project-dialog-close",
+ G_OBJECT_CLASS_TYPE (g_object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GeanyObjectClass, project_dialog_close),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
/* Editor signals */
geany_object_signals[GCB_UPDATE_EDITOR_MENU] = g_signal_new (
Modified: src/geanyobject.h
6 files changed, 4 insertions(+), 2 deletions(-)
===================================================================
@@ -41,8 +41,9 @@
GCB_PROJECT_OPEN,
GCB_PROJECT_SAVE,
GCB_PROJECT_CLOSE,
- GCB_PROJECT_DIALOG_CREATE,
+ GCB_PROJECT_DIALOG_OPEN,
GCB_PROJECT_DIALOG_CONFIRMED,
+ GCB_PROJECT_DIALOG_CLOSE,
GCB_UPDATE_EDITOR_MENU,
GCB_EDITOR_NOTIFY,
GCB_GEANY_STARTUP_COMPLETE,
@@ -90,8 +91,9 @@ struct _GeanyObjectClass
void (*project_open)(GKeyFile *keyfile);
void (*project_save)(GKeyFile *keyfile);
void (*project_close)(void);
- void (*project_dialog_create)(GtkWidget *notebook);
+ void (*project_dialog_open)(GtkWidget *notebook);
void (*project_dialog_confirmed)(GtkWidget *notebook);
+ void (*project_dialog_close)(GtkWidget *notebook);
void (*update_editor_menu)(const gchar *word, gint click_pos, GeanyDocument *doc);
gboolean (*editor_notify)(GeanyEditor *editor, gpointer scnt);
void (*geany_startup_complete)(void);
Modified: src/plugindata.h
4 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -53,14 +53,14 @@
* @warning You should not test for values below 200 as previously
* @c GEANY_API_VERSION was defined as an enum value, not a macro.
*/
-#define GEANY_API_VERSION 213
+#define GEANY_API_VERSION 214
/** The Application Binary Interface (ABI) version, incremented whenever
* existing fields in the plugin data types have to be changed or reordered.
* Changing this forces all plugins to be recompiled before Geany can load them. */
/* This should usually stay the same if fields are only appended, assuming only pointers to
* structs and not structs themselves are declared by plugins. */
-#define GEANY_ABI_VERSION 68
+#define GEANY_ABI_VERSION 69
/** Defines a function to check the plugin is safe to load.
Modified: src/project.c
5 files changed, 3 insertions(+), 2 deletions(-)
===================================================================
@@ -542,7 +542,7 @@ static void show_project_properties(gboolean show_build)
g_free(str);
}
- g_signal_emit_by_name(geany_object, "project-dialog-create", e.notebook);
+ g_signal_emit_by_name(geany_object, "project-dialog-open", e.notebook);
gtk_widget_show_all(e.dialog);
/* note: notebook page must be shown before setting current page */
@@ -567,6 +567,7 @@ static void show_project_properties(gboolean show_build)
}
build_free_fields(e.build_properties);
+ g_signal_emit_by_name(geany_object, "project-dialog-close", e.notebook);
gtk_notebook_remove_page(GTK_NOTEBOOK(e.notebook), e.build_page_num);
gtk_widget_hide(e.dialog);
}
@@ -593,7 +594,7 @@ gboolean project_ask_close(void)
{
if (dialogs_show_question_full(NULL, GTK_STOCK_CLOSE, GTK_STOCK_CANCEL,
_("Do you want to close it before proceeding?"),
- _("The '%s' project is already open."), app->project->name))
+ _("The '%s' project is open."), app->project->name))
{
project_close(FALSE);
return TRUE;
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
Branch: refs/heads/master
Author: Eugene Arshinov <earshinov(a)gmail.com>
Committer: Eugene Arshinov <earshinov(a)gmail.com>
Date: Sat, 25 Feb 2012 15:55:24
Commit: f8fd93039b577a21819baa7722314612e25b94e9
https://github.com/geany/geany/commit/f8fd93039b577a21819baa7722314612e25b9…
Log Message:
-----------
join_lines: Remove excessive comments
Modified Paths:
--------------
src/keybindings.c
Modified: src/keybindings.c
54 files changed, 6 insertions(+), 48 deletions(-)
===================================================================
@@ -2019,42 +2019,18 @@ static void join_lines(GeanyEditor *editor)
end = sci_get_line_from_position(editor->sci,
sci_get_selection_end(editor->sci));
- /*
- * remove trailing spaces for every line except the last one
- * so that these spaces won't appear within text after joining
- */
+ /* remove spaces surrounding the lines so that these spaces
+ * won't appear within text after joining */
for (i = start; i < end; i++)
editor_strip_line_trailing_spaces(editor, i);
-
- /* remove starting spaces from second and following lines due to the same reason */
for (i = start + 1; i <= end; i++)
sci_set_line_indentation(editor->sci, i, 0);
- /*
- * SCI_LINESJOIN automatically adds spaces between joined lines, including
- * empty ones. We should drop empty lines if we want only one space to be
- * inserted (see also example below). I don't think we should care of that.
- */
-
sci_set_target_start(editor->sci,
sci_get_position_from_line(editor->sci, start));
sci_set_target_end(editor->sci,
sci_get_position_from_line(editor->sci, end));
sci_lines_join(editor->sci);
-
- /*
- * Example: joining
- *
- * [TAB]if (something_wrong)
- * [TAB]{
- * [TAB][TAB]
- * [TAB][TAB]exit(1);[SPACE][SPACE]
- * [TAB]}[SPACE]
- *
- * gives
- *
- * [TAB]if (something_wrong) { exit(1); }[SPACE]
- */
}
@@ -2062,20 +2038,11 @@ static gint get_reflow_column(GeanyEditor *editor)
{
const GeanyEditorPrefs *eprefs = editor_get_prefs(editor);
if (editor->line_breaking)
- {
- /* use line break column if enabled */
return eprefs->line_break_column;
- }
else if (eprefs->long_line_type != 2)
- {
- /* use long line if enabled */
return eprefs->long_line_column;
- }
else
- {
- /* do nothing if no column is defined */
- return -1;
- }
+ return -1; /* do nothing */
}
@@ -2086,16 +2053,11 @@ static void reflow_lines(GeanyEditor *editor, gint column)
start = sci_get_line_from_position(editor->sci,
sci_get_selection_start(editor->sci));
- /*
- * If several lines are selected, first join them.
- * This allows to reformat text paragraphs easily.
- */
+ /* if several lines are selected, join them. */
if (sci_get_lines_selected(editor->sci) > 1)
join_lines(editor);
- /*
- * If this line is short enough, just return
- */
+ /* if this line is short enough, do nothing */
if (column > sci_get_line_end_position(editor->sci, start) -
sci_get_position_from_line(editor->sci, start))
{
@@ -2118,15 +2080,11 @@ static void reflow_lines(GeanyEditor *editor, gint column)
indent = sci_get_line_indentation(editor->sci, start);
sci_set_line_indentation(editor->sci, start, 0);
- /*
- * Use sci_get_line_count() to determine how many new lines
- * appeared during splitting. SCI_LINESSPLIT should better return
- * this value itself...
- */
sci_target_from_selection(editor->sci);
linescount = sci_get_line_count(editor->sci);
sci_lines_split(editor->sci,
(column - indent) * sci_text_width(editor->sci, STYLE_DEFAULT, " "));
+ /* use lines count to determine how many lines appeared after splitting */
linescount = sci_get_line_count(editor->sci) - linescount;
/* Fix indentation. */
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
Branch: refs/heads/master
Author: Eugene Arshinov <earshinov(a)gmail.com>
Committer: Eugene Arshinov <earshinov(a)gmail.com>
Date: Sat, 25 Feb 2012 15:51:32
Commit: 2d29296302a40e5af39a81657d9a91f049fe579f
https://github.com/geany/geany/commit/2d29296302a40e5af39a81657d9a91f049fe5…
Log Message:
-----------
join_lines: Remove `sci_fix_selection_anchors` function.
Previously it was useful because `reflow_lines`, in case when selection
contained trailing newline, removed that newline from selection by
calling `sci_set_selection_end` which only works when anchor > current
cursor position (it's mentioned in Scintilla's documentation on
SCI_SETSELECTIONEND).
Now trailing newline is removed by calling `sci_deselect_last_newline`
which uses `sci_set_selection` with `start` and `end` arguments. This
function works regardless of the interposition of current cursor
position and anchor.
Modified Paths:
--------------
src/keybindings.c
Modified: src/keybindings.c
13 files changed, 0 insertions(+), 13 deletions(-)
===================================================================
@@ -2157,17 +2157,6 @@ static void sci_deselect_last_newline(ScintillaObject *sci)
}
-/* if cursor < anchor, swap them */
-static void sci_fix_selection_anchors(ScintillaObject *sci)
-{
- gint start, end;
-
- start = sci_get_selection_start(sci);
- end = sci_get_selection_end(sci);
- sci_set_selection(sci, start, end);
-}
-
-
static void reflow_paragraph(GeanyEditor *editor)
{
ScintillaObject *sci = editor->sci;
@@ -2186,7 +2175,6 @@ static void reflow_paragraph(GeanyEditor *editor)
if (!sel)
editor_select_indent_block(editor);
sci_deselect_last_newline(sci);
- sci_fix_selection_anchors(sci);
reflow_lines(editor, column);
if (!sel)
sci_set_anchor(sci, -1);
@@ -2213,7 +2201,6 @@ static void join_paragraph(GeanyEditor *editor)
if (!sel)
editor_select_indent_block(editor);
sci_deselect_last_newline(sci);
- //sci_fix_selection_anchors(sci);
join_lines(editor);
if (!sel)
sci_set_anchor(sci, -1);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
Branch: refs/heads/master
Author: Eugene Arshinov <earshinov(a)gmail.com>
Committer: Eugene Arshinov <earshinov(a)gmail.com>
Date: Sat, 25 Feb 2012 15:48:37
Commit: f318b2cca0fa9fa024d3dddb908c1e490ab78a0e
https://github.com/geany/geany/commit/f318b2cca0fa9fa024d3dddb908c1e490ab78…
Log Message:
-----------
join_lines: Remove some obsolete code from `reflow_lines`.
The code joined current line with the next one when no text is selected.
For "Join lines" command this behaviour is wrong; for "Reflow paragraph"
the case is already handled outside the `reflow_lines` function.
Modified Paths:
--------------
src/keybindings.c
Modified: src/keybindings.c
4 files changed, 0 insertions(+), 4 deletions(-)
===================================================================
@@ -2019,10 +2019,6 @@ static void join_lines(GeanyEditor *editor)
end = sci_get_line_from_position(editor->sci,
sci_get_selection_end(editor->sci));
- /* if there is only one line in selection, join it with the following one */
- if (end == start)
- end = start + 1;
-
/*
* remove trailing spaces for every line except the last one
* so that these spaces won't appear within text after joining
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).