git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20760 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-10-05 20:43:26 +00:00
parent 33030d3ed8
commit 169d3fa39e
6 changed files with 99 additions and 140 deletions

View File

@ -1,49 +0,0 @@
/**
* \file ControlNote.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "ControlNote.h"
#include "FuncRequest.h"
#include "insets/InsetNote.h"
#include "gettext.h"
using std::string;
namespace lyx {
namespace frontend {
ControlNote::ControlNote(Dialog & parent)
: Controller(parent)
{}
bool ControlNote::initialiseParams(string const & data)
{
InsetNoteMailer::string2params(data, params_);
return true;
}
void ControlNote::clearParams()
{
params_ = InsetNoteParams();
}
void ControlNote::dispatchParams()
{
string const lfun = InsetNoteMailer::params2string(params());
dispatch(FuncRequest(getLfun(), lfun));
}
} // namespace frontend
} // namespace lyx

View File

@ -1,48 +0,0 @@
// -*- C++ -*-
/**
* \file ControlNote.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS.
*/
#ifndef CONTROLNOTE_H
#define CONTROLNOTE_H
#include "Dialog.h"
#include "insets/InsetNote.h"
#include <vector>
namespace lyx {
namespace frontend {
class ControlNote : public Controller
{
public:
///
ControlNote(Dialog &);
///
virtual bool initialiseParams(std::string const & data);
///
virtual void clearParams();
///
virtual void dispatchParams();
///
virtual bool isBufferDependent() const { return true; }
///
InsetNoteParams & params() { return params_; }
///
InsetNoteParams const & params() const { return params_; }
///
private:
///
InsetNoteParams params_;
};
} // namespace frontend
} // namespace lyx
#endif // CONTROLNOTE_H

View File

@ -29,7 +29,6 @@ SOURCEFILES = \
ControlLog.cpp \ ControlLog.cpp \
ControlViewSource.cpp \ ControlViewSource.cpp \
ControlMath.cpp \ ControlMath.cpp \
ControlNote.cpp \
ControlParagraph.cpp \ ControlParagraph.cpp \
ControlPrefs.cpp \ ControlPrefs.cpp \
ControlPrint.cpp \ ControlPrint.cpp \
@ -67,7 +66,6 @@ HEADERFILES = \
ControlLog.h \ ControlLog.h \
ControlViewSource.h \ ControlViewSource.h \
ControlMath.h \ ControlMath.h \
ControlNote.h \
ControlParagraph.h \ ControlParagraph.h \
ControlPrefs.h \ ControlPrefs.h \
ControlPrint.h \ ControlPrint.h \

View File

