From f4b2be060fda5ce669c327608ca34933a83fbc58 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Sun, 9 Mar 2003 21:03:43 +0000 Subject: [PATCH] Port the Merge Changes dialog to the Dialog scheme. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6404 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView_pimpl.C | 4 +-- src/ChangeLog | 5 ++++ src/frontends/ChangeLog | 4 +++ src/frontends/Dialogs.h | 2 -- src/frontends/controllers/ControlChanges.C | 33 ++++++++++------------ src/frontends/controllers/ControlChanges.h | 20 +++++++------ src/frontends/qt2/Dialogs.C | 3 +- src/frontends/qt2/Dialogs2.C | 6 ---- src/frontends/qt2/Dialogs3.C | 15 +++++++--- src/frontends/qt2/Dialogs_impl.h | 7 ----- src/frontends/qt2/QChanges.C | 6 ++-- src/frontends/qt2/QChanges.h | 6 ++-- src/frontends/xforms/ChangeLog | 11 ++++++++ src/frontends/xforms/Dialogs.C | 3 +- src/frontends/xforms/Dialogs2.C | 6 ---- src/frontends/xforms/Dialogs3.C | 7 +++++ src/frontends/xforms/Dialogs_impl.h | 8 ------ src/frontends/xforms/FormChanges.C | 6 ++-- src/frontends/xforms/FormChanges.h | 7 +++-- src/frontends/xforms/forms/form_changes.fd | 8 +++--- 20 files changed, 86 insertions(+), 81 deletions(-) diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 26a65e87ff..79df187825 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -945,7 +945,7 @@ void BufferView::Pimpl::trackChanges() bool found = lyxfind::findNextChange(bv_); if (found) { - owner_->getDialogs().showMergeChanges(); + owner_->getDialogs().show("changes"); return; } @@ -1227,7 +1227,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in) break; case LFUN_MERGE_CHANGES: - owner_->getDialogs().showMergeChanges(); + owner_->getDialogs().show("changes"); break; case LFUN_ACCEPT_ALL_CHANGES: { diff --git a/src/ChangeLog b/src/ChangeLog index caedbc8f93..022004f15c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2003-03-09 Angus Leeming + + * BufferView_pimpl.C (trackChanges, dispatch): call + Dialogs::show("changes") rather than Dialogs::showMergeChanges(). + 2003-03-09 Angus Leeming * lyxfunc.C (dispatch): call Dialogs::show("about") rather diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index 73efec778f..db99b80f6b 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,7 @@ +2003-03-09 Angus Leeming + + * Dialogs.h: remove showMergeChanges. + 2003-03-09 Angus Leeming * Dialogs.h: remove showAboutlyx. diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index 1dfdb019a8..b6f9f4b8da 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -85,8 +85,6 @@ public: void showLogFile(); /// display the top-level maths panel void showMathPanel(); - /// show the merge changes dialog - void showMergeChanges(); /// void showParagraph(); /// diff --git a/src/frontends/controllers/ControlChanges.C b/src/frontends/controllers/ControlChanges.C index fcc42687dc..89b2a7fb83 100644 --- a/src/frontends/controllers/ControlChanges.C +++ b/src/frontends/controllers/ControlChanges.C @@ -10,35 +10,32 @@ #include -#include "ViewBase.h" -#include "ButtonControllerBase.h" #include "ControlChanges.h" #include "frontends/Dialogs.h" #include "frontends/LyXView.h" #include "buffer.h" -#include "lyxfind.h" -#include "lyxfunc.h" -#include "debug.h" #include "BufferView.h" -#include "support/lstrings.h" #include "funcrequest.h" +#include "lyxfind.h" +#include "lyxfunc.h" #include "author.h" +#include "support/lstrings.h" -ControlChanges::ControlChanges(LyXView & lv, Dialogs & d) - : ControlDialogBD(lv, d) -{ -} + +ControlChanges::ControlChanges(Dialog & parent) + : Dialog::Controller(parent) +{} void ControlChanges::find() { - lyxfind::findNextChange(bufferview()); + lyxfind::findNextChange(kernel().bufferview()); } string const ControlChanges::getChangeDate() { - Change c(bufferview()->getCurrentChange()); + Change c(kernel().bufferview()->getCurrentChange()); if (c.type == Change::UNCHANGED || !c.changetime) return string(); return ctime(&c.changetime); @@ -47,11 +44,11 @@ string const ControlChanges::getChangeDate() string const ControlChanges::getChangeAuthor() { - Change c(bufferview()->getCurrentChange()); + Change c(kernel().bufferview()->getCurrentChange()); if (c.type == Change::UNCHANGED) return string(); - Author const & a(bufferview()->buffer()->authors().get(c.author)); + Author const & a(kernel().buffer()->authors().get(c.author)); string author(a.name()); @@ -66,13 +63,13 @@ string const ControlChanges::getChangeAuthor() void ControlChanges::accept() { - lv_.dispatch(FuncRequest(LFUN_ACCEPT_CHANGE)); - lyxfind::findNextChange(bufferview()); + kernel().dispatch(FuncRequest(LFUN_ACCEPT_CHANGE)); + lyxfind::findNextChange(kernel().bufferview()); } void ControlChanges::reject() { - lv_.dispatch(FuncRequest(LFUN_REJECT_CHANGE)); - lyxfind::findNextChange(bufferview()); + kernel().dispatch(FuncRequest(LFUN_REJECT_CHANGE)); + lyxfind::findNextChange(kernel().bufferview()); } diff --git a/src/frontends/controllers/ControlChanges.h b/src/frontends/controllers/ControlChanges.h index 733393db56..d4fd3cc27f 100644 --- a/src/frontends/controllers/ControlChanges.h +++ b/src/frontends/controllers/ControlChanges.h @@ -12,15 +12,23 @@ #ifndef CONTROLCHANGES_H #define CONTROLCHANGES_H -#include "ControlDialog_impl.h" -#include "LString.h" +#include "Dialog.h" /** * A controller for the merge changes dialog. */ -class ControlChanges : public ControlDialogBD { +class ControlChanges : public Dialog::Controller { public: - ControlChanges(LyXView &, Dialogs &); + /// + ControlChanges(Dialog &); + /// + virtual void initialiseParams(string const &) {} + /// + virtual void clearParams() {} + /// + virtual void dispatchParams() {} + /// + virtual bool isBufferDependent() const { return true; } /// find the next merge chunk and highlight it void find(); @@ -36,10 +44,6 @@ public: /// reject the current merge void reject(); - -private: - /// not needed. - virtual void apply() {} }; #endif // CONTROLCHANGES_H diff --git a/src/frontends/qt2/Dialogs.C b/src/frontends/qt2/Dialogs.C index dc64fb4a27..7175f4d4e1 100644 --- a/src/frontends/qt2/Dialogs.C +++ b/src/frontends/qt2/Dialogs.C @@ -26,8 +26,7 @@ Dialogs::~Dialogs() Dialogs::Impl::Impl(LyXView & lv, Dialogs & d) - : changes(lv, d), - character(lv, d), + : character(lv, d), document(lv, d), file(lv, d), logfile(lv, d), diff --git a/src/frontends/qt2/Dialogs2.C b/src/frontends/qt2/Dialogs2.C index f2c6b10ffd..82d6b74959 100644 --- a/src/frontends/qt2/Dialogs2.C +++ b/src/frontends/qt2/Dialogs2.C @@ -15,12 +15,6 @@ #include "Dialogs_impl.h" -void Dialogs::showMergeChanges() -{ - pimpl_->changes.controller().show(); -} - - void Dialogs::showCharacter() { pimpl_->character.controller().show(); diff --git a/src/frontends/qt2/Dialogs3.C b/src/frontends/qt2/Dialogs3.C index bac3b686f2..a6b1ceb8d7 100644 --- a/src/frontends/qt2/Dialogs3.C +++ b/src/frontends/qt2/Dialogs3.C @@ -15,6 +15,7 @@ #include "ControlAboutlyx.h" #include "ControlBibtex.h" +#include "ControlChanges.h" #include "ControlCitation.h" #include "ControlError.h" #include "ControlERT.h" @@ -35,6 +36,8 @@ #include "QBibitemDialog.h" #include "QBibtex.h" #include "QBibtexDialog.h" +#include "QChanges.h" +#include "QChangesDialog.h" #include "QCitation.h" #include "QCitationDialog.h" #include "QError.h" @@ -89,10 +92,10 @@ typedef ButtonController namespace { -char const * const dialognames[] = { "about", "bibitem", "bibtex", "citation", - "error", "ert", "external", "float", - "graphics", "include", "index", "label", - "minipage", "ref", "tabular", +char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes", + "citation", "error", "ert", "external", + "float", "graphics", "include", "index", + "label", "minipage", "ref", "tabular", "tabularcreate", "toc", "url", "wrap" }; char const * const * const end_dialognames = @@ -137,6 +140,10 @@ Dialog * Dialogs::build(string const & name) dialog->setController(new ControlBibtex(*dialog)); dialog->setView(new QBibtex(*dialog)); dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + } else if (name == "changes") { + dialog->setController(new ControlChanges(*dialog)); + dialog->setView(new QChanges(*dialog)); + dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); } else if (name == "citation") { dialog->setController(new ControlCitation(*dialog)); dialog->setView(new QCitation(*dialog)); diff --git a/src/frontends/qt2/Dialogs_impl.h b/src/frontends/qt2/Dialogs_impl.h index 1f06f29798..4712a62132 100644 --- a/src/frontends/qt2/Dialogs_impl.h +++ b/src/frontends/qt2/Dialogs_impl.h @@ -14,7 +14,6 @@ #include "Dialogs.h" #include "controllers/GUI.h" -#include "ControlChanges.h" #include "ControlCharacter.h" #include "ControlDocument.h" #include "ControlForks.h" @@ -29,8 +28,6 @@ #include "ControlTexinfo.h" #include "ControlVCLog.h" -#include "QChanges.h" -#include "QChangesDialog.h" #include "QCharacter.h" #include "QCharacterDialog.h" #include "QDocument.h" @@ -72,9 +69,6 @@ -typedef GUI -ChangesDialog; - typedef GUI CharacterDialog; @@ -120,7 +114,6 @@ VCLogFileDialog; struct Dialogs::Impl { Impl(LyXView & lv, Dialogs & d); - ChangesDialog changes; CharacterDialog character; DocumentDialog document; FileDialog file; diff --git a/src/frontends/qt2/QChanges.C b/src/frontends/qt2/QChanges.C index 93707b1144..12e64834e0 100644 --- a/src/frontends/qt2/QChanges.C +++ b/src/frontends/qt2/QChanges.C @@ -20,11 +20,11 @@ #include "QChanges.h" #include "Qt2BC.h" -typedef Qt2CB > base_class; +typedef QController > base_class; -QChanges::QChanges() - : base_class(qt_("LyX: Merge Changes")) +QChanges::QChanges(Dialog & parent) + : base_class(parent, qt_("LyX: Merge Changes")) { } diff --git a/src/frontends/qt2/QChanges.h b/src/frontends/qt2/QChanges.h index 8ba79b08cb..ea2b5f223c 100644 --- a/src/frontends/qt2/QChanges.h +++ b/src/frontends/qt2/QChanges.h @@ -12,18 +12,18 @@ #ifndef QCHANGES_H #define QCHANGES_H -#include "Qt2Base.h" +#include "QDialogView.h" class ControlChanges; class QChangesDialog; class QChanges - : public Qt2CB > + : public QController > { public: friend class QChangesDialog; - QChanges(); + QChanges(Dialog &); void accept(); diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 5ca3a7c812..541014829d 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,14 @@ +2003-03-09 Angus Leeming + + * Dialogs.C: + * Dialogs2.C: + * Dialogs_impl.h: remove merge changes dialog. + + * Dialogs3.C: add merge changes dialog. + + * FormChanges.[Ch]: + * forms/form_changes.fd: changes to use the new Dialog-based scheme. + 2003-03-09 Angus Leeming * Dialogs.C: diff --git a/src/frontends/xforms/Dialogs.C b/src/frontends/xforms/Dialogs.C index f2fb43a93d..f7e615356b 100644 --- a/src/frontends/xforms/Dialogs.C +++ b/src/frontends/xforms/Dialogs.C @@ -26,8 +26,7 @@ Dialogs::~Dialogs() Dialogs::Impl::Impl(LyXView & lv, Dialogs & d) - : changes(lv, d), - character(lv, d), + : character(lv, d), document(lv, d), file(lv, d), forks(lv, d), diff --git a/src/frontends/xforms/Dialogs2.C b/src/frontends/xforms/Dialogs2.C index c272f3713b..9dc74d6f35 100644 --- a/src/frontends/xforms/Dialogs2.C +++ b/src/frontends/xforms/Dialogs2.C @@ -15,12 +15,6 @@ #include "Dialogs_impl.h" -void Dialogs::showMergeChanges() -{ - pimpl_->changes.controller().show(); -} - - void Dialogs::showCharacter() { pimpl_->character.controller().show(); diff --git a/src/frontends/xforms/Dialogs3.C b/src/frontends/xforms/Dialogs3.C index 4d5460b949..82767197b8 100644 --- a/src/frontends/xforms/Dialogs3.C +++ b/src/frontends/xforms/Dialogs3.C @@ -17,6 +17,7 @@ #include "ControlAboutlyx.h" #include "ControlBibtex.h" +#include "ControlChanges.h" #include "ControlCitation.h" #include "ControlCommand.h" #include "ControlError.h" @@ -38,6 +39,8 @@ #include "forms/form_bibitem.h" #include "FormBibtex.h" #include "forms/form_bibtex.h" +#include "FormChanges.h" +#include "forms/form_changes.h" #include "FormCitation.h" #include "forms/form_citation.h" #include "FormError.h" @@ -137,6 +140,10 @@ Dialog * Dialogs::build(string const & name) dialog->setController(new ControlBibtex(*dialog)); dialog->setView(new FormBibtex(*dialog)); dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); + } else if (name == "changes") { + dialog->setController(new ControlChanges(*dialog)); + dialog->setView(new FormChanges(*dialog)); + dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); } else if (name == "citation") { dialog->setController(new ControlCitation(*dialog)); dialog->setView(new FormCitation(*dialog)); diff --git a/src/frontends/xforms/Dialogs_impl.h b/src/frontends/xforms/Dialogs_impl.h index 3386904f6b..8fd40e7e17 100644 --- a/src/frontends/xforms/Dialogs_impl.h +++ b/src/frontends/xforms/Dialogs_impl.h @@ -21,10 +21,6 @@ #include "FormBrowser.h" #include "forms/form_browser.h" -#include "ControlChanges.h" -#include "FormChanges.h" -#include "forms/form_changes.h" - #include "ControlCharacter.h" #include "FormCharacter.h" #include "forms/form_character.h" @@ -88,9 +84,6 @@ #include "ControlVCLog.h" #include "FormVCLog.h" -typedef GUI -ChangesDialog; - typedef GUI CharacterDialog; @@ -144,7 +137,6 @@ VCLogFileDialog; struct Dialogs::Impl { Impl(LyXView & lv, Dialogs & d); - ChangesDialog changes; CharacterDialog character; DocumentDialog document; FileDialog file; diff --git a/src/frontends/xforms/FormChanges.C b/src/frontends/xforms/FormChanges.C index 3389fe9beb..bb2d592bf2 100644 --- a/src/frontends/xforms/FormChanges.C +++ b/src/frontends/xforms/FormChanges.C @@ -17,10 +17,10 @@ #include FORMS_H_LOCATION -typedef FormCB > base_class; +typedef FormController > base_class; -FormChanges::FormChanges() - : base_class(_("LyX: Merge changes")) +FormChanges::FormChanges(Dialog & parent) + : base_class(parent, _("LyX: Merge changes")) {} diff --git a/src/frontends/xforms/FormChanges.h b/src/frontends/xforms/FormChanges.h index fc680c5965..ca1752cc7d 100644 --- a/src/frontends/xforms/FormChanges.h +++ b/src/frontends/xforms/FormChanges.h @@ -12,7 +12,7 @@ #ifndef FORMCHANGES_H #define FORMCHANGES_H -#include "FormBase.h" +#include "FormDialogView.h" class ControlChanges; struct FD_changes; @@ -20,9 +20,10 @@ struct FD_changes; /** * This class provides an XForms implementation of the Merge Changes Dialog. */ -class FormChanges : public FormCB > { +class FormChanges + : public FormController > { public: - FormChanges(); + FormChanges(Dialog &); private: /// not needed. diff --git a/src/frontends/xforms/forms/form_changes.fd b/src/frontends/xforms/forms/form_changes.fd index a9a5cbf5cd..f73e6a80bf 100644 --- a/src/frontends/xforms/forms/form_changes.fd +++ b/src/frontends/xforms/forms/form_changes.fd @@ -45,7 +45,7 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthEast FL_SouthEast name: button_reject -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -63,7 +63,7 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthEast FL_SouthEast name: button_next -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -81,7 +81,7 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthEast FL_SouthEast name: button_accept -callback: C_FormBaseInputCB +callback: C_FormDialogView_InputCB argument: 0 -------------------- @@ -99,7 +99,7 @@ shortcut: resize: FL_RESIZE_NONE gravity: FL_SouthEast FL_SouthEast name: button_close -callback: C_FormBaseCancelCB +callback: C_FormDialogView_CancelCB argument: 0 -------------------- -- 2.39.2