mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
next one
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20764 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c2f2b1742d
commit
58296b3994
@ -1,65 +0,0 @@
|
||||
/**
|
||||
* \file ControlVSpace.cpp
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Edwin Leuven
|
||||
* \author Angus Leeming
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "ControlVSpace.h"
|
||||
|
||||
#include "FuncRequest.h"
|
||||
#include "insets/InsetVSpace.h"
|
||||
|
||||
|
||||
using std::istringstream;
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
ControlVSpace::ControlVSpace(Dialog & parent)
|
||||
: Controller(parent)
|
||||
{}
|
||||
|
||||
|
||||
bool ControlVSpace::initialiseParams(string const & data)
|
||||
{
|
||||
InsetVSpaceMailer::string2params(data, params_);
|
||||
dialog().setButtonsValid(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ControlVSpace::clearParams()
|
||||
{
|
||||
params_ = VSpace();
|
||||
}
|
||||
|
||||
|
||||
void ControlVSpace::dispatchParams()
|
||||
{
|
||||
string const str = InsetVSpaceMailer::params2string(params_);
|
||||
dispatch(FuncRequest(getLfun(), str));
|
||||
}
|
||||
|
||||
|
||||
VSpace & ControlVSpace::params()
|
||||
{
|
||||
return params_;
|
||||
}
|
||||
|
||||
|
||||
VSpace const & ControlVSpace::params() const
|
||||
{
|
||||
return params_;
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
@ -1,49 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file ControlVSpace.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Edwin Leuven
|
||||
* \author André Pönitz
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef CONTROLVSPACE_H
|
||||
#define CONTROLVSPACE_H
|
||||
|
||||
#include "Dialog.h"
|
||||
#include "VSpace.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlVSpace : public Controller {
|
||||
public:
|
||||
///
|
||||
ControlVSpace(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; }
|
||||
///
|
||||
VSpace & params();
|
||||
///
|
||||
VSpace const & params() const;
|
||||
///
|
||||
bool inInset() const;
|
||||
|
||||
private:
|
||||
///
|
||||
VSpace params_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // CONTROLPARAGRAPH_H
|
@ -38,7 +38,6 @@ SOURCEFILES = \
|
||||
ControlTexinfo.cpp \
|
||||
ControlThesaurus.cpp \
|
||||
ControlToc.cpp \
|
||||
ControlVSpace.cpp \
|
||||
frontend_helpers.cpp
|
||||
|
||||
HEADERFILES = \
|
||||
@ -72,7 +71,6 @@ HEADERFILES = \
|
||||
ControlTexinfo.h \
|
||||
ControlThesaurus.h \
|
||||
ControlToc.h \
|
||||
ControlVSpace.h \
|
||||
frontend_helpers.h
|
||||
|
||||
if MONOLITHIC_CONTROLLERS
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include "GuiViewSource.h"
|
||||
#include "TocWidget.h"
|
||||
#include "GuiURL.h"
|
||||
#include "GuiVSpace.h"
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
#include "ControlThesaurus.h"
|
||||
@ -253,7 +252,7 @@ Dialog * Dialogs::build(string const & name)
|
||||
} else if (name == "url") {
|
||||
dialog = new GuiURLDialog(lyxview_);
|
||||
} else if (name == "vspace") {
|
||||
dialog = new GuiVSpaceDialog(lyxview_);
|
||||
dialog = createGuiVSpace(lyxview_);
|
||||
} else if (name == "wrap") {
|
||||
dialog = createGuiWrap(lyxview_);
|
||||
} else if (name == "listings") {
|
||||
|
@ -17,14 +17,14 @@
|
||||
|
||||
#include "GuiVSpace.h"
|
||||
|
||||
#include "ControlVSpace.h"
|
||||
#include "LengthCombo.h"
|
||||
#include "qt_helpers.h"
|
||||
#include "Validator.h"
|
||||
|
||||
#include "LyXRC.h" // to set the default length values
|
||||
#include "Spacing.h"
|
||||
#include "VSpace.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "insets/InsetVSpace.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
@ -40,12 +40,12 @@ using std::string;
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GuiVSpaceDialog::GuiVSpaceDialog(LyXView & lv)
|
||||
: GuiDialog(lv, "vspace")
|
||||
GuiVSpace::GuiVSpace(LyXView & lv)
|
||||
: GuiDialog(lv, "vspace"), Controller(this)
|
||||
{
|
||||
setupUi(this);
|
||||
setViewTitle(_("Vertical Space Settings"));
|
||||
setController(new ControlVSpace(*this));
|
||||
setController(this, false);
|
||||
|
||||
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
||||
connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
|
||||
@ -84,26 +84,20 @@ GuiVSpaceDialog::GuiVSpaceDialog(LyXView & lv)
|
||||
}
|
||||
|
||||
|
||||
ControlVSpace & GuiVSpaceDialog::controller()
|
||||
{
|
||||
return static_cast<ControlVSpace &>(GuiDialog::controller());
|
||||
}
|
||||
|
||||
|
||||
void GuiVSpaceDialog::closeEvent(QCloseEvent * e)
|
||||
void GuiVSpace::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
slotClose();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
void GuiVSpaceDialog::change_adaptor()
|
||||
void GuiVSpace::change_adaptor()
|
||||
{
|
||||
changed();
|
||||
}
|
||||
|
||||
|
||||
void GuiVSpaceDialog::enableCustom(int selection)
|
||||
void GuiVSpace::enableCustom(int selection)
|
||||
{
|
||||
bool const enable = selection == 5;
|
||||
valueLE->setEnabled(enable);
|
||||
@ -164,26 +158,49 @@ static VSpace setVSpaceFromWidgets(int spacing,
|
||||
}
|
||||
|
||||
|
||||
void GuiVSpaceDialog::applyView()
|
||||
void GuiVSpace::applyView()
|
||||
{
|
||||
// If a vspace choice is "Length" but there's no text in
|
||||
// the input field, do not insert a vspace at all.
|
||||
if (spacingCO->currentIndex() == 5 && valueLE->text().isEmpty())
|
||||
return;
|
||||
|
||||
VSpace const space = setVSpaceFromWidgets(spacingCO->currentIndex(),
|
||||
params_ = setVSpaceFromWidgets(spacingCO->currentIndex(),
|
||||
valueLE, unitCO, keepCB->isChecked());
|
||||
|
||||
controller().params() = space;
|
||||
}
|
||||
|
||||
|
||||
void GuiVSpaceDialog::updateContents()
|
||||
void GuiVSpace::updateContents()
|
||||
{
|
||||
setWidgetsFromVSpace(controller().params(),
|
||||
spacingCO, valueLE, unitCO, keepCB);
|
||||
setWidgetsFromVSpace(params_, spacingCO, valueLE, unitCO, keepCB);
|
||||
}
|
||||
|
||||
|
||||
bool GuiVSpace::initialiseParams(string const & data)
|
||||
{
|
||||
InsetVSpaceMailer::string2params(data, params_);
|
||||
dialog().setButtonsValid(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void GuiVSpace::clearParams()
|
||||
{
|
||||
params_ = VSpace();
|
||||
}
|
||||
|
||||
|
||||
void GuiVSpace::dispatchParams()
|
||||
{
|
||||
dispatch(FuncRequest(getLfun(), InsetVSpaceMailer::params2string(params_)));
|
||||
}
|
||||
|
||||
|
||||
Dialog * createGuiVSpace(LyXView & lv) { return new GuiVSpace(lv); }
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
* \author André Pönitz
|
||||
* \author Angus Leeming
|
||||
* \author Jürgen Spitzmüller
|
||||
* \author Edwin Leuven
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
@ -15,31 +16,47 @@
|
||||
#define GUIVSPACE_H
|
||||
|
||||
#include "GuiDialog.h"
|
||||
#include "ControlVSpace.h"
|
||||
#include "ui_VSpaceUi.h"
|
||||
#include "VSpace.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class GuiVSpaceDialog : public GuiDialog, public Ui::VSpaceUi
|
||||
class GuiVSpace : public GuiDialog, public Ui::VSpaceUi, public Controller
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GuiVSpaceDialog(LyXView & lv);
|
||||
GuiVSpace(LyXView & lv);
|
||||
|
||||
private Q_SLOTS:
|
||||
///
|
||||
void change_adaptor();
|
||||
///
|
||||
void closeEvent(QCloseEvent *);
|
||||
///
|
||||
void enableCustom(int);
|
||||
|
||||
private:
|
||||
/// parent controller
|
||||
ControlVSpace & controller();
|
||||
Controller & controller() { return *this; }
|
||||
/// Apply from dialog
|
||||
void applyView();
|
||||
/// Update the dialog
|
||||
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; }
|
||||
///
|
||||
bool inInset() const;
|
||||
|
||||
///
|
||||
VSpace params_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
Loading…
Reference in New Issue
Block a user