From 7ae6332b03d5df51348c08e50211bac9e8da9f31 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 30 Mar 2004 19:18:14 +0000 Subject: [PATCH] Move the document dialog over to the Dialog-based scheme. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8566 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 5 + src/frontends/ChangeLog | 6 + src/frontends/Dialogs.h | 2 - src/frontends/controllers/ChangeLog | 4 + src/frontends/controllers/ControlDocument.C | 63 ++++---- src/frontends/controllers/ControlDocument.h | 29 ++-- src/frontends/gtk/ChangeLog | 4 + src/frontends/gtk/Dialogs.C | 12 +- src/frontends/guiapi.C | 6 - src/frontends/guiapi.h | 1 - src/frontends/qt2/ChangeLog | 7 + src/frontends/qt2/Dialogs.C | 14 +- src/frontends/qt2/Dialogs2.C | 20 +-- src/frontends/qt2/QDocument.C | 21 +-- src/frontends/qt2/QDocument.h | 11 +- src/frontends/qt2/QDocumentDialog.C | 1 + src/frontends/xforms/ChangeLog | 8 + src/frontends/xforms/Dialogs.C | 12 +- src/frontends/xforms/Dialogs2.C | 17 +-- src/frontends/xforms/FormDocument.C | 18 ++- src/frontends/xforms/FormDocument.h | 17 +-- src/frontends/xforms/forms/form_document.fd | 158 ++++++++++---------- src/lyxfunc.C | 2 - 23 files changed, 224 insertions(+), 214 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 82788e3b4d..2c82803a10 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-03-30 Angus Leeming + + * lyxfunc.C (dispatch): the specialization Dialogs::showDocument + has died. Fall through to the generic Dialogs::show("document"). + 2004-03-30 Angus Leeming * lfuns.h: diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index 8f72b642c6..44baae294d 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,9 @@ +2004-03-30 Angus Leeming + + * Dialogs.h (showDocument): removed. + + * guiapi.[Ch] (gui_ShowDocument): removed. + 2004-03-28 Angus Leeming * Dialogs.h (showPrint): removed. diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index d3ec0d02b0..0e1c17230d 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -66,8 +66,6 @@ public: Put into some sort of alphabetical order */ //@{ /// - void showDocument(); - /// void showPreamble(); /// void showPreferences(); diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index ab1ca56ef3..4cab6a2f48 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,7 @@ +2004-03-30 Angus Leeming + + * ControlDocument.[Ch]: converted to the dialog-based scheme. + 2004-03-30 Angus Leeming * ControlDocument.[Ch]: move all of the 'apply' code into the core diff --git a/src/frontends/controllers/ControlDocument.C b/src/frontends/controllers/ControlDocument.C index 00f32ba1e0..e353dece32 100644 --- a/src/frontends/controllers/ControlDocument.C +++ b/src/frontends/controllers/ControlDocument.C @@ -11,7 +11,7 @@ #include #include "ControlDocument.h" -#include "ViewBase.h" +#include "Kernel.h" #include "BranchList.h" #include "buffer.h" @@ -21,16 +21,14 @@ #include "LColor.h" #include "lyxtextclasslist.h" -#include "frontends/LyXView.h" - #include "support/std_sstream.h" using std::ostringstream; using std::string; -ControlDocument::ControlDocument(LyXView & lv, Dialogs & d) - : ControlDialogBD(lv, d), bp_(0) +ControlDocument::ControlDocument(Dialog & parent) + : Dialog::Controller(parent) {} @@ -38,24 +36,28 @@ ControlDocument::~ControlDocument() {} -void ControlDocument::setParams() +bool ControlDocument::initialiseParams(std::string const &) { - if (!bp_.get()) - bp_.reset(new BufferParams); - - /// Set the buffer parameters - *bp_ = buffer()->params(); + bp_.reset(new BufferParams); + *bp_ = kernel().buffer().params(); + return true; } -BufferParams & ControlDocument::params() +void ControlDocument::clearParams() +{ + bp_.reset(); +} + + +BufferParams & ControlDocument::params() const { BOOST_ASSERT(bp_.get()); return *bp_; } -LyXTextClass ControlDocument::textClass() +LyXTextClass const & ControlDocument::textClass() const { return textclasslist[bp_->textclass]; } @@ -63,38 +65,35 @@ LyXTextClass ControlDocument::textClass() namespace { -void dispatch_params(LyXView & lv, BufferParams const & bp, kb_action lfun) +void dispatch_bufferparams(Kernel const & kernel, BufferParams const & bp, + kb_action lfun) { ostringstream ss; bp.writeFile(ss); ss << "\\end_header\n"; - lv.dispatch(FuncRequest(lfun, ss.str())); + kernel.dispatch(FuncRequest(lfun, ss.str())); } } // namespace anon -void ControlDocument::apply() +void ControlDocument::dispatchParams() { - if (!bufferIsAvailable()) - return; - - view().apply(); - // This must come first so that a language change is correctly noticed setLanguage(); // Set the document class. - lyx::textclass_type const old_class = buffer()->params().textclass; + lyx::textclass_type const old_class = + kernel().buffer().params().textclass; lyx::textclass_type const new_class = bp_->textclass; if (new_class != old_class) { string const name = textclasslist[new_class].name(); - lv_.dispatch(FuncRequest(LFUN_TEXTCLASS_APPLY, name)); + kernel().dispatch(FuncRequest(LFUN_TEXTCLASS_APPLY, name)); } // Apply the BufferParams. - dispatch_params(lv_, params(), LFUN_BUFFERPARAMS_APPLY); + dispatch_bufferparams(kernel(), params(), LFUN_BUFFERPARAMS_APPLY); // Generate the colours requested by each new branch. BranchList & branchlist = params().branchlist(); @@ -112,29 +111,29 @@ void ControlDocument::apply() x11hexname = lcolor.getX11Name(LColor::background); // display the new color string const str = current_branch + ' ' + x11hexname; - lv_.dispatch(FuncRequest(LFUN_SET_COLOR, str)); + kernel().dispatch(FuncRequest(LFUN_SET_COLOR, str)); } // Open insets of selected branches, close deselected ones - lv_.dispatch(FuncRequest(LFUN_ALL_INSETS_TOGGLE, "toggle branch")); + kernel().dispatch(FuncRequest(LFUN_ALL_INSETS_TOGGLE, "toggle branch")); } -void ControlDocument::setLanguage() +void ControlDocument::setLanguage() const { Language const * const newL = bp_->language; - if (buffer()->params().language == newL) + if (kernel().buffer().params().language == newL) return; string const lang_name = newL->lang(); - lv_.dispatch(FuncRequest(LFUN_LANGUAGE_BUFFER, lang_name)); + kernel().dispatch(FuncRequest(LFUN_LANGUAGE_BUFFER, lang_name)); } bool ControlDocument::loadTextclass(lyx::textclass_type tc) const { string const name = textclasslist[tc].name(); - lv_.dispatch(FuncRequest(LFUN_TEXTCLASS_LOAD, name)); + kernel().dispatch(FuncRequest(LFUN_TEXTCLASS_LOAD, name)); // Report back whether we were able to change the class. bool const success = textclasslist[tc].loaded(); @@ -142,7 +141,7 @@ bool ControlDocument::loadTextclass(lyx::textclass_type tc) const } -void ControlDocument::saveAsDefault() +void ControlDocument::saveAsDefault() const { - dispatch_params(lv_, params(), LFUN_SAVE_AS_DEFAULT); + dispatch_bufferparams(kernel(), params(), LFUN_SAVE_AS_DEFAULT); } diff --git a/src/frontends/controllers/ControlDocument.h b/src/frontends/controllers/ControlDocument.h index 8aeabc291d..f761a787ff 100644 --- a/src/frontends/controllers/ControlDocument.h +++ b/src/frontends/controllers/ControlDocument.h @@ -12,40 +12,41 @@ #ifndef CONTROLDOCUMENT_H #define CONTROLDOCUMENT_H -#include "ControlDialog_impl.h" - +#include "Dialog.h" #include "support/types.h" - #include class BufferParams; -class Language; class LyXTextClass; /** A controller for Document dialogs. */ -class ControlDocument : public ControlDialogBD { +class ControlDocument : public Dialog::Controller { public: /// - ControlDocument(LyXView &, Dialogs &); + ControlDocument(Dialog &); /// ~ControlDocument(); /// - void setLanguage(); + virtual bool initialiseParams(std::string const & data); /// - LyXTextClass textClass(); + virtual void clearParams(); /// - BufferParams & params(); + virtual void dispatchParams(); /// - void saveAsDefault(); + virtual bool isBufferDependent() const { return true; } + /// + LyXTextClass const & textClass() const; + /// + BufferParams & params() const; + /// + void setLanguage() const; + /// + void saveAsDefault() const; /// bool loadTextclass(lyx::textclass_type tc) const; private: - /// apply settings - void apply(); - /// set the params before show or update - void setParams(); /// boost::scoped_ptr bp_; }; diff --git a/src/frontends/gtk/ChangeLog b/src/frontends/gtk/ChangeLog index cfe3a7667a..2e229cea8e 100644 --- a/src/frontends/gtk/ChangeLog +++ b/src/frontends/gtk/ChangeLog @@ -1,3 +1,7 @@ +2004-03-30 Angus Leeming + + * Dialogs.C (build) added document dialog. + 2004-03-28 Angus Leeming * Dialogs.C (build): added print dialog. diff --git a/src/frontends/gtk/Dialogs.C b/src/frontends/gtk/Dialogs.C index 24fcfef6d5..17e99732d7 100644 --- a/src/frontends/gtk/Dialogs.C +++ b/src/frontends/gtk/Dialogs.C @@ -23,6 +23,7 @@ #include "ControlCharacter.h" #include "ControlCitation.h" #include "ControlCommand.h" +#include "ControlDocument.h" #include "ControlErrorList.h" #include "ControlERT.h" #include "ControlExternal.h" @@ -55,6 +56,7 @@ #include "FormChanges.h" #include "FormCharacter.h" #include "FormCitation.h" +#include "FormDocument.h" #include "FormErrorList.h" #include "FormERT.h" #include "FormExternal.h" @@ -122,9 +124,9 @@ FormMathsBitmap * createFormBitmap(Dialog & parent, string const & title, char const * const dialognames[] = { "aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character", -"citation", "error", "errorlist" , "ert", "external", "file", "findreplace", -"float", "graphics", "include", "index", "label", "log", "mathpanel", -"mathaccents", "matharrows", "mathoperators", "mathrelations", +"citation", "document", "error", "errorlist" , "ert", "external", "file", +"findreplace", "float", "graphics", "include", "index", "label", "log", +"mathpanel", "mathaccents", "matharrows", "mathoperators", "mathrelations", "mathgreek", "mathmisc", "mathdots", "mathbigoperators", "mathamsmisc", "mathamsarrows", "mathamsrelations", "mathamsnegatedrelations", "mathamsoperators", "mathdelimiter", "mathmatrix", "mathspace", "mathstyle", @@ -195,6 +197,10 @@ Dialog * Dialogs::build(string const & name) dialog->setController(new ControlCitation(*dialog)); dialog->setView(new FormCitation(*dialog)); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); + } else if (name == "document") { + dialog->setController(new ControlDocument(*dialog)); + dialog->setView(new FormDocument(*dialog)); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "errorlist") { dialog->setController(new ControlErrorList(*dialog)); dialog->setView(new FormErrorList(*dialog)); diff --git a/src/frontends/guiapi.C b/src/frontends/guiapi.C index 398604b8c8..28537c4448 100644 --- a/src/frontends/guiapi.C +++ b/src/frontends/guiapi.C @@ -22,12 +22,6 @@ void gui_show_dialog(Dialogs * d, char const * name, char const * data) d->show(name, data, 0); } -void gui_ShowDocument(Dialogs & d) -{ - d.showDocument(); -} - - void gui_ShowPreamble(Dialogs & d) { d.showPreamble(); diff --git a/src/frontends/guiapi.h b/src/frontends/guiapi.h index ec72c87641..1182517e35 100644 --- a/src/frontends/guiapi.h +++ b/src/frontends/guiapi.h @@ -20,7 +20,6 @@ extern "C" { void gui_show_dialog(Dialogs *, char const * name, char const * data); -void gui_ShowDocument(Dialogs &); void gui_ShowPreamble(Dialogs &); void gui_ShowPreferences(Dialogs &); void gui_ShowSpellchecker(Dialogs &); diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 6d94a8f9e3..7885b8e6dc 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,10 @@ +2004-03-30 Angus Leeming + + * Dialogs.C (build): added document dialog. + * Dialogs2.C (showDocument): removed. + + * QDocument.[Ch]: converted to the Dialog-based scheme. + 2004-03-29 Jürgen Spitzmüller * QBibtex.C: diff --git a/src/frontends/qt2/Dialogs.C b/src/frontends/qt2/Dialogs.C index 244125cb78..47dea061de 100644 --- a/src/frontends/qt2/Dialogs.C +++ b/src/frontends/qt2/Dialogs.C @@ -19,6 +19,7 @@ #include "ControlChanges.h" #include "ControlCharacter.h" #include "ControlCitation.h" +#include "ControlDocument.h" #include "ControlErrorList.h" #include "ControlERT.h" #include "ControlExternal.h" @@ -50,6 +51,7 @@ #include "QChanges.h" #include "QCharacter.h" #include "QCitation.h" +#include "QDocument.h" #include "QErrorList.h" #include "QERT.h" #include "QExternal.h" @@ -92,10 +94,10 @@ namespace { char const * const dialognames[] = { "aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character", -"citation", "error", "errorlist", "ert", "external", "file", "findreplace", -"float", "graphics", "include", "index", "label", "log", "mathpanel", -"mathdelimiter", "mathmatrix", "note", "paragraph", "print", "ref", "sendto", -"tabular", "tabularcreate", "texinfo", +"citation", "document", "error", "errorlist", "ert", "external", "file", +"findreplace", "float", "graphics", "include", "index", "label", "log", +"mathpanel", "mathdelimiter", "mathmatrix", "note", "paragraph", "print", +"ref", "sendto", "tabular", "tabularcreate", "texinfo", #ifdef HAVE_LIBAIKSAURUS "thesaurus", @@ -166,6 +168,10 @@ Dialog * Dialogs::build(string const & name) dialog->setController(new ControlCitation(*dialog)); dialog->setView(new QCitation(*dialog)); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); + } else if (name == "document") { + dialog->setController(new ControlDocument(*dialog)); + dialog->setView(new QDocument(*dialog)); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "errorlist") { dialog->setController(new ControlErrorList(*dialog)); dialog->setView(new QErrorList(*dialog)); diff --git a/src/frontends/qt2/Dialogs2.C b/src/frontends/qt2/Dialogs2.C index ddbccb88d3..cb78d9d8b8 100644 --- a/src/frontends/qt2/Dialogs2.C +++ b/src/frontends/qt2/Dialogs2.C @@ -17,11 +17,10 @@ #include "controllers/GUI.h" #include "ButtonController.h" -#include "ControlDocument.h" +#include "Qt2BC.h" + #include "ControlSpellchecker.h" -#include "QDocument.h" -#include "QDocumentDialog.h" // Here would be an appropriate point to lecture on the evils // of the Qt headers, those most fucked up of disgusting ratholes. // But I won't. @@ -34,9 +33,6 @@ -typedef GUI -DocumentDialog; - typedef GUI PrefsDialog; @@ -46,15 +42,13 @@ SpellcheckerDialog; struct Dialogs::Impl { Impl(LyXView & lv, Dialogs & d); - DocumentDialog document; PrefsDialog prefs; SpellcheckerDialog spellchecker; }; Dialogs::Impl::Impl(LyXView & lv, Dialogs & d) - : document(lv, d), - prefs(lv, d), + : prefs(lv, d), spellchecker(lv, d) {} @@ -71,15 +65,9 @@ Dialogs::~Dialogs() } -void Dialogs::showDocument() -{ - pimpl_->document.controller().show(); -} - - void Dialogs::showPreamble() { - pimpl_->document.controller().show(); + show("document"); // Oh Angus, won't you help a poor child ? //pimpl_->document.view()->showPreamble(); } diff --git a/src/frontends/qt2/QDocument.C b/src/frontends/qt2/QDocument.C index 1109771c1b..54dba167fd 100644 --- a/src/frontends/qt2/QDocument.C +++ b/src/frontends/qt2/QDocument.C @@ -10,17 +10,14 @@ #include -#include "debug.h" -#include "qt_helpers.h" - -#include "ControlDocument.h" -#include "QDocument.h" -#include "QDocumentDialog.h" +#include "controllers/ControlDocument.h" #include "bufferparams.h" +#include "debug.h" #include "language.h" #include "helper_funcs.h" // getSecond() #include "frnt_lang.h" +#include "gettext.h" #include "lyxrc.h" // defaultUnit #include "tex-strings.h" // tex_graphics #include "support/tostr.h" @@ -28,6 +25,12 @@ #include "lyxtextclasslist.h" #include "floatplacement.h" +#include "QDocument.h" +#include "QDocumentDialog.h" +#include "Qt2BC.h" + +#include "qt_helpers.h" + #include #include #include @@ -45,7 +48,7 @@ using std::vector; using std::string; -typedef Qt2CB > base_class; +typedef QController > base_class; namespace { @@ -59,8 +62,8 @@ char const * encodings[] = { "LaTeX default", "latin1", "latin2", } -QDocument::QDocument() - : base_class(_("LyX: Document Settings")), +QDocument::QDocument(Dialog & parent) + : base_class(parent, _("LyX: Document Settings")), lang_(getSecond(frnt::getLanguageData(false))) {} diff --git a/src/frontends/qt2/QDocument.h b/src/frontends/qt2/QDocument.h index cbfc832482..52fef8f633 100644 --- a/src/frontends/qt2/QDocument.h +++ b/src/frontends/qt2/QDocument.h @@ -13,14 +13,11 @@ #ifndef QDOCUMENT_H #define QDOCUMENT_H - -#include "Qt2Base.h" -#include "Qt2BC.h" - +#include "QDialogView.h" #include "BranchList.h" - #include #include +#include class ControlDocument; @@ -29,13 +26,13 @@ class LengthCombo; class QLineEdit; class QDocument - : public Qt2CB > + : public QController > { public: friend class QDocumentDialog; - QDocument(); + QDocument(Dialog &); void showPreamble(); diff --git a/src/frontends/qt2/QDocumentDialog.C b/src/frontends/qt2/QDocumentDialog.C index 25dcf9edad..17b4cb0082 100644 --- a/src/frontends/qt2/QDocumentDialog.C +++ b/src/frontends/qt2/QDocumentDialog.C @@ -12,6 +12,7 @@ #include "bufferparams.h" #include "debug.h" +#include "gettext.h" #include "lyxrc.h" #include "controllers/ControlDocument.h" diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 6fb67f15ca..4ac69a3d97 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,11 @@ +2004-03-30 Angus Leeming + + * Dialogs.C (build): added document dialog. + * Dialogs2.C (showDocument): removed. + + * FormDocument.[Ch]: + * fomrs/form_document.fd: converted to the Dialog-based scheme. + 2004-03-29 Jürgen Spitzmüller * FormBibtex.C: diff --git a/src/frontends/xforms/Dialogs.C b/src/frontends/xforms/Dialogs.C index 7f535e5931..3eb9a86c75 100644 --- a/src/frontends/xforms/Dialogs.C +++ b/src/frontends/xforms/Dialogs.C @@ -20,6 +20,7 @@ #include "ControlBranch.h" #include "ControlChanges.h" #include "ControlCitation.h" +#include "ControlDocument.h" #include "ControlErrorList.h" #include "ControlERT.h" #include "ControlExternal.h" @@ -49,6 +50,7 @@ #include "FormChanges.h" #include "FormCharacter.h" #include "FormCitation.h" +#include "FormDocument.h" #include "FormErrorList.h" #include "FormERT.h" #include "FormExternal.h" @@ -117,9 +119,9 @@ FormMathsBitmap * createFormBitmap(Dialog & parent, string const & title, char const * const dialognames[] = { "aboutlyx", "bibitem", "bibtex", "box", "branch", "changes", "character", -"citation", "error", "errorlist" , "ert", "external", "file", "findreplace", -"float", "graphics", "include", "index", "label", "log", "mathpanel", -"mathaccents", "matharrows", "mathoperators", "mathrelations", +"citation", "document", "error", "errorlist" , "ert", "external", "file", +"findreplace", "float", "graphics", "include", "index", "label", "log", +"mathpanel", "mathaccents", "matharrows", "mathoperators", "mathrelations", "mathgreek", "mathmisc", "mathdots", "mathbigoperators", "mathamsmisc", "mathamsarrows", "mathamsrelations", "mathamsnegatedrelations", "mathamsoperators", "mathdelimiter", "mathmatrix", "mathspace", "mathstyle", @@ -193,6 +195,10 @@ Dialog * Dialogs::build(string const & name) dialog->setController(new ControlCitation(*dialog)); dialog->setView(new FormCitation(*dialog)); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); + } else if (name == "document") { + dialog->setController(new ControlDocument(*dialog)); + dialog->setView(new FormDocument(*dialog)); + dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); } else if (name == "errorlist") { dialog->setController(new ControlErrorList(*dialog)); dialog->setView(new FormErrorList(*dialog)); diff --git a/src/frontends/xforms/Dialogs2.C b/src/frontends/xforms/Dialogs2.C index 156c4ffe2d..1e667e8fd6 100644 --- a/src/frontends/xforms/Dialogs2.C +++ b/src/frontends/xforms/Dialogs2.C @@ -18,10 +18,6 @@ #include "xformsBC.h" #include "xforms_helpers.h" -#include "ControlDocument.h" -#include "FormDocument.h" -#include "forms/form_document.h" - #include "ControlPreamble.h" #include "FormPreamble.h" #include "forms/form_preamble.h" @@ -35,9 +31,6 @@ #include "FormSpellchecker.h" #include "forms/form_spellchecker.h" -typedef GUI -DocumentDialog; - typedef GUI PreambleDialog; @@ -51,7 +44,6 @@ SpellcheckerDialog; struct Dialogs::Impl { Impl(LyXView & lv, Dialogs & d); - DocumentDialog document; PreambleDialog preamble; PreferencesDialog preferences; SpellcheckerDialog spellchecker; @@ -59,8 +51,7 @@ struct Dialogs::Impl { Dialogs::Impl::Impl(LyXView & lv, Dialogs & d) - : document(lv, d), - preamble(lv, d), + : preamble(lv, d), preferences(lv, d), spellchecker(lv, d) {} @@ -78,12 +69,6 @@ Dialogs::~Dialogs() } -void Dialogs::showDocument() -{ - pimpl_->document.controller().show(); -} - - void Dialogs::showPreamble() { pimpl_->preamble.controller().show(); diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index 07bc5bb086..c64a5d34e8 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -14,9 +14,10 @@ #include #include "FormDocument.h" -#include "ControlDocument.h" #include "forms/form_document.h" +#include "controllers/ControlDocument.h" + #include "bmtable.h" #include "checkedwidgets.h" #include "ColorHandler.h" @@ -76,13 +77,17 @@ enum { JURABIB }; +enum GuiColors { + GUI_COLOR_CHOICE = FL_FREE_COL15 +}; + } // namespace anon -typedef FormCB > base_class; +typedef FormController > base_class; -FormDocument::FormDocument() - : base_class(_("Document Settings"), scalableTabfolders), +FormDocument::FormDocument(Dialog & parent) + : base_class(parent, _("Document Settings"), scalableTabfolders), ActCell(0), Confirmed(0), current_bullet_panel(0), current_bullet_depth(0), fbullet(0) {} @@ -1307,8 +1312,7 @@ void FormDocument::bullets_update(BufferParams const & params) (XpmVersion==4 && XpmRevision<7))) return; - bool const isLinuxDoc = - controller().docType() == ControlDocument::LINUXDOC; + bool const isLinuxDoc = kernel().docType() == Kernel::LINUXDOC; setEnabled(fbullet, !isLinuxDoc); if (isLinuxDoc) return; @@ -1369,7 +1373,7 @@ void FormDocument::branch_update(BufferParams const & params) void FormDocument::checkReadOnly() { - if (bc().readOnly(controller().bufferIsReadonly())) { + if (bc().readOnly(kernel().isBufferReadonly())) { postWarning(_("Document is read-only." " No changes to layout permitted.")); } else { diff --git a/src/frontends/xforms/FormDocument.h b/src/frontends/xforms/FormDocument.h index 729043ac32..c93ff2ebca 100644 --- a/src/frontends/xforms/FormDocument.h +++ b/src/frontends/xforms/FormDocument.h @@ -12,7 +12,7 @@ #ifndef FORM_DOCUMENT_H #define FORM_DOCUMENT_H -#include "FormBase.h" +#include "FormDialogView.h" #include "BranchList.h" #include "RadioButtonGroup.h" @@ -35,22 +35,13 @@ struct FD_document_options; struct FD_document_bullet; struct FD_document_branch; -namespace { - -enum GuiColors { - GUI_COLOR_CHOICE = FL_FREE_COL15 -}; - - -} - - /** This class provides an XForms implementation of the FormDocument dialog. * The table-layout-form here changes values for latex-tabulars */ -class FormDocument : public FormCB > { +class FormDocument + : public FormController > { public: - FormDocument(); + FormDocument(Dialog &); private: /** Redraw the form (on receipt of a Signal indicating, for example, that the xforms colours have been re-mapped). */ diff --git a/src/frontends/xforms/forms/form_document.fd b/src/frontends/xforms/forms/form_document.fd index e696ee4693..d09c332368 100644 --- a/src/frontends/xforms/forms/form_document.fd +++ b/src/frontends/xforms/forms/form_document.fd @@ -64,7 +64,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_close -callback: C_FormBaseCancelCB +callback: C_FormDialogView_CancelCB argument: 0 -------------------- @@ -82,7 +82,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_apply -callback: C_FormBaseApplyCB +callback: C_FormDialogView_ApplyCB argument: 0 -------------------- @@ -100,7 +100,7 @@ shortcut: ^M resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_ok -callback: C_FormBaseOKCB +callback: C_FormDialogView_OKCB argument: 0 -------------------- @@ -136,7 +136,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_restore -callback: C_FormBaseRestoreCB +callback: C_FormDialogView_RestoreCB argument: 0 -------------------- @@ -154,7 +154,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_save_defaults -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -172,7 +172,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_reset_defaults -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 =============== FORM =============== @@ -232,7 +232,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: choice_papersize -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -250,7 +250,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: input_custom_width -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -268,7 +268,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: choice_custom_width_units -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -286,7 +286,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: input_custom_height -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -304,7 +304,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: choice_custom_height_units -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -358,7 +358,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_portrait -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -376,7 +376,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_landscape -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -430,7 +430,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_use_geometry -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -448,7 +448,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: choice_paperpackage -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -466,7 +466,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: input_top_margin -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -484,7 +484,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: choice_top_margin_units -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -502,7 +502,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: input_bottom_margin -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -520,7 +520,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: choice_bottom_margin_units -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -538,7 +538,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: input_inner_margin -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -556,7 +556,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: choice_inner_margin_units -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -574,7 +574,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: input_outer_margin -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -592,7 +592,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: choice_outer_margin_units -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -610,7 +610,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: input_head_height -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -628,7 +628,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: choice_head_height_units -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -646,7 +646,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: input_head_sep -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -664,7 +664,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: choice_head_sep_units -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -682,7 +682,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: input_foot_skip -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -700,7 +700,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: choice_foot_skip_units -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 =============== FORM =============== @@ -796,7 +796,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: choice_fonts -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -814,7 +814,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: choice_fontsize -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -832,7 +832,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: combox_class -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -850,7 +850,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: choice_pagestyle -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -868,7 +868,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: choice_spacing -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -886,7 +886,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: input_extra -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -904,7 +904,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: input_skip -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -922,7 +922,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: choice_skip -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -958,7 +958,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_sides_one -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -976,7 +976,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_sides_two -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1030,7 +1030,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_columns_one -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1048,7 +1048,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_columns_two -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1102,7 +1102,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_indent -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1120,7 +1120,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_skip -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 value: 1 @@ -1157,7 +1157,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: input_spacing -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1175,7 +1175,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: choice_skip_units -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 =============== FORM =============== @@ -1217,7 +1217,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: choice_inputenc -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1235,7 +1235,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: choice_quotes_language -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1253,7 +1253,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: combox_language -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 =============== FORM =============== @@ -1295,7 +1295,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: input_float_placement -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1313,7 +1313,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: counter_secnumdepth -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 bounds: -2 5 precision: 0 @@ -1335,7 +1335,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: counter_tocdepth -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 bounds: -1 5 precision: 0 @@ -1357,7 +1357,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: choice_postscript_driver -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1375,7 +1375,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_use_natbib -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1393,7 +1393,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: choice_citation_format -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1411,7 +1411,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: choice_ams_math -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1447,7 +1447,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_use_jurabib -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1465,7 +1465,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_use_defcite -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1483,7 +1483,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: check_bibtopic -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 =============== FORM =============== @@ -1543,7 +1543,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: bmtable_panel -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1561,7 +1561,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: choice_size -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1579,7 +1579,7 @@ shortcut: resize: FL_RESIZE_X gravity: FL_NoGravity FL_NoGravity name: input_latex -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1615,7 +1615,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_depth_1 -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 value: 1 @@ -1634,7 +1634,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_depth_2 -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1652,7 +1652,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_depth_3 -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1670,7 +1670,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: radio_depth_4 -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1724,7 +1724,7 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity name: radio_panel_standard -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 value: 1 @@ -1743,7 +1743,7 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity name: radio_panel_maths -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1761,7 +1761,7 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity name: radio_panel_ding1 -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1779,7 +1779,7 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity name: radio_panel_ding2 -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1797,7 +1797,7 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity name: radio_panel_ding3 -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1815,7 +1815,7 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_NoGravity FL_NoGravity name: radio_panel_ding4 -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1875,7 +1875,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: input_all_branches -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1893,7 +1893,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_add_branch -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1911,7 +1911,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_remove_branch -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1929,7 +1929,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: browser_all_branches -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1947,7 +1947,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: browser_selection -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1965,7 +1965,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_select -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -1983,7 +1983,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_deselect -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -2019,7 +2019,7 @@ shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity name: button_modify -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 ============================== diff --git a/src/lyxfunc.C b/src/lyxfunc.C index fe575daf3c..dc86b748b5 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1024,8 +1024,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose) if (!data.empty()) owner->getDialogs().show("character", data); } - else if (name == "document") - owner->getDialogs().showDocument(); else if (name == "preamble") owner->getDialogs().showPreamble(); else if (name == "preferences")