merge ButtonController and its view (Qt2BC in this case)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20018 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-09-03 05:59:32 +00:00
parent c247f0ffe0
commit 212386be8a
100 changed files with 807 additions and 925 deletions

View File

@ -44,7 +44,7 @@ Dialog * Dialogs::find_or_build(string const & name)
if (it != dialogs_.end())
return it->second.get();
dialogs_[name] = build(name);
dialogs_[name].reset(build(name));
return dialogs_[name].get();
}

View File

@ -104,7 +104,7 @@ private:
///
typedef boost::shared_ptr<Dialog> DialogPtr;
///
DialogPtr build(std::string const & name);
Dialog * build(std::string const & name);
///
LyXView & lyxview_;

View File

@ -1,24 +0,0 @@
/**
* \file BCView.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 "BCView.h"
#include "ButtonController.h"
namespace lyx {
namespace frontend {
ButtonPolicy const & BCView::bp() const { return parent.policy(); }
ButtonPolicy & BCView::bp() { return parent.policy(); }
} // namespace frontend
} // namespace lyx

View File

@ -1,54 +0,0 @@
// -*- C++ -*-
/**
* \file BCView.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Allan Rae
* \author Angus Leeming
* \author Baruch Even
*
* Full author contact details are available in file CREDITS.
*/
#ifndef BCVIEW_H
#define BCVIEW_H
namespace lyx {
namespace frontend {
class ButtonController;
class ButtonPolicy;
/** \c BCView is the View to ButtonController's Controller. It
* stores the individual GUI widgets and sets their activation state
* upon receipt of instructions from the controller.
*
* It is a base class. The true, GUI, instantiations derive from it.
*/
class BCView
{
public:
BCView(ButtonController & p) : parent(p) {}
virtual ~BCView() {}
//@{
/// Refresh the status of the Ok, Apply, Restore, Cancel buttons.
virtual void refresh() const = 0;
/// Refresh the status of any widgets in the read_only list
virtual void refreshReadOnly() const = 0;
//@}
/// A shortcut to the BP of the BC.
ButtonPolicy const & bp() const;
ButtonPolicy & bp();
ButtonController & parent;
};
} // namespace frontend
} // namespace lyx
#endif // BCVIEW_H

View File

@ -1,114 +0,0 @@
/**
* \file ButtonController.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Allan Rae
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "ButtonController.h"
#include "BCView.h"
#include "debug.h"
namespace lyx {
namespace frontend {
BCView & ButtonController::view() const
{
BOOST_ASSERT(view_.get());
return *view_.get();
}
void ButtonController::view(BCView * view)
{
view_.reset(view);
}
void ButtonController::setPolicy(ButtonPolicy::Policy policy)
{
policy_ = ButtonPolicy(policy);
}
void ButtonController::refresh() const
{
view().refresh();
}
void ButtonController::refreshReadOnly() const
{
view().refreshReadOnly();
}
void ButtonController::ok()
{
input(ButtonPolicy::SMI_OKAY);
}
void ButtonController::input(ButtonPolicy::SMInput in)
{
if (ButtonPolicy::SMI_NOOP == in)
return;
policy_.input(in);
view().refresh();
}
void ButtonController::apply()
{
input(ButtonPolicy::SMI_APPLY);
}
void ButtonController::cancel()
{
input(ButtonPolicy::SMI_CANCEL);
}
void ButtonController::restore()
{
input(ButtonPolicy::SMI_RESTORE);
}
void ButtonController::hide()
{
input(ButtonPolicy::SMI_HIDE);
}
void ButtonController::valid(bool v)
{
if (v) {
input(ButtonPolicy::SMI_VALID);
} else {
input(ButtonPolicy::SMI_INVALID);
}
}
bool ButtonController::readOnly(bool ro)
{
LYXERR(Debug::GUI) << "Setting controller ro: " << ro << std::endl;
if (ro) {
policy_.input(ButtonPolicy::SMI_READ_ONLY);
} else {
policy_.input(ButtonPolicy::SMI_READ_WRITE);
}
view().refreshReadOnly();
view().refresh();
return ro;
}
} // namespace frontend
} // namespace lyx

View File

@ -1,95 +0,0 @@
// -*- C++ -*-
/**
* \file ButtonController.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Allan Rae
*
* Full author contact details are available in file CREDITS.
*/
#ifndef BUTTONCONTROLLER_H
#define BUTTONCONTROLLER_H
#include "ButtonPolicy.h"
#include "BCView.h"
#include <boost/scoped_ptr.hpp>
#include <boost/noncopyable.hpp>
namespace lyx {
namespace frontend {
/** \c ButtonController controls the activation of the OK, Apply and
* Cancel buttons.
*
* It actually supports 4 buttons in all and it's up to the user to decide on
* the activation policy and which buttons correspond to which output of the
* state machine.
*/
class ButtonController : boost::noncopyable {
public:
ButtonController() : policy_(ButtonPolicy::IgnorantPolicy) {}
//@{
/** Methods to set and get the GUI view (containing the actual
* button widgets.
* \param ptr is owned by the ButtonController.
*/
void view(BCView * ptr);
BCView & view() const;
//@}
//@{
/** Methods to set and get the ButtonPolicy.
* \param ptr is owned by the ButtonController.
*/
void setPolicy(ButtonPolicy::Policy policy);
ButtonPolicy const & policy() const { return policy_; }
ButtonPolicy & policy() { return policy_; }
//@}
///
void input(ButtonPolicy::SMInput);
//@{
/// Tell the BC that a particular button has been pressed.
void ok();
void apply();
void cancel();
void restore();
//@}
/// Tell the BC that the dialog is being hidden
void hide();
/**Refresh the activation state of the Ok, Apply, Close and
* Restore buttons.
*/
void refresh() const;
/** Refresh the activation state of all the widgets under the control
* of the BC to reflect the read-only status of the underlying buffer.
*/
void refreshReadOnly() const;
/** Passthrough function -- returns its input value
* Tell the BC about the read-only status of the underlying buffer.
*/
bool readOnly(bool = true);
/** \param validity Tell the BC that the data is, or is not, valid.
* Sets the activation state of the buttons immediately.
*/
void valid(bool = true);
private:
ButtonPolicy policy_;
boost::scoped_ptr<BCView> view_;
};
} // namespace frontend
} // namespace lyx
#endif // BUTTONCONTROLLER_H

View File

@ -11,7 +11,6 @@
#include <config.h>
#include "ControlCharacter.h"
#include "ButtonController.h"
#include "Buffer.h"
#include "BufferParams.h"
@ -46,7 +45,7 @@ bool ControlCharacter::initialiseParams(string const &)
getBar() != IGNORE ||
getColor() != Color::ignore ||
font_->language() != ignore_language)
dialog().bc().valid();
dialog().setButtonsValid(true);
return true;
}

View File

@ -15,7 +15,6 @@
#include "Buffer.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "ButtonController.h"
#include "Cursor.h"
#include "FuncRequest.h"
#include "Lexer.h"
@ -117,7 +116,7 @@ bool ControlParagraph::initialiseParams(string const & data)
// If "update", then set the activation status of the button controller
if (action > 0) {
bool const accept = action == 1;
dialog().bc().valid(accept);
dialog().setButtonsValid(accept);
}
return true;
}

View File

@ -12,7 +12,6 @@
#include "ControlPrint.h"
#include "ButtonController.h"
#include "frontend_helpers.h"
#include "Buffer.h"
@ -49,7 +48,7 @@ bool ControlPrint::initialiseParams(std::string const &)
params_.reset(new PrinterParams(PrinterParams::PRINTER,
lyxrc.printer, name));
dialog().bc().valid(); // so that the user can press Ok
dialog().setButtonsValid(true); // so that the user can press Ok
return true;
}

View File

@ -12,7 +12,6 @@
#include <config.h>
#include "ControlVSpace.h"
#include "ButtonController.h"
#include "FuncRequest.h"
#include "insets/InsetVSpace.h"
@ -34,7 +33,7 @@ bool ControlVSpace::initialiseParams(string const & data)
InsetVSpaceMailer::string2params(data, params_);
// so that the user can press Ok
dialog().bc().valid();
dialog().setButtonsValid(true);
return true;
}

View File

@ -12,9 +12,6 @@
#include "Dialog.h"
#include "ButtonController.h"
#include "BCView.h"
#include "frontends/LyXView.h"
#include "debug.h"
@ -29,43 +26,16 @@ namespace lyx {
namespace frontend {
Dialog::Dialog(LyXView & lv, string const & name)
: is_closing_(false), kernel_(lv), name_(name),
bc_ptr_(new ButtonController)
: is_closing_(false), kernel_(lv), name_(name)
{}
void Dialog::ApplyButton()
{
apply();
bc().apply();
}
Dialog::~Dialog()
{}
void Dialog::OKButton()
{
is_closing_ = true;
apply();
is_closing_ = false;
hide();
bc().ok();
}
void Dialog::CancelButton()
{
hide();
bc().cancel();
}
void Dialog::RestoreButton()
{
// Tell the kernel that a request to refresh the dialog's contents
// has been received. It's up to the kernel to supply the necessary
// info by calling Dialog::update().
kernel().updateDialog(name_);
bc().restore();
}
void Dialog::setButtonsValid(bool valid)
{}
void Dialog::show(string const & data)
@ -80,11 +50,9 @@ void Dialog::show(string const & data)
return;
}
bc().readOnly(kernel().isBufferReadonly());
preShow();
view().show();
// The widgets may not be valid, so refresh the button controller
bc().refresh();
postShow();
}
@ -99,11 +67,14 @@ void Dialog::update(string const & data)
return;
}
bc().readOnly(kernel().isBufferReadonly());
preUpdate();
view().update();
postUpdate();
}
// The widgets may not be valid, so refresh the button controller
bc().refresh();
void Dialog::checkStatus()
{
}
@ -150,13 +121,6 @@ void Dialog::redraw()
}
ButtonController & Dialog::bc() const
{
BOOST_ASSERT(bc_ptr_.get());
return *bc_ptr_.get();
}
void Dialog::setController(Controller * i)
{
BOOST_ASSERT(i && !controller_ptr_.get());
@ -171,31 +135,6 @@ void Dialog::setView(View * v)
}
void Dialog::checkStatus()
{
// buffer independant dialogs are always active.
// This check allows us leave canApply unimplemented for some dialogs.
if (!controller().isBufferDependent())
return;
// deactivate the dialog if we have no buffer
if (!kernel().isBufferAvailable()) {
bc().readOnly(true);
return;
}
// check whether this dialog may be active
if (controller().canApply()) {
bool const readonly = kernel().isBufferReadonly();
bc().readOnly(readonly);
// refreshReadOnly() is too generous in _enabling_ widgets
// update dialog to disable disabled widgets again
if (!readonly || controller().canApplyToReadOnly())
view().update();
} else
bc().readOnly(true);
}
Dialog::Controller::Controller(Dialog & parent)
: parent_(parent)

View File

