SF.net SVN: geany: [1695] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Jul 12 15:44:13 UTC 2007


Revision: 1695
          http://svn.sourceforge.net/geany/?rev=1695&view=rev
Author:   ntrel
Date:     2007-07-12 08:44:13 -0700 (Thu, 12 Jul 2007)

Log Message:
-----------
Apply patch from Jeff Pohlmeyer to add a preference for whether to
use 'smart' home key behaviour (thanks).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/geany.glade
    trunk/src/document.c
    trunk/src/editor.h
    trunk/src/interface.c
    trunk/src/keyfile.c
    trunk/src/prefs.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-07-12 11:59:13 UTC (rev 1694)
+++ trunk/ChangeLog	2007-07-12 15:44:13 UTC (rev 1695)
@@ -4,6 +4,10 @@
    Make Escape close the 'Grab Key' dialog.
  * src/keybindings.c, src/tools.c, src/dialogs.c, src/search.c
    Capitalize some dialog titles.
+ * src/interface.c, src/prefs.c, src/keyfile.c, src/document.c,
+   src/editor.h, geany.glade:
+   Apply patch from Jeff Pohlmeyer to add a preference for whether to
+   use 'smart' home key behaviour (thanks).
 
 
 2007-07-11  Enrico Tröger  <enrico.troeger at uvena.de>

Modified: trunk/geany.glade
===================================================================
--- trunk/geany.glade	2007-07-12 11:59:13 UTC (rev 1694)
+++ trunk/geany.glade	2007-07-12 15:44:13 UTC (rev 1695)
@@ -5484,6 +5484,26 @@
 			  </child>
 
 			  <child>
+			    <widget class="GtkCheckButton" id="check_smart_home">
+			      <property name="visible">True</property>
+			      <property name="tooltip" translatable="yes">When "smart" home is enabled, the HOME key will move the caret to the first non-blank character of the line, unless it is already there, it moves to the very beginning of the line. When this feature is disabled, the HOME key always moves the caret to the start of the current line, regardless of its current position.</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Enable "smart" home key</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">False</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
 			    <widget class="GtkCheckButton" id="check_disable_dnd">
 			      <property name="visible">True</property>
 			      <property name="tooltip" translatable="yes">Disable drag and drop completely in the editor window so you can't drag and drop any selections within or outside of the editor window.</property>

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2007-07-12 11:59:13 UTC (rev 1694)
+++ trunk/src/document.c	2007-07-12 15:44:13 UTC (rev 1695)
@@ -216,6 +216,10 @@
 	sci_set_folding_margin_visible(sci, editor_prefs.folding);
 
 	doc_list[idx].auto_indent = (editor_prefs.indent_mode != INDENT_NONE);
+
+	sci_assign_cmdkey(sci, SCK_HOME,
+		editor_prefs.smart_home_key ? SCI_VCHOMEWRAP : SCI_HOMEWRAP);
+	sci_assign_cmdkey(sci, SCK_END,  SCI_LINEENDWRAP);
 }
 
 
@@ -299,8 +303,6 @@
 	//SSM(sci, SCI_SETWRAPSTARTINDENT, 4, 0);
 	// disable scintilla provided popup menu
 	sci_use_popup(sci, FALSE);
-	sci_assign_cmdkey(sci, SCK_HOME, SCI_VCHOMEWRAP);
-	sci_assign_cmdkey(sci, SCK_END,  SCI_LINEENDWRAP);
 	// disable some Scintilla keybinsings to be able to redefine it
 	sci_clear_cmdkey(sci, 'A' | (SCMOD_CTRL << 16)); // select all
 	sci_clear_cmdkey(sci, 'T' | (SCMOD_CTRL << 16)); // line transpose

Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h	2007-07-12 11:59:13 UTC (rev 1694)
+++ trunk/src/editor.h	2007-07-12 15:44:13 UTC (rev 1695)
@@ -67,6 +67,7 @@
 	gboolean	replace_tabs;
 	gboolean	trail_space;
 	gboolean	disable_dnd;
+	gboolean	smart_home_key;
 	GHashTable	*auto_completions;
 } EditorPrefs;
 

Modified: trunk/src/interface.c
===================================================================
--- trunk/src/interface.c	2007-07-12 11:59:13 UTC (rev 1694)
+++ trunk/src/interface.c	2007-07-12 15:44:13 UTC (rev 1695)
@@ -2536,6 +2536,7 @@
   GtkWidget *alignment17;
   GtkWidget *vbox17;
   GtkWidget *check_line_wrapping;
+  GtkWidget *check_smart_home;
   GtkWidget *check_disable_dnd;
   GtkWidget *check_folding;
   GtkWidget *check_unfold_children;
