From 6d47abda7f4c367949145942f40c336beb515a8f Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 25 Mar 2003 18:13:46 +0000 Subject: [PATCH] port the various dialogs to display the contents of an external file to the new Dialog-based scheme git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6575 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 4 ++ src/frontends/ChangeLog | 5 +++ src/frontends/Dialogs.h | 6 --- src/frontends/controllers/ChangeLog | 6 +++ src/frontends/controllers/ControlLog.C | 12 +++--- src/frontends/controllers/ControlLog.h | 26 ++++++------ src/frontends/controllers/ControlShowFile.C | 20 +++++---- src/frontends/controllers/ControlShowFile.h | 19 +++++---- src/frontends/controllers/ControlTexinfo.C | 2 +- src/frontends/controllers/ControlVCLog.C | 13 ++---- src/frontends/controllers/ControlVCLog.h | 23 +++++------ src/frontends/guiapi.C | 17 -------- src/frontends/guiapi.h | 3 -- src/frontends/qt2/ChangeLog | 14 ++++++- src/frontends/qt2/Dialogs.C | 16 +++----- src/frontends/qt2/Dialogs2.C | 18 --------- src/frontends/qt2/Dialogs3.C | 28 +++++++++++-- src/frontends/qt2/Dialogs_impl.h | 24 ----------- src/frontends/qt2/QLog.C | 6 +-- src/frontends/qt2/QLog.h | 7 ++-- src/frontends/qt2/QShowFile.C | 6 +-- src/frontends/qt2/QShowFile.h | 7 ++-- src/frontends/qt2/QVCLog.C | 6 +-- src/frontends/qt2/QVCLog.h | 7 ++-- src/frontends/xforms/ChangeLog | 14 +++++++ src/frontends/xforms/Dialogs.C | 16 +++----- src/frontends/xforms/Dialogs2.C | 18 --------- src/frontends/xforms/Dialogs3.C | 45 ++++++++++----------- src/frontends/xforms/Dialogs_impl.h | 25 ------------ src/frontends/xforms/FormBrowser.C | 5 ++- src/frontends/xforms/FormBrowser.h | 6 +-- src/frontends/xforms/FormLog.C | 4 +- src/frontends/xforms/FormLog.h | 5 +-- src/frontends/xforms/FormShowFile.C | 4 +- src/frontends/xforms/FormShowFile.h | 5 +-- src/frontends/xforms/FormVCLog.C | 4 +- src/frontends/xforms/FormVCLog.h | 4 +- src/frontends/xforms/forms/form_browser.fd | 4 +- src/lyxfunc.C | 4 +- 39 files changed, 200 insertions(+), 258 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index c7f1861e2e..c93fd0c3da 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2003-03-25 Angus Leeming + + * lyxfunc.C (dispatch): changes to the Dialogs interface. + 2003-03-25 Alfredo Braunstein * text2.C: diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index d400b74965..1ae1d75343 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,8 @@ +2003-03-25 Angus Leeming + + * Dialogs.h: remove showFile, showLogFile, showVCLogFile. + * guiapi.[Ch]: remove the gui_ equivalents. + 2003-03-22 John Levon * screen.C: diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index 97f7bbb4a5..6f0519e2e5 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -72,12 +72,8 @@ public: //@{ /// void showDocument(); - /// show the contents of a file. - void showFile(string const &); /// show all forked child processes void showForks(); - /// show the LaTeX log or build file - void showLogFile(); /// display the top-level maths panel void showMathPanel(); /// @@ -96,8 +92,6 @@ public: void showTexinfo(); /// show the thesaurus dialog void showThesaurus(string const &); - /// show the version control log - void showVCLogFile(); //@} /** \param name == "about" etc; an identifier used to diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index 7c636ecf08..57385d9767 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,9 @@ +2003-03-25 Angus Leeming + + * ControlLog.[Ch]: + * ControlShowFile.[Ch]: + * ControlVCLog.[Ch]: rewrite to use the Dialog-based scheme. + 2003-03-24 John Levon * ControlMath.C: include Pr function diff --git a/src/frontends/controllers/ControlLog.C b/src/frontends/controllers/ControlLog.C index 2c1bc027fd..83adb29e6a 100644 --- a/src/frontends/controllers/ControlLog.C +++ b/src/frontends/controllers/ControlLog.C @@ -11,20 +11,18 @@ #include - #include "ControlLog.h" -#include "buffer.h" - -ControlLog::ControlLog(LyXView & lv, Dialogs & d) - : ControlDialogBD(lv, d) +ControlLog::ControlLog(Dialog & parent) + : Dialog::Controller(parent) {} -void ControlLog::setParams() +bool ControlLog::initialiseParams(string const &) { - logfile_ = buffer()->getLogName(); + logfile_ = kernel().buffer()->getLogName(); + return true; } diff --git a/src/frontends/controllers/ControlLog.h b/src/frontends/controllers/ControlLog.h index e8c50d1d38..aec1f362c5 100644 --- a/src/frontends/controllers/ControlLog.h +++ b/src/frontends/controllers/ControlLog.h @@ -13,30 +13,30 @@ #ifndef CONTROLLOG_H #define CONTROLLOG_H -#include - - -#include "ControlDialog_impl.h" +#include "Dialog.h" #include "buffer.h" // Buffer::LogType +#include /** * A controller for a read-only text browser. */ -class ControlLog : public ControlDialogBD { +class ControlLog : public Dialog::Controller { public: /// - ControlLog(LyXView &, Dialogs &); + ControlLog(Dialog &); + /// + virtual bool initialiseParams(string const &); /// - std::pair const & logfile() { + virtual void clearParams(); + /// + virtual void dispatchParams() {} + /// + virtual bool isBufferDependent() const { return true; } + /// + std::pair const & logfile() const { return logfile_; } private: - /// - virtual void apply() {} - /// set the params before show or update - virtual void setParams(); - /// clean-up on hide. - virtual void clearParams(); std::pair logfile_; }; diff --git a/src/frontends/controllers/ControlShowFile.C b/src/frontends/controllers/ControlShowFile.C index 78eb25dce9..b541dfd228 100644 --- a/src/frontends/controllers/ControlShowFile.C +++ b/src/frontends/controllers/ControlShowFile.C @@ -10,21 +10,25 @@ #include - #include "ControlShowFile.h" - -#include "support/filetools.h" // FileSearch +#include "support/filetools.h" -ControlShowFile::ControlShowFile(LyXView & lv, Dialogs & d) - : ControlDialogBI(lv, d) +ControlShowFile::ControlShowFile(Dialog & parent) + : Dialog::Controller(parent) {} -void ControlShowFile::showFile(string const & file) +bool ControlShowFile::initialiseParams(string const & data) +{ + filename_ = data; + return true; +} + + +void ControlShowFile::clearParams() { - filename_ = file; - show(); + filename_.erase(); } diff --git a/src/frontends/controllers/ControlShowFile.h b/src/frontends/controllers/ControlShowFile.h index 19e8171228..654dc93f36 100644 --- a/src/frontends/controllers/ControlShowFile.h +++ b/src/frontends/controllers/ControlShowFile.h @@ -4,6 +4,7 @@ * Licence details can be found in the file COPYING. * * \file ControlShowFile.h + * * \author Herbert Voss * * Full author contact details are available in file CREDITS @@ -11,26 +12,28 @@ #ifndef CONTROLSHOWFILE_H #define CONTROLSHOWFILE_H - -#include "ControlDialog_impl.h" -#include "LString.h" +#include "Dialog.h" /** A controller for the ShowFile dialog. */ -class ControlShowFile : public ControlDialogBI { +class ControlShowFile : public Dialog::Controller { public: /// - ControlShowFile(LyXView &, Dialogs &); + ControlShowFile(Dialog &); + /// + virtual bool initialiseParams(string const &); + /// + virtual void clearParams(); + /// + virtual void dispatchParams() {} /// - virtual void showFile(string const &); + virtual bool isBufferDependent() const { return false; } /// string getFileContents(); /// string getFileName(); private: - /// not needed. - virtual void apply() {} /// string filename_; }; diff --git a/src/frontends/controllers/ControlTexinfo.C b/src/frontends/controllers/ControlTexinfo.C index 72e657d72c..5ef2811385 100644 --- a/src/frontends/controllers/ControlTexinfo.C +++ b/src/frontends/controllers/ControlTexinfo.C @@ -81,7 +81,7 @@ ControlTexinfo::getContents(texFileSuffix type, bool withFullPath) const void ControlTexinfo::viewFile(string const filename) const { - lv_.getDialogs().showFile(filename); + lv_.getDialogs().show("file", filename); } diff --git a/src/frontends/controllers/ControlVCLog.C b/src/frontends/controllers/ControlVCLog.C index 7048f79c3c..5f79518a17 100644 --- a/src/frontends/controllers/ControlVCLog.C +++ b/src/frontends/controllers/ControlVCLog.C @@ -11,35 +11,30 @@ #include - #include "ControlVCLog.h" -#include "ButtonController.h" #include "buffer.h" -#include "lyxrc.h" #include "gettext.h" - #include "support/lyxlib.h" - #include using std::endl; using std::ostream; -ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d) - : ControlDialogBD(lv, d) +ControlVCLog::ControlVCLog(Dialog & parent) + : Dialog::Controller(parent) {} string const ControlVCLog::getBufferFileName() const { - return buffer()->fileName(); + return kernel().buffer()->fileName(); } void ControlVCLog::getVCLogFile(ostream & ss) const { - string const name = buffer()->lyxvc.getLogFile(); + string const name = kernel().buffer()->lyxvc.getLogFile(); std::ifstream in(name.c_str()); diff --git a/src/frontends/controllers/ControlVCLog.h b/src/frontends/controllers/ControlVCLog.h index 4499c6fc77..ba7ffb3237 100644 --- a/src/frontends/controllers/ControlVCLog.h +++ b/src/frontends/controllers/ControlVCLog.h @@ -13,25 +13,24 @@ #ifndef CONTROLVCLOG_H #define CONTROLVCLOG_H +#include "Dialog.h" -#include "ControlDialog_impl.h" - -#include "LString.h" - -/** - * A controller for the Version Control log viewer. - */ -class ControlVCLog : public ControlDialogBD { +class ControlVCLog : public Dialog::Controller { public: /// - ControlVCLog(LyXView &, Dialogs &); + ControlVCLog(Dialog &); + /// + virtual bool initialiseParams(string const &) { return true; } + /// + virtual void clearParams() {} + /// + virtual void dispatchParams() {} + /// + virtual bool isBufferDependent() const { return true; } /// put the log file into the ostream void getVCLogFile(std::ostream & ss) const; /// get the filename of the buffer string const getBufferFileName() const; -private: - /// - virtual void apply() {} }; #endif // CONTROLVCLOG_H diff --git a/src/frontends/guiapi.C b/src/frontends/guiapi.C index 205a1c3844..ea34d09fd3 100644 --- a/src/frontends/guiapi.C +++ b/src/frontends/guiapi.C @@ -27,24 +27,12 @@ void gui_ShowDocument(Dialogs & d) } -void gui_ShowFile(string const & f, Dialogs & d) -{ - d.showFile(f); -} - - void gui_ShowForks(Dialogs & d) { d.showForks(); } -void gui_ShowLogFile(Dialogs & d) -{ - d.showLogFile(); -} - - void gui_ShowMathPanel(Dialogs & d) { d.showMathPanel(); @@ -99,9 +87,4 @@ void gui_ShowThesaurus(string const & s, Dialogs & d) } -void gui_ShowVCLogFile(Dialogs & d) -{ - d.showVCLogFile(); -} - } // extern "C" diff --git a/src/frontends/guiapi.h b/src/frontends/guiapi.h index 1108b6fb4e..ebaa03b559 100644 --- a/src/frontends/guiapi.h +++ b/src/frontends/guiapi.h @@ -22,9 +22,7 @@ extern "C" { void gui_show_dialog(Dialogs *, char const * name, char const * data); void gui_ShowDocument(Dialogs &); -void gui_ShowFile(string const &, Dialogs &); void gui_ShowForks(Dialogs &); -void gui_ShowLogFile(Dialogs &); void gui_ShowMathPanel(Dialogs &); void gui_ShowPreamble(Dialogs &); void gui_ShowPreferences(Dialogs &); @@ -34,7 +32,6 @@ void gui_ShowSendto(Dialogs &); void gui_ShowSpellchecker(Dialogs &); void gui_ShowTexinfo(Dialogs &); void gui_ShowThesaurus(string const &, Dialogs &); -void gui_ShowVCLogFile(Dialogs &); } // extern "C" diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index a9086f7712..e0718bad9e 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,15 @@ +2003-03-25 Angus Leeming + + * Dialogs.C: + * Dialogs2.C: + * Dialogs_impl.h: remove the log, showfile and vclog dialogs. + + * Dialogs3.C: add these dialogs. + + * QLog.[Ch]: + * QShowFile.[Ch]: + * QVCLog.[Ch]: changes to use the new Dialog-based scheme. + 2003-03-23 John Levon * lyx_gui.C: remove unused variables @@ -33,7 +45,7 @@ * Dialogs2.C: * Dialogs_impl.h: remove paragraph dialog. - * Dialogs3.C: addparagraph dialog. + * Dialogs3.C: add paragraph dialog. * QParagraph.[Ch]: changes to use the new Dialog-based scheme. diff --git a/src/frontends/qt2/Dialogs.C b/src/frontends/qt2/Dialogs.C index 29f645acf2..de108477ce 100644 --- a/src/frontends/qt2/Dialogs.C +++ b/src/frontends/qt2/Dialogs.C @@ -27,19 +27,15 @@ Dialogs::~Dialogs() Dialogs::Impl::Impl(LyXView & lv, Dialogs & d) - : document(lv, d), - file(lv, d), - logfile(lv, d), + : +#ifdef HAVE_LIBAIKSAURUS + thesaurus(lv, d), +#endif + document(lv, d), prefs(lv, d), print(lv, d), search(lv, d), sendto(lv, d), spellchecker(lv, d), - texinfo(lv, d), - -#ifdef HAVE_LIBAIKSAURUS - thesaurus(lv, d), -#endif - - vclogfile(lv, d) + texinfo(lv, d) {} diff --git a/src/frontends/qt2/Dialogs2.C b/src/frontends/qt2/Dialogs2.C index 2b658cb1a5..59d1dd8543 100644 --- a/src/frontends/qt2/Dialogs2.C +++ b/src/frontends/qt2/Dialogs2.C @@ -21,22 +21,10 @@ void Dialogs::showDocument() } -void Dialogs::showFile(string const & f) -{ - pimpl_->file.controller().showFile(f); -} - - void Dialogs::showForks() {} -void Dialogs::showLogFile() -{ - pimpl_->logfile.controller().show(); -} - - void Dialogs::showMathPanel() { // FIXME FIXME FIXME @@ -101,9 +89,3 @@ void Dialogs::showThesaurus(string const &) {} #endif - - -void Dialogs::showVCLogFile() -{ - pimpl_->vclogfile.controller().show(); -} diff --git a/src/frontends/qt2/Dialogs3.C b/src/frontends/qt2/Dialogs3.C index 9681e97daa..7668900146 100644 --- a/src/frontends/qt2/Dialogs3.C +++ b/src/frontends/qt2/Dialogs3.C @@ -24,12 +24,15 @@ #include "ControlFloat.h" #include "ControlGraphics.h" #include "ControlInclude.h" +#include "ControlLog.h" #include "ControlMinipage.h" #include "ControlParagraph.h" #include "ControlRef.h" +#include "ControlShowFile.h" #include "ControlTabular.h" #include "ControlTabularCreate.h" #include "ControlToc.h" +#include "ControlVCLog.h" #include "ControlWrap.h" #include "QAbout.h" @@ -62,12 +65,16 @@ #include "QIncludeDialog.h" #include "QIndex.h" #include "QIndexDialog.h" +#include "QLog.h" +#include "QLogDialog.h" #include "QMinipage.h" #include "QMinipageDialog.h" #include "QParagraph.h" #include "QParagraphDialog.h" #include "QRef.h" #include "QRefDialog.h" +#include "QShowFile.h" +#include "QShowFileDialog.h" #include "QTabular.h" #include "QTabularDialog.h" #include "QTabularCreate.h" @@ -76,6 +83,9 @@ #include "QTocDialog.h" #include "QURL.h" #include "QURLDialog.h" +#include "QVCLog.h" +#include "QVCLogDialog.h" + #include "QWrap.h" #include "QWrapDialog.h" @@ -87,9 +97,9 @@ namespace { char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes", -"character", "citation", "error", "ert", "external", "float", "graphics", -"include", "index", "label", "minipage", "paragraph", "ref", "tabular", -"tabularcreate", "toc", "url", "wrap" }; +"character", "citation", "error", "ert", "external", "file", "float", +"graphics", "include", "index", "label", "log", "minipage", "paragraph", +"ref", "tabular", "tabularcreate", "toc", "url", "vclog", "wrap" }; char const * const * const end_dialognames = dialognames + (sizeof(dialognames) / sizeof(char *)); @@ -158,6 +168,10 @@ Dialog * Dialogs::build(string const & name) dialog->setController(new ControlExternal(*dialog)); dialog->setView(new QExternal(*dialog)); dialog->bc().bp(new OkApplyCancelReadOnlyPolicy); + } else if (name == "file") { + dialog->setController(new ControlShowFile(*dialog)); + dialog->setView(new QShowFile(*dialog)); + dialog->bc().bp(new OkCancelPolicy); } else if (name == "float") { dialog->setController(new ControlFloat(*dialog)); dialog->setView(new QFloat(*dialog)); @@ -182,6 +196,10 @@ Dialog * Dialogs::build(string const & name) qt_("LyX: Insert Label"), qt_("&Label"))); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); + } else if (name == "log") { + dialog->setController(new ControlLog(*dialog)); + dialog->setView(new QLog(*dialog)); + dialog->bc().bp(new OkCancelPolicy); } else if (name == "minipage") { dialog->setController(new ControlMinipage(*dialog)); dialog->setView(new QMinipage(*dialog)); @@ -210,6 +228,10 @@ Dialog * Dialogs::build(string const & name) dialog->setController(new ControlCommand(*dialog, name)); dialog->setView(new QURL(*dialog)); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); + } else if (name == "vclog") { + dialog->setController(new ControlVCLog(*dialog)); + dialog->setView(new QVCLog(*dialog)); + dialog->bc().bp(new OkCancelPolicy); } else if (name == "wrap") { dialog->setController(new ControlWrap(*dialog)); dialog->setView(new QWrap(*dialog)); diff --git a/src/frontends/qt2/Dialogs_impl.h b/src/frontends/qt2/Dialogs_impl.h index 8166bfa5c6..c1ab3de9a7 100644 --- a/src/frontends/qt2/Dialogs_impl.h +++ b/src/frontends/qt2/Dialogs_impl.h @@ -16,15 +16,12 @@ #include "ControlDocument.h" #include "ControlForks.h" -#include "ControlLog.h" #include "ControlPrefs.h" #include "ControlPrint.h" #include "ControlSearch.h" #include "ControlSendto.h" -#include "ControlShowFile.h" #include "ControlSpellchecker.h" #include "ControlTexinfo.h" -#include "ControlVCLog.h" #include "QCharacter.h" #include "QCharacterDialog.h" @@ -35,8 +32,6 @@ // of the Qt headers, those most fucked up of disgusting ratholes. // But I won't. #undef signals -#include "QLog.h" -#include "QLogDialog.h" #include "QPrefs.h" #include "QPrefsDialog.h" #include "QPrint.h" @@ -45,8 +40,6 @@ #include "QSearchDialog.h" #include "QSendto.h" #include "QSendtoDialog.h" -#include "QShowFile.h" -#include "QShowFileDialog.h" #include "QSpellchecker.h" #include "QSpellcheckerDialog.h" #include "QTexinfo.h" @@ -58,9 +51,6 @@ #include "QThesaurusDialog.h" #endif -#include "QVCLog.h" -#include "QVCLogDialog.h" - #include "Qt2BC.h" @@ -68,12 +58,6 @@ typedef GUI DocumentDialog; -typedef GUI -FileDialog; - -typedef GUI -LogFileDialog; - typedef GUI PrefsDialog; @@ -97,16 +81,10 @@ typedef GUI ThesaurusDialog; #endif -typedef GUI -VCLogFileDialog; - - struct Dialogs::Impl { Impl(LyXView & lv, Dialogs & d); DocumentDialog document; - FileDialog file; - LogFileDialog logfile; PrefsDialog prefs; PrintDialog print; SearchDialog search; @@ -117,8 +95,6 @@ struct Dialogs::Impl { #ifdef HAVE_LIBAIKSAURUS ThesaurusDialog thesaurus; #endif - - VCLogFileDialog vclogfile; }; #endif // DIALOGS_IMPL_H diff --git a/src/frontends/qt2/QLog.C b/src/frontends/qt2/QLog.C index b6dbfc0321..9ea5a027f5 100644 --- a/src/frontends/qt2/QLog.C +++ b/src/frontends/qt2/QLog.C @@ -28,10 +28,10 @@ using std::ifstream; using std::getline; -typedef Qt2CB > base_class; +typedef QController > base_class; -QLog::QLog() - : base_class(qt_("LyX: LaTeX Log")) +QLog::QLog(Dialog & parent) + : base_class(parent, qt_("LyX: LaTeX Log")) { } diff --git a/src/frontends/qt2/QLog.h b/src/frontends/qt2/QLog.h index 41f6dce092..240ad259b0 100644 --- a/src/frontends/qt2/QLog.h +++ b/src/frontends/qt2/QLog.h @@ -13,20 +13,21 @@ #define QLOG_H -#include "Qt2Base.h" +#include "QDialogView.h" + class ControlLog; class QLogDialog; /// class QLog - : public Qt2CB > + : public QController > { public: /// friend class QLogDialog; /// - QLog(); + QLog(Dialog &); private: /// Apply changes virtual void apply() {} diff --git a/src/frontends/qt2/QShowFile.C b/src/frontends/qt2/QShowFile.C index 924e9b4e6a..a79e0525d0 100644 --- a/src/frontends/qt2/QShowFile.C +++ b/src/frontends/qt2/QShowFile.C @@ -21,11 +21,11 @@ #include #include -typedef Qt2CB > base_class; +typedef QController > base_class; -QShowFile::QShowFile() - : base_class(qt_("LyX: Show File")) +QShowFile::QShowFile(Dialog & parent) + : base_class(parent, qt_("LyX: Show File")) { } diff --git a/src/frontends/qt2/QShowFile.h b/src/frontends/qt2/QShowFile.h index d209c8cd43..f7d2f65d53 100644 --- a/src/frontends/qt2/QShowFile.h +++ b/src/frontends/qt2/QShowFile.h @@ -13,19 +13,20 @@ #define QSHOWFILE_H -#include "Qt2Base.h" +#include "QDialogView.h" + class ControlShowFile; class QShowFileDialog; class QShowFile - : public Qt2CB > + : public QController > { public: friend class QShowFileDialog; - QShowFile(); + QShowFile(Dialog &); private: /// Apply changes virtual void apply() {} diff --git a/src/frontends/qt2/QVCLog.C b/src/frontends/qt2/QVCLog.C index 4645eaf963..c28508453c 100644 --- a/src/frontends/qt2/QVCLog.C +++ b/src/frontends/qt2/QVCLog.C @@ -25,11 +25,11 @@ #include "BoostFormat.h" -typedef Qt2CB > base_class; +typedef QController > base_class; -QVCLog::QVCLog() - : base_class(qt_("LyX: Version Control Log")) +QVCLog::QVCLog(Dialog & parent) + : base_class(parent, qt_("LyX: Version Control Log")) { } diff --git a/src/frontends/qt2/QVCLog.h b/src/frontends/qt2/QVCLog.h index 153c0ad1ad..3cb56c8d45 100644 --- a/src/frontends/qt2/QVCLog.h +++ b/src/frontends/qt2/QVCLog.h @@ -13,20 +13,21 @@ #define QVCLOG_H -#include "Qt2Base.h" +#include "QDialogView.h" + class ControlVCLog; class QVCLogDialog; /// class QVCLog - : public Qt2CB > + : public QController > { public: /// friend class QVCLogDialog; /// - QVCLog(); + QVCLog(Dialog &); private: /// Apply changes virtual void apply() {} diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 5f24bcc840..148061c3c8 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,17 @@ +2003-03-25 Angus Leeming + + * Dialogs.C: + * Dialogs2.C: + * Dialogs_impl.h: remove the log, showfile and vclog dialogs. + + * Dialogs3.C: add these dialogs. + + * FormBrowser.[Ch]: + * forms/form_browser.fd: + * FormLog.[Ch]: + * FormShowFile.[Ch]: + * FormVCLog.[Ch]: changes to use the new Dialog-based scheme. + 2003-03-25 Angus Leeming * xformsImage.C (clip): cure compiler warnings. diff --git a/src/frontends/xforms/Dialogs.C b/src/frontends/xforms/Dialogs.C index b98402937b..3d302c46db 100644 --- a/src/frontends/xforms/Dialogs.C +++ b/src/frontends/xforms/Dialogs.C @@ -27,10 +27,12 @@ Dialogs::~Dialogs() Dialogs::Impl::Impl(LyXView & lv, Dialogs & d) - : document(lv, d), - file(lv, d), + : +#ifdef HAVE_LIBAIKSAURUS + thesaurus(lv, d), +#endif + document(lv, d), forks(lv, d), - logfile(lv, d), mathpanel(lv, d), preamble(lv, d), preferences(lv, d), @@ -38,11 +40,5 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d) search(lv, d), sendto(lv, d), spellchecker(lv, d), - texinfo(lv, d), - -#ifdef HAVE_LIBAIKSAURUS - thesaurus(lv, d), -#endif - - vclogfile(lv, d) + texinfo(lv, d) {} diff --git a/src/frontends/xforms/Dialogs2.C b/src/frontends/xforms/Dialogs2.C index dd7570638c..10d2989954 100644 --- a/src/frontends/xforms/Dialogs2.C +++ b/src/frontends/xforms/Dialogs2.C @@ -21,24 +21,12 @@ void Dialogs::showDocument() } -void Dialogs::showFile(string const & f) -{ - pimpl_->file.controller().showFile(f); -} - - void Dialogs::showForks() { pimpl_->forks.controller().show(); } -void Dialogs::showLogFile() -{ - pimpl_->logfile.controller().show(); -} - - void Dialogs::showMathPanel() { pimpl_->mathpanel.controller().show(); @@ -100,9 +88,3 @@ void Dialogs::showThesaurus(string const &) {} #endif - - -void Dialogs::showVCLogFile() -{ - pimpl_->vclogfile.controller().show(); -} diff --git a/src/frontends/xforms/Dialogs3.C b/src/frontends/xforms/Dialogs3.C index 20384e34d5..a1a8595a8d 100644 --- a/src/frontends/xforms/Dialogs3.C +++ b/src/frontends/xforms/Dialogs3.C @@ -27,56 +27,41 @@ #include "ControlFloat.h" #include "ControlGraphics.h" #include "ControlInclude.h" +#include "ControlLog.h" #include "ControlMinipage.h" #include "ControlParagraph.h" #include "ControlRef.h" +#include "ControlShowFile.h" #include "ControlTabular.h" #include "ControlTabularCreate.h" #include "ControlToc.h" +#include "ControlVCLog.h" #include "ControlWrap.h" #include "FormAboutlyx.h" -#include "forms/form_aboutlyx.h" #include "FormBibitem.h" -#include "forms/form_bibitem.h" #include "FormBibtex.h" -#include "forms/form_bibtex.h" #include "FormChanges.h" -#include "forms/form_changes.h" #include "FormCharacter.h" -#include "forms/form_character.h" #include "FormCitation.h" -#include "forms/form_citation.h" #include "FormError.h" -#include "forms/form_error.h" #include "FormERT.h" -#include "forms/form_ert.h" #include "FormExternal.h" -#include "forms/form_external.h" #include "FormFloat.h" -#include "forms/form_float.h" #include "FormGraphics.h" -#include "forms/form_graphics.h" #include "FormInclude.h" -#include "forms/form_include.h" +#include "FormLog.h" #include "FormMinipage.h" -#include "forms/form_minipage.h" #include "FormParagraph.h" -#include "forms/form_paragraph.h" #include "FormRef.h" -#include "forms/form_ref.h" #include "FormTabular.h" -#include "forms/form_tabular.h" +#include "FormShowFile.h" #include "FormTabularCreate.h" -#include "forms/form_tabular_create.h" #include "FormText.h" -#include "forms/form_text.h" #include "FormToc.h" -#include "forms/form_toc.h" #include "FormUrl.h" -#include "forms/form_url.h" +#include "FormVCLog.h" #include "FormWrap.h" -#include "forms/form_wrap.h" #include "xformsBC.h" #include "ButtonController.h" @@ -85,9 +70,9 @@ namespace { char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes", -"character", "citation", "error", "ert", "external", "float", "graphics", -"include", "index", "label", "minipage", "paragraph", "ref", "tabular", -"tabularcreate", "toc", "url", "wrap" }; +"character", "citation", "error", "ert", "external", "file", "float", +"graphics", "include", "index", "label", "log", "minipage", "paragraph", +"ref", "tabular", "tabularcreate", "toc", "url", "vclog", "wrap" }; char const * const * const end_dialognames = dialognames + (sizeof(dialognames) / sizeof(char *)); @@ -156,6 +141,10 @@ Dialog * Dialogs::build(string const & name) dialog->setController(new ControlExternal(*dialog)); dialog->setView(new FormExternal(*dialog)); dialog->bc().bp(new OkApplyCancelReadOnlyPolicy); + } else if (name == "file") { + dialog->setController(new ControlShowFile(*dialog)); + dialog->setView(new FormShowFile(*dialog)); + dialog->bc().bp(new OkCancelPolicy); } else if (name == "float") { dialog->setController(new ControlFloat(*dialog)); dialog->setView(new FormFloat(*dialog)); @@ -178,6 +167,10 @@ Dialog * Dialogs::build(string const & name) dialog->setView(new FormText(*dialog, _("Label"), _("Label:|#L"))); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); + } else if (name == "log") { + dialog->setController(new ControlLog(*dialog)); + dialog->setView(new FormLog(*dialog)); + dialog->bc().bp(new OkCancelPolicy); } else if (name == "minipage") { dialog->setController(new ControlMinipage(*dialog)); dialog->setView(new FormMinipage(*dialog)); @@ -206,6 +199,10 @@ Dialog * Dialogs::build(string const & name) dialog->setController(new ControlCommand(*dialog, name)); dialog->setView(new FormUrl(*dialog)); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); + } else if (name == "vclog") { + dialog->setController(new ControlVCLog(*dialog)); + dialog->setView(new FormVCLog(*dialog)); + dialog->bc().bp(new OkCancelPolicy); } else if (name == "wrap") { dialog->setController(new ControlWrap(*dialog)); dialog->setView(new FormWrap(*dialog)); diff --git a/src/frontends/xforms/Dialogs_impl.h b/src/frontends/xforms/Dialogs_impl.h index be4eb9cc50..6d8ff0056e 100644 --- a/src/frontends/xforms/Dialogs_impl.h +++ b/src/frontends/xforms/Dialogs_impl.h @@ -18,9 +18,6 @@ #include "xformsBC.h" #include "combox.h" -#include "FormBrowser.h" -#include "forms/form_browser.h" - #include "ControlDocument.h" #include "FormDocument.h" #include "forms/form_document.h" @@ -29,12 +26,6 @@ #include "FormForks.h" #include "forms/form_forks.h" -#include "ControlLog.h" -#include "FormLog.h" - -#include "ControlShowFile.h" -#include "FormShowFile.h" - #include "ControlMath.h" #include "FormMathsPanel.h" #include "forms/form_maths_panel.h" @@ -73,21 +64,12 @@ #include "forms/form_thesaurus.h" #endif -#include "ControlVCLog.h" -#include "FormVCLog.h" - typedef GUI DocumentDialog; -typedef GUI -FileDialog; - typedef GUI ForksDialog; -typedef GUI -LogFileDialog; - typedef GUI MathPanelDialog; @@ -117,16 +99,11 @@ typedef GUI -VCLogFileDialog; - struct Dialogs::Impl { Impl(LyXView & lv, Dialogs & d); DocumentDialog document; - FileDialog file; ForksDialog forks; - LogFileDialog logfile; MathPanelDialog mathpanel; PreambleDialog preamble; PreferencesDialog preferences; @@ -139,8 +116,6 @@ struct Dialogs::Impl { #ifdef HAVE_LIBAIKSAURUS ThesaurusDialog thesaurus; #endif - - VCLogFileDialog vclogfile; }; #endif // DIALOGS_IMPL_H diff --git a/src/frontends/xforms/FormBrowser.C b/src/frontends/xforms/FormBrowser.C index 19b670b2ea..ee9d1e09ef 100644 --- a/src/frontends/xforms/FormBrowser.C +++ b/src/frontends/xforms/FormBrowser.C @@ -15,8 +15,9 @@ #include "forms/form_browser.h" #include "xformsBC.h" -FormBrowser::FormBrowser(string const & t, bool allowResize) - : FormDB(t, allowResize) +FormBrowser::FormBrowser(Dialog & parent, + string const & title, bool allowResize) + : FormView(parent, title, allowResize) {} diff --git a/src/frontends/xforms/FormBrowser.h b/src/frontends/xforms/FormBrowser.h index c038c5e5df..7b480e4513 100644 --- a/src/frontends/xforms/FormBrowser.h +++ b/src/frontends/xforms/FormBrowser.h @@ -14,7 +14,7 @@ #define FORMBROWSER_H -#include "FormBase.h" +#include "FormDialogView.h" /** * This class provides an XForms implementation of a read only @@ -22,10 +22,10 @@ */ struct FD_browser; -class FormBrowser : public FormDB { +class FormBrowser : public FormView { public: /// - FormBrowser(string const &, bool allowResize = true); + FormBrowser(Dialog &, string const &, bool allowResize = true); private: /// Build the dialog. virtual void build(); diff --git a/src/frontends/xforms/FormLog.C b/src/frontends/xforms/FormLog.C index c5f59c2be3..911da5c6f7 100644 --- a/src/frontends/xforms/FormLog.C +++ b/src/frontends/xforms/FormLog.C @@ -18,8 +18,8 @@ #include "gettext.h" #include FORMS_H_LOCATION -FormLog::FormLog() - : FormCB( _("LaTeX Log")) +FormLog::FormLog(Dialog & parent) + : FormController(parent, _("LaTeX Log")) {} diff --git a/src/frontends/xforms/FormLog.h b/src/frontends/xforms/FormLog.h index 94fefd9981..1a270d30d3 100644 --- a/src/frontends/xforms/FormLog.h +++ b/src/frontends/xforms/FormLog.h @@ -12,7 +12,6 @@ #ifndef FORMLOG_H #define FORMLOG_H - #include "FormBrowser.h" class ControlLog; @@ -21,10 +20,10 @@ class ControlLog; * This class provides an XForms implementation of the LaTeX log dialog * for viewing the last LaTeX log file. */ -class FormLog : public FormCB { +class FormLog : public FormController { public: /// - FormLog(); + FormLog(Dialog &); // Functions accessible to the Controller. diff --git a/src/frontends/xforms/FormShowFile.C b/src/frontends/xforms/FormShowFile.C index 0cff21c7d2..dc5bb6e777 100644 --- a/src/frontends/xforms/FormShowFile.C +++ b/src/frontends/xforms/FormShowFile.C @@ -19,8 +19,8 @@ #include FORMS_H_LOCATION -FormShowFile::FormShowFile() - : FormCB(_("Show File")) +FormShowFile::FormShowFile(Dialog & parent) + : FormController(parent, _("Show File")) {} diff --git a/src/frontends/xforms/FormShowFile.h b/src/frontends/xforms/FormShowFile.h index ed69adc4c9..82e7d4c33f 100644 --- a/src/frontends/xforms/FormShowFile.h +++ b/src/frontends/xforms/FormShowFile.h @@ -12,7 +12,6 @@ #ifndef FORMSHOWFILE_H #define FORMSHOWFILE_H - #include "FormBrowser.h" class ControlShowFile; @@ -21,10 +20,10 @@ class ControlShowFile; * This class provides an XForms implementation of a dialog to browse through a * Help file. */ -class FormShowFile : public FormCB { +class FormShowFile : public FormController { public: /// - FormShowFile(); + FormShowFile(Dialog &); // Functions accessible to the Controller. diff --git a/src/frontends/xforms/FormVCLog.C b/src/frontends/xforms/FormVCLog.C index 372ed66639..a5d49915a3 100644 --- a/src/frontends/xforms/FormVCLog.C +++ b/src/frontends/xforms/FormVCLog.C @@ -20,8 +20,8 @@ #include FORMS_H_LOCATION -FormVCLog::FormVCLog() - : FormCB(_("Version Control Log")) +FormVCLog::FormVCLog(Dialog & parent) + : FormController(parent, _("Version Control Log")) {} diff --git a/src/frontends/xforms/FormVCLog.h b/src/frontends/xforms/FormVCLog.h index 540b7ca032..410fcb9e96 100644 --- a/src/frontends/xforms/FormVCLog.h +++ b/src/frontends/xforms/FormVCLog.h @@ -21,10 +21,10 @@ class ControlVCLog; * This class provides an XForms implementation of the Version Control * log viewer */ -class FormVCLog : public FormCB { +class FormVCLog : public FormController { public: /// - FormVCLog(); + FormVCLog(Dialog &); // Functions accessible to the Controller. diff --git a/src/frontends/xforms/forms/form_browser.fd b/src/frontends/xforms/forms/form_browser.fd index c866869f03..4dfdbb3956 100644 --- a/src/frontends/xforms/forms/form_browser.fd +++ b/src/frontends/xforms/forms/form_browser.fd @@ -64,7 +64,7 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthEast FL_SouthEast name: button_close -callback: C_FormBaseCancelCB +callback: C_FormDialogView_CancelCB argument: 0 -------------------- @@ -82,7 +82,7 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthEast FL_SouthEast name: button_update -callback: C_FormBaseRestoreCB +callback: C_FormDialogView_RestoreCB argument: 0 ============================== diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 0d90659bc3..ae1fa6e2e5 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1202,7 +1202,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) case LFUN_VC_HISTORY: { - owner->getDialogs().showVCLogFile(); + owner->getDialogs().show("vclog"); break; } @@ -1226,7 +1226,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose) break; case LFUN_LATEX_LOG: - owner->getDialogs().showLogFile(); + owner->getDialogs().show("log"); break; case LFUN_LAYOUT_DOCUMENT: -- 2.39.5