* The MiniBuffer Class
* read minibuffer.h for more
* information.
- *
+ *
* Copyright 1995 Matthias Ettrich
- * Copyright 1995-2001 The LyX Team.
- *
+ * Copyright 1995-2001 The LyX Team.
+ *
* ###########################################################################
*/
#pragma implementation
#endif
-// FIXME: temporary
+// FIXME: temporary
#include "frontends/xforms/DropDown.h"
-
+#include "frontends/xforms/XFormsView.h"
+
#include "minibuffer.h"
#include "support/lyxalgo.h"
#include "support/filetools.h"
#include "support/lstrings.h"
-#include "LyXView.h"
-#include "XFormsView.h"
+#include "frontends/LyXView.h"
#include "gettext.h"
#include "LyXAction.h"
#include "BufferView.h"
struct prefix {
string p;
- prefix(string const & s)
+ prefix(string const & s)
: p(s) {}
bool operator()(string const & s) const {
return prefixIs(s, p);
{
add(FL_NORMAL_INPUT, x, y, h, w);
- timer = new Timeout(600);
+ timer = new Timeout(6000);
timer->timeout.connect(slot(this, &MiniBuffer::init));
stored_timer = new Timeout(1500);
deactivate();
}
-
-// thanks for nothing, xforms (recursive creation not allowed)
+
+// thanks for nothing, xforms (recursive creation not allowed)
void MiniBuffer::dd_init()
{
dropdown_ = new DropDown(owner_, the_buffer);
delete dropdown_;
}
-
-void MiniBuffer::stored_slot()
+
+void MiniBuffer::stored_slot()
{
if (stored_) {
stored_ = false;
}
-void MiniBuffer::stored_set(string const & str)
+void MiniBuffer::stored_set(string const & str)
{
stored_input = str;
stored_ = true;
set_input(input);
stored_ = false;
}
-
+
switch (key) {
case XK_Down:
if (hist_iter != history_->end()) {
} else {
set_input((*hist_iter));
}
- return 1;
+ return 1;
case XK_Up:
if (hist_iter == history_->begin()) {
// no further history
--hist_iter;
set_input((*hist_iter));
}
- return 1;
+ return 1;
case 9:
case XK_Tab:
{
// Completion handling.
-
+
vector<string> comp;
lyx::copy_if(completion_.begin(),
completion_.end(),
test += tmp[test.length()];
}
set_input(test);
-
+
int x,y,w,h;
fl_get_wingeometry(fl_get_real_object_window(the_buffer),
&x, &y, &w, &h);
-
+
// asynchronous completion
int const air = the_buffer->x;
x += air;
w = the_buffer->w;
dropdown_->select(comp, x, y, w);
}
- return 1;
+ return 1;
}
case 27:
case XK_Escape:
init();
deactivate();
//escape.emit();
- return 1;
+ return 1;
case 13:
case XK_Return:
{
return 1;
}
}
-
+
}
-
+
default:
return 0;
}
//lyxerr << "Unhandled minibuffer event!" << endl;
break;
}
-
+
return 0;
}
extern "C" {
-
+
static
- int C_MiniBuffer_peek_event(FL_OBJECT * ob, int event,
+ int C_MiniBuffer_peek_event(FL_OBJECT * ob, int event,
FL_Coord, FL_Coord,
int key, void * /*xev*/)
{
MiniBuffer * mini = static_cast<MiniBuffer*>(ob->u_vdata);
return mini->peek_event(ob, event, key);
}
-
+
}
FL_Coord w, FL_Coord h)
{
FL_OBJECT * obj;
-
+
the_buffer = obj = fl_add_input(type, x, y, w, h, text.c_str());
- fl_set_object_boxtype(obj, FL_DOWN_BOX);
- fl_set_object_resize(obj, FL_RESIZE_ALL);
- fl_set_object_gravity(obj, SouthWestGravity, SouthEastGravity);
- fl_set_object_color(obj, FL_MCOL, FL_MCOL);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-
+ fl_set_object_boxtype(obj, FL_DOWN_BOX);
+ fl_set_object_resize(obj, FL_RESIZE_ALL);
+ fl_set_object_gravity(obj, SouthWestGravity, SouthEastGravity);
+ fl_set_object_color(obj, FL_MCOL, FL_MCOL);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+
// To intercept Up, Down, Table for history
- fl_set_object_prehandler(obj, C_MiniBuffer_peek_event);
- obj->u_vdata = this;
- obj->wantkey = FL_KEY_TAB;
+ fl_set_object_prehandler(obj, C_MiniBuffer_peek_event);
+ obj->u_vdata = this;
+ obj->wantkey = FL_KEY_TAB;
set_input(text);
-
+
return obj;
}
-void MiniBuffer::message(string const & str)
+void MiniBuffer::message(string const & str)
{
timer->restart();
string const ntext = strip(str);
}
-void MiniBuffer::messagePush(string const & str)
+void MiniBuffer::messagePush(string const & str)
{
text_stored = text;
message(str);
}
-void MiniBuffer::redraw()
+void MiniBuffer::redraw()
{
fl_redraw_object(the_buffer);
XFlush(fl_display);
}
}
-
+
void MiniBuffer::append_char(char c)
{
if (!c || !isprint(c))
fl_set_input(the_buffer, str.c_str());
}
-
+
void MiniBuffer::set_input(string const & str)
{
fl_set_input(the_buffer, str.c_str());