* 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 "insets/InsetNote.h"
-#include <QCloseEvent>
+using namespace std;
namespace lyx {
namespace frontend {
-/////////////////////////////////////////////////////////////////////
-//
-// GuiNoteDialog
-//
-/////////////////////////////////////////////////////////////////////
-
-GuiNoteDialog::GuiNoteDialog(GuiNote * form)
- : form_(form)
+GuiNote::GuiNote(GuiView & lv)
+ : GuiDialog(lv, "note", qt_("Note Settings"))
{
setupUi(this);
- connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
- connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
+ connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
+ connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
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()));
-}
-
-
-void GuiNoteDialog::closeEvent(QCloseEvent * e)
-{
- form_->slotWMHide();
- e->accept();
-}
-
-void GuiNoteDialog::change_adaptor()
-{
- form_->changed();
+ bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
+ bc().setOK(okPB);
+ bc().setCancel(closePB);
}
-/////////////////////////////////////////////////////////////////////
-//
-// GuiNote
-//
-/////////////////////////////////////////////////////////////////////
-
-
-GuiNote::GuiNote(GuiDialog & parent)
- : GuiView<GuiNoteDialog>(parent, _("Note Settings"))
-{}
-
-
-void GuiNote::build_dialog()
+void GuiNote::change_adaptor()
{
- dialog_.reset(new GuiNoteDialog(this));
-
- bc().setOK(dialog_->okPB);
- bc().setCancel(dialog_->closePB);
+ changed();
}
-void GuiNote::update_contents()
+void GuiNote::updateContents()
{
- QRadioButton * rb = 0;
-
- switch (controller().params().type) {
+ switch (params_.type) {
case InsetNoteParams::Note:
- rb = dialog_->noteRB;
+ noteRB->setChecked(true);
break;
case InsetNoteParams::Comment:
- rb = dialog_->commentRB;
+ commentRB->setChecked(true);
break;
case InsetNoteParams::Greyedout:
- rb = dialog_->greyedoutRB;
- break;
- case InsetNoteParams::Framed:
- rb = dialog_->framedRB;
- break;
- case InsetNoteParams::Shaded:
- rb = dialog_->shadedRB;
+ greyedoutRB->setChecked(true);
break;
}
-
- rb->setChecked(true);
}
void GuiNote::applyView()
{
- InsetNoteParams::Type type;
-
- if (dialog_->greyedoutRB->isChecked())
- type = InsetNoteParams::Greyedout;
- else if (dialog_->commentRB->isChecked())
- type = InsetNoteParams::Comment;
- else if (dialog_->framedRB->isChecked())
- type = InsetNoteParams::Framed;
- else if (dialog_->shadedRB->isChecked())
- type = InsetNoteParams::Shaded;
+ if (greyedoutRB->isChecked())
+ params_.type = InsetNoteParams::Greyedout;
+ else if (commentRB->isChecked())
+ params_.type = InsetNoteParams::Comment;
else
- type = InsetNoteParams::Note;
+ params_.type = InsetNoteParams::Note;
+}
+
+
+bool GuiNote::initialiseParams(string const & data)
+{
+ InsetNote::string2params(data, params_);
+ return true;
+}
- controller().params().type = type;
+
+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"