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"
|
2001-02-07 16:44:49 +00:00
|
|
|
#include "frontends/Timeout.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class LyXView;
|
|
|
|
|
2000-10-26 00:07:20 +00:00
|
|
|
#ifdef SIGC_CXX_NAMESPACES
|
|
|
|
using SigC::Object;
|
|
|
|
#endif
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-10-26 00:07:20 +00:00
|
|
|
class MiniBuffer : public Object{
|
1999-09-27 18:44:28 +00:00
|
|
|
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;
|
2000-10-26 00:07:20 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-10-26 00:07:20 +00:00
|
|
|
void setTimer(unsigned int a) {
|
|
|
|
timer.setTimeout(a * 1000);
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
2000-10-26 00:07:20 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
void Set(string const & = string(),
|
|
|
|
string const & = string(),
|
|
|
|
string const & = string(),
|
2000-10-26 00:07:20 +00:00
|
|
|
unsigned 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();
|
|
|
|
///
|
2000-10-13 12:20:38 +00:00
|
|
|
void PrepareForCommand();
|
1999-09-27 18:44:28 +00:00
|
|
|
/** 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
|
|
|
///
|
2000-10-26 00:07:20 +00:00
|
|
|
static void ExecutingCB(FL_OBJECT * ob, long);
|
1999-10-25 14:18:30 +00:00
|
|
|
///
|
|
|
|
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);
|
2000-10-26 00:07:20 +00:00
|
|
|
///
|
|
|
|
Timeout 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-10-26 00:07:20 +00:00
|
|
|
string const getHistory() const {
|
|
|
|
return history[history_idx % MAX_HISTORY];
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
#endif
|