]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiNote.cpp
Whitespace.
[lyx.git] / src / frontends / qt4 / GuiNote.cpp
index de7319438537cd3fbe40c18a6ab91f1121800120..adbb6e7425f09bbd3893116d2cc3cc34fcbe03cc 100644 (file)
@@ -3,7 +3,8 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Jürgen Spitzmüller
+ * \author Angus Leeming
+ * \author Jürgen Spitzmüller
  *
  * Full author contact details are available in file CREDITS.
  */
 #include <config.h>
 
 #include "GuiNote.h"
+#include "FuncRequest.h"
+#include "support/gettext.h"
 
-#include "ControlNote.h"
 #include "insets/InsetNote.h"
 
-#include <QCloseEvent>
+using namespace std;
 
 namespace lyx {
 namespace frontend {
 
-GuiNoteDialog::GuiNoteDialog(LyXView & lv)
-       : GuiDialog(lv, "note")
+GuiNote::GuiNote(GuiView & lv)
+       : GuiDialog(lv, "note", qt_("Note Settings"))
 {
        setupUi(this);
-       setController(new ControlNote(*this));
-       setViewTitle(_("Note Settings"));
 
        connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
        connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
@@ -33,8 +33,6 @@ GuiNoteDialog::GuiNoteDialog(LyXView & lv)
        connect(noteRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
        connect(greyedoutRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
        connect(commentRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
-       connect(framedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
-       connect(shadedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
 
        bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
        bc().setOK(okPB);
@@ -42,70 +40,62 @@ GuiNoteDialog::GuiNoteDialog(LyXView & lv)
 }
 
 
-ControlNote & GuiNoteDialog::controller() const
-{
-       return static_cast<ControlNote &>(GuiDialog::controller());
-}
-
-
-void GuiNoteDialog::closeEvent(QCloseEvent * e)
-{
-       slotWMHide();
-       e->accept();
-}
-
-
-void GuiNoteDialog::change_adaptor()
+void GuiNote::change_adaptor()
 {
        changed();
 }
 
 
-void GuiNoteDialog::update_contents()
+void GuiNote::updateContents()
 {
-       QRadioButton * rb = 0;
-
-       switch (controller().params().type) {
+       switch (params_.type) {
        case InsetNoteParams::Note:
-               rb = noteRB;
+               noteRB->setChecked(true);
                break;
        case InsetNoteParams::Comment:
-               rb = commentRB;
+               commentRB->setChecked(true);
                break;
        case InsetNoteParams::Greyedout:
-               rb = greyedoutRB;
-               break;
-       case InsetNoteParams::Framed:
-               rb = framedRB;
-               break;
-       case InsetNoteParams::Shaded:
-               rb = shadedRB;
+               greyedoutRB->setChecked(true);
                break;
        }
-
-       rb->setChecked(true);
 }
 
 
-void GuiNoteDialog::applyView()
+void GuiNote::applyView()
 {
-       InsetNoteParams::Type type;
-
        if (greyedoutRB->isChecked())
-               type = InsetNoteParams::Greyedout;
+               params_.type = InsetNoteParams::Greyedout;
        else if (commentRB->isChecked())
-               type = InsetNoteParams::Comment;
-       else if (framedRB->isChecked())
-               type = InsetNoteParams::Framed;
-       else if (shadedRB->isChecked())
-               type = InsetNoteParams::Shaded;
+               params_.type = InsetNoteParams::Comment;
        else
-               type = InsetNoteParams::Note;
+               params_.type = InsetNoteParams::Note;
+}
 
-       controller().params().type = type;
+
+bool GuiNote::initialiseParams(string const & data)
+{
+       InsetNote::string2params(data, params_);
+       return true;
 }
 
+
+void GuiNote::clearParams()
+{
+       params_ = InsetNoteParams();
+}
+
+
+void GuiNote::dispatchParams()
+{
+       dispatch(FuncRequest(getLfun(), InsetNote::params2string(params_)));
+}
+
+
+Dialog * createGuiNote(GuiView & lv) { return new GuiNote(lv); }
+
+
 } // namespace frontend
 } // namespace lyx
 
-#include "GuiNote_moc.cpp"
+#include "moc_GuiNote.cpp"