Kaydet (Commit) a1bca612 authored tarafından Enrico Tröger's avatar Enrico Tröger

Added "Replace in all open files" option in the replace dialog.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@546 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 3539ab40
2006-07-10 Enrico Tröger <enrico.troeger@uvena.de>
* src/sci_cb.c: Autocompletion only works on blank lines.
* src/callbacks.c, src/dialogs.c:
Added "Replace in all open files" option in the replace dialog.
2006-07-09 Enrico Tröger <enrico.troeger@uvena.de>
......
......@@ -77,6 +77,7 @@ static gint search_flags;
static gboolean search_backwards;
static gint search_flags_re;
static gboolean search_backwards_re;
static gboolean search_in_all_buffers_re;
// holds the current position where the mouse pointer is when the popup menu for the scintilla
// scintilla widget is shown
......@@ -1894,6 +1895,8 @@ on_replace_dialog_response (GtkDialog *dialog,
lookup_widget(GTK_WIDGET(app->replace_dialog), "check_wordstart")));
search_backwards_re = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
lookup_widget(GTK_WIDGET(app->replace_dialog), "check_back")));
search_in_all_buffers_re = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
lookup_widget(GTK_WIDGET(app->replace_dialog), "check_all_buffers")));
find = gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(entry_find))));
replace = gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(entry_replace))));
......@@ -1911,22 +1914,36 @@ on_replace_dialog_response (GtkDialog *dialog,
(fl2 ? SCFIND_WHOLEWORD : 0) |
(fl3 ? SCFIND_REGEXP : 0) |
(fl4 ? SCFIND_WORDSTART : 0);
switch (response)
if (search_in_all_buffers_re && response == GEANY_RESPONSE_REPLACE_ALL)
{
case GEANY_RESPONSE_REPLACE:
{
document_replace_text(idx, find, replace, search_flags_re, search_backwards_re);
break;
}
case GEANY_RESPONSE_REPLACE_ALL:
gint i;
for (i = 0; i < GEANY_MAX_OPEN_FILES; i++)
{
document_replace_all(idx, find, replace, search_flags_re);
break;
if (! doc_list[i].is_valid) continue;
document_replace_all(i, find, replace, search_flags_re);
}
case GEANY_RESPONSE_REPLACE_SEL:
}
else
{
switch (response)
{
document_replace_sel(idx, find, replace, search_flags_re);
break;
case GEANY_RESPONSE_REPLACE:
{
document_replace_text(idx, find, replace, search_flags_re, search_backwards_re);
break;
}
case GEANY_RESPONSE_REPLACE_ALL:
{
document_replace_all(idx, find, replace, search_flags_re);
break;
}
case GEANY_RESPONSE_REPLACE_SEL:
{
document_replace_sel(idx, find, replace, search_flags_re);
break;
}
}
}
}
......
......@@ -904,7 +904,7 @@ void dialogs_show_replace(void)
if (app->replace_dialog == NULL)
{
GtkWidget *label_find, *label_replace, *entry_find, *entry_replace;
GtkWidget *checkbox1, *checkbox2, *checkbox3, *checkbox5, *checkbox4;
GtkWidget *checkbox1, *checkbox2, *checkbox3, *checkbox4, *checkbox5, *checkbox6;
GtkWidget *button;
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
......@@ -986,11 +986,19 @@ void dialogs_show_replace(void)
gtk_widget_ref(checkbox5), (GDestroyNotify)gtk_widget_unref);
gtk_button_set_focus_on_click(GTK_BUTTON(checkbox5), FALSE);
checkbox6 = gtk_check_button_new_with_mnemonic(_("Replace in all open files"));
g_object_set_data_full(G_OBJECT(app->replace_dialog), "check_all_buffers",
gtk_widget_ref(checkbox6), (GDestroyNotify)gtk_widget_unref);
gtk_tooltips_set_tip(tooltips, checkbox6,
_("Replaces the search text in all opened files. This option is only useful(and used) if you click on \"Replace All\"."), NULL);
gtk_button_set_focus_on_click(GTK_BUTTON(checkbox6), FALSE);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(app->replace_dialog)->vbox), checkbox1);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(app->replace_dialog)->vbox), checkbox2);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(app->replace_dialog)->vbox), checkbox5);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(app->replace_dialog)->vbox), checkbox3);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(app->replace_dialog)->vbox), checkbox4);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(app->replace_dialog)->vbox), checkbox6);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(app->replace_dialog)->vbox), gtk_label_new(""));
gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(app->replace_dialog)->vbox), 3);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment