#pragma implementation
#endif
+// FIXME: temporary
+#include "frontends/xforms/DropDown.h"
+
#include "minibuffer.h"
#include "support/lyxalgo.h"
deactivate();
}
+
+// thanks for nothing, xforms (recursive creation not allowed)
+void MiniBuffer::dd_init()
+{
+ dropdown_ = new DropDown(owner_, the_buffer);
+ dropdown_->result.connect(slot(this, &MiniBuffer::set_complete_input));
+}
+
+
+MiniBuffer::~MiniBuffer()
+{
+ delete dropdown_;
+}
+
void MiniBuffer::stored_slot()
{
if (stored_) {
// Perfect match
string const tmp =
comp[0] + _(" [sole completion]");
- stored_set(comp[0]);
+ stored_set(comp[0] + " ");
set_input(tmp);
} else {
// More that one match
// Find maximal avaliable prefix
string const tmp = comp[0];
string test(input);
- test += tmp[test.length()];
+ if (tmp.length() > test.length())
+ test += tmp[test.length()];
while (test.length() < tmp.length()) {
vector<string> vtmp;
lyx::copy_if(comp.begin(),
}
set_input(test);
- // How should the possible matches
- // be visualized?
- std::copy(comp.begin(), comp.end(),
- std::ostream_iterator<string>(std::cerr, "\n"));
+ int x,y,w,h;
+ fl_get_wingeometry(fl_get_real_object_window(the_buffer),
+ &x, &y, &w, &h);
+
+ // asynchronous completion
+ dropdown_->select(comp, x, y + h, w);
}
return 1;
}
}
-extern "C"
-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);
+extern "C" {
+
+ static
+ 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);
+ }
+
}
}
+void MiniBuffer::set_complete_input(string const & str)
+{
+ if (!str.empty())
+ set_input(str);
+}
+
+
void MiniBuffer::set_input(string const & str)
{
fl_set_input(the_buffer, str.c_str());