@ -23,7 +23,6 @@
namespace lyx {
namespace frontend {
class ButtonController;
class LyXView;
/** \c Dialog collects the different parts of a Model-Controller-View
@ -35,23 +34,13 @@ public:
/// \param name is the identifier given to the dialog by its parent
/// container.
Dialog(LyXView & lv, std::string const & name);
virtual ~Dialog();
/** The Dialog's name is the means by which a dialog identifies
* itself to the kernel.
*/
std::string const & name() const { return name_; }
/** \name Buttons
* These methods are publicly accessible because they are invoked
* by the View when the user presses... guess what ;-)
*/
//@{
void ApplyButton();
void OKButton();
void CancelButton();
void RestoreButton();
//@}
/** \name Container Access
* These methods are publicly accessible because they are invoked
* by the parent container acting on commands from the LyX kernel.
@ -65,6 +54,17 @@ public:
void hide();
bool isVisible() const;
// Override in GuiDialog
virtual void preShow() {}
virtual void postShow() {}
virtual void preUpdate() {}
virtual void postUpdate() {}
virtual void OkButton() {}
virtual void ApplyButton() {}
virtual void CancelButton() {}
virtual void RestoreButton() {}
/** This function is called, for example, if the GUI colours
* have been changed.
*/
@ -112,17 +112,17 @@ public:
*/
//@{
Controller & controller() const;
ButtonController & bc() const;
View & view() const;
//@}
private:
virtual void setButtonsValid(bool valid);
protected:
void apply();
bool is_closing_;
Kernel kernel_;
std::string name_;
boost::scoped_ptr<ButtonController> bc_ptr_;
boost::scoped_ptr<Controller> controller_ptr_;
boost::scoped_ptr<View> view_ptr_;
};
@ -286,9 +286,6 @@ protected:
Controller & getController() { return p_.controller(); }
Controller const & getController() const { return p_.controller(); }
ButtonController & bc() { return p_.bc(); }
ButtonController const & bc() const { return p_.bc(); }
//@}
private:

View File

@ -7,10 +7,9 @@ EXTRA_DIST =
pkglib_LTLIBRARIES = liblyxcontrollers.la
SOURCEFILES = \
Dialog.cpp \
Dialog.cpp \
Kernel.cpp \
BCView.cpp \
ButtonController.cpp \
ButtonPolicy.cpp \
ControlAboutlyx.cpp \
ControlBibtex.cpp \
@ -53,7 +52,6 @@ SOURCEFILES = \
HEADERFILES = \
Kernel.h \
ButtonController.h \
ButtonPolicy.h \
ControlAboutlyx.h \
ControlBibtex.h \

View File

@ -19,17 +19,14 @@
#include <utility>
#include <vector>
#include <string>
#include <boost/bind.hpp>
#include <algorithm>
#include <utility>
#include <map>
class Buffer;
class Color_color;
/** Functions of use to the character GUI controller and view */
namespace lyx {
namespace support { class FileFilterList; }
namespace frontend {
///
@ -83,14 +80,6 @@ std::vector<LanguagePair> const getLanguageData(bool character_dlg);
/// sort colors for the gui
std::vector<Color_color> const getSortedColors(std::vector<Color_color> colors);
} // namespace frontend
namespace support { class FileFilterList; }
namespace frontend {
/** Launch a file dialog and return the chosen file.
filename: a suggested filename.
title: the title of the dialog.
@ -157,29 +146,6 @@ browseDir(docstring const & pathname,
std::vector<docstring> const getLatexUnits();
/** Functions to extract vectors of the first and second elems from a
vector<pair<A,B> >
*/
template<class Pair>
std::vector<typename Pair::first_type> const
getFirst(std::vector<Pair> const & pr)
{
std::vector<typename Pair::first_type> tmp(pr.size());
std::transform(pr.begin(), pr.end(), tmp.begin(),
boost::bind(&Pair::first, _1));
return tmp;
}
template<class Pair>
std::vector<typename Pair::second_type> const
getSecond(std::vector<Pair> const & pr)
{
std::vector<typename Pair::second_type> tmp(pr.size());
std::transform(pr.begin(), pr.end(), tmp.begin(),
boost::bind(&Pair::second, _1));
return tmp;
}
/** Build filelists of all availabe bst/cls/sty-files. Done through
* kpsewhich and an external script, saved in *Files.lst.
*/

View File

@ -1,19 +1,16 @@
/**
* \file Qt2BC.cpp
* \file ButtonController.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Allan Rae
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "Qt2BC.h"
#include "BCView.h"
#include "ButtonPolicy.h"
#include "ButtonController.h"
#include "debug.h"
#include "qt_helpers.h"
@ -22,17 +19,79 @@
#include <QLabel>
#include <QValidator>
namespace lyx {
namespace frontend {
Qt2BC::Qt2BC(ButtonController & parent)
: BCView(parent), okay_(0), apply_(0), cancel_(0), restore_(0)
ButtonController::ButtonController()
: okay_(0), apply_(0), cancel_(0), restore_(0),
policy_(ButtonPolicy::IgnorantPolicy)
{}
void Qt2BC::refresh() const
void ButtonController::setPolicy(ButtonPolicy::Policy policy)
{
policy_ = ButtonPolicy(policy);
}
void ButtonController::ok()
{
input(ButtonPolicy::SMI_OKAY);
}
void ButtonController::input(ButtonPolicy::SMInput in)
{
if (ButtonPolicy::SMI_NOOP == in)
return;
policy_.input(in);
refresh();
}
void ButtonController::apply()
{
input(ButtonPolicy::SMI_APPLY);
}
void ButtonController::cancel()
{
input(ButtonPolicy::SMI_CANCEL);
}
void ButtonController::restore()
{
input(ButtonPolicy::SMI_RESTORE);
}
void ButtonController::hide()
{
input(ButtonPolicy::SMI_HIDE);
}
void ButtonController::setValid(bool v)
{
input(v ? ButtonPolicy::SMI_VALID : ButtonPolicy::SMI_INVALID);
}
bool ButtonController::setReadOnly(bool ro)
{
LYXERR(Debug::GUI) << "Setting controller ro: " << ro << std::endl;
policy_.input(ro ?
ButtonPolicy::SMI_READ_ONLY : ButtonPolicy::SMI_READ_WRITE);
refreshReadOnly();
refresh();
return ro;
}
void ButtonController::refresh() const
{
LYXERR(Debug::GUI) << "Calling BC refresh()" << std::endl;
@ -40,21 +99,21 @@ void Qt2BC::refresh() const
if (okay_) {
bool const enabled =
all_valid && bp().buttonStatus(ButtonPolicy::OKAY);
all_valid && policy().buttonStatus(ButtonPolicy::OKAY);
okay_->setEnabled(enabled);
}
if (apply_) {
bool const enabled =
all_valid && bp().buttonStatus(ButtonPolicy::APPLY);
all_valid && policy().buttonStatus(ButtonPolicy::APPLY);
apply_->setEnabled(enabled);
}
if (restore_) {
bool const enabled =
all_valid && bp().buttonStatus(ButtonPolicy::RESTORE);
all_valid && policy().buttonStatus(ButtonPolicy::RESTORE);
restore_->setEnabled(enabled);
}
if (cancel_) {
bool const enabled = bp().buttonStatus(ButtonPolicy::CANCEL);
bool const enabled = policy().buttonStatus(ButtonPolicy::CANCEL);
if (enabled)
cancel_->setText(toqstr(_("Cancel")));
else
@ -63,12 +122,12 @@ void Qt2BC::refresh() const
}
void Qt2BC::refreshReadOnly() const
void ButtonController::refreshReadOnly() const
{
if (read_only_.empty())
return;
bool const enable = !bp().isReadOnly();
bool const enable = !policy().isReadOnly();
Widgets::const_iterator end = read_only_.end();
Widgets::const_iterator iter = read_only_.begin();
@ -77,7 +136,7 @@ void Qt2BC::refreshReadOnly() const
}
void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled) const
void ButtonController::setWidgetEnabled(QWidget * obj, bool enabled) const
{
if (QLineEdit * le = qobject_cast<QLineEdit*>(obj))
le->setReadOnly(!enabled);
@ -88,13 +147,13 @@ void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled) const
}
void Qt2BC::addCheckedLineEdit(QLineEdit * input, QWidget * label)
void ButtonController::addCheckedLineEdit(QLineEdit * input, QWidget * label)
{
checked_widgets.push_back(CheckedLineEdit(input, label));
}
bool Qt2BC::checkWidgets() const
bool ButtonController::checkWidgets() const
{
bool valid = true;
@ -115,13 +174,6 @@ bool Qt2BC::checkWidgets() const
//
//////////////////////////////////////////////////////////////
void addCheckedLineEdit(BCView & bcview, QLineEdit * input, QWidget * label)
{
Qt2BC * bc = static_cast<Qt2BC *>(&bcview);
bc->addCheckedLineEdit(input, label);
}
static void setWarningColor(QWidget * widget)
{
QPalette pal = widget->palette();
@ -130,7 +182,6 @@ static void setWarningColor(QWidget * widget)
}
CheckedLineEdit::CheckedLineEdit(QLineEdit * input, QWidget * label)
: input_(input), label_(label)
{}
@ -152,7 +203,7 @@ bool CheckedLineEdit::check() const
else
setWarningColor(input_);
if (label_) {
if (!label_) {
if (valid)
label_->setPalette(QPalette());
else

View File

@ -1,24 +1,20 @@
// -*- C++ -*-
/**
* \file Qt2BC.h
* \file ButtonController.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Allan Rae
* \author Angus Leeming
* \author Baruch Even
*
* Full author contact details are available in file CREDITS.
*/
#ifndef QT2BC_H
#define QT2BC_H
#ifndef BUTTONCONTROLLER_H
#define BUTTONCONTROLLER_H
#include "BCView.h"
#include "ButtonPolicy.h"
#include "gettext.h"
#include <list>
class QWidget;
class QPushButton;
class QLineEdit;
@ -26,10 +22,6 @@ class QLineEdit;
namespace lyx {
namespace frontend {
void addCheckedLineEdit(BCView & bcview,
QLineEdit * input, QWidget * label = 0);
class CheckedLineEdit
{
public:
@ -49,11 +41,66 @@ private:
state machine.
*/
class Qt2BC : public BCView
/** \c ButtonController controls the activation of the OK, Apply and
* Cancel buttons.
*
* It actually supports 4 buttons in all and it's up to the user to decide on
* the activation policy and which buttons correspond to which output of the
* state machine.
*/
class ButtonController
{
public:
ButtonController();
//@{
/** Methods to set and get the ButtonPolicy.
* \param ptr is owned by the ButtonController.
*/
void setPolicy(ButtonPolicy::Policy policy);
ButtonPolicy const & policy() const { return policy_; }
ButtonPolicy & policy() { return policy_; }
//@}
///
Qt2BC(ButtonController & parent);
void input(ButtonPolicy::SMInput);
//@{
/// Tell the BC that a particular button has been pressed.
void ok();
void apply();
void cancel();
void restore();
//@}
/// Tell the BC that the dialog is being hidden
void hide();
/**Refresh the activation state of the Ok, Apply, Close and
* Restore buttons.
*/
void refresh() const;
/** Refresh the activation state of all the widgets under the control
* of the BC to reflect the read-only status of the underlying buffer.
*/
void refreshReadOnly() const;
/** Passthrough function -- returns its input value
* Tell the BC about the read-only status of the underlying buffer.
*/
bool setReadOnly(bool = true);
/** \param validity Tell the BC that the data is, or is not, valid.
* Sets the activation state of the buttons immediately.
*/
void setValid(bool = true);
//
// View
//
//@{
/** Store pointers to these widgets.
@ -70,11 +117,6 @@ public:
*/
void addReadOnly(QWidget * obj) { read_only_.push_back(obj); }
/// Refresh the status of the Ok, Apply, Restore, Cancel buttons.
virtual void refresh() const;
/// Refresh the status of any widgets in the read_only list
virtual void refreshReadOnly() const;
/** Add a widget to the list of all widgets whose validity should
* be checked explicitly when the buttons are refreshed.
*/
@ -99,9 +141,12 @@ private:
typedef std::list<QWidget *> Widgets;
Widgets read_only_;
private:
ButtonPolicy policy_;
};
} // namespace frontend
} // namespace lyx
#endif // QT2BC_H
#endif // BUTTONCONTROLLER_H

View File

@ -11,8 +11,8 @@
#include <config.h>
#include "Dialogs.h"
#include "GuiDialog.h"
#include "Qt2BC.h"
#include "ButtonController.h"
#include "DockView.h"
#include "GuiView.h"
@ -110,12 +110,11 @@ bool Dialogs::isValidName(string const & name) const
}
Dialogs::DialogPtr Dialogs::build(string const & name)
Dialog * Dialogs::build(string const & name)
{
BOOST_ASSERT(isValidName(name));
DialogPtr dialog(new Dialog(lyxview_, name));
dialog->bc().view(new Qt2BC(dialog->bc()));
GuiDialog * dialog = new GuiDialog(lyxview_, name);
if (name == "aboutlyx") {
dialog->setController(new ControlAboutlyx(*dialog));

View File

@ -11,11 +11,8 @@
#include <config.h>
#include "GuiAbout.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "controllers/ButtonController.h"
#include "controllers/ControlAboutlyx.h"
#include "gettext.h"
#include "support/lstrings.h"
@ -38,7 +35,7 @@ namespace lyx {
namespace frontend {
GuiAbout::GuiAbout(Dialog & parent)
GuiAbout::GuiAbout(GuiDialog & parent)
: GuiView<GuiAboutDialog>(parent, _("About LyX"))
{
}
@ -112,8 +109,8 @@ void GuiAbout::build_dialog()
dialog_->setMinimumSize(dialog_->sizeHint());
// Manage the cancel/close button
bcview().setCancel(dialog_->closePB);
bc().refresh();
bc().setCancel(dialog_->closePB);
//FIXME bc().refresh();
}
} // namespace frontend

View File

@ -36,7 +36,7 @@ public:
class GuiAbout : public GuiView<GuiAboutDialog>
{
public:
GuiAbout(Dialog &);
GuiAbout(GuiDialog &);
/// parent controller
ControlAboutlyx & controller()
{ return static_cast<ControlAboutlyx &>(this->getController()); }

View File

@ -11,7 +11,6 @@
#include <config.h>
#include "GuiBibitem.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include <QCloseEvent>
@ -62,7 +61,7 @@ void GuiBibitemDialog::closeEvent(QCloseEvent *e)
/////////////////////////////////////////////////////////////////////
GuiBibitem::GuiBibitem(Dialog & parent)
GuiBibitem::GuiBibitem(GuiDialog & parent)
: GuiView<GuiBibitemDialog>(parent, _("Bibliography Entry Settings"))
{
}
@ -72,10 +71,10 @@ void GuiBibitem::build_dialog()
{
dialog_.reset(new GuiBibitemDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->keyED);
bcview().addReadOnly(dialog_->labelED);
bc().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->keyED);
bc().addReadOnly(dialog_->labelED);
}

View File

@ -42,7 +42,7 @@ class GuiBibitem : public GuiView<GuiBibitemDialog>
{
public:
///
GuiBibitem(Dialog &);
GuiBibitem(GuiDialog &);
/// parent controller
ControlCommand & controller()
{ return static_cast<ControlCommand &>(this->getController()); }

View File

@ -15,7 +15,6 @@
#include "GuiBibtex.h"
#include "ui_BibtexAddUi.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "Validator.h"
#include "LyXRC.h"
@ -80,14 +79,10 @@ GuiBibtexDialog::GuiBibtexDialog(GuiBibtex * form)
this, SLOT(addPressed()));
add_ = new UiDialog<Ui::BibtexAddUi>(this, true);
Qt2BC * bcview = new Qt2BC(add_bc_);
add_bc_.view(bcview);
add_bc_.setPolicy(ButtonPolicy::OkCancelPolicy);
bcview->setOK(add_->addPB);
bcview->setCancel(add_->closePB);
bcview->addCheckedLineEdit(add_->bibED, 0);
add_bc_.setOK(add_->addPB);
add_bc_.setCancel(add_->closePB);
add_bc_.addCheckedLineEdit(add_->bibED, 0);
connect(add_->bibED, SIGNAL(textChanged(const QString &)),
this, SLOT(bibEDChanged()));
@ -105,7 +100,6 @@ GuiBibtexDialog::GuiBibtexDialog(GuiBibtex * form)
this, SLOT(browseBibPressed()));
connect(add_->closePB, SIGNAL(clicked()),
add_, SLOT(reject()));
}
@ -114,7 +108,7 @@ void GuiBibtexDialog::bibEDChanged()
// Indicate to the button controller that the contents have
// changed. The actual test of validity is carried out by
// the checkedLineEdit.
add_bc_.valid(true);
add_bc_.setValid(true);
}
@ -176,7 +170,7 @@ void GuiBibtexDialog::browseBibPressed()
void GuiBibtexDialog::addPressed()
{
add_bc_.valid(false);
add_bc_.setValid(false);
add_->exec();
}
@ -231,7 +225,7 @@ void GuiBibtexDialog::databaseChanged()
void GuiBibtexDialog::availableChanged()
{
add_bc_.valid(true);
add_bc_.setValid(true);
}
@ -244,12 +238,12 @@ void GuiBibtexDialog::closeEvent(QCloseEvent *e)
/////////////////////////////////////////////////////////////////////
//
// QBibTex
// GuiBibTex
//
/////////////////////////////////////////////////////////////////////
GuiBibtex::GuiBibtex(Dialog & parent)
GuiBibtex::GuiBibtex(GuiDialog & parent)
: GuiView<GuiBibtexDialog>(parent, _("BibTeX Bibliography"))
{
}
@ -259,14 +253,14 @@ void GuiBibtex::build_dialog()
{
dialog_.reset(new GuiBibtexDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->databaseLW);
bcview().addReadOnly(dialog_->stylePB);
bcview().addReadOnly(dialog_->styleCB);
bcview().addReadOnly(dialog_->bibtocCB);
bcview().addReadOnly(dialog_->addBibPB);
bcview().addReadOnly(dialog_->deletePB);
bc().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->databaseLW);
bc().addReadOnly(dialog_->stylePB);
bc().addReadOnly(dialog_->styleCB);
bc().addReadOnly(dialog_->bibtocCB);
bc().addReadOnly(dialog_->addBibPB);
bc().addReadOnly(dialog_->deletePB);
}

View File

@ -71,7 +71,7 @@ class GuiBibtex : public GuiView<GuiBibtexDialog>
public:
friend class GuiBibtexDialog;
GuiBibtex(Dialog &);
GuiBibtex(GuiDialog &);
/// parent controller
ControlBibtex & controller()
{ return static_cast<ControlBibtex &>(this->getController()); }

View File

@ -16,7 +16,6 @@
#include "LengthCombo.h"
#include "qt_helpers.h"
#include "Qt2BC.h"
#include "lengthcommon.h"
#include "LyXRC.h" // to set the default length values
#include "Validator.h"
@ -142,7 +141,7 @@ void GuiBoxDialog::restoreClicked()
//////////////////////////////////////////////////////////////////
GuiBox::GuiBox(Dialog & parent)
GuiBox::GuiBox(GuiDialog & parent)
: GuiView<GuiBoxDialog>(parent, _("Box Settings"))
{}
@ -162,24 +161,24 @@ void GuiBox::build_dialog()
for (unsigned int i = 1; i < gui_names_spec_.size(); ++i)
dialog_->heightUnitsLC->addItem(toqstr(gui_names_spec_[i]));
bcview().addReadOnly(dialog_->typeCO);
bcview().addReadOnly(dialog_->innerBoxCO);
bcview().addReadOnly(dialog_->valignCO);
bcview().addReadOnly(dialog_->ialignCO);
bcview().addReadOnly(dialog_->halignCO);
bcview().addReadOnly(dialog_->widthED);
bcview().addReadOnly(dialog_->heightED);
bcview().addReadOnly(dialog_->widthUnitsLC);
bcview().addReadOnly(dialog_->heightUnitsLC);
bc().addReadOnly(dialog_->typeCO);
bc().addReadOnly(dialog_->innerBoxCO);
bc().addReadOnly(dialog_->valignCO);
bc().addReadOnly(dialog_->ialignCO);
bc().addReadOnly(dialog_->halignCO);
bc().addReadOnly(dialog_->widthED);
bc().addReadOnly(dialog_->heightED);
bc().addReadOnly(dialog_->widthUnitsLC);
bc().addReadOnly(dialog_->heightUnitsLC);
bcview().setRestore(dialog_->restorePB);
bcview().setOK(dialog_->okPB);
bcview().setApply(dialog_->applyPB);
bcview().setCancel(dialog_->closePB);
bc().setRestore(dialog_->restorePB);
bc().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB);
// initialize the length validator
addCheckedLineEdit(bcview(), dialog_->widthED, dialog_->widthLA);
addCheckedLineEdit(bcview(), dialog_->heightED, dialog_->heightLA);
bc().addCheckedLineEdit(dialog_->widthED, dialog_->widthLA);
bc().addCheckedLineEdit(dialog_->heightED, dialog_->heightLA);
}