@@ -3456,6 +3457,12 @@
   gtk_box_pack_start (GTK_BOX (vbox17), check_line_wrapping, FALSE, FALSE, 0);
   gtk_tooltips_set_tip (tooltips, check_line_wrapping, _("Wrap the line at the window border and continue it on the next line. Note: line wrapping has a high performance cost for large documents so should be disabled on slow machines."), NULL);
 
+  check_smart_home = gtk_check_button_new_with_mnemonic (_("Enable \"smart\" home key"));
+  gtk_widget_show (check_smart_home);
+  gtk_box_pack_start (GTK_BOX (vbox17), check_smart_home, FALSE, FALSE, 0);
+  gtk_tooltips_set_tip (tooltips, check_smart_home, _("When \"smart\" home is enabled, the HOME key will move the caret to the first non-blank character of the line, unless it is already there, it moves to the very beginning of the line. When this feature is disabled, the HOME key always moves the caret to the start of the current line, regardless of its current position."), NULL);
+  gtk_button_set_focus_on_click (GTK_BUTTON (check_smart_home), FALSE);
+
   check_disable_dnd = gtk_check_button_new_with_mnemonic (_("Disable Drag and Drop"));
   gtk_widget_show (check_disable_dnd);
   gtk_box_pack_start (GTK_BOX (vbox17), check_disable_dnd, FALSE, FALSE, 0);
@@ -4247,6 +4254,7 @@
   GLADE_HOOKUP_OBJECT (prefs_dialog, alignment17, "alignment17");
   GLADE_HOOKUP_OBJECT (prefs_dialog, vbox17, "vbox17");
   GLADE_HOOKUP_OBJECT (prefs_dialog, check_line_wrapping, "check_line_wrapping");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, check_smart_home, "check_smart_home");
   GLADE_HOOKUP_OBJECT (prefs_dialog, check_disable_dnd, "check_disable_dnd");
   GLADE_HOOKUP_OBJECT (prefs_dialog, check_folding, "check_folding");
   GLADE_HOOKUP_OBJECT (prefs_dialog, check_unfold_children, "check_unfold_children");

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2007-07-12 11:59:13 UTC (rev 1694)
+++ trunk/src/keyfile.c	2007-07-12 15:44:13 UTC (rev 1695)
@@ -268,6 +268,7 @@
 	g_key_file_set_boolean(config, PACKAGE, "pref_editor_replace_tabs", editor_prefs.replace_tabs);
 	g_key_file_set_boolean(config, PACKAGE, "pref_editor_trail_space", editor_prefs.trail_space);
 	g_key_file_set_boolean(config, PACKAGE, "pref_editor_disable_dnd", editor_prefs.disable_dnd);
+	g_key_file_set_boolean(config, PACKAGE, "pref_editor_smart_home_key", editor_prefs.smart_home_key);
 	g_key_file_set_string(config, PACKAGE, "pref_editor_default_new_encoding", encodings[editor_prefs.default_new_encoding].charset);
 	if (editor_prefs.default_open_encoding == -1)
 		g_key_file_set_string(config, PACKAGE, "pref_editor_default_open_encoding", "none");
@@ -538,6 +539,7 @@
 	editor_prefs.new_line = utils_get_setting_boolean(config, PACKAGE, "pref_editor_new_line", TRUE);
 	editor_prefs.trail_space = utils_get_setting_boolean(config, PACKAGE, "pref_editor_trail_space", FALSE);
 	editor_prefs.disable_dnd = utils_get_setting_boolean(config, PACKAGE, "pref_editor_disable_dnd", FALSE);
+	editor_prefs.smart_home_key = utils_get_setting_boolean(config, PACKAGE, "pref_editor_smart_home_key", TRUE);
 
 	tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_MAKE);
 	app->tools_make_cmd = utils_get_setting_string(config, "tools", "make_cmd", tmp_string);

Modified: trunk/src/prefs.c
===================================================================
--- trunk/src/prefs.c	2007-07-12 11:59:13 UTC (rev 1694)
+++ trunk/src/prefs.c	2007-07-12 15:44:13 UTC (rev 1695)
@@ -289,6 +289,9 @@
 	widget = lookup_widget(app->prefs_dialog, "check_disable_dnd");
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.disable_dnd);
 
+	widget = lookup_widget(app->prefs_dialog, "check_smart_home");
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.smart_home_key);
+
 	widget = lookup_widget(app->prefs_dialog, "check_use_tabs");
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.use_tabs);
 
@@ -644,6 +647,9 @@
 		widget = lookup_widget(app->prefs_dialog, "check_disable_dnd");
 		editor_prefs.disable_dnd = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
+		widget = lookup_widget(app->prefs_dialog, "check_smart_home");
+		editor_prefs.smart_home_key = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+
 		widget = lookup_widget(app->prefs_dialog, "check_use_tabs");
 		editor_prefs.use_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 


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