]> git.lyx.org Git - lyx.git/blobdiff - src/minibuffer.C
Added html export for LinuxDoc and DocBook. LinuxDoc import now available in file...
[lyx.git] / src / minibuffer.C
index 52f41e70d0483ad4264cfb53b65d33955c02462a..f365325f3141da1a1ae92256223e435858313b42 100644 (file)
@@ -5,7 +5,7 @@
  *                 information.
  * 
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-1999 The LyX Team.  
+ *           Copyright 1995-2000 The LyX Team.  
  * 
  * ###########################################################################
  */
 #include "LyXView.h"
 #include "debug.h"
 #include "gettext.h"
+#include "LyXAction.h"
 
 extern bool keyseqUncomplete();
-extern string keyseqOptions(int l=190);
-extern string keyseqStr(int l=190);
+extern string keyseqOptions(int l= 190);
+extern string keyseqStr(int l= 190);
 extern LyXAction lyxaction;
 
 void MiniBuffer::TimerCB(FL_OBJECT * ob, long)
@@ -45,8 +46,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->currentView()->getWorkArea());
+       obj->owner->view()->focus(true);
+
        if (obj->cur_cmd.empty()) { 
                obj->Init();
                return ; 
@@ -54,22 +55,8 @@ void MiniBuffer::ExecutingCB(FL_OBJECT * ob, long)
        obj->Set(_("Executing:"), obj->cur_cmd);
        obj->addHistory(obj->cur_cmd);
        
-       // Split command into function and argument
-       string arg = obj->cur_cmd;
-       string function;
-       if (contains(arg, " ")) {
-               arg = split(arg, function, ' ');
-               function = strip(function);
-       } else {
-               function = arg;
-               arg.clear();
-       }
-       lyxerr.debug() << "Function: " << function
-                      << "\nArg     : " << arg << endl;
-
        // Dispatch only returns requested data for a few commands (ale)
-       string res = obj->owner->getLyXFunc()->Dispatch(function.c_str(),
-                                                      arg.c_str());
+       string res = obj->owner->getLyXFunc()->Dispatch(obj->cur_cmd);
        lyxerr.debug() << "Minibuffer Res: " << res << endl;
        obj->shows_no_match = false;
 
@@ -105,16 +92,15 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, FL_Coord, FL_Coord,
                case XK_Tab:
                {
                        // complete or increment the command
-                       char const * s = lyxaction.getApproxFuncName(fl_get_input(ob));
-                       if (s && s[0])
-                               fl_set_input(ob, s);
+                       string  s = lyxaction.getApproxFuncName(fl_get_input(ob));
+                       if (!s.empty())
+                               fl_set_input(ob, s.c_str());
                        return 1; 
                }
                case 27:
                case XK_Escape:
                        // Abort
-                       fl_set_focus_object(mini->owner->getForm(),
-                                           mini->owner->currentView()->getWorkArea());
+                       mini->owner->view()->focus(true);
                        mini->Init();
                        return 1; 
                case 13:
@@ -134,7 +120,7 @@ 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);
+       return MiniBuffer::peek_event(ob, event, 0, 0, key, xev);
 }
 
 
@@ -142,7 +128,7 @@ void MiniBuffer::ExecCommand()
 {
        text.clear();
        fl_set_input(the_buffer, "");
-       fl_set_focus_object(owner->getForm(),the_buffer);
+       fl_set_focus_object(owner->getForm(), the_buffer);
 }
 
 
@@ -151,13 +137,13 @@ FL_OBJECT * MiniBuffer::add(int type, FL_Coord x, FL_Coord y,
 {
        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);
+       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_callback(obj,C_MiniBuffer_ExecutingCB, 0);
+        fl_set_object_color(obj, FL_MCOL, FL_MCOL);
+        fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+       fl_set_object_callback(obj, C_MiniBuffer_ExecutingCB, 0);
 
        // To intercept Up, Down, Table for history
         fl_set_object_prehandler(obj, C_MiniBuffer_peek_event);
@@ -165,7 +151,7 @@ FL_OBJECT * MiniBuffer::add(int type, FL_Coord x, FL_Coord y,
         obj->wantkey = FL_KEY_TAB;
        
        // timer
-       timer = fl_add_timer(FL_HIDDEN_TIMER, 0,0,0,0, "Timer");
+       timer = fl_add_timer(FL_HIDDEN_TIMER, 0, 0, 0, 0, "Timer");
        fl_set_object_callback(timer, C_MiniBuffer_TimerCB, 0);
        timer->u_vdata = this;
        fl_set_input(the_buffer, text.c_str());
@@ -209,10 +195,10 @@ void MiniBuffer::Init()
                text = owner->getLyXFunc()->keyseqOptions();
    
        // Else, show the buffer state.
-       else if (owner->currentView()->available()) {
-                       string nicename =
+       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: ";