... and a bit more.
Small changes in order to reduce include file dependency. The "most intrusive" parts are "localized typedefs" for Paragraph::size_type plus some whitespace changes (mostly spaces -> tab for indentation) Andre' -- André Pönitz .............................................. [EMAIL PROTECTED]
Index: BufferView_pimpl.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v retrieving revision 1.173 diff -u -p -r1.173 BufferView_pimpl.C --- BufferView_pimpl.C 2001/11/13 14:47:32 1.173 +++ BufferView_pimpl.C 2001/11/20 19:34:43 @@ -14,6 +14,7 @@ #include "lyxscreen.h" #include "lyxtext.h" #include "lyxrow.h" +#include "paragraph.h" #include "LyXView.h" #include "commandtags.h" #include "lyxfunc.h" @@ -293,9 +294,9 @@ int BufferView::Pimpl::resizeCurrentBuff Paragraph * selendpar = 0; UpdatableInset * the_locking_inset = 0; - Paragraph::size_type pos = 0; - Paragraph::size_type selstartpos = 0; - Paragraph::size_type selendpos = 0; + pos_type pos = 0; + pos_type selstartpos = 0; + pos_type selendpos = 0; bool selection = false; bool mark_set = false; @@ -2798,7 +2799,7 @@ bool BufferView::Pimpl::Dispatch(kb_acti case LFUN_CHARATCURSOR: { - Paragraph::size_type pos = bv_->getLyXText()->cursor.pos(); + pos_type pos = bv_->getLyXText()->cursor.pos(); if (pos < bv_->getLyXText()->cursor.par()->size()) owner_->getLyXFunc()->setMessage( tostr(bv_->getLyXText()->cursor.par()->getChar(pos))); @@ -3243,7 +3244,7 @@ void BufferView::Pimpl::smartQuote() { LyXText const * lt = bv_->getLyXText(); Paragraph const * par = lt->cursor.par(); - Paragraph::size_type pos = lt->cursor.pos(); + pos_type pos = lt->cursor.pos(); char c; if (!pos Index: BufferView_pimpl.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.h,v retrieving revision 1.39 diff -u -p -r1.39 BufferView_pimpl.h --- BufferView_pimpl.h 2001/08/02 14:55:00 1.39 +++ BufferView_pimpl.h 2001/11/20 19:34:43 @@ -10,7 +10,6 @@ #include "commandtags.h" #include "frontends/Timeout.h" #include "WorkArea.h" -#include "paragraph.h" #include "insets/insetspecialchar.h" #ifdef __GNUG__ @@ -23,6 +22,8 @@ class LyXScreen; /// struct BufferView::Pimpl : public SigC::Object { + /// copied from paragraph.h even if it does not look overly sensible + typedef std::vector<char>::difference_type pos_type; /// Pimpl(BufferView * i, LyXView * o, int xpos, int ypos, int width, int height); @@ -172,22 +173,22 @@ private: /// struct Position { /// Filename - string filename; - /// Cursor paragraph Id - int par_id; - /// Cursor position - Paragraph::size_type par_pos; + string filename; + /// Cursor paragraph Id + int par_id; + /// Cursor position + pos_type par_pos; /// Position() : par_id(0), par_pos(0) {} /// - Position(string const & f, int id, Paragraph::size_type pos) - : filename(f), par_id(id), par_pos(pos) {} + Position(string const & f, int id, pos_type pos) + : filename(f), par_id(id), par_pos(pos) {} }; /// std::vector<Position> saved_positions; /// void moveCursorUpdate(bool selecting); - /// Get next inset of this class from current cursor position + /// Get next inset of this class from current cursor position Inset * getInsetByCode(Inset::Code code); /// void MenuInsertLyXFile(string const & filen); Index: Makefile.am =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/Makefile.am,v retrieving revision 1.95 diff -u -p -r1.95 Makefile.am --- Makefile.am 2001/10/03 15:49:31 1.95 +++ Makefile.am 2001/11/20 19:34:43 @@ -67,8 +67,6 @@ lyx_SOURCES = \ ParagraphParameters.h \ ParameterStruct.h \ PrinterParams.h \ - Sectioning.h \ - Sectioning.C \ ShareContainer.h \ Spacing.C \ Spacing.h \ Index: buffer.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.h,v retrieving revision 1.85 diff -u -p -r1.85 buffer.h --- buffer.h 2001/11/14 09:46:05 1.85 +++ buffer.h 2001/11/20 19:34:43 @@ -162,15 +162,13 @@ public: */ void latexParagraphs(std::ostream & os, Paragraph * par, Paragraph * endpar, TexRow & texrow) const; - - /// + /// void simpleDocBookOnePar(std::ostream &, Paragraph * par, int & desc_on, Paragraph::depth_type depth) const ; - /// + /// void simpleLinuxDocOnePar(std::ostream & os, Paragraph * par, Paragraph::depth_type depth); - /// void makeLinuxDocFile(string const & filename, bool nice, bool only_body = false); @@ -178,14 +176,13 @@ public: void makeDocBookFile(string const & filename, bool nice, bool only_body = false); /// Open SGML/XML tag. - void sgmlOpenTag(std::ostream & os, Paragraph::depth_type depth, - string const & latexname) const; - /// Closes SGML/XML tag. - void sgmlCloseTag(std::ostream & os, Paragraph::depth_type depth, - string const & latexname) const; + void sgmlOpenTag(std::ostream & os, Paragraph::depth_type depth, + string const & latexname) const; + /// Closes SGML/XML tag. + void sgmlCloseTag(std::ostream & os, Paragraph::depth_type depth, + string const & latexname) const; /// - void sgmlError(Paragraph * par, int pos, - string const & message) const; + void sgmlError(Paragraph * par, int pos, string const & message) const; /// returns the main language for the buffer (document) Language const * getLanguage() const; @@ -296,10 +293,10 @@ public: bool isMultiLingual(); /// Does this mean that this is buffer local? - UndoStack undostack; + UndoStack undostack; /// Does this mean that this is buffer local? - UndoStack redostack; + UndoStack redostack; /// BufferParams params; @@ -561,7 +558,8 @@ void Buffer::setParentName(string const /// inline -bool operator==(Buffer::TocItem const & a, Buffer::TocItem const & b) { +bool operator==(Buffer::TocItem const & a, Buffer::TocItem const & b) +{ return a.par == b.par && a.str == b.str; // No need to compare depth. } @@ -569,7 +567,8 @@ bool operator==(Buffer::TocItem const & /// inline -bool operator!=(Buffer::TocItem const & a, Buffer::TocItem const & b) { +bool operator!=(Buffer::TocItem const & a, Buffer::TocItem const & b) +{ return !(a == b); // No need to compare depth. } @@ -578,7 +577,8 @@ bool operator!=(Buffer::TocItem const & /// inline bool operator==(Buffer::inset_iterator const & iter1, - Buffer::inset_iterator const & iter2) { + Buffer::inset_iterator const & iter2) +{ return iter1.par == iter2.par && (iter1.par == 0 || iter1.it == iter2.it); } @@ -587,7 +587,8 @@ bool operator==(Buffer::inset_iterator c /// inline bool operator!=(Buffer::inset_iterator const & iter1, - Buffer::inset_iterator const & iter2) { + Buffer::inset_iterator const & iter2) +{ return !(iter1 == iter2); } Index: layout.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/layout.h,v retrieving revision 1.35 diff -u -p -r1.35 layout.h --- layout.h 2001/11/09 13:44:43 1.35 +++ layout.h 2001/11/20 19:34:43 @@ -39,8 +39,8 @@ enum layout_default { /// The different output types enum OutputType { - /// - LATEX = 1, + /// + LATEX = 1, /// LINUXDOC, /// @@ -49,6 +49,7 @@ enum OutputType { LITERATE }; + /// The different margin types enum LYX_MARGIN_TYPE { /// @@ -79,7 +80,7 @@ enum LyXAlignment { /// LYX_ALIGN_LAYOUT = 16, /// - LYX_ALIGN_SPECIAL = 32 + LYX_ALIGN_SPECIAL = 32 }; /// @@ -88,6 +89,7 @@ void operator|=(LyXAlignment & la1, LyXA la1 = static_cast<LyXAlignment>(la1 | la2); } + /// The different LaTeX-Types enum LYX_LATEX_TYPES { /// @@ -102,6 +104,7 @@ enum LYX_LATEX_TYPES { LATEX_LIST_ENVIRONMENT }; + /// The different label types enum LYX_LABEL_TYPES { /// @@ -109,7 +112,7 @@ enum LYX_LABEL_TYPES { /// LABEL_MANUAL, /// - LABEL_BIBLIO, + LABEL_BIBLIO, /// LABEL_TOP_ENVIRONMENT, /// @@ -142,6 +145,7 @@ enum LYX_LABEL_TYPES { LABEL_COUNTER_ENUMIV }; + /// enum LYX_END_LABEL_TYPES { /// @@ -367,9 +371,9 @@ private: string labelstring_appendix_; /// LaTeX parameter for environment - string latexparam_; + string latexparam_; - /// Macro definitions needed for this layout + /// Macro definitions needed for this layout string preamble_; }; @@ -461,8 +465,8 @@ public: /// int tocdepth() const { return tocdepth_; } - /// - OutputType outputType() const { return outputType_; } + /// + OutputType outputType() const { return outputType_; } /// LyXFont const & defaultfont() const { return defaultfont_; } @@ -492,9 +496,9 @@ private: /// string description_; /// Specific class options - string opt_fontsize_; + string opt_fontsize_; /// - string opt_pagestyle_; + string opt_pagestyle_; /// string options_; /// @@ -511,8 +515,8 @@ private: int secnumdepth_; /// int tocdepth_; - /// - OutputType outputType_; + /// + OutputType outputType_; /** Base font. The paragraph and layout fonts are resolved against this font. This has to be fully instantiated. Attributes LyXFont::INHERIT, LyXFont::IGNORE, and LyXFont::TOGGLE are @@ -524,7 +528,7 @@ private: /// Text that dictates how wide the right margin is on the screen string rightmargin_; - /// + /// int maxcounter_; // add approp. signedness /// Index: lyxcursor.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxcursor.C,v retrieving revision 1.9 diff -u -p -r1.9 lyxcursor.C --- lyxcursor.C 2001/08/06 19:12:45 1.9 +++ lyxcursor.C 2001/11/20 19:34:43 @@ -35,13 +35,13 @@ Paragraph * LyXCursor::par() const } -void LyXCursor::pos(Paragraph::size_type p) +void LyXCursor::pos(pos_type p) { pos_ = p; } -Paragraph::size_type LyXCursor::pos() const +LyXCursor::pos_type LyXCursor::pos() const { return pos_; } Index: lyxcursor.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxcursor.h,v retrieving revision 1.19 diff -u -p -r1.19 lyxcursor.h --- lyxcursor.h 2001/08/06 19:12:45 1.19 +++ lyxcursor.h 2001/11/20 19:34:43 @@ -16,23 +16,27 @@ #pragma interface #endif -#include "paragraph.h" +#include <vector> -struct Row; +class Paragraph; +class Row; /** All these variables should be explained. Matthias? */ class LyXCursor { public: + /// copied from paragraph.h even if it does not look overly sensible + typedef std::vector<char>::difference_type pos_type; + /// LyXCursor(); /// void par(Paragraph * p); /// Paragraph * par() const; /// - void pos(Paragraph::size_type p); + void pos(pos_type p); /// - Paragraph::size_type pos() const; + pos_type pos() const; /// void boundary(bool b); /// @@ -57,7 +61,7 @@ private: /// The paragraph the cursor is in. Paragraph * par_; /// The position inside the paragraph - Paragraph::size_type pos_; + pos_type pos_; /// bool boundary_; /// Index: lyxfunc.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v retrieving revision 1.264 diff -u -p -r1.264 lyxfunc.C --- lyxfunc.C 2001/11/09 13:44:43 1.264 +++ lyxfunc.C 2001/11/20 19:34:43 @@ -30,6 +30,7 @@ #include "version.h" #include "kbmap.h" #include "lyxfunc.h" +#include "lyxrow.h" #include "bufferlist.h" #include "BufferView.h" #include "ColorHandler.h" Index: lyxlex.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxlex.h,v retrieving revision 1.25 diff -u -p -r1.25 lyxlex.h --- lyxlex.h 2001/08/06 19:12:46 1.25 +++ lyxlex.h 2001/11/20 19:34:43 @@ -21,7 +21,7 @@ struct keyword_item { /// char const * tag; /// - short code; + int code; }; /** Generalized simple lexical analizer. Index: lyxrow.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrow.C,v retrieving revision 1.7 diff -u -p -r1.7 lyxrow.C --- lyxrow.C 2001/06/25 00:06:18 1.7 +++ lyxrow.C 2001/11/20 19:34:43 @@ -29,13 +29,13 @@ void Row::par(Paragraph * p) } -void Row::pos(Paragraph::size_type p) +void Row::pos(pos_type p) { pos_ = p; } -Paragraph::size_type Row::pos() const +Row::pos_type Row::pos() const { return pos_; } Index: lyxrow.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrow.h,v retrieving revision 1.13 diff -u -p -r1.13 lyxrow.h --- lyxrow.h 2001/06/25 00:06:18 1.13 +++ lyxrow.h 2001/11/20 19:34:43 @@ -16,11 +16,15 @@ #pragma interface #endif -#include "paragraph.h" +#include <vector> +class Paragraph; + /// class Row { public: + /// copied from paragraph.h even if it does not look overly sensible + typedef std::vector<char>::difference_type pos_type; /// Row(); /// @@ -30,9 +34,9 @@ public: /// Paragraph * par() const; /// - void pos(Paragraph::size_type p); + void pos(pos_type p); /// - Paragraph::size_type pos() const; + pos_type pos() const; /// void fill(int f); /// @@ -65,7 +69,7 @@ private: /// Paragraph * par_; /// - Paragraph::size_type pos_; + pos_type pos_; /** what is missing to a full row can be negative. Needed for hfills, flushright, block etc. */ mutable int fill_; Index: lyxscreen.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxscreen.h,v retrieving revision 1.29 diff -u -p -r1.29 lyxscreen.h --- lyxscreen.h 2001/08/02 14:55:02 1.29 +++ lyxscreen.h 2001/11/20 19:34:43 @@ -25,10 +25,6 @@ class BufferView; struct Row; -/// -typedef unsigned short Dimension; - - /** The class LyXScreen is used for the main Textbody. Concretely, the screen is held in a pixmap. This pixmap is kept up to date and used to optimize drawing on the screen. Index: lyxtext.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v retrieving revision 1.95 diff -u -p -r1.95 lyxtext.h --- lyxtext.h 2001/11/09 13:44:44 1.95 +++ lyxtext.h 2001/11/20 19:34:43 @@ -18,17 +18,19 @@ #include "lyxfont.h" #include "lyxcursor.h" -#include "paragraph.h" #include "layout.h" -#include "lyxrow.h" -#include "vspace.h" -#include "Spacing.h" #include "LColor.h" +#include "insets/inset.h" class Buffer; class BufferParams; class BufferView; class InsetText; +class Paragraph; +class Row; +class Spacing; +class UpdatableInset; +class VSpace; /** @@ -36,6 +38,10 @@ class InsetText; */ class LyXText { public: + /// copied from paragraph.h even if it does not look overly sensible + typedef std::vector<char>::difference_type pos_type; + /// should equal LyXTextClass::size_type + typedef std::vector<char>::size_type layout_type; /// enum text_status { /// @@ -94,18 +100,16 @@ public: /// int getRealCursorX(BufferView *) const; /// - LyXFont const getFont(Buffer const *, Paragraph * par, - Paragraph::size_type pos) const; + LyXFont const getFont(Buffer const *, Paragraph * par, pos_type pos) const; /// LyXFont const getLayoutFont(Buffer const *, Paragraph * par) const; /// LyXFont const getLabelFont(Buffer const *, Paragraph * par) const; /// void setCharFont(Buffer const *, Paragraph * par, - Paragraph::size_type pos, LyXFont const & font); + pos_type pos, LyXFont const & font); void setCharFont(BufferView *, Paragraph * par, - Paragraph::size_type pos, - LyXFont const & font, bool toggleall); + pos_type pos, LyXFont const & font, bool toggleall); /// returns a pointer to the very first Paragraph Paragraph * firstParagraph() const; @@ -118,8 +122,9 @@ public: Paragraph * setLayout(BufferView *, LyXCursor & actual_cursor, LyXCursor & selection_start, LyXCursor & selection_end, - LyXTextClass::size_type layout); - void setLayout(BufferView *, LyXTextClass::size_type layout); + layout_type layout); + /// + void setLayout(BufferView *, layout_type layout); /// used in setlayout void makeFontEntriesLayoutSpecific(Buffer const *, Paragraph * par); @@ -135,7 +140,7 @@ public: /** Get the depth at current cursor position */ - int getDepth() const { return cursor.par()->getDepth(); } + int getDepth() const; /** set font over selection and make a total rebreak of those paragraphs. @@ -194,7 +199,7 @@ public: /// mutable Row * refresh_row; /// - Paragraph::size_type refresh_pos; + pos_type refresh_pos; /// give and set the LyXText status text_status status() const; @@ -217,14 +222,14 @@ public: /** returns the column near the specified x-coordinate of the row x is set to the real beginning of this column */ - Paragraph::size_type getColumnNearX(BufferView *, Row * row, + pos_type getColumnNearX(BufferView *, Row * row, int & x, bool & boundary) const; /** returns a pointer to a specified row. y is set to the beginning of the row */ Row * getRow(Paragraph * par, - Paragraph::size_type pos, int & y) const; + pos_type pos, int & y) const; /** returns the height of a default row, needed for scrollbar */ @@ -301,16 +306,16 @@ public: void selectSelectedWord(BufferView *); /// void setCursor(BufferView *, Paragraph * par, - Paragraph::size_type pos, + pos_type pos, bool setfont = true, bool boundary = false) const; /// void setCursor(BufferView *, LyXCursor &, Paragraph * par, - Paragraph::size_type pos, + pos_type pos, bool boundary = false) const; /// void setCursorIntern(BufferView *, Paragraph * par, - Paragraph::size_type pos, + pos_type pos, bool setfont = true, bool boundary = false) const; /// @@ -318,10 +323,10 @@ public: /// bool isBoundary(Buffer const *, Paragraph * par, - Paragraph::size_type pos) const; + pos_type pos) const; /// bool isBoundary(Buffer const *, Paragraph * par, - Paragraph::size_type pos, + pos_type pos, LyXFont const & font) const; /// @@ -452,11 +457,9 @@ public: /// returns false if inset wasn't found bool updateInset(BufferView *, Inset *); /// - void checkParagraph(BufferView *, Paragraph * par, - Paragraph::size_type pos); + void checkParagraph(BufferView *, Paragraph * par, pos_type pos); /// - int numberOfCell(Paragraph * par, - Paragraph::size_type pos) const; + int numberOfCell(Paragraph * par, pos_type pos) const; /// void removeTableRow(LyXCursor & cursor) const; /// @@ -472,7 +475,7 @@ public: /// Maps positions in the visual string to positions in logical string. inline - Paragraph::size_type log2vis(Paragraph::size_type pos) const { + pos_type log2vis(pos_type pos) const { if (bidi_start == -1) return pos; else @@ -481,7 +484,7 @@ public: /// Maps positions in the logical string to positions in visual string. inline - Paragraph::size_type vis2log(Paragraph::size_type pos) const { + pos_type vis2log(pos_type pos) const { if (bidi_start == -1) return pos; else @@ -489,7 +492,7 @@ public: } /// inline - Paragraph::size_type bidi_level(Paragraph::size_type pos) const { + pos_type bidi_level(pos_type pos) const { if (bidi_start == -1) return 0; else @@ -497,7 +500,7 @@ public: } /// inline - bool bidi_InRange(Paragraph::size_type pos) const { + bool bidi_InRange(pos_type pos) const { return bidi_start == -1 || (bidi_start <= pos && pos <= bidi_end); } @@ -511,12 +514,11 @@ private: Asger has learned that this should be a buffer-property instead Lgb has learned that 'char' is a lousy type for non-characters */ - LyXTextClass::size_type copylayouttype; + layout_type copylayouttype; /** inserts a new row behind the specified row, increments the touched counters */ - void insertRow(Row * row, Paragraph * par, - Paragraph::size_type pos) const; + void insertRow(Row * row, Paragraph * par, pos_type pos) const; /** removes the row and reset the touched counters */ void removeRow(Row * row) const; @@ -618,19 +620,15 @@ private: */ /// - int singleWidth(BufferView *, Paragraph * par, - Paragraph::size_type pos) const; + int singleWidth(BufferView *, Paragraph * par, pos_type pos) const; /// - int singleWidth(BufferView *, Paragraph * par, - Paragraph::size_type pos, char c) const; + int singleWidth(BufferView *, Paragraph * par, pos_type pos, char c) const; /// void draw(BufferView *, Row const * row, - Paragraph::size_type & pos, - int offset, float & x, bool cleared); + pos_type & pos, int offset, float & x, bool cleared); /// get the next breakpoint in a given paragraph - Paragraph::size_type nextBreakPoint(BufferView *, Row const * row, - int width) const; + pos_type nextBreakPoint(BufferView *, Row const * row, int width) const; /// returns the minimum space a row needs on the screen in pixel int fill(BufferView *, Row * row, int workwidth) const; @@ -639,8 +637,7 @@ private: int labelFill(BufferView *, Row const * row) const; /// - Paragraph::size_type - beginningOfMainBody(Buffer const *, Paragraph const * par) const; + pos_type beginningOfMainBody(Buffer const *, Paragraph const * par) const; /** Returns the left beginning of the text. This information cannot be taken from the layouts-objekt, because @@ -671,39 +668,39 @@ private: LaTeX */ bool hfillExpansion(Buffer const *, Row const * row_ptr, - Paragraph::size_type pos) const; + pos_type pos) const; /// LColor::color backgroundColor(); /// - mutable std::vector<Paragraph::size_type> log2vis_list; + mutable std::vector<pos_type> log2vis_list; /// - mutable std::vector<Paragraph::size_type> vis2log_list; + mutable std::vector<pos_type> vis2log_list; /// - mutable std::vector<Paragraph::size_type> bidi_levels; + mutable std::vector<pos_type> bidi_levels; /// - mutable Paragraph::size_type bidi_start; + mutable pos_type bidi_start; /// - mutable Paragraph::size_type bidi_end; + mutable pos_type bidi_end; /// mutable bool bidi_same_direction; /// unsigned char transformChar(unsigned char c, Paragraph * par, - Paragraph::size_type pos) const; + pos_type pos) const; /** returns the paragraph position of the last character in the specified row */ - Paragraph::size_type rowLast(Row const * row) const; + pos_type rowLast(Row const * row) const; /// - Paragraph::size_type rowLastPrintable(Row const * row) const; + pos_type rowLastPrintable(Row const * row) const; /// void charInserted(); @@ -718,23 +715,4 @@ public: void ownerParagraph(int id, Paragraph *) const; }; - -/* returns a pointer to the row near the specified y-coordinate - * (relative to the whole text). y is set to the real beginning - * of this row */ -inline -Row * LyXText::getRowNearY(int & y) const -{ - // If possible we should optimize this method. (Lgb) - Row * tmprow = firstrow; - int tmpy = 0; - - while (tmprow->next() && tmpy + tmprow->height() <= y) { - tmpy += tmprow->height(); - tmprow = tmprow->next(); - } - - y = tmpy; // return the real y - return tmprow; -} #endif Index: paragraph.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.h,v retrieving revision 1.17 diff -u -p -r1.17 paragraph.h --- paragraph.h 2001/11/09 13:44:44 1.17 +++ paragraph.h 2001/11/20 19:34:43 @@ -81,6 +81,8 @@ public: /// The same as ParameterStruct::depth_type typedef unsigned int depth_type; /// + LyXTextClass::LayoutList::size_type layout_type; + /// typedef std::vector<value_type> TextContainer; /// /* This should be TextContainer::size_type, but we need @@ -332,13 +334,13 @@ public: int stripLeadingSpaces(LyXTextClassList::size_type tclass); #ifndef NO_PEXTRA_REALLY - /* If I set a PExtra Indent on one paragraph of a ENV_LIST-TYPE - I have to set it on each of it's elements */ + /* If I set a PExtra Indent on one paragraph of a ENV_LIST-TYPE + I have to set it on each of it's elements */ /// - void setPExtraType(BufferParams const &, int type, + void setPExtraType(BufferParams const &, int type, string const & width, string const & widthp); /// - void unsetPExtraType(BufferParams const &); + void unsetPExtraType(BufferParams const &); #endif /// bool sgmlConvertChar(char c, string & sgml_string); @@ -377,7 +379,7 @@ public: /// Inset * operator*() { return it->inset; } /// - size_type getPos() const {return it->pos; } + size_type getPos() const { return it->pos; } /// bool operator==(inset_iterator const & iter) const { return it == iter.it; Index: text.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v retrieving revision 1.196 diff -u -p -r1.196 text.C --- text.C 2001/11/15 00:39:11 1.196 +++ text.C 2001/11/20 19:34:43 @@ -11,6 +11,7 @@ #include <config.h> #include "lyxtext.h" +#include "lyxrow.h" #include "layout.h" #include "paragraph.h" #include "lyx_gui_misc.h" @@ -67,7 +68,7 @@ int LyXText::workWidth(BufferView * bvie int LyXText::workWidth(BufferView * bview, Inset * inset) const { Paragraph * par = 0; - Paragraph::size_type pos = 0; + pos_type pos = 0; Buffer::inset_iterator it = bview->buffer()->inset_iterator_begin(); @@ -123,7 +124,7 @@ int LyXText::getRealCursorX(BufferView * unsigned char LyXText::transformChar(unsigned char c, Paragraph * par, - Paragraph::size_type pos) const + pos_type pos) const { if (!Encodings::is_arabic(c)) if (lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 && isdigit(c)) @@ -134,7 +135,7 @@ unsigned char LyXText::transformChar(uns unsigned char const prev_char = pos > 0 ? par->getChar(pos-1) : ' '; unsigned char next_char = ' '; - for (Paragraph::size_type i = pos+1; i < par->size(); ++i) + for (pos_type i = pos+1; i < par->size(); ++i) if (!Encodings::IsComposeChar_arabic(par->getChar(i))) { next_char = par->getChar(i); break; @@ -179,7 +180,7 @@ unsigned char LyXText::transformChar(uns // Lgb int LyXText::singleWidth(BufferView * bview, Paragraph * par, - Paragraph::size_type pos) const + pos_type pos) const { char const c = par->getChar(pos); return singleWidth(bview, par, pos, c); @@ -187,7 +188,7 @@ int LyXText::singleWidth(BufferView * bv int LyXText::singleWidth(BufferView * bview, Paragraph * par, - Paragraph::size_type pos, char c) const + pos_type pos, char c) const { LyXFont const font = getFont(bview->buffer(), par, pos); @@ -229,7 +230,7 @@ int LyXText::singleWidth(BufferView * bv // Returns the paragraph position of the last character in the specified row -Paragraph::size_type LyXText::rowLast(Row const * row) const +LyXText::pos_type LyXText::rowLast(Row const * row) const { if (row->next() == 0) return row->par()->size() - 1; @@ -240,9 +241,9 @@ Paragraph::size_type LyXText::rowLast(Ro } -Paragraph::size_type LyXText::rowLastPrintable(Row const * row) const +LyXText::pos_type LyXText::rowLastPrintable(Row const * row) const { - Paragraph::size_type const last = rowLast(row); + pos_type const last = rowLast(row); if (last >= row->pos() && row->next() && row->next()->par() == row->par() @@ -270,8 +271,8 @@ void LyXText::computeBidiTables(Buffer c } if (bidi_end + 2 - bidi_start > - static_cast<Paragraph::size_type>(log2vis_list.size())) { - Paragraph::size_type new_size = + static_cast<pos_type>(log2vis_list.size())) { + pos_type new_size = (bidi_end + 2 - bidi_start < 500) ? 500 : 2 * (bidi_end + 2 - bidi_start); log2vis_list.resize(new_size); @@ -282,19 +283,18 @@ void LyXText::computeBidiTables(Buffer c vis2log_list[bidi_end + 1 - bidi_start] = -1; log2vis_list[bidi_end + 1 - bidi_start] = -1; - Paragraph::size_type stack[2]; + pos_type stack[2]; bool const rtl_par = row->par()->getParLanguage(buf->params)->RightToLeft(); int level = 0; bool rtl = false; bool rtl0 = false; - Paragraph::size_type const main_body = - beginningOfMainBody(buf, row->par()); + pos_type const main_body = beginningOfMainBody(buf, row->par()); - for (Paragraph::size_type lpos = bidi_start; + for (pos_type lpos = bidi_start; lpos <= bidi_end; ++lpos) { bool is_space = row->par()->isLineSeparator(lpos); - Paragraph::size_type const pos = + pos_type const pos = (is_space && lpos + 1 <= bidi_end && !row->par()->isLineSeparator(lpos + 1) && !row->par()->isNewline(lpos + 1)) @@ -345,8 +345,7 @@ void LyXText::computeBidiTables(Buffer c bidi_levels[lpos - bidi_start] = new_level; while (level > new_level2) { - Paragraph::size_type old_lpos = - stack[--level]; + pos_type old_lpos = stack[--level]; int delta = lpos - old_lpos - 1; if (level % 2) delta = -delta; @@ -358,15 +357,15 @@ void LyXText::computeBidiTables(Buffer c } while (level > 0) { - Paragraph::size_type const old_lpos = stack[--level]; + pos_type const old_lpos = stack[--level]; int delta = bidi_end - old_lpos; if (level % 2) delta = -delta; log2vis_list[old_lpos - bidi_start] += delta; } - Paragraph::size_type vpos = bidi_start - 1; - for (Paragraph::size_type lpos = bidi_start; + pos_type vpos = bidi_start - 1; + for (pos_type lpos = bidi_start; lpos <= bidi_end; ++lpos) { vpos += log2vis_list[lpos - bidi_start]; vis2log_list[vpos - bidi_start] = lpos; @@ -377,7 +376,7 @@ void LyXText::computeBidiTables(Buffer c // This method requires a previous call to ComputeBidiTables() bool LyXText::isBoundary(Buffer const * buf, Paragraph * par, - Paragraph::size_type pos) const + pos_type pos) const { if (!lyxrc.rtl_support || pos == 0) return false; @@ -397,8 +396,7 @@ bool LyXText::isBoundary(Buffer const * bool LyXText::isBoundary(Buffer const * buf, Paragraph * par, - Paragraph::size_type pos, - LyXFont const & font) const + pos_type pos, LyXFont const & font) const { if (!lyxrc.rtl_support) return false; // This is just for speedup @@ -412,12 +410,11 @@ bool LyXText::isBoundary(Buffer const * void LyXText::draw(BufferView * bview, Row const * row, - Paragraph::size_type & vpos, - int offset, float & x, bool cleared) + pos_type & vpos, int offset, float & x, bool cleared) { Painter & pain = bview->painter(); - Paragraph::size_type pos = vis2log(vpos); + pos_type pos = vis2log(vpos); char c = row->par()->getChar(pos); float tmpx = x; @@ -527,13 +524,13 @@ void LyXText::draw(BufferView * bview, R textstring = c; ++vpos; - Paragraph::size_type const last = rowLastPrintable(row); + pos_type const last = rowLastPrintable(row); if (font.language()->lang() == "hebrew") { if (Encodings::IsComposeChar_hebrew(c)) { int const width = lyxfont::width(c, font2); int dx = 0; - for (Paragraph::size_type i = pos-1; i >= 0; --i) { + for (pos_type i = pos-1; i >= 0; --i) { c = row->par()->getChar(i); if (!Encodings::IsComposeChar_hebrew(c)) { if (IsPrintableNonspace(c)) { @@ -572,7 +569,7 @@ void LyXText::draw(BufferView * bview, R textstring = c; int const width = lyxfont::width(c, font2); int dx = 0; - for (Paragraph::size_type i = pos-1; i >= 0; --i) { + for (pos_type i = pos-1; i >= 0; --i) { c = row->par()->getChar(i); if (!Encodings::IsComposeChar_arabic(c)) { if (IsPrintableNonspace(c)) { @@ -881,7 +878,7 @@ int LyXText::labelEnd(BufferView * bview // get the next breakpoint in a given paragraph -Paragraph::size_type +LyXText::pos_type LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const { Paragraph * par = row->par(); @@ -889,20 +886,20 @@ LyXText::nextBreakPoint(BufferView * bvi if (width < 0) return par->size(); - Paragraph::size_type const pos = row->pos(); + pos_type const pos = row->pos(); // position of the last possible breakpoint // -1 isn't a suitable value, but a flag - Paragraph::size_type last_separator = -1; + pos_type last_separator = -1; width -= rightMargin(bview->buffer(), row); - Paragraph::size_type const main_body = + pos_type const main_body = beginningOfMainBody(bview->buffer(), par); LyXLayout const & layout = textclasslist.Style(bview->buffer()->params.textclass, par->getLayout()); - Paragraph::size_type i = pos; + pos_type i = pos; if (layout.margintype == MARGIN_RIGHT_ADDRESS_BOX) { /* special code for right address boxes, only newlines count */ @@ -919,7 +916,7 @@ LyXText::nextBreakPoint(BufferView * bvi } } else { // Last position is an invariant - Paragraph::size_type const last = + pos_type const last = par->size(); // this is the usual handling int x = leftMargin(bview, row); @@ -1002,7 +999,7 @@ int LyXText::fill(BufferView * bview, Ro int w; // get the pure distance - Paragraph::size_type const last = rowLastPrintable(row); + pos_type const last = rowLastPrintable(row); // special handling of the right address boxes if (textclasslist.Style(bview->buffer()->params.textclass, @@ -1018,9 +1015,9 @@ int LyXText::fill(BufferView * bview, Ro LyXLayout const & layout = textclasslist.Style(bview->buffer()->params.textclass, row->par()->getLayout()); - Paragraph::size_type const main_body = + pos_type const main_body = beginningOfMainBody(bview->buffer(), row->par()); - Paragraph::size_type i = row->pos(); + pos_type i = row->pos(); while (i <= last) { if (main_body > 0 && i == main_body) { @@ -1058,7 +1055,7 @@ int LyXText::fill(BufferView * bview, Ro // returns the minimum space a manual label needs on the screen in pixel int LyXText::labelFill(BufferView * bview, Row const * row) const { - Paragraph::size_type last = beginningOfMainBody(bview->buffer(), row->par()) - 1; + pos_type last = beginningOfMainBody(bview->buffer(), row->par()) - 1; // -1 because a label ends either with a space that is in the label, // or with the beginning of a footnote that is outside the label. @@ -1074,7 +1071,7 @@ int LyXText::labelFill(BufferView * bvie --last; int w = 0; - Paragraph::size_type i = row->pos(); + pos_type i = row->pos(); while (i <= last) { w += singleWidth(bview, row->par(), i); ++i; @@ -1095,9 +1092,8 @@ int LyXText::labelFill(BufferView * bvie // on the very last column doesnt count int LyXText::numberOfSeparators(Buffer const * buf, Row const * row) const { - Paragraph::size_type const last = rowLast(row); - Paragraph::size_type p = - max(row->pos(), beginningOfMainBody(buf, row->par())); + pos_type const last = rowLast(row); + pos_type p = max(row->pos(), beginningOfMainBody(buf, row->par())); int n = 0; for (; p < last; ++p) { if (row->par()->isSeparator(p)) { @@ -1113,8 +1109,8 @@ int LyXText::numberOfSeparators(Buffer c // ignored. This is *MUCH* more usefull than not to ignore! int LyXText::numberOfHfills(Buffer const * buf, Row const * row) const { - Paragraph::size_type const last = rowLast(row); - Paragraph::size_type first = row->pos(); + pos_type const last = rowLast(row); + pos_type first = row->pos(); if (first) { /* hfill *DO* count at the beginning * of paragraphs! */ while(first <= last && row->par()->isHfill(first)) @@ -1123,7 +1119,7 @@ int LyXText::numberOfHfills(Buffer const first = max(first, beginningOfMainBody(buf, row->par())); int n = 0; - for (Paragraph::size_type p = first; p <= last; ++p) { + for (pos_type p = first; p <= last; ++p) { // last, because the end is ignored! if (row->par()->isHfill(p)) { ++n; @@ -1136,8 +1132,8 @@ int LyXText::numberOfHfills(Buffer const // like NumberOfHfills, but only those in the manual label! int LyXText::numberOfLabelHfills(Buffer const * buf, Row const * row) const { - Paragraph::size_type last = rowLast(row); - Paragraph::size_type first = row->pos(); + pos_type last = rowLast(row); + pos_type first = row->pos(); if (first) { /* hfill *DO* count at the beginning * of paragraphs! */ while(first < last && row->par()->isHfill(first)) @@ -1146,8 +1142,8 @@ int LyXText::numberOfLabelHfills(Buffer last = min(last, beginningOfMainBody(buf, row->par())); int n = 0; - for (Paragraph::size_type p = first; - p < last; ++p) { // last, because the end is ignored! + for (pos_type p = first; p < last; ++p) { + // last, because the end is ignored! if (row->par()->isHfill(p)) { ++n; } @@ -1159,7 +1155,7 @@ int LyXText::numberOfLabelHfills(Buffer // returns true, if a expansion is needed. // Rules are given by LaTeX bool LyXText::hfillExpansion(Buffer const * buf, Row const * row_ptr, - Paragraph::size_type pos) const + pos_type pos) const { // by the way, is it a hfill? if (!row_ptr->par()->isHfill(pos)) @@ -1184,7 +1180,7 @@ bool LyXText::hfillExpansion(Buffer cons // if there is anything between the first char of the row and // the sepcified position that is not a newline and not a hfill, // the hfill will count, otherwise not - Paragraph::size_type i = row_ptr->pos(); + pos_type i = row_ptr->pos(); while (i < pos && (row_ptr->par()->isNewline(i) || row_ptr->par()->isHfill(i))) ++i; @@ -1255,12 +1251,12 @@ void LyXText::setHeightOfRow(BufferView int maxdesc = int(lyxfont::maxDescent(font) * layout.spacing.getValue() * spacing_val); - Paragraph::size_type const pos_end = rowLast(row_ptr); + pos_type const pos_end = rowLast(row_ptr); int labeladdon = 0; int maxwidth = 0; // Check if any insets are larger - for (Paragraph::size_type pos = row_ptr->pos(); pos <= pos_end; ++pos) { + for (pos_type pos = row_ptr->pos(); pos <= pos_end; ++pos) { if (row_ptr->par()->getChar(pos) == Paragraph::META_INSET) { tmpfont = getFont(bview->buffer(), row_ptr->par(), pos); tmpinset = row_ptr->par()->getInset(pos); @@ -1452,7 +1448,7 @@ void LyXText::setHeightOfRow(BufferView maxdesc += 2 * lyxfont::ascent('x', getFont(bview->buffer(), par, - max(Paragraph::size_type(0), par->size() - 1))); + max(pos_type(0), +par->size() - 1))); // and now the pagebreaks if (firstpar->params().pagebreakBottom()) @@ -1530,10 +1526,10 @@ void LyXText::appendParagraph(BufferView // The last character position of a paragraph is an invariant so we can // safely get it here. (Asger) - Paragraph::size_type const lastposition = row->par()->size(); + pos_type const lastposition = row->par()->size(); do { // Get the next breakpoint - Paragraph::size_type z = nextBreakPoint(bview, row, workWidth(bview)); + pos_type z = nextBreakPoint(bview, row, workWidth(bview)); Row * tmprow = row; @@ -1564,7 +1560,7 @@ void LyXText::breakAgain(BufferView * bv do { // get the next breakpoint - Paragraph::size_type z = nextBreakPoint(bview, row, workWidth(bview)); + pos_type z = nextBreakPoint(bview, row, workWidth(bview)); Row * tmprow = row; if (z < row->par()->size()) { @@ -1608,7 +1604,7 @@ void LyXText::breakAgain(BufferView * bv void LyXText::breakAgainOneRow(BufferView * bview, Row * row) { // get the next breakpoint - Paragraph::size_type z = nextBreakPoint(bview, row, workWidth(bview)); + pos_type z = nextBreakPoint(bview, row, workWidth(bview)); Row * tmprow = row; if (z < row->par()->size()) { @@ -1825,7 +1821,7 @@ void LyXText::insertChar(BufferView * bv * current font */ // Get the font that is used to calculate the baselineskip - Paragraph::size_type const lastpos = cursor.par()->size(); + pos_type const lastpos = cursor.par()->size(); LyXFont rawparfont = cursor.par()->getFontSettings(bview->buffer()->params, lastpos - 1); @@ -1895,7 +1891,7 @@ void LyXText::insertChar(BufferView * bv || cursor.par()->isNewline(cursor.pos()) || cursor.row()->fill() == -1) && row->previous() && row->previous()->par() == row->par()) { - Paragraph::size_type z = nextBreakPoint(bview, + pos_type z = nextBreakPoint(bview, row->previous(), workWidth(bview)); if (z >= row->pos()) { @@ -2107,9 +2103,9 @@ void LyXText::prepareToPrint(BufferView computeBidiTables(bview->buffer(), row); if (is_rtl) { - Paragraph::size_type main_body = + pos_type main_body = beginningOfMainBody(bview->buffer(), row->par()); - Paragraph::size_type last = rowLast(row); + pos_type last = rowLast(row); if (main_body > 0 && (main_body-1 > last || @@ -2370,7 +2366,7 @@ string const LyXText::selectNextWordToSp // Finally, we copy the word to a string and return it string str; if (selection.cursor.pos() < cursor.pos()) { - Paragraph::size_type i; + pos_type i; for (i = selection.cursor.pos(); i < cursor.pos(); ++i) { if (!cursor.par()->isInset(i)) str += cursor.par()->getChar(i); @@ -2506,7 +2502,7 @@ void LyXText::changeRegionCase(BufferVie setUndo(bview, Undo::FINISH, from.par(), to.par()->next()); - Paragraph::size_type pos = from.pos(); + pos_type pos = from.pos(); Paragraph * par = from.par(); while (par && (pos != to.pos() || par != to.par())) { @@ -2549,7 +2545,7 @@ void LyXText::transposeChars(BufferView setUndo(&bview, Undo::FINISH, tmppar, tmppar->next()); - Paragraph::size_type tmppos = cursor.pos(); + pos_type tmppos = cursor.pos(); // First decide if it is possible to transpose at all @@ -2614,7 +2610,7 @@ void LyXText::Delete(BufferView * bview) void LyXText::backspace(BufferView * bview) { // Get the font that is used to calculate the baselineskip - Paragraph::size_type lastpos = cursor.par()->size(); + pos_type lastpos = cursor.par()->size(); LyXFont rawparfont = cursor.par()->getFontSettings(bview->buffer()->params, lastpos - 1); @@ -2752,7 +2748,7 @@ void LyXText::backspace(BufferView * bvi Row * row = cursor.row(); int y = cursor.y() - row->baseline(); - Paragraph::size_type z; + pos_type z; /* remember that a space at the end of a row doesnt count * when calculating the fill */ if (cursor.pos() < rowLast(row) || @@ -2935,7 +2931,7 @@ bool LyXText::paintRowBackground(DrawRow Inset * inset = 0; LyXFont font(LyXFont::ALL_SANE); - Paragraph::size_type const last = rowLastPrintable(p.row); + pos_type const last = rowLastPrintable(p.row); if (!p.bv->screen()->forceClear() && last == p.row->pos() && isMetaInset(p.row->par(), p.row->pos())) { @@ -3048,11 +3044,11 @@ void LyXText::paintRowSelection(DrawRowP Buffer const * buffer = p.bv->buffer(); Paragraph * par = row->par(); - Paragraph::size_type main_body = beginningOfMainBody(buffer, par); - Paragraph::size_type const last = rowLastPrintable(row); + pos_type main_body = beginningOfMainBody(buffer, par); + pos_type const last = rowLastPrintable(row); - for (Paragraph::size_type vpos = row->pos(); vpos <= last; ++vpos) { - Paragraph::size_type pos = vis2log(vpos); + for (pos_type vpos = row->pos(); vpos <= last; ++vpos) { + pos_type pos = vis2log(vpos); float const old_tmpx = tmpx; if (main_body > 0 && pos == main_body - 1) { LyXLayout const & layout = textclasslist.Style(buffer->params.textclass, @@ -3396,7 +3392,7 @@ void LyXText::paintLastRow(DrawRowParams LyXFont font(LyXFont::ALL_SANE); int const asc = lyxfont::ascent('x', getFont(buffer, par, - max(Paragraph::size_type(0), par->size() - 1))); + max(pos_type(0), par->size() - 1))); y_bottom -= asc; @@ -3409,7 +3405,7 @@ void LyXText::paintLastRow(DrawRowParams y_bottom -= asc; } - Paragraph::size_type const last = rowLastPrintable(p.row); + pos_type const last = rowLastPrintable(p.row); bool const is_rtl = p.row->par()->isRightToLeftPar(p.bv->buffer()->params); int const endlabel = par->getEndLabel(buffer->params); @@ -3459,8 +3455,8 @@ void LyXText::paintRowText(DrawRowParams Paragraph * par = p.row->par(); Buffer const * buffer = p.bv->buffer(); - Paragraph::size_type const last = rowLastPrintable(p.row); - Paragraph::size_type main_body = + pos_type const last = rowLastPrintable(p.row); + pos_type main_body = beginningOfMainBody(buffer, par); if (main_body > 0 && (main_body - 1 > last || @@ -3471,9 +3467,9 @@ void LyXText::paintRowText(DrawRowParams LyXLayout const & layout = textclasslist.Style(buffer->params.textclass, par->getLayout()); - Paragraph::size_type vpos = p.row->pos(); + pos_type vpos = p.row->pos(); while (vpos <= last) { - Paragraph::size_type pos = vis2log(vpos); + pos_type pos = vis2log(vpos); if (main_body > 0 && pos == main_body - 1) { int const lwidth = lyxfont::width(layout.labelsep, getLabelFont(buffer, par)); @@ -3590,7 +3586,7 @@ int LyXText::defaultHeight() const /* returns the column near the specified x-coordinate of the row * x is set to the real beginning of this column */ -Paragraph::size_type +LyXText::pos_type LyXText::getColumnNearX(BufferView * bview, Row * row, int & x, bool & boundary) const { @@ -3602,16 +3598,15 @@ LyXText::getColumnNearX(BufferView * bvi prepareToPrint(bview, row, tmpx, fill_separator, fill_hfill, fill_label_hfill); - Paragraph::size_type vc = row->pos(); - Paragraph::size_type last = rowLastPrintable(row); - Paragraph::size_type c = 0; + pos_type vc = row->pos(); + pos_type last = rowLastPrintable(row); + pos_type c = 0; LyXLayout const & layout = textclasslist.Style(bview->buffer()->params.textclass, row->par()->getLayout()); bool left_side = false; - Paragraph::size_type - main_body = beginningOfMainBody(bview->buffer(), row->par()); + pos_type main_body = beginningOfMainBody(bview->buffer(), row->par()); float last_tmpx = tmpx; if (main_body > 0 && @@ -3698,8 +3693,7 @@ LyXText::getColumnNearX(BufferView * bvi // returns pointer to a specified row -Row * LyXText::getRow(Paragraph * par, - Paragraph::size_type pos, int & y) const +Row * LyXText::getRow(Paragraph * par, pos_type pos, int & y) const { if (!firstrow) return 0; @@ -3723,4 +3717,26 @@ Row * LyXText::getRow(Paragraph * par, } return tmprow; +} + + +Row * LyXText::getRowNearY(int & y) const +{ + // If possible we should optimize this method. (Lgb) + Row * tmprow = firstrow; + int tmpy = 0; + + while (tmprow->next() && tmpy + tmprow->height() <= y) { + tmpy += tmprow->height(); + tmprow = tmprow->next(); + } + + y = tmpy; // return the real y + return tmprow; +} + + +int LyXText::getDepth() const +{ + return cursor.par()->getDepth(); } Index: text2.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v retrieving revision 1.174 diff -u -p -r1.174 text2.C --- text2.C 2001/11/09 13:44:45 1.174 +++ text2.C 2001/11/20 19:34:43 @@ -38,6 +38,7 @@ #include "font.h" #include "debug.h" #include "lyxrc.h" +#include "lyxrow.h" #include "FloatList.h" #include "language.h" #include "ParagraphParameters.h" @@ -155,7 +156,7 @@ LyXFont const realizeFont(LyXFont const // If position is -1, we get the layout font of the paragraph. // If position is -2, we get the font of the manual label of the paragraph. LyXFont const LyXText::getFont(Buffer const * buf, Paragraph * par, - Paragraph::size_type pos) const + pos_type pos) const { lyx::Assert(pos >= 0); @@ -239,7 +240,7 @@ LyXFont const LyXText::getLabelFont(Buff void LyXText::setCharFont(BufferView * bv, Paragraph * par, - Paragraph::size_type pos, LyXFont const & fnt, + pos_type pos, LyXFont const & fnt, bool toggleall) { Buffer const * buf = bv->buffer(); @@ -301,7 +302,7 @@ void LyXText::setCharFont(BufferView * b void LyXText::setCharFont(Buffer const * buf, Paragraph * par, - Paragraph::size_type pos, LyXFont const & fnt) + pos_type pos, LyXFont const & fnt) { LyXFont font(fnt); @@ -353,7 +354,7 @@ void LyXText::setCharFont(Buffer const * // inserts a new row behind the specified row, increments // the touched counters void LyXText::insertRow(Row * row, Paragraph * par, - Paragraph::size_type pos) const + pos_type pos) const { Row * tmprow = new Row; if (!row) { @@ -487,7 +488,7 @@ void LyXText::makeFontEntriesLayoutSpeci textclasslist.Style(buf->params.textclass, par->getLayout()); LyXFont layoutfont; - for (Paragraph::size_type pos = 0; pos < par->size(); ++pos) { + for (pos_type pos = 0; pos < par->size(); ++pos) { if (pos < beginningOfMainBody(buf, par)) layoutfont = layout.labelfont; else @@ -503,7 +504,7 @@ void LyXText::makeFontEntriesLayoutSpeci Paragraph * LyXText::setLayout(BufferView * bview, LyXCursor & cur, LyXCursor & sstart_cur, LyXCursor & send_cur, - LyXTextClass::size_type layout) + layout_type layout) { Paragraph * endpar = send_cur.par()->next(); Paragraph * undoendpar = endpar; @@ -565,7 +566,7 @@ Paragraph * LyXText::setLayout(BufferVie // set layout over selection and make a total rebreak of those paragraphs -void LyXText::setLayout(BufferView * bview, LyXTextClass::size_type layout) +void LyXText::setLayout(BufferView * bview, layout_type layout) { LyXCursor tmpcursor = cursor; /* store the current cursor */ @@ -1168,7 +1169,7 @@ string LyXText::getStringToIndex(BufferV } -Paragraph::size_type LyXText::beginningOfMainBody(Buffer const * buf, +LyXText::pos_type LyXText::beginningOfMainBody(Buffer const * buf, Paragraph const * par) const { if (textclasslist.Style(buf->params.textclass, @@ -1884,7 +1885,7 @@ void LyXText::replaceSelectionWithString } // Get font setting before we cut - Paragraph::size_type pos = selection.end.pos(); + pos_type pos = selection.end.pos(); LyXFont const font = selection.start.par() ->getFontSettings(bview->buffer()->params, selection.start.pos()); @@ -1906,7 +1907,7 @@ void LyXText::replaceSelectionWithString void LyXText::insertStringAsLines(BufferView * bview, string const & str) { Paragraph * par = cursor.par(); - Paragraph::size_type pos = cursor.pos(); + pos_type pos = cursor.pos(); Paragraph * endpar = cursor.par()->next(); setCursorParUndo(bview); @@ -1982,12 +1983,12 @@ bool LyXText::gotoNextInset(BufferView * void LyXText::checkParagraph(BufferView * bview, Paragraph * par, - Paragraph::size_type pos) + pos_type pos) { LyXCursor tmpcursor; int y = 0; - Paragraph::size_type z; + pos_type z; Row * row = getRow(par, pos, y); // is there a break one row above @@ -2012,7 +2013,7 @@ void LyXText::checkParagraph(BufferView } int const tmpheight = row->height(); - Paragraph::size_type const tmplast = rowLast(row); + pos_type const tmplast = rowLast(row); refresh_y = y; refresh_row = row; @@ -2090,7 +2091,7 @@ bool LyXText::updateInset(BufferView * b void LyXText::setCursor(BufferView * bview, Paragraph * par, - Paragraph::size_type pos, + pos_type pos, bool setfont, bool boundary) const { LyXCursor old_cursor = cursor; @@ -2100,7 +2101,7 @@ void LyXText::setCursor(BufferView * bvi void LyXText::setCursor(BufferView *bview, LyXCursor & cur, Paragraph * par, - Paragraph::size_type pos, bool boundary) const + pos_type pos, bool boundary) const { cur.par(par); cur.pos(pos); @@ -2121,8 +2122,8 @@ void LyXText::setCursor(BufferView *bvie float fill_label_hfill; prepareToPrint(bview, row, x, fill_separator, fill_hfill, fill_label_hfill); - Paragraph::size_type cursor_vpos = 0; - Paragraph::size_type last = rowLastPrintable(row); + pos_type cursor_vpos = 0; + pos_type last = rowLastPrintable(row); if (pos > last + 1) // This shouldn't happen. pos = last + 1; @@ -2144,14 +2145,14 @@ void LyXText::setCursor(BufferView *bvie cursor_vpos = (bidi_level(pos) % 2 == 0) ? log2vis(pos) : log2vis(pos) + 1; - Paragraph::size_type main_body = + pos_type main_body = beginningOfMainBody(bview->buffer(), row->par()); if ((main_body > 0) && ((main_body-1 > last) || !row->par()->isLineSeparator(main_body-1))) main_body = 0; - for (Paragraph::size_type vpos = row->pos(); + for (pos_type vpos = row->pos(); vpos < cursor_vpos; ++vpos) { pos = vis2log(vpos); if (main_body > 0 && pos == main_body - 1) { @@ -2179,13 +2180,13 @@ void LyXText::setCursor(BufferView *bvie } cur.x(int(x)); - cur.x_fix(cur.x()); + cur.x_fix(cur.x()); cur.row(row); } void LyXText::setCursorIntern(BufferView * bview, Paragraph * par, - Paragraph::size_type pos, + pos_type pos, bool setfont, bool boundary) const { InsetText * it = static_cast<InsetText *>(par->inInset()); @@ -2219,7 +2220,7 @@ void LyXText::setCursorIntern(BufferView void LyXText::setCurrentFont(BufferView * bview) const { - Paragraph::size_type pos = cursor.pos(); + pos_type pos = cursor.pos(); if (cursor.boundary() && pos > 0) --pos; @@ -2271,9 +2272,7 @@ void LyXText::setCursorFromCoordinates(B Row * row = getRowNearY(y); bool bound = false; - Paragraph::size_type const column = getColumnNearX(bview, row, x, - bound); - + pos_type const column = getColumnNearX(bview, row, x, bound); cur.par(row->par()); cur.pos(row->pos() + column); cur.x(x); Index: vspace.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/vspace.C,v retrieving revision 1.41 diff -u -p -r1.41 vspace.C --- vspace.C 2001/10/15 16:05:08 1.41 +++ vspace.C 2001/11/20 19:34:43 @@ -204,7 +204,7 @@ bool isValidGlueLength (string const & d // To make isValidGlueLength recognize negative values as // the first number this little hack is needed: - short val_sign = 1; // positive as default + int val_sign = 1; // positive as default switch (buffer[0]) { case '-': lyx_advance(buffer, 1); @@ -270,7 +270,7 @@ bool isValidLength(string const & data, // To make isValidLength recognize negative values // this little hack is needed: - short val_sign = 1; // positive as default + int val_sign = 1; // positive as default switch (buffer[0]) { case '-': lyx_advance(buffer, 1);