mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
remove last member variables from LyXFunc and move them to cursor. Now the class can be replaced by a namespace
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33386 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
668d0f8c3f
commit
ead206efb0
@ -27,7 +27,6 @@
|
||||
#include "FuncRequest.h"
|
||||
#include "Language.h"
|
||||
#include "LyXAction.h"
|
||||
#include "LyXFunc.h"
|
||||
#include "LyXRC.h"
|
||||
#include "Paragraph.h"
|
||||
#include "ParIterator.h"
|
||||
@ -315,6 +314,12 @@ bool Cursor::getStatus(FuncRequest const & cmd, FuncStatus & status) const
|
||||
}
|
||||
|
||||
|
||||
void Cursor::saveBeforeDispatchPosXY()
|
||||
{
|
||||
getPos(beforeDispatchPosX_, beforeDispatchPosY_);
|
||||
}
|
||||
|
||||
|
||||
void Cursor::dispatch(FuncRequest const & cmd0)
|
||||
{
|
||||
LYXERR(Debug::DEBUG, "cmd: " << cmd0 << '\n' << *this);
|
||||
@ -1662,7 +1667,7 @@ bool Cursor::upDownInMath(bool up)
|
||||
int xo = 0;
|
||||
int yo = 0;
|
||||
getPos(xo, yo);
|
||||
xo = theLyXFunc().cursorBeforeDispatchX();
|
||||
xo = beforeDispatchPosX_;
|
||||
|
||||
// check if we had something else in mind, if not, this is the future
|
||||
// target
|
||||
@ -1712,7 +1717,7 @@ bool Cursor::upDownInMath(bool up)
|
||||
int x;
|
||||
int y;
|
||||
getPos(x, y);
|
||||
int oy = theLyXFunc().cursorBeforeDispatchY();
|
||||
int oy = beforeDispatchPosY_;
|
||||
if ((!up && y <= oy) ||
|
||||
(up && y >= oy))
|
||||
operator=(old);
|
||||
@ -1733,7 +1738,7 @@ bool Cursor::upDownInMath(bool up)
|
||||
int x;
|
||||
int y;
|
||||
getPos(x, y);
|
||||
int oy = theLyXFunc().cursorBeforeDispatchY();
|
||||
int oy = beforeDispatchPosY_;
|
||||
if ((!up && y <= oy) ||
|
||||
(up && y >= oy))
|
||||
operator=(old);
|
||||
@ -1757,7 +1762,7 @@ bool Cursor::upDownInMath(bool up)
|
||||
//lyxerr << "updown: popBackward succeeded" << endl;
|
||||
int xnew;
|
||||
int ynew;
|
||||
int yold = theLyXFunc().cursorBeforeDispatchY();
|
||||
int yold = beforeDispatchPosY_;
|
||||
getPos(xnew, ynew);
|
||||
if (up ? ynew < yold : ynew > yold)
|
||||
return true;
|
||||
@ -1799,7 +1804,7 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
|
||||
int xo = 0;
|
||||
int yo = 0;
|
||||
getPos(xo, yo);
|
||||
xo = theLyXFunc().cursorBeforeDispatchX();
|
||||
xo = beforeDispatchPosX_;
|
||||
|
||||
// update the targetX - this is here before the "return false"
|
||||
// to set a new target which can be used by InsetTexts above
|
||||
|
10
src/Cursor.h
10
src/Cursor.h
@ -294,8 +294,10 @@ public:
|
||||
///
|
||||
mutable DispatchResult disp_;
|
||||
///
|
||||
DocIterator const & beforeDispatchCursor() { return beforeDispatchCursor_; }
|
||||
|
||||
DocIterator const & beforeDispatchCursor() const { return beforeDispatchCursor_; }
|
||||
///
|
||||
void saveBeforeDispatchPosXY();
|
||||
|
||||
private:
|
||||
/**
|
||||
* The target x position of the cursor. This is used for when
|
||||
@ -325,6 +327,10 @@ private:
|
||||
bool logicalpos_;
|
||||
/// position before dispatch started
|
||||
DocIterator beforeDispatchCursor_;
|
||||
/// cursor screen coordinates before dispatch started
|
||||
int beforeDispatchPosX_;
|
||||
int beforeDispatchPosY_;
|
||||
|
||||
|
||||
// FIXME: make them private.
|
||||
public:
|
||||
|
@ -341,13 +341,16 @@ static docstring makeDispatchMessage(docstring const & msg,
|
||||
|
||||
void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
{
|
||||
LyXView * lv = theApp()->currentWindow();
|
||||
if (lv && lv->currentBufferView())
|
||||
lv->currentBufferView()->cursor().saveBeforeDispatchPosXY();
|
||||
|
||||
DispatchResult dr;
|
||||
// redraw the screen at the end (first of the two drawing steps).
|
||||
//This is done unless explicitly requested otherwise
|
||||
dr.update(Update::FitCursor);
|
||||
dispatch(cmd, dr);
|
||||
|
||||
LyXView * lv = theApp()->currentWindow();
|
||||
if (lv && lv->currentBufferView()) {
|
||||
// BufferView::update() updates the ViewMetricsInfo and
|
||||
// also initializes the position cache for all insets in
|
||||
@ -565,8 +568,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
|
||||
// Let the current Cursor dispatch its own actions.
|
||||
Cursor old = bv->cursor();
|
||||
bv->cursor().getPos(cursorPosBeforeDispatchX_,
|
||||
cursorPosBeforeDispatchY_);
|
||||
bv->cursor().dispatch(cmd);
|
||||
|
||||
// notify insets we just left
|
||||
|
@ -41,6 +41,8 @@ class FileName;
|
||||
keyboard or from the GUI. All GUI objects, including buttons and
|
||||
menus should use this class and never call kernel functions directly.
|
||||
*/
|
||||
|
||||
//FIXME: this should not be a class anymore
|
||||
class LyXFunc
|
||||
{
|
||||
public:
|
||||
@ -63,15 +65,6 @@ public:
|
||||
/// not the current buffer
|
||||
void gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer);
|
||||
|
||||
/// cursor x position before dispatch started
|
||||
int cursorBeforeDispatchX() const { return cursorPosBeforeDispatchX_; }
|
||||
/// cursor y position before dispatch started
|
||||
int cursorBeforeDispatchY() const { return cursorPosBeforeDispatchY_; }
|
||||
|
||||
private:
|
||||
/// cursor position before dispatch started
|
||||
int cursorPosBeforeDispatchX_;
|
||||
int cursorPosBeforeDispatchY_;
|
||||
};
|
||||
|
||||
/// Implementation is in LyX.cpp
|
||||
|
Loading…
Reference in New Issue
Block a user