]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/Dialogs.cpp
Move Color::color enum to ColorCode.h
[lyx.git] / src / frontends / Dialogs.cpp
index 5fb70c4587c1cc5605f10646b2766cefaee38da9..3032f0d9013a6d01b0323feaad656037076eddc0 100644 (file)
 #include <config.h>
 
 #include "Dialogs.h"
-
-#include "callback.h"
-
-#include "controllers/Dialog.h"
+#include "Dialog.h"
 
 #include <boost/signal.hpp>
 #include <boost/bind.hpp>
@@ -25,6 +22,8 @@ using std::string;
 
 namespace lyx {
 
+extern bool quitting;
+
 namespace frontend {
 
 Dialogs::Dialogs(LyXView & lyxview)
@@ -48,20 +47,6 @@ Dialog * Dialogs::find_or_build(string const & name)
 }
 
 
-void Dialogs::show(string const & name, string const & data)
-{
-       if (in_show_)
-               return;
-
-       in_show_ = true;
-       Dialog * dialog = find_or_build(name);
-       if (dialog)
-               dialog->showData(data);
-
-       in_show_ = false;
-}
-
-
 void Dialogs::show(string const & name, string const & data, Inset * inset)
 {
        if (in_show_)
@@ -71,7 +56,8 @@ void Dialogs::show(string const & name, string const & data, Inset * inset)
        Dialog * dialog = find_or_build(name);
        if (dialog) {
                dialog->showData(data);
-               open_insets_[name] = inset;
+               if (inset)
+                       open_insets_[name] = inset;
        }
        in_show_ = false;
 }
@@ -79,8 +65,7 @@ void Dialogs::show(string const & name, string const & data, Inset * inset)
 
 bool Dialogs::visible(string const & name) const
 {
-       std::map<string, DialogPtr>::const_iterator it =
-               dialogs_.find(name);
+       std::map<string, DialogPtr>::const_iterator it = dialogs_.find(name);
        if (it == dialogs_.end())
                return false;
        return it->second.get()->isVisibleView();
@@ -89,8 +74,7 @@ bool Dialogs::visible(string const & name) const
 
 void Dialogs::update(string const & name, string const & data)
 {
-       std::map<string, DialogPtr>::const_iterator it =
-               dialogs_.find(name);
+       std::map<string, DialogPtr>::const_iterator it = dialogs_.find(name);
        if (it == dialogs_.end())
                return;
 
@@ -162,7 +146,7 @@ void Dialogs::hideBufferDependent() const
 
        for(; it != end; ++it) {
                Dialog * dialog = it->second.get();
-               if (dialog->controller().isBufferDependent())
+               if (dialog->isBufferDependent())
                        dialog->hide();
        }
 }
@@ -175,8 +159,8 @@ void Dialogs::updateBufferDependent(bool switched) const
 
        for(; it != end; ++it) {
                Dialog * dialog = it->second.get();
-               if (switched && dialog->controller().isBufferDependent()) {
-                       if (dialog->isVisibleView() && dialog->controller().initialiseParams(""))
+               if (switched && dialog->isBufferDependent()) {
+                       if (dialog->isVisibleView() && dialog->initialiseParams(""))
                                dialog->updateView();
                        else
                                dialog->hide();
@@ -184,7 +168,7 @@ void Dialogs::updateBufferDependent(bool switched) const
                        // A bit clunky, but the dialog will request
                        // that the kernel provides it with the necessary
                        // data.
-                       dialog->RestoreButton();
+                       dialog->slotRestore();
                }
        }
 }
@@ -207,7 +191,7 @@ void Dialogs::checkStatus()
 
        for(; it != end; ++it) {
                Dialog * const dialog = it->second.get();
-               if (dialog->isVisibleView())
+               if (dialog && dialog->isVisibleView())
                        dialog->checkStatus();
        }
 }