mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
some integer type changes for inset unification
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8337 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
09c7f0bf77
commit
7f48aeeab1
@ -16,6 +16,9 @@
|
||||
* text3.C:
|
||||
* undo.C: adjust
|
||||
|
||||
* cursor.h:
|
||||
* cursor_slice.[Ch]: some integer type changes for inset unification
|
||||
|
||||
2004-01-08 Alfredo Braunstein <abraunst@lyx.org>
|
||||
|
||||
* text2.C (undoSpan): add and use
|
||||
|
@ -15,8 +15,6 @@
|
||||
#include "textcursor.h"
|
||||
#include "cursor_slice.h"
|
||||
|
||||
#include "support/types.h"
|
||||
|
||||
#include <iosfwd>
|
||||
#include <vector>
|
||||
|
||||
@ -35,6 +33,13 @@ class InsetTabular;
|
||||
|
||||
class LCursor {
|
||||
public:
|
||||
/// type for cell number in inset
|
||||
typedef CursorSlice::idx_type idx_type;
|
||||
/// type for paragraph numbers positions within a cell
|
||||
typedef CursorSlice::par_type par_type;
|
||||
/// type for cursor positions within a cell
|
||||
typedef CursorSlice::pos_type pos_type;
|
||||
|
||||
/// create 'empty' cursor
|
||||
explicit LCursor(BufferView * bv);
|
||||
/// dispatch from innermost inset upwards
|
||||
|
@ -3,7 +3,10 @@
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Lars Gullik Bjønnes
|
||||
* \author Matthias Ettrich
|
||||
* \author André Pönitz
|
||||
* \author Jürgen Vigna
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
@ -22,17 +25,53 @@ using std::endl;
|
||||
|
||||
|
||||
CursorSlice::CursorSlice()
|
||||
: inset_(0), idx_(0), par_(0), pos_(0)
|
||||
: inset_(0), idx_(0), par_(0), pos_(0), boundary_(false)
|
||||
{}
|
||||
|
||||
|
||||
CursorSlice::CursorSlice(InsetBase * p)
|
||||
: inset_(p), idx_(0), par_(0), pos_(0)
|
||||
: inset_(p), idx_(0), par_(0), pos_(0), boundary_(false)
|
||||
{
|
||||
///BOOST_ASSERT(inset_);
|
||||
}
|
||||
|
||||
|
||||
void CursorSlice::par(lyx::paroffset_type par)
|
||||
{
|
||||
par_ = par;
|
||||
}
|
||||
|
||||
|
||||
lyx::paroffset_type CursorSlice::par() const
|
||||
{
|
||||
return par_;
|
||||
}
|
||||
|
||||
|
||||
void CursorSlice::pos(lyx::pos_type pos)
|
||||
{
|
||||
pos_ = pos;
|
||||
}
|
||||
|
||||
|
||||
lyx::pos_type CursorSlice::pos() const
|
||||
{
|
||||
return pos_;
|
||||
}
|
||||
|
||||
|
||||
void CursorSlice::boundary(bool boundary)
|
||||
{
|
||||
boundary_ = boundary;
|
||||
}
|
||||
|
||||
|
||||
bool CursorSlice::boundary() const
|
||||
{
|
||||
return boundary_;
|
||||
}
|
||||
|
||||
|
||||
MathInset * CursorSlice::asMathInset() const
|
||||
{
|
||||
return static_cast<MathInset *>(const_cast<InsetBase *>(inset_));
|
||||
|
@ -4,7 +4,12 @@
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Lars Gullik Bjønnes
|
||||
* \author Matthias Ettrich
|
||||
* \author John Levon
|
||||
* \author André Pönitz
|
||||
* \author Dekel Tsur
|
||||
* \author Jürgen Vigna
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
@ -15,6 +20,8 @@
|
||||
#include <iosfwd>
|
||||
#include <cstddef>
|
||||
|
||||
#include "support/types.h"
|
||||
|
||||
class InsetBase;
|
||||
class UpdatableInset;
|
||||
class MathInset;
|
||||
@ -34,15 +41,28 @@ public:
|
||||
/// type for cell number in inset
|
||||
typedef size_t idx_type;
|
||||
/// type for paragraph numbers positions within a cell
|
||||
typedef size_t par_type;
|
||||
typedef lyx::paroffset_type par_type;
|
||||
/// type for cursor positions within a cell
|
||||
typedef size_t pos_type;
|
||||
typedef lyx::pos_type pos_type;
|
||||
|
||||
///
|
||||
CursorSlice();
|
||||
///
|
||||
explicit CursorSlice(InsetBase *);
|
||||
|
||||
/// set the paragraph that contains this cursor
|
||||
void par(par_type pit);
|
||||
/// return the paragraph this cursor is in
|
||||
par_type par() const;
|
||||
/// set the position within the paragraph
|
||||
void pos(pos_type p);
|
||||
/// return the position within the paragraph
|
||||
pos_type pos() const;
|
||||
|
||||
/// FIXME
|
||||
void boundary(bool b);
|
||||
/// FIXME
|
||||
bool boundary() const;
|
||||
///
|
||||
/// texted specific stuff
|
||||
///
|
||||
@ -76,6 +96,22 @@ public:
|
||||
par_type par_;
|
||||
/// position in this cell
|
||||
pos_type pos_;
|
||||
/**
|
||||
* When the cursor position is i, is the cursor is after the i-th char
|
||||
* or before the i+1-th char ? Normally, these two interpretations are
|
||||
* equivalent, except when the fonts of the i-th and i+1-th char
|
||||
* differ.
|
||||
* We use boundary_ to distinguish between the two options:
|
||||
* If boundary_=true, then the cursor is after the i-th char
|
||||
* and if boundary_=false, then the cursor is before the i+1-th char.
|
||||
*
|
||||
* We currently use the boundary only when the language direction of
|
||||
* the i-th char is different than the one of the i+1-th char.
|
||||
* In this case it is important to distinguish between the two
|
||||
* cursor interpretations, in order to give a reasonable behavior to
|
||||
* the user.
|
||||
*/
|
||||
bool boundary_;
|
||||
};
|
||||
|
||||
/// test for equality
|
||||
@ -84,5 +120,7 @@ bool operator==(CursorSlice const &, CursorSlice const &);
|
||||
bool operator!=(CursorSlice const &, CursorSlice const &);
|
||||
/// test for order
|
||||
bool operator<(CursorSlice const &, CursorSlice const &);
|
||||
/// test for order
|
||||
bool operator>(CursorSlice const &, CursorSlice const &);
|
||||
|
||||
#endif
|
||||
|
@ -29,17 +29,17 @@ class DispatchResult;
|
||||
class InsetBase {
|
||||
public:
|
||||
///
|
||||
typedef int difference_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
/// short of anything else reasonable
|
||||
typedef size_t size_type;
|
||||
typedef size_t size_type;
|
||||
/// type for cell indices
|
||||
typedef size_t idx_type;
|
||||
typedef size_t idx_type;
|
||||
/// type for cursor positions
|
||||
typedef size_t pos_type;
|
||||
typedef ptrdiff_t pos_type;
|
||||
/// type for row numbers
|
||||
typedef size_t row_type;
|
||||
typedef size_t row_type;
|
||||
/// type for column numbers
|
||||
typedef size_t col_type;
|
||||
typedef size_t col_type;
|
||||
|
||||
/// virtual base class destructor
|
||||
virtual ~InsetBase() {}
|
||||
|
@ -814,7 +814,7 @@ void MathCursor::normalize()
|
||||
lyxerr << endl;
|
||||
dump("error 4");
|
||||
}
|
||||
pos() = min(pos(), size());
|
||||
pos() = pos() < size() ? pos() : size();
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "math_inset.h"
|
||||
#include "math_data.h"
|
||||
#include "math_iterator.h"
|
||||
#include "support/types.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@ -40,17 +41,17 @@ this formula's MathHullInset to the current position.
|
||||
class MathCursor {
|
||||
public:
|
||||
/// short of anything else reasonable
|
||||
typedef MathInset::size_type size_type;
|
||||
typedef size_t size_type;
|
||||
/// type for column numbers
|
||||
typedef MathArray::difference_type difference_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
/// type for cursor positions within a cell
|
||||
typedef MathInset::pos_type pos_type;
|
||||
typedef lyx::pos_type pos_type;
|
||||
/// type for cell indices
|
||||
typedef MathInset::idx_type idx_type;
|
||||
typedef size_t idx_type;
|
||||
/// type for row numbers
|
||||
typedef MathInset::row_type row_type;
|
||||
typedef size_t row_type;
|
||||
/// type for column numbers
|
||||
typedef MathInset::col_type col_type;
|
||||
typedef size_t col_type;
|
||||
|
||||
///
|
||||
explicit MathCursor(InsetFormulaBase *, bool left);
|
||||
|
@ -22,10 +22,12 @@ namespace lyx {
|
||||
|
||||
/// a type for positions used in paragraphs
|
||||
// needs to be signed for a while to hold the special value -1 that is
|
||||
// used there...
|
||||
// used there
|
||||
typedef ptrdiff_t pos_type;
|
||||
|
||||
/// a type for paragraph offsets
|
||||
// FIXME: should be unsigned as well.
|
||||
// however, simply changing it breaks a downward loop somewhere...
|
||||
typedef ptrdiff_t paroffset_type;
|
||||
|
||||
/// a type for the nesting depth of a paragraph
|
||||
|
Loading…
Reference in New Issue
Block a user