This commit was manufactured by cvs2svn to create tag
[lyx.git] / src / minibuffer.h
blob7c214d6f28f8b4cee5c35c68790d3d2e2ecead63
1 // -*- C++ -*-
2 #ifndef _MINIBUFFER_H
3 #define _MINIBUFFER_H
5 #include FORMS_H_LOCATION
6 #include "LString.h"
7 #include "gettext.h"
9 #ifdef __GNUG__
10 #pragma interface
11 #endif
13 class LyXView;
15 ///
16 class MiniBuffer {
17 public:
18 ///
19 MiniBuffer(LyXView *o, FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w)
20 : owner(o)
22 text = _("Welcome to LyX!");
23 shows_no_match = true;
24 history_idx = history_cnt = 0;
25 add(FL_NORMAL_INPUT, x, y, h, w);
27 ///
28 bool shows_no_match;
29 ///
30 void setTimer(int a) {
31 fl_set_timer(timer, a);
33 ///
34 void Set(string const& = string(),
35 string const& = string(),
36 string const& = string(),
37 int delay_secs=6);
38 ///
39 string GetText() const { return text; }
40 ///
41 void Init();
42 ///
43 void ExecCommand();
44 /** allows to store and reset the contents one time. Usefull
45 for status messages like "load font" (Matthias)
47 void Store();
48 ///
49 void Reset();
50 ///
51 void Activate();
52 ///
53 void Deactivate();
54 ///
55 static void ExecutingCB(FL_OBJECT *ob, long);
56 ///
57 static void TimerCB(FL_OBJECT *ob, long);
58 ///
59 static int peek_event(FL_OBJECT *, int, FL_Coord, FL_Coord,
60 int, void *);
61 private:
62 ///
63 LyXView *owner;
64 ///
65 string text;
66 ///
67 string text_stored;
68 ///
69 FL_OBJECT *add(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord);
70 ///
71 FL_OBJECT *timer;
72 ///
73 FL_OBJECT *the_buffer;
74 ///
75 string cur_cmd;
76 ///
77 enum{ MAX_HISTORY = 10 };
78 ///
79 string history[MAX_HISTORY];
80 ///
81 int history_idx, history_cnt;
82 ///
83 void addHistory(string const &cmd) {
84 if (history_cnt==0 || (history_cnt>0 && cmd!=history[(history_cnt-1) % MAX_HISTORY])) {
85 history[history_cnt % MAX_HISTORY] = cmd;
86 history_cnt++;
88 history_idx = history_cnt;
90 ///
91 string getHistory() { return history[history_idx % MAX_HISTORY]; }
93 #endif