mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-05 17:09:56 +00:00
branch: Fix bug #2213: GuiChanges? lacks "Previous Change" button.
see r29108, r29109, r29110, r29111, and r29115. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@30597 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
9e6e4ebdd5
commit
d0d41147a7
@ -964,6 +964,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
|||||||
|
|
||||||
case LFUN_CHANGES_MERGE:
|
case LFUN_CHANGES_MERGE:
|
||||||
case LFUN_CHANGE_NEXT:
|
case LFUN_CHANGE_NEXT:
|
||||||
|
case LFUN_CHANGE_PREVIOUS:
|
||||||
case LFUN_ALL_CHANGES_ACCEPT:
|
case LFUN_ALL_CHANGES_ACCEPT:
|
||||||
case LFUN_ALL_CHANGES_REJECT:
|
case LFUN_ALL_CHANGES_REJECT:
|
||||||
// TODO: context-sensitive enabling of LFUNs
|
// TODO: context-sensitive enabling of LFUNs
|
||||||
@ -1210,9 +1211,15 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
|||||||
// FIXME: Move this LFUN to Buffer so that we don't have to do this:
|
// FIXME: Move this LFUN to Buffer so that we don't have to do this:
|
||||||
processUpdateFlags(Update::Force | Update::FitCursor);
|
processUpdateFlags(Update::Force | Update::FitCursor);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LFUN_CHANGE_PREVIOUS:
|
||||||
|
findPreviousChange(this);
|
||||||
|
// FIXME: Move this LFUN to Buffer so that we don't have to do this:
|
||||||
|
processUpdateFlags(Update::Force | Update::FitCursor);
|
||||||
|
break;
|
||||||
|
|
||||||
case LFUN_CHANGES_MERGE:
|
case LFUN_CHANGES_MERGE:
|
||||||
if (findNextChange(this)) {
|
if (findNextChange(this) || findPreviousChange(this)) {
|
||||||
processUpdateFlags(Update::Force | Update::FitCursor);
|
processUpdateFlags(Update::Force | Update::FitCursor);
|
||||||
showDialog("changes");
|
showDialog("changes");
|
||||||
}
|
}
|
||||||
|
@ -446,6 +446,12 @@ void Cursor::resetAnchor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Cursor::setCursorToAnchor()
|
||||||
|
{
|
||||||
|
if (selection())
|
||||||
|
setCursor(anchor_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Cursor::posBackward()
|
bool Cursor::posBackward()
|
||||||
{
|
{
|
||||||
|
@ -63,6 +63,8 @@ public:
|
|||||||
void leaveInset(Inset const & inset);
|
void leaveInset(Inset const & inset);
|
||||||
/// sets cursor part
|
/// sets cursor part
|
||||||
void setCursor(DocIterator const & it);
|
void setCursor(DocIterator const & it);
|
||||||
|
/// sets the cursor to the anchor
|
||||||
|
void setCursorToAnchor();
|
||||||
|
|
||||||
///
|
///
|
||||||
void setCurrentFont();
|
void setCurrentFont();
|
||||||
|
@ -349,10 +349,10 @@ enum FuncCode
|
|||||||
LFUN_PARAGRAPH_MOVE_UP,
|
LFUN_PARAGRAPH_MOVE_UP,
|
||||||
// 265
|
// 265
|
||||||
LFUN_BUFFER_TOGGLE_COMPRESSION, // bpeng 20060427
|
LFUN_BUFFER_TOGGLE_COMPRESSION, // bpeng 20060427
|
||||||
LFUN_MATH_BIGDELIM,
|
|
||||||
LFUN_CLIPBOARD_PASTE,
|
LFUN_CLIPBOARD_PASTE,
|
||||||
LFUN_INSET_DISSOLVE, // jspitzm 20060807
|
LFUN_INSET_DISSOLVE, // jspitzm 20060807
|
||||||
LFUN_CHANGE_NEXT,
|
LFUN_CHANGE_NEXT,
|
||||||
|
LFUN_CHANGE_PREVIOUS, // vfr 20090404
|
||||||
// 270
|
// 270
|
||||||
LFUN_WINDOW_NEW, // Abdel 20061021
|
LFUN_WINDOW_NEW, // Abdel 20061021
|
||||||
LFUN_WINDOW_CLOSE, // Abdel 20061023
|
LFUN_WINDOW_CLOSE, // Abdel 20061023
|
||||||
@ -424,7 +424,7 @@ enum FuncCode
|
|||||||
LFUN_INSET_BEGIN_SELECT, // JMarc, 20090316
|
LFUN_INSET_BEGIN_SELECT, // JMarc, 20090316
|
||||||
LFUN_INSET_END_SELECT, // JMarc, 20090316
|
LFUN_INSET_END_SELECT, // JMarc, 20090316
|
||||||
LFUN_VC_LOCKING_TOGGLE,
|
LFUN_VC_LOCKING_TOGGLE,
|
||||||
|
LFUN_MATH_BIGDELIM,
|
||||||
|
|
||||||
LFUN_LASTACTION // end of the table
|
LFUN_LASTACTION // end of the table
|
||||||
};
|
};
|
||||||
|
@ -2089,6 +2089,15 @@ void LyXAction::init()
|
|||||||
* \endvar
|
* \endvar
|
||||||
*/
|
*/
|
||||||
{ LFUN_CHANGE_NEXT, "change-next", ReadOnly, Edit },
|
{ LFUN_CHANGE_NEXT, "change-next", ReadOnly, Edit },
|
||||||
|
/*!
|
||||||
|
* \var lyx::FuncCode lyx::LFUN_CHANGE_PREVIOUS
|
||||||
|
* \li Action: Moves the cursor to the position of the previous change
|
||||||
|
of the change tracking records.
|
||||||
|
* \li Syntax: change-previous
|
||||||
|
* \li Origin: vfr, 4 Apr 2009
|
||||||
|
* \endvar
|
||||||
|
*/
|
||||||
|
{ LFUN_CHANGE_PREVIOUS, "change-previous", ReadOnly, Edit },
|
||||||
/*!
|
/*!
|
||||||
* \var lyx::FuncCode lyx::LFUN_CHANGES_MERGE
|
* \var lyx::FuncCode lyx::LFUN_CHANGES_MERGE
|
||||||
* \li Action: Open change tracking dialog for merging and moves the cursor
|
* \li Action: Open change tracking dialog for merging and moves the cursor
|
||||||
|
@ -43,6 +43,7 @@ GuiChanges::GuiChanges(GuiView & lv)
|
|||||||
|
|
||||||
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
||||||
connect(nextPB, SIGNAL(clicked()), this, SLOT(nextChange()));
|
connect(nextPB, SIGNAL(clicked()), this, SLOT(nextChange()));
|
||||||
|
connect(previousPB, SIGNAL(clicked()), this, SLOT(previousChange()));
|
||||||
connect(rejectPB, SIGNAL(clicked()), this, SLOT(rejectChange()));
|
connect(rejectPB, SIGNAL(clicked()), this, SLOT(rejectChange()));
|
||||||
connect(acceptPB, SIGNAL(clicked()), this, SLOT(acceptChange()));
|
connect(acceptPB, SIGNAL(clicked()), this, SLOT(acceptChange()));
|
||||||
|
|
||||||
@ -74,6 +75,12 @@ void GuiChanges::nextChange()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiChanges::previousChange()
|
||||||
|
{
|
||||||
|
dispatch(FuncRequest(LFUN_CHANGE_PREVIOUS));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
docstring GuiChanges::changeDate() const
|
docstring GuiChanges::changeDate() const
|
||||||
{
|
{
|
||||||
Change const & c = bufferview()->getCurrentChange();
|
Change const & c = bufferview()->getCurrentChange();
|
||||||
|
@ -35,6 +35,8 @@ protected Q_SLOTS:
|
|||||||
void rejectChange();
|
void rejectChange();
|
||||||
/// find the next change and highlight it
|
/// find the next change and highlight it
|
||||||
void nextChange();
|
void nextChange();
|
||||||
|
/// find the previous change and highlight it
|
||||||
|
void previousChange();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
|
@ -43,6 +43,19 @@
|
|||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="previousPB" >
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Go to previous change</string>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>&Previous change</string>
|
||||||
|
</property>
|
||||||
|
<property name="default" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="nextPB" >
|
<widget class="QPushButton" name="nextPB" >
|
||||||
<property name="toolTip" >
|
<property name="toolTip" >
|
||||||
|
@ -100,11 +100,19 @@ bool findBackwards(DocIterator & cur, MatchString const & match,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool findChange(DocIterator & cur)
|
bool findChange(DocIterator & cur, bool next)
|
||||||
{
|
{
|
||||||
for (; cur; cur.forwardPos())
|
if (!next)
|
||||||
if (cur.inTexted() && !cur.paragraph().isUnchanged(cur.pos()))
|
cur.backwardPos();
|
||||||
|
for (; cur; next ? cur.forwardPos() : cur.backwardPos())
|
||||||
|
if (cur.inTexted() && !cur.paragraph().isUnchanged(cur.pos())) {
|
||||||
|
if (!next)
|
||||||
|
// if we search backwards, take a step forward
|
||||||
|
// to correctly set the anchor
|
||||||
|
cur.forwardPos();
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,21 +325,54 @@ void replace(BufferView * bv, FuncRequest const & ev, bool has_deleted)
|
|||||||
|
|
||||||
bool findNextChange(BufferView * bv)
|
bool findNextChange(BufferView * bv)
|
||||||
{
|
{
|
||||||
DocIterator cur = bv->cursor();
|
return findChange(bv, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (!findChange(cur))
|
|
||||||
|
bool findPreviousChange(BufferView * bv)
|
||||||
|
{
|
||||||
|
return findChange(bv, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool findChange(BufferView * bv, bool next)
|
||||||
|
{
|
||||||
|
if (bv->cursor().selection()) {
|
||||||
|
// set the cursor at the beginning or at the end of the selection
|
||||||
|
// before searching. Otherwise, the current change will be found.
|
||||||
|
if (next != bv->cursor().top() > bv->cursor().anchor())
|
||||||
|
bv->cursor().setCursorToAnchor();
|
||||||
|
}
|
||||||
|
|
||||||
|
DocIterator cur = bv->cursor();
|
||||||
|
if (!findChange(cur, next))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bv->cursor().setCursor(cur);
|
bv->cursor().setCursor(cur);
|
||||||
bv->cursor().resetAnchor();
|
bv->cursor().resetAnchor();
|
||||||
|
|
||||||
|
if (!next)
|
||||||
|
// take a step into the change
|
||||||
|
cur.backwardPos();
|
||||||
|
|
||||||
Change orig_change = cur.paragraph().lookupChange(cur.pos());
|
Change orig_change = cur.paragraph().lookupChange(cur.pos());
|
||||||
|
|
||||||
CursorSlice & tip = cur.top();
|
CursorSlice & tip = cur.top();
|
||||||
for (; !tip.at_end(); tip.forwardPos()) {
|
if (next) {
|
||||||
Change change = tip.paragraph().lookupChange(tip.pos());
|
for (; !tip.at_end(); tip.forwardPos()) {
|
||||||
if (change != orig_change)
|
Change change = tip.paragraph().lookupChange(tip.pos());
|
||||||
break;
|
if (change != orig_change)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (; !tip.at_begin(); tip.backwardPos()) {
|
||||||
|
Change change = tip.paragraph().lookupChange(tip.pos());
|
||||||
|
if (change != orig_change) {
|
||||||
|
// take a step forward to correctly set the selection
|
||||||
|
tip.forwardPos();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now put cursor to end of selection:
|
// Now put cursor to end of selection:
|
||||||
|
@ -58,6 +58,14 @@ void replace(BufferView * bv, FuncRequest const &, bool has_deleted = false);
|
|||||||
/// find the next change in the buffer
|
/// find the next change in the buffer
|
||||||
bool findNextChange(BufferView * bv);
|
bool findNextChange(BufferView * bv);
|
||||||
|
|
||||||
|
/// find the previous change in the buffer
|
||||||
|
bool findPreviousChange(BufferView * bv);
|
||||||
|
|
||||||
|
/// find the change in the buffer
|
||||||
|
/// \param next true to find the next change, otherwise the previous
|
||||||
|
bool findChange(BufferView * bv, bool next);
|
||||||
|
|
||||||
|
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
|
||||||
#endif // LYXFIND_H
|
#endif // LYXFIND_H
|
||||||
|
@ -70,6 +70,7 @@ What's new
|
|||||||
|
|
||||||
- Make it possible to copy from a deleted section (bug 5390).
|
- Make it possible to copy from a deleted section (bug 5390).
|
||||||
|
|
||||||
|
- Reverse searching added to the merge changes dialog (bug 2213).
|
||||||
|
|
||||||
|
|
||||||
* DOCUMENTATION AND LOCALIZATION
|
* DOCUMENTATION AND LOCALIZATION
|
||||||
@ -223,8 +224,9 @@ What's new
|
|||||||
|
|
||||||
- Fix selection of math insets on some archs.
|
- Fix selection of math insets on some archs.
|
||||||
|
|
||||||
- Fix unitialized variable in Math, Dialog and inset painting code
|
- Fix of painter glitches caused by unitialized variables (bug 6077).
|
||||||
(bugs 6082, 6081, 6077).
|
|
||||||
|
- Fix unitialized variable in Dialog code (bug 6081).
|
||||||
|
|
||||||
|
|
||||||
* DOCUMENTATION AND LOCALIZATION
|
* DOCUMENTATION AND LOCALIZATION
|
||||||
|
Loading…
Reference in New Issue
Block a user