mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-14 06:57:01 +00:00
finally merge Dialog and Controller
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20875 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fee6fea248
commit
5342ee5aad
@ -30,53 +30,39 @@ Dialog::~Dialog()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Controller::Controller(Dialog & parent)
|
bool Dialog::canApply() const
|
||||||
: parent_(parent), lyxview_(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Controller::Controller(Dialog * parent)
|
|
||||||
: parent_(*parent), lyxview_(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Controller::~Controller()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
bool Controller::canApply() const
|
|
||||||
{
|
{
|
||||||
FuncRequest const fr(getLfun(), dialog().name());
|
FuncRequest const fr(getLfun(), name());
|
||||||
FuncStatus const fs(getStatus(fr));
|
FuncStatus const fs(getStatus(fr));
|
||||||
return fs.enabled();
|
return fs.enabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Controller::dispatch(FuncRequest const & fr) const
|
void Dialog::dispatch(FuncRequest const & fr) const
|
||||||
{
|
{
|
||||||
lyxview_->dispatch(fr);
|
lyxview_->dispatch(fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Controller::updateDialog(std::string const & name) const
|
void Dialog::updateDialog(std::string const & name) const
|
||||||
{
|
{
|
||||||
dispatch(FuncRequest(LFUN_DIALOG_UPDATE, name));
|
dispatch(FuncRequest(LFUN_DIALOG_UPDATE, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Controller::disconnect(std::string const & name) const
|
void Dialog::disconnect(std::string const & name) const
|
||||||
{
|
{
|
||||||
lyxview_->getDialogs().disconnect(name);
|
lyxview_->getDialogs().disconnect(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Controller::isBufferAvailable() const
|
bool Dialog::isBufferAvailable() const
|
||||||
{
|
{
|
||||||
return lyxview_->buffer() != 0;
|
return lyxview_->buffer() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Controller::isBufferReadonly() const
|
bool Dialog::isBufferReadonly() const
|
||||||
{
|
{
|
||||||
if (!lyxview_->buffer())
|
if (!lyxview_->buffer())
|
||||||
return true;
|
return true;
|
||||||
@ -84,13 +70,13 @@ bool Controller::isBufferReadonly() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string const Controller::bufferFilepath() const
|
std::string const Dialog::bufferFilepath() const
|
||||||
{
|
{
|
||||||
return buffer().filePath();
|
return buffer().filePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
KernelDocType Controller::docType() const
|
KernelDocType Dialog::docType() const
|
||||||
{
|
{
|
||||||
if (buffer().isLatex())
|
if (buffer().isLatex())
|
||||||
return LATEX;
|
return LATEX;
|
||||||
@ -101,26 +87,26 @@ KernelDocType Controller::docType() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BufferView * Controller::bufferview()
|
BufferView * Dialog::bufferview()
|
||||||
{
|
{
|
||||||
return lyxview_->view();
|
return lyxview_->view();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BufferView const * Controller::bufferview() const
|
BufferView const * Dialog::bufferview() const
|
||||||
{
|
{
|
||||||
return lyxview_->view();
|
return lyxview_->view();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Buffer & Controller::buffer()
|
Buffer & Dialog::buffer()
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(lyxview_->buffer());
|
BOOST_ASSERT(lyxview_->buffer());
|
||||||
return *lyxview_->buffer();
|
return *lyxview_->buffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Buffer const & Controller::buffer() const
|
Buffer const & Dialog::buffer() const
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(lyxview_->buffer());
|
BOOST_ASSERT(lyxview_->buffer());
|
||||||
return *lyxview_->buffer();
|
return *lyxview_->buffer();
|
||||||
|
@ -39,13 +39,6 @@ enum KernelDocType
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** Different dialogs will have different Controllers and Views.
|
|
||||||
* deriving from these base classes.
|
|
||||||
*/
|
|
||||||
//@{
|
|
||||||
class Controller;
|
|
||||||
//@}
|
|
||||||
|
|
||||||
/** \c Dialog collects the different parts of a Model-Controller-View
|
/** \c Dialog collects the different parts of a Model-Controller-View
|
||||||
* split of a generic dialog together.
|
* split of a generic dialog together.
|
||||||
*/
|
*/
|
||||||
@ -55,7 +48,7 @@ public:
|
|||||||
/// \param lv is the access point for the dialog to the LyX kernel.
|
/// \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
|
/// \param name is the identifier given to the dialog by its parent
|
||||||
/// container.
|
/// container.
|
||||||
Dialog() {}
|
Dialog(LyXView & lv) : lyxview_(&lv) {}
|
||||||
virtual ~Dialog();
|
virtual ~Dialog();
|
||||||
|
|
||||||
/** \name Container Access
|
/** \name Container Access
|
||||||
@ -93,13 +86,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual bool isClosing() const { return false; }
|
virtual bool isClosing() const { return false; }
|
||||||
|
|
||||||
/** \name Dialog Specialization
|
|
||||||
* Methods to set the Controller and View and so specialise
|
|
||||||
* to a particular dialog.
|
|
||||||
*/
|
|
||||||
//@{
|
|
||||||
virtual Controller & controller() = 0;
|
|
||||||
//@}
|
|
||||||
|
|
||||||
/** \c Button controller part
|
/** \c Button controller part
|
||||||
*/
|
*/
|
||||||
@ -144,33 +130,6 @@ public:
|
|||||||
///
|
///
|
||||||
virtual std::string name() const = 0;
|
virtual std::string name() const = 0;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void apply() {}
|
|
||||||
|
|
||||||
private:
|
|
||||||
/// intentionally unimplemented, therefore uncopiable
|
|
||||||
Dialog(Dialog const &);
|
|
||||||
void operator=(Dialog const &);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/** \c Controller is an abstract base class for the Controller
|
|
||||||
* of a Model-Controller-View split of a generic dialog.
|
|
||||||
*/
|
|
||||||
class Controller
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/// \param parent Dialog owning this Controller.
|
|
||||||
Controller(Dialog & parent);
|
|
||||||
// the same. avoids ambiguity with the (non-existent) copy constructor
|
|
||||||
Controller(Dialog * parent);
|
|
||||||
virtual ~Controller();
|
|
||||||
void setLyXView(LyXView & lv) { lyxview_ = &lv; }
|
|
||||||
|
|
||||||
/** \name Generic Controller
|
|
||||||
* These few methods are all that a generic dialog needs of a
|
|
||||||
* controller.
|
|
||||||
*/
|
|
||||||
//@{
|
//@{
|
||||||
/** Enable the controller to initialise its data structures.
|
/** Enable the controller to initialise its data structures.
|
||||||
* \param data is a string encoding of the parameters to be displayed.
|
* \param data is a string encoding of the parameters to be displayed.
|
||||||
@ -229,14 +188,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual bool exitEarly() const { return false; }
|
virtual bool exitEarly() const { return false; }
|
||||||
//@}
|
//@}
|
||||||
public:
|
|
||||||
/** \name Controller Access
|
|
||||||
* Enable the derived classes to access the other parts of the whole.
|
|
||||||
*/
|
|
||||||
//@{
|
|
||||||
Dialog & dialog() { return parent_; }
|
|
||||||
Dialog const & dialog() const { return parent_; }
|
|
||||||
//@}
|
|
||||||
|
|
||||||
/** \c Kernel part: a wrapper making the LyX kernel available to the dialog.
|
/** \c Kernel part: a wrapper making the LyX kernel available to the dialog.
|
||||||
* (Ie, it provides an interface to the Model part of the Model-Controller-
|
* (Ie, it provides an interface to the Model part of the Model-Controller-
|
||||||
@ -295,14 +246,17 @@ public:
|
|||||||
BufferView const * bufferview() const;
|
BufferView const * bufferview() const;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
/// intentionally unimplemented, therefore uncopiable
|
virtual void apply() {}
|
||||||
Controller(Controller const &);
|
|
||||||
void operator=(Controller const &);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Dialog & parent_;
|
|
||||||
LyXView * lyxview_;
|
LyXView * lyxview_;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/// intentionally unimplemented, therefore uncopiable
|
||||||
|
Dialog(Dialog const &);
|
||||||
|
void operator=(Dialog const &);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,8 +65,7 @@ void Dialogs::show(string const & name, string const & data, Inset * inset)
|
|||||||
|
|
||||||
bool Dialogs::visible(string const & name) const
|
bool Dialogs::visible(string const & name) const
|
||||||
{
|
{
|
||||||
std::map<string, DialogPtr>::const_iterator it =
|
std::map<string, DialogPtr>::const_iterator it = dialogs_.find(name);
|
||||||
dialogs_.find(name);
|
|
||||||
if (it == dialogs_.end())
|
if (it == dialogs_.end())
|
||||||
return false;
|
return false;
|
||||||
return it->second.get()->isVisibleView();
|
return it->second.get()->isVisibleView();
|
||||||
@ -75,8 +74,7 @@ bool Dialogs::visible(string const & name) const
|
|||||||
|
|
||||||
void Dialogs::update(string const & name, string const & data)
|
void Dialogs::update(string const & name, string const & data)
|
||||||
{
|
{
|
||||||
std::map<string, DialogPtr>::const_iterator it =
|
std::map<string, DialogPtr>::const_iterator it = dialogs_.find(name);
|
||||||
dialogs_.find(name);
|
|
||||||
if (it == dialogs_.end())
|
if (it == dialogs_.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -148,7 +146,7 @@ void Dialogs::hideBufferDependent() const
|
|||||||
|
|
||||||
for(; it != end; ++it) {
|
for(; it != end; ++it) {
|
||||||
Dialog * dialog = it->second.get();
|
Dialog * dialog = it->second.get();
|
||||||
if (dialog->controller().isBufferDependent())
|
if (dialog->isBufferDependent())
|
||||||
dialog->hide();
|
dialog->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,8 +159,8 @@ void Dialogs::updateBufferDependent(bool switched) const
|
|||||||
|
|
||||||
for(; it != end; ++it) {
|
for(; it != end; ++it) {
|
||||||
Dialog * dialog = it->second.get();
|
Dialog * dialog = it->second.get();
|
||||||
if (switched && dialog->controller().isBufferDependent()) {
|
if (switched && dialog->isBufferDependent()) {
|
||||||
if (dialog->isVisibleView() && dialog->controller().initialiseParams(""))
|
if (dialog->isVisibleView() && dialog->initialiseParams(""))
|
||||||
dialog->updateView();
|
dialog->updateView();
|
||||||
else
|
else
|
||||||
dialog->hide();
|
dialog->hide();
|
||||||
|
@ -25,7 +25,7 @@ namespace frontend {
|
|||||||
/// Dock Widget container for LyX dialogs.
|
/// Dock Widget container for LyX dialogs.
|
||||||
/// This template class that encapsulates a given Widget inside a
|
/// This template class that encapsulates a given Widget inside a
|
||||||
/// QDockWidget and presents a Dialog interface
|
/// QDockWidget and presents a Dialog interface
|
||||||
class DockView : public QDockWidget, public Dialog, public Controller
|
class DockView : public QDockWidget, public Dialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DockView(
|
DockView(
|
||||||
@ -34,7 +34,7 @@ public:
|
|||||||
Qt::DockWidgetArea area = Qt::LeftDockWidgetArea, ///< Position of the dock (and also drawer)
|
Qt::DockWidgetArea area = Qt::LeftDockWidgetArea, ///< Position of the dock (and also drawer)
|
||||||
Qt::WindowFlags flags = 0
|
Qt::WindowFlags flags = 0
|
||||||
)
|
)
|
||||||
: QDockWidget(&parent, flags), Controller(this, parent), name_(name)
|
: QDockWidget(&parent, flags), Dialog(parent), name_(name)
|
||||||
{
|
{
|
||||||
if (flags & Qt::Drawer)
|
if (flags & Qt::Drawer)
|
||||||
setFeatures(QDockWidget::NoDockWidgetFeatures);
|
setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||||
@ -68,7 +68,6 @@ public:
|
|||||||
}
|
}
|
||||||
bool isClosing() const { return false; }
|
bool isClosing() const { return false; }
|
||||||
void partialUpdateView(int /*id*/) {}
|
void partialUpdateView(int /*id*/) {}
|
||||||
Controller & controller() { return *this; }
|
|
||||||
std::string name() const { return name_; }
|
std::string name() const { return name_; }
|
||||||
//@}
|
//@}
|
||||||
private:
|
private:
|
||||||
|
@ -406,7 +406,7 @@ void GuiCharacter::updateContents()
|
|||||||
colorCO->setCurrentIndex(findPos2nd(color, getColor()));
|
colorCO->setCurrentIndex(findPos2nd(color, getColor()));
|
||||||
langCO->setCurrentIndex(findPos2nd(language, getLanguage()));
|
langCO->setCurrentIndex(findPos2nd(language, getLanguage()));
|
||||||
|
|
||||||
toggleallCB->setChecked(getToggleAll());
|
toggleallCB->setChecked(toggleall_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -420,7 +420,7 @@ void GuiCharacter::applyView()
|
|||||||
setColor(color[colorCO->currentIndex()].second);
|
setColor(color[colorCO->currentIndex()].second);
|
||||||
setLanguage(language[langCO->currentIndex()].second);
|
setLanguage(language[langCO->currentIndex()].second);
|
||||||
|
|
||||||
setToggleAll(toggleallCB->isChecked());
|
toggleall_ = toggleallCB->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ bool GuiCharacter::initialiseParams(string const &)
|
|||||||
|| getBar() != IGNORE
|
|| getBar() != IGNORE
|
||||||
|| getColor() != Color::ignore
|
|| getColor() != Color::ignore
|
||||||
|| font_.language() != ignore_language)
|
|| font_.language() != ignore_language)
|
||||||
dialog().setButtonsValid(true);
|
setButtonsValid(true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -596,18 +596,6 @@ void GuiCharacter::setLanguage(string const & val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GuiCharacter::getToggleAll() const
|
|
||||||
{
|
|
||||||
return toggleall_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GuiCharacter::setToggleAll(bool t)
|
|
||||||
{
|
|
||||||
toggleall_ = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Dialog * createGuiCharacter(LyXView & lv) { return new GuiCharacter(lv); }
|
Dialog * createGuiCharacter(LyXView & lv) { return new GuiCharacter(lv); }
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,8 +98,6 @@ private:
|
|||||||
void setColor(Color_color);
|
void setColor(Color_color);
|
||||||
///
|
///
|
||||||
void setLanguage(std::string const &);
|
void setLanguage(std::string const &);
|
||||||
///
|
|
||||||
void setToggleAll(bool);
|
|
||||||
|
|
||||||
///
|
///
|
||||||
Font::FONT_FAMILY getFamily() const;
|
Font::FONT_FAMILY getFamily() const;
|
||||||
@ -115,8 +113,7 @@ private:
|
|||||||
Color_color getColor() const;
|
Color_color getColor() const;
|
||||||
///
|
///
|
||||||
std::string getLanguage() const;
|
std::string getLanguage() const;
|
||||||
///
|
|
||||||
bool getToggleAll() const;
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
Font font_;
|
Font font_;
|
||||||
|
@ -25,7 +25,7 @@ namespace lyx {
|
|||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
GuiDialog::GuiDialog(LyXView & lv, std::string const & name)
|
GuiDialog::GuiDialog(LyXView & lv, std::string const & name)
|
||||||
: Controller(this, lv), is_closing_(false), name_(name)
|
: Dialog(lv), is_closing_(false), name_(name)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ void GuiDialog::hide()
|
|||||||
|
|
||||||
clearParams();
|
clearParams();
|
||||||
hideView();
|
hideView();
|
||||||
Controller::disconnect(name_);
|
Dialog::disconnect(name_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ void GuiDialog::apply()
|
|||||||
dispatchParams();
|
dispatchParams();
|
||||||
|
|
||||||
if (disconnectOnApply() && !is_closing_) {
|
if (disconnectOnApply() && !is_closing_) {
|
||||||
Controller::disconnect(name_);
|
Dialog::disconnect(name_);
|
||||||
initialiseParams(string());
|
initialiseParams(string());
|
||||||
updateView();
|
updateView();
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace frontend {
|
|||||||
/** \c Dialog collects the different parts of a Model-Controller-View
|
/** \c Dialog collects the different parts of a Model-Controller-View
|
||||||
* split of a generic dialog together.
|
* split of a generic dialog together.
|
||||||
*/
|
*/
|
||||||
class GuiDialog : public QDialog, public Dialog, public Controller
|
class GuiDialog : public QDialog, public Dialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -119,13 +119,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool isClosing() const { return is_closing_; }
|
bool isClosing() const { return is_closing_; }
|
||||||
|
|
||||||
/** \name Dialog Components
|
|
||||||
* Methods to access the various components making up a dialog.
|
|
||||||
*/
|
|
||||||
//@{
|
|
||||||
virtual Controller & controller() { return *this; }
|
|
||||||
//@}
|
|
||||||
|
|
||||||
/** Defaults to nothing. Can be used by the Controller, however, to
|
/** Defaults to nothing. Can be used by the Controller, however, to
|
||||||
* indicate to the View that something has changed and that the
|
* indicate to the View that something has changed and that the
|
||||||
* dialog therefore needs updating.
|
* dialog therefore needs updating.
|
||||||
@ -139,10 +132,10 @@ public:
|
|||||||
void apply();
|
void apply();
|
||||||
void redrawView() {}
|
void redrawView() {}
|
||||||
|
|
||||||
private:
|
|
||||||
/// Update the display of the dialog whilst it is still visible.
|
/// Update the display of the dialog whilst it is still visible.
|
||||||
virtual void updateView();
|
virtual void updateView();
|
||||||
|
|
||||||
|
private:
|
||||||
ButtonController bc_;
|
ButtonController bc_;
|
||||||
/// are we updating ?
|
/// are we updating ?
|
||||||
bool updating_;
|
bool updating_;
|
||||||
|
@ -1681,14 +1681,14 @@ TextClass const & GuiDocument::textClass() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void dispatch_bufferparams(Controller const & controller,
|
static void dispatch_bufferparams(Dialog const & dialog,
|
||||||
BufferParams const & bp, kb_action lfun)
|
BufferParams const & bp, kb_action lfun)
|
||||||
{
|
{
|
||||||
ostringstream ss;
|
ostringstream ss;
|
||||||
ss << "\\begin_header\n";
|
ss << "\\begin_header\n";
|
||||||
bp.writeFile(ss);
|
bp.writeFile(ss);
|
||||||
ss << "\\end_header\n";
|
ss << "\\end_header\n";
|
||||||
controller.dispatch(FuncRequest(lfun, ss.str()));
|
dialog.dispatch(FuncRequest(lfun, ss.str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1711,8 +1711,7 @@ void GuiDocument::dispatchParams()
|
|||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
docstring const & current_branch = it->getBranch();
|
docstring const & current_branch = it->getBranch();
|
||||||
Branch const * branch = branchlist.find(current_branch);
|
Branch const * branch = branchlist.find(current_branch);
|
||||||
string const x11hexname =
|
string const x11hexname = X11hexname(branch->getColor());
|
||||||
lyx::X11hexname(branch->getColor());
|
|
||||||
// display the new color
|
// display the new color
|
||||||
docstring const str = current_branch + ' ' + from_ascii(x11hexname);
|
docstring const str = current_branch + ' ' + from_ascii(x11hexname);
|
||||||
dispatch(FuncRequest(LFUN_SET_COLOR, str));
|
dispatch(FuncRequest(LFUN_SET_COLOR, str));
|
||||||
|
@ -653,7 +653,7 @@ void GuiExternal::updateTemplate()
|
|||||||
void GuiExternal::applyView()
|
void GuiExternal::applyView()
|
||||||
{
|
{
|
||||||
params_.filename.set(internal_path(fromqstr(fileED->text())),
|
params_.filename.set(internal_path(fromqstr(fileED->text())),
|
||||||
controller().bufferFilepath());
|
bufferFilepath());
|
||||||
|
|
||||||
params_.settemplate(getTemplate(externalCO->currentIndex()).lyxName);
|
params_.settemplate(getTemplate(externalCO->currentIndex()).lyxName);
|
||||||
|
|
||||||
@ -725,7 +725,7 @@ void GuiExternal::dispatchParams()
|
|||||||
|
|
||||||
void GuiExternal::editExternal()
|
void GuiExternal::editExternal()
|
||||||
{
|
{
|
||||||
dialog().applyView();
|
applyView();
|
||||||
string const lfun = InsetExternalMailer::params2string(params_, buffer());
|
string const lfun = InsetExternalMailer::params2string(params_, buffer());
|
||||||
dispatch(FuncRequest(LFUN_EXTERNAL_EDIT, lfun));
|
dispatch(FuncRequest(LFUN_EXTERNAL_EDIT, lfun));
|
||||||
}
|
}
|
||||||
|
@ -808,14 +808,13 @@ string const GuiGraphics::readBB(string const & file)
|
|||||||
bool GuiGraphics::isFilenameValid(string const & fname) const
|
bool GuiGraphics::isFilenameValid(string const & fname) const
|
||||||
{
|
{
|
||||||
// It may be that the filename is relative.
|
// It may be that the filename is relative.
|
||||||
FileName const name(makeAbsPath(fname, bufferFilepath()));
|
return isFileReadable(makeAbsPath(fname, bufferFilepath()));
|
||||||
return isFileReadable(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiGraphics::editGraphics()
|
void GuiGraphics::editGraphics()
|
||||||
{
|
{
|
||||||
dialog().applyView();
|
applyView();
|
||||||
string const lfun =
|
string const lfun =
|
||||||
InsetGraphicsMailer::params2string(params_, buffer());
|
InsetGraphicsMailer::params2string(params_, buffer());
|
||||||
dispatch(FuncRequest(LFUN_GRAPHICS_EDIT, lfun));
|
dispatch(FuncRequest(LFUN_GRAPHICS_EDIT, lfun));
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "Cursor.h"
|
#include "Cursor.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "DialogView.h"
|
//#include "DialogView.h"
|
||||||
#include "DockView.h"
|
//#include "DockView.h"
|
||||||
#include "frontend_helpers.h"
|
#include "frontend_helpers.h"
|
||||||
#include "FuncRequest.h"
|
#include "FuncRequest.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
@ -50,7 +50,7 @@ namespace lyx {
|
|||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
GuiParagraph::GuiParagraph(LyXView & lv)
|
GuiParagraph::GuiParagraph(LyXView & lv)
|
||||||
: Controller(this, lv)
|
: Dialog(lv)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setWindowTitle(qt_("Paragraph Settings"));
|
setWindowTitle(qt_("Paragraph Settings"));
|
||||||
|
@ -38,7 +38,7 @@ namespace lyx {
|
|||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
class GuiParagraph
|
class GuiParagraph
|
||||||
: public QDialog, public Ui::ParagraphUi, public Controller, public Dialog
|
: public QDialog, public Ui::ParagraphUi, public Dialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@ -55,8 +55,6 @@ private:
|
|||||||
///
|
///
|
||||||
LyXAlignment getAlignmentFromDialog();
|
LyXAlignment getAlignmentFromDialog();
|
||||||
///
|
///
|
||||||
Controller & controller() { return *this; }
|
|
||||||
///
|
|
||||||
typedef std::map<LyXAlignment, QRadioButton *> RadioMap;
|
typedef std::map<LyXAlignment, QRadioButton *> RadioMap;
|
||||||
RadioMap radioMap;
|
RadioMap radioMap;
|
||||||
|
|
||||||
|
@ -1866,9 +1866,8 @@ void GuiPreferences::dispatchParams()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The Save button has been pressed
|
// The Save button has been pressed
|
||||||
if (dialog().isClosing()) {
|
if (isClosing())
|
||||||
dispatch(FuncRequest(LFUN_PREFERENCES_SAVE));
|
dispatch(FuncRequest(LFUN_PREFERENCES_SAVE));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ bool GuiPrint::initialiseParams(std::string const &)
|
|||||||
lyxrc.print_file_extension);
|
lyxrc.print_file_extension);
|
||||||
params_ = PrinterParams(PrinterParams::PRINTER, lyxrc.printer, name);
|
params_ = PrinterParams(PrinterParams::PRINTER, lyxrc.printer, name);
|
||||||
|
|
||||||
dialog().setButtonsValid(true); // so that the user can press Ok
|
setButtonsValid(true); // so that the user can press Ok
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ void GuiRef::selectionChanged()
|
|||||||
|
|
||||||
void GuiRef::refHighlighted(QListWidgetItem * sel)
|
void GuiRef::refHighlighted(QListWidgetItem * sel)
|
||||||
{
|
{
|
||||||
if (controller().isBufferReadonly())
|
if (isBufferReadonly())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* int const cur_item = refsLW->currentRow();
|
/* int const cur_item = refsLW->currentRow();
|
||||||
|
@ -30,10 +30,9 @@ namespace frontend {
|
|||||||
|
|
||||||
static void uniqueInsert(QComboBox * box, QString const & text)
|
static void uniqueInsert(QComboBox * box, QString const & text)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < box->count(); ++i) {
|
for (int i = box->count(); --i >= 0; )
|
||||||
if (box->itemText(i) == text)
|
if (box->itemText(i) == text)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
box->addItem(text);
|
box->addItem(text);
|
||||||
}
|
}
|
||||||
@ -87,8 +86,8 @@ void GuiSearch::findChanged()
|
|||||||
replaceallPB->setEnabled(false);
|
replaceallPB->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
findPB->setEnabled(true);
|
findPB->setEnabled(true);
|
||||||
replacePB->setEnabled(!controller().isBufferReadonly());
|
replacePB->setEnabled(!isBufferReadonly());
|
||||||
replaceallPB->setEnabled(!controller().isBufferReadonly());
|
replaceallPB->setEnabled(!isBufferReadonly());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,8 +126,8 @@ void GuiSearch::replaceallClicked()
|
|||||||
void GuiSearch::find(docstring const & search, bool casesensitive,
|
void GuiSearch::find(docstring const & search, bool casesensitive,
|
||||||
bool matchword, bool forward)
|
bool matchword, bool forward)
|
||||||
{
|
{
|
||||||
docstring const data = find2string(search, casesensitive,
|
docstring const data =
|
||||||
matchword, forward);
|
find2string(search, casesensitive, matchword, forward);
|
||||||
dispatch(FuncRequest(LFUN_WORD_FIND, data));
|
dispatch(FuncRequest(LFUN_WORD_FIND, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ void GuiSpellchecker::check()
|
|||||||
LYXERR(Debug::GUI) << "Updating spell progress." << endl;
|
LYXERR(Debug::GUI) << "Updating spell progress." << endl;
|
||||||
oldval_ = newvalue_;
|
oldval_ = newvalue_;
|
||||||
// set progress bar
|
// set progress bar
|
||||||
dialog().partialUpdateView(SPELL_PROGRESSED);
|
partialUpdateView(SPELL_PROGRESSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// speller might be dead ...
|
// speller might be dead ...
|
||||||
@ -385,7 +385,7 @@ void GuiSpellchecker::check()
|
|||||||
// set suggestions
|
// set suggestions
|
||||||
if (res != SpellBase::OK && res != SpellBase::IGNORED_WORD) {
|
if (res != SpellBase::OK && res != SpellBase::IGNORED_WORD) {
|
||||||
LYXERR(Debug::GUI) << "Found a word needing checking." << endl;
|
LYXERR(Debug::GUI) << "Found a word needing checking." << endl;
|
||||||
dialog().partialUpdateView(SPELL_FOUND_WORD);
|
partialUpdateView(SPELL_FOUND_WORD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,7 +402,7 @@ bool GuiSpellchecker::checkAlive()
|
|||||||
else
|
else
|
||||||
message = _("The spellchecker has failed.\n") + speller_->error();
|
message = _("The spellchecker has failed.\n") + speller_->error();
|
||||||
|
|
||||||
dialog().slotClose();
|
slotClose();
|
||||||
|
|
||||||
Alert::error(_("The spellchecker has failed"), message);
|
Alert::error(_("The spellchecker has failed"), message);
|
||||||
return false;
|
return false;
|
||||||
@ -412,7 +412,7 @@ bool GuiSpellchecker::checkAlive()
|
|||||||
void GuiSpellchecker::showSummary()
|
void GuiSpellchecker::showSummary()
|
||||||
{
|
{
|
||||||
if (!checkAlive() || count_ == 0) {
|
if (!checkAlive() || count_ == 0) {
|
||||||
dialog().slotClose();
|
slotClose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,7 +422,7 @@ void GuiSpellchecker::showSummary()
|
|||||||
else
|
else
|
||||||
message = _("One word checked.");
|
message = _("One word checked.");
|
||||||
|
|
||||||
dialog().slotClose();
|
slotClose();
|
||||||
Alert::information(_("Spelling check completed"), message);
|
Alert::information(_("Spelling check completed"), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -941,6 +941,7 @@ void GuiTabular::closeGUI()
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GuiTabular::initialiseParams(string const & data)
|
bool GuiTabular::initialiseParams(string const & data)
|
||||||
{
|
{
|
||||||
// try to get the current cell
|
// try to get the current cell
|
||||||
@ -1049,14 +1050,14 @@ void GuiTabular::setWidth(string const & width)
|
|||||||
else
|
else
|
||||||
set(Tabular::SET_PWIDTH, width);
|
set(Tabular::SET_PWIDTH, width);
|
||||||
|
|
||||||
dialog().updateView();
|
updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiTabular::toggleMultiColumn()
|
void GuiTabular::toggleMultiColumn()
|
||||||
{
|
{
|
||||||
set(Tabular::MULTICOLUMN);
|
set(Tabular::MULTICOLUMN);
|
||||||
dialog().updateView();
|
updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,9 +50,9 @@ GuiVSpace::GuiVSpace(LyXView & lv)
|
|||||||
connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
|
connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
|
||||||
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
||||||
|
|
||||||
connect(spacingCO, SIGNAL(highlighted(const QString &)),
|
connect(spacingCO, SIGNAL(highlighted(QString)),
|
||||||
this, SLOT(change_adaptor()));
|
this, SLOT(change_adaptor()));
|
||||||
connect(valueLE, SIGNAL(textChanged(const QString &)),
|
connect(valueLE, SIGNAL(textChanged(QString)),
|
||||||
this, SLOT(change_adaptor()));
|
this, SLOT(change_adaptor()));
|
||||||
connect(spacingCO, SIGNAL(activated(int)),
|
connect(spacingCO, SIGNAL(activated(int)),
|
||||||
this, SLOT(enableCustom(int)));
|
this, SLOT(enableCustom(int)));
|
||||||
@ -166,7 +166,6 @@ void GuiVSpace::applyView()
|
|||||||
|
|
||||||
params_ = setVSpaceFromWidgets(spacingCO->currentIndex(),
|
params_ = setVSpaceFromWidgets(spacingCO->currentIndex(),
|
||||||
valueLE, unitCO, keepCB->isChecked());
|
valueLE, unitCO, keepCB->isChecked());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -179,7 +178,7 @@ void GuiVSpace::updateContents()
|
|||||||
bool GuiVSpace::initialiseParams(string const & data)
|
bool GuiVSpace::initialiseParams(string const & data)
|
||||||
{
|
{
|
||||||
InsetVSpaceMailer::string2params(data, params_);
|
InsetVSpaceMailer::string2params(data, params_);
|
||||||
dialog().setButtonsValid(true);
|
setButtonsValid(true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user