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
This commit is contained in:
Angus Leeming 2003-03-09 21:03:43 +00:00
parent 5ec0a44b09
commit f4b2be060f
20 changed files with 86 additions and 81 deletions

View File

@ -945,7 +945,7 @@ void BufferView::Pimpl::trackChanges()
bool found = lyxfind::findNextChange(bv_); bool found = lyxfind::findNextChange(bv_);
if (found) { if (found) {
owner_->getDialogs().showMergeChanges(); owner_->getDialogs().show("changes");
return; return;
} }
@ -1227,7 +1227,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
break; break;
case LFUN_MERGE_CHANGES: case LFUN_MERGE_CHANGES:
owner_->getDialogs().showMergeChanges(); owner_->getDialogs().show("changes");
break; break;
case LFUN_ACCEPT_ALL_CHANGES: { case LFUN_ACCEPT_ALL_CHANGES: {

View File

@ -1,3 +1,8 @@
2003-03-09 Angus Leeming <leeming@lyx.org>
* BufferView_pimpl.C (trackChanges, dispatch): call
Dialogs::show("changes") rather than Dialogs::showMergeChanges().
2003-03-09 Angus Leeming <leeming@lyx.org> 2003-03-09 Angus Leeming <leeming@lyx.org>
* lyxfunc.C (dispatch): call Dialogs::show("about") rather * lyxfunc.C (dispatch): call Dialogs::show("about") rather

View File

@ -1,3 +1,7 @@
2003-03-09 Angus Leeming <leeming@lyx.org>
* Dialogs.h: remove showMergeChanges.
2003-03-09 Angus Leeming <leeming@lyx.org> 2003-03-09 Angus Leeming <leeming@lyx.org>
* Dialogs.h: remove showAboutlyx. * Dialogs.h: remove showAboutlyx.

View File

@ -85,8 +85,6 @@ public:
void showLogFile(); void showLogFile();
/// display the top-level maths panel /// display the top-level maths panel
void showMathPanel(); void showMathPanel();
/// show the merge changes dialog
void showMergeChanges();
/// ///
void showParagraph(); void showParagraph();
/// ///

View File

@ -10,35 +10,32 @@
#include <config.h> #include <config.h>
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlChanges.h" #include "ControlChanges.h"
#include "frontends/Dialogs.h" #include "frontends/Dialogs.h"
#include "frontends/LyXView.h" #include "frontends/LyXView.h"
#include "buffer.h" #include "buffer.h"
#include "BufferView.h"
#include "funcrequest.h"
#include "lyxfind.h" #include "lyxfind.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "debug.h"
#include "BufferView.h"
#include "support/lstrings.h"
#include "funcrequest.h"
#include "author.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() void ControlChanges::find()
{ {
lyxfind::findNextChange(bufferview()); lyxfind::findNextChange(kernel().bufferview());
} }
string const ControlChanges::getChangeDate() string const ControlChanges::getChangeDate()
{ {
Change c(bufferview()->getCurrentChange()); Change c(kernel().bufferview()->getCurrentChange());
if (c.type == Change::UNCHANGED || !c.changetime) if (c.type == Change::UNCHANGED || !c.changetime)
return string(); return string();
return ctime(&c.changetime); return ctime(&c.changetime);
@ -47,11 +44,11 @@ string const ControlChanges::getChangeDate()
string const ControlChanges::getChangeAuthor() string const ControlChanges::getChangeAuthor()
{ {
Change c(bufferview()->getCurrentChange()); Change c(kernel().bufferview()->getCurrentChange());
if (c.type == Change::UNCHANGED) if (c.type == Change::UNCHANGED)
return string(); return string();
Author const & a(bufferview()->buffer()->authors().get(c.author)); Author const & a(kernel().buffer()->authors().get(c.author));
string author(a.name()); string author(a.name());
@ -66,13 +63,13 @@ string const ControlChanges::getChangeAuthor()
void ControlChanges::accept() void ControlChanges::accept()
{ {
lv_.dispatch(FuncRequest(LFUN_ACCEPT_CHANGE)); kernel().dispatch(FuncRequest(LFUN_ACCEPT_CHANGE));
lyxfind::findNextChange(bufferview()); lyxfind::findNextChange(kernel().bufferview());
} }
void ControlChanges::reject() void ControlChanges::reject()
{ {
lv_.dispatch(FuncRequest(LFUN_REJECT_CHANGE)); kernel().dispatch(FuncRequest(LFUN_REJECT_CHANGE));
lyxfind::findNextChange(bufferview()); lyxfind::findNextChange(kernel().bufferview());
} }

View File

@ -12,15 +12,23 @@
#ifndef CONTROLCHANGES_H #ifndef CONTROLCHANGES_H
#define CONTROLCHANGES_H #define CONTROLCHANGES_H
#include "ControlDialog_impl.h" #include "Dialog.h"
#include "LString.h"
/** /**
* A controller for the merge changes dialog. * A controller for the merge changes dialog.
*/ */
class ControlChanges : public ControlDialogBD { class ControlChanges : public Dialog::Controller {
public: 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 /// find the next merge chunk and highlight it
void find(); void find();
@ -36,10 +44,6 @@ public:
/// reject the current merge /// reject the current merge
void reject(); void reject();
private:
/// not needed.
virtual void apply() {}
}; };
#endif // CONTROLCHANGES_H #endif // CONTROLCHANGES_H

View File

@ -26,8 +26,7 @@ Dialogs::~Dialogs()
Dialogs::Impl::Impl(LyXView & lv, Dialogs & d) Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
: changes(lv, d), : character(lv, d),
character(lv, d),
document(lv, d), document(lv, d),
file(lv, d), file(lv, d),
logfile(lv, d), logfile(lv, d),

View File

@ -15,12 +15,6 @@
#include "Dialogs_impl.h" #include "Dialogs_impl.h"
void Dialogs::showMergeChanges()
{
pimpl_->changes.controller().show();
}
void Dialogs::showCharacter() void Dialogs::showCharacter()
{ {
pimpl_->character.controller().show(); pimpl_->character.controller().show();

View File

@ -15,6 +15,7 @@
#include "ControlAboutlyx.h" #include "ControlAboutlyx.h"
#include "ControlBibtex.h" #include "ControlBibtex.h"
#include "ControlChanges.h"
#include "ControlCitation.h" #include "ControlCitation.h"
#include "ControlError.h" #include "ControlError.h"
#include "ControlERT.h" #include "ControlERT.h"
@ -35,6 +36,8 @@
#include "QBibitemDialog.h" #include "QBibitemDialog.h"
#include "QBibtex.h" #include "QBibtex.h"
#include "QBibtexDialog.h" #include "QBibtexDialog.h"
#include "QChanges.h"
#include "QChangesDialog.h"
#include "QCitation.h" #include "QCitation.h"
#include "QCitationDialog.h" #include "QCitationDialog.h"
#include "QError.h" #include "QError.h"
@ -89,10 +92,10 @@ typedef ButtonController<NoRepeatedApplyReadOnlyPolicy, Qt2BC>
namespace { namespace {
char const * const dialognames[] = { "about", "bibitem", "bibtex", "citation", char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes",
"error", "ert", "external", "float", "citation", "error", "ert", "external",
"graphics", "include", "index", "label", "float", "graphics", "include", "index",
"minipage", "ref", "tabular", "label", "minipage", "ref", "tabular",
"tabularcreate", "toc", "url", "wrap" }; "tabularcreate", "toc", "url", "wrap" };
char const * const * const end_dialognames = char const * const * const end_dialognames =
@ -137,6 +140,10 @@ Dialog * Dialogs::build(string const & name)
dialog->setController(new ControlBibtex(*dialog)); dialog->setController(new ControlBibtex(*dialog));
dialog->setView(new QBibtex(*dialog)); dialog->setView(new QBibtex(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); 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") { } else if (name == "citation") {
dialog->setController(new ControlCitation(*dialog)); dialog->setController(new ControlCitation(*dialog));
dialog->setView(new QCitation(*dialog)); dialog->setView(new QCitation(*dialog));

View File

@ -14,7 +14,6 @@
#include "Dialogs.h" #include "Dialogs.h"
#include "controllers/GUI.h" #include "controllers/GUI.h"
#include "ControlChanges.h"
#include "ControlCharacter.h" #include "ControlCharacter.h"
#include "ControlDocument.h" #include "ControlDocument.h"
#include "ControlForks.h" #include "ControlForks.h"
@ -29,8 +28,6 @@
#include "ControlTexinfo.h" #include "ControlTexinfo.h"
#include "ControlVCLog.h" #include "ControlVCLog.h"
#include "QChanges.h"
#include "QChangesDialog.h"
#include "QCharacter.h" #include "QCharacter.h"
#include "QCharacterDialog.h" #include "QCharacterDialog.h"
#include "QDocument.h" #include "QDocument.h"
@ -72,9 +69,6 @@
typedef GUI<ControlChanges, QChanges, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
ChangesDialog;
typedef GUI<ControlCharacter, QCharacter, OkApplyCancelReadOnlyPolicy, Qt2BC> typedef GUI<ControlCharacter, QCharacter, OkApplyCancelReadOnlyPolicy, Qt2BC>
CharacterDialog; CharacterDialog;
@ -120,7 +114,6 @@ VCLogFileDialog;
struct Dialogs::Impl { struct Dialogs::Impl {
Impl(LyXView & lv, Dialogs & d); Impl(LyXView & lv, Dialogs & d);
ChangesDialog changes;
CharacterDialog character; CharacterDialog character;
DocumentDialog document; DocumentDialog document;
FileDialog file; FileDialog file;

View File

@ -20,11 +20,11 @@
#include "QChanges.h" #include "QChanges.h"
#include "Qt2BC.h" #include "Qt2BC.h"
typedef Qt2CB<ControlChanges, Qt2DB<QChangesDialog> > base_class; typedef QController<ControlChanges, QView<QChangesDialog> > base_class;
QChanges::QChanges() QChanges::QChanges(Dialog & parent)
: base_class(qt_("LyX: Merge Changes")) : base_class(parent, qt_("LyX: Merge Changes"))
{ {
} }

View File

@ -12,18 +12,18 @@
#ifndef QCHANGES_H #ifndef QCHANGES_H
#define QCHANGES_H #define QCHANGES_H
#include "Qt2Base.h" #include "QDialogView.h"
class ControlChanges; class ControlChanges;
class QChangesDialog; class QChangesDialog;
class QChanges class QChanges
: public Qt2CB<ControlChanges, Qt2DB<QChangesDialog> > : public QController<ControlChanges, QView<QChangesDialog> >
{ {
public: public:
friend class QChangesDialog; friend class QChangesDialog;
QChanges(); QChanges(Dialog &);
void accept(); void accept();

View File

@ -1,3 +1,14 @@
2003-03-09 Angus Leeming <leeming@lyx.org>
* 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 <leeming@lyx.org> 2003-03-09 Angus Leeming <leeming@lyx.org>
* Dialogs.C: * Dialogs.C:

View File

@ -26,8 +26,7 @@ Dialogs::~Dialogs()
Dialogs::Impl::Impl(LyXView & lv, Dialogs & d) Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
: changes(lv, d), : character(lv, d),
character(lv, d),
document(lv, d), document(lv, d),
file(lv, d), file(lv, d),
forks(lv, d), forks(lv, d),

View File

@ -15,12 +15,6 @@
#include "Dialogs_impl.h" #include "Dialogs_impl.h"
void Dialogs::showMergeChanges()
{
pimpl_->changes.controller().show();
}
void Dialogs::showCharacter() void Dialogs::showCharacter()
{ {
pimpl_->character.controller().show(); pimpl_->character.controller().show();

View File

@ -17,6 +17,7 @@
#include "ControlAboutlyx.h" #include "ControlAboutlyx.h"
#include "ControlBibtex.h" #include "ControlBibtex.h"
#include "ControlChanges.h"
#include "ControlCitation.h" #include "ControlCitation.h"
#include "ControlCommand.h" #include "ControlCommand.h"
#include "ControlError.h" #include "ControlError.h"
@ -38,6 +39,8 @@
#include "forms/form_bibitem.h" #include "forms/form_bibitem.h"
#include "FormBibtex.h" #include "FormBibtex.h"
#include "forms/form_bibtex.h" #include "forms/form_bibtex.h"
#include "FormChanges.h"
#include "forms/form_changes.h"
#include "FormCitation.h" #include "FormCitation.h"
#include "forms/form_citation.h" #include "forms/form_citation.h"
#include "FormError.h" #include "FormError.h"
@ -137,6 +140,10 @@ Dialog * Dialogs::build(string const & name)
dialog->setController(new ControlBibtex(*dialog)); dialog->setController(new ControlBibtex(*dialog));
dialog->setView(new FormBibtex(*dialog)); dialog->setView(new FormBibtex(*dialog));
dialog->setButtonController(new NoRepeatedApplyReadOnlyBC); 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") { } else if (name == "citation") {
dialog->setController(new ControlCitation(*dialog)); dialog->setController(new ControlCitation(*dialog));
dialog->setView(new FormCitation(*dialog)); dialog->setView(new FormCitation(*dialog));

View File

@ -21,10 +21,6 @@
#include "FormBrowser.h" #include "FormBrowser.h"
#include "forms/form_browser.h" #include "forms/form_browser.h"
#include "ControlChanges.h"
#include "FormChanges.h"
#include "forms/form_changes.h"
#include "ControlCharacter.h" #include "ControlCharacter.h"
#include "FormCharacter.h" #include "FormCharacter.h"
#include "forms/form_character.h" #include "forms/form_character.h"
@ -88,9 +84,6 @@
#include "ControlVCLog.h" #include "ControlVCLog.h"
#include "FormVCLog.h" #include "FormVCLog.h"
typedef GUI<ControlChanges, FormChanges, NoRepeatedApplyReadOnlyPolicy, xformsBC>
ChangesDialog;
typedef GUI<ControlCharacter, FormCharacter, OkApplyCancelReadOnlyPolicy, xformsBC> typedef GUI<ControlCharacter, FormCharacter, OkApplyCancelReadOnlyPolicy, xformsBC>
CharacterDialog; CharacterDialog;
@ -144,7 +137,6 @@ VCLogFileDialog;
struct Dialogs::Impl { struct Dialogs::Impl {
Impl(LyXView & lv, Dialogs & d); Impl(LyXView & lv, Dialogs & d);
ChangesDialog changes;
CharacterDialog character; CharacterDialog character;
DocumentDialog document; DocumentDialog document;
FileDialog file; FileDialog file;

View File

@ -17,10 +17,10 @@
#include FORMS_H_LOCATION #include FORMS_H_LOCATION
typedef FormCB<ControlChanges, FormDB<FD_changes> > base_class; typedef FormController<ControlChanges, FormView<FD_changes> > base_class;
FormChanges::FormChanges() FormChanges::FormChanges(Dialog & parent)
: base_class(_("LyX: Merge changes")) : base_class(parent, _("LyX: Merge changes"))
{} {}

View File

@ -12,7 +12,7 @@
#ifndef FORMCHANGES_H #ifndef FORMCHANGES_H
#define FORMCHANGES_H #define FORMCHANGES_H
#include "FormBase.h" #include "FormDialogView.h"
class ControlChanges; class ControlChanges;
struct FD_changes; struct FD_changes;
@ -20,9 +20,10 @@ struct FD_changes;
/** /**
* This class provides an XForms implementation of the Merge Changes Dialog. * This class provides an XForms implementation of the Merge Changes Dialog.
*/ */
class FormChanges : public FormCB<ControlChanges, FormDB<FD_changes> > { class FormChanges
: public FormController<ControlChanges, FormView<FD_changes> > {
public: public:
FormChanges(); FormChanges(Dialog &);
private: private:
/// not needed. /// not needed.

View File

@ -45,7 +45,7 @@ shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast gravity: FL_SouthEast FL_SouthEast
name: button_reject name: button_reject
callback: C_FormBaseInputCB callback: C_FormDialogView_InputCB
argument: 0 argument: 0
-------------------- --------------------
@ -63,7 +63,7 @@ shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast gravity: FL_SouthEast FL_SouthEast
name: button_next name: button_next
callback: C_FormBaseInputCB callback: C_FormDialogView_InputCB
argument: 0 argument: 0
-------------------- --------------------
@ -81,7 +81,7 @@ shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast gravity: FL_SouthEast FL_SouthEast
name: button_accept name: button_accept
callback: C_FormBaseInputCB callback: C_FormDialogView_InputCB
argument: 0 argument: 0
-------------------- --------------------
@ -99,7 +99,7 @@ shortcut:
resize: FL_RESIZE_NONE resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast gravity: FL_SouthEast FL_SouthEast
name: button_close name: button_close
callback: C_FormBaseCancelCB callback: C_FormDialogView_CancelCB
argument: 0 argument: 0
-------------------- --------------------