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 \
ControlViewSource.cpp \
ControlMath.cpp \
ControlNote.cpp \
ControlParagraph.cpp \
ControlPrefs.cpp \
ControlPrint.cpp \
@ -67,7 +66,6 @@ HEADERFILES = \
ControlLog.h \
ControlViewSource.h \
ControlMath.h \
ControlNote.h \
ControlParagraph.h \
ControlPrefs.h \
ControlPrint.h \

View File

@ -38,7 +38,6 @@
#include "GuiNomencl.h"
#include "GuiListings.h"
#include "GuiLog.h"
#include "GuiNote.h"
#include "GuiParagraph.h"
#include "GuiPrefs.h"
#include "GuiPrint.h"
@ -55,7 +54,6 @@
#include "TocWidget.h"
#include "GuiURL.h"
#include "GuiVSpace.h"
#include "GuiWrap.h"
#ifdef HAVE_LIBAIKSAURUS
#include "ControlThesaurus.h"
@ -109,8 +107,43 @@ private:
} // 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 * 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);
@ -181,7 +214,7 @@ Dialog * Dialogs::build(string const & name)
} else if (name == "mathmatrix") {
dialog = new GuiMathMatrixDialog(lyxview_);
} else if (name == "note") {
dialog = new GuiNoteDialog(lyxview_);
dialog = createGuiNote(lyxview_);
} else if (name == "paragraph") {
#ifdef USE_DOCK_WIDGET
DockView<ControlParagraph, GuiParagraph> * dv =

View File

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

View File

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