SF.net SVN: geany:[4751] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Wed Mar 10 16:20:35 UTC 2010
Revision: 4751
http://geany.svn.sourceforge.net/geany/?rev=4751&view=rev
Author: ntrel
Date: 2010-03-10 16:20:34 +0000 (Wed, 10 Mar 2010)
Log Message:
-----------
Apply patch from Eugene Arshinov to add project long line marker
customisation (thanks).
Modified Paths:
--------------
trunk/ChangeLog
trunk/geany.glade
trunk/src/editor.c
trunk/src/editor.h
trunk/src/interface.c
trunk/src/keybindings.c
trunk/src/keyfile.c
trunk/src/plugindata.h
trunk/src/prefs.c
trunk/src/project.c
trunk/src/project.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-03-10 13:52:41 UTC (rev 4750)
+++ trunk/ChangeLog 2010-03-10 16:20:34 UTC (rev 4751)
@@ -3,6 +3,11 @@
* doc/geany.txt, doc/geany.html:
Warn about some GNU extensions for regular expressions & clarify
some points.
+ * src/interface.c, src/keybindings.c, src/project.c, src/project.h,
+ src/prefs.c, src/plugindata.h, src/keyfile.c, src/editor.c,
+ src/editor.h, geany.glade:
+ Apply patch from Eugene Arshinov to add project long line marker
+ customisation (thanks).
2010-03-10 Lex Trotman <elextr.at.gmail.dot.com>
Modified: trunk/geany.glade
===================================================================
--- trunk/geany.glade 2010-03-10 13:52:41 UTC (rev 4750)
+++ trunk/geany.glade 2010-03-10 16:20:34 UTC (rev 4751)
@@ -7057,26 +7057,6 @@
<property name="fill">False</property>
</packing>
</child>
-
- <child>
- <widget class="GtkRadioButton" id="radio_long_line_disabled">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Disabled</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radio_long_line_line</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -7093,22 +7073,16 @@
</child>
<child>
- <widget class="GtkLabel" id="label155">
+ <widget class="GtkCheckButton" id="check_long_line">
<property name="visible">True</property>
- <property name="label" translatable="yes"><b>Long line marker</b></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Long line marker</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
</widget>
<packing>
<property name="type">label_item</property>
@@ -9966,6 +9940,254 @@
<property name="type">tab</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox47">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">3</property>
+
+ <child>
+ <widget class="GtkFrame" id="frame40">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.5</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment48">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkTable" id="table18">
+ <property name="visible">True</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">3</property>
+ <property name="column_spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label241">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Display:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label240">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Long line marker:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="radio_long_line_disabled">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Disabled</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="radio_long_line_custom">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Custom</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_long_line_disabled</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="radio_long_line_default">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Use global settings</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radio_long_line_disabled</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="spin_long_line">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">True</property>
+ <property name="adjustment">72 0 1000 1 10 0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label239">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Long line marker</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label238">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Editor</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2010-03-10 13:52:41 UTC (rev 4750)
+++ trunk/src/editor.c 2010-03-10 16:20:34 UTC (rev 4751)
@@ -272,6 +272,35 @@
}
+gint editor_get_long_line_type(void)
+{
+ if (app->project)
+ switch (app->project->long_line_behaviour)
+ {
+ case 0: /* marker disabled */
+ return 2;
+ case 1: /* use global settings */
+ break;
+ case 2: /* custom (enabled) */
+ return editor_prefs.long_line_global_type;
+ }
+
+ if (!editor_prefs.long_line_global_enabled)
+ return 2;
+ else
+ return editor_prefs.long_line_global_type;
+}
+
+
+gint editor_get_long_line_column(void)
+{
+ if (app->project && app->project->long_line_behaviour != 1 /* use global settings */)
+ return app->project->long_line_column;
+ else
+ return editor_prefs.long_line_global_column;
+}
+
+
void editor_toggle_fold(GeanyEditor *editor, gint line, gint modifiers)
{
ScintillaObject *sci;
@@ -4850,8 +4879,8 @@
sci = editor->sci;
- sci_set_mark_long_lines(sci, editor_prefs.long_line_type,
- editor_prefs.long_line_column, editor_prefs.long_line_color);
+ sci_set_mark_long_lines(sci, editor_get_long_line_type(),
+ editor_get_long_line_column(), editor_prefs.long_line_color);
/* update indent width, tab width */
editor_set_indent_type(editor, editor->indent_type);
Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h 2010-03-10 13:52:41 UTC (rev 4750)
+++ trunk/src/editor.h 2010-03-10 16:20:34 UTC (rev 4751)
@@ -100,16 +100,19 @@
GeanyIndentPrefs;
-/* Default prefs when creating a new editor window.
- * Some of these can be overridden per document. */
+/** Default prefs when creating a new editor window.
+ * Some of these can be overridden per document or per project. */
typedef struct GeanyEditorPrefs
{
GeanyIndentPrefs *indentation; /*< Default indentation prefs. @see editor_get_indent_prefs(). */
gboolean show_white_space;
gboolean show_indent_guide;
gboolean show_line_endings;
- gint long_line_type; /* 0 - line, 1 - background, 2 - none */
- gint long_line_column;
+ /* 0 - line, 1 - background. This setting may be overriden when a project is opened. Use
+ * @c editor_get_long_line_type(). */
+ gint long_line_global_type;
+ /* This setting may be overriden when a project is opened. Use @c editor_get_long_line_column(). */
+ gint long_line_global_column;
gchar *long_line_color;
gboolean show_markers_margin; /* view menu */
gboolean show_linenumber_margin; /* view menu */
@@ -140,6 +143,8 @@
gboolean completion_drops_rest_of_word;
gchar *color_scheme;
gint show_virtual_space;
+ /* This setting may be overriden when a project is opened. Use @c editor_get_long_line_type(). */
+ gboolean long_line_global_enabled;
}
GeanyEditorPrefs;
@@ -223,6 +228,11 @@
void editor_snippets_free(void);
+/* 0 - line, 1 - background, 2 - disabled */
+gint editor_get_long_line_type(void);
+
+gint editor_get_long_line_column(void);
+
/* General editing functions */
void editor_find_current_word(GeanyEditor *editor, gint pos, gchar *word, size_t wordlen,
Modified: trunk/src/interface.c
===================================================================
--- trunk/src/interface.c 2010-03-10 13:52:41 UTC (rev 4750)
+++ trunk/src/interface.c 2010-03-10 16:20:34 UTC (rev 4751)
@@ -2579,8 +2579,7 @@
GtkWidget *radio_long_line_line;
GSList *radio_long_line_line_group = NULL;
GtkWidget *radio_long_line_background;
- GtkWidget *radio_long_line_disabled;
- GtkWidget *label155;
+ GtkWidget *check_long_line;
GtkWidget *frame40;
GtkWidget *alignment47;
GtkWidget *vbox48;
@@ -4003,17 +4002,10 @@
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_long_line_background), radio_long_line_line_group);
radio_long_line_line_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_long_line_background));
- radio_long_line_disabled = gtk_radio_button_new_with_mnemonic (NULL, _("Disabled"));
- gtk_widget_show (radio_long_line_disabled);
- gtk_box_pack_start (GTK_BOX (hbox5), radio_long_line_disabled, FALSE, FALSE, 0);
- gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_long_line_disabled), radio_long_line_line_group);
- radio_long_line_line_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_long_line_disabled));
+ check_long_line = gtk_check_button_new_with_mnemonic (_("Long line marker"));
+ gtk_widget_show (check_long_line);
+ gtk_frame_set_label_widget (GTK_FRAME (frame8), check_long_line);
- label155 = gtk_label_new (_("<b>Long line marker</b>"));
- gtk_widget_show (label155);
- gtk_frame_set_label_widget (GTK_FRAME (frame8), label155);
- gtk_label_set_use_markup (GTK_LABEL (label155), TRUE);
-
frame40 = gtk_frame_new (NULL);
gtk_widget_show (frame40);
gtk_box_pack_start (GTK_BOX (vbox24), frame40, FALSE, TRUE, 0);
@@ -4993,8 +4985,7 @@
GLADE_HOOKUP_OBJECT (prefs_dialog, hbox5, "hbox5");
GLADE_HOOKUP_OBJECT (prefs_dialog, radio_long_line_line, "radio_long_line_line");
GLADE_HOOKUP_OBJECT (prefs_dialog, radio_long_line_background, "radio_long_line_background");
- GLADE_HOOKUP_OBJECT (prefs_dialog, radio_long_line_disabled, "radio_long_line_disabled");
- GLADE_HOOKUP_OBJECT (prefs_dialog, label155, "label155");
+ GLADE_HOOKUP_OBJECT (prefs_dialog, check_long_line, "check_long_line");
GLADE_HOOKUP_OBJECT (prefs_dialog, frame40, "frame40");
GLADE_HOOKUP_OBJECT (prefs_dialog, alignment47, "alignment47");
GLADE_HOOKUP_OBJECT (prefs_dialog, vbox48, "vbox48");
@@ -5164,6 +5155,20 @@
GtkObject *spin_tab_width_adj;
GtkWidget *spin_tab_width;
GtkWidget *label227;
+ GtkWidget *vbox47;
+ GtkWidget *frame40;
+ GtkWidget *alignment48;
+ GtkWidget *table18;
+ GtkWidget *label241;
+ GtkWidget *label240;
+ GtkWidget *radio_long_line_disabled;
+ GSList *radio_long_line_disabled_group = NULL;
+ GtkWidget *radio_long_line_custom;
+ GtkWidget *radio_long_line_default;
+ GtkObject *spin_long_line_adj;
+ GtkWidget *spin_long_line;
+ GtkWidget *label239;
+ GtkWidget *label238;
GtkWidget *dialog_action_area4;
GtkWidget *cancelbutton1;
GtkWidget *okbutton1;
@@ -5293,6 +5298,83 @@
gtk_widget_show (label227);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (project_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (project_notebook), 0), label227);
+ vbox47 = gtk_vbox_new (FALSE, 3);
+ gtk_widget_show (vbox47);
+ gtk_container_add (GTK_CONTAINER (project_notebook), vbox47);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox47), 6);
+
+ frame40 = gtk_frame_new (NULL);
+ gtk_widget_show (frame40);
+ gtk_box_pack_start (GTK_BOX (vbox47), frame40, FALSE, TRUE, 0);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame40), GTK_SHADOW_NONE);
+
+ alignment48 = gtk_alignment_new (0.5, 0.5, 1, 1);
+ gtk_widget_show (alignment48);
+ gtk_container_add (GTK_CONTAINER (frame40), alignment48);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (alignment48), 0, 0, 12, 0);
+
+ table18 = gtk_table_new (4, 2, FALSE);
+ gtk_widget_show (table18);
+ gtk_container_add (GTK_CONTAINER (alignment48), table18);
+ gtk_table_set_row_spacings (GTK_TABLE (table18), 3);
+ gtk_table_set_col_spacings (GTK_TABLE (table18), 12);
+
+ label241 = gtk_label_new (_("Display:"));
+ gtk_widget_show (label241);
+ gtk_table_attach (GTK_TABLE (table18), label241, 0, 1, 0, 1,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (label241), 0, 0.5);
+
+ label240 = gtk_label_new (_("Long line marker:"));
+ gtk_widget_show (label240);
+ gtk_table_attach (GTK_TABLE (table18), label240, 0, 1, 3, 4,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (label240), 0, 0.5);
+
+ radio_long_line_disabled = gtk_radio_button_new_with_mnemonic (NULL, _("Disabled"));
+ gtk_widget_show (radio_long_line_disabled);
+ gtk_table_attach (GTK_TABLE (table18), radio_long_line_disabled, 1, 2, 0, 1,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_long_line_disabled), radio_long_line_disabled_group);
+ radio_long_line_disabled_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_long_line_disabled));
+
+ radio_long_line_custom = gtk_radio_button_new_with_mnemonic (NULL, _("Custom"));
+ gtk_widget_show (radio_long_line_custom);
+ gtk_table_attach (GTK_TABLE (table18), radio_long_line_custom, 1, 2, 2, 3,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_long_line_custom), radio_long_line_disabled_group);
+ radio_long_line_disabled_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_long_line_custom));
+
+ radio_long_line_default = gtk_radio_button_new_with_mnemonic (NULL, _("Use global settings"));
+ gtk_widget_show (radio_long_line_default);
+ gtk_table_attach (GTK_TABLE (table18), radio_long_line_default, 1, 2, 1, 2,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_long_line_default), radio_long_line_disabled_group);
+ radio_long_line_disabled_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_long_line_default));
+
+ spin_long_line_adj = gtk_adjustment_new (72, 0, 1000, 1, 10, 0);
+ spin_long_line = gtk_spin_button_new (GTK_ADJUSTMENT (spin_long_line_adj), 1, 0);
+ gtk_widget_show (spin_long_line);
+ gtk_table_attach (GTK_TABLE (table18), spin_long_line, 1, 2, 3, 4,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_long_line), TRUE);
+ gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spin_long_line), TRUE);
+
+ label239 = gtk_label_new (_("<b>Long line marker</b>"));
+ gtk_widget_show (label239);
+ gtk_frame_set_label_widget (GTK_FRAME (frame40), label239);
+ gtk_label_set_use_markup (GTK_LABEL (label239), TRUE);
+
+ label238 = gtk_label_new (_("Editor"));
+ gtk_widget_show (label238);
+ gtk_notebook_set_tab_label (GTK_NOTEBOOK (project_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (project_notebook), 1), label238);
+
dialog_action_area4 = GTK_DIALOG (project_dialog)->action_area;
gtk_widget_show (dialog_action_area4);
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area4), GTK_BUTTONBOX_END);
@@ -5326,6 +5408,18 @@
GLADE_HOOKUP_OBJECT (project_dialog, label231, "label231");
GLADE_HOOKUP_OBJECT (project_dialog, spin_tab_width, "spin_tab_width");
GLADE_HOOKUP_OBJECT (project_dialog, label227, "label227");
+ GLADE_HOOKUP_OBJECT (project_dialog, vbox47, "vbox47");
+ GLADE_HOOKUP_OBJECT (project_dialog, frame40, "frame40");
+ GLADE_HOOKUP_OBJECT (project_dialog, alignment48, "alignment48");
+ GLADE_HOOKUP_OBJECT (project_dialog, table18, "table18");
+ GLADE_HOOKUP_OBJECT (project_dialog, label241, "label241");
+ GLADE_HOOKUP_OBJECT (project_dialog, label240, "label240");
+ GLADE_HOOKUP_OBJECT (project_dialog, radio_long_line_disabled, "radio_long_line_disabled");
+ GLADE_HOOKUP_OBJECT (project_dialog, radio_long_line_custom, "radio_long_line_custom");
+ GLADE_HOOKUP_OBJECT (project_dialog, radio_long_line_default, "radio_long_line_default");
+ GLADE_HOOKUP_OBJECT (project_dialog, spin_long_line, "spin_long_line");
+ GLADE_HOOKUP_OBJECT (project_dialog, label239, "label239");
+ GLADE_HOOKUP_OBJECT (project_dialog, label238, "label238");
GLADE_HOOKUP_OBJECT_NO_REF (project_dialog, dialog_action_area4, "dialog_action_area4");
GLADE_HOOKUP_OBJECT (project_dialog, cancelbutton1, "cancelbutton1");
GLADE_HOOKUP_OBJECT (project_dialog, okbutton1, "okbutton1");
Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c 2010-03-10 13:52:41 UTC (rev 4750)
+++ trunk/src/keybindings.c 2010-03-10 16:20:34 UTC (rev 4751)
@@ -2339,10 +2339,10 @@
/* use line break column if enabled */
column = editor_prefs.line_break_column;
}
- else if (editor_prefs.long_line_type != 2)
+ else if (editor_get_long_line_type() != 2)
{
/* use long line if enabled */
- column = editor_prefs.long_line_column;
+ column = editor_get_long_line_column();
}
else
{
Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c 2010-03-10 13:52:41 UTC (rev 4750)
+++ trunk/src/keyfile.c 2010-03-10 16:20:34 UTC (rev 4751)
@@ -368,8 +368,9 @@
g_key_file_set_boolean(config, PACKAGE, "show_line_endings", editor_prefs.show_line_endings);
g_key_file_set_boolean(config, PACKAGE, "show_markers_margin", editor_prefs.show_markers_margin);
g_key_file_set_boolean(config, PACKAGE, "show_linenumber_margin", editor_prefs.show_linenumber_margin);
- g_key_file_set_integer(config, PACKAGE, "long_line_type", editor_prefs.long_line_type);
- g_key_file_set_integer(config, PACKAGE, "long_line_column", editor_prefs.long_line_column);
+ g_key_file_set_boolean(config, PACKAGE, "long_line_enabled", editor_prefs.long_line_global_enabled);
+ g_key_file_set_integer(config, PACKAGE, "long_line_type", editor_prefs.long_line_global_type);
+ g_key_file_set_integer(config, PACKAGE, "long_line_column", editor_prefs.long_line_global_column);
g_key_file_set_string(config, PACKAGE, "long_line_color", editor_prefs.long_line_color);
/* editor */
@@ -660,9 +661,15 @@
interface_prefs.msgwin_scribble_visible = utils_get_setting_boolean(config, PACKAGE, "msgwin_scribble_visible", TRUE);
/* display, editor */
- editor_prefs.long_line_type = utils_get_setting_integer(config, PACKAGE, "long_line_type", 0);
+ editor_prefs.long_line_global_enabled = utils_get_setting_boolean(config, PACKAGE, "long_line_enabled", TRUE);
+ editor_prefs.long_line_global_type = utils_get_setting_integer(config, PACKAGE, "long_line_type", 0);
+ if (editor_prefs.long_line_global_type == 2) /* backward compatibility */
+ {
+ editor_prefs.long_line_global_type = 0;
+ editor_prefs.long_line_global_enabled = FALSE;
+ }
editor_prefs.long_line_color = utils_get_setting_string(config, PACKAGE, "long_line_color", "#C2EBC2");
- editor_prefs.long_line_column = utils_get_setting_integer(config, PACKAGE, "long_line_column", 72);
+ editor_prefs.long_line_global_column = utils_get_setting_integer(config, PACKAGE, "long_line_column", 72);
editor_prefs.symbolcompletion_min_chars = utils_get_setting_integer(config, PACKAGE, "symbolcompletion_min_chars", GEANY_MIN_SYMBOLLIST_CHARS);
editor_prefs.symbolcompletion_max_height = utils_get_setting_integer(config, PACKAGE, "symbolcompletion_max_height", GEANY_MAX_SYMBOLLIST_HEIGHT);
editor_prefs.line_wrapping = utils_get_setting_boolean(config, PACKAGE, "line_wrapping", FALSE); /* default is off for better performance */
@@ -1112,4 +1119,3 @@
g_ptr_array_free(keyfile_groups, TRUE);
g_ptr_array_free(pref_groups, TRUE);
}
-
Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h 2010-03-10 13:52:41 UTC (rev 4750)
+++ trunk/src/plugindata.h 2010-03-10 16:20:34 UTC (rev 4751)
@@ -50,7 +50,7 @@
enum {
/** The Application Programming Interface (API) version, incremented
* whenever any plugin data types are modified or appended to. */
- GEANY_API_VERSION = 175,
+ GEANY_API_VERSION = 176,
/** The Application Binary Interface (ABI) version, incremented whenever
* existing fields in the plugin data types have to be changed or reordered. */
Modified: trunk/src/prefs.c
===================================================================
--- trunk/src/prefs.c 2010-03-10 13:52:41 UTC (rev 4750)
+++ trunk/src/prefs.c 2010-03-10 16:20:34 UTC (rev 4751)
@@ -399,13 +399,15 @@
gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), interface_prefs.editor_font);
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "spin_long_line");
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.long_line_column);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.long_line_global_column);
- switch (editor_prefs.long_line_type)
+ widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_long_line");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.long_line_global_enabled);
+
+ switch (editor_prefs.long_line_global_type)
{
case 0: widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_line"); break;
case 1: widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_background"); break;
- default: widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_disabled"); break;
}
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
@@ -806,19 +808,19 @@
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles");
interface_prefs.sidebar_openfiles_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_long_line");
+ editor_prefs.long_line_global_enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_line");
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) editor_prefs.long_line_type = 0;
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
+ editor_prefs.long_line_global_type = 0;
else
- {
- widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_long_line_background");
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) editor_prefs.long_line_type = 1;
- else
- { /* now only the disabled radio remains, so disable it */
- editor_prefs.long_line_type = 2;
- }
- }
- if (editor_prefs.long_line_column == 0) editor_prefs.long_line_type = 2;
+ /* now only the "background" radio remains */
+ editor_prefs.long_line_global_type = 1;
+ if (editor_prefs.long_line_global_column == 0)
+ editor_prefs.long_line_global_enabled = FALSE;
+
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_show_notebook_tabs");
interface_prefs.show_notebook_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
@@ -907,7 +909,7 @@
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "spin_long_line");
/* note: use stash for new code - it updates spin buttons itself */
gtk_spin_button_update(GTK_SPIN_BUTTON(widget));
- editor_prefs.long_line_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+ editor_prefs.long_line_global_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_folding");
editor_prefs.folding = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
@@ -1716,4 +1718,3 @@
prefs_init_dialog();
gtk_window_present(GTK_WINDOW(ui_widgets.prefs_dialog));
}
-
Modified: trunk/src/project.c
===================================================================
--- trunk/src/project.c 2010-03-10 13:52:41 UTC (rev 4750)
+++ trunk/src/project.c 2010-03-10 16:20:34 UTC (rev 4751)
@@ -88,6 +88,8 @@
static gboolean write_config(gboolean emit_signal);
static void on_name_entry_changed(GtkEditable *editable, PropertyDialogElements *e);
static void on_entries_changed(GtkEditable *editable, PropertyDialogElements *e);
+static void on_radio_long_line_custom_toggled(GtkToggleButton *radio, GtkWidget *spin_long_line);
+static void apply_editor_prefs();
#define SHOW_ERR(args) dialogs_show_msgbox(GTK_MESSAGE_ERROR, args)
@@ -367,6 +369,8 @@
g_free(app->project);
app->project = NULL;
+ apply_editor_prefs(); /* ensure that global settings are restored */
+
if (project_prefs.project_session)
{
/* close all existing tabs first */
@@ -500,6 +504,9 @@
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
+ g_signal_connect(ui_lookup_widget(e->dialog, "radio_long_line_custom"), "toggled",
+ G_CALLBACK(on_radio_long_line_custom_toggled), ui_lookup_widget(e->dialog, "spin_long_line"));
+
#if 0
label = gtk_label_new(_("File patterns:"));
/* <small>Separate multiple patterns by a new line</small> */
@@ -531,6 +538,8 @@
PropertyDialogElements *e = g_new(PropertyDialogElements, 1);
GeanyProject *p = app->project;
gint response;
+ GtkWidget *widget = NULL;
+ GtkWidget *radio_long_line_custom;
g_return_if_fail(app->project != NULL);
@@ -542,7 +551,22 @@
/* fill the elements with the appropriate data */
gtk_entry_set_text(GTK_ENTRY(e->name), p->name);
+ gtk_entry_set_text(GTK_ENTRY(e->file_name), p->file_name);
+ gtk_entry_set_text(GTK_ENTRY(e->base_path), p->base_path);
+ radio_long_line_custom = ui_lookup_widget(e->dialog, "radio_long_line_custom");
+ switch (p->long_line_behaviour)
+ {
+ case 0: widget = ui_lookup_widget(e->dialog, "radio_long_line_disabled"); break;
+ case 1: widget = ui_lookup_widget(e->dialog, "radio_long_line_default"); break;
+ case 2: widget = radio_long_line_custom; break;
+ }
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
+
+ widget = ui_lookup_widget(e->dialog, "spin_long_line");
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), (gdouble)p->long_line_column);
+ on_radio_long_line_custom_toggled(GTK_TOGGLE_BUTTON(radio_long_line_custom), widget);
+
if (p->description != NULL)
{ /* set text */
GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(e->description));
@@ -570,8 +594,6 @@
}
#endif
- gtk_entry_set_text(GTK_ENTRY(e->file_name), p->file_name);
- gtk_entry_set_text(GTK_ENTRY(e->base_path), p->base_path);
gtk_widget_show_all(e->dialog);
retry:
@@ -621,6 +643,9 @@
priv.indentation = &indentation;
project->priv = &priv;
+ project->long_line_behaviour = 1 /* use global settings */;
+ project->long_line_column = editor_prefs.long_line_global_column;
+
app->project = project;
return project;
}
@@ -729,6 +754,7 @@
BuildDestination menu_dst;
GeanyBuildCommand *oldvalue;
GeanyFiletype *ft = NULL;
+ GtkWidget *widget;
/* get and set the project description */
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(e->description));
@@ -764,6 +790,23 @@
}
build_menu_update(doc);
+ widget = ui_lookup_widget(e->dialog, "radio_long_line_disabled");
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
+ p->long_line_behaviour = 0;
+ else
+ {
+ widget = ui_lookup_widget(e->dialog, "radio_long_line_default");
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
+ p->long_line_behaviour = 1;
+ else
+ /* "Custom" radio button must be checked */
+ p->long_line_behaviour = 2;
+ }
+
+ widget = ui_lookup_widget(e->dialog, "spin_long_line");
+ p->long_line_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+ apply_editor_prefs();
+
#if 0
/* get and set the project file patterns */
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(e->patterns));
@@ -916,6 +959,12 @@
}
+static void on_radio_long_line_custom_toggled(GtkToggleButton *radio, GtkWidget *spin_long_line)
+{
+ gtk_widget_set_sensitive(spin_long_line, gtk_toggle_button_get_active(radio));
+}
+
+
gboolean project_load_file(const gchar *locale_file_name)
{
g_return_val_if_fail(locale_file_name != NULL, FALSE);
@@ -970,6 +1019,10 @@
p->base_path = utils_get_setting_string(config, "project", "base_path", "");
p->file_patterns = g_key_file_get_string_list(config, "project", "file_patterns", NULL, NULL);
+ p->long_line_behaviour = g_key_file_get_integer(config, "long line marker", "long_line_behaviour", NULL);
+ p->long_line_column = g_key_file_get_integer(config, "long line marker", "long_line_column", NULL);
+ apply_editor_prefs();
+
build_load_menu(config, GEANY_BCS_PROJ, (gpointer)p);
if (project_prefs.project_session)
{
@@ -988,6 +1041,15 @@
}
+static void apply_editor_prefs()
+{
+ guint i;
+
+ foreach_document(i)
+ editor_apply_update_prefs(documents[i]->editor);
+}
+
+
/* Write the project settings as well as the project session files into its configuration files.
* emit_signal defines whether the project-save signal should be emitted. When write_config()
* is called while closing a project, this is used to skip emitting the signal because
@@ -1021,6 +1083,9 @@
g_key_file_set_string_list(config, "project", "file_patterns",
(const gchar**) p->file_patterns, g_strv_length(p->file_patterns));
+ g_key_file_set_integer(config, "long line marker", "long_line_behaviour", p->long_line_behaviour);
+ g_key_file_set_integer(config, "long line marker", "long_line_column", p->long_line_column);
+
/* store the session files into the project too */
if (project_prefs.project_session)
configuration_save_session_files(config);
@@ -1165,4 +1230,3 @@
{
stash_group_free(indent_group);
}
-
Modified: trunk/src/project.h
===================================================================
--- trunk/src/project.h 2010-03-10 13:52:41 UTC (rev 4750)
+++ trunk/src/project.h 2010-03-10 16:20:34 UTC (rev 4751)
@@ -43,7 +43,9 @@
struct GeanyProjectPrivate *priv; /* must be last, append fields before this item */
#ifdef GEANY_PRIVATE
/* Do not use following fields in plugins */
- GPtrArray *build_filetypes_list; /* *< Project has custom filetype builds for these. */
+ GPtrArray *build_filetypes_list; /* Project has custom filetype builds for these. */
+ gint long_line_behaviour; /* 0 - disabled, 1 - follow global settings, 2 - enabled (custom) */
+ gint long_line_column; /* Long line marker position. */
#endif
}
GeanyProject;
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