View File

@ -47,7 +47,7 @@ class GuiBox : public GuiView<GuiBoxDialog>
{
public:
///
GuiBox(Dialog &);
GuiBox(GuiDialog &);
/// parent controller
ControlBox & controller()
{ return static_cast<ControlBox &>(this->getController()); }

View File

@ -11,7 +11,6 @@
#include <config.h>
#include "GuiBranch.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "BranchList.h"
@ -63,7 +62,7 @@ void GuiBranchDialog::change_adaptor()
/////////////////////////////////////////////////////////////////////
GuiBranch::GuiBranch(Dialog & parent)
GuiBranch::GuiBranch(GuiDialog & parent)
: GuiView<GuiBranchDialog>(parent, _("Branch Settings"))
{}
@ -72,8 +71,8 @@ void GuiBranch::build_dialog()
{
dialog_.reset(new GuiBranchDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setCancel(dialog_->closePB);
bc().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB);
}

View File

@ -42,7 +42,7 @@ class GuiBranch : public GuiView<GuiBranchDialog>
{
public:
/// Constructor
GuiBranch(Dialog &);
GuiBranch(GuiDialog &);
/// parent controller
ControlBranch & controller()
{ return static_cast<ControlBranch &>(this->getController()); }

View File

@ -12,7 +12,6 @@
#include <config.h>
#include "GuiChanges.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "support/lstrings.h"
@ -76,7 +75,7 @@ void GuiChangesDialog::closeEvent(QCloseEvent *e)
/////////////////////////////////////////////////////////////////////
GuiChanges::GuiChanges(Dialog & parent)
GuiChanges::GuiChanges(GuiDialog & parent)
: GuiView<GuiChangesDialog>(parent, _("Merge Changes"))
{
}
@ -86,9 +85,9 @@ void GuiChanges::build_dialog()
{
dialog_.reset(new GuiChangesDialog(this));
bcview().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->acceptPB);
bcview().addReadOnly(dialog_->rejectPB);
bc().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->acceptPB);
bc().addReadOnly(dialog_->rejectPB);
}

View File

@ -47,7 +47,7 @@ class GuiChanges : public GuiView<GuiChangesDialog>
{
public:
///
GuiChanges(Dialog &);
GuiChanges(GuiDialog &);
/// parent controller
ControlChanges & controller()
{ return static_cast<ControlChanges &>(this->getController()); }

View File

@ -12,7 +12,6 @@
#include <config.h>
#include "GuiCharacter.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "frontend_helpers.h"
#include "Color.h"
@ -85,7 +84,7 @@ void GuiCharacterDialog::closeEvent(QCloseEvent * e)
/////////////////////////////////////////////////////////////////////
GuiCharacter::GuiCharacter(Dialog & parent)
GuiCharacter::GuiCharacter(GuiDialog & parent)
: GuiView<GuiCharacterDialog>(parent, _("Text Style"))
{
}
@ -133,18 +132,18 @@ void GuiCharacter::build_dialog()
dialog_->langCO->addItem(toqstr(cit->first));
}
bcview().setOK(dialog_->okPB);
bcview().setApply(dialog_->applyPB);
bcview().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->familyCO);
bcview().addReadOnly(dialog_->seriesCO);
bcview().addReadOnly(dialog_->sizeCO);
bcview().addReadOnly(dialog_->shapeCO);
bcview().addReadOnly(dialog_->miscCO);
bcview().addReadOnly(dialog_->langCO);
bcview().addReadOnly(dialog_->colorCO);
bcview().addReadOnly(dialog_->toggleallCB);
bcview().addReadOnly(dialog_->autoapplyCB);
bc().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->familyCO);
bc().addReadOnly(dialog_->seriesCO);
bc().addReadOnly(dialog_->sizeCO);
bc().addReadOnly(dialog_->shapeCO);
bc().addReadOnly(dialog_->miscCO);
bc().addReadOnly(dialog_->langCO);
bc().addReadOnly(dialog_->colorCO);
bc().addReadOnly(dialog_->toggleallCB);
bc().addReadOnly(dialog_->autoapplyCB);
// FIXME: hack to work around resizing bug in Qt >= 4.2
// bug verified with Qt 4.2.{0-3} (JSpitzm)

View File

@ -44,7 +44,7 @@ class GuiCharacter : public GuiView<GuiCharacterDialog>
public:
friend class GuiCharacterDialog;
GuiCharacter(Dialog &);
GuiCharacter(GuiDialog &);
/// parent controller
ControlCharacter & controller()
{ return static_cast<ControlCharacter &>(this->getController()); }

View File

@ -462,7 +462,7 @@ void GuiCitationDialog::changed()
//
///////////////////////////////////////////////////////////////////////
GuiCitation::GuiCitation(Dialog & parent)
GuiCitation::GuiCitation(GuiDialog & parent)
: ControlCitation(parent)
{
}

View File

@ -15,7 +15,7 @@
#ifndef GUICITATION_H
#define GUICITATION_H
#include "Dialog.h"
#include "GuiDialog.h"
#include "GuiSelectionManager.h"
#include "ui_CitationUi.h"
#include "ControlCitation.h"
@ -109,7 +109,7 @@ class GuiCitation : public ControlCitation
{
public:
///
GuiCitation(Dialog &);
GuiCitation(GuiDialog &);
virtual ~GuiCitation() {}
virtual bool initialiseParams(std::string const & data);

View File

@ -58,7 +58,7 @@ QString fix_name(QString const & str, bool big)
} // namespace anon
GuiDelimiter::GuiDelimiter(Dialog & parent)
GuiDelimiter::GuiDelimiter(GuiDialog & parent)
: GuiView<GuiDelimiterDialog>(parent, _("Math Delimiter"))
{}

View File

@ -54,7 +54,7 @@ class GuiDelimiter : public GuiView<GuiDelimiterDialog>
public:
friend class GuiDelimiterDialog;
///
GuiDelimiter(Dialog &);
GuiDelimiter(GuiDialog &);
/// parent controller
ControlMath & controller()
{ return static_cast<ControlMath &>(this->getController()); }

View File

