]> git.lyx.org Git - lyx.git/blobdiff - src/minibuffer.h
More fixes to insettabular/text (and some missing features added).
[lyx.git] / src / minibuffer.h
index 27b802c5b0b45a5fbe283cc386b68f9fe0d155b0..9bdf1c4600ed9ba324402b395323375de47046a8 100644 (file)
@@ -1,10 +1,11 @@
 // -*- C++ -*-
-#ifndef _MINIBUFFER_H
-#define _MINIBUFFER_H
+#ifndef MINIBUFFER_H
+#define MINIBUFFER_H
 
 #include FORMS_H_LOCATION
 #include "LString.h"
 #include "gettext.h"
+#include "Timeout.h"
 
 #ifdef __GNUG__
 #pragma interface
 
 class LyXView;
 
+#ifdef SIGC_CXX_NAMESPACES
+using SigC::Object;
+#endif
+
 ///
-class MiniBuffer {
+class MiniBuffer : public Object{
 public:
        ///
-       MiniBuffer(LyXView *o, FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w)
-               : owner(o)
-       {
-               text = _("Welcome to LyX!");
-               shows_no_match = true;
-               history_idx = history_cnt = 0;
-               add(FL_NORMAL_INPUT, x, y, h, w);
-       }
+       MiniBuffer(LyXView * o,
+                  FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w);
+
        ///
        bool shows_no_match;
+
        ///
-       void setTimer(int a) {
-               fl_set_timer(timer, a);
+       void setTimer(unsigned int a) {
+               timer.setTimeout(a * 1000);
        }
+
        ///
-       void Set(string const& = string(),
-                string const& = string(),
-                string const& = string(),
-                int delay_secs=6);
+       void Set(string const & = string(),
+                string const & = string(),
+                string const & = string(),
+                unsigned int delay_secs = 6);
        /// 
-       string GetText() const { return text; }
+       string const GetText() const { return text; }
        ///
        void Init();
        ///
-       void ExecCommand();
+       void PrepareForCommand();
        /** allows to store and reset the contents one time. Usefull
          for status messages like "load font" (Matthias)
          */
@@ -51,43 +53,47 @@ public:
        void Activate();
        ///
        void Deactivate();
+       ///
+       static void ExecutingCB(FL_OBJECT * ob, long);
+       ///
+        static int  peek_event(FL_OBJECT *, int, FL_Coord, FL_Coord,
+                              int, void *);
 private:
        ///
-       LyXView *owner;
+       LyXView * owner;
        ///
        string text;
        ///
        string text_stored;
        ///
-       FL_OBJECT *add(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord);
-       ///
-       static void ExecutingCB(FL_OBJECT *ob, long);
+       FL_OBJECT * add(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord);
        ///
-       static void TimerCB(FL_OBJECT *ob, long);
-       ///
-        static int  peek_event(FL_OBJECT *, int, FL_Coord, FL_Coord,
-                              int, void *);
-        ///
-       FL_OBJECT *timer;
+       Timeout timer;
        ///
-       FL_OBJECT *the_buffer;
+       FL_OBJECT * the_buffer;
        ///
        string cur_cmd;
         ///
         enum{ MAX_HISTORY = 10 };
         ///
-        string history[MAX_HISTORY];
+        mutable string history[MAX_HISTORY];
         ///
-        int history_idx, history_cnt;
+        mutable int history_idx;
+       ///
+       mutable int history_cnt;
         ///
-        void addHistory(string const &cmd) { 
-               if (history_cnt==0 || (history_cnt>0 && cmd!=history[(history_cnt-1) % MAX_HISTORY])) {
+        void addHistory(string const & cmd) const { 
+               if (history_cnt == 0
+                   || (history_cnt > 0
+                       && cmd != history[(history_cnt - 1) % MAX_HISTORY])) {
                    history[history_cnt % MAX_HISTORY] = cmd;
-                   history_cnt++;
+                   ++history_cnt;
                }
                history_idx = history_cnt;
        }
         ///
-        string getHistory() { return history[history_idx % MAX_HISTORY]; }
+        string const getHistory() const {
+               return history[history_idx % MAX_HISTORY];
+       }
 };
 #endif