mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-13 06:20:28 +00:00
39 to go
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20759 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f3555064fc
commit
33030d3ed8
@ -1,47 +0,0 @@
|
|||||||
/**
|
|
||||||
* \file ControlWrap.cpp
|
|
||||||
* This file is part of LyX, the document processor.
|
|
||||||
* Licence details can be found in the file COPYING.
|
|
||||||
*
|
|
||||||
* \author Dekel Tsur
|
|
||||||
*
|
|
||||||
* Full author contact details are available in file CREDITS.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include "ControlWrap.h"
|
|
||||||
#include "FuncRequest.h"
|
|
||||||
|
|
||||||
|
|
||||||
using std::string;
|
|
||||||
|
|
||||||
namespace lyx {
|
|
||||||
namespace frontend {
|
|
||||||
|
|
||||||
ControlWrap::ControlWrap(Dialog & parent)
|
|
||||||
: Controller(parent)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
bool ControlWrap::initialiseParams(string const & data)
|
|
||||||
{
|
|
||||||
InsetWrapMailer::string2params(data, params_);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ControlWrap::clearParams()
|
|
||||||
{
|
|
||||||
params_ = InsetWrapParams();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ControlWrap::dispatchParams()
|
|
||||||
{
|
|
||||||
string const lfun = InsetWrapMailer::params2string(params());
|
|
||||||
dispatch(FuncRequest(getLfun(), lfun));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace frontend
|
|
||||||
} // namespace lyx
|
|
@ -1,46 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
/**
|
|
||||||
* \file ControlWrap.h
|
|
||||||
* This file is part of LyX, the document processor.
|
|
||||||
* Licence details can be found in the file COPYING.
|
|
||||||
*
|
|
||||||
* \author Dekel Tsur
|
|
||||||
*
|
|
||||||
* Full author contact details are available in file CREDITS.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CONTROLWRAP_H
|
|
||||||
#define CONTROLWRAP_H
|
|
||||||
|
|
||||||
#include "Dialog.h"
|
|
||||||
#include "insets/InsetWrap.h"
|
|
||||||
|
|
||||||
namespace lyx {
|
|
||||||
namespace frontend {
|
|
||||||
|
|
||||||
class ControlWrap : public Controller
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
///
|
|
||||||
ControlWrap(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; }
|
|
||||||
///
|
|
||||||
InsetWrapParams & params() { return params_; }
|
|
||||||
///
|
|
||||||
InsetWrapParams const & params() const { return params_; }
|
|
||||||
private:
|
|
||||||
///
|
|
||||||
InsetWrapParams params_;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace frontend
|
|
||||||
} // namespace lyx
|
|
||||||
|
|
||||||
#endif
|
|
@ -35,6 +35,11 @@ Controller::Controller(Dialog & parent)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Controller::Controller(Dialog * parent)
|
||||||
|
: parent_(*parent), lyxview_(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Controller::~Controller()
|
Controller::~Controller()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -162,6 +162,8 @@ class Controller
|
|||||||
public:
|
public:
|
||||||
/// \param parent Dialog owning this Controller.
|
/// \param parent Dialog owning this Controller.
|
||||||
Controller(Dialog & parent);
|
Controller(Dialog & parent);
|
||||||
|
// the same. avoids ambiguity with the (non-existent) copy constructor
|
||||||
|
Controller(Dialog * parent);
|
||||||
virtual ~Controller();
|
virtual ~Controller();
|
||||||
void setLyXView(LyXView & lv) { lyxview_ = &lv; }
|
void setLyXView(LyXView & lv) { lyxview_ = &lv; }
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@ SOURCEFILES = \
|
|||||||
ControlThesaurus.cpp \
|
ControlThesaurus.cpp \
|
||||||
ControlToc.cpp \
|
ControlToc.cpp \
|
||||||
ControlVSpace.cpp \
|
ControlVSpace.cpp \
|
||||||
ControlWrap.cpp \
|
|
||||||
frontend_helpers.cpp
|
frontend_helpers.cpp
|
||||||
|
|
||||||
HEADERFILES = \
|
HEADERFILES = \
|
||||||
@ -82,7 +81,6 @@ HEADERFILES = \
|
|||||||
ControlThesaurus.h \
|
ControlThesaurus.h \
|
||||||
ControlToc.h \
|
ControlToc.h \
|
||||||
ControlVSpace.h \
|
ControlVSpace.h \
|
||||||
ControlWrap.h \
|
|
||||||
frontend_helpers.h
|
frontend_helpers.h
|
||||||
|
|
||||||
if MONOLITHIC_CONTROLLERS
|
if MONOLITHIC_CONTROLLERS
|
||||||
|
@ -111,6 +111,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
Dialog * createGuiRef(LyXView & lv);
|
Dialog * createGuiRef(LyXView & lv);
|
||||||
|
Dialog * createGuiWrap(LyXView & lv);
|
||||||
|
|
||||||
|
|
||||||
bool Dialogs::isValidName(string const & name) const
|
bool Dialogs::isValidName(string const & name) const
|
||||||
@ -224,7 +225,7 @@ Dialog * Dialogs::build(string const & name)
|
|||||||
} else if (name == "vspace") {
|
} else if (name == "vspace") {
|
||||||
dialog = new GuiVSpaceDialog(lyxview_);
|
dialog = new GuiVSpaceDialog(lyxview_);
|
||||||
} else if (name == "wrap") {
|
} else if (name == "wrap") {
|
||||||
dialog = new GuiWrapDialog(lyxview_);
|
dialog = createGuiWrap(lyxview_);
|
||||||
} else if (name == "listings") {
|
} else if (name == "listings") {
|
||||||
dialog = new GuiListingsDialog(lyxview_);
|
dialog = new GuiListingsDialog(lyxview_);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ using support::makeDisplayPath;
|
|||||||
static std::string const lfun_name_ = "ref";
|
static std::string const lfun_name_ = "ref";
|
||||||
|
|
||||||
GuiRef::GuiRef(LyXView & lv)
|
GuiRef::GuiRef(LyXView & lv)
|
||||||
: GuiDialog(lv, "ref"), Controller(*static_cast<Dialog*>(this)),
|
: GuiDialog(lv, "ref"), Controller(this),
|
||||||
params_("ref")
|
params_("ref")
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
#include "GuiWrap.h"
|
#include "GuiWrap.h"
|
||||||
|
|
||||||
#include "ControlWrap.h"
|
|
||||||
#include "LengthCombo.h"
|
#include "LengthCombo.h"
|
||||||
#include "qt_helpers.h"
|
#include "qt_helpers.h"
|
||||||
#include "Validator.h"
|
#include "Validator.h"
|
||||||
|
#include "FuncRequest.h"
|
||||||
|
|
||||||
#include "insets/InsetWrap.h"
|
#include "insets/InsetWrap.h"
|
||||||
|
|
||||||
@ -31,27 +31,27 @@ using std::string;
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
GuiWrapDialog::GuiWrapDialog(LyXView & lv)
|
GuiWrap::GuiWrap(LyXView & lv)
|
||||||
: GuiDialog(lv, "wrap")
|
: GuiDialog(lv, "wrap"), Controller(this)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setViewTitle(_("Wrap Float Settings"));
|
setViewTitle(_("Wrap Float Settings"));
|
||||||
setController(new ControlWrap(*this));
|
setController(this, false);
|
||||||
|
|
||||||
connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
|
connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
|
||||||
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
||||||
connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
|
connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
|
||||||
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
||||||
|
|
||||||
connect(widthED, SIGNAL(textChanged(const QString &)),
|
connect(widthED, SIGNAL(textChanged(QString)),
|
||||||
this, SLOT(change_adaptor()));
|
this, SLOT(change_adaptor()));
|
||||||
connect(widthUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
connect(widthUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
||||||
this, SLOT(change_adaptor()));
|
this, SLOT(change_adaptor()));
|
||||||
connect(valignCO, SIGNAL(highlighted(const QString &)),
|
connect(valignCO, SIGNAL(highlighted(QString)),
|
||||||
this, SLOT(change_adaptor()));
|
this, SLOT(change_adaptor()));
|
||||||
connect(overhangCB, SIGNAL(stateChanged(int)),
|
connect(overhangCB, SIGNAL(stateChanged(int)),
|
||||||
this, SLOT(change_adaptor()));
|
this, SLOT(change_adaptor()));
|
||||||
connect(overhangED, SIGNAL(textChanged(const QString &)),
|
connect(overhangED, SIGNAL(textChanged(QString)),
|
||||||
this, SLOT(change_adaptor()));
|
this, SLOT(change_adaptor()));
|
||||||
connect(overhangUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
connect(overhangUnitLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
|
||||||
this, SLOT(change_adaptor()));
|
this, SLOT(change_adaptor()));
|
||||||
@ -86,26 +86,20 @@ GuiWrapDialog::GuiWrapDialog(LyXView & lv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ControlWrap & GuiWrapDialog::controller()
|
void GuiWrap::closeEvent(QCloseEvent * e)
|
||||||
{
|
|
||||||
return static_cast<ControlWrap &>(GuiDialog::controller());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GuiWrapDialog::closeEvent(QCloseEvent * e)
|
|
||||||
{
|
{
|
||||||
slotClose();
|
slotClose();
|
||||||
e->accept();
|
e->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiWrapDialog::change_adaptor()
|
void GuiWrap::change_adaptor()
|
||||||
{
|
{
|
||||||
changed();
|
changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiWrapDialog::applyView()
|
void GuiWrap::applyView()
|
||||||
{
|
{
|
||||||
double const width_value = widthED->text().toDouble();
|
double const width_value = widthED->text().toDouble();
|
||||||
Length::UNIT widthUnit = widthUnitLC->currentLengthItem();
|
Length::UNIT widthUnit = widthUnitLC->currentLengthItem();
|
||||||
@ -116,52 +110,48 @@ void GuiWrapDialog::applyView()
|
|||||||
if (overhangED->text().isEmpty())
|
if (overhangED->text().isEmpty())
|
||||||
overhangUnit = Length::UNIT_NONE;
|
overhangUnit = Length::UNIT_NONE;
|
||||||
|
|
||||||
InsetWrapParams & params = controller().params();
|
params_.width = Length(width_value, widthUnit);
|
||||||
|
|
||||||
params.width = Length(width_value, widthUnit);
|
|
||||||
|
|
||||||
if (overhangCB->checkState() == Qt::Checked)
|
if (overhangCB->checkState() == Qt::Checked)
|
||||||
params.overhang = Length(overhang_value, overhangUnit);
|
params_.overhang = Length(overhang_value, overhangUnit);
|
||||||
else
|
else
|
||||||
// when value is "0" the option is not set in the LaTeX-output
|
// when value is "0" the option is not set in the LaTeX-output
|
||||||
// in InsetWrap.cpp
|
// in InsetWrap.cpp
|
||||||
params.overhang = Length("0in");
|
params_.overhang = Length("0in");
|
||||||
|
|
||||||
if (linesCB->checkState() == Qt::Checked)
|
if (linesCB->checkState() == Qt::Checked)
|
||||||
params.lines = linesSB->value();
|
params_.lines = linesSB->value();
|
||||||
else
|
else
|
||||||
// when value is "0" the option is not set in the LaTeX-output
|
// when value is "0" the option is not set in the LaTeX-output
|
||||||
// in InsetWrap.cpp
|
// in InsetWrap.cpp
|
||||||
params.lines = 0;
|
params_.lines = 0;
|
||||||
|
|
||||||
switch (valignCO->currentIndex()) {
|
switch (valignCO->currentIndex()) {
|
||||||
case 0:
|
case 0:
|
||||||
params.placement = "o";
|
params_.placement = "o";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
params.placement = "i";
|
params_.placement = "i";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
params.placement = "l";
|
params_.placement = "l";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
params.placement = "r";
|
params_.placement = "r";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiWrapDialog::updateContents()
|
void GuiWrap::updateContents()
|
||||||
{
|
{
|
||||||
InsetWrapParams & params = controller().params();
|
// 0pt is a legal width now, it yields a
|
||||||
|
// wrapfloat just wide enough for the contents.
|
||||||
//0pt is a legal width now, it yields a
|
Length len_w = params_.width;
|
||||||
//wrapfloat just wide enough for the contents.
|
|
||||||
Length len_w(params.width);
|
|
||||||
widthED->setText(QString::number(len_w.value()));
|
widthED->setText(QString::number(len_w.value()));
|
||||||
widthUnitLC->setCurrentItem(len_w.unit());
|
widthUnitLC->setCurrentItem(len_w.unit());
|
||||||
|
|
||||||
Length len_o(params.overhang);
|
Length len_o(params_.overhang);
|
||||||
overhangED->setText(QString::number(len_o.value()));
|
overhangED->setText(QString::number(len_o.value()));
|
||||||
overhangUnitLC->setCurrentItem(len_o.unit());
|
overhangUnitLC->setCurrentItem(len_o.unit());
|
||||||
if (len_o.value() == 0)
|
if (len_o.value() == 0)
|
||||||
@ -169,23 +159,47 @@ void GuiWrapDialog::updateContents()
|
|||||||
else
|
else
|
||||||
overhangCB->setCheckState(Qt::Checked);
|
overhangCB->setCheckState(Qt::Checked);
|
||||||
|
|
||||||
linesSB->setValue(params.lines);
|
linesSB->setValue(params_.lines);
|
||||||
if (params.lines == 0)
|
if (params_.lines == 0)
|
||||||
linesCB->setCheckState(Qt::Unchecked);
|
linesCB->setCheckState(Qt::Unchecked);
|
||||||
else
|
else
|
||||||
linesCB->setCheckState(Qt::Checked);
|
linesCB->setCheckState(Qt::Checked);
|
||||||
|
|
||||||
int item = 0;
|
int item = 0;
|
||||||
if (params.placement == "i")
|
if (params_.placement == "i")
|
||||||
item = 1;
|
item = 1;
|
||||||
else if (params.placement == "l")
|
else if (params_.placement == "l")
|
||||||
item = 2;
|
item = 2;
|
||||||
else if (params.placement == "r")
|
else if (params_.placement == "r")
|
||||||
item = 3;
|
item = 3;
|
||||||
|
|
||||||
valignCO->setCurrentIndex(item);
|
valignCO->setCurrentIndex(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GuiWrap::initialiseParams(string const & data)
|
||||||
|
{
|
||||||
|
InsetWrapMailer::string2params(data, params_);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiWrap::clearParams()
|
||||||
|
{
|
||||||
|
params_ = InsetWrapParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiWrap::dispatchParams()
|
||||||
|
{
|
||||||
|
string const lfun = InsetWrapMailer::params2string(params_);
|
||||||
|
dispatch(FuncRequest(getLfun(), lfun));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Dialog * createGuiWrap(LyXView & lv) { return new GuiWrap(lv); }
|
||||||
|
|
||||||
|
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
|
||||||
|
@ -13,18 +13,18 @@
|
|||||||
#define GUIWRAP_H
|
#define GUIWRAP_H
|
||||||
|
|
||||||
#include "GuiDialog.h"
|
#include "GuiDialog.h"
|
||||||
#include "ControlWrap.h"
|
|
||||||
#include "ui_WrapUi.h"
|
#include "ui_WrapUi.h"
|
||||||
|
#include "insets/InsetWrap.h"
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
class GuiWrapDialog : public GuiDialog, public Ui::WrapUi
|
class GuiWrap : public GuiDialog, public Ui::WrapUi, public Controller
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GuiWrapDialog(LyXView & lv);
|
GuiWrap(LyXView & lv);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void change_adaptor();
|
void change_adaptor();
|
||||||
@ -32,11 +32,22 @@ private Q_SLOTS:
|
|||||||
private:
|
private:
|
||||||
void closeEvent(QCloseEvent * e);
|
void closeEvent(QCloseEvent * e);
|
||||||
/// parent controller
|
/// parent controller
|
||||||
ControlWrap & controller();
|
Controller & controller() { return *this; }
|
||||||
/// Apply changes
|
/// Apply changes
|
||||||
void applyView();
|
void applyView();
|
||||||
/// update
|
/// update
|
||||||
void updateContents();
|
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; }
|
||||||
|
|
||||||
|
///
|
||||||
|
InsetWrapParams params_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
|
Loading…
Reference in New Issue
Block a user