@ -0,0 +1,121 @@
/**
* \file Dialog.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 "GuiDialog.h"
#include "debug.h"
namespace lyx {
namespace frontend {
GuiDialog::GuiDialog(LyXView & lv, std::string const & name)
: Dialog(lv, name)
{}
void GuiDialog::setButtonsValid(bool valid)
{
bc().setValid(valid);
}
void GuiDialog::ApplyButton()
{
apply();
bc().apply();
}
void GuiDialog::OKButton()
{
is_closing_ = true;
apply();
is_closing_ = false;
hide();
bc().ok();
}
void GuiDialog::CancelButton()
{
hide();
bc().cancel();
}
void GuiDialog::RestoreButton()
{
// Tell the kernel that a request to refresh the dialog's contents
// has been received. It's up to the kernel to supply the necessary
// info by calling GuiDialog::update().
kernel().updateDialog(name_);
bc().restore();
}
void GuiDialog::preShow()
{
bc().setReadOnly(kernel().isBufferReadonly());
}
void GuiDialog::postShow()
{
// The widgets may not be valid, so refresh the button controller
bc().refresh();
}
void GuiDialog::preUpdate()
{
bc().setReadOnly(kernel().isBufferReadonly());
}
void GuiDialog::postUpdate()
{
// The widgets may not be valid, so refresh the button controller
bc().refresh();
}
void GuiDialog::checkStatus()
{
// buffer independant dialogs are always active.
// This check allows us leave canApply unimplemented for some dialogs.
if (!controller().isBufferDependent())
return;
// deactivate the dialog if we have no buffer
if (!kernel().isBufferAvailable()) {
bc().setReadOnly(true);
return;
}
// check whether this dialog may be active
if (controller().canApply()) {
bool const readonly = kernel().isBufferReadonly();
bc().setReadOnly(readonly);
// refreshReadOnly() is too generous in _enabling_ widgets
// update dialog to disable disabled widgets again
/*
* FIXME:
if (!readonly || controller().canApplyToReadOnly())
update();
*/
} else {
bc().setReadOnly(true);
}
}
} // namespace frontend
} // namespace lyx

View File

@ -0,0 +1,71 @@
// -*- C++ -*-
/**
* \file GuiDialog.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 GUIDIALOG_H
#define GUIDIALOG_H
#include "Dialog.h"
#include "ButtonController.h"
namespace lyx {
namespace frontend {
/** \c Dialog collects the different parts of a Model-Controller-View
* split of a generic dialog together.
*/
class GuiDialog : public Dialog
{
public:
/// \param lv is the access point for the dialog to the LyX kernel.
/// \param name is the identifier given to the dialog by its parent
/// container.
GuiDialog(LyXView & lv, std::string const & name);
/** \name Buttons
* These methods are publicly accessible because they are invoked
* by the View when the user presses... guess what ;-)
*/
//@{
void ApplyButton();
void OKButton();
void CancelButton();
void RestoreButton();
//@}
/** Check whether we may apply our data.
*
* The buttons are disabled if not and (re-)enabled if yes.
*/
void checkStatus();
void setButtonsValid(bool valid);
/** \name Dialog Components
* Methods to access the various components making up a dialog.
*/
//@{
ButtonController const & bc() const { return bc_; }
ButtonController & bc() { return bc_; }
//@}
void preShow();
void postShow();
void preUpdate();
void postUpdate();
private:
ButtonController bc_;
};
} // namespace frontend
} // namespace lyx
#endif // GUIDIALOG_H

View File

