git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20763 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-10-05 22:08:56 +00:00
parent d1d0501625
commit c2f2b1742d
6 changed files with 53 additions and 118 deletions

View File

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

View File

@ -1,46 +0,0 @@
// -*- C++ -*-
/**
* \file ControlFloat.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author unknown
*
* Full author contact details are available in file CREDITS.
*/
#ifndef CONTROLFLOAT_H
#define CONTROLFLOAT_H
#include "Dialog.h"
#include "insets/InsetFloat.h"
namespace lyx {
namespace frontend {
class ControlFloat : public Controller
{
public:
///
ControlFloat(Dialog &);
///
virtual bool initialiseParams(std::string const & data);
/// clean-up on hide.
virtual void clearParams();
/// clean-up on hide.
virtual void dispatchParams();
///
virtual bool isBufferDependent() const { return true; }
///
InsetFloatParams & params() { return params_; }
///
InsetFloatParams const & params() const { return params_; }
private:
///
InsetFloatParams params_;
};
} // namespace frontend
} // namespace lyx
#endif

View File

@ -21,7 +21,6 @@ SOURCEFILES = \
ControlEmbeddedFiles.cpp \
ControlErrorList.cpp \
ControlExternal.cpp \
ControlFloat.cpp \
ControlGraphics.cpp \
ControlInclude.cpp \
ControlLog.cpp \
@ -56,7 +55,6 @@ HEADERFILES = \
ControlErrorList.h \
ControlEmbeddedFiles.h \
ControlExternal.h \
ControlFloat.h \
ControlGraphics.h \
ControlInclude.h \
ControlLog.h \

View File

@ -29,7 +29,6 @@
#include "GuiEmbeddedFiles.h"
#include "GuiErrorList.h"
#include "GuiExternal.h"
#include "GuiFloat.h"
#include "GuiGraphics.h"
#include "GuiInclude.h"
#include "GuiIndex.h"
@ -191,7 +190,7 @@ Dialog * Dialogs::build(string const & name)
} else if (name == "findreplace") {
dialog = new GuiSearchDialog(lyxview_);
} else if (name == "float") {
dialog = new GuiFloatDialog(lyxview_);
dialog = createGuiFloat(lyxview_);
} else if (name == "graphics") {
dialog = new GuiGraphicsDialog(lyxview_);
} else if (name == "include") {

View File

@ -12,22 +12,24 @@
#include "GuiFloat.h"
#include "ControlFloat.h"
#include "FloatPlacement.h"
#include "FuncRequest.h"
#include "insets/InsetFloat.h"
#include <QCloseEvent>
#include <QPushButton>
using std::string;
namespace lyx {
namespace frontend {
GuiFloatDialog::GuiFloatDialog(LyXView & lv)
: GuiDialog(lv, "float")
GuiFloat::GuiFloat(LyXView & lv)
: GuiDialog(lv, "float"), Controller(this)
{
setController(new ControlFloat(*this));
setController(this, false);
setViewTitle(_("Float Settings"));
setupUi(this);
@ -54,37 +56,53 @@ GuiFloatDialog::GuiFloatDialog(LyXView & lv)
}
ControlFloat & GuiFloatDialog::controller()
{
return static_cast<ControlFloat &>(GuiDialog::controller());
}
void GuiFloatDialog::change_adaptor()
void GuiFloat::change_adaptor()
{
changed();
}
void GuiFloatDialog::closeEvent(QCloseEvent * e)
void GuiFloat::closeEvent(QCloseEvent * e)
{
slotClose();
e->accept();
}
void GuiFloatDialog::updateContents()
void GuiFloat::updateContents()
{
floatFP->set(controller().params());
floatFP->set(params_);
}
void GuiFloatDialog::applyView()
void GuiFloat::applyView()
{
InsetFloatParams & params = controller().params();
params.placement = floatFP->get(params.wide, params.sideways);
params_.placement = floatFP->get(params_.wide, params_.sideways);
}
bool GuiFloat::initialiseParams(string const & data)
{
InsetFloatMailer::string2params(data, params_);
return true;
}
void GuiFloat::clearParams()
{
params_ = InsetFloatParams();
}
void GuiFloat::dispatchParams()
{
dispatch(FuncRequest(getLfun(), InsetFloatMailer::params2string(params_)));
}
Dialog * createGuiFloat(LyXView & lv) { return new GuiFloat(lv); }
} // namespace frontend
} // namespace lyx

View File

@ -13,18 +13,19 @@
#define GUIFLOAT_H
#include "GuiDialog.h"
#include "ControlFloat.h"
#include "ui_FloatUi.h"
#include "insets/InsetFloat.h"
namespace lyx {
namespace frontend {
class GuiFloatDialog : public GuiDialog, public Ui::FloatUi
class GuiFloat : public GuiDialog, public Ui::FloatUi, public Controller
{
Q_OBJECT
public:
GuiFloatDialog(LyXView & lv);
GuiFloat(LyXView & lv);
private Q_SLOTS:
void change_adaptor();
@ -32,11 +33,23 @@ private Q_SLOTS:
private:
void closeEvent(QCloseEvent * e);
/// parent controller
ControlFloat & controller();
Controller & controller() { return *this; }
/// Apply changes
void applyView();
/// update
void updateContents();
///
bool initialiseParams(std::string const & data);
/// clean-up on hide.
void clearParams();
/// clean-up on hide.
void dispatchParams();
///
bool isBufferDependent() const { return true; }
private:
///
InsetFloatParams params_;
};
} // namespace frontend