mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 05:33:33 +00:00
A couple of changing resulting from gcc 3.4 debug mode testing.
Dont copy singular iterators. Dont compare iterators from different containers. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8121 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e506fc5915
commit
7dd8cd705b
@ -1350,5 +1350,3 @@ void BufferView::Pimpl::updateParagraphDialog()
|
|||||||
data = "update " + tostr(accept) + '\n' + data;
|
data = "update " + tostr(accept) + '\n' + data;
|
||||||
bv_->owner()->getDialogs().update("paragraph", data);
|
bv_->owner()->getDialogs().update("paragraph", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,22 @@
|
|||||||
|
2003-11-22 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||||
|
|
||||||
|
* text3.C (dispatch): [PRIOR] make sure that we do not compare
|
||||||
|
iterators from different ParagraphList containers.
|
||||||
|
[NEXT] ditto
|
||||||
|
|
||||||
|
* text2.C (LyXText): change order of initialization slightly
|
||||||
|
(operator=): new function. copy all variables except cache_par_
|
||||||
|
(moveUp): make sure that we do not compare iterators from
|
||||||
|
different ParagraphList constainers.
|
||||||
|
(moveDown): ditto
|
||||||
|
|
||||||
|
* text.C (firstPar): new function
|
||||||
|
(lastPar): new function
|
||||||
|
(endPar): new function
|
||||||
|
|
||||||
|
* lyxtext.h: move things around and group public functions, public
|
||||||
|
variables, private functions, private variables
|
||||||
|
|
||||||
2003-11-21 Michael Schmitt <michael.schmitt@teststep.org>
|
2003-11-21 Michael Schmitt <michael.schmitt@teststep.org>
|
||||||
|
|
||||||
* factory.C: change call to InsetERT constructor to avoid
|
* factory.C: change call to InsetERT constructor to avoid
|
||||||
|
@ -212,4 +212,3 @@ void InsetCharStyleParams::read(LyXLex & lex)
|
|||||||
type = lex.getString();
|
type = lex.getString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
180
src/lyxtext.h
180
src/lyxtext.h
@ -49,23 +49,16 @@ class VSpace;
|
|||||||
// The inheritance from TextCursor should go. It's just there to ease
|
// The inheritance from TextCursor should go. It's just there to ease
|
||||||
// transition...
|
// transition...
|
||||||
class LyXText : public TextCursor {
|
class LyXText : public TextCursor {
|
||||||
|
// Public Functions
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
LyXText(BufferView *, InsetText *, bool ininset, ParagraphList & plist);
|
LyXText(BufferView *, InsetText *, bool ininset, ParagraphList & plist);
|
||||||
|
|
||||||
|
// Copy assignment
|
||||||
|
LyXText & operator=(LyXText const &);
|
||||||
|
|
||||||
void init(BufferView *);
|
void init(BufferView *);
|
||||||
///
|
|
||||||
int height;
|
|
||||||
///
|
|
||||||
unsigned int width;
|
|
||||||
/// the current font settings
|
|
||||||
LyXFont current_font;
|
|
||||||
/// the current font
|
|
||||||
LyXFont real_current_font;
|
|
||||||
/// our buffer's default layout font
|
|
||||||
LyXFont defaultfont_;
|
|
||||||
///
|
|
||||||
InsetText * inset_owner;
|
|
||||||
|
|
||||||
/// update all cached row positions
|
/// update all cached row positions
|
||||||
void updateRowPositions();
|
void updateRowPositions();
|
||||||
@ -120,10 +113,6 @@ public:
|
|||||||
|
|
||||||
/// rebreaks the cursor par
|
/// rebreaks the cursor par
|
||||||
void redoParagraph();
|
void redoParagraph();
|
||||||
private:
|
|
||||||
/// rebreaks the given par
|
|
||||||
void redoParagraphInternal(ParagraphList::iterator pit);
|
|
||||||
public:
|
|
||||||
|
|
||||||
///
|
///
|
||||||
void toggleFree(LyXFont const &, bool toggleall = false);
|
void toggleFree(LyXFont const &, bool toggleall = false);
|
||||||
@ -152,10 +141,6 @@ public:
|
|||||||
|
|
||||||
friend class LyXScreen;
|
friend class LyXScreen;
|
||||||
|
|
||||||
public:
|
|
||||||
/// only the top-level LyXText has this non-zero
|
|
||||||
BufferView * bv_owner;
|
|
||||||
|
|
||||||
/// returns an iterator pointing to a cursor paragraph
|
/// returns an iterator pointing to a cursor paragraph
|
||||||
ParagraphList::iterator getPar(LyXCursor const & cursor) const;
|
ParagraphList::iterator getPar(LyXCursor const & cursor) const;
|
||||||
///
|
///
|
||||||
@ -320,24 +305,6 @@ public:
|
|||||||
///
|
///
|
||||||
int workWidth() const;
|
int workWidth() const;
|
||||||
|
|
||||||
private:
|
|
||||||
///
|
|
||||||
float getCursorX(ParagraphList::iterator pit,
|
|
||||||
Row const & row, lyx::pos_type pos, bool boundary) const;
|
|
||||||
/// used in setlayout
|
|
||||||
void makeFontEntriesLayoutSpecific(BufferParams const &, Paragraph & par);
|
|
||||||
|
|
||||||
/// Calculate and set the height of the row
|
|
||||||
void setHeightOfRow(ParagraphList::iterator, Row & row);
|
|
||||||
|
|
||||||
// fix the cursor `cur' after a characters has been deleted at `where'
|
|
||||||
// position. Called by deleteEmptyParagraphMechanism
|
|
||||||
void fixCursorAfterDelete(LyXCursor & cur, LyXCursor const & where);
|
|
||||||
|
|
||||||
/// delete double space (false) or empty paragraphs (true) around old_cursor
|
|
||||||
bool deleteEmptyParagraphMechanism(LyXCursor const & old_cursor);
|
|
||||||
|
|
||||||
public:
|
|
||||||
/** Updates all counters starting BEHIND the row. Changed paragraphs
|
/** Updates all counters starting BEHIND the row. Changed paragraphs
|
||||||
* with a dynamic left margin will be rebroken. */
|
* with a dynamic left margin will be rebroken. */
|
||||||
void updateCounters();
|
void updateCounters();
|
||||||
@ -369,46 +336,6 @@ public:
|
|||||||
* the cursor and when creating a visible row */
|
* the cursor and when creating a visible row */
|
||||||
void prepareToPrint(ParagraphList::iterator pit, Row & row) const;
|
void prepareToPrint(ParagraphList::iterator pit, Row & row) const;
|
||||||
|
|
||||||
private:
|
|
||||||
///
|
|
||||||
void setCounter(Buffer const &, ParagraphList::iterator pit);
|
|
||||||
///
|
|
||||||
void deleteWordForward();
|
|
||||||
///
|
|
||||||
void deleteWordBackward();
|
|
||||||
///
|
|
||||||
void deleteLineForward();
|
|
||||||
|
|
||||||
/// sets row.end to the pos value *after* which a row should break.
|
|
||||||
/// for example, the pos after which isNewLine(pos) == true
|
|
||||||
void rowBreakPoint(ParagraphList::iterator pit, Row & row) const;
|
|
||||||
|
|
||||||
/// sets row.witdh to the minimum space a row needs on the screen in pixel
|
|
||||||
void fill(ParagraphList::iterator pit, Row & row, int workwidth) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns the minimum space a manual label needs on the
|
|
||||||
* screen in pixels
|
|
||||||
*/
|
|
||||||
int labelFill(ParagraphList::iterator pit, Row const & row) const;
|
|
||||||
|
|
||||||
/// FIXME
|
|
||||||
int labelEnd(ParagraphList::iterator pit, Row const & row) const;
|
|
||||||
|
|
||||||
///
|
|
||||||
void charInserted();
|
|
||||||
/// set 'number' font property
|
|
||||||
void number();
|
|
||||||
/// is the cursor paragraph right-to-left?
|
|
||||||
bool rtl() const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
///
|
|
||||||
mutable Bidi bidi;
|
|
||||||
///
|
|
||||||
bool in_inset_;
|
|
||||||
///
|
|
||||||
ParagraphList * paragraphs_;
|
|
||||||
//
|
//
|
||||||
// special owner functions
|
// special owner functions
|
||||||
///
|
///
|
||||||
@ -417,6 +344,13 @@ public:
|
|||||||
/// return true if this is owned by an inset.
|
/// return true if this is owned by an inset.
|
||||||
bool isInInset() const;
|
bool isInInset() const;
|
||||||
|
|
||||||
|
///
|
||||||
|
ParagraphList::iterator firstPar() const;
|
||||||
|
///
|
||||||
|
ParagraphList::iterator lastPar() const;
|
||||||
|
///
|
||||||
|
ParagraphList::iterator endPar() const;
|
||||||
|
|
||||||
/// return first row of text
|
/// return first row of text
|
||||||
RowList::iterator firstRow() const;
|
RowList::iterator firstRow() const;
|
||||||
/// return last row of text
|
/// return last row of text
|
||||||
@ -461,6 +395,91 @@ public:
|
|||||||
///
|
///
|
||||||
bool checkAndActivateInset(bool front);
|
bool checkAndActivateInset(bool front);
|
||||||
|
|
||||||
|
|
||||||
|
// Public Variables
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
int height;
|
||||||
|
///
|
||||||
|
unsigned int width;
|
||||||
|
/// the current font settings
|
||||||
|
LyXFont current_font;
|
||||||
|
/// the current font
|
||||||
|
LyXFont real_current_font;
|
||||||
|
/// our buffer's default layout font
|
||||||
|
LyXFont defaultfont_;
|
||||||
|
///
|
||||||
|
InsetText * inset_owner;
|
||||||
|
|
||||||
|
/// only the top-level LyXText has this non-zero
|
||||||
|
BufferView * bv_owner;
|
||||||
|
|
||||||
|
///
|
||||||
|
mutable Bidi bidi;
|
||||||
|
///
|
||||||
|
bool in_inset_;
|
||||||
|
///
|
||||||
|
ParagraphList * paragraphs_;
|
||||||
|
|
||||||
|
/// absolute document pixel coordinates of this LyXText
|
||||||
|
int xo_;
|
||||||
|
int yo_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Functions
|
||||||
|
private:
|
||||||
|
/// rebreaks the given par
|
||||||
|
void redoParagraphInternal(ParagraphList::iterator pit);
|
||||||
|
|
||||||
|
///
|
||||||
|
float getCursorX(ParagraphList::iterator pit,
|
||||||
|
Row const & row, lyx::pos_type pos, bool boundary) const;
|
||||||
|
/// used in setlayout
|
||||||
|
void makeFontEntriesLayoutSpecific(BufferParams const &, Paragraph & par);
|
||||||
|
|
||||||
|
/// Calculate and set the height of the row
|
||||||
|
void setHeightOfRow(ParagraphList::iterator, Row & row);
|
||||||
|
|
||||||
|
// fix the cursor `cur' after a characters has been deleted at `where'
|
||||||
|
// position. Called by deleteEmptyParagraphMechanism
|
||||||
|
void fixCursorAfterDelete(LyXCursor & cur, LyXCursor const & where);
|
||||||
|
|
||||||
|
/// delete double space (false) or empty paragraphs (true) around old_cursor
|
||||||
|
bool deleteEmptyParagraphMechanism(LyXCursor const & old_cursor);
|
||||||
|
|
||||||
|
///
|
||||||
|
void setCounter(Buffer const &, ParagraphList::iterator pit);
|
||||||
|
///
|
||||||
|
void deleteWordForward();
|
||||||
|
///
|
||||||
|
void deleteWordBackward();
|
||||||
|
///
|
||||||
|
void deleteLineForward();
|
||||||
|
|
||||||
|
/// sets row.end to the pos value *after* which a row should break.
|
||||||
|
/// for example, the pos after which isNewLine(pos) == true
|
||||||
|
void rowBreakPoint(ParagraphList::iterator pit, Row & row) const;
|
||||||
|
|
||||||
|
/// sets row.witdh to the minimum space a row needs on the screen in pixel
|
||||||
|
void fill(ParagraphList::iterator pit, Row & row, int workwidth) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the minimum space a manual label needs on the
|
||||||
|
* screen in pixels
|
||||||
|
*/
|
||||||
|
int labelFill(ParagraphList::iterator pit, Row const & row) const;
|
||||||
|
|
||||||
|
/// FIXME
|
||||||
|
int labelEnd(ParagraphList::iterator pit, Row const & row) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
void charInserted();
|
||||||
|
/// set 'number' font property
|
||||||
|
void number();
|
||||||
|
/// is the cursor paragraph right-to-left?
|
||||||
|
bool rtl() const;
|
||||||
|
|
||||||
|
// Private Variables
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/// prohibit this as long as there are back pointers...
|
/// prohibit this as long as there are back pointers...
|
||||||
@ -469,11 +488,6 @@ private:
|
|||||||
// cache for cursorPar()
|
// cache for cursorPar()
|
||||||
mutable ParagraphList::iterator cache_par_;
|
mutable ParagraphList::iterator cache_par_;
|
||||||
mutable int cache_pos_;
|
mutable int cache_pos_;
|
||||||
|
|
||||||
public:
|
|
||||||
/// absolute document pixel coordinates of this LyXText
|
|
||||||
int xo_;
|
|
||||||
int yo_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// return the default height of a row in pixels, considering font zoom
|
/// return the default height of a row in pixels, considering font zoom
|
||||||
|
18
src/text.C
18
src/text.C
@ -1507,18 +1507,36 @@ RowList::iterator LyXText::firstRow() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ParagraphList::iterator LyXText::firstPar() const
|
||||||
|
{
|
||||||
|
return ownerParagraphs().begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RowList::iterator LyXText::lastRow() const
|
RowList::iterator LyXText::lastRow() const
|
||||||
{
|
{
|
||||||
return boost::prior(endRow());
|
return boost::prior(endRow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ParagraphList::iterator LyXText::lastPar() const
|
||||||
|
{
|
||||||
|
return boost::prior(endPar());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RowList::iterator LyXText::endRow() const
|
RowList::iterator LyXText::endRow() const
|
||||||
{
|
{
|
||||||
return ownerParagraphs().back().rows.end();
|
return ownerParagraphs().back().rows.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ParagraphList::iterator LyXText::endPar() const
|
||||||
|
{
|
||||||
|
return ownerParagraphs().end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::nextRow(ParagraphList::iterator & pit,
|
void LyXText::nextRow(ParagraphList::iterator & pit,
|
||||||
RowList::iterator & rit) const
|
RowList::iterator & rit) const
|
||||||
{
|
{
|
||||||
|
34
src/text2.C
34
src/text2.C
@ -73,11 +73,37 @@ using std::string;
|
|||||||
LyXText::LyXText(BufferView * bv, InsetText * inset, bool ininset,
|
LyXText::LyXText(BufferView * bv, InsetText * inset, bool ininset,
|
||||||
ParagraphList & paragraphs)
|
ParagraphList & paragraphs)
|
||||||
: height(0), width(0), inset_owner(inset), bv_owner(bv),
|
: height(0), width(0), inset_owner(inset), bv_owner(bv),
|
||||||
in_inset_(ininset), paragraphs_(¶graphs),
|
in_inset_(ininset), paragraphs_(¶graphs), xo_(0), yo_(0),
|
||||||
cache_pos_(-1), xo_(0), yo_(0)
|
cache_pos_(-1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
LyXText & LyXText::operator=(LyXText const & lt)
|
||||||
|
{
|
||||||
|
// Copy all public variables
|
||||||
|
height = lt.height;
|
||||||
|
width = lt.width;
|
||||||
|
current_font = lt.current_font;
|
||||||
|
real_current_font = lt.real_current_font;
|
||||||
|
defaultfont_ = lt.defaultfont_;
|
||||||
|
inset_owner = lt.inset_owner;
|
||||||
|
bv_owner = lt.bv_owner;
|
||||||
|
bidi = lt.bidi;
|
||||||
|
in_inset_ = lt.in_inset_;
|
||||||
|
paragraphs_ = lt.paragraphs_;
|
||||||
|
xo_ = lt.xo_;
|
||||||
|
yo_ = lt.yo_;
|
||||||
|
|
||||||
|
// Copy all the private variables
|
||||||
|
|
||||||
|
// we cannot initailize a iterator with a singular iterator.
|
||||||
|
//cache_par_ = lt.cache_par_;
|
||||||
|
cache_pos_ = lt.cache_pos_;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::init(BufferView * bview)
|
void LyXText::init(BufferView * bview)
|
||||||
{
|
{
|
||||||
bv_owner = bview;
|
bv_owner = bview;
|
||||||
@ -1642,7 +1668,7 @@ DispatchResult LyXText::moveLeftIntern(bool front,
|
|||||||
|
|
||||||
DispatchResult LyXText::moveUp()
|
DispatchResult LyXText::moveUp()
|
||||||
{
|
{
|
||||||
if (cursorRow() == firstRow())
|
if (cursorPar() == firstPar() && cursorRow() == firstRow())
|
||||||
return DispatchResult(false, FINISHED_UP);
|
return DispatchResult(false, FINISHED_UP);
|
||||||
cursorUp(false);
|
cursorUp(false);
|
||||||
clearSelection();
|
clearSelection();
|
||||||
@ -1652,7 +1678,7 @@ DispatchResult LyXText::moveUp()
|
|||||||
|
|
||||||
DispatchResult LyXText::moveDown()
|
DispatchResult LyXText::moveDown()
|
||||||
{
|
{
|
||||||
if (cursorRow() == lastRow())
|
if (cursorPar() == lastPar() && cursorRow() == lastRow())
|
||||||
return DispatchResult(false, FINISHED_DOWN);
|
return DispatchResult(false, FINISHED_DOWN);
|
||||||
cursorDown(false);
|
cursorDown(false);
|
||||||
clearSelection();
|
clearSelection();
|
||||||
|
@ -679,7 +679,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
|
|||||||
if (!selection.mark())
|
if (!selection.mark())
|
||||||
clearSelection();
|
clearSelection();
|
||||||
finishChange(bv, false);
|
finishChange(bv, false);
|
||||||
if (cursorRow() == firstRow())
|
if (cursorPar() == firstPar() && cursorRow() == firstRow())
|
||||||
return DispatchResult(false, FINISHED_UP);
|
return DispatchResult(false, FINISHED_UP);
|
||||||
cursorPrevious();
|
cursorPrevious();
|
||||||
break;
|
break;
|
||||||
@ -688,7 +688,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
|
|||||||
if (!selection.mark())
|
if (!selection.mark())
|
||||||
clearSelection();
|
clearSelection();
|
||||||
finishChange(bv, false);
|
finishChange(bv, false);
|
||||||
if (cursorRow() == lastRow())
|
if (cursorPar() == lastPar() && cursorRow() == lastRow())
|
||||||
return DispatchResult(false, FINISHED_DOWN);
|
return DispatchResult(false, FINISHED_DOWN);
|
||||||
cursorNext();
|
cursorNext();
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user