]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/gtk/GSearch.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / gtk / GSearch.C
index 14fa2033e3841f26cf19d6f9c023406118f6c479..c966ede402383d5a2e4cc4818fae41b6f1bc9314 100644 (file)
@@ -9,11 +9,16 @@
  */
 
 #include <config.h>
-#include <gtkmm.h>
+
+// Too hard to make concept checks work with this file
+#ifdef _GLIBCPP_CONCEPT_CHECKS
+#undef _GLIBCPP_CONCEPT_CHECKS
+#endif
 
 #include "GSearch.h"
 #include "ControlSearch.h"
 #include "ghelpers.h"
+
 #include <libglademm.h>
 
 using std::string;
@@ -23,6 +28,7 @@ namespace frontend {
 
 typedef GViewCB<ControlSearch, GViewGladeB> base_class;
 
+
 GSearch::GSearch(Dialog & parent)
        : base_class(parent, _("Find and Replace"), false)
 {}
@@ -32,14 +38,14 @@ void GSearch::doBuild()
 {
        string const gladeName = findGladeFile("search");
        xml_ = Gnome::Glade::Xml::create(gladeName);
-       
+
        Gtk::Button * cancelbutton;
        xml_->get_widget("Cancel", cancelbutton);
        setCancel(cancelbutton);
 
        xml_->get_widget("FindNext", findnextbutton);
        xml_->get_widget("Replace", replacebutton);
-       xml_->get_widget("ReplaceAll", replaceallbutton);       
+       xml_->get_widget("ReplaceAll", replaceallbutton);
        xml_->get_widget("FindEntry", findentry);
        xml_->get_widget("ReplaceEntry", replaceentry);
        xml_->get_widget("CaseSensitive", casecheck);
@@ -47,19 +53,27 @@ void GSearch::doBuild()
        xml_->get_widget("SearchBackwards", backwardscheck);
 
        findnextbutton->signal_clicked().connect(
-               SigC::slot(*this, &GSearch::onFindNext));
+               sigc::mem_fun(*this, &GSearch::onFindNext));
        replacebutton->signal_clicked().connect(
-               SigC::slot(*this, &GSearch::onReplace));
+               sigc::mem_fun(*this, &GSearch::onReplace));
        replaceallbutton->signal_clicked().connect(
-               SigC::slot(*this, &GSearch::onReplaceAll));
+               sigc::mem_fun(*this, &GSearch::onReplaceAll));
        findentry->signal_changed().connect(
-               SigC::slot(*this,&GSearch::onFindEntryChanged));        
+               sigc::mem_fun(*this,&GSearch::onFindEntryChanged));
 
        bcview().addReadOnly(replaceentry);
        bcview().addReadOnly(replacebutton);
        bcview().addReadOnly(replaceallbutton);
 }
 
+
+void GSearch::update()
+{
+       bc().refreshReadOnly();
+       onFindEntryChanged();
+}
+
+
 void GSearch::onFindNext()
 {
        controller().find(findentry->get_text(),
@@ -68,6 +82,7 @@ void GSearch::onFindNext()
                          !backwardscheck->get_active());
 }
 
+
 void GSearch::onReplace()
 {
        controller().replace(findentry->get_text(),
@@ -75,9 +90,10 @@ void GSearch::onReplace()
                             casecheck->get_active(),
                             matchwordcheck->get_active(),
                             !backwardscheck->get_active(),
-                            false);                         
+                            false);
 }
 
+
 void GSearch::onReplaceAll()
 {
        controller().replace(findentry->get_text(),
@@ -85,19 +101,20 @@ void GSearch::onReplaceAll()
                             casecheck->get_active(),
                             matchwordcheck->get_active(),
                             !backwardscheck->get_active(),
-                            true);                          
+                            true);
 }
 
+
 void GSearch::onFindEntryChanged()
 {
        if (findentry->get_text().empty()) {
                findnextbutton->set_sensitive(false);
                replacebutton->set_sensitive(false);
-               replaceallbutton->set_sensitive(false); 
+               replaceallbutton->set_sensitive(false);
        } else {
                findnextbutton->set_sensitive(true);
-               replacebutton->set_sensitive(true);
-               replaceallbutton->set_sensitive(true);  
+               replacebutton->set_sensitive(!readOnly());
+               replaceallbutton->set_sensitive(!readOnly());
        }
 }