SF.net SVN: geany: [1301] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Sat Feb 17 17:39:11 UTC 2007
Revision: 1301
http://svn.sourceforge.net/geany/?rev=1301&view=rev
Author: ntrel
Date: 2007-02-17 09:39:10 -0800 (Sat, 17 Feb 2007)
Log Message:
-----------
Add Mark button as a Find All option in the Find dialog.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/search.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-02-17 16:59:36 UTC (rev 1300)
+++ trunk/ChangeLog 2007-02-17 17:39:10 UTC (rev 1301)
@@ -3,6 +3,8 @@
* src/ui_utils.c:
Scroll Compiler and Messages window in view when using Next Error
or Next Message.
+ * src/search.c:
+ Add Mark button as a Find All option in the Find dialog.
2007-02-16 Nick Treleaven <nick.treleaven at btinternet.com>
Modified: trunk/src/search.c
===================================================================
--- trunk/src/search.c 2007-02-17 16:59:36 UTC (rev 1300)
+++ trunk/src/search.c 2007-02-17 17:39:10 UTC (rev 1301)
@@ -344,12 +344,12 @@
exp = gtk_expander_new(_("Find All"));
bbox = gtk_hbutton_box_new();
-#if 0
button = gtk_button_new_with_mnemonic(_("_Mark"));
+ gtk_tooltips_set_tip(tooltips, button,
+ _("Mark all matches in the current document."), NULL);
gtk_container_add(GTK_CONTAINER(bbox), button);
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(send_find_dialog_response),
GINT_TO_POINTER(GEANY_RESPONSE_MARK));
-#endif // not implemented yet
button = gtk_button_new_with_mnemonic(_("In Sessi_on"));
gtk_container_add(GTK_CONTAINER(bbox), button);
@@ -770,6 +770,31 @@
}
+static gint search_mark(gint idx, const gchar *search_text, gint flags)
+{
+ gint pos, line, count = 0;
+ struct TextToFind ttf;
+
+ g_return_val_if_fail(DOC_IDX_VALID(idx), 0);
+
+ ttf.chrg.cpMin = 0;
+ ttf.chrg.cpMax = sci_get_length(doc_list[idx].sci);
+ ttf.lpstrText = (gchar *)search_text;
+ while (1)
+ {
+ pos = sci_find_text(doc_list[idx].sci, flags, &ttf);
+ if (pos == -1) break;
+
+ line = sci_get_line_from_position(doc_list[idx].sci, pos);
+ sci_set_marker_at_line(doc_list[idx].sci, line, TRUE, 1);
+
+ ttf.chrg.cpMin = ttf.chrgText.cpMax + 1;
+ count++;
+ }
+ return count;
+}
+
+
static void
on_find_entry_activate(GtkEntry *entry, gpointer user_data)
{
@@ -824,25 +849,30 @@
{
case GEANY_RESPONSE_FIND:
case GEANY_RESPONSE_FIND_PREVIOUS:
- document_find_text(idx, search_data.text, search_data.flags,
- (response == GEANY_RESPONSE_FIND_PREVIOUS), TRUE);
- check_close = FALSE;
- if (app->pref_main_suppress_search_dialogs)
- check_close = TRUE;
- break;
+ document_find_text(idx, search_data.text, search_data.flags,
+ (response == GEANY_RESPONSE_FIND_PREVIOUS), TRUE);
+ check_close = FALSE;
+ if (app->pref_main_suppress_search_dialogs)
+ check_close = TRUE;
+ break;
case GEANY_RESPONSE_FIND_IN_FILE:
- search_find_usage(search_data.text, search_data.flags, FALSE);
- break;
+ search_find_usage(search_data.text, search_data.flags, FALSE);
+ break;
case GEANY_RESPONSE_FIND_IN_SESSION:
- search_find_usage(search_data.text, search_data.flags, TRUE);
- break;
+ search_find_usage(search_data.text, search_data.flags, TRUE);
+ break;
case GEANY_RESPONSE_MARK:
- // TODO
- break;
+ {
+ gint idx = document_get_cur_idx();
+ if (DOC_IDX_VALID(idx))
+ search_mark(idx, search_data.text, search_data.flags);
+ break;
+ }
+
// Note: we can get GTK_RESPONSE_DELETE_EVENT responses when ESC is pressed
}
if (check_close)
@@ -1318,3 +1348,5 @@
g_free(text);
}
}
+
+
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