SF.net SVN: geany: [700] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Sat Aug 12 12:04:19 UTC 2006


Revision: 700
Author:   ntrel
Date:     2006-08-12 05:04:14 -0700 (Sat, 12 Aug 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=700&view=rev

Log Message:
-----------
Enable case sensitive when regex search enabled; Some label text changes for the dialogs

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/search.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-08-11 21:41:05 UTC (rev 699)
+++ trunk/ChangeLog	2006-08-12 12:04:14 UTC (rev 700)
@@ -1,3 +1,9 @@
+2006-08-12  Nick Treleaven  <nick.treleaven at btinternet.com>
+
+ * src/search.c: Enable case sensitive when regex search enabled.
+                 Some label text changes for the dialogs.
+
+
 2006-08-11  Nick Treleaven  <nick.treleaven at btinternet.com>
 
  * src/keybindings.c, src/geany.h, src/callbacks.c, src/callbacks.h,

Modified: trunk/src/search.c
===================================================================
--- trunk/src/search.c	2006-08-11 21:41:05 UTC (rev 699)
+++ trunk/src/search.c	2006-08-12 12:04:14 UTC (rev 700)
@@ -110,29 +110,9 @@
 static void add_find_checkboxes(GtkDialog *dialog)
 {
 	GtkWidget *checkbox1, *checkbox2, *check_regexp, *checkbox4, *checkbox5,
-			  *checkbox7, *hbox, *lbox, *rbox;
+			  *checkbox7, *hbox, *fbox, *mbox;
 	GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
 
-	checkbox1 = gtk_check_button_new_with_mnemonic(_("_Case sensitive"));
-	g_object_set_data_full(G_OBJECT(dialog), "check_case",
-					gtk_widget_ref(checkbox1), (GDestroyNotify)gtk_widget_unref);
-	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox1), FALSE);
-
-	checkbox2 = gtk_check_button_new_with_mnemonic(_("Match only a _whole word"));
-	g_object_set_data_full(G_OBJECT(dialog), "check_word",
-					gtk_widget_ref(checkbox2), (GDestroyNotify)gtk_widget_unref);
-	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox2), FALSE);
-
-	checkbox5 = gtk_check_button_new_with_mnemonic(_("Match only word s_tart"));
-	g_object_set_data_full(G_OBJECT(dialog), "check_wordstart",
-					gtk_widget_ref(checkbox5), (GDestroyNotify)gtk_widget_unref);
-	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox5), FALSE);
-
-	lbox = gtk_vbox_new(FALSE, 0);
-	gtk_container_add(GTK_CONTAINER(lbox), checkbox1);
-	gtk_container_add(GTK_CONTAINER(lbox), checkbox2);
-	gtk_container_add(GTK_CONTAINER(lbox), checkbox5);
-
 	check_regexp = gtk_check_button_new_with_mnemonic(_("_Use regular expressions"));
 	g_object_set_data_full(G_OBJECT(dialog), "check_regexp",
 					gtk_widget_ref(check_regexp), (GDestroyNotify)gtk_widget_unref);
@@ -147,7 +127,7 @@
 					gtk_widget_ref(checkbox4), (GDestroyNotify)gtk_widget_unref);
 	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox4), FALSE);
 
-	checkbox7 = gtk_check_button_new_with_mnemonic(_("_Replace control characters"));
+	checkbox7 = gtk_check_button_new_with_mnemonic(_("Use _escape sequences"));
 	g_object_set_data_full(G_OBJECT(dialog), "check_escape",
 					gtk_widget_ref(checkbox7), (GDestroyNotify)gtk_widget_unref);
 	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox7), FALSE);
@@ -155,14 +135,36 @@
 		_("Replace \\\\, \\t, \\n, \\r and \\uXXXX (Unicode chararacters) with the "
 		  "corresponding control characters."), NULL);
 
-	rbox = gtk_vbox_new(FALSE, 0);
-	gtk_container_add(GTK_CONTAINER(rbox), check_regexp);
-	gtk_container_add(GTK_CONTAINER(rbox), checkbox7);
-	gtk_container_add(GTK_CONTAINER(rbox), checkbox4);
+	// Search features
+	fbox = gtk_vbox_new(FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(fbox), check_regexp);
+	gtk_container_add(GTK_CONTAINER(fbox), checkbox7);
+	gtk_container_add(GTK_CONTAINER(fbox), checkbox4);
 
+	checkbox1 = gtk_check_button_new_with_mnemonic(_("_Case sensitive"));
+	g_object_set_data_full(G_OBJECT(dialog), "check_case",
+					gtk_widget_ref(checkbox1), (GDestroyNotify)gtk_widget_unref);
+	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox1), FALSE);
+
+	checkbox2 = gtk_check_button_new_with_mnemonic(_("Match only a _whole word"));
+	g_object_set_data_full(G_OBJECT(dialog), "check_word",
+					gtk_widget_ref(checkbox2), (GDestroyNotify)gtk_widget_unref);
+	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox2), FALSE);
+
+	checkbox5 = gtk_check_button_new_with_mnemonic(_("Match only word s_tart"));
+	g_object_set_data_full(G_OBJECT(dialog), "check_wordstart",
+					gtk_widget_ref(checkbox5), (GDestroyNotify)gtk_widget_unref);
+	gtk_button_set_focus_on_click(GTK_BUTTON(checkbox5), FALSE);
+
+	// Matching options
+	mbox = gtk_vbox_new(FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(mbox), checkbox1);
+	gtk_container_add(GTK_CONTAINER(mbox), checkbox2);
+	gtk_container_add(GTK_CONTAINER(mbox), checkbox5);
+
 	hbox = gtk_hbox_new(FALSE, 6);
