]> git.lyx.org Git - lyx.git/blobdiff - src/minibuffer.C
I reactivate the code to resize the InsetText on a resize event of the main
[lyx.git] / src / minibuffer.C
index 4e0666c52d9a678d724d9a9d22fd9f55b9f5e1e9..3f1ae5224e5dc511ac6fd60cc2860f337af5c1f4 100644 (file)
 #include "gettext.h"
 #include "LyXAction.h"
 #include "BufferView.h"
+#include "frontends/Timeout.h"
 
+#include <cctype>
 
 using SigC::slot;
 using std::vector;
+using std::back_inserter;
+using std::find;
 
 extern LyXAction lyxaction;
 
@@ -58,10 +62,12 @@ MiniBuffer::MiniBuffer(LyXView * o, FL_Coord x, FL_Coord y,
        : stored_(false), owner_(o), state_(spaces)
 {
        add(FL_NORMAL_INPUT, x, y, h, w);
-       timer.setTimeout(6000);
-       timer.timeout.connect(slot(this, &MiniBuffer::init));
-       stored_timer.setTimeout(1500);
-       stored_timer.timeout.connect(slot(this, &MiniBuffer::stored_slot));
+
+       timer = new Timeout(6000);
+       timer->timeout.connect(slot(this, &MiniBuffer::init));
+
+       stored_timer = new Timeout(1500);
+       stored_timer->timeout.connect(slot(this, &MiniBuffer::stored_slot));
        deactivate();
 }
 
@@ -77,6 +83,8 @@ void MiniBuffer::dd_init()
 
 MiniBuffer::~MiniBuffer()
 {
+       delete timer;
+       delete stored_timer;
        delete dropdown_;
 }
 
@@ -94,7 +102,7 @@ void MiniBuffer::stored_set(string const & str)
 {
        stored_input = str;
        stored_ = true;
-       stored_timer.start();
+       stored_timer->start();
 }
 
 
@@ -109,7 +117,7 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key)
                char const * tmp = fl_get_input(ob);
                string input = tmp ? tmp : "";
                if (stored_) {
-                       stored_timer.stop();
+                       stored_timer->stop();
                        input = stored_input;
                        set_input(input);
                        stored_ = false;
@@ -146,7 +154,7 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key)
                        vector<string> comp;
                        lyx::copy_if(completion_.begin(),
                                     completion_.end(),
-                                    std::back_inserter(comp), prefix(input));
+                                    back_inserter(comp), prefix(input));
 
                        if (comp.empty()) {
                                // No matches
@@ -170,7 +178,7 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key)
                                        vector<string> vtmp;
                                        lyx::copy_if(comp.begin(),
                                                     comp.end(),
-                                                    std::back_inserter(vtmp),
+                                                    back_inserter(vtmp),
                                                     prefix(test));
                                        if (vtmp.size() != comp.size()) {
                                                test.erase(test.length() - 1);
@@ -210,7 +218,7 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, int key)
                        // of argumetns LFUN's should have first. (Lgb)
                        // First check for match
                        vector<string>::const_iterator cit =
-                               std::find(completion_.begin(),
+                               find(completion_.begin(),
                                          completion_.end(),
                                          input);
                        if (cit == completion_.end()) {
@@ -312,7 +320,7 @@ FL_OBJECT * MiniBuffer::add(int type, FL_Coord x, FL_Coord y,
 
 void MiniBuffer::message(string const & str) 
 {
-       timer.restart();
+       timer->restart();
        string const ntext = strip(str);
        if (!the_buffer->focus) {
                set_input(ntext);
@@ -363,7 +371,7 @@ void MiniBuffer::init()
                return;
 
        timeout.emit();
-       timer.stop();
+       timer->stop();
 }