+extern "C" void C_MiniBuffer_ExecutingCB(FL_OBJECT *ob, long data)
+{
+ MiniBuffer::TimerCB(ob, data);
+}
+
+// This is not as dirty as it seems, the hidden buttons removed by this
+// function were just kludges for an uncomplete keyboard callback (ale)
+int MiniBuffer::peek_event(FL_OBJECT *ob, int event, FL_Coord, FL_Coord,
+ int key, void */*xev*/)
+{
+ MiniBuffer *mini = (MiniBuffer*)ob->u_vdata;
+
+ if (event==FL_KEYBOARD){
+ switch (key) {
+ case XK_Down:
+ mini->history_idx++;
+ if (!mini->getHistory().empty()) {
+ fl_set_input(ob, mini->getHistory().c_str());
+ } else
+ mini->history_idx--;
+ return 1;
+ case XK_Up:
+ if (mini->history_idx > 0) mini->history_idx--;
+ fl_set_input(ob, mini->getHistory().c_str());
+ return 1;
+ case 9:
+ case XK_Tab:
+ {
+ // complete or increment the command
+ const char *s = lyxaction.getApproxFuncName(fl_get_input(ob));
+ if (s && s[0])
+ fl_set_input(ob, s);
+ return 1;
+ }
+ case 27:
+ case XK_Escape:
+ // Abort
+ fl_set_focus_object(mini->owner->getForm(),
+ mini->owner->currentView()->getWorkArea());
+ mini->Init();
+ return 1;
+ case 13:
+ case XK_Return:
+ // Execute a command.
+ mini->cur_cmd = string(fl_get_input(ob));
+ ExecutingCB(ob, 0);
+ return 1;
+ default:
+ return 0;
+ }
+ }
+ return 0;
+}
+
+extern "C" int C_MiniBuffer_peek_event(FL_OBJECT *ob, int event,
+ FL_Coord, FL_Coord,
+ int key, void *xev)
+{
+ return MiniBuffer::peek_event(ob,event,0,0,key,xev);
+}
+