mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
Tell X the selection status also after it is changed by the keyboard, since
we got a consensus on this on the list. Some calls of haveSelection are still missing, but we need to decide the "persistent selection" question before those can be implemented properly. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16572 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
37652b6d7a
commit
fed31122c4
@ -63,6 +63,7 @@
|
|||||||
#include "frontends/Alert.h"
|
#include "frontends/Alert.h"
|
||||||
#include "frontends/FileDialog.h"
|
#include "frontends/FileDialog.h"
|
||||||
#include "frontends/FontMetrics.h"
|
#include "frontends/FontMetrics.h"
|
||||||
|
#include "frontends/Selection.h"
|
||||||
|
|
||||||
#include "graphics/Previews.h"
|
#include "graphics/Previews.h"
|
||||||
|
|
||||||
@ -196,6 +197,7 @@ void BufferView::setBuffer(Buffer * b)
|
|||||||
cursor_.resetAnchor();
|
cursor_.resetAnchor();
|
||||||
cursor_.setCursor(buffer_->getCursor().asDocIterator(&(buffer_->inset())));
|
cursor_.setCursor(buffer_->getCursor().asDocIterator(&(buffer_->inset())));
|
||||||
cursor_.setSelection();
|
cursor_.setSelection();
|
||||||
|
theSelection().haveSelection(cursor_.selection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1298,6 +1300,7 @@ void BufferView::putSelectionAt(DocIterator const & cur,
|
|||||||
cursor_.setSelection(cursor_, -length);
|
cursor_.setSelection(cursor_, -length);
|
||||||
} else
|
} else
|
||||||
cursor_.setSelection(cursor_, length);
|
cursor_.setSelection(cursor_, length);
|
||||||
|
theSelection().haveSelection(cursor_.selection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
|
|
||||||
#include "frontends/Clipboard.h"
|
#include "frontends/Clipboard.h"
|
||||||
|
#include "frontends/Selection.h"
|
||||||
|
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
@ -532,6 +533,7 @@ void cutSelection(LCursor & cur, bool doclear, bool realcut)
|
|||||||
// need a valid cursor. (Lgb)
|
// need a valid cursor. (Lgb)
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
updateLabels(cur.buffer());
|
updateLabels(cur.buffer());
|
||||||
|
theSelection().haveSelection(false);
|
||||||
|
|
||||||
// tell tabular that a recent copy happened
|
// tell tabular that a recent copy happened
|
||||||
dirtyTabularStack(false);
|
dirtyTabularStack(false);
|
||||||
@ -709,6 +711,7 @@ void eraseSelection(LCursor & cur)
|
|||||||
}
|
}
|
||||||
// need a valid cursor. (Lgb)
|
// need a valid cursor. (Lgb)
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
|
theSelection().haveSelection(false);
|
||||||
} else {
|
} else {
|
||||||
lyxerr << "can't erase this selection 1" << endl;
|
lyxerr << "can't erase this selection 1" << endl;
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,8 @@
|
|||||||
#include "mathed/InsetMathScript.h"
|
#include "mathed/InsetMathScript.h"
|
||||||
#include "mathed/MathMacroTable.h"
|
#include "mathed/MathMacroTable.h"
|
||||||
|
|
||||||
|
#include "frontends/Selection.h"
|
||||||
|
|
||||||
#include "support/limited_stack.h"
|
#include "support/limited_stack.h"
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
@ -558,6 +560,7 @@ bool LCursor::selHandle(bool sel)
|
|||||||
|
|
||||||
resetAnchor();
|
resetAnchor();
|
||||||
selection() = sel;
|
selection() = sel;
|
||||||
|
theSelection().haveSelection(sel);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,6 +547,8 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
cell(cur.idx())->dispatch(cur, cmd);
|
cell(cur.idx())->dispatch(cur, cmd);
|
||||||
if (!cur.result().dispatched()) {
|
if (!cur.result().dispatched()) {
|
||||||
isRightToLeft(cur) ? movePrevCell(cur) : moveNextCell(cur);
|
isRightToLeft(cur) ? movePrevCell(cur) : moveNextCell(cur);
|
||||||
|
if (cmd.action == LFUN_CHAR_FORWARD_SELECT)
|
||||||
|
theSelection().haveSelection(cur.selection());
|
||||||
if (sl == cur.top())
|
if (sl == cur.top())
|
||||||
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
|
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
|
||||||
else
|
else
|
||||||
@ -559,6 +561,8 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
cell(cur.idx())->dispatch(cur, cmd);
|
cell(cur.idx())->dispatch(cur, cmd);
|
||||||
if (!cur.result().dispatched()) {
|
if (!cur.result().dispatched()) {
|
||||||
isRightToLeft(cur) ? moveNextCell(cur) : movePrevCell(cur);
|
isRightToLeft(cur) ? moveNextCell(cur) : movePrevCell(cur);
|
||||||
|
if (cmd.action == LFUN_CHAR_BACKWARD_SELECT)
|
||||||
|
theSelection().haveSelection(cur.selection());
|
||||||
if (sl == cur.top())
|
if (sl == cur.top())
|
||||||
cmd = FuncRequest(LFUN_FINISHED_LEFT);
|
cmd = FuncRequest(LFUN_FINISHED_LEFT);
|
||||||
else
|
else
|
||||||
@ -580,6 +584,8 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
TextMetrics const & tm =
|
TextMetrics const & tm =
|
||||||
cur.bv().textMetrics(cell(cur.idx())->getText(0));
|
cur.bv().textMetrics(cell(cur.idx())->getText(0));
|
||||||
cur.pos() = tm.x2pos(cur.pit(), 0, cur.targetX());
|
cur.pos() = tm.x2pos(cur.pit(), 0, cur.targetX());
|
||||||
|
if (cmd.action == LFUN_DOWN_SELECT)
|
||||||
|
theSelection().haveSelection(cur.selection());
|
||||||
}
|
}
|
||||||
if (sl == cur.top()) {
|
if (sl == cur.top()) {
|
||||||
// we trick it to go to the RIGHT after leaving the
|
// we trick it to go to the RIGHT after leaving the
|
||||||
@ -605,6 +611,8 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
ParagraphMetrics const & pm =
|
ParagraphMetrics const & pm =
|
||||||
tm.parMetrics(cur.lastpit());
|
tm.parMetrics(cur.lastpit());
|
||||||
cur.pos() = tm.x2pos(cur.pit(), pm.rows().size()-1, cur.targetX());
|
cur.pos() = tm.x2pos(cur.pit(), pm.rows().size()-1, cur.targetX());
|
||||||
|
if (cmd.action == LFUN_UP_SELECT)
|
||||||
|
theSelection().haveSelection(cur.selection());
|
||||||
}
|
}
|
||||||
if (sl == cur.top()) {
|
if (sl == cur.top()) {
|
||||||
cmd = FuncRequest(LFUN_FINISHED_UP);
|
cmd = FuncRequest(LFUN_FINISHED_UP);
|
||||||
@ -1868,6 +1876,7 @@ void InsetTabular::cutSelection(LCursor & cur)
|
|||||||
if (cur.pos() > cur.lastpos())
|
if (cur.pos() > cur.lastpos())
|
||||||
cur.pos() = cur.lastpos();
|
cur.pos() = cur.lastpos();
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
|
theSelection().haveSelection(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "undo.h"
|
#include "undo.h"
|
||||||
|
|
||||||
#include "frontends/Alert.h"
|
#include "frontends/Alert.h"
|
||||||
|
#include "frontends/Selection.h"
|
||||||
|
|
||||||
#include "support/convert.h"
|
#include "support/convert.h"
|
||||||
#include "support/docstream.h"
|
#include "support/docstream.h"
|
||||||
@ -356,6 +357,7 @@ bool findNextChange(BufferView * bv)
|
|||||||
// Now put cursor to end of selection:
|
// Now put cursor to end of selection:
|
||||||
bv->cursor().setCursor(cur);
|
bv->cursor().setCursor(cur);
|
||||||
bv->cursor().setSelection();
|
bv->cursor().setSelection();
|
||||||
|
theSelection().haveSelection(bv->cursor().selection());
|
||||||
// if we used a lfun like in find/replace, dispatch would do
|
// if we used a lfun like in find/replace, dispatch would do
|
||||||
// that for us
|
// that for us
|
||||||
bv->update();
|
bv->update();
|
||||||
|
@ -1398,6 +1398,7 @@ bool InsetMathHull::searchForward(BufferView * bv, string const & str,
|
|||||||
MathArray const & a = top.asInsetMath()->cell(top.idx_);
|
MathArray const & a = top.asInsetMath()->cell(top.idx_);
|
||||||
if (a.matchpart(ar, top.pos_)) {
|
if (a.matchpart(ar, top.pos_)) {
|
||||||
bv->cursor().setSelection(it, ar.size());
|
bv->cursor().setSelection(it, ar.size());
|
||||||
|
theSelection().haveSelection(bv->cursor().selection());
|
||||||
current = it;
|
current = it;
|
||||||
top.pos_ += ar.size();
|
top.pos_ += ar.size();
|
||||||
bv->update();
|
bv->update();
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
|
|
||||||
#include "frontends/FontMetrics.h"
|
#include "frontends/FontMetrics.h"
|
||||||
#include "frontends/Painter.h"
|
#include "frontends/Painter.h"
|
||||||
|
#include "frontends/Selection.h"
|
||||||
|
|
||||||
#include "insets/insettext.h"
|
#include "insets/insettext.h"
|
||||||
#include "insets/insetbibitem.h"
|
#include "insets/insetbibitem.h"
|
||||||
@ -828,6 +829,7 @@ void LyXText::selectWord(LCursor & cur, word_location loc)
|
|||||||
cur.resetAnchor();
|
cur.resetAnchor();
|
||||||
setCursor(cur, to.pit(), to.pos());
|
setCursor(cur, to.pit(), to.pos());
|
||||||
cur.setSelection();
|
cur.setSelection();
|
||||||
|
theSelection().haveSelection(cur.selection());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,8 +121,7 @@ namespace {
|
|||||||
{
|
{
|
||||||
if (selecting || cur.mark())
|
if (selecting || cur.mark())
|
||||||
cur.setSelection();
|
cur.setSelection();
|
||||||
if (!cur.selection())
|
theSelection().haveSelection(cur.selection());
|
||||||
theSelection().haveSelection(false);
|
|
||||||
cur.bv().switchKeyMap();
|
cur.bv().switchKeyMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1065,7 +1064,9 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
if (lyxrc.auto_region_delete) {
|
if (lyxrc.auto_region_delete) {
|
||||||
if (cur.selection())
|
if (cur.selection())
|
||||||
cutSelection(cur, false, false);
|
cutSelection(cur, false, false);
|
||||||
theSelection().haveSelection(false);
|
// cutSelection clears the X selection.
|
||||||
|
else
|
||||||
|
theSelection().haveSelection(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
|
Loading…
Reference in New Issue
Block a user