]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
Fix small bug in reading \set_color in lyxrc
[lyx.git] / src / lyxfunc.C
index ed4429f003e68247846adc83a97fabe14dfd3f54..01f949df91e99fe43fac748ea13a041cc94fbd63 100644 (file)
@@ -28,6 +28,7 @@ using std::istringstream;
 #pragma implementation
 #endif
 
+#include "version.h"
 #include "lyxlookup.h"
 #include "kbmap.h"
 #include "lyxfunc.h"
@@ -64,7 +65,6 @@ using std::istringstream;
 #include "insets/insettheorem.h"
 #include "insets/insetcaption.h"
 #include "mathed/formulamacro.h"
-#include "toolbar.h"
 #include "spellchecker.h" // RVDK_PATCH_5
 #include "minibuffer.h"
 #include "vspace.h"
@@ -86,9 +86,14 @@ using std::istringstream;
 #include "layout.h"
 #include "WorkArea.h"
 #include "lyxfr1.h"
-#include "menus.h"
 #include "bufferview_funcs.h"
 #include "frontends/Dialogs.h"
+#include "frontends/Toolbar.h"
+#ifdef NEW_MENUBAR
+#include "frontends/Menubar.h"
+#else
+#include "menus.h"
+#endif
 #include "FloatList.h"
 
 using std::pair;
@@ -118,6 +123,7 @@ extern void MenuSendto();
 extern void QuitLyX();
 extern void MenuFax(Buffer *);
 extern void MenuExport(Buffer *, string const &);
+extern void show_symbols_form(LyXFunc *);
 
 extern LyXAction lyxaction;
 // (alkis)
@@ -179,7 +185,7 @@ void LyXFunc::moveCursorUpdate(bool selecting)
        
        /* ---> Everytime the cursor is moved, show the current font state. */
        // should this too me moved out of this func?
-       //owner->getMiniBuffer()->Set(CurrentState());
+       //owner->showState();
        owner->view()->setState();
 }
 
@@ -220,7 +226,7 @@ int LyXFunc::processKeyEvent(XEvent * ev)
                        owner->view()->unlockInset(tli);
                        owner->view()->text->CursorRight(owner->view());
                        moveCursorUpdate(false);
-                       owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+                       owner->showState();
                } else {
                        tli->UnlockInsetInInset(owner->view(),
                                                tli->GetLockingInset(),true);
@@ -343,6 +349,7 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
                                // no
                                setErrorMessage(N_("Document is read-only"));
                                flag |= LyXFunc::Disabled;
+                               return flag;
                        }
                } else {
                        // no
@@ -352,9 +359,6 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
                }
        }
 
-       if (flag & LyXFunc::Disabled)
-               return flag;
-
        // I would really like to avoid having this switch and rather try to
        // encode this in the function itself.
         static bool noLaTeX = lyxrc.latex_command == "none";
@@ -377,20 +381,31 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
                disable = noLaTeX || lyxrc.fax_command == "none";
                break;
        case LFUN_IMPORT:
-               if (argument == "latex")
+               if (argument == "latex" || argument == "noweb")
                        disable = lyxrc.relyx_command == "none";
-               if (argument == "linuxdoc")
+               else if (argument == "linuxdoc")
                        disable = lyxrc.linuxdoc_to_lyx_command == "none";
                break;
        case LFUN_EXPORT:
-               if (argument == "dvi" || argument == "postscript")
+               if (argument == "latex")
+                       disable = ! buf->isLatex();
+               else if (argument == "linuxdoc")
+                       disable = ! buf->isLinuxDoc();
+               else if (argument == "docbook")
+                       disable = ! buf->isDocBook();
+               else if (argument == "dvi" || argument == "postscript")
                        disable = noLaTeX;
-               if (argument == "html")
-                       disable = lyxrc.html_command == "none";
-               if (argument == "html-linuxdoc")
-                       disable = lyxrc.linuxdoc_to_html_command == "none";
-               if (argument == "html-docbook")
-                       disable = lyxrc.docbook_to_html_command == "none";
+               else if (argument == "html")
+                       disable = (! buf->isLatex() 
+                                  || lyxrc.html_command == "none");
+               else if (argument == "html-linuxdoc")
+                       disable = (! buf->isLinuxDoc() 
+                                  || lyxrc.linuxdoc_to_html_command == "none");
+               else if (argument == "html-docbook")
+                       disable = (! buf->isDocBook() 
+                                  || lyxrc.docbook_to_html_command == "none");
+               else if (argument == "custom")
+                       disable == ! buf->isLatex();
                break;
        case LFUN_UNDO:
                disable = buf->undostack.empty();