@ -11,23 +11,20 @@
#include <config.h>
#include "GuiDialogView.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "controllers/ButtonController.h"
namespace lyx {
namespace frontend {
GuiDialogView::GuiDialogView(Dialog & parent, docstring const & t)
: Dialog::View(parent,t), updating_(false)
GuiDialogView::GuiDialogView(GuiDialog & parent, docstring const & t)
: Dialog::View(parent, t), updating_(false), parent_(parent)
{}
Qt2BC & GuiDialogView::bcview()
ButtonController & GuiDialogView::bc()
{
return static_cast<Qt2BC &>(dialog().bc().view());
return parent_.bc();
}
@ -45,9 +42,8 @@ bool GuiDialogView::readOnly() const
void GuiDialogView::show()
{
if (!form()) {
if (!form())
build();
}
QSize const sizeHint = form()->sizeHint();
if (sizeHint.height() >= 0 && sizeHint.width() >= 0)
@ -87,37 +83,37 @@ void GuiDialogView::changed()
{
if (updating_)
return;
bc().valid(isValid());
parent_.bc().setValid(isValid());
}
void GuiDialogView::slotWMHide()
{
dialog().CancelButton();
parent_.CancelButton();
}
void GuiDialogView::slotApply()
{
dialog().ApplyButton();
parent_.ApplyButton();
}
void GuiDialogView::slotOK()
{
dialog().OKButton();
parent_.OKButton();
}
void GuiDialogView::slotClose()
{
dialog().CancelButton();
parent_.CancelButton();
}
void GuiDialogView::slotRestore()
{
dialog().RestoreButton();
parent_.RestoreButton();
}
} // namespace frontend

View File

@ -12,7 +12,7 @@
#ifndef GUIDIALOGVIEW_H
#define GUIDIALOGVIEW_H
#include "Dialog.h"
#include "GuiDialog.h"
#include <boost/scoped_ptr.hpp>
@ -23,15 +23,14 @@
namespace lyx {
namespace frontend {
class Qt2BC;
/** This class is an Qt2 GUI base class.
*/
class GuiDialogView : public QObject, public Dialog::View {
class GuiDialogView : public QObject, public Dialog::View
{
Q_OBJECT
public:
///
GuiDialogView(Dialog &, docstring const &);
GuiDialogView(GuiDialog &, docstring const &);
///
virtual ~GuiDialogView() {}
///
@ -41,7 +40,7 @@ public:
virtual void changed();
///
Qt2BC & bcview();
ButtonController & bc();
protected:
/// build the actual dialog
@ -63,6 +62,8 @@ protected:
/// are we updating ?
bool updating_;
GuiDialog & parent_;
public Q_SLOTS:
// dialog closed from WM
void slotWMHide();
@ -87,7 +88,7 @@ private:
template <class GUIDialog>
class GuiView : public GuiDialogView {
protected:
GuiView(Dialog & p, docstring const & t)
GuiView(GuiDialog & p, docstring const & t)
: GuiDialogView(p, t)
{}

View File

@ -15,7 +15,6 @@
#include "FloatPlacement.h"
#include "LengthCombo.h"
#include "PanelStack.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "Validator.h"
@ -41,7 +40,7 @@
#include <QScrollBar>
#include <QTextCursor>
#include <map>
#include <algorithm>
using lyx::support::token;
using lyx::support::bformat;
@ -171,9 +170,18 @@ void PreambleModule::closeEvent(QCloseEvent * e)
//
/////////////////////////////////////////////////////////////////////
template<class Pair>
std::vector<typename Pair::second_type> const
getSecond(std::vector<Pair> const & pr)
{
std::vector<typename Pair::second_type> tmp(pr.size());
std::transform(pr.begin(), pr.end(), tmp.begin(),
boost::bind(&Pair::second, _1));
return tmp;
}
GuiDocumentDialog::GuiDocumentDialog(GuiDocument * form)
: form_(form),
lang_(getSecond(getLanguageData(false)))
: form_(form), lang_(getSecond(getLanguageData(false)))
{
setupUi(this);
@ -186,10 +194,10 @@ GuiDocumentDialog::GuiDocumentDialog(GuiDocument * form)
connect(defaultPB, SIGNAL(clicked()), this, SLOT(useDefaultsClicked()));
// Manage the restore, ok, apply, restore and cancel/close buttons
form_->bcview().setOK(okPB);
form_->bcview().setApply(applyPB);
form_->bcview().setCancel(closePB);
form_->bcview().setRestore(restorePB);
form_->bc().setOK(okPB);
form_->bc().setApply(applyPB);
form_->bc().setCancel(closePB);
form_->bc().setRestore(restorePB);
textLayoutModule = new UiWidget<Ui::TextLayoutUi>;
@ -247,7 +255,7 @@ GuiDocumentDialog::GuiDocumentDialog(GuiDocument * form)
Spacing::Other, qt_("Custom"));
// initialize the length validator
addCheckedLineEdit(form_->bcview(), textLayoutModule->skipLE);
form_->bc().addCheckedLineEdit(textLayoutModule->skipLE);
fontModule = new UiWidget<Ui::FontUi>;
// fonts
@ -337,9 +345,9 @@ GuiDocumentDialog::GuiDocumentDialog(GuiDocument * form)
pageLayoutModule->pagestyleCO->addItem(qt_("plain"));
pageLayoutModule->pagestyleCO->addItem(qt_("headings"));
pageLayoutModule->pagestyleCO->addItem(qt_("fancy"));
addCheckedLineEdit(form_->bcview(), pageLayoutModule->paperheightLE,
form_->bc().addCheckedLineEdit(pageLayoutModule->paperheightLE,
pageLayoutModule->paperheightL);
addCheckedLineEdit(form_->bcview(), pageLayoutModule->paperwidthLE,
form_->bc().addCheckedLineEdit(pageLayoutModule->paperwidthLE,
pageLayoutModule->paperwidthL);
// paper
@ -415,19 +423,19 @@ GuiDocumentDialog::GuiDocumentDialog(GuiDocument * form)
marginsModule->footskipLE->setValidator(unsignedLengthValidator(
marginsModule->footskipLE));
addCheckedLineEdit(form_->bcview(), marginsModule->topLE,
form_->bc().addCheckedLineEdit(marginsModule->topLE,
marginsModule->topL);
addCheckedLineEdit(form_->bcview(), marginsModule->bottomLE,
form_->bc().addCheckedLineEdit(marginsModule->bottomLE,
marginsModule->bottomL);
addCheckedLineEdit(form_->bcview(), marginsModule->innerLE,
form_->bc().addCheckedLineEdit(marginsModule->innerLE,
marginsModule->innerL);
addCheckedLineEdit(form_->bcview(), marginsModule->outerLE,
form_->bc().addCheckedLineEdit(marginsModule->outerLE,
marginsModule->outerL);
addCheckedLineEdit(form_->bcview(), marginsModule->headsepLE,
form_->bc().addCheckedLineEdit(marginsModule->headsepLE,
marginsModule->headsepL);
addCheckedLineEdit(form_->bcview(), marginsModule->headheightLE,
form_->bc().addCheckedLineEdit(marginsModule->headheightLE,
marginsModule->headheightL);
addCheckedLineEdit(form_->bcview(), marginsModule->footskipLE,
form_->bc().addCheckedLineEdit(marginsModule->footskipLE,
marginsModule->footskipL);
@ -509,7 +517,6 @@ GuiDocumentDialog::GuiDocumentDialog(GuiDocument * form)
biblioModule->citeStyleCO->setCurrentIndex(0);
mathsModule = new UiWidget<Ui::MathsUi>;
connect(mathsModule->amsautoCB, SIGNAL(toggled(bool)),
mathsModule->amsCB, SLOT(setDisabled(bool)));
@ -1393,7 +1400,7 @@ void GuiDocumentDialog::updateParams(BufferParams const & params)
/////////////////////////////////////////////////////////////////////
GuiDocument::GuiDocument(Dialog & parent)
GuiDocument::GuiDocument(GuiDialog & parent)
: GuiView<GuiDocumentDialog>(parent, _("Document Settings"))
{}

View File

@ -123,7 +123,7 @@ public:
friend class GuiDocumentDialog;
GuiDocument(Dialog &);
GuiDocument(GuiDialog &);
void showPreamble();
/// parent controller

View File

@ -11,7 +11,7 @@
#include <config.h>
#include "GuiERT.h"
#include "Qt2BC.h"
#include "gettext.h"
#include <QRadioButton>
#include <QPushButton>
@ -58,7 +58,7 @@ void GuiERTDialog::change_adaptor()
//
/////////////////////////////////////////////////////////////////////
GuiERT::GuiERT(Dialog & parent)
GuiERT::GuiERT(GuiDialog & parent)
: GuiView<GuiERTDialog>(parent, _("TeX Code Settings"))
{
}
@ -68,8 +68,8 @@ void GuiERT::build_dialog()
{
dialog_.reset(new GuiERTDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setCancel(dialog_->closePB);
bc().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB);
}

View File

@ -16,7 +16,6 @@
#include "ControlERT.h"
#include "ui_ERTUi.h"
#include <QCloseEvent>
#include <QDialog>
namespace lyx {
@ -42,7 +41,7 @@ class GuiERT : public GuiView<GuiERTDialog>
{
public:
/// constructor
GuiERT(Dialog &);
GuiERT(GuiDialog &);
/// parent controller
ControlERT & controller()
{ return static_cast<ControlERT &>(this->getController()); }

View File

@ -11,8 +11,6 @@
#include <config.h>
#include "GuiEmbeddedFiles.h"
#include "Qt2BC.h"
#include "debug.h"
namespace lyx {

View File

@ -11,7 +11,6 @@
#include <config.h>
#include "GuiErrorList.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include <QListWidget>
@ -69,7 +68,7 @@ void GuiErrorListDialog::showEvent(QShowEvent *e)
/////////////////////////////////////////////////////////////////////
GuiErrorList::GuiErrorList(Dialog & parent)
GuiErrorList::GuiErrorList(GuiDialog & parent)
: GuiView<GuiErrorListDialog>(parent, docstring())
{}
@ -77,7 +76,7 @@ GuiErrorList::GuiErrorList(Dialog & parent)
void GuiErrorList::build_dialog()
{
dialog_.reset(new GuiErrorListDialog(this));
bcview().setCancel(dialog_->closePB);
bc().setCancel(dialog_->closePB);
}

View File

@ -45,7 +45,7 @@ class GuiErrorList : public GuiView<GuiErrorListDialog>
public:
friend class GuiErrorListDialog;
GuiErrorList(Dialog &);
GuiErrorList(GuiDialog &);
/// parent controller
ControlErrorList & controller()
{ return static_cast<ControlErrorList &>(this->getController()); }

View File

@ -14,8 +14,6 @@
#include "lengthcommon.h"
#include "LyXRC.h"
#include "controllers/ButtonController.h"
#include "insets/ExternalTemplate.h"
#include "insets/InsetExternal.h"
@ -25,7 +23,6 @@
#include "support/lyxlib.h"
#include "GuiExternal.h"
#include "Qt2BC.h"
#include "LengthCombo.h"
#include "qt_helpers.h"
@ -485,7 +482,7 @@ void getExtra(external::ExtraData & data,
} // namespace anon
GuiExternal::GuiExternal(Dialog & parent)
GuiExternal::GuiExternal(GuiDialog & parent)
: GuiView<GuiExternalDialog>(parent, _("External Material"))
{}
@ -494,43 +491,43 @@ void GuiExternal::build_dialog()
{
dialog_.reset(new GuiExternalDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setApply(dialog_->applyPB);
bcview().setCancel(dialog_->closePB);
bc().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->fileED);
bcview().addReadOnly(dialog_->browsePB);
bcview().addReadOnly(dialog_->editPB);
bcview().addReadOnly(dialog_->externalCO);
bcview().addReadOnly(dialog_->draftCB);
bcview().addReadOnly(dialog_->displayscaleED);
bcview().addReadOnly(dialog_->showCO);
bcview().addReadOnly(dialog_->displayCB);
bcview().addReadOnly(dialog_->angleED);
bcview().addReadOnly(dialog_->originCO);
bcview().addReadOnly(dialog_->heightUnitCO);
bcview().addReadOnly(dialog_->heightED);
bcview().addReadOnly(dialog_->aspectratioCB);
bcview().addReadOnly(dialog_->widthUnitCO);
bcview().addReadOnly(dialog_->widthED);
bcview().addReadOnly(dialog_->clipCB);
bcview().addReadOnly(dialog_->getbbPB);
bcview().addReadOnly(dialog_->ytED);
bcview().addReadOnly(dialog_->xlED);
bcview().addReadOnly(dialog_->xrED);
bcview().addReadOnly(dialog_->ybED);
bcview().addReadOnly(dialog_->extraFormatCO);
bcview().addReadOnly(dialog_->extraED);
bc().addReadOnly(dialog_->fileED);
bc().addReadOnly(dialog_->browsePB);
bc().addReadOnly(dialog_->editPB);
bc().addReadOnly(dialog_->externalCO);
bc().addReadOnly(dialog_->draftCB);
bc().addReadOnly(dialog_->displayscaleED);
bc().addReadOnly(dialog_->showCO);
bc().addReadOnly(dialog_->displayCB);
bc().addReadOnly(dialog_->angleED);
bc().addReadOnly(dialog_->originCO);
bc().addReadOnly(dialog_->heightUnitCO);
bc().addReadOnly(dialog_->heightED);
bc().addReadOnly(dialog_->aspectratioCB);
bc().addReadOnly(dialog_->widthUnitCO);
bc().addReadOnly(dialog_->widthED);
bc().addReadOnly(dialog_->clipCB);
bc().addReadOnly(dialog_->getbbPB);
bc().addReadOnly(dialog_->ytED);
bc().addReadOnly(dialog_->xlED);
bc().addReadOnly(dialog_->xrED);
bc().addReadOnly(dialog_->ybED);
bc().addReadOnly(dialog_->extraFormatCO);
bc().addReadOnly(dialog_->extraED);
addCheckedLineEdit(bcview(), dialog_->angleED, dialog_->angleLA);
addCheckedLineEdit(bcview(), dialog_->displayscaleED, dialog_->scaleLA);
addCheckedLineEdit(bcview(), dialog_->heightED, dialog_->heightLA);
addCheckedLineEdit(bcview(), dialog_->widthED, dialog_->widthLA);
addCheckedLineEdit(bcview(), dialog_->xlED, dialog_->lbLA);
addCheckedLineEdit(bcview(), dialog_->ybED, dialog_->lbLA);
addCheckedLineEdit(bcview(), dialog_->xrED, dialog_->rtLA);
addCheckedLineEdit(bcview(), dialog_->ytED, dialog_->rtLA);
addCheckedLineEdit(bcview(), dialog_->fileED, dialog_->fileLA);
bc().addCheckedLineEdit(dialog_->angleED, dialog_->angleLA);
bc().addCheckedLineEdit(dialog_->displayscaleED, dialog_->scaleLA);
bc().addCheckedLineEdit(dialog_->heightED, dialog_->heightLA);
bc().addCheckedLineEdit(dialog_->widthED, dialog_->widthLA);
bc().addCheckedLineEdit(dialog_->xlED, dialog_->lbLA);
bc().addCheckedLineEdit(dialog_->ybED, dialog_->lbLA);
bc().addCheckedLineEdit(dialog_->xrED, dialog_->rtLA);
bc().addCheckedLineEdit(dialog_->ytED, dialog_->rtLA);
bc().addCheckedLineEdit(dialog_->fileED, dialog_->fileLA);
std::vector<string> templates(controller().getTemplates());

View File

@ -58,7 +58,7 @@ class GuiExternal : public GuiView<GuiExternalDialog>
public:
friend class GuiExternalDialog;
GuiExternal(Dialog &);
GuiExternal(GuiDialog &);
/// parent controller
ControlExternal & controller()
{ return static_cast<ControlExternal &>(this->getController()); }

View File

@ -11,7 +11,6 @@
#include <config.h>
#include "GuiFloat.h"
#include "Qt2BC.h"
#include "FloatPlacement.h"
#include "insets/InsetFloat.h"
@ -59,7 +58,7 @@ void GuiFloatDialog::closeEvent(QCloseEvent * e)
}
GuiFloat::GuiFloat(Dialog & parent)
GuiFloat::GuiFloat(GuiDialog & parent)
: GuiView<GuiFloatDialog>(parent, _("Float Settings"))
{
}
@ -69,12 +68,12 @@ void GuiFloat::build_dialog()
{
dialog_.reset(new GuiFloatDialog(this));
bcview().setCancel(dialog_->closePB);
bcview().setApply(dialog_->applyPB);
bcview().setOK(dialog_->okPB);
bcview().setRestore(dialog_->restorePB);
bc().setCancel(dialog_->closePB);
bc().setApply(dialog_->applyPB);
bc().setOK(dialog_->okPB);
bc().setRestore(dialog_->restorePB);
bcview().addReadOnly(dialog_->floatFP);
bc().addReadOnly(dialog_->floatFP);
}

View File

@ -45,7 +45,7 @@ public:
///
friend class GuiFloatDialog;
///
GuiFloat(Dialog &);
GuiFloat(GuiDialog &);
/// parent controller
ControlFloat & controller()
{ return static_cast<ControlFloat &>(this->getController()); }

View File

@ -19,7 +19,6 @@
#include "LengthCombo.h"
#include "lengthcommon.h"
#include "LyXRC.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "Validator.h"
@ -32,10 +31,6 @@
#include "support/lyxlib.h"
#include "support/os.h"
#include <cmath>
#include "insets/InsetGraphicsParams.h"
#include <QCheckBox>
#include <QCloseEvent>
#include <QLabel>
@ -43,6 +38,8 @@
#include <QPushButton>
#include <QValidator>
#include <algorithm>
#include <cmath>
using lyx::support::float_equal;
using lyx::support::token;
@ -61,6 +58,16 @@ namespace lyx {
namespace frontend {
template<class Pair>
std::vector<typename Pair::first_type> const
getFirst(std::vector<Pair> const & pr)
{
std::vector<typename Pair::first_type> tmp(pr.size());
std::transform(pr.begin(), pr.end(), tmp.begin(),
boost::bind(&Pair::first, _1));
return tmp;
}
GuiGraphicsDialog::GuiGraphicsDialog(GuiGraphics * form)
: form_(form)
{
@ -329,7 +336,7 @@ void GuiGraphicsDialog::on_angle_textChanged(const QString & filename)
}
GuiGraphics::GuiGraphics(Dialog & parent)
GuiGraphics::GuiGraphics(GuiDialog & parent)
: GuiView<GuiGraphicsDialog>(parent, _("Graphics"))
{
}
@ -339,39 +346,39 @@ void GuiGraphics::build_dialog()
{
dialog_.reset(new GuiGraphicsDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setApply(dialog_->applyPB);
bcview().setRestore(dialog_->restorePB);
bcview().setCancel(dialog_->closePB);
bc().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB);
bc().setRestore(dialog_->restorePB);
bc().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->latexoptions);
bcview().addReadOnly(dialog_->subfigure);
bcview().addReadOnly(dialog_->filenameL);
bcview().addReadOnly(dialog_->filename);
bcview().addReadOnly(dialog_->browsePB);
bcview().addReadOnly(dialog_->unzipCB);
bcview().addReadOnly(dialog_->bbFrame);
bcview().addReadOnly(dialog_->draftCB);
bcview().addReadOnly(dialog_->clip);
bcview().addReadOnly(dialog_->unzipCB);
bcview().addReadOnly(dialog_->displayGB);
bcview().addReadOnly(dialog_->sizeGB);
bcview().addReadOnly(dialog_->rotationGB);
bcview().addReadOnly(dialog_->latexoptions);
bcview().addReadOnly(dialog_->getPB);
bcview().addReadOnly(dialog_->rotateOrderCB);
bc().addReadOnly(dialog_->latexoptions);
bc().addReadOnly(dialog_->subfigure);
bc().addReadOnly(dialog_->filenameL);
bc().addReadOnly(dialog_->filename);
bc().addReadOnly(dialog_->browsePB);
bc().addReadOnly(dialog_->unzipCB);
bc().addReadOnly(dialog_->bbFrame);
bc().addReadOnly(dialog_->draftCB);
bc().addReadOnly(dialog_->clip);
bc().addReadOnly(dialog_->unzipCB);
bc().addReadOnly(dialog_->displayGB);
bc().addReadOnly(dialog_->sizeGB);
bc().addReadOnly(dialog_->rotationGB);
bc().addReadOnly(dialog_->latexoptions);
bc().addReadOnly(dialog_->getPB);
bc().addReadOnly(dialog_->rotateOrderCB);
// initialize the length validator
addCheckedLineEdit(bcview(), dialog_->Scale, dialog_->scaleCB);
addCheckedLineEdit(bcview(), dialog_->Width, dialog_->WidthCB);
addCheckedLineEdit(bcview(), dialog_->Height, dialog_->HeightCB);
addCheckedLineEdit(bcview(), dialog_->displayscale, dialog_->scaleLA);
addCheckedLineEdit(bcview(), dialog_->angle, dialog_->angleL);
addCheckedLineEdit(bcview(), dialog_->lbX, dialog_->xL);
addCheckedLineEdit(bcview(), dialog_->lbY, dialog_->yL);
addCheckedLineEdit(bcview(), dialog_->rtX, dialog_->xL_2);
addCheckedLineEdit(bcview(), dialog_->rtY, dialog_->yL_2);
addCheckedLineEdit(bcview(), dialog_->filename, dialog_->filenameL);
bc().addCheckedLineEdit(dialog_->Scale, dialog_->scaleCB);
bc().addCheckedLineEdit(dialog_->Width, dialog_->WidthCB);
bc().addCheckedLineEdit(dialog_->Height, dialog_->HeightCB);
bc().addCheckedLineEdit(dialog_->displayscale, dialog_->scaleLA);
bc().addCheckedLineEdit(dialog_->angle, dialog_->angleL);
bc().addCheckedLineEdit(dialog_->lbX, dialog_->xL);
bc().addCheckedLineEdit(dialog_->lbY, dialog_->yL);
bc().addCheckedLineEdit(dialog_->rtX, dialog_->xL_2);
bc().addCheckedLineEdit(dialog_->rtY, dialog_->yL_2);
bc().addCheckedLineEdit(dialog_->filename, dialog_->filenameL);
}
@ -383,6 +390,16 @@ static int getItemNo(const vector<string> & v, string const & s)
return (cit != v.end()) ? int(cit - v.begin()) : 0;
}
template<class Pair>
std::vector<typename Pair::second_type> const
getSecond(std::vector<Pair> const & pr)
{
std::vector<typename Pair::second_type> tmp(pr.size());
std::transform(pr.begin(), pr.end(), tmp.begin(),
boost::bind(&Pair::second, _1));
return tmp;
}
void GuiGraphics::update_contents()
{

View File

@ -59,7 +59,7 @@ public:
///
friend class GuiGraphicsDialog;
///
GuiGraphics(Dialog &);
GuiGraphics(GuiDialog &);
/// parent controller
ControlGraphics & controller()
{ return static_cast<ControlGraphics &>(this->getController()); }

View File

@ -15,7 +15,6 @@
#include "GuiInclude.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "LyXRC.h"
@ -184,7 +183,7 @@ void GuiIncludeDialog::browseClicked()
/////////////////////////////////////////////////////////////////////
GuiInclude::GuiInclude(Dialog & parent)
GuiInclude::GuiInclude(GuiDialog & parent)
: GuiView<GuiIncludeDialog>(parent, _("Child Document"))
{}
@ -193,15 +192,15 @@ void GuiInclude::build_dialog()
{
dialog_.reset(new GuiIncludeDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->filenameED);
bcview().addReadOnly(dialog_->browsePB);
bcview().addReadOnly(dialog_->visiblespaceCB);
bcview().addReadOnly(dialog_->typeCO);
bcview().addReadOnly(dialog_->listingsED);
bc().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->filenameED);
bc().addReadOnly(dialog_->browsePB);
bc().addReadOnly(dialog_->visiblespaceCB);
bc().addReadOnly(dialog_->typeCO);
bc().addReadOnly(dialog_->listingsED);
addCheckedLineEdit(bcview(), dialog_->filenameED, dialog_->filenameLA);
bc().addCheckedLineEdit(dialog_->filenameED, dialog_->filenameLA);
}

View File

@ -56,7 +56,7 @@ public:
///
friend class GuiIncludeDialog;
///
GuiInclude(Dialog &);
GuiInclude(GuiDialog &);
/// parent controller
ControlInclude & controller()
{ return static_cast<ControlInclude &>(this->getController()); }

View File

@ -10,13 +10,11 @@
#include <config.h>
#include "GuiIndex.h"
#include "debug.h"
#include "qt_helpers.h"
#include "GuiIndex.h"
#include "Qt2BC.h"
#include "ButtonController.h"
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
@ -90,7 +88,8 @@ void GuiIndexDialog::closeEvent(QCloseEvent * e)
/////////////////////////////////////////////////////////////////////
GuiIndex::GuiIndex(Dialog & parent, docstring const & title, QString const & label)
GuiIndex::GuiIndex(GuiDialog & parent, docstring const & title,
QString const & label)
: GuiView<GuiIndexDialog>(parent, title), label_(label)
{
}
@ -102,9 +101,9 @@ void GuiIndex::build_dialog()
dialog_->keywordLA->setText(label_);
bcview().setOK(dialog_->okPB);
bcview().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->keywordED);
bc().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->keywordED);
}
@ -113,7 +112,7 @@ void GuiIndex::update_contents()
docstring const contents = controller().params()["name"];
dialog_->keywordED->setText(toqstr(contents));
bc().valid(!contents.empty());
bc().setValid(!contents.empty());
}

View File

@ -44,7 +44,7 @@ class GuiIndex : public GuiView<GuiIndexDialog>
public:
friend class GuiIndexDialog;
GuiIndex(Dialog &, docstring const & title, QString const & label);
GuiIndex(GuiDialog &, docstring const & title, QString const & label);
/// parent controller
ControlCommand & controller()
{ return static_cast<ControlCommand &>(this->getController()); }

View File

@ -12,7 +12,6 @@
#include <config.h>
#include "GuiListings.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "insets/InsetListingsParams.h"
#include "debug.h"
@ -408,7 +407,7 @@ void GuiListingsDialog::on_languageCO_currentIndexChanged(int index)
/////////////////////////////////////////////////////////////////////
GuiListings::GuiListings(Dialog & parent)
GuiListings::GuiListings(GuiDialog & parent)
: GuiView<GuiListingsDialog>(parent, _("Program Listing Settings"))
{
}
@ -418,9 +417,9 @@ void GuiListings::build_dialog()
{
dialog_.reset(new GuiListingsDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setApply(dialog_->applyPB);
bcview().setCancel(dialog_->closePB);
bc().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB);
dialog_->listingsTB->setPlainText(
qt_("Input listing parameters on the right. Enter ? for a list of parameters."));

View File

@ -57,7 +57,7 @@ class GuiListings : public GuiView<GuiListingsDialog> {
public:
friend class GuiListingsDialog;
GuiListings(Dialog &);
GuiListings(GuiDialog &);
/// parent controller
ControlListings & controller()
{ return static_cast<ControlListings &>(this->getController()); }

View File

@ -107,7 +107,7 @@ void LogHighlighter::highlightBlock(QString const & text)
/////////////////////////////////////////////////////////////////////
GuiLog::GuiLog(Dialog & parent)
GuiLog::GuiLog(GuiDialog & parent)
: GuiView<GuiLogDialog>(parent, docstring())
{}

View File

@ -47,7 +47,7 @@ public:
///
friend class GuiLogDialog;
///
GuiLog(Dialog &);
GuiLog(GuiDialog &);
/// parent controller
ControlLog & controller()
{ return static_cast<ControlLog &>(this->getController()); }

View File

@ -28,7 +28,7 @@ using std::string;
namespace lyx {
namespace frontend {
GuiMathMatrix::GuiMathMatrix(Dialog & parent)
GuiMathMatrix::GuiMathMatrix(GuiDialog & parent)
: GuiView<GuiMathMatrixDialog>(parent, _("Math Matrix"))
{}

View File

@ -47,7 +47,7 @@ class GuiMathMatrix : public GuiView<GuiMathMatrixDialog> {
public:
friend class GuiMathMatrixDialog;
GuiMathMatrix(Dialog &);
GuiMathMatrix(GuiDialog &);
/// parent controller
ControlMath & controller()
{ return static_cast<ControlMath &>(this->getController()); }

View File

@ -11,14 +11,12 @@
#include <config.h>
#include "GuiNomencl.h"
#include "debug.h"
#include "ControlCommand.h"
#include "qt_helpers.h"
#include "GuiNomencl.h"
#include "Qt2BC.h"
#include "ButtonController.h"
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
@ -85,7 +83,7 @@ void GuiNomenclDialog::closeEvent(QCloseEvent * e)
/////////////////////////////////////////////////////////////////////
GuiNomencl::GuiNomencl(Dialog & parent, docstring const & title)
GuiNomencl::GuiNomencl(GuiDialog & parent, docstring const & title)
: GuiView<GuiNomenclDialog>(parent, title)
{
}
@ -95,11 +93,11 @@ void GuiNomencl::build_dialog()
{
dialog_.reset(new GuiNomenclDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->symbolED);
bcview().addReadOnly(dialog_->descriptionTE);
bcview().addReadOnly(dialog_->prefixED);
bc().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->symbolED);
bc().addReadOnly(dialog_->descriptionTE);
bc().addReadOnly(dialog_->prefixED);
}
@ -111,7 +109,7 @@ void GuiNomencl::update_contents()
description.replace("\\\\","\n");
dialog_->descriptionTE->setPlainText(description);
bc().valid(isValid());
bc().setValid(isValid());
}

View File

@ -26,7 +26,8 @@ namespace frontend {
class GuiNomencl;
class GuiNomenclDialog : public QDialog, public Ui::NomenclUi {
class GuiNomenclDialog : public QDialog, public Ui::NomenclUi
{
Q_OBJECT
public:
GuiNomenclDialog(GuiNomencl * form);
@ -46,7 +47,7 @@ class GuiNomencl : public GuiView<GuiNomenclDialog>
public:
friend class GuiNomenclDialog;
GuiNomencl(Dialog &, docstring const & title);
GuiNomencl(GuiDialog &, docstring const & title);
/// parent controller
ControlCommand & controller()
{ return static_cast<ControlCommand &>(this->getController()); }

View File

@ -11,7 +11,6 @@
#include <config.h>
#include "GuiNote.h"
#include "Qt2BC.h"
#include "insets/InsetNote.h"
@ -62,7 +61,7 @@ void GuiNoteDialog::change_adaptor()
/////////////////////////////////////////////////////////////////////
GuiNote::GuiNote(Dialog & parent)
GuiNote::GuiNote(GuiDialog & parent)
: GuiView<GuiNoteDialog>(parent, _("Note Settings"))
{}
@ -71,8 +70,8 @@ void GuiNote::build_dialog()
{
dialog_.reset(new GuiNoteDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setCancel(dialog_->closePB);
bc().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB);
}

View File

@ -45,7 +45,7 @@ public:
friend class GuiNoteDialog;
/// Constructor
GuiNote(Dialog &);
GuiNote(GuiDialog &);
/// parent controller
ControlNote & controller()
{ return static_cast<ControlNote &>(this->getController()); }

View File

@ -12,13 +12,12 @@
#include <config.h>
#include "GuiParagraph.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "debug.h"
#include "ParagraphParameters.h"
#include "Spacing.h"
#include "frontend_helpers.h"
#include "ParagraphParameters.h"
#include "qt_helpers.h"
#include "Spacing.h"
#include <QCheckBox>
#include <QCloseEvent>
@ -163,7 +162,7 @@ LyXAlignment GuiParagraphDialog::getAlignmentFromDialog()
/////////////////////////////////////////////////////////////////////
GuiParagraph::GuiParagraph(Dialog & parent)
GuiParagraph::GuiParagraph(GuiDialog & parent)
: GuiView<GuiParagraphDialog>(parent, _("Paragraph Settings"))
{}
@ -174,10 +173,10 @@ void GuiParagraph::build_dialog()
dialog_.reset(new GuiParagraphDialog(this));
// Manage the ok, apply, restore and cancel/close buttons
bcview().setOK(dialog_->okPB);
bcview().setApply(dialog_->applyPB);
bcview().setCancel(dialog_->closePB);
bcview().setRestore(dialog_->restorePB);
bc().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB);
bc().setRestore(dialog_->restorePB);
}

View File

@ -59,7 +59,7 @@ class GuiParagraph : public GuiView<GuiParagraphDialog>
public:
friend class GuiParagraphDialog;
GuiParagraph(Dialog &);
GuiParagraph(GuiDialog &);
/// parent controller
ControlParagraph & controller()
{ return static_cast<ControlParagraph &>(this->getController()); }

View File

@ -12,7 +12,6 @@
#include "GuiPrefs.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "GuiApplication.h"
@ -45,8 +44,11 @@
#include <QCloseEvent>
#include <boost/tuple/tuple.hpp>
#include <boost/bind.hpp>
#include <iomanip>
#include <sstream>
#include <algorithm>
using namespace Ui;
@ -1571,6 +1573,17 @@ void PrefFileformats::remove_format()
//
/////////////////////////////////////////////////////////////////////
template<class Pair>
std::vector<typename Pair::second_type> const
getSecond(std::vector<Pair> const & pr)
{
std::vector<typename Pair::second_type> tmp(pr.size());
std::transform(pr.begin(), pr.end(), tmp.begin(),
boost::bind(&Pair::second, _1));
return tmp;
}
PrefLanguage::PrefLanguage(QWidget * parent)
: PrefModule(_("Language"), 0, parent)
{
@ -1946,10 +1959,10 @@ GuiPrefsDialog::GuiPrefsDialog(GuiPrefs * form)
prefsPS->updateGeometry();
#endif
form_->bcview().setOK(savePB);
form_->bcview().setApply(applyPB);
form_->bcview().setCancel(closePB);
form_->bcview().setRestore(restorePB);
form_->bc().setOK(savePB);
form_->bc().setApply(applyPB);
form_->bc().setCancel(closePB);
form_->bc().setRestore(restorePB);
}
@ -2000,7 +2013,7 @@ void GuiPrefsDialog::updateRc(LyXRC const & rc)
/////////////////////////////////////////////////////////////////////
GuiPrefs::GuiPrefs(Dialog & parent)
GuiPrefs::GuiPrefs(GuiDialog & parent)
: GuiView<GuiPrefsDialog>(parent, _("Preferences"))
{
}

View File

@ -361,7 +361,7 @@ private:
class GuiPrefs : public GuiView<GuiPrefsDialog>
{
public:
GuiPrefs(Dialog &);
GuiPrefs(GuiDialog &);
Converters & converters();
Formats & formats();

View File

@ -12,9 +12,8 @@
#include <config.h>
#include "GuiPrint.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "qt_helpers.h"
#include "PrinterParams.h"
#include "support/os.h"
@ -104,7 +103,7 @@ void GuiPrintDialog::pagerangeChanged()
}
GuiPrint::GuiPrint(Dialog & parent)
GuiPrint::GuiPrint(GuiDialog & parent)
: GuiView<GuiPrintDialog>(parent, _("Print Document"))
{
}
@ -114,8 +113,8 @@ void GuiPrint::build_dialog()
{
dialog_.reset(new GuiPrintDialog(this));
bcview().setOK(dialog_->printPB);
bcview().setCancel(dialog_->closePB);
bc().setOK(dialog_->printPB);
bc().setCancel(dialog_->closePB);
}

View File

@ -46,7 +46,7 @@ public:
///
friend class GuiPrintDialog;
///
GuiPrint(Dialog &);
GuiPrint(GuiDialog &);
/// parent controller
ControlPrint & controller()
{ return static_cast<ControlPrint &>(this->getController()); }

View File

@ -12,11 +12,8 @@
#include <config.h>
#include "GuiRef.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "ButtonController.h"
#include "insets/InsetRef.h"
#include <QLineEdit>
@ -181,7 +178,7 @@ void GuiRefDialog::closeEvent(QCloseEvent * e)
/////////////////////////////////////////////////////////////////////
GuiRef::GuiRef(Dialog & parent)
GuiRef::GuiRef(GuiDialog & parent)
: GuiView<GuiRefDialog>(parent, _("Cross-reference")),
sort_(false), at_ref_(false)
{
@ -192,15 +189,15 @@ void GuiRef::build_dialog()
{
dialog_.reset(new GuiRefDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setApply(dialog_->applyPB);
bcview().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->refsLW);
bcview().addReadOnly(dialog_->sortCB);
bcview().addReadOnly(dialog_->nameED);
bcview().addReadOnly(dialog_->referenceED);
bcview().addReadOnly(dialog_->typeCO);
bcview().addReadOnly(dialog_->bufferCO);
bc().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->refsLW);
bc().addReadOnly(dialog_->sortCB);
bc().addReadOnly(dialog_->nameED);
bc().addReadOnly(dialog_->referenceED);
bc().addReadOnly(dialog_->typeCO);
bc().addReadOnly(dialog_->bufferCO);
restored_buffer_ = -1;
}
@ -243,7 +240,7 @@ void GuiRef::update_contents()
dialog_->bufferCO->setCurrentIndex(controller().getBufferNum());
updateRefs();
bc().valid(false);
bc().setValid(false);
}

View File

@ -57,7 +57,7 @@ class GuiRef : public GuiView<GuiRefDialog>
public:
friend class GuiRefDialog;
GuiRef(Dialog &);
GuiRef(GuiDialog &);
/// parent controller
ControlRef & controller()

View File

@ -13,7 +13,6 @@
#include "GuiSearch.h"
#include "qt_helpers.h"
#include "Qt2BC.h"
#include <QLineEdit>
#include <QCloseEvent>
@ -130,7 +129,7 @@ void GuiSearchDialog::replaceallClicked()
/////////////////////////////////////////////////////////////////////
GuiSearch::GuiSearch(Dialog & parent)
GuiSearch::GuiSearch(GuiDialog & parent)
: GuiView<GuiSearchDialog>(parent, _("Find and Replace"))
{
}
@ -140,10 +139,10 @@ void GuiSearch::build_dialog()
{
dialog_.reset(new GuiSearchDialog(this));
bcview().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->replaceCO);
bcview().addReadOnly(dialog_->replacePB);
bcview().addReadOnly(dialog_->replaceallPB);
bc().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->replaceCO);
bc().addReadOnly(dialog_->replacePB);
bc().addReadOnly(dialog_->replaceallPB);
dialog_->replacePB->setEnabled(false);
dialog_->replaceallPB->setEnabled(false);

View File

@ -50,7 +50,7 @@ public:
///
friend class GuiSearchDialog;
///
GuiSearch(Dialog &);
GuiSearch(GuiDialog &);
/// parent controller
ControlSearch & controller()
{ return static_cast<ControlSearch &>(this->getController()); }

View File

@ -11,7 +11,6 @@
#include <config.h>
#include "GuiSendto.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "Format.h"
@ -76,7 +75,7 @@ void GuiSendtoDialog::closeEvent(QCloseEvent * e)
/////////////////////////////////////////////////////////////////////
GuiSendto::GuiSendto(Dialog & parent)
GuiSendto::GuiSendto(GuiDialog & parent)
: GuiView<GuiSendtoDialog>(parent, _("Send Document to Command"))
{
}
@ -87,9 +86,9 @@ void GuiSendto::build_dialog()
dialog_.reset(new GuiSendtoDialog(this));
// Manage the ok, apply, restore and cancel/close buttons
bcview().setOK(dialog_->okPB);
bcview().setApply(dialog_->applyPB);
bcview().setCancel(dialog_->closePB);
bc().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB);
}

View File

@ -53,7 +53,7 @@ public:
///
friend class GuiSendtoDialog;
///
GuiSendto(Dialog &);
GuiSendto(GuiDialog &);
/// parent controller
ControlSendto & controller()
{ return static_cast<ControlSendto &>(this->getController()); }

View File

@ -11,7 +11,6 @@
#include <config.h>
#include "GuiShowFile.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include <QTextBrowser>
@ -49,7 +48,7 @@ void GuiShowFileDialog::closeEvent(QCloseEvent * e)
/////////////////////////////////////////////////////////////////////
GuiShowFile::GuiShowFile(Dialog & parent)
GuiShowFile::GuiShowFile(GuiDialog & parent)
: GuiView<GuiShowFileDialog>(parent, _("Show File"))
{
}
@ -59,7 +58,7 @@ void GuiShowFile::build_dialog()
{
dialog_.reset(new GuiShowFileDialog(this));
bcview().setCancel(dialog_->closePB);
bc().setCancel(dialog_->closePB);
}

View File

@ -41,7 +41,7 @@ class GuiShowFile : public GuiView<GuiShowFileDialog>
public:
friend class GuiShowFileDialog;
GuiShowFile(Dialog &);
GuiShowFile(GuiDialog &);
/// parent controller
ControlShowFile & controller()
{ return static_cast<ControlShowFile &>(this->getController()); }

View File

@ -11,7 +11,6 @@
#include <config.h>
#include "GuiSpellchecker.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include <QProgressBar>
@ -127,7 +126,7 @@ void GuiSpellcheckerDialog::reject()
/////////////////////////////////////////////////////////////////////
GuiSpellchecker::GuiSpellchecker(Dialog & parent)
GuiSpellchecker::GuiSpellchecker(GuiDialog & parent)
: GuiView<GuiSpellcheckerDialog>(parent, _("Spellchecker"))
{}
@ -136,7 +135,7 @@ void GuiSpellchecker::build_dialog()
{
dialog_.reset(new GuiSpellcheckerDialog(this));
bcview().setCancel(dialog_->closePB);
bc().setCancel(dialog_->closePB);
dialog_->wordED->setReadOnly(true);
}

View File

@ -55,7 +55,7 @@ class GuiSpellchecker : public GuiView<GuiSpellcheckerDialog>
public:
friend class GuiSpellcheckerDialog;
GuiSpellchecker(Dialog &);
GuiSpellchecker(GuiDialog &);
/// update from controller
void partialUpdate(int id);

View File

@ -15,14 +15,10 @@
#include "GuiTabular.h"
#include "GuiSetBorder.h"
#include "Qt2BC.h"
#include "LengthCombo.h"
#include "Validator.h"
#include "qt_helpers.h"
#include "controllers/ButtonController.h"
#include "support/convert.h"
#include <QCloseEvent>
@ -516,7 +512,7 @@ void GuiTabularDialog::ltLastFooterEmpty_clicked()
/////////////////////////////////////////////////////////////////////
GuiTabular::GuiTabular(Dialog & parent)
GuiTabular::GuiTabular(GuiDialog & parent)
: GuiView<GuiTabularDialog>(parent, _("Table Settings"))
{
}
@ -526,57 +522,53 @@ void GuiTabular::build_dialog()
{
dialog_.reset(new GuiTabularDialog(this));
bcview().setCancel(dialog_->closePB);
bc().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->topspaceED);
bcview().addReadOnly(dialog_->topspaceUnit);
bcview().addReadOnly(dialog_->topspaceCO);
bcview().addReadOnly(dialog_->bottomspaceED);
bcview().addReadOnly(dialog_->bottomspaceUnit);
bcview().addReadOnly(dialog_->bottomspaceCO);
bcview().addReadOnly(dialog_->interlinespaceED);
bcview().addReadOnly(dialog_->interlinespaceUnit);
bcview().addReadOnly(dialog_->interlinespaceCO);
bcview().addReadOnly(dialog_->borderDefaultRB);
bcview().addReadOnly(dialog_->booktabsRB);
bc().addReadOnly(dialog_->topspaceED);
bc().addReadOnly(dialog_->topspaceUnit);
bc().addReadOnly(dialog_->topspaceCO);
bc().addReadOnly(dialog_->bottomspaceED);
bc().addReadOnly(dialog_->bottomspaceUnit);
bc().addReadOnly(dialog_->bottomspaceCO);
bc().addReadOnly(dialog_->interlinespaceED);
bc().addReadOnly(dialog_->interlinespaceUnit);
bc().addReadOnly(dialog_->interlinespaceCO);
bc().addReadOnly(dialog_->borderDefaultRB);
bc().addReadOnly(dialog_->booktabsRB);
bcview().addReadOnly(dialog_->multicolumnCB);
bcview().addReadOnly(dialog_->rotateCellCB);
bcview().addReadOnly(dialog_->rotateTabularCB);
bcview().addReadOnly(dialog_->specialAlignmentED);
bcview().addReadOnly(dialog_->widthED);
bcview().addReadOnly(dialog_->widthUnit);
bcview().addReadOnly(dialog_->hAlignCB);
bcview().addReadOnly(dialog_->vAlignCB);
bcview().addReadOnly(dialog_->borderSetPB);
bcview().addReadOnly(dialog_->borderUnsetPB);
bcview().addReadOnly(dialog_->borders);
bcview().addReadOnly(dialog_->longTabularCB);
bcview().addReadOnly(dialog_->headerStatusCB);
bcview().addReadOnly(dialog_->headerBorderAboveCB);
bcview().addReadOnly(dialog_->headerBorderBelowCB);
bcview().addReadOnly(dialog_->firstheaderStatusCB);
bcview().addReadOnly(dialog_->firstheaderBorderAboveCB);
bcview().addReadOnly(dialog_->firstheaderBorderBelowCB);
bcview().addReadOnly(dialog_->firstheaderNoContentsCB);
bcview().addReadOnly(dialog_->footerStatusCB);
bcview().addReadOnly(dialog_->footerBorderAboveCB);
bcview().addReadOnly(dialog_->footerBorderBelowCB);
bcview().addReadOnly(dialog_->lastfooterStatusCB);
bcview().addReadOnly(dialog_->lastfooterBorderAboveCB);
bcview().addReadOnly(dialog_->lastfooterBorderBelowCB);
bcview().addReadOnly(dialog_->lastfooterNoContentsCB);
bcview().addReadOnly(dialog_->newpageCB);
bc().addReadOnly(dialog_->multicolumnCB);
bc().addReadOnly(dialog_->rotateCellCB);
bc().addReadOnly(dialog_->rotateTabularCB);
bc().addReadOnly(dialog_->specialAlignmentED);
bc().addReadOnly(dialog_->widthED);
bc().addReadOnly(dialog_->widthUnit);
bc().addReadOnly(dialog_->hAlignCB);
bc().addReadOnly(dialog_->vAlignCB);
bc().addReadOnly(dialog_->borderSetPB);
bc().addReadOnly(dialog_->borderUnsetPB);
bc().addReadOnly(dialog_->borders);
bc().addReadOnly(dialog_->longTabularCB);
bc().addReadOnly(dialog_->headerStatusCB);
bc().addReadOnly(dialog_->headerBorderAboveCB);
bc().addReadOnly(dialog_->headerBorderBelowCB);
bc().addReadOnly(dialog_->firstheaderStatusCB);
bc().addReadOnly(dialog_->firstheaderBorderAboveCB);
bc().addReadOnly(dialog_->firstheaderBorderBelowCB);
bc().addReadOnly(dialog_->firstheaderNoContentsCB);
bc().addReadOnly(dialog_->footerStatusCB);
bc().addReadOnly(dialog_->footerBorderAboveCB);
bc().addReadOnly(dialog_->footerBorderBelowCB);
bc().addReadOnly(dialog_->lastfooterStatusCB);
bc().addReadOnly(dialog_->lastfooterBorderAboveCB);
bc().addReadOnly(dialog_->lastfooterBorderBelowCB);
bc().addReadOnly(dialog_->lastfooterNoContentsCB);
bc().addReadOnly(dialog_->newpageCB);
// initialize the length validator
addCheckedLineEdit(bcview(), dialog_->widthED,
dialog_->fixedWidthColLA);
addCheckedLineEdit(bcview(), dialog_->topspaceED,
dialog_->topspaceLA);
addCheckedLineEdit(bcview(), dialog_->bottomspaceED,
dialog_->bottomspaceLA);
addCheckedLineEdit(bcview(), dialog_->interlinespaceED,
dialog_->interlinespaceLA);
bc().addCheckedLineEdit(dialog_->widthED, dialog_->fixedWidthColLA);
bc().addCheckedLineEdit(dialog_->topspaceED, dialog_->topspaceLA);
bc().addCheckedLineEdit(dialog_->bottomspaceED, dialog_->bottomspaceLA);
bc().addCheckedLineEdit(dialog_->interlinespaceED, dialog_->interlinespaceLA);
}
@ -668,7 +660,8 @@ void GuiTabular::update_contents()
bool const isReadonly = bc().policy().isReadOnly();
dialog_->specialAlignmentED->setEnabled(!isReadonly);
Length::UNIT default_unit = controller().useMetricUnits() ? Length::CM : Length::IN;
Length::UNIT default_unit =
controller().useMetricUnits() ? Length::CM : Length::IN;
dialog_->borderDefaultRB->setChecked(!tabular.useBookTabs());
dialog_->booktabsRB->setChecked(tabular.useBookTabs());

View File

@ -83,7 +83,7 @@ class GuiTabular : public GuiView<GuiTabularDialog>
public:
friend class GuiTabularDialog;
GuiTabular(Dialog &);
GuiTabular(GuiDialog &);
/// parent controller
ControlTabular & controller()

View File

@ -11,7 +11,6 @@
#include <config.h>
#include "GuiTabularCreate.h"
#include "Qt2BC.h"
#include "EmptyTable.h"
#include <QCloseEvent>
@ -64,7 +63,7 @@ void GuiTabularCreateDialog::rowsChanged(int)
/////////////////////////////////////////////////////////////////////
GuiTabularCreate::GuiTabularCreate(Dialog & parent)
GuiTabularCreate::GuiTabularCreate(GuiDialog & parent)
: GuiView<GuiTabularCreateDialog>(parent, _("Insert Table"))
{
}
@ -74,8 +73,8 @@ void GuiTabularCreate::build_dialog()
{
dialog_.reset(new GuiTabularCreateDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setCancel(dialog_->closePB);
bc().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB);
}

View File

@ -42,7 +42,7 @@ public:
///
friend class GuiTabularCreateDialog;
///
GuiTabularCreate(Dialog &);
GuiTabularCreate(GuiDialog &);
/// parent controller
ControlTabularCreate & controller()
{ return static_cast<ControlTabularCreate &>(this->getController()); }

View File

@ -11,7 +11,6 @@
#include <config.h>
#include "GuiTexinfo.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "support/filetools.h"
@ -122,7 +121,7 @@ void GuiTexinfoDialog::enableViewPB()
/////////////////////////////////////////////////////////////////////
GuiTexinfo::GuiTexinfo(Dialog & parent)
GuiTexinfo::GuiTexinfo(GuiDialog & parent)
: GuiView<GuiTexinfoDialog>(parent, _("TeX Information")),
warningPosted(false), activeStyle(ControlTexinfo::cls)
{
@ -135,7 +134,7 @@ void GuiTexinfo::build_dialog()
updateStyles(ControlTexinfo::cls);
bcview().setCancel(dialog_->closePB);
bc().setCancel(dialog_->closePB);
}

View File

@ -52,7 +52,7 @@ public:
///
friend class GuiTexinfoDialog;
///
GuiTexinfo(Dialog &);
GuiTexinfo(GuiDialog &);
/// parent controller
ControlTexinfo & controller()
{ return static_cast<ControlTexinfo &>(this->getController()); }

View File

@ -11,7 +11,6 @@
#include <config.h>
#include "GuiThesaurus.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "debug.h"
@ -141,7 +140,7 @@ void GuiThesaurusDialog::updateLists()
//
/////////////////////////////////////////////////////////////////////
GuiThesaurus::GuiThesaurus(Dialog & parent)
GuiThesaurus::GuiThesaurus(GuiDialog & parent)
: GuiView<GuiThesaurusDialog>(parent, _("Thesaurus"))
{
}
@ -151,10 +150,10 @@ void GuiThesaurus::build_dialog()
{
dialog_.reset(new GuiThesaurusDialog(this));
bcview().setCancel(dialog_->closePB);
bcview().setApply(dialog_->replacePB);
bcview().addReadOnly(dialog_->replaceED);
bcview().addReadOnly(dialog_->replacePB);
bc().setCancel(dialog_->closePB);
bc().setApply(dialog_->replacePB);
bc().addReadOnly(dialog_->replaceED);
bc().addReadOnly(dialog_->replacePB);
}

View File

@ -56,7 +56,7 @@ public:
///
friend class GuiThesaurusDialog;
///
GuiThesaurus(Dialog &);
GuiThesaurus(GuiDialog &);
/// parent controller
ControlThesaurus & controller()
{ return static_cast<ControlThesaurus &>(this->getController()); }

View File

@ -14,12 +14,11 @@
#include "GuiToc.h"
#include "TocModel.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "debug.h"
#include "controllers/ControlToc.h"
#include "ControlToc.h"
#include <algorithm>

View File

@ -11,9 +11,7 @@
#include <config.h>
#include "GuiURL.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "ButtonController.h"
#include <QCheckBox>
#include <QCloseEvent>
@ -56,7 +54,7 @@ void GuiURLDialog::closeEvent(QCloseEvent * e)
UrlView::UrlView(Dialog & parent)
UrlView::UrlView(GuiDialog & parent)
: GuiView<GuiURLDialog>(parent, _("URL"))
{
}
@ -66,11 +64,11 @@ void UrlView::build_dialog()
{
dialog_.reset(new GuiURLDialog(this));
bcview().setOK(dialog_->okPB);
bcview().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->urlED);
bcview().addReadOnly(dialog_->nameED);
bcview().addReadOnly(dialog_->hyperlinkCB);
bc().setOK(dialog_->okPB);
bc().setCancel(dialog_->closePB);
bc().addReadOnly(dialog_->urlED);
bc().addReadOnly(dialog_->nameED);
bc().addReadOnly(dialog_->hyperlinkCB);
}
@ -82,7 +80,7 @@ void UrlView::update_contents()
dialog_->nameED->setText(toqstr(params["name"]));
dialog_->hyperlinkCB->setChecked(params.getCmdName() != "url");
bc().valid(isValid());
bc().setValid(isValid());
}

View File

@ -41,7 +41,7 @@ class UrlView : public GuiView<GuiURLDialog>
{
public:
friend class QURLDialog;
UrlView(Dialog &);
UrlView(GuiDialog &);
/// parent controller
ControlCommand & controller()
{ return static_cast<ControlCommand &>(this->getController()); }

View File

@ -16,7 +16,6 @@
#include <config.h>
#include "GuiVSpace.h"
#include "Qt2BC.h"
#include "LengthCombo.h"
#include "qt_helpers.h"
@ -26,8 +25,8 @@
#include "Spacing.h"
#include "VSpace.h"
#include "controllers/ControlVSpace.h"
#include "controllers/frontend_helpers.h"
#include "ControlVSpace.h"
#include "frontend_helpers.h"
#include "support/lstrings.h"
@ -181,7 +180,7 @@ static VSpace setVSpaceFromWidgets(int spacing,
}
GuiVSpace::GuiVSpace(Dialog & parent)
GuiVSpace::GuiVSpace(GuiDialog & parent)
: GuiView<GuiVSpaceDialog>(parent, _("Vertical Space Settings"))
{}
@ -192,18 +191,18 @@ void GuiVSpace::build_dialog()
dialog_.reset(new GuiVSpaceDialog(this));
// Manage the ok, apply, restore and cancel/close buttons
bcview().setOK(dialog_->okPB);
bcview().setApply(dialog_->applyPB);
bcview().setCancel(dialog_->closePB);
bc().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB);
// disable for read-only documents
bcview().addReadOnly(dialog_->spacingCO);
bcview().addReadOnly(dialog_->valueLE);
bcview().addReadOnly(dialog_->unitCO);
bcview().addReadOnly(dialog_->keepCB);
bc().addReadOnly(dialog_->spacingCO);
bc().addReadOnly(dialog_->valueLE);
bc().addReadOnly(dialog_->unitCO);
bc().addReadOnly(dialog_->keepCB);
// initialize the length validator
addCheckedLineEdit(bcview(), dialog_->valueLE, dialog_->valueL);
bc().addCheckedLineEdit(dialog_->valueLE, dialog_->valueL);
// remove the %-items from the unit choice
dialog_->unitCO->noPercents();

View File

@ -50,7 +50,7 @@ public:
///
friend class GuiVSpaceDialog;
///
GuiVSpace(Dialog &);
GuiVSpace(GuiDialog &);
/// parent controller
ControlVSpace & controller()
{ return static_cast<ControlVSpace &>(this->getController()); }

View File

@ -160,7 +160,7 @@ void LaTeXHighlighter::highlightBlock(QString const & text)
}
GuiViewSource::GuiViewSource(Dialog & parent)
GuiViewSource::GuiViewSource(GuiDialog & parent)
: ControlViewSource(parent)
{
document_ = new QTextDocument(this);

View File

@ -15,6 +15,7 @@
#define GUIVIEWSOURCE_H
#include "ControlViewSource.h"
#include "GuiDialog.h"
#include "Application.h"
#include "ui_ViewSourceUi.h"
@ -63,7 +64,7 @@ private:
class GuiViewSource : public QObject, public ControlViewSource {
public:
///
GuiViewSource(Dialog &);
GuiViewSource(GuiDialog &);
///
QTextDocument * document() { return document_; }
///

View File

@ -11,7 +11,6 @@
#include <config.h>
#include "GuiWrap.h"
#include "Qt2BC.h"
#include "LengthCombo.h"
#include "qt_helpers.h"
@ -75,7 +74,7 @@ void GuiWrapDialog::change_adaptor()
//
/////////////////////////////////////////////////////////////////////
GuiWrap::GuiWrap(Dialog & parent)
GuiWrap::GuiWrap(GuiDialog & parent)
: GuiView<GuiWrapDialog>(parent, _("Text Wrap Settings"))
{
}
@ -85,14 +84,14 @@ void GuiWrap::build_dialog()
{
dialog_.reset(new GuiWrapDialog(this));
bcview().setRestore(dialog_->restorePB);
bcview().setOK(dialog_->okPB);
bcview().setApply(dialog_->applyPB);
bcview().setCancel(dialog_->closePB);
bc().setRestore(dialog_->restorePB);
bc().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB);
bcview().addReadOnly(dialog_->widthED);
bcview().addReadOnly(dialog_->unitsLC);
bcview().addReadOnly(dialog_->valignCO);
bc().addReadOnly(dialog_->widthED);
bc().addReadOnly(dialog_->unitsLC);
bc().addReadOnly(dialog_->valignCO);
}

View File

@ -42,7 +42,7 @@ class GuiWrap : public GuiView<GuiWrapDialog>
public:
friend class GuiWrapDialog;
GuiWrap(Dialog &);
GuiWrap(GuiDialog &);
/// parent controller
ControlWrap & controller()
{ return static_cast<ControlWrap &>(this->getController()); }

View File

@ -38,6 +38,7 @@ SOURCEFILES = \
Action.cpp \
alert_pimpl.cpp \
BulletsModule.cpp \
ButtonController.cpp \
ColorCache.cpp \
Dialogs.cpp \
EmptyTable.cpp \
@ -57,6 +58,7 @@ SOURCEFILES = \
GuiCommandBuffer.cpp \
GuiCommandEdit.cpp \
GuiDelimiter.cpp \
GuiDialog.cpp \
GuiDialogView.cpp \
GuiDocument.cpp \
GuiEmbeddedFiles.cpp \
@ -110,7 +112,6 @@ SOURCEFILES = \
LengthCombo.cpp \
LyXFileDialog.cpp \
PanelStack.cpp \
Qt2BC.cpp \
qt_helpers.cpp \
socket_callback.cpp \
TocModel.cpp \
@ -118,13 +119,13 @@ SOURCEFILES = \
Validator.cpp
NOMOCHEADER = \
ButtonController.h \
GuiClipboard.h \
GuiFontLoader.h \
GuiFontMetrics.h \
GuiSelection.h \
GuiImage.h \
GuiPainter.h \
Qt2BC.h \
qt_helpers.h
MOCHEADER = \
@ -147,6 +148,7 @@ MOCHEADER = \
GuiCommandBuffer.h \
GuiCommandEdit.h \
GuiDelimiter.h \
GuiDialog.h \
GuiDialogView.h \
GuiDocument.h \
GuiEmbeddedFiles.h \