X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fminibuffer.h;h=394f9429cf6dd78b5f7b6f59eaca4f62561a137f;hb=98c966c64594611e469313314abd1e59524adb4a;hp=9bdf1c4600ed9ba324402b395323375de47046a8;hpb=45933fac0c917f91423a805c2d18e045823762d4;p=lyx.git diff --git a/src/minibuffer.h b/src/minibuffer.h index 9bdf1c4600..394f9429cf 100644 --- a/src/minibuffer.h +++ b/src/minibuffer.h @@ -2,65 +2,92 @@ #ifndef MINIBUFFER_H #define MINIBUFFER_H +#include +#include + #include FORMS_H_LOCATION #include "LString.h" -#include "gettext.h" -#include "Timeout.h" #ifdef __GNUG__ #pragma interface #endif class LyXView; - -#ifdef SIGC_CXX_NAMESPACES -using SigC::Object; -#endif +class DropDown; +class Timeout; /// -class MiniBuffer : public Object{ +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); - /// - bool shows_no_match; + /// destructor + ~MiniBuffer(); + + /// create drop down + void dd_init(); /// - void setTimer(unsigned int a) { - timer.setTimeout(a * 1000); - } + void addSet(string const &, + string const & = string()); /// - void Set(string const & = string(), - string const & = string(), - string const & = string(), - unsigned int delay_secs = 6); - /// - string const GetText() const { return text; } + void message(string const & str); /// - void Init(); + void messagePush(string const & str); /// - void PrepareForCommand(); - /** allows to store and reset the contents one time. Usefull - for status messages like "load font" (Matthias) - */ - void Store(); + 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 Reset(); + void redraw(); /// - void Activate(); + int peek_event(FL_OBJECT *, int, int); /// - void Deactivate(); + SigC::Signal1 stringReady; /// - static void ExecutingCB(FL_OBJECT * ob, long); + //SigC::Signal0 escape; /// - static int peek_event(FL_OBJECT *, int, FL_Coord, FL_Coord, - int, void *); + SigC::Signal0 timeout; private: /// - LyXView * owner; + void activate(); + /// + void deactivate(); + /// + void prepare(); + /// + void stored_slot(); + /// + 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; /// @@ -68,32 +95,20 @@ private: /// FL_OBJECT * add(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord); /// - Timeout timer; + Timeout * timer; + /// + Timeout * stored_timer; + /// the dropdown menu + DropDown * dropdown_; /// FL_OBJECT * the_buffer; /// - string cur_cmd; - /// - enum{ MAX_HISTORY = 10 }; - /// - mutable string history[MAX_HISTORY]; - /// - mutable int history_idx; - /// - mutable int history_cnt; - /// - 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_idx = history_cnt; - } - /// - string const getHistory() const { - return history[history_idx % MAX_HISTORY]; - } + std::vector completion_; + /// + std::vector * history_; + /// + std::vector::iterator hist_iter; + /// + State state_; }; #endif