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_);
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: {

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>
* 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>
* Dialogs.h: remove showAboutlyx.

View File

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

View File

@ -10,35 +10,32 @@
#include <config.h>
#include "ViewBase.h"
#include "ButtonControllerBase.h"
#include "ControlChanges.h"
#include "frontends/Dialogs.h"
#include "frontends/LyXView.h"
#include "buffer.h"
#include "BufferView.h"
#include "funcrequest.h"
#include "lyxfind.h"
#include "lyxfunc.h"
#include "debug.h"
#include "BufferView.h"
#include "support/lstrings.h"
#include "funcrequest.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());
}

View File

@ -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

View File

@ -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),

View File

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

View File

@ -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<NoRepeatedApplyReadOnlyPolicy, Qt2BC>
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));

View File

@ -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<ControlChanges, QChanges, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
ChangesDialog;
typedef GUI<ControlCharacter, QCharacter, OkApplyCancelReadOnlyPolicy, Qt2BC>
CharacterDialog;
@ -120,7 +114,6 @@ VCLogFileDialog;
struct Dialogs::Impl {
Impl(LyXView & lv, Dialogs & d);
ChangesDialog changes;
CharacterDialog character;
DocumentDialog document;
FileDialog file;

View File

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

View File

@ -12,18 +12,18 @@
#ifndef QCHANGES_H
#define QCHANGES_H
#include "Qt2Base.h"
#include "QDialogView.h"
class ControlChanges;
class QChangesDialog;
class QChanges
: public Qt2CB<ControlChanges, Qt2DB<QChangesDialog> >
: public QController<ControlChanges, QView<QChangesDialog> >
{
public:
friend class QChangesDialog;
QChanges();
QChanges(Dialog &);
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>
* Dialogs.C:

View File

@ -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),

View File

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

View File

@ -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));

View File

@ -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<ControlChanges, FormChanges, NoRepeatedApplyReadOnlyPolicy, xformsBC>
ChangesDialog;
typedef GUI<ControlCharacter, FormCharacter, OkApplyCancelReadOnlyPolicy, xformsBC>
CharacterDialog;
@ -144,7 +137,6 @@ VCLogFileDialog;
struct Dialogs::Impl {
Impl(LyXView & lv, Dialogs & d);
ChangesDialog changes;
CharacterDialog character;
DocumentDialog document;
FileDialog file;

View File

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

View File

@ -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<ControlChanges, FormDB<FD_changes> > {
class FormChanges
: public FormController<ControlChanges, FormView<FD_changes> > {
public:
FormChanges();
FormChanges(Dialog &);
private:
/// not needed.

View File

@ -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
--------------------