]> git.lyx.org Git - lyx.git/blobdiff - src/LyXFunc.cpp
Cleanup in order to better understand bug 3043 and 3561.
[lyx.git] / src / LyXFunc.cpp
index ffde3bcba3046956ee24d96d5e8aa570b0e88ce8..cabf8afa1f60b92fcbcda6c18c28981102905a1b 100644 (file)
@@ -544,6 +544,9 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                break;
        }
 
+       case LFUN_DIALOG_TOGGLE:
+               flag.setOnOff(lyx_view_->getDialogs().visible(cmd.getArg(0)));
+               // fall through to set "enable"
        case LFUN_DIALOG_SHOW: {
                string const name = cmd.getArg(0);
                if (!buf)
@@ -637,7 +640,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        case LFUN_BUFFER_UPDATE:
        case LFUN_BUFFER_VIEW:
        case LFUN_BUFFER_IMPORT:
-       case LFUN_TOC_VIEW:
        case LFUN_BUFFER_AUTO_SAVE:
        case LFUN_RECONFIGURE:
        case LFUN_HELP_OPEN:
@@ -1091,14 +1093,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                theApp()->gui().closeAllViews();
                        break;
 
-               case LFUN_TOC_VIEW: {
-                       BOOST_ASSERT(lyx_view_);
-                       InsetCommandParams p("tableofcontents");
-                       string const data = InsetCommandMailer::params2string("toc", p);
-                       lyx_view_->getDialogs().show("toc", data, 0);
-                       break;
-               }
-
                case LFUN_BUFFER_AUTO_SAVE:
                        autoSave(view());
                        break;
@@ -1361,6 +1355,15 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        Dialogs::hide(argument, 0);
                        break;
 
+               case LFUN_DIALOG_TOGGLE: {
+                       BOOST_ASSERT(lyx_view_);
+                       if (lyx_view_->getDialogs().visible(cmd.getArg(0)))
+                               dispatch(FuncRequest(LFUN_DIALOG_HIDE, argument));
+                       else
+                               dispatch(FuncRequest(LFUN_DIALOG_SHOW, argument));
+                       break;
+               }
+
                case LFUN_DIALOG_DISCONNECT_INSET:
                        BOOST_ASSERT(lyx_view_);
                        lyx_view_->getDialogs().disconnect(argument);