@ -38,7 +38,6 @@
#include "GuiNomencl.h" #include "GuiNomencl.h"
#include "GuiListings.h" #include "GuiListings.h"
#include "GuiLog.h" #include "GuiLog.h"
#include "GuiNote.h"
#include "GuiParagraph.h" #include "GuiParagraph.h"
#include "GuiPrefs.h" #include "GuiPrefs.h"
#include "GuiPrint.h" #include "GuiPrint.h"
@ -55,7 +54,6 @@
#include "TocWidget.h" #include "TocWidget.h"
#include "GuiURL.h" #include "GuiURL.h"
#include "GuiVSpace.h" #include "GuiVSpace.h"
#include "GuiWrap.h"
#ifdef HAVE_LIBAIKSAURUS #ifdef HAVE_LIBAIKSAURUS
#include "ControlThesaurus.h" #include "ControlThesaurus.h"
@ -109,8 +107,43 @@ private:
} // namespace anon } // namespace anon
// will be replaced by a proper factory...
Dialog * createGuiAboutDialog(LyXView & lv);
Dialog * createGuiBibitemDialog(LyXView & lv);
Dialog * createGuiBibtexDialog(LyXView & lv);
Dialog * createGuiBoxDialog(LyXView & lv);
Dialog * createGuiBranchDialog(LyXView & lv);
Dialog * createGuiChangesDialog(LyXView & lv);
Dialog * createGuiCharacterDialog(LyXView & lv);
Dialog * createGuiCitationDialog(LyXView & lv);
Dialog * createGuiDelimiterDialog(LyXView & lv);
Dialog * createGuiDocumentDialog(LyXView & lv);
Dialog * createGuiErrorListDialog(LyXView & lv);
Dialog * createGuiERTDialog(LyXView & lv);
Dialog * createGuiExternalDialog(LyXView & lv);
Dialog * createGuiFloatDialog(LyXView & lv);
Dialog * createGuiGraphicsDialog(LyXView & lv);
Dialog * createGuiIncludeDialog(LyXView & lv);
Dialog * createGuiIndexDialog(LyXView & lv);
Dialog * createGuiLabelDialog(LyXView & lv);
Dialog * createGuiListingsDialog(LyXView & lv);
Dialog * createGuiLogDialog(LyXView & lv);
Dialog * createGuiMathMatrixDialog(LyXView & lv);
Dialog * createGuiNomenclDialog(LyXView & lv);
Dialog * createGuiNote(LyXView & lv);
Dialog * createGuiPrefsDialog(LyXView & lv);
Dialog * createGuiPrintDialog(LyXView & lv);
Dialog * createGuiRef(LyXView & lv); Dialog * createGuiRef(LyXView & lv);
Dialog * createGuiSearchDialog(LyXView & lv);
Dialog * createGuiSendtoDialog(LyXView & lv);
Dialog * createGuiShowFileDialog(LyXView & lv);
Dialog * createGuiSpellcheckerDialog(LyXView & lv);
Dialog * createGuiTabularCreateDialog(LyXView & lv);
Dialog * createGuiTabularDialog(LyXView & lv);
Dialog * createGuiTexinfoDialog(LyXView & lv);
Dialog * createGuiThesaurusDialog(LyXView & lv);
Dialog * createGuiURLDialog(LyXView & lv);
Dialog * createGuiVSpaceDialog(LyXView & lv);
Dialog * createGuiWrap(LyXView & lv); Dialog * createGuiWrap(LyXView & lv);
@ -181,7 +214,7 @@ Dialog * Dialogs::build(string const & name)
} else if (name == "mathmatrix") { } else if (name == "mathmatrix") {
dialog = new GuiMathMatrixDialog(lyxview_); dialog = new GuiMathMatrixDialog(lyxview_);
} else if (name == "note") { } else if (name == "note") {
dialog = new GuiNoteDialog(lyxview_); dialog = createGuiNote(lyxview_);
} else if (name == "paragraph") { } else if (name == "paragraph") {
#ifdef USE_DOCK_WIDGET #ifdef USE_DOCK_WIDGET
DockView<ControlParagraph, GuiParagraph> * dv = DockView<ControlParagraph, GuiParagraph> * dv =

View File

@ -3,6 +3,7 @@
* This file is part of LyX, the document processor. * This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
* \author Angus Leeming
* \author Jürgen Spitzmüller * \author Jürgen Spitzmüller
* *
* Full author contact details are available in file CREDITS. * Full author contact details are available in file CREDITS.
@ -11,20 +12,24 @@
#include <config.h> #include <config.h>
#include "GuiNote.h" #include "GuiNote.h"
#include "FuncRequest.h"
#include "gettext.h"
#include "ControlNote.h"
#include "insets/InsetNote.h" #include "insets/InsetNote.h"
#include <QCloseEvent> #include <QCloseEvent>
using std::string;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
GuiNoteDialog::GuiNoteDialog(LyXView & lv) GuiNote::GuiNote(LyXView & lv)
: GuiDialog(lv, "note") : GuiDialog(lv, "note"), Controller(this)
{ {
setupUi(this); setupUi(this);
setController(new ControlNote(*this)); setController(this, false);
setViewTitle(_("Note Settings")); setViewTitle(_("Note Settings"));
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
@ -42,69 +47,78 @@ GuiNoteDialog::GuiNoteDialog(LyXView & lv)
} }
ControlNote & GuiNoteDialog::controller() void GuiNote::closeEvent(QCloseEvent * e)
{
return static_cast<ControlNote &>(GuiDialog::controller());
}
void GuiNoteDialog::closeEvent(QCloseEvent * e)
{ {
slotClose(); slotClose();
e->accept(); e->accept();
} }
void GuiNoteDialog::change_adaptor() void GuiNote::change_adaptor()
{ {
changed(); changed();
} }
void GuiNoteDialog::updateContents() void GuiNote::updateContents()
{ {
QRadioButton * rb = 0; switch (params_.type) {
switch (controller().params().type) {
case InsetNoteParams::Note: case InsetNoteParams::Note:
rb = noteRB; noteRB->setChecked(true);
break; break;
case InsetNoteParams::Comment: case InsetNoteParams::Comment:
rb = commentRB; commentRB->setChecked(true);
break; break;
case InsetNoteParams::Greyedout: case InsetNoteParams::Greyedout:
rb = greyedoutRB; greyedoutRB->setChecked(true);
break; break;
case InsetNoteParams::Framed: case InsetNoteParams::Framed:
rb = framedRB; framedRB->setChecked(true);
break; break;
case InsetNoteParams::Shaded: case InsetNoteParams::Shaded:
rb = shadedRB; shadedRB->setChecked(true);
break; break;
} }
rb->setChecked(true);
} }
void GuiNoteDialog::applyView() void GuiNote::applyView()
{ {
InsetNoteParams::Type type;
if (greyedoutRB->isChecked()) if (greyedoutRB->isChecked())
type = InsetNoteParams::Greyedout; params_.type = InsetNoteParams::Greyedout;
else if (commentRB->isChecked()) else if (commentRB->isChecked())
type = InsetNoteParams::Comment; params_.type = InsetNoteParams::Comment;
else if (framedRB->isChecked()) else if (framedRB->isChecked())
type = InsetNoteParams::Framed; params_.type = InsetNoteParams::Framed;
else if (shadedRB->isChecked()) else if (shadedRB->isChecked())
type = InsetNoteParams::Shaded; params_.type = InsetNoteParams::Shaded;
else else
type = InsetNoteParams::Note; params_.type = InsetNoteParams::Note;
controller().params().type = type;
} }
bool GuiNote::initialiseParams(string const & data)
{
InsetNoteMailer::string2params(data, params_);
return true;
}
void GuiNote::clearParams()
{
params_ = InsetNoteParams();
}
void GuiNote::dispatchParams()
{
dispatch(FuncRequest(getLfun(), InsetNoteMailer::params2string(params_)));
}
Dialog * createGuiNote(LyXView & lv) { return new GuiNote(lv); }
} // namespace frontend } // namespace frontend
} // namespace lyx } // namespace lyx

