]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/gtk/GMiniBuffer.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / gtk / GMiniBuffer.C
index bcc2a29e3a7bccee12a604f665f609f9a1b8861f..3f117a77455978e218f83caaff500f64103dc078 100644 (file)
@@ -9,16 +9,26 @@
  */
 
 #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 "GView.h"
 #include "GMiniBuffer.h"
 #include "debug.h"
 #include "bufferview_funcs.h"
+
+#include "frontends/controllers/ControlCommandBuffer.h"
+
 #include <boost/bind.hpp>
 #include <vector>
-#include "frontends/controllers/ControlCommandBuffer.h"
 
+using std::string;
+
+namespace lyx {
+namespace frontend {
 
 GMiniBuffer::GMiniBuffer(GView * view, ControlCommandBuffer & control) :
        controller_(control), view_(view)
@@ -28,34 +38,37 @@ GMiniBuffer::GMiniBuffer(GView * view, ControlCommandBuffer & control) :
        listView_.set_model(listStore_);
        listView_.append_column("Completions", listCol_);
        listView_.signal_key_press_event().connect(
-               SigC::slot(*this, &GMiniBuffer::onListKeyPress));
+               sigc::mem_fun(*this, &GMiniBuffer::onListKeyPress));
        listView_.signal_focus_in_event().connect(
-               SigC::slot(*this, &GMiniBuffer::onListFocusIn));
+               sigc::mem_fun(*this, &GMiniBuffer::onListFocusIn));
        listView_.signal_focus_out_event().connect(
-               SigC::slot(*this, &GMiniBuffer::onFocusOut));
+               sigc::mem_fun(*this, &GMiniBuffer::onFocusOut));
        listSel_ = listView_.get_selection();
        listSel_->signal_changed().connect(
-               SigC::slot(*this, &GMiniBuffer::onSelected));
+               sigc::mem_fun(*this, &GMiniBuffer::onSelected));
+
        listView_.show();
        scrolledWindow_.set_policy(Gtk::POLICY_AUTOMATIC,
                                   Gtk::POLICY_AUTOMATIC);
        scrolledWindow_.set_size_request(300, 150);
        scrolledWindow_.add(listView_);
-       view_->getVBox().children().push_back(
-               Gtk::Box_Helpers::Element(scrolledWindow_,
-                                         Gtk::PACK_SHRINK));
+
+       view_->getBox(GView::Bottom).children().push_back(
+               Gtk::Box_Helpers::Element(scrolledWindow_,Gtk::PACK_SHRINK));
+
        entry_.signal_key_press_event().connect(
-               SigC::slot(*this, &GMiniBuffer::onKeyPress));
+               sigc::mem_fun(*this, &GMiniBuffer::onKeyPress));
        entry_.signal_focus_in_event().connect(
-               SigC::slot(*this, &GMiniBuffer::onFocusIn));
+               sigc::mem_fun(*this, &GMiniBuffer::onFocusIn));
        entry_.signal_focus_out_event().connect(
-               SigC::slot(*this, &GMiniBuffer::onFocusOut));
+               sigc::mem_fun(*this, &GMiniBuffer::onFocusOut));
        entry_.signal_activate().connect(
-               SigC::slot(*this, &GMiniBuffer::onCommit));
+               sigc::mem_fun(*this, &GMiniBuffer::onCommit));
        entry_.show();
-       view_->getVBox().children().push_back(
-               Gtk::Box_Helpers::Element(entry_,
-                                         Gtk::PACK_SHRINK));
+
+       view_->getBox(GView::Bottom).children().push_back(
+               Gtk::Box_Helpers::Element(entry_, Gtk::PACK_SHRINK));
+
        infoTimer_.reset(new Timeout(1500));
        idleTimer_.reset(new Timeout(6000));
        focusTimer_.reset(new Timeout(50));
@@ -188,7 +201,7 @@ bool GMiniBuffer::onKeyPress(GdkEventKey * event)
        switch (event->keyval) {
        case GDK_Down:
        {
-               Glib::ustring const h = 
+               Glib::ustring const h =
                        Glib::locale_to_utf8(controller_.historyDown());
                if (h.empty())
                        showInfo("[End of history]", false);
@@ -198,7 +211,7 @@ bool GMiniBuffer::onKeyPress(GdkEventKey * event)
        }
        case GDK_Up:
        {
-               Glib::ustring const h = 
+               Glib::ustring const h =
                        Glib::locale_to_utf8(controller_.historyUp());
                if (h.empty())
                        showInfo("[Beginning of history]", false);
@@ -211,13 +224,14 @@ bool GMiniBuffer::onKeyPress(GdkEventKey * event)
                break;
        case GDK_Tab:
        {
-               Glib::ustring new_input, input;
                string new_input_locale;
-               input = entry_.get_text();
-               std::vector<string> comp = 
+               Glib::ustring input = entry_.get_text();
+               std::vector<string> comp =
                        controller_.completions(Glib::locale_from_utf8(input),
                                                new_input_locale);
-               new_input = Glib::locale_to_utf8(new_input_locale);
+               Glib::ustring new_input =
+                       Glib::locale_to_utf8(new_input_locale);
+
                if (comp.empty() && new_input == input) {
                        showInfo("[no match]");
                        break;
@@ -279,3 +293,6 @@ void GMiniBuffer::setInput(Glib::ustring const & input)
        entry_.set_text(input);
        entry_.set_position(-1);
 }
+
+} // namespace frontend
+} // namespace lyx