mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 21:05:12 +00:00
some selection work for tabulars
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8329 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4768220752
commit
2336bc463a
@ -1,3 +1,4 @@
|
||||
|
||||
2004-01-08 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* BufferView_pimpl.C (MenuInsertLyXFile):
|
||||
|
25
src/cursor.C
25
src/cursor.C
@ -181,7 +181,7 @@ void LCursor::getPos(int & x, int & y) const
|
||||
// inset->draw() is not called: this doesn't update
|
||||
// inset.top_baseline, so getCursor() returns an old value.
|
||||
// Ugly as you like.
|
||||
inset->getCursorPos(x, y);
|
||||
inset->getCursorPos(data_.back().idx_, x, y);
|
||||
x += inset->x();
|
||||
y += cached_y_;
|
||||
}
|
||||
@ -202,3 +202,26 @@ InsetTabular * LCursor::innerInsetTabular() const
|
||||
return static_cast<InsetTabular *>
|
||||
(innerInsetOfType(InsetOld::TABULAR_CODE));
|
||||
}
|
||||
|
||||
|
||||
void LCursor::cell(int idx)
|
||||
{
|
||||
#if 0
|
||||
BOOST_ASSERT(!data_.empty());
|
||||
data_.back().idx_ = idx;
|
||||
#else
|
||||
if (!data_.empty())
|
||||
data_.back().idx_ = idx;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int LCursor::cell() const
|
||||
{
|
||||
#if 0
|
||||
BOOST_ASSERT(!data_.empty());
|
||||
return data_.back().idx_;
|
||||
#else
|
||||
return data_.empty() ? 0 : data_.back().idx_;
|
||||
#endif
|
||||
}
|
||||
|
@ -45,6 +45,10 @@ public:
|
||||
void pop(int depth);
|
||||
/// pop one level off the cursor
|
||||
void pop();
|
||||
/// set the cell the cursor is in
|
||||
void cell(int);
|
||||
/// return the cell this cursor is in
|
||||
int cell() const;
|
||||
///
|
||||
UpdatableInset * innerInset() const;
|
||||
///
|
||||
|
@ -1,3 +1,11 @@
|
||||
|
||||
2004-01-08 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* insetcollapsable.[Ch]:
|
||||
* insettabular.[Ch]:
|
||||
* insettext.[Ch]:
|
||||
* updatableinset.h: use cell index info from global cursor.
|
||||
|
||||
2004-01-06 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* insetnote.C (InsetNoteParams::write): write label only once
|
||||
|
@ -375,9 +375,9 @@ void InsetCollapsable::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
void InsetCollapsable::getCursorPos(int & x, int & y) const
|
||||
void InsetCollapsable::getCursorPos(int cell, int & x, int & y) const
|
||||
{
|
||||
inset.getCursorPos(x, y);
|
||||
inset.getCursorPos(cell, x, y);
|
||||
if (status_ != Inlined)
|
||||
y += - ascent() + height_collapsed() + inset.ascent();
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
/// get the screen x,y of the cursor
|
||||
void getCursorPos(int & x, int & y) const;
|
||||
void getCursorPos(int cell, int & x, int & y) const;
|
||||
///
|
||||
void setLabel(std::string const & l);
|
||||
///
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -47,8 +47,10 @@
|
||||
|
||||
#include "inset.h"
|
||||
#include "tabular.h"
|
||||
|
||||
#include "frontends/mouse_state.h"
|
||||
|
||||
|
||||
class FuncStatus;
|
||||
class LyXLex;
|
||||
class Painter;
|
||||
@ -56,6 +58,8 @@ class BufferView;
|
||||
class Buffer;
|
||||
class BufferParams;
|
||||
class Paragraph;
|
||||
class CursorSlice;
|
||||
|
||||
|
||||
class InsetTabular : public UpdatableInset {
|
||||
public:
|
||||
@ -80,7 +84,7 @@ public:
|
||||
///
|
||||
void updateLocal(BufferView *) const;
|
||||
///
|
||||
bool insetAllowed(InsetOld::Code code) const;
|
||||
bool insetAllowed(InsetOld::Code code) const { return true; }
|
||||
///
|
||||
bool isTextInset() const { return true; }
|
||||
/** returns true if, when outputing LaTeX, font changes should
|
||||
@ -106,20 +110,18 @@ public:
|
||||
///
|
||||
InsetOld::Code lyxCode() const { return InsetOld::TABULAR_CODE; }
|
||||
/// get the absolute screen x,y of the cursor
|
||||
void getCursorPos(int & x, int & y) const;
|
||||
void getCursorPos(int cell, int & x, int & y) const;
|
||||
///
|
||||
bool tabularFeatures(BufferView * bv, std::string const & what);
|
||||
///
|
||||
void tabularFeatures(BufferView * bv, LyXTabular::Feature feature,
|
||||
std::string const & val = std::string());
|
||||
///
|
||||
int getActCell() const { return actcell; }
|
||||
///
|
||||
void openLayoutDialog(BufferView *) const;
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
///
|
||||
FuncStatus getStatus(std::string const & argument) const;
|
||||
FuncStatus getStatus(std::string const & argument, int cell) const;
|
||||
/// Appends \c list with all labels found within this inset.
|
||||
void getLabelList(Buffer const &, std::vector<std::string> & list) const;
|
||||
///
|
||||
@ -179,27 +181,27 @@ private:
|
||||
///
|
||||
void setPos(BufferView *, int x, int y) const;
|
||||
///
|
||||
DispatchResult moveRight(BufferView *);
|
||||
bool moveRight(BufferView *, CursorSlice & cur);
|
||||
///
|
||||
DispatchResult moveLeft(BufferView *);
|
||||
bool moveLeft(BufferView *, CursorSlice & cur);
|
||||
///
|
||||
DispatchResult moveUp(BufferView *);
|
||||
bool moveUp(BufferView *, CursorSlice & cur);
|
||||
///
|
||||
DispatchResult moveDown(BufferView *);
|
||||
bool moveDown(BufferView *, CursorSlice & cur);
|
||||
|
||||
///
|
||||
DispatchResult moveRightLock(BufferView *);
|
||||
bool moveRightLock(BufferView *, CursorSlice & cur);
|
||||
///
|
||||
DispatchResult moveLeftLock(BufferView *);
|
||||
bool moveLeftLock(BufferView *, CursorSlice & cur);
|
||||
///
|
||||
DispatchResult moveUpLock(BufferView *);
|
||||
bool moveUpLock(BufferView *, CursorSlice & cur);
|
||||
///
|
||||
DispatchResult moveDownLock(BufferView *);
|
||||
bool moveDownLock(BufferView *, CursorSlice & cur);
|
||||
|
||||
///
|
||||
bool moveNextCell(BufferView *);
|
||||
bool moveNextCell(BufferView *, CursorSlice & cur);
|
||||
///
|
||||
bool movePrevCell(BufferView *);
|
||||
bool movePrevCell(BufferView *, CursorSlice & cur);
|
||||
|
||||
|
||||
///
|
||||
@ -209,15 +211,9 @@ private:
|
||||
///
|
||||
void removeTabularRow();
|
||||
///
|
||||
void clearSelection() const {
|
||||
sel_cell_start = sel_cell_end = 0;
|
||||
has_selection = false;
|
||||
}
|
||||
void setSelection(int start, int end) const {
|
||||
sel_cell_start = start;
|
||||
sel_cell_end = end;
|
||||
has_selection = true;
|
||||
}
|
||||
void clearSelection() const;
|
||||
///
|
||||
void setSelection(int start, int end) const;
|
||||
///
|
||||
void activateCellInset(BufferView *, int cell, int x, int y);
|
||||
///
|
||||
@ -233,7 +229,8 @@ private:
|
||||
///
|
||||
bool isRightToLeft(BufferView *);
|
||||
///
|
||||
void getSelection(int & scol, int & ecol, int & srow, int & erow) const;
|
||||
void getSelection(int cell,
|
||||
int & scol, int & ecol, int & srow, int & erow) const;
|
||||
///
|
||||
bool insertAsciiString(BufferView *, std::string const & buf, bool usePaste);
|
||||
|
||||
@ -252,15 +249,13 @@ private:
|
||||
/// the ending cell selection nr
|
||||
mutable int sel_cell_end;
|
||||
///
|
||||
mutable int actcell;
|
||||
///
|
||||
mutable int actcol;
|
||||
///
|
||||
mutable int actrow;
|
||||
///
|
||||
mutable int first_visible_cell;
|
||||
///
|
||||
mutable int in_reset_pos;
|
||||
/// tablemode == true means we operate on the table as such,
|
||||
// i.e. select cells instead of characters in a cell etc.
|
||||
// tablemode == false directs most LFUN handling to the 'current' cell.
|
||||
mutable bool tablemode;
|
||||
};
|
||||
|
||||
|
||||
|
@ -382,7 +382,7 @@ void InsetText::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
void InsetText::getCursorPos(int & x, int & y) const
|
||||
void InsetText::getCursorPos(int, int & x, int & y) const
|
||||
{
|
||||
x = text_.cursorX() + TEXT_TO_INSET_OFFSET;
|
||||
y = text_.cursorY() - dim_.asc + TEXT_TO_INSET_OFFSET;
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
///
|
||||
InsetOld::Code lyxCode() const { return InsetOld::TEXT_CODE; }
|
||||
/// FIXME, document
|
||||
void getCursorPos(int & x, int & y) const;
|
||||
void getCursorPos(int cell, int & x, int & y) const;
|
||||
///
|
||||
bool insetAllowed(InsetOld::Code) const;
|
||||
///
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
virtual EDITABLE editable() const;
|
||||
|
||||
/// return the cursor pos, relative to the inset pos
|
||||
virtual void getCursorPos(int &, int &) const {}
|
||||
virtual void getCursorPos(int, int &, int &) const {}
|
||||
/// return the cursor dim
|
||||
virtual void getCursorDim(int &, int &) const;
|
||||
// We need this method to not clobber the real method in Inset
|
||||
|
@ -170,7 +170,7 @@ void InsetFormulaBase::getCursor(BufferView &, int & x, int & y) const
|
||||
}
|
||||
|
||||
|
||||
void InsetFormulaBase::getCursorPos(int & x, int & y) const
|
||||
void InsetFormulaBase::getCursorPos(int, int & x, int & y) const
|
||||
{
|
||||
if (!mathcursor) {
|
||||
lyxerr << "getCursorPos - should not happen";
|
||||
@ -399,7 +399,8 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
|
||||
case LFUN_RIGHTSEL:
|
||||
sel = true; // fall through...
|
||||
case LFUN_RIGHT:
|
||||
result = mathcursor->right(sel) ? DispatchResult(true, true) : DispatchResult(false, FINISHED_RIGHT);
|
||||
result = mathcursor->right(sel) ?
|
||||
DispatchResult(true, true) : DispatchResult(false, FINISHED_RIGHT);
|
||||
//lyxerr << "calling scroll 20" << endl;
|
||||
//scroll(bv, 20);
|
||||
// write something to the minibuffer
|
||||
@ -409,19 +410,22 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
|
||||
case LFUN_LEFTSEL:
|
||||
sel = true; // fall through
|
||||
case LFUN_LEFT:
|
||||
result = mathcursor->left(sel) ? DispatchResult(true, true) : DispatchResult(true, FINISHED);
|
||||
result = mathcursor->left(sel) ?
|
||||
DispatchResult(true, true) : DispatchResult(false, FINISHED);
|
||||
break;
|
||||
|
||||
case LFUN_UPSEL:
|
||||
sel = true; // fall through
|
||||
case LFUN_UP:
|
||||
result = mathcursor->up(sel) ? DispatchResult(true, true) : DispatchResult(false, FINISHED_UP);
|
||||
result = mathcursor->up(sel) ?
|
||||
DispatchResult(true, true) : DispatchResult(false, FINISHED_UP);
|
||||
break;
|
||||
|
||||
case LFUN_DOWNSEL:
|
||||
sel = true; // fall through
|
||||
case LFUN_DOWN:
|
||||
result = mathcursor->down(sel) ? DispatchResult(true, true) : DispatchResult(false, FINISHED_DOWN);
|
||||
result = mathcursor->down(sel) ?
|
||||
DispatchResult(true, true) : DispatchResult(false, FINISHED_DOWN);
|
||||
break;
|
||||
|
||||
case LFUN_WORDSEL:
|
||||
|
@ -19,6 +19,7 @@
|
||||
class Buffer;
|
||||
class BufferView;
|
||||
class MathAtom;
|
||||
class CursorSlice;
|
||||
|
||||
|
||||
/// An abstract base class for all math related LyX insets
|
||||
@ -45,7 +46,7 @@ public:
|
||||
/// what appears in the minibuffer when opening
|
||||
virtual std::string const editMessage() const;
|
||||
///
|
||||
virtual void getCursorPos(int &, int &) const;
|
||||
virtual void getCursorPos(int cell, int & x, int & y) const;
|
||||
///
|
||||
virtual void getCursorDim(int &, int &) const;
|
||||
/// get the absolute document x,y of the cursor
|
||||
|
Loading…
Reference in New Issue
Block a user