]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/controllers/ControlDialog.tmpl
port the graphics dialog to the new scheme and get rid of the ControlInset
[lyx.git] / src / frontends / controllers / ControlDialog.tmpl
index 5e7390360a82c8ab391d84426302b5ff5b6f9b27..dffa2e7ecc856ab40f91865f510f039035c574bb 100644 (file)
@@ -1,22 +1,22 @@
 // -*- C++ -*-
-/*
+/**
  * \file ControlDialog.tmpl
- * Copyright 2002 the LyX Team
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * \author Angus Leeming <a.leeming@ic.ac.uk>
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS
  *
  * ControlDialog is a base class and so these templatised methods will be
  * instantiated if this file is #included in the derived classes' .C file.
  */
 
 #include "ControlDialog.h"
+
 #include "ButtonControllerBase.h"
-#include "ControlConnections.h"
-#include "frontends/LyXView.h"
-#include "BufferView.h"
 #include "ViewBase.h"
-#include "debug.h"
+
 
 template <class Base>
 ControlDialog<Base>::ControlDialog(LyXView & lv, Dialogs & d)
@@ -27,49 +27,54 @@ ControlDialog<Base>::ControlDialog(LyXView & lv, Dialogs & d)
 template <class Base>
 void ControlDialog<Base>::show()
 {
-       if (Base::isBufferDependent() && !Base::lv_.view()->available())
+       if (isBufferDependent() && !bufferIsAvailable())
                return;
 
-       Base::connect();
+       connect();
+
+       if (!dialog_built_) {
+               view().build();
+               dialog_built_ = true;
+       }
 
        setParams();
-       if (Base::emergency_exit_) {
+       if (emergency_exit_) {
                hide();
                return;
        }
 
-       if (!dialog_built_) {
-               Base::view().build();
-               dialog_built_ = true;
-       }
+       bc().readOnly(bufferIsReadonly());
+       view().show();
 
-       Base::bc().readOnly(Base::isReadonly());
-       Base::view().show();
+       // The widgets may not be valid, so refresh the button controller
+       bc().refresh();
 }
 
 template <class Base>
 void ControlDialog<Base>::update()
 {
-       if (Base::isBufferDependent() && !Base::lv_.view()->available())
+       if (isBufferDependent() && !bufferIsAvailable())
                return;
 
        setParams();
-       if (Base::emergency_exit_) {
+       if (emergency_exit_) {
                hide();
                return;
        }
 
-       Base::bc().readOnly(Base::isReadonly());
-       Base::view().update();
+       bc().readOnly(bufferIsReadonly());
+       view().update();
+
+       // The widgets may not be valid, so refresh the button controller
+       bc().refresh();
 }
 
 template <class Base>
 void ControlDialog<Base>::hide()
 {
-       Base::emergency_exit_ = false;
+       emergency_exit_ = false;
        clearParams();
 
-       Base::disconnect();
-       Base::view().hide();
+       disconnect();
+       view().hide();
 }
-