fix bug 2212: First change is skipped in Merge changes... dialog

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@13332 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2006-03-10 16:53:24 +00:00
parent 08323de6c6
commit 21cc9c2795
11 changed files with 68 additions and 38 deletions

View File

@ -907,12 +907,7 @@ void BufferView::Pimpl::trackChanges()
buffer_->undostack().clear(); buffer_->undostack().clear();
} else { } else {
cursor_.setCursor(doc_iterator_begin(buffer_->inset())); cursor_.setCursor(doc_iterator_begin(buffer_->inset()));
bool const found = lyx::find::findNextChange(bv_); if (lyx::find::findNextChange(bv_)) {
if (found) {
// We reset the cursor to the start of the
// document, since the Changes Dialog is going
// to search for the next change anyway.
cursor_.setCursor(doc_iterator_begin(buffer_->inset()));
owner_->getDialogs().show("changes"); owner_->getDialogs().show("changes");
return; return;
} }
@ -1213,7 +1208,8 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
} }
case LFUN_MERGE_CHANGES: case LFUN_MERGE_CHANGES:
owner_->getDialogs().show("changes"); if (lyx::find::findNextChange(bv_))
owner_->getDialogs().show("changes");
break; break;
case LFUN_ACCEPT_ALL_CHANGES: { case LFUN_ACCEPT_ALL_CHANGES: {

View File

@ -4142,6 +4142,11 @@
2004-02-06 André Pönitz <poenitz@gmx.net> 2004-02-06 André Pönitz <poenitz@gmx.net>
* BufferView_pimpl.C: fix bug 2212: First change is skipped is
"Merge changes..." dialog
2006-03-10 Martin Vermeer <martin.vermeer@hut.fi>
* BufferView.[Ch]: * BufferView.[Ch]:
* BufferView_pimpl.[Ch]: * BufferView_pimpl.[Ch]:
* text3.C: move some text specific LFUN handling * text3.C: move some text specific LFUN handling

View File

@ -1,3 +1,8 @@
2006-03-10 Martin Vermeer <martin.vermeer@hut.fi>
* ControlChanges.C: fix bug 2212: First change is skipped in
"Merge changes..." dialog
2005-12-12 Jürgen Spitzmüller <j.spitzmueller@gmx.de> 2005-12-12 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* ControlPrefs.[Ch]: new helper functions toPaperSize and * ControlPrefs.[Ch]: new helper functions toPaperSize and

View File

@ -39,6 +39,13 @@ bool ControlChanges::find()
} }
bool ControlChanges::changed()
{
Change c(kernel().bufferview()->getCurrentChange());
return c.type != Change::UNCHANGED;
}
string const ControlChanges::getChangeDate() string const ControlChanges::getChangeDate()
{ {
Change c(kernel().bufferview()->getCurrentChange()); Change c(kernel().bufferview()->getCurrentChange());

View File

@ -38,6 +38,9 @@ public:
/// find the next merge chunk and highlight it /// find the next merge chunk and highlight it
bool find(); bool find();
/// Are there changes to be merged at current location?
bool changed();
/// return date of change /// return date of change
std::string const getChangeDate(); std::string const getChangeDate();

View File

@ -1,3 +1,8 @@
2006-03-10 Martin Vermeer <martin.vermeer@hut.fi>
* GChanges.C: fix bug 2212: First change is skipped in
"Merge changes..." dialog
2006-02-20 John Spray <spray@lyx.org> 2006-02-20 John Spray <spray@lyx.org>
* glade/documents.glade: change "page style" to "page numbering" * glade/documents.glade: change "page style" to "page numbering"
in UI. in UI.

View File

@ -63,7 +63,10 @@ void GChanges::doBuild()
void GChanges::update() void GChanges::update()
{ {
onNext(); if (controller().changed())
promptChange();
else
promptDismiss();
} }

View File

@ -1,3 +1,8 @@
2006-03-10 Martin Vermeer <martin.vermeer@hut.fi>
* QChanges.C: fix bug 2212: First change is skipped in
"Merge changes..." dialog
2006-03-10 Georg Baum <Georg.Baum@post.rwth-aachen.de> 2006-03-10 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* QWorkArea.C (getClipboard): convert MAC to UNIX line endings on OSX * QWorkArea.C (getClipboard): convert MAC to UNIX line endings on OSX

View File

@ -50,14 +50,6 @@ void QChanges::build_dialog()
void QChanges::update_contents() void QChanges::update_contents()
{ {
next();
}
void QChanges::next()
{
controller().find();
string text; string text;
string author(controller().getChangeAuthor()); string author(controller().getChangeAuthor());
string date(controller().getChangeDate()); string date(controller().getChangeDate());
@ -71,6 +63,13 @@ void QChanges::next()
} }
void QChanges::next()
{
controller().find();
update_contents();
}
void QChanges::accept() void QChanges::accept()
{ {
controller().accept(); controller().accept();

View File

@ -1,3 +1,8 @@
2006-03-10 Martin Vermeer <martin.vermeer@hut.fi>
* FormChanges.C: fix bug 2212: First change is skipped in
"Merge changes..." dialog
2006-02-15 Jürgen Spitzmüller <j.spitzmueller@gmx.de> 2006-02-15 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* FormCitation.C (input): get rid of the iterator. * FormCitation.C (input): get rid of the iterator.

View File

@ -48,35 +48,32 @@ void FormChanges::build()
void FormChanges::update() void FormChanges::update()
{ {
input(dialog_->button_next, 0); if (!dialog_.get()) return;
bool exist = controller().changed();
setEnabled(dialog_->button_accept, exist);
setEnabled(dialog_->button_reject, exist);
setEnabled(dialog_->button_next, exist);
string const author = exist ? controller().getChangeAuthor() : "";
fl_set_object_label(dialog_->text_author, author.c_str());
string const date = exist ? controller().getChangeDate() : "";
fl_set_object_label(dialog_->text_date, date.c_str());
// Yes, this is needed.
fl_redraw_form(form());
} }
ButtonPolicy::SMInput FormChanges::input(FL_OBJECT * obj, long) ButtonPolicy::SMInput FormChanges::input(FL_OBJECT * obj, long)
{ {
if (obj == dialog_->button_accept) { if (obj == dialog_->button_accept)
controller().accept(); controller().accept();
else if (obj == dialog_->button_reject)
} else if (obj == dialog_->button_reject) {
controller().reject(); controller().reject();
else if (obj == dialog_->button_next)
} else if (obj == dialog_->button_next) { controller().find();
update();
bool const exist = controller().find();
setEnabled(dialog_->button_accept, exist);
setEnabled(dialog_->button_reject, exist);
setEnabled(dialog_->button_next, exist);
string const author = exist ? controller().getChangeAuthor() : "";
fl_set_object_label(dialog_->text_author, author.c_str());
string const date = exist ? controller().getChangeDate() : "";
fl_set_object_label(dialog_->text_date, date.c_str());
// Yes, this is needed.
fl_redraw_form(form());
}
return ButtonPolicy::SMI_VALID; return ButtonPolicy::SMI_VALID;
} }