View File

@ -13,27 +13,38 @@
#define GUINOTE_H #define GUINOTE_H
#include "GuiDialog.h" #include "GuiDialog.h"
#include "ControlNote.h" #include "insets/InsetNote.h"
#include "ui_NoteUi.h" #include "ui_NoteUi.h"
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class GuiNoteDialog : public GuiDialog, public Ui::NoteUi class GuiNote : public GuiDialog, public Ui::NoteUi, public Controller
{ {
Q_OBJECT Q_OBJECT
public: public:
GuiNoteDialog(LyXView & lv); GuiNote(LyXView & lv);
private Q_SLOTS: private Q_SLOTS:
void change_adaptor(); void change_adaptor();
private: private:
void closeEvent(QCloseEvent * e); void closeEvent(QCloseEvent * e);
/// parent controller /// parent controller
ControlNote & controller(); Controller & controller() { return *this; }
/// Apply changes /// Apply changes
void applyView(); void applyView();
/// Update dialog before showing it /// Update dialog before showing it
void updateContents(); void updateContents();
///
bool initialiseParams(std::string const & data);
///
void clearParams();
///
void dispatchParams();
///
bool isBufferDependent() const { return true; }
private:
///
InsetNoteParams params_;
}; };
} // namespace frontend } // namespace frontend