1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
1999-11-15 12:01:38 +00:00
|
|
|
#ifndef MINIBUFFER_H
|
|
|
|
#define MINIBUFFER_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#include FORMS_H_LOCATION
|
|
|
|
#include "LString.h"
|
|
|
|
#include "gettext.h"
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class LyXView;
|
|
|
|
|
|
|
|
///
|
|
|
|
class MiniBuffer {
|
|
|
|
public:
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
MiniBuffer(LyXView * o,
|
|
|
|
FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w);
|
2000-04-04 00:19:15 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
bool shows_no_match;
|
|
|
|
///
|
|
|
|
void setTimer(int a) {
|
|
|
|
fl_set_timer(timer, a);
|
|
|
|
}
|
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
void Set(string const & = string(),
|
|
|
|
string const & = string(),
|
|
|
|
string const & = string(),
|
1999-11-15 12:01:38 +00:00
|
|
|
int delay_secs= 6);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-09-14 17:53:12 +00:00
|
|
|
string const GetText() const { return text; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void Init();
|
|
|
|
///
|
|
|
|
void ExecCommand();
|
|
|
|
/** allows to store and reset the contents one time. Usefull
|
|
|
|
for status messages like "load font" (Matthias)
|
|
|
|
*/
|
|
|
|
void Store();
|
|
|
|
///
|
|
|
|
void Reset();
|
|
|
|
///
|
|
|
|
void Activate();
|
|
|
|
///
|
|
|
|
void Deactivate();
|
1999-10-25 14:18:30 +00:00
|
|
|
///
|
|
|
|
static void ExecutingCB(FL_OBJECT *ob, long);
|
|
|
|
///
|
|
|
|
static void TimerCB(FL_OBJECT *ob, long);
|
|
|
|
///
|
|
|
|
static int peek_event(FL_OBJECT *, int, FL_Coord, FL_Coord,
|
|
|
|
int, void *);
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
|
|
|
///
|
2000-08-07 20:58:24 +00:00
|
|
|
LyXView * owner;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string text;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string text_stored;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-08-07 20:58:24 +00:00
|
|
|
FL_OBJECT * add(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-08-07 20:58:24 +00:00
|
|
|
FL_OBJECT * timer;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-08-07 20:58:24 +00:00
|
|
|
FL_OBJECT * the_buffer;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string cur_cmd;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
enum{ MAX_HISTORY = 10 };
|
|
|
|
///
|
2000-09-14 17:53:12 +00:00
|
|
|
mutable string history[MAX_HISTORY];
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-09-14 17:53:12 +00:00
|
|
|
mutable int history_idx;
|
|
|
|
///
|
|
|
|
mutable int history_cnt;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-09-19 11:18:35 +00:00
|
|
|
void addHistory(string const & cmd) const {
|
2000-08-07 20:58:24 +00:00
|
|
|
if (history_cnt == 0
|
|
|
|
|| (history_cnt > 0
|
|
|
|
&& cmd != history[(history_cnt - 1) % MAX_HISTORY])) {
|
1999-09-27 18:44:28 +00:00
|
|
|
history[history_cnt % MAX_HISTORY] = cmd;
|
2000-01-24 18:34:46 +00:00
|
|
|
++history_cnt;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
history_idx = history_cnt;
|
|
|
|
}
|
|
|
|
///
|
2000-09-14 17:53:12 +00:00
|
|
|
string const getHistory() const { return history[history_idx % MAX_HISTORY]; }
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
#endif
|