To: vim-dev@vim.org Subject: Patch 6.2.241 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.241 Problem: GTK 2: Search and Search/Replace dialogs are synced, that makes no sense. Buttons are sometimes greyed-out. (Jeremy Messenger) Solution: Remove the code to sync the two dialogs. Adjust the code to react to an empty search string to also work for GTK2. (David Necas) Files: src/gui_gtk.c *** ../vim-6.2.240/src/gui_gtk.c Fri Feb 6 19:22:46 2004 --- src/gui_gtk.c Fri Feb 6 15:22:50 2004 *************** *** 170,183 **** #endif /* HAVE_GTK2 */ static void entry_activate_cb(GtkWidget *widget, gpointer data); - #ifndef HAVE_GTK2 /* crack alert! */ static void entry_changed_cb(GtkWidget *entry, GtkWidget *dialog); - #endif - static void find_direction_cb(GtkWidget *widget, gpointer data); static void find_replace_cb(GtkWidget *widget, gpointer data); - static void wword_match_cb(GtkWidget *widget, gpointer data); - static void mcase_match_cb(GtkWidget *widget, gpointer data); - static void repl_dir_cb(GtkWidget *widget, gpointer data); #if defined(FEAT_TOOLBAR) && defined(HAVE_GTK2) /* --- 170,177 ---- *************** *** 2514,2523 **** sensitive = (entry_text != NULL && entry_text[0] != NUL); if (entry_text != NULL) gtk_entry_set_text(GTK_ENTRY(frdp->what), (char *)entry_text); - #ifndef HAVE_GTK2 gtk_signal_connect(GTK_OBJECT(frdp->what), "changed", GTK_SIGNAL_FUNC(entry_changed_cb), frdp->dialog); - #endif gtk_signal_connect_after(GTK_OBJECT(frdp->what), "key_press_event", GTK_SIGNAL_FUNC(find_key_press_event), (gpointer) frdp); --- 2508,2515 ---- *************** *** 2561,2568 **** frdp->wword = gtk_check_button_new_with_label(CONV(_("Match whole word only"))); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->wword), (gboolean)wword); - gtk_signal_connect(GTK_OBJECT(frdp->wword), "clicked", - GTK_SIGNAL_FUNC(wword_match_cb), NULL); if (do_replace) gtk_table_attach(GTK_TABLE(table), frdp->wword, 0, 1023, 2, 3, GTK_FILL, GTK_EXPAND, 2, 2); --- 2553,2558 ---- *************** *** 2574,2581 **** frdp->mcase = gtk_check_button_new_with_label(CONV(_("Match case"))); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->mcase), (gboolean)mcase); - gtk_signal_connect(GTK_OBJECT(frdp->mcase), "clicked", - GTK_SIGNAL_FUNC(mcase_match_cb), NULL); if (do_replace) gtk_table_attach(GTK_TABLE(table), frdp->mcase, 0, 1023, 3, 4, GTK_FILL, GTK_EXPAND, 2, 2); --- 2564,2569 ---- *************** *** 2601,2610 **** gtk_radio_button_group(GTK_RADIO_BUTTON(frdp->up)), CONV(_("Down"))); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->down), TRUE); - gtk_signal_connect(GTK_OBJECT(frdp->down), "clicked", - (do_replace) ? GTK_SIGNAL_FUNC(repl_dir_cb) - : GTK_SIGNAL_FUNC(find_direction_cb), - NULL); #ifdef HAVE_GTK2 gtk_container_set_border_width(GTK_CONTAINER(vbox), 2); #endif --- 2589,2594 ---- *************** *** 2850,2919 **** } /* - * The following are used to synchronize the direction setting - * between the search and the replace dialog. - */ - /*ARGSUSED*/ - static void - find_direction_cb(GtkWidget * widget, gpointer data) - { - gboolean direction_down = GTK_TOGGLE_BUTTON(widget)->active; - - if (repl_widgets.dialog) - { - GtkWidget *w; - w = direction_down ? repl_widgets.down : repl_widgets.up; - - if (!GTK_TOGGLE_BUTTON(w)->active) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(w), TRUE); - } - } - - /*ARGSUSED*/ - static void - repl_dir_cb(GtkWidget *widget, gpointer data) - { - gboolean direction_down = GTK_TOGGLE_BUTTON(widget)->active; - - if (find_widgets.dialog) - { - GtkWidget *w; - w = direction_down ? find_widgets.down : find_widgets.up; - - if (!GTK_TOGGLE_BUTTON(w)->active) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(w), TRUE); - } - } - - /*ARGSUSED*/ - static void - wword_match_cb(GtkWidget * widget, gpointer data) - { - gboolean active = GTK_TOGGLE_BUTTON(widget)->active; - - if (find_widgets.dialog) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(find_widgets.wword), - active); - if (repl_widgets.dialog) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(repl_widgets.wword), - active); - } - - /*ARGSUSED*/ - static void - mcase_match_cb(GtkWidget * widget, gpointer data) - { - gboolean active = GTK_TOGGLE_BUTTON(widget)->active; - - if (find_widgets.dialog) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(find_widgets.mcase), - active); - if (repl_widgets.dialog) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(repl_widgets.mcase), - active); - } - - /* * Syncing the find/replace dialogs on the fly is utterly useless crack, * and causes nothing but problems. Please tell me a use case for which * you'd need both a find dialog and a find/replace one at the same time, --- 2834,2839 ---- *************** *** 2922,2928 **** * particularly evil incarnation of braindeadness, whatever; I'd much rather * see it extinguished from this planet. Thanks for listening. Sorry. */ - #ifndef HAVE_GTK2 static void entry_changed_cb(GtkWidget * entry, GtkWidget * dialog) { --- 2842,2847 ---- *************** *** 2939,2969 **** if (dialog == find_widgets.dialog) { gtk_widget_set_sensitive(find_widgets.find, nonempty); - if (repl_widgets.dialog) - { - gtk_widget_set_sensitive(repl_widgets.find, nonempty); - gtk_widget_set_sensitive(repl_widgets.replace, nonempty); - gtk_widget_set_sensitive(repl_widgets.all, nonempty); - if (strcmp(entry_text, - gtk_entry_get_text(GTK_ENTRY(repl_widgets.what)))) - gtk_entry_set_text(GTK_ENTRY(repl_widgets.what), entry_text); - } } if (dialog == repl_widgets.dialog) { gtk_widget_set_sensitive(repl_widgets.find, nonempty); gtk_widget_set_sensitive(repl_widgets.replace, nonempty); gtk_widget_set_sensitive(repl_widgets.all, nonempty); - if (find_widgets.dialog) - { - gtk_widget_set_sensitive(find_widgets.find, nonempty); - if (strcmp(entry_text, - gtk_entry_get_text(GTK_ENTRY(find_widgets.what)))) - gtk_entry_set_text(GTK_ENTRY(find_widgets.what), entry_text); - } } } - #endif /* * ":helpfind" --- 2858,2872 ---- if (dialog == find_widgets.dialog) { gtk_widget_set_sensitive(find_widgets.find, nonempty); } + if (dialog == repl_widgets.dialog) { gtk_widget_set_sensitive(repl_widgets.find, nonempty); gtk_widget_set_sensitive(repl_widgets.replace, nonempty); gtk_widget_set_sensitive(repl_widgets.all, nonempty); } } /* * ":helpfind" *** ../vim-6.2.240/src/version.c Fri Feb 6 19:22:46 2004 --- src/version.c Fri Feb 6 19:29:40 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 241, /**/ -- hundred-and-one symptoms of being an internet addict: 65. The last time you looked at the clock it was 11:30pm, and in what seems like only a few seconds later, your sister runs past you to catch her 7am school bus. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///