X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fminibuffer.h;h=394f9429cf6dd78b5f7b6f59eaca4f62561a137f;hb=98c966c64594611e469313314abd1e59524adb4a;hp=91a7dd97ebfff5c672ec7c286e8038171f4ffd8d;hpb=1d7d3cc4afa2205c801ccc2aa71c7ac59359dc5f;p=lyx.git diff --git a/src/minibuffer.h b/src/minibuffer.h index 91a7dd97eb..394f9429cf 100644 --- a/src/minibuffer.h +++ b/src/minibuffer.h @@ -2,92 +2,113 @@ #ifndef MINIBUFFER_H #define MINIBUFFER_H +#include +#include + #include FORMS_H_LOCATION #include "LString.h" -#include "gettext.h" #ifdef __GNUG__ #pragma interface #endif class LyXView; +class DropDown; +class Timeout; /// -class MiniBuffer { +class MiniBuffer : public SigC::Object { public: + enum State { + spaces, + nospaces + }; + /// - 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); + + /// destructor + ~MiniBuffer(); + + /// create drop down + void dd_init(); + /// - bool shows_no_match; + void addSet(string const &, + string const & = string()); + /// - void setTimer(int a) { - fl_set_timer(timer, a); - } + void message(string const & str); /// - void Set(string const & = string(), - string const & = string(), - string const & = string(), - int delay_secs= 6); - /// - string GetText() const { return text; } + void messagePush(string const & str); /// - void Init(); + void messagePop(); + + /** Makes the minibuffer wait for a string to be inserted. + Waits for a string to be inserted into the minibuffer, when + the string has been inserted the signal stringReady is + emitted. + */ + void getString(State space, + std::vector const & completion, + std::vector & history); /// - void ExecCommand(); - /** allows to store and reset the contents one time. Usefull - for status messages like "load font" (Matthias) - */ - void Store(); + void redraw(); /// - void Reset(); + int peek_event(FL_OBJECT *, int, int); /// - void Activate(); + SigC::Signal1 stringReady; /// - void Deactivate(); + //SigC::Signal0 escape; /// - static void ExecutingCB(FL_OBJECT *ob, long); + SigC::Signal0 timeout; +private: /// - static void TimerCB(FL_OBJECT *ob, long); + void activate(); /// - static int peek_event(FL_OBJECT *, int, FL_Coord, FL_Coord, - int, void *); -private: + void deactivate(); + /// + void prepare(); + /// + void stored_slot(); /// - LyXView *owner; + void stored_set(string const &); + /// set the minibuffer content if str non-empty + void set_complete_input(string const &); + /// append c to the current contents + void append_char(char c); + /// set the minibuffer content + void set_input(string const &); + /// + void init(); + /// + string stored_input; + /// + bool stored_; + /// + LyXView * owner_; /// string text; /// string text_stored; /// - FL_OBJECT *add(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord); - /// - FL_OBJECT *timer; - /// - FL_OBJECT *the_buffer; - /// - string cur_cmd; - /// - enum{ MAX_HISTORY = 10 }; - /// - string history[MAX_HISTORY]; - /// - int history_idx, history_cnt; - /// - void addHistory(string const &cmd) { - if (history_cnt == 0 || (history_cnt>0 && cmd!= history[(history_cnt-1) % MAX_HISTORY])) { - history[history_cnt % MAX_HISTORY] = cmd; - history_cnt++; - } - history_idx = history_cnt; - } - /// - string getHistory() { return history[history_idx % MAX_HISTORY]; } + FL_OBJECT * add(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord); + /// + Timeout * timer; + /// + Timeout * stored_timer; + /// the dropdown menu + DropDown * dropdown_; + /// + FL_OBJECT * the_buffer; + /// + std::vector completion_; + /// + std::vector * history_; + /// + std::vector::iterator hist_iter; + /// + State state_; }; #endif