-	gtk_container_add(GTK_CONTAINER(hbox), lbox);
-	gtk_container_add(GTK_CONTAINER(hbox), rbox);
+	gtk_container_add(GTK_CONTAINER(hbox), fbox);
+	gtk_container_add(GTK_CONTAINER(hbox), mbox);
 	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, TRUE, TRUE, 6);
 }
 
@@ -189,7 +191,7 @@
 			GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL,
 			GTK_STOCK_FIND, GTK_RESPONSE_ACCEPT, NULL);
 
-		label = gtk_label_new(_("Enter the search text here:"));
+		label = gtk_label_new(_("Search for:"));
 		gtk_misc_set_padding(GTK_MISC(label), 0, 6);
 		gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
 
@@ -272,10 +274,10 @@
 		gtk_dialog_add_action_widget(GTK_DIALOG(widgets.replace_dialog), button,
 			GEANY_RESPONSE_REPLACE);
 
-		label_find = gtk_label_new(_("Enter the search text here:"));
+		label_find = gtk_label_new(_("Search for:"));
 		gtk_misc_set_alignment(GTK_MISC(label_find), 0, 0.5);
 
-		label_replace = gtk_label_new(_("Enter the replace text here:"));
+		label_replace = gtk_label_new(_("Replace with:"));
 		gtk_misc_set_alignment(GTK_MISC(label_replace), 0, 0.5);
 
 		entry_find = gtk_combo_box_entry_new_text();
@@ -299,14 +301,14 @@
 				G_CALLBACK(gtk_widget_hide), NULL);
 
 		fbox = gtk_hbox_new(FALSE, 6);
-		gtk_container_add(GTK_CONTAINER(fbox), label_find);
-		gtk_container_add(GTK_CONTAINER(fbox), entry_find);
+		gtk_box_pack_start(GTK_BOX(fbox), label_find, FALSE, FALSE, 0);
+		gtk_box_pack_start(GTK_BOX(fbox), entry_find, TRUE, TRUE, 0);
 		gtk_box_pack_start(GTK_BOX(GTK_DIALOG(widgets.replace_dialog)->vbox), fbox,
 			FALSE, FALSE, 6);
 
 		rbox = gtk_hbox_new(FALSE, 6);
-		gtk_container_add(GTK_CONTAINER(rbox), label_replace);
-		gtk_container_add(GTK_CONTAINER(rbox), entry_replace);
+		gtk_box_pack_start(GTK_BOX(rbox), label_replace, FALSE, FALSE, 0);
+		gtk_box_pack_start(GTK_BOX(rbox), entry_replace, TRUE, TRUE, 0);
 		gtk_box_pack_start(GTK_BOX(GTK_DIALOG(widgets.replace_dialog)->vbox), rbox,
 			FALSE, FALSE, 3);
 
@@ -380,7 +382,7 @@
 		gtk_box_pack_start(GTK_BOX(vbox1), label1, FALSE, FALSE, 0);
 		gtk_box_pack_start(GTK_BOX(vbox1), entry1, FALSE, FALSE, 0);
 
-		label = gtk_label_new(_("Enter the search text here:"));
+		label = gtk_label_new(_("Search for:"));
 		gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
 
 		combo = gtk_combo_box_entry_new_text();
@@ -394,7 +396,7 @@
 						gtk_widget_ref(checkbox1), (GDestroyNotify)gtk_widget_unref);
 		gtk_button_set_focus_on_click(GTK_BUTTON(checkbox1), FALSE);
 
-		checkbox2 = gtk_check_button_new_with_mnemonic(_("Invert search results"));
+		checkbox2 = gtk_check_button_new_with_mnemonic(_("_Invert search results"));
 		g_object_set_data_full(G_OBJECT(widgets.find_in_files_dialog), "check_invert",
 						gtk_widget_ref(checkbox2), (GDestroyNotify)gtk_widget_unref);
 		gtk_button_set_focus_on_click(GTK_BUTTON(checkbox2), FALSE);
@@ -468,10 +470,27 @@
 		GtkWidget *check_back = lookup_widget(dialog, "check_back");
 		GtkWidget *check_word = lookup_widget(dialog, "check_word");
 		GtkWidget *check_wordstart = lookup_widget(dialog, "check_wordstart");
+		GtkToggleButton *check_case = GTK_TOGGLE_BUTTON(
+			lookup_widget(dialog, "check_case"));
+		static gboolean case_state = FALSE; // state before regex enabled
 
+		// hide options that don't apply to regex searches
 		gtk_widget_set_sensitive(check_back, ! regex_set);
 		gtk_widget_set_sensitive(check_word, ! regex_set);
 		gtk_widget_set_sensitive(check_wordstart, ! regex_set);
+
+		if (regex_set)	// regex enabled
+		{
+			// Enable case sensitive but remember original case toggle state
+			case_state = gtk_toggle_button_get_active(check_case);
+			gtk_toggle_button_set_active(check_case, TRUE);
+		}
+		else	// regex disabled
+		{
+			// If case sensitive is still enabled, revert to what it was before we enabled it
+			if (gtk_toggle_button_get_active(check_case) == TRUE)
+				gtk_toggle_button_set_active(check_case, case_state);
+		}
 	}
 }
 


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