From: Angus Leeming Date: Tue, 27 Mar 2001 16:03:28 +0000 (+0000) Subject: Implemented controller-view split for minipage and preamble popups. X-Git-Tag: 1.6.10~21390 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=c44d76deae691866fc734077d870e698eb607a10;p=features.git Implemented controller-view split for minipage and preamble popups. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1838 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 9af84c78ea..25d23f559c 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,8 +1,10 @@ 2001-03-27 Angus Leeming + * ControlMinipage.[Ch]: + * ControlPreamble.[Ch]: * ControlPrint.[Ch]: - * ControlSplash.[Ch]: new files; controller for the Print popup and - Splash screen respectively. + * ControlSplash.[Ch]: new files; controller for the Minipage, Preamble + and Print popups and Splash screen, respectively. * ViewBase.h (ViewSplash): new base class for GUI-specific Splash screens. diff --git a/src/frontends/controllers/ControlError.C b/src/frontends/controllers/ControlError.C index 4a178607d9..0c571e1876 100644 --- a/src/frontends/controllers/ControlError.C +++ b/src/frontends/controllers/ControlError.C @@ -23,12 +23,10 @@ #include "buffer.h" #include "insets/inseterror.h" -using SigC::slot; - ControlError::ControlError(LyXView & lv, Dialogs & d) : ControlInset(lv, d) { - d_.showError.connect(slot(this, &ControlError::showInset)); + d_.showError.connect(SigC::slot(this, &ControlError::showInset)); } string const ControlError::getParams(InsetError const & inset) diff --git a/src/frontends/controllers/ControlMinipage.C b/src/frontends/controllers/ControlMinipage.C new file mode 100644 index 0000000000..14f1741b68 --- /dev/null +++ b/src/frontends/controllers/ControlMinipage.C @@ -0,0 +1,70 @@ +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2001 The LyX Team. + * + * ====================================================== + * + * \author Juergen Vigna, jug@sad.it + * \author Angus Leeming, a.leeming@ic.ac.uk + */ + +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "ControlMinipage.h" +#include "Dialogs.h" +#include "LyXView.h" +#include "buffer.h" + +using SigC::slot; + +ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d) + : ControlInset(lv, d) +{ + d_.showMinipage.connect(slot(this, &ControlMinipage::showInset)); + d_.updateMinipage.connect(slot(this, &ControlMinipage::showInset)); +} + + +void ControlMinipage::applyParamsToInset() +{ + inset()->width(params().width); + inset()->widthp(params().widthp); + inset()->pos(params().pos); +} + + +void ControlMinipage::applyParamsNoInset() +{ +} + + +MinipageParams const ControlMinipage::getParams(InsetMinipage const & inset) +{ + return MinipageParams(inset); +} + + +MinipageParams::MinipageParams() + : widthp(0), pos(InsetMinipage::top) +{} + +MinipageParams::MinipageParams(InsetMinipage const & inset) + : width(inset.width()), widthp(inset.widthp()), pos(inset.pos()) +{} + +bool MinipageParams::operator==(MinipageParams const & o) const +{ + return (width == o.width && widthp == o.widthp && pos == o.pos); +} + +bool MinipageParams::operator!=(MinipageParams const & o) const +{ + return !(*this == o); +} diff --git a/src/frontends/controllers/ControlMinipage.h b/src/frontends/controllers/ControlMinipage.h new file mode 100644 index 0000000000..bc7222734d --- /dev/null +++ b/src/frontends/controllers/ControlMinipage.h @@ -0,0 +1,71 @@ +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2001 The LyX Team. + * + *====================================================== + * + * \file ControlMinipage.h + * \author Juergen Vigna, jug@sad.it + * \author Angus Leeming, a.leeming@ic.ac.uk + */ + +#ifndef CONTROLMINIPAGE_H +#define CONTROLMINIPAGE_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "ControlInset.h" +#include "insets/insetminipage.h" // InsetMinipage::Position + +/** This should be moved back into insetminipage.h and InsetMinipage should + contain an instance of it. */ + +struct MinipageParams { + /// + MinipageParams(); + /// + MinipageParams(InsetMinipage const &); + /// + bool operator==(MinipageParams const &) const; + /// + bool operator!=(MinipageParams const &) const; + + /// + string width; + /// + int widthp; + /// + InsetMinipage::Position pos; +}; + + +class InsetMinipage; +class MinipageParams; + +/** A controller for Minipage dialogs. + */ +class ControlMinipage : public ControlInset { +public: + /// + ControlMinipage(LyXView &, Dialogs &); + +private: + /// Dispatch the changed parameters to the kernel. + virtual void applyParamsToInset(); + /// + virtual void applyParamsNoInset(); + /// + virtual void clearDaughterParams() {} + /// get the parameters from the string passed to createInset. + virtual MinipageParams const getParams(string const &) + { return MinipageParams(); } + /// get the parameters from the inset passed to showInset. + virtual MinipageParams const getParams(InsetMinipage const &); +}; + +#endif diff --git a/src/frontends/controllers/ControlPreamble.C b/src/frontends/controllers/ControlPreamble.C new file mode 100644 index 0000000000..d298300446 --- /dev/null +++ b/src/frontends/controllers/ControlPreamble.C @@ -0,0 +1,63 @@ +/** + * \file FormPreamble.C + * Copyright 2001 The LyX Team. + * See the file COPYING. + * + * \author Edwin Leuven, leuven@fee.uva.nl + */ + +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "ControlPreamble.h" +#include "LyXView.h" +#include "Dialogs.h" +#include "buffer.h" +#include "lyxrc.h" +#include "Liason.h" + + +ControlPreamble::ControlPreamble(LyXView & lv, Dialogs & d) + : ControlDialog(lv, d) +{ + d_.showPreamble.connect(SigC::slot(this, &ControlPreamble::show)); +} + + +void ControlPreamble::apply() +{ + if (!lv_.view()->available()) + return; + + view().apply(); + + lv_.buffer()->params.preamble = params(); + lv_.buffer()->markDirty(); + Liason::setMinibuffer(&lv_, _("LaTeX preamble set")); +} + + +string & ControlPreamble::params() const +{ + Assert(params_); + return *params_; +} + + +void ControlPreamble::setParams() +{ + if (params_) delete params_; + params_ = new string(lv_.buffer()->params.preamble); +} + + +void ControlPreamble::clearParams() +{ + if (params_) { + delete params_; + params_ = 0; + } +} diff --git a/src/frontends/controllers/ControlPreamble.h b/src/frontends/controllers/ControlPreamble.h new file mode 100644 index 0000000000..71907fcc2b --- /dev/null +++ b/src/frontends/controllers/ControlPreamble.h @@ -0,0 +1,40 @@ +/** + * \file ControlPreamble.h + * Copyright 2001 The LyX Team. + * See the file COPYING. + * + * \author Edwin Leuven, leuven@fee.uva.nl + */ + +#ifndef CONTROLPREAMBLE_H +#define CONTROLPREAMBLE_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "ControlDialogs.h" + +/** A controller for Preamble dialogs. + */ +class ControlPreamble : public ControlDialog { +public: + /// + ControlPreamble(LyXView &, Dialogs &); + + /// + string & params() const; + +private: + /// Get changed parameters and Dispatch them to the kernel. + virtual void apply(); + /// set the params before show or update. + virtual void setParams(); + /// clean-up on hide. + virtual void clearParams(); + + /// + string * params_; +}; + +#endif // CONTROLPREAMBLE_H diff --git a/src/frontends/controllers/ControlPrint.C b/src/frontends/controllers/ControlPrint.C index ed9d21a3bf..183b8e0b2b 100644 --- a/src/frontends/controllers/ControlPrint.C +++ b/src/frontends/controllers/ControlPrint.C @@ -69,6 +69,8 @@ void ControlPrint::setParams() { if (params_) delete params_; params_ = new PrinterParams(getPrinterParams(lv_.buffer())); + + bc().valid(); // so that the user can press Ok } diff --git a/src/frontends/controllers/GUI.h b/src/frontends/controllers/GUI.h index fbe6a4ddf2..3881ec7564 100644 --- a/src/frontends/controllers/GUI.h +++ b/src/frontends/controllers/GUI.h @@ -168,6 +168,34 @@ public: }; +/** Specialization for Minipage dialog + */ +class ControlMinipage; + +template +class GUIMinipage : + public GUI { +public: + /// + GUIMinipage(LyXView & lv, Dialogs & d) + : GUI(lv, d) {} +}; + + +/** Specialization for Preamble dialog + */ +class ControlPreamble; + +template +class GUIPreamble : + public GUI { +public: + /// + GUIPreamble(LyXView & lv, Dialogs & d) + : GUI(lv, d) {} +}; + + /** Specialization for Print dialog */ class ControlPrint; diff --git a/src/frontends/controllers/Makefile.am b/src/frontends/controllers/Makefile.am index 66752dc88e..7a6784312d 100644 --- a/src/frontends/controllers/Makefile.am +++ b/src/frontends/controllers/Makefile.am @@ -40,6 +40,10 @@ libcontrollers_la_SOURCES=\ ControlInset.h \ ControlLog.C \ ControlLog.h \ + ControlMinipage.C \ + ControlMinipage.h \ + ControlPreamble.C \ + ControlPreamble.h \ ControlPrint.C \ ControlPrint.h \ ControlRef.C \ diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 3a4af75365..05c8fd97fb 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,5 +1,7 @@ 2001-03-27 Angus Leeming + * FormMinipage.[Ch]: + * forms/form_minipage.fd: * FormPrint.[Ch]: * forms/form_print.fd: * FormSplash.[Ch]: implemented controller-view split. @@ -8,6 +10,8 @@ 2001-03-26 Angus Leeming + * FormPreamble.[Ch]: + * forms/form_preamble.fd: * FormRef.[Ch]: * forms/form_ref.fd: * FormSearch.[Ch]: diff --git a/src/frontends/xforms/Dialogs.C b/src/frontends/xforms/Dialogs.C index 94f5d602fd..6d3721e2fe 100644 --- a/src/frontends/xforms/Dialogs.C +++ b/src/frontends/xforms/Dialogs.C @@ -28,6 +28,8 @@ #include "ControlError.h" #include "ControlInclude.h" #include "ControlLog.h" +#include "ControlMinipage.h" +#include "ControlPreamble.h" #include "ControlPrint.h" #include "ControlRef.h" #include "ControlSearch.h" @@ -48,6 +50,8 @@ #include "form_credits.h" #include "form_error.h" #include "form_include.h" +#include "form_minipage.h" +#include "form_preamble.h" #include "form_print.h" #include "form_ref.h" #include "form_search.h" @@ -64,6 +68,8 @@ #include "FormError.h" #include "FormInclude.h" #include "FormLog.h" +#include "FormMinipage.h" +#include "FormPreamble.h" #include "FormPrint.h" #include "FormRef.h" #include "FormSearch.h" @@ -78,11 +84,9 @@ #include "FormIndex.h" #include "FormMathsPanel.h" #include "FormParagraph.h" -#include "FormPreamble.h" #include "FormPreferences.h" #include "FormTabular.h" #include "FormToc.h" -#include "FormMinipage.h" // Signal enabling all visible popups to be redrawn if so desired. // E.g., when the GUI colours have been remapped. @@ -101,6 +105,8 @@ Dialogs::Dialogs(LyXView * lv) add(new GUIError(*lv, *this)); add(new GUIInclude(*lv, *this)); add(new GUILog(*lv, *this)); + add(new GUIMinipage(*lv, *this)); + add(new GUIPreamble(*lv, *this)); add(new GUIPrint(*lv, *this)); add(new GUIRef(*lv, *this)); add(new GUISearch(*lv, *this)); @@ -114,11 +120,9 @@ Dialogs::Dialogs(LyXView * lv) add(new FormIndex(lv, this)); add(new FormMathsPanel(lv, this)); add(new FormParagraph(lv, this)); - add(new FormPreamble(lv, this)); add(new FormPreferences(lv, this)); add(new FormTabular(lv, this)); add(new FormToc(lv, this)); - add(new FormMinipage(lv, this)); // reduce the number of connections needed in // dialogs by a simple connection here. diff --git a/src/frontends/xforms/FormCharacter.h b/src/frontends/xforms/FormCharacter.h index 648fea5c02..e4a41d8b18 100644 --- a/src/frontends/xforms/FormCharacter.h +++ b/src/frontends/xforms/FormCharacter.h @@ -25,7 +25,7 @@ class Combox; struct FD_form_character; /** - * This class provides an XForms implementation of the FormCharacter Dialog. + * This class provides an XForms implementation of the Character Dialog. * The character dialog allows users to change the character settings * in their documents. */ @@ -36,12 +36,12 @@ public: FormCharacter(ControlCharacter &); private: - /// Build the popup - virtual void build(); - /// Apply from popup virtual void apply(); + /// Build the popup + virtual void build(); + /// Nothing to update... virtual void update() {} diff --git a/src/frontends/xforms/FormMinipage.C b/src/frontends/xforms/FormMinipage.C index 9ff5cc1f38..bf3cb4a695 100644 --- a/src/frontends/xforms/FormMinipage.C +++ b/src/frontends/xforms/FormMinipage.C @@ -1,15 +1,14 @@ -// -*- C++ -*- /* This file is part of * ====================================================== * * LyX, The Document Processor * - * Copyright 2000 The LyX Team. + * Copyright 2001 The LyX Team. * * ====================================================== - */ -/* FormMinipage.C - * FormMinipage Interface Class Implementation + * + * \file FormMinipage.C + * \author Juergen Vigna, jug@sad.it */ #include @@ -18,105 +17,65 @@ #pragma implementation #endif +#include "xformsBC.h" +#include "ControlMinipage.h" #include "FormMinipage.h" #include "form_minipage.h" -#include "Dialogs.h" -#include "LyXView.h" -#include "buffer.h" -#include "insets/insetminipage.h" #include "support/lstrings.h" -FormMinipage::FormMinipage(LyXView * lv, Dialogs * d) - : FormInset(lv, d, _("Minipage Options")), - inset_(0) -{ - // let the dialog be shown - // This is a permanent connection so we won't bother - // storing a copy because we won't be disconnecting. - d->showMinipage.connect(SigC::slot(this, &FormMinipage::showInset)); - d->updateMinipage.connect(SigC::slot(this, &FormMinipage::updateInset)); -} - - -FL_FORM * FormMinipage::form() const -{ - if (dialog_.get()) - return dialog_->form; - return 0; -} - - -void FormMinipage::connect() -{ - bc().valid(true); - FormBaseBD::connect(); -} - +typedef FormCB > base_class; -void FormMinipage::showInset(InsetMinipage * inset) -{ - if (inset == 0) return; - - // If connected to another inset, disconnect from it. - if (inset_ != inset) { - ih_.disconnect(); - ih_ = inset->hideDialog.connect(SigC::slot(this, &FormMinipage::hide)); - inset_ = inset; - } +FormMinipage::FormMinipage(ControlMinipage & c) + : base_class(c, _("Minipage Options")) +{} - show(); -} - -void FormMinipage::updateInset(InsetMinipage * inset) +void FormMinipage::build() { - if (inset == 0 || inset_ == 0) return; + dialog_.reset(build_minipage()); - // If connected to another inset, disconnect from it. - if (inset_ != inset) { - ih_.disconnect(); - ih_ = inset->hideDialog.connect(SigC::slot(this, &FormMinipage::hide)); - inset_ = inset; - } + fl_set_input_return(dialog_->input_width, FL_RETURN_CHANGED); + fl_set_input_return(dialog_->input_widthp, FL_RETURN_CHANGED); - update(); -} - -void FormMinipage::build() -{ - dialog_.reset(build_minipage()); + // Manage the ok, apply and cancel/close buttons + bc().setOK(dialog_->button_ok); + bc().setApply(dialog_->button_apply); + bc().setCancel(dialog_->button_cancel); + bc().setUndoAll(dialog_->button_restore); - fl_set_input_return(dialog_->input_width, FL_RETURN_CHANGED); - fl_set_input_return(dialog_->input_widthp, FL_RETURN_CHANGED); + bc().addReadOnly(dialog_->input_width); + bc().addReadOnly(dialog_->input_widthp); + bc().addReadOnly(dialog_->radio_top); + bc().addReadOnly(dialog_->radio_middle); + bc().addReadOnly(dialog_->radio_bottom); - // Manage the ok, apply and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_cancel); - bc().refresh(); + bc().refresh(); } void FormMinipage::apply() { -#if 0 - int ysize = int(fl_get_slider_value(dialog_->slider_columns) + 0.5); - int xsize = int(fl_get_slider_value(dialog_->slider_rows) + 0.5); - - string tmp = tostr(xsize) + " " + tostr(ysize); - lv_->getLyXFunc()->Dispatch(LFUN_INSET_TABULAR, tmp); -#endif + controller().params().width = fl_get_input(dialog_->input_width); + controller().params().widthp = + strToInt(fl_get_input(dialog_->input_widthp)); + + if (fl_get_button(dialog_->radio_top)) + controller().params().pos = InsetMinipage::top; + else if (fl_get_button(dialog_->radio_middle)) + controller().params().pos = InsetMinipage::center; + else + controller().params().pos = InsetMinipage::bottom; } void FormMinipage::update() { - if (!inset_) - return; - fl_set_input(dialog_->input_width, inset_->width().c_str()); - fl_set_input(dialog_->input_widthp, tostr(inset_->widthp()).c_str()); + fl_set_input(dialog_->input_width, + controller().params().width.c_str()); + fl_set_input(dialog_->input_widthp, + tostr(controller().params().widthp).c_str()); - switch (inset_->pos()) { + switch (controller().params().pos) { case InsetMinipage::top: fl_set_button(dialog_->radio_top, 1); break; @@ -127,5 +86,4 @@ void FormMinipage::update() fl_set_button(dialog_->radio_bottom, 1); break; } - bc().readOnly(lv_->buffer()->isReadonly()); } diff --git a/src/frontends/xforms/FormMinipage.h b/src/frontends/xforms/FormMinipage.h index bba936b244..f0f92a9670 100644 --- a/src/frontends/xforms/FormMinipage.h +++ b/src/frontends/xforms/FormMinipage.h @@ -1,77 +1,51 @@ -// -*- C++ -*- /* This file is part of * ====================================================== * * LyX, The Document Processor * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2000 The LyX Team. + * Copyright 2001 The LyX Team. * - *======================================================*/ -/* FormMinipage.h - * FormMinipage Interface Class + *====================================================== + * + * \file FormMinipage.h + * \author Juergen Vigna, jug@sad.it */ #ifndef FORMMINIPAGE_H #define FORMMINIPAGE_H -#include - #ifdef __GNUG__ #pragma interface #endif -#include "FormInset.h" -#include "xformsBC.h" +#include "FormBase.h" class LyXView; class Dialogs; class InsetMinipage; struct FD_form_minipage; -/** This class provides an XForms implementation of the FormMinipage +/** This class provides an XForms implementation of the Minipage Dialog. */ -class FormMinipage : public FormInset { +class ControlMinipage; +struct FD_form_minipage; + +class FormMinipage : public FormCB > { public: - /// #FormMinipage x(LyXView ..., Dialogs ...);# - FormMinipage(LyXView *, Dialogs *); + /// + FormMinipage(ControlMinipage &); private: - /// Pointer to the actual instantiation of the ButtonController. - virtual xformsBC & bc(); - /// Connect signals etc. - virtual void connect(); - - /// Slot launching dialog to an existing inset - void showInset(InsetMinipage *); - /// Slot launching dialog to an existing inset - void updateInset(InsetMinipage *); - /// Apply from dialog + /// Set the Params variable for the Controller. virtual void apply(); - /// Update dialog before showing it - virtual void update(); - /// Pointer to the actual instantiation of the xforms form - virtual FL_FORM * form() const; - /// Build the dialog + /// Build the dialog. virtual void build(); + /// Update dialog before/whilst showing it. + virtual void update(); - /// + /// Fdesign generated method FD_form_minipage * build_minipage(); - - /// Real GUI implementation. - boost::scoped_ptr dialog_; - /// The ButtonController - ButtonController bc_; - - /// pointer to the inset passed through showInset - InsetMinipage * inset_; }; - -inline -xformsBC & FormMinipage::bc() -{ - return bc_; -} -#endif +#endif // FORMMINIPAGE_H diff --git a/src/frontends/xforms/FormPreamble.C b/src/frontends/xforms/FormPreamble.C index b68f411708..9e37c1df32 100644 --- a/src/frontends/xforms/FormPreamble.C +++ b/src/frontends/xforms/FormPreamble.C @@ -8,83 +8,52 @@ #include -#include FORMS_H_LOCATION - #ifdef __GNUG__ #pragma implementation #endif -#include "form_preamble.h" +#include "xformsBC.h" +#include "ControlPreamble.h" #include "FormPreamble.h" -#include "Dialogs.h" -#include "Liason.h" -#include "LyXView.h" -#include "buffer.h" -#include "gettext.h" +#include "form_preamble.h" #include "xforms_helpers.h" -using Liason::setMinibuffer; -using SigC::slot; +typedef FormCB > base_class; -FormPreamble::FormPreamble(LyXView * lv, Dialogs * d) - : FormBaseBD(lv, d, _("LaTeX preamble")) -{ - // let the popup be shown - // This is a permanent connection so we won't bother - // storing a copy because we won't be disconnecting. - d->showPreamble.connect(slot(this, &FormPreamble::show)); -} - - -FL_FORM * FormPreamble::form() const -{ - if (dialog_.get()) return dialog_->form; - return 0; -} +FormPreamble::FormPreamble(ControlPreamble & c) + : base_class(c, _("LaTeX preamble")) +{} void FormPreamble::build() { - dialog_.reset(build_preamble()); + dialog_.reset(build_preamble()); - fl_set_input_return(dialog_->input_preamble, FL_RETURN_CHANGED); - // Manage the ok, apply and cancel/close buttons - bc().setOK(dialog_->button_ok); - bc().setApply(dialog_->button_apply); - bc().setCancel(dialog_->button_cancel); - bc().addReadOnly(dialog_->input_preamble); - bc().refresh(); + fl_set_input_return(dialog_->input_preamble, FL_RETURN_CHANGED); + + // Manage the ok, apply and cancel/close buttons + bc().setOK(dialog_->button_ok); + bc().setApply(dialog_->button_apply); + bc().setCancel(dialog_->button_cancel); + bc().addReadOnly(dialog_->input_preamble); + bc().refresh(); } void FormPreamble::apply() { - if (!lv_->view()->available() || !dialog_.get()) - return; - - // is this needed?: - // lv_->view()->update(BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE); - - lv_->buffer()->params.preamble = fl_get_input(dialog_->input_preamble); - lv_->buffer()->markDirty(); - setMinibuffer(lv_, _("LaTeX preamble set")); + controller().params() = fl_get_input(dialog_->input_preamble); } void FormPreamble::update() { - if (!dialog_.get()) - return; - - fl_set_input(dialog_->input_preamble,lv_->buffer()->params.preamble.c_str()); + fl_set_input(dialog_->input_preamble, controller().params().c_str()); - bool const enable = (! lv_->buffer()->isReadonly()); - setEnabled(dialog_->input_preamble, enable); - setEnabled(dialog_->button_ok, enable); - setEnabled(dialog_->button_apply, enable); - - // need this? - // bc().readOnly(lv_->buffer()->isReadonly()); + bool const enable = (!controller().isReadonly()); + setEnabled(dialog_->input_preamble, enable); + setEnabled(dialog_->button_ok, enable); + setEnabled(dialog_->button_apply, enable); } diff --git a/src/frontends/xforms/FormPreamble.h b/src/frontends/xforms/FormPreamble.h index ee43a0a6e5..27dd6d0ed4 100644 --- a/src/frontends/xforms/FormPreamble.h +++ b/src/frontends/xforms/FormPreamble.h @@ -1,4 +1,3 @@ -// -*- C++ -*- /** * \file FormPreamble.h * Copyright 2001 The LyX Team. @@ -10,51 +9,32 @@ #ifndef FORMPREAMBLE_H #define FORMPREAMBLE_H -#include - #ifdef __GNUG__ #pragma interface #endif -#include "FormBaseDeprecated.h" +#include "FormBase.h" +class ControlPreamble; struct FD_form_preamble; -/** This class provides an XForms implementation of the FormPreamble Dialog. +/** This class provides an XForms implementation of the Preamble Dialog. */ -class FormPreamble : public FormBaseBD { +class FormPreamble : public FormCB > { public: /// - FormPreamble(LyXView *, Dialogs *); + FormPreamble(ControlPreamble &); private: - /// Pointer to the actual instantiation of the ButtonController. - virtual xformsBC & bc(); - - /// Filter the inputs - // virtual bool input(FL_OBJECT *, long); - - /// Build the popup - virtual void build(); /// Apply from popup virtual void apply(); + /// Build the popup + virtual void build(); /// Update the popup. virtual void update(); - /// - virtual FL_FORM * form() const; /// Fdesign generated method FD_form_preamble * build_preamble(); - - /// Real GUI implementation. - boost::scoped_ptr dialog_; - /// The ButtonController - ButtonController bc_; }; -inline -xformsBC & FormPreamble::bc() -{ - return bc_; -} -#endif +#endif // FORMPREAMBLE_H diff --git a/src/frontends/xforms/form_minipage.C b/src/frontends/xforms/form_minipage.C index 25c0ab0fbd..ed97867bec 100644 --- a/src/frontends/xforms/form_minipage.C +++ b/src/frontends/xforms/form_minipage.C @@ -35,7 +35,7 @@ FD_form_minipage * FormMinipage::build_minipage() fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); { // xgettext:no-c-format char const * const dummy = N_("or %|#o"); @@ -43,7 +43,7 @@ FD_form_minipage * FormMinipage::build_minipage() fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); obj = fl_add_text(FL_NORMAL_TEXT, 30, 10, 100, 20, _("Width")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); @@ -60,21 +60,21 @@ FD_form_minipage * FormMinipage::build_minipage() fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); { char const * const dummy = N_("Middle|#d"); fdui->radio_middle = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 249, 60, 152, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); { char const * const dummy = N_("Bottom|#B"); fdui->radio_bottom = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 249, 90, 152, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_end_group(); { @@ -83,24 +83,24 @@ FD_form_minipage * FormMinipage::build_minipage() fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseDeprecatedCancelCB, 0); + fl_set_object_callback(obj, C_FormBaseCancelCB, 0); { char const * const dummy = N_("Apply|#A"); fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 230, 130, 90, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseDeprecatedApplyCB, 0); + fl_set_object_callback(obj, C_FormBaseApplyCB, 0); fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 130, 130, 90, 30, _("OK")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseDeprecatedOKCB, 0); + fl_set_object_callback(obj, C_FormBaseOKCB, 0); { char const * const dummy = N_("Restore|#R"); fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 130, 90, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_callback(obj, C_FormBaseDeprecatedRestoreCB, 0); + fl_set_object_callback(obj, C_FormBaseRestoreCB, 0); fl_end_form(); fdui->form->fdui = fdui; diff --git a/src/frontends/xforms/form_minipage.h b/src/frontends/xforms/form_minipage.h index e9f9349964..bf386ac471 100644 --- a/src/frontends/xforms/form_minipage.h +++ b/src/frontends/xforms/form_minipage.h @@ -5,11 +5,11 @@ #define FD_form_minipage_h_ /** Callbacks, globals and object handlers **/ -extern "C" void C_FormBaseDeprecatedInputCB(FL_OBJECT *, long); -extern "C" void C_FormBaseDeprecatedCancelCB(FL_OBJECT *, long); -extern "C" void C_FormBaseDeprecatedApplyCB(FL_OBJECT *, long); -extern "C" void C_FormBaseDeprecatedOKCB(FL_OBJECT *, long); -extern "C" void C_FormBaseDeprecatedRestoreCB(FL_OBJECT *, long); +extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); +extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long); +extern "C" void C_FormBaseApplyCB(FL_OBJECT *, long); +extern "C" void C_FormBaseOKCB(FL_OBJECT *, long); +extern "C" void C_FormBaseRestoreCB(FL_OBJECT *, long); /**** Forms and Objects ****/ diff --git a/src/frontends/xforms/form_preamble.C b/src/frontends/xforms/form_preamble.C index b8ac189cb3..85e301e14b 100644 --- a/src/frontends/xforms/form_preamble.C +++ b/src/frontends/xforms/form_preamble.C @@ -32,7 +32,7 @@ FD_form_preamble * FormPreamble::build_preamble() } fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, C_FormBaseDeprecatedOKCB, 0); + fl_set_object_callback(obj, C_FormBaseOKCB, 0); { char const * const dummy = N_("Apply|#A"); fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 160, 380, 100, 30, idex(_(dummy))); @@ -40,7 +40,7 @@ FD_form_preamble * FormPreamble::build_preamble() } fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, C_FormBaseDeprecatedApplyCB, 0); + fl_set_object_callback(obj, C_FormBaseApplyCB, 0); { char const * const dummy = N_("Cancel|^["); fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 270, 380, 100, 30, idex(_(dummy))); @@ -48,11 +48,11 @@ FD_form_preamble * FormPreamble::build_preamble() } fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, C_FormBaseDeprecatedCancelCB, 0); + fl_set_object_callback(obj, C_FormBaseCancelCB, 0); fdui->input_preamble = obj = fl_add_input(FL_MULTILINE_INPUT, 10, 10, 360, 360, ""); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast); - fl_set_object_callback(obj, C_FormBaseDeprecatedInputCB, 0); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_end_form(); fdui->form->fdui = fdui; diff --git a/src/frontends/xforms/form_preamble.h b/src/frontends/xforms/form_preamble.h index 51607f04a6..6e826d0ddb 100644 --- a/src/frontends/xforms/form_preamble.h +++ b/src/frontends/xforms/form_preamble.h @@ -5,10 +5,10 @@ #define FD_form_preamble_h_ /** Callbacks, globals and object handlers **/ -extern "C" void C_FormBaseDeprecatedOKCB(FL_OBJECT *, long); -extern "C" void C_FormBaseDeprecatedApplyCB(FL_OBJECT *, long); -extern "C" void C_FormBaseDeprecatedCancelCB(FL_OBJECT *, long); -extern "C" void C_FormBaseDeprecatedInputCB(FL_OBJECT *, long); +extern "C" void C_FormBaseOKCB(FL_OBJECT *, long); +extern "C" void C_FormBaseApplyCB(FL_OBJECT *, long); +extern "C" void C_FormBaseCancelCB(FL_OBJECT *, long); +extern "C" void C_FormBaseInputCB(FL_OBJECT *, long); /**** Forms and Objects ****/ diff --git a/src/frontends/xforms/forms/form_minipage.fd b/src/frontends/xforms/forms/form_minipage.fd index 5875aa9fed..5a3e22e25b 100644 --- a/src/frontends/xforms/forms/form_minipage.fd +++ b/src/frontends/xforms/forms/form_minipage.fd @@ -81,7 +81,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_width -callback: C_FormBaseDeprecatedInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -99,7 +99,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_widthp -callback: C_FormBaseDeprecatedInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -171,7 +171,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_top -callback: C_FormBaseDeprecatedInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -189,7 +189,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_middle -callback: C_FormBaseDeprecatedInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -207,7 +207,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_bottom -callback: C_FormBaseDeprecatedInputCB +callback: C_FormBaseInputCB argument: 0 -------------------- @@ -243,7 +243,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_cancel -callback: C_FormBaseDeprecatedCancelCB +callback: C_FormBaseCancelCB argument: 0 -------------------- @@ -261,7 +261,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_apply -callback: C_FormBaseDeprecatedApplyCB +callback: C_FormBaseApplyCB argument: 0 -------------------- @@ -279,7 +279,7 @@ shortcut: ^M resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_ok -callback: C_FormBaseDeprecatedOKCB +callback: C_FormBaseOKCB argument: 0 -------------------- @@ -297,7 +297,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_restore -callback: C_FormBaseDeprecatedRestoreCB +callback: C_FormBaseRestoreCB argument: 0 ============================== diff --git a/src/frontends/xforms/forms/form_preamble.fd b/src/frontends/xforms/forms/form_preamble.fd index e464e35fe1..65b17ed7ed 100644 --- a/src/frontends/xforms/forms/form_preamble.fd +++ b/src/frontends/xforms/forms/form_preamble.fd @@ -46,7 +46,7 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthEast FL_SouthEast name: button_ok -callback: C_FormBaseDeprecatedOKCB +callback: C_FormBaseOKCB argument: 0 -------------------- @@ -64,7 +64,7 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthEast FL_SouthEast name: button_apply -callback: C_FormBaseDeprecatedApplyCB +callback: C_FormBaseApplyCB argument: 0 -------------------- @@ -82,7 +82,7 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthEast FL_SouthEast name: button_cancel -callback: C_FormBaseDeprecatedCancelCB +callback: C_FormBaseCancelCB argument: 0 -------------------- @@ -100,7 +100,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NorthWest FL_SouthEast name: input_preamble -callback: C_FormBaseDeprecatedInputCB +callback: C_FormBaseInputCB argument: ==============================