@@ -404,9 +419,28 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
        case LFUN_RUNCHKTEX:
                disable = lyxrc.chktex_command == "none";
                break;
+       case LFUN_BUILDPROG:
+               disable = (lyxrc.literate_command == "none" 
+                          || ! buf->isLiterate());
+#ifndef NEW_TABULAR
        case LFUN_LAYOUT_TABLE:
                disable = ! owner->view()->text->cursor.par()->table;
                break;
+#endif
+       case LFUN_VC_REGISTER:
+               disable = buf->lyxvc.inUse();
+               break;
+       case LFUN_VC_CHECKIN:
+               disable = !buf->lyxvc.inUse() || buf->isReadonly();
+               break;
+       case LFUN_VC_CHECKOUT:
+               disable = !buf->lyxvc.inUse() || !buf->isReadonly();
+               break;
+       case LFUN_VC_REVERT:
+       case LFUN_VC_UNDO:
+       case LFUN_VC_HISTORY:
+               disable = !buf->lyxvc.inUse();
+               break;
        default:
                break;
         }
@@ -593,29 +627,26 @@ string LyXFunc::Dispatch(int ac,
                                case LFUN_BREAKLINE:
                                        owner->view()->text->CursorRight(owner->view());
                                        owner->view()->setState();
-                                       owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+                                       owner->showState();
                                        break;
                                case LFUN_RIGHT:
                                        if (!owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
                                                owner->view()->text->CursorRight(owner->view());
                                                moveCursorUpdate(false);
-                                               owner->getMiniBuffer()->
-                                                       Set(CurrentState(owner->view()));
+                                               owner->showState();
                                        }
                                        return string();
                                case LFUN_LEFT: 
                                        if (owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
                                                owner->view()->text->CursorRight(owner->view());
                                                moveCursorUpdate(false);
-                                               owner->getMiniBuffer()->
-                                                       Set(CurrentState(owner->view()));
+                                               owner->showState();
                                        }
                                        return string();
                                case LFUN_DOWN:
                                        owner->view()->text->CursorDown(owner->view());
                                        moveCursorUpdate(false);
-                                       owner->getMiniBuffer()->
-                                               Set(CurrentState(owner->view()));
+                                       owner->showState();
                                        return string();
                                default:
                                        break;
@@ -882,7 +913,7 @@ string LyXFunc::Dispatch(int ac,
                Figure();
                break;
 
-       case LFUN_INSERT_GRAPHICS:
+       case LFUN_INSET_GRAPHICS:
        {
                Inset * new_inset = new InsetGraphics;
                if (!owner->view()->insertInset(new_inset))
@@ -999,13 +1030,13 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_FREE:
                Free(owner->view());
                owner->view()->setState();
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_TEX:
                Tex(owner->view());
                owner->view()->setState();
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
 #ifndef NEW_INSETS             
        case LFUN_MELT:
@@ -1047,6 +1078,42 @@ string LyXFunc::Dispatch(int ac,
                owner->getDialogs()->showCopyright();
                break;
 
+       case LFUN_HELP_CREDITS:
+               owner->getDialogs()->showCredits();
+               break;
+
+        case LFUN_HELP_OPEN: {
+               string arg = argument;
+               if (arg.empty()) {
+                       setErrorMessage(N_("Missing argument"));
+                       break;
+               }
+               ProhibitInput(owner->view());
+               string fname = i18nLibFileSearch("doc", arg, "lyx");
+               if (fname.empty()) {
+                       lyxerr << "LyX: unable to find documentation file `"
+                              << arg << "'. Bad installation?" << endl;
+                       AllowInput(owner->view());
+                       break;
+               }
+               owner->getMiniBuffer()->Set(_("Opening help file"),
+                                           MakeDisplayPath(fname),"...");
+               owner->view()->buffer(bufferlist.loadLyXFile(fname,false));
+               AllowInput(owner->view());
+               break;
+        }
+
+       case LFUN_HELP_VERSION: 
+               ProhibitInput(owner->view());
+               fl_show_message((string(_("LyX Version ")) + LYX_VERSION 
+                                + _(" of ") + LYX_RELEASE).c_str(),
+                               (_("Library directory: ")
+                                + MakeDisplayPath(system_lyxdir)).c_str(),
+                               (_("User directory: ") 
+                                + MakeDisplayPath(user_lyxdir)).c_str());
+               AllowInput(owner->view());
+               break;
+
                // --- version control -------------------------------
        case LFUN_VC_REGISTER:
        {
@@ -1091,6 +1158,11 @@ string LyXFunc::Dispatch(int ac,
        
        // --- buffers ----------------------------------------
 
+        case LFUN_SWITCHBUFFER:
+                owner->view()->buffer(bufferlist.getBuffer(argument));
+               break;
+
+
        case LFUN_FILE_INSERT:
        {
                MenuInsertLyXFile(argument);
@@ -1175,10 +1247,7 @@ string LyXFunc::Dispatch(int ac,
                        owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
                        owner->view()->text->
                                SetLayout(owner->view(), layout.second);
-                       owner->getToolbar()->combox->
-                               select(owner->view()->
-                                      text->cursor.par()->
-                                      GetLayout() + 1);
+                       owner->setLayout(layout.second);
                        owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
                        owner->view()->setState();
                }
@@ -1222,58 +1291,58 @@ string LyXFunc::Dispatch(int ac,
                break;
                
        case LFUN_DROP_LAYOUTS_CHOICE:
-               owner->getToolbar()->combox->Show();
+               owner->getToolbar()->openLayoutList();
                break;
 
        case LFUN_LANGUAGE:
                Lang(owner->view(), argument);
                owner->view()->setState();
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
 
        case LFUN_EMPH:
                Emph(owner->view());
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
 
        case LFUN_BOLD:
                Bold(owner->view());
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_NOUN:
                Noun(owner->view());
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_CODE:
                Code(owner->view());
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_SANS:
                Sans(owner->view());
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_ROMAN:
                Roman(owner->view());
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_DEFAULT:
                StyleReset(owner->view());
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_UNDERLINE:
                Underline(owner->view());
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_FONT_SIZE:
                FontSize(owner->view(), argument);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_FONT_STATE:
@@ -1349,7 +1418,11 @@ string LyXFunc::Dispatch(int ac,
        break;
                
        case LFUN_MENU_OPEN_BY_NAME:
+#ifdef NEW_MENUBAR
+               owner->getMenubar()->openByName(argument);
+#else
                owner->getMenus()->openByName(argument);
+#endif
                break; // RVDK_PATCH_5
                
        case LFUN_SPELLCHECK:
@@ -1381,7 +1454,7 @@ string LyXFunc::Dispatch(int ac,
                        tmptext->CursorRight(owner->view(), false);
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
        }
        break;
                
@@ -1417,7 +1490,7 @@ string LyXFunc::Dispatch(int ac,
 
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
        }
        break;
                
@@ -1427,7 +1500,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorUp(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_DOWN:
@@ -1437,7 +1510,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorDown(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
 
        case LFUN_UP_PARAGRAPH:
@@ -1447,7 +1520,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorUpParagraph(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_DOWN_PARAGRAPH:
@@ -1457,7 +1530,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorDownParagraph(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_PRIOR:
@@ -1467,7 +1540,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->cursorPrevious();
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_NEXT:
@@ -1477,7 +1550,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->cursorNext();
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_HOME:
@@ -1487,7 +1560,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorHome(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_END:
@@ -1497,7 +1570,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorEnd(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_SHIFT_TAB:
@@ -1508,7 +1581,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorTab(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_WORDRIGHT:
@@ -1521,7 +1594,7 @@ string LyXFunc::Dispatch(int ac,
                        owner->view()->text->CursorRightOneWord(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_WORDLEFT:
@@ -1534,7 +1607,7 @@ string LyXFunc::Dispatch(int ac,
                        owner->view()->text->CursorLeftOneWord(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_BEGINNINGBUF:
@@ -1544,7 +1617,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorTop(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_ENDBUF:
@@ -1554,7 +1627,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorBottom(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
 
       
@@ -1567,7 +1640,7 @@ string LyXFunc::Dispatch(int ac,
                        owner->view()->text->CursorRight(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_LEFTSEL:
@@ -1578,7 +1651,7 @@ string LyXFunc::Dispatch(int ac,
                        owner->view()->text->CursorLeft(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_UPSEL:
@@ -1586,7 +1659,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorUp(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_DOWNSEL:
@@ -1594,7 +1667,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorDown(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
 
        case LFUN_UP_PARAGRAPHSEL:
@@ -1602,7 +1675,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorUpParagraph(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_DOWN_PARAGRAPHSEL:
@@ -1610,7 +1683,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorDownParagraph(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_PRIORSEL:
@@ -1618,7 +1691,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->cursorPrevious();
                owner->view()->text->FinishUndo();
                moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_NEXTSEL:
@@ -1626,7 +1699,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->cursorNext();
                owner->view()->text->FinishUndo();
                moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_HOMESEL:
@@ -1634,7 +1707,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorHome(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_ENDSEL:
@@ -1642,7 +1715,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorEnd(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_WORDRIGHTSEL:
@@ -1653,7 +1726,7 @@ string LyXFunc::Dispatch(int ac,
                        owner->view()->text->CursorRightOneWord(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_WORDLEFTSEL:
@@ -1664,7 +1737,7 @@ string LyXFunc::Dispatch(int ac,
                        owner->view()->text->CursorLeftOneWord(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_BEGINNINGBUFSEL:
@@ -1672,7 +1745,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorTop(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
        case LFUN_ENDBUFSEL:
@@ -1680,7 +1753,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->CursorBottom(owner->view());
                owner->view()->text->FinishUndo();
                moveCursorUpdate(true);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
 
                // --- text changing commands ------------------------
@@ -1735,7 +1808,7 @@ string LyXFunc::Dispatch(int ac,
                        owner->view()->cut();
                }
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                owner->view()->setState();
                break;
 
@@ -1789,7 +1862,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->DeleteWordForward(owner->view());
                owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
 
                /* -------> Delete word backward. */
@@ -1798,7 +1871,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->DeleteWordBackward(owner->view());
                owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
                moveCursorUpdate(false);
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
                
                /* -------> Kill to end of line. */
@@ -1843,7 +1916,7 @@ string LyXFunc::Dispatch(int ac,
                } else {
                        owner->view()->cut();
                }
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                owner->view()->setState();
        }
        break;
@@ -1887,7 +1960,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->sel_cursor = 
                        owner->view()->text->cursor;
                owner->view()->setState();
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
        }
 
@@ -1899,7 +1972,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->text->sel_cursor = 
                        owner->view()->text->cursor;
                owner->view()->setState();
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
                break;
        }
        
@@ -1934,7 +2007,7 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
                owner->view()->text->sel_cursor = cursor;
                owner->view()->setState();
-               owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+               owner->showState();
        }
        break;
 
@@ -2291,15 +2364,7 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_PUSH_TOOLBAR:
        {
                int nth = strToInt(argument);
-               if (lyxerr.debugging(Debug::TOOLBAR)) {
-                       lyxerr << "LFUN_PUSH_TOOLBAR: argument = `"
-                              << argument << "'\n"
-                              << "LFUN_PUSH_TOOLBAR: nth = `"
-                              << nth << "'" << endl;
-               }
-               
                if (nth <= 0) {
-                       LyXBell();
                        setErrorMessage(N_("Push-toolbar needs argument > 0"));
                } else {
                        owner->getToolbar()->push(nth);
@@ -2309,7 +2374,7 @@ string LyXFunc::Dispatch(int ac,
        
        case LFUN_ADD_TO_TOOLBAR:
        {
-               if (lyxerr.debugging(Debug::TOOLBAR)) {
+               if (lyxerr.debugging(Debug::GUI)) {
                        lyxerr << "LFUN_ADD_TO_TOOLBAR:"
                                "argument = `" << argument << '\'' << endl;
                }
@@ -2317,7 +2382,6 @@ string LyXFunc::Dispatch(int ac,
                //lyxerr <<string("Argument: ") + argument);
                //lyxerr <<string("Tmp     : ") + tmp);
                if (tmp.empty()) {
-                       LyXBell();
                        setErrorMessage(N_("Usage: toolbar-add-to <LyX command>"));
                } else {
                        owner->getToolbar()->add(argument, false);
@@ -2398,8 +2462,7 @@ string LyXFunc::Dispatch(int ac,
        break;
 
        case LFUN_MATH_MODE:   // Open or create a math inset
-       {
-               
+       {               
                if (owner->view()->available())
                        owner->view()->open_new_inset(new InsetFormula);
                setMessage(N_("Math editor mode"));
@@ -2410,6 +2473,13 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_MATH_LIMITS:
        {
                setErrorMessage(N_("This is only allowed in math mode!"));
+       
+       }
+       break;
+
+       case LFUN_MATH_PANEL:
+       {
+               show_symbols_form(this);
        }
        break;