]> git.lyx.org Git - lyx.git/blobdiff - src/minibuffer.C
citation patch from Angus
[lyx.git] / src / minibuffer.C
index aed4479c52f80de1d5b4f305184a993e5680830f..1b417b813063b53fe4f53be5885c62395360e58a 100644 (file)
@@ -5,7 +5,7 @@
  *                 information.
  * 
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-1999 The LyX Team.  
+ *           Copyright 1995-2000 The LyX Team.  
  * 
  * ###########################################################################
  */
 #include "debug.h"
 #include "gettext.h"
 #include "LyXAction.h"
+#include "BufferView.h"
+#include "buffer.h"
+
+using std::endl;
 
 extern bool keyseqUncomplete();
 extern string keyseqOptions(int l= 190);
 extern string keyseqStr(int l= 190);
 extern LyXAction lyxaction;
 
+MiniBuffer::MiniBuffer(LyXView * o, FL_Coord x, FL_Coord y,
+                      FL_Coord h, FL_Coord w)
+       : owner(o)
+{
+       text = _("Welcome to LyX!");
+       shows_no_match = true;
+       history_idx = history_cnt = 0;
+       add(FL_NORMAL_INPUT, x, y, h, w);
+}
+
 void MiniBuffer::TimerCB(FL_OBJECT * ob, long)
 {
        MiniBuffer * obj = static_cast<MiniBuffer*>(ob->u_vdata);
@@ -46,8 +60,8 @@ void MiniBuffer::ExecutingCB(FL_OBJECT * ob, long)
 {
        MiniBuffer * obj = static_cast<MiniBuffer*>(ob->u_vdata);
        lyxerr.debug() << "Getting ready to execute: " << obj->cur_cmd << endl;
-       fl_set_focus_object(obj->owner->getForm(),
-                           obj->owner->view()->getWorkArea());
+       obj->owner->view()->focus(true);
+
        if (obj->cur_cmd.empty()) { 
                obj->Init();
                return ; 
@@ -100,8 +114,7 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, FL_Coord, FL_Coord,
                case 27:
                case XK_Escape:
                        // Abort
-                       fl_set_focus_object(mini->owner->getForm(),
-                                           mini->owner->view()->getWorkArea());
+                       mini->owner->view()->focus(true);
                        mini->Init();
                        return 1; 
                case 13:
@@ -127,7 +140,7 @@ extern "C" int C_MiniBuffer_peek_event(FL_OBJECT * ob, int event,
 
 void MiniBuffer::ExecCommand()
 {
-       text.clear();
+       text.erase();
        fl_set_input(the_buffer, "");
        fl_set_focus_object(owner->getForm(), the_buffer);
 }
@@ -199,7 +212,7 @@ void MiniBuffer::Init()
        else if (owner->view()->available()) {
                        string nicename = 
                                MakeDisplayPath(owner->buffer()->
-                                               getFileName());
+                                               fileName());
                        // Should we do this instead? (kindo like emacs)
                        // leaves more room for other information
                        text = "LyX: ";
@@ -240,7 +253,7 @@ void MiniBuffer::Reset()
 {
        if (!text_stored.empty()){
                Set(text_stored);
-               text_stored.clear();
+               text_stored.erase();
        }
 }