mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-31 07:45:44 +00:00
par->pit renaming
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9300 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0d8fade81b
commit
ed064bdee6
@ -293,7 +293,7 @@ void BufferView::gotoLabel(string const & label)
|
|||||||
it->getLabelList(*buffer(), labels);
|
it->getLabelList(*buffer(), labels);
|
||||||
if (find(labels.begin(),labels.end(),label) != labels.end()) {
|
if (find(labels.begin(),labels.end(),label) != labels.end()) {
|
||||||
cursor().clearSelection();
|
cursor().clearSelection();
|
||||||
text()->setCursor(cursor(), it.par(), it.pos());
|
text()->setCursor(cursor(), it.pit(), it.pos());
|
||||||
cursor().resetAnchor();
|
cursor().resetAnchor();
|
||||||
update();
|
update();
|
||||||
return;
|
return;
|
||||||
@ -342,7 +342,7 @@ void BufferView::setCursor(ParIterator const & par, lyx::pos_type pos)
|
|||||||
|
|
||||||
cursor().setCursor(makeDocIterator(par, pos));
|
cursor().setCursor(makeDocIterator(par, pos));
|
||||||
cursor().selection() = false;
|
cursor().selection() = false;
|
||||||
par.bottom().text()->redoParagraph(par.bottom().par());
|
par.bottom().text()->redoParagraph(par.bottom().pit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ bool BufferView::Pimpl::fitCursor()
|
|||||||
{
|
{
|
||||||
// to get the correct y cursor info
|
// to get the correct y cursor info
|
||||||
lyxerr[Debug::DEBUG] << "BufferView::fitCursor" << std::endl;
|
lyxerr[Debug::DEBUG] << "BufferView::fitCursor" << std::endl;
|
||||||
lyx::par_type const pit = bv_->cursor().bottom().par();
|
lyx::pit_type const pit = bv_->cursor().bottom().pit();
|
||||||
bv_->text()->redoParagraph(pit);
|
bv_->text()->redoParagraph(pit);
|
||||||
refreshPar(*bv_, *bv_->text(), pit);
|
refreshPar(*bv_, *bv_->text(), pit);
|
||||||
|
|
||||||
@ -602,7 +602,7 @@ void BufferView::Pimpl::update()
|
|||||||
buffer_->buildMacros();
|
buffer_->buildMacros();
|
||||||
|
|
||||||
// update all 'visible' paragraphs
|
// update all 'visible' paragraphs
|
||||||
lyx::par_type beg, end;
|
lyx::pit_type beg, end;
|
||||||
getParsInRange(buffer_->paragraphs(),
|
getParsInRange(buffer_->paragraphs(),
|
||||||
top_y(), top_y() + workarea().workHeight(),
|
top_y(), top_y() + workarea().workHeight(),
|
||||||
beg, end);
|
beg, end);
|
||||||
@ -657,7 +657,7 @@ Change const BufferView::Pimpl::getCurrentChange()
|
|||||||
if (!cur.selection())
|
if (!cur.selection())
|
||||||
return Change(Change::UNCHANGED);
|
return Change(Change::UNCHANGED);
|
||||||
|
|
||||||
return text->getPar(cur.selBegin().par()).
|
return text->getPar(cur.selBegin().pit()).
|
||||||
lookupChangeFull(cur.selBegin().pos());
|
lookupChangeFull(cur.selBegin().pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -811,7 +811,7 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filenm)
|
|||||||
BOOST_ASSERT(bv_->cursor().inTexted());
|
BOOST_ASSERT(bv_->cursor().inTexted());
|
||||||
|
|
||||||
string const fname = MakeAbsPath(filename);
|
string const fname = MakeAbsPath(filename);
|
||||||
bool const res = bv_->buffer()->readFile(fname, bv_->cursor().par());
|
bool const res = bv_->buffer()->readFile(fname, bv_->cursor().pit());
|
||||||
bv_->resize();
|
bv_->resize();
|
||||||
|
|
||||||
string s = res ? _("Document %1$s inserted.")
|
string s = res ? _("Document %1$s inserted.")
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
|
||||||
using lyx::pos_type;
|
using lyx::pos_type;
|
||||||
using lyx::par_type;
|
using lyx::pit_type;
|
||||||
using lyx::textclass_type;
|
using lyx::textclass_type;
|
||||||
|
|
||||||
using lyx::support::bformat;
|
using lyx::support::bformat;
|
||||||
@ -60,7 +60,7 @@ using std::string;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
typedef std::pair<lyx::par_type, int> PitPosPair;
|
typedef std::pair<lyx::pit_type, int> PitPosPair;
|
||||||
|
|
||||||
typedef limited_stack<pair<ParagraphList, textclass_type> > CutStack;
|
typedef limited_stack<pair<ParagraphList, textclass_type> > CutStack;
|
||||||
|
|
||||||
@ -96,9 +96,9 @@ bool checkPastePossible(int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pair<PitPosPair, par_type>
|
pair<PitPosPair, pit_type>
|
||||||
pasteSelectionHelper(Buffer const & buffer, ParagraphList & pars,
|
pasteSelectionHelper(Buffer const & buffer, ParagraphList & pars,
|
||||||
par_type pit, int pos,
|
pit_type pit, int pos,
|
||||||
textclass_type tc, size_t cut_index, ErrorList & errorlist)
|
textclass_type tc, size_t cut_index, ErrorList & errorlist)
|
||||||
{
|
{
|
||||||
if (!checkPastePossible(cut_index))
|
if (!checkPastePossible(cut_index))
|
||||||
@ -183,7 +183,7 @@ pasteSelectionHelper(Buffer const & buffer, ParagraphList & pars,
|
|||||||
|
|
||||||
// Split the paragraph for inserting the buf if necessary.
|
// Split the paragraph for inserting the buf if necessary.
|
||||||
bool did_split = false;
|
bool did_split = false;
|
||||||
if (pars[pit].size() || pit + 1 == par_type(pars.size())) {
|
if (pars[pit].size() || pit + 1 == pit_type(pars.size())) {
|
||||||
breakParagraphConservative(buffer.params(), pars, pit, pos);
|
breakParagraphConservative(buffer.params(), pars, pit, pos);
|
||||||
did_split = true;
|
did_split = true;
|
||||||
}
|
}
|
||||||
@ -192,14 +192,14 @@ pasteSelectionHelper(Buffer const & buffer, ParagraphList & pars,
|
|||||||
pars.insert(pars.begin() + pit + 1, insertion.begin(), insertion.end());
|
pars.insert(pars.begin() + pit + 1, insertion.begin(), insertion.end());
|
||||||
mergeParagraph(buffer.params(), pars, pit);
|
mergeParagraph(buffer.params(), pars, pit);
|
||||||
|
|
||||||
par_type last_paste = pit + insertion.size() - 1;
|
pit_type last_paste = pit + insertion.size() - 1;
|
||||||
|
|
||||||
// Store the new cursor position.
|
// Store the new cursor position.
|
||||||
pit = last_paste;
|
pit = last_paste;
|
||||||
pos = pars[last_paste].size();
|
pos = pars[last_paste].size();
|
||||||
|
|
||||||
// Maybe some pasting.
|
// Maybe some pasting.
|
||||||
if (did_split && last_paste + 1 != par_type(pars.size())) {
|
if (did_split && last_paste + 1 != pit_type(pars.size())) {
|
||||||
if (pars[last_paste + 1].hasSameLayout(pars[last_paste])) {
|
if (pars[last_paste + 1].hasSameLayout(pars[last_paste])) {
|
||||||
mergeParagraph(buffer.params(), pars, last_paste);
|
mergeParagraph(buffer.params(), pars, last_paste);
|
||||||
} else if (pars[last_paste + 1].empty()) {
|
} else if (pars[last_paste + 1].empty()) {
|
||||||
@ -220,14 +220,14 @@ pasteSelectionHelper(Buffer const & buffer, ParagraphList & pars,
|
|||||||
|
|
||||||
PitPosPair eraseSelectionHelper(BufferParams const & params,
|
PitPosPair eraseSelectionHelper(BufferParams const & params,
|
||||||
ParagraphList & pars,
|
ParagraphList & pars,
|
||||||
par_type startpit, par_type endpit,
|
pit_type startpit, pit_type endpit,
|
||||||
int startpos, int endpos, bool doclear)
|
int startpos, int endpos, bool doclear)
|
||||||
{
|
{
|
||||||
if (startpit == par_type(pars.size()) ||
|
if (startpit == pit_type(pars.size()) ||
|
||||||
(startpos > pars[startpit].size()))
|
(startpos > pars[startpit].size()))
|
||||||
return PitPosPair(endpit, endpos);
|
return PitPosPair(endpit, endpos);
|
||||||
|
|
||||||
if (endpit == par_type(pars.size()) ||
|
if (endpit == pit_type(pars.size()) ||
|
||||||
startpit == endpit) {
|
startpit == endpit) {
|
||||||
endpos -= pars[startpit].erase(startpos, endpos);
|
endpos -= pars[startpit].erase(startpos, endpos);
|
||||||
return PitPosPair(endpit, endpos);
|
return PitPosPair(endpit, endpos);
|
||||||
@ -245,7 +245,7 @@ PitPosPair eraseSelectionHelper(BufferParams const & params,
|
|||||||
all_erased = false;
|
all_erased = false;
|
||||||
|
|
||||||
// Loop through the deleted pars if any, erasing as needed
|
// Loop through the deleted pars if any, erasing as needed
|
||||||
for (par_type pit = startpit + 1; pit != endpit;) {
|
for (pit_type pit = startpit + 1; pit != endpit;) {
|
||||||
// "erase" the contents of the par
|
// "erase" the contents of the par
|
||||||
pars[pit].erase(0, pars[pit].size());
|
pars[pit].erase(0, pars[pit].size());
|
||||||
if (!pars[pit].size()) {
|
if (!pars[pit].size()) {
|
||||||
@ -267,7 +267,7 @@ PitPosPair eraseSelectionHelper(BufferParams const & params,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (startpit + 1 == par_type(pars.size()))
|
if (startpit + 1 == pit_type(pars.size()))
|
||||||
return PitPosPair(endpit, endpos);
|
return PitPosPair(endpit, endpos);
|
||||||
|
|
||||||
if (doclear) {
|
if (doclear) {
|
||||||
@ -290,7 +290,7 @@ PitPosPair eraseSelectionHelper(BufferParams const & params,
|
|||||||
|
|
||||||
|
|
||||||
void copySelectionHelper(ParagraphList & pars,
|
void copySelectionHelper(ParagraphList & pars,
|
||||||
par_type startpit, par_type endpit,
|
pit_type startpit, pit_type endpit,
|
||||||
int start, int end, textclass_type tc)
|
int start, int end, textclass_type tc)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(0 <= start && start <= pars[startpit].size());
|
BOOST_ASSERT(0 <= start && start <= pars[startpit].size());
|
||||||
@ -315,7 +315,7 @@ void copySelectionHelper(ParagraphList & pars,
|
|||||||
|
|
||||||
|
|
||||||
PitPosPair cutSelectionHelper(BufferParams const & params,
|
PitPosPair cutSelectionHelper(BufferParams const & params,
|
||||||
ParagraphList & pars, par_type startpit, par_type endpit,
|
ParagraphList & pars, pit_type startpit, pit_type endpit,
|
||||||
int startpos, int endpos, textclass_type tc, bool doclear)
|
int startpos, int endpos, textclass_type tc, bool doclear)
|
||||||
{
|
{
|
||||||
copySelectionHelper(pars, startpit, endpit, startpos, endpos, tc);
|
copySelectionHelper(pars, startpit, endpit, startpos, endpos, tc);
|
||||||
@ -442,8 +442,8 @@ void cutSelection(LCursor & cur, bool doclear, bool realcut)
|
|||||||
|
|
||||||
// make sure that the depth behind the selection are restored, too
|
// make sure that the depth behind the selection are restored, too
|
||||||
recordUndoSelection(cur);
|
recordUndoSelection(cur);
|
||||||
par_type begpit = cur.selBegin().par();
|
pit_type begpit = cur.selBegin().pit();
|
||||||
par_type endpit = cur.selEnd().par();
|
pit_type endpit = cur.selEnd().pit();
|
||||||
|
|
||||||
int endpos = cur.selEnd().pos();
|
int endpos = cur.selEnd().pos();
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ void cutSelection(LCursor & cur, bool doclear, bool realcut)
|
|||||||
// it anew. (Lgb)
|
// it anew. (Lgb)
|
||||||
// we prefer the end for when tracking changes
|
// we prefer the end for when tracking changes
|
||||||
cur.pos() = endpos;
|
cur.pos() = endpos;
|
||||||
cur.par() = endpit;
|
cur.pit() = endpit;
|
||||||
|
|
||||||
// need a valid cursor. (Lgb)
|
// need a valid cursor. (Lgb)
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
@ -506,13 +506,13 @@ void copySelection(LCursor & cur)
|
|||||||
// copy behind a space if there is one
|
// copy behind a space if there is one
|
||||||
ParagraphList & pars = text->paragraphs();
|
ParagraphList & pars = text->paragraphs();
|
||||||
pos_type pos = cur.selBegin().pos();
|
pos_type pos = cur.selBegin().pos();
|
||||||
par_type par = cur.selBegin().par();
|
pit_type par = cur.selBegin().pit();
|
||||||
while (pos < pars[par].size()
|
while (pos < pars[par].size()
|
||||||
&& pars[par].isLineSeparator(pos)
|
&& pars[par].isLineSeparator(pos)
|
||||||
&& (par != cur.selEnd().par() || pos < cur.selEnd().pos()))
|
&& (par != cur.selEnd().pit() || pos < cur.selEnd().pos()))
|
||||||
++pos;
|
++pos;
|
||||||
|
|
||||||
copySelectionHelper(pars, par, cur.selEnd().par(),
|
copySelectionHelper(pars, par, cur.selEnd().pit(),
|
||||||
pos, cur.selEnd().pos(), cur.buffer().params().textclass);
|
pos, cur.selEnd().pos(), cur.buffer().params().textclass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,7 +550,7 @@ void pasteSelection(LCursor & cur, size_t sel_index)
|
|||||||
|
|
||||||
recordUndo(cur);
|
recordUndo(cur);
|
||||||
|
|
||||||
par_type endpit;
|
pit_type endpit;
|
||||||
PitPosPair ppp;
|
PitPosPair ppp;
|
||||||
|
|
||||||
ErrorList el;
|
ErrorList el;
|
||||||
@ -558,13 +558,13 @@ void pasteSelection(LCursor & cur, size_t sel_index)
|
|||||||
boost::tie(ppp, endpit) =
|
boost::tie(ppp, endpit) =
|
||||||
pasteSelectionHelper(cur.buffer(),
|
pasteSelectionHelper(cur.buffer(),
|
||||||
text->paragraphs(),
|
text->paragraphs(),
|
||||||
cur.par(), cur.pos(),
|
cur.pit(), cur.pos(),
|
||||||
cur.buffer().params().textclass,
|
cur.buffer().params().textclass,
|
||||||
sel_index, el);
|
sel_index, el);
|
||||||
bufferErrors(cur.buffer(), el);
|
bufferErrors(cur.buffer(), el);
|
||||||
cur.bv().showErrorList(_("Paste"));
|
cur.bv().showErrorList(_("Paste"));
|
||||||
|
|
||||||
text->redoParagraphs(cur.par(), endpit);
|
text->redoParagraphs(cur.pit(), endpit);
|
||||||
|
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
cur.resetAnchor();
|
cur.resetAnchor();
|
||||||
@ -601,7 +601,7 @@ void replaceSelectionWithString(LCursor & cur, string const & str)
|
|||||||
|
|
||||||
// Get font setting before we cut
|
// Get font setting before we cut
|
||||||
pos_type pos = cur.selEnd().pos();
|
pos_type pos = cur.selEnd().pos();
|
||||||
Paragraph & par = text->getPar(cur.selEnd().par());
|
Paragraph & par = text->getPar(cur.selEnd().pit());
|
||||||
LyXFont const font =
|
LyXFont const font =
|
||||||
par.getFontSettings(cur.buffer().params(), cur.selBegin().pos());
|
par.getFontSettings(cur.buffer().params(), cur.selBegin().pos());
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "paragraph.h"
|
#include "paragraph.h"
|
||||||
|
|
||||||
|
|
||||||
FontIterator::FontIterator(LyXText const & text, lyx::par_type pit,
|
FontIterator::FontIterator(LyXText const & text, lyx::pit_type pit,
|
||||||
lyx::pos_type pos)
|
lyx::pos_type pos)
|
||||||
: text_(text), pit_(pit), pos_(pos),
|
: text_(text), pit_(pit), pos_(pos),
|
||||||
font_(text.getFont(text.getPar(pit), pos)),
|
font_(text.getFont(text.getPar(pit), pos)),
|
||||||
|
@ -31,7 +31,7 @@ class FontIterator : std::iterator<std::forward_iterator_tag, LyXFont>
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
FontIterator(LyXText const & text, lyx::par_type pit, lyx::pos_type pos);
|
FontIterator(LyXText const & text, lyx::pit_type pit, lyx::pos_type pos);
|
||||||
///
|
///
|
||||||
LyXFont operator*() const;
|
LyXFont operator*() const;
|
||||||
///
|
///
|
||||||
@ -43,7 +43,7 @@ private:
|
|||||||
///
|
///
|
||||||
LyXText const & text_;
|
LyXText const & text_;
|
||||||
///
|
///
|
||||||
lyx::par_type pit_;
|
lyx::pit_type pit_;
|
||||||
///
|
///
|
||||||
lyx::pos_type pos_;
|
lyx::pos_type pos_;
|
||||||
///
|
///
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
|
|
||||||
|
|
||||||
using lyx::pos_type;
|
using lyx::pos_type;
|
||||||
using lyx::par_type;
|
using lyx::pit_type;
|
||||||
|
|
||||||
using lyx::support::AddName;
|
using lyx::support::AddName;
|
||||||
using lyx::support::bformat;
|
using lyx::support::bformat;
|
||||||
@ -473,7 +473,7 @@ bool Buffer::readDocument(LyXLex & lex)
|
|||||||
|
|
||||||
// needed to insert the selection
|
// needed to insert the selection
|
||||||
void Buffer::insertStringAsLines(ParagraphList & pars,
|
void Buffer::insertStringAsLines(ParagraphList & pars,
|
||||||
par_type & par, pos_type & pos,
|
pit_type & par, pos_type & pos,
|
||||||
LyXFont const & fn, string const & str)
|
LyXFont const & fn, string const & str)
|
||||||
{
|
{
|
||||||
LyXLayout_ptr const & layout = pars[par].layout();
|
LyXLayout_ptr const & layout = pars[par].layout();
|
||||||
@ -549,7 +549,7 @@ bool Buffer::readFile(string const & filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Buffer::readFile(string const & filename, par_type pit)
|
bool Buffer::readFile(string const & filename, pit_type pit)
|
||||||
{
|
{
|
||||||
LyXLex lex(0, 0);
|
LyXLex lex(0, 0);
|
||||||
lex.setFile(filename);
|
lex.setFile(filename);
|
||||||
@ -569,7 +569,7 @@ void Buffer::fully_loaded(bool value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Buffer::readFile(LyXLex & lex, string const & filename, par_type pit)
|
bool Buffer::readFile(LyXLex & lex, string const & filename, pit_type pit)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(!filename.empty());
|
BOOST_ASSERT(!filename.empty());
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public:
|
|||||||
/// load a new file
|
/// load a new file
|
||||||
bool readFile(std::string const & filename);
|
bool readFile(std::string const & filename);
|
||||||
|
|
||||||
bool readFile(std::string const & filename, lyx::par_type pit);
|
bool readFile(std::string const & filename, lyx::pit_type pit);
|
||||||
|
|
||||||
/// read the header, returns number of unknown tokens
|
/// read the header, returns number of unknown tokens
|
||||||
int readHeader(LyXLex & lex);
|
int readHeader(LyXLex & lex);
|
||||||
@ -98,7 +98,7 @@ public:
|
|||||||
|
|
||||||
///
|
///
|
||||||
void insertStringAsLines(ParagraphList & plist,
|
void insertStringAsLines(ParagraphList & plist,
|
||||||
lyx::par_type &, lyx::pos_type &,
|
lyx::pit_type &, lyx::pos_type &,
|
||||||
LyXFont const &, std::string const &);
|
LyXFont const &, std::string const &);
|
||||||
///
|
///
|
||||||
ParIterator getParFromID(int id) const;
|
ParIterator getParFromID(int id) const;
|
||||||
@ -325,7 +325,7 @@ private:
|
|||||||
\return \c false if method fails.
|
\return \c false if method fails.
|
||||||
*/
|
*/
|
||||||
bool readFile(LyXLex &, std::string const & filename,
|
bool readFile(LyXLex &, std::string const & filename,
|
||||||
lyx::par_type pit);
|
lyx::pit_type pit);
|
||||||
|
|
||||||
bool do_writeFile(std::ostream & ofs) const;
|
bool do_writeFile(std::ostream & ofs) const;
|
||||||
|
|
||||||
|
28
src/cursor.C
28
src/cursor.C
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
using lyx::par_type;
|
using lyx::pit_type;
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
@ -116,7 +116,7 @@ namespace {
|
|||||||
int x, int y, int xlow, int xhigh, int ylow, int yhigh)
|
int x, int y, int xlow, int xhigh, int ylow, int yhigh)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(!cursor.empty());
|
BOOST_ASSERT(!cursor.empty());
|
||||||
par_type beg, end;
|
pit_type beg, end;
|
||||||
CursorSlice bottom = cursor[0];
|
CursorSlice bottom = cursor[0];
|
||||||
LyXText * text = bottom.text();
|
LyXText * text = bottom.text();
|
||||||
BOOST_ASSERT(text);
|
BOOST_ASSERT(text);
|
||||||
@ -128,8 +128,8 @@ namespace {
|
|||||||
//lyxerr << "xlow: " << xlow << " ylow: " << ylow << endl;
|
//lyxerr << "xlow: " << xlow << " ylow: " << ylow << endl;
|
||||||
//lyxerr << "xhigh: " << xhigh << " yhigh: " << yhigh << endl;
|
//lyxerr << "xhigh: " << xhigh << " yhigh: " << yhigh << endl;
|
||||||
|
|
||||||
it.par() = beg;
|
it.pit() = beg;
|
||||||
//et.par() = text->parOffset(end);
|
//et.pit() = text->parOffset(end);
|
||||||
|
|
||||||
double best_dist = 10e10;
|
double best_dist = 10e10;
|
||||||
DocIterator best_cursor = it;
|
DocIterator best_cursor = it;
|
||||||
@ -202,7 +202,7 @@ void LCursor::dispatch(FuncRequest const & cmd0)
|
|||||||
lyxerr[Debug::DEBUG] << "LCursor::dispatch: cmd: " << cmd0 << endl << *this << endl;
|
lyxerr[Debug::DEBUG] << "LCursor::dispatch: cmd: " << cmd0 << endl << *this << endl;
|
||||||
BOOST_ASSERT(pos() <= lastpos());
|
BOOST_ASSERT(pos() <= lastpos());
|
||||||
BOOST_ASSERT(idx() <= lastidx());
|
BOOST_ASSERT(idx() <= lastidx());
|
||||||
BOOST_ASSERT(par() <= lastpar());
|
BOOST_ASSERT(pit() <= lastpit());
|
||||||
|
|
||||||
// The common case is 'LFUN handled, need update', so make the
|
// The common case is 'LFUN handled, need update', so make the
|
||||||
// LFUN handler's life easier by assuming this as default value.
|
// LFUN handler's life easier by assuming this as default value.
|
||||||
@ -243,10 +243,10 @@ bool LCursor::getStatus(FuncRequest const & cmd, FuncStatus & status)
|
|||||||
<< ". Trying to correct this." << endl;
|
<< ". Trying to correct this." << endl;
|
||||||
idx() = lastidx();
|
idx() = lastidx();
|
||||||
}
|
}
|
||||||
if (par() > lastpar()) {
|
if (pit() > lastpit()) {
|
||||||
lyxerr << "wrong par " << par() << ", max is " << lastpar()
|
lyxerr << "wrong par " << pit() << ", max is " << lastpit()
|
||||||
<< ". Trying to correct this." << endl;
|
<< ". Trying to correct this." << endl;
|
||||||
par() = lastpar();
|
pit() = lastpit();
|
||||||
}
|
}
|
||||||
if (pos() > lastpos()) {
|
if (pos() > lastpos()) {
|
||||||
lyxerr << "wrong pos " << pos() << ", max is " << lastpos()
|
lyxerr << "wrong pos " << pos() << ", max is " << lastpos()
|
||||||
@ -452,7 +452,7 @@ void LCursor::setSelection()
|
|||||||
#ifdef WITH_WARNINGS
|
#ifdef WITH_WARNINGS
|
||||||
#warning doesnt look ok
|
#warning doesnt look ok
|
||||||
#endif
|
#endif
|
||||||
if (par() == anchor().par() && pos() == anchor().pos())
|
if (pit() == anchor().pit() && pos() == anchor().pos())
|
||||||
selection() = false;
|
selection() = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1070,8 +1070,8 @@ string LCursor::selectionAsString(bool label) const
|
|||||||
ParagraphList & pars = text()->paragraphs();
|
ParagraphList & pars = text()->paragraphs();
|
||||||
|
|
||||||
// should be const ...
|
// should be const ...
|
||||||
par_type startpit = selBegin().par();
|
pit_type startpit = selBegin().pit();
|
||||||
par_type endpit = selEnd().par();
|
pit_type endpit = selEnd().pit();
|
||||||
size_t const startpos = selBegin().pos();
|
size_t const startpos = selBegin().pos();
|
||||||
size_t const endpos = selEnd().pos();
|
size_t const endpos = selEnd().pos();
|
||||||
|
|
||||||
@ -1083,7 +1083,7 @@ string LCursor::selectionAsString(bool label) const
|
|||||||
asString(buffer, startpos, pars[startpit].size(), label) + "\n\n";
|
asString(buffer, startpos, pars[startpit].size(), label) + "\n\n";
|
||||||
|
|
||||||
// The paragraphs in between (if any)
|
// The paragraphs in between (if any)
|
||||||
for (par_type pit = startpit + 1; pit != endpit; ++pit) {
|
for (pit_type pit = startpit + 1; pit != endpit; ++pit) {
|
||||||
Paragraph & par = pars[pit];
|
Paragraph & par = pars[pit];
|
||||||
result += par.asString(buffer, 0, par.size(), label) + "\n\n";
|
result += par.asString(buffer, 0, par.size(), label) + "\n\n";
|
||||||
}
|
}
|
||||||
@ -1136,8 +1136,8 @@ Encoding const * LCursor::getEncoding() const
|
|||||||
break;
|
break;
|
||||||
CursorSlice const & sl = operator[](s);
|
CursorSlice const & sl = operator[](s);
|
||||||
LyXText & text = *sl.text();
|
LyXText & text = *sl.text();
|
||||||
LyXFont font = text.getPar(sl.par()).getFont(
|
LyXFont font = text.getPar(sl.pit()).getFont(
|
||||||
bv().buffer()->params(), sl.pos(), outerFont(sl.par(), text.paragraphs()));
|
bv().buffer()->params(), sl.pos(), outerFont(sl.pit(), text.paragraphs()));
|
||||||
return font.language()->encoding();
|
return font.language()->encoding();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,12 +30,12 @@ using std::endl;
|
|||||||
|
|
||||||
|
|
||||||
CursorSlice::CursorSlice()
|
CursorSlice::CursorSlice()
|
||||||
: inset_(0), idx_(0), par_(0), pos_(0), boundary_(false)
|
: inset_(0), idx_(0), pit_(0), pos_(0), boundary_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
CursorSlice::CursorSlice(InsetBase & p)
|
CursorSlice::CursorSlice(InsetBase & p)
|
||||||
: inset_(&p), idx_(0), par_(0), pos_(0), boundary_(false)
|
: inset_(&p), idx_(0), pit_(0), pos_(0), boundary_(false)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(inset_);
|
BOOST_ASSERT(inset_);
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ Paragraph & CursorSlice::paragraph()
|
|||||||
{
|
{
|
||||||
// access to the main lyx text must be handled in the cursor
|
// access to the main lyx text must be handled in the cursor
|
||||||
BOOST_ASSERT(text());
|
BOOST_ASSERT(text());
|
||||||
return text()->getPar(par_);
|
return text()->getPar(pit_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ Paragraph const & CursorSlice::paragraph() const
|
|||||||
{
|
{
|
||||||
// access to the main lyx text must be handled in the cursor
|
// access to the main lyx text must be handled in the cursor
|
||||||
BOOST_ASSERT(text());
|
BOOST_ASSERT(text());
|
||||||
return text()->getPar(par_);
|
return text()->getPar(pit_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ bool operator==(CursorSlice const & p, CursorSlice const & q)
|
|||||||
{
|
{
|
||||||
return &p.inset() == &q.inset()
|
return &p.inset() == &q.inset()
|
||||||
&& p.idx() == q.idx()
|
&& p.idx() == q.idx()
|
||||||
&& p.par() == q.par()
|
&& p.pit() == q.pit()
|
||||||
&& p.pos() == q.pos();
|
&& p.pos() == q.pos();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ bool operator!=(CursorSlice const & p, CursorSlice const & q)
|
|||||||
{
|
{
|
||||||
return &p.inset() != &q.inset()
|
return &p.inset() != &q.inset()
|
||||||
|| p.idx() != q.idx()
|
|| p.idx() != q.idx()
|
||||||
|| p.par() != q.par()
|
|| p.pit() != q.pit()
|
||||||
|| p.pos() != q.pos();
|
|| p.pos() != q.pos();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,8 +154,8 @@ bool operator<(CursorSlice const & p, CursorSlice const & q)
|
|||||||
}
|
}
|
||||||
if (p.idx() != q.idx())
|
if (p.idx() != q.idx())
|
||||||
return p.idx() < q.idx();
|
return p.idx() < q.idx();
|
||||||
if (p.par() != q.par())
|
if (p.pit() != q.pit())
|
||||||
return p.par() < q.par();
|
return p.pit() < q.pit();
|
||||||
return p.pos() < q.pos();
|
return p.pos() < q.pos();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ std::ostream & operator<<(std::ostream & os, CursorSlice const & item)
|
|||||||
<< "inset: " << &item.inset()
|
<< "inset: " << &item.inset()
|
||||||
// << " text: " << item.text()
|
// << " text: " << item.text()
|
||||||
<< " idx: " << item.idx()
|
<< " idx: " << item.idx()
|
||||||
<< " par: " << item.par()
|
<< " par: " << item.pit()
|
||||||
<< " pos: " << item.pos()
|
<< " pos: " << item.pos()
|
||||||
// << " x: " << item.inset().x()
|
// << " x: " << item.inset().x()
|
||||||
// << " y: " << item.inset().y()
|
// << " y: " << item.inset().y()
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
/// type for cell number in inset
|
/// type for cell number in inset
|
||||||
typedef size_t idx_type;
|
typedef size_t idx_type;
|
||||||
/// type for paragraph numbers positions within a cell
|
/// type for paragraph numbers positions within a cell
|
||||||
typedef lyx::par_type par_type;
|
typedef lyx::pit_type pit_type;
|
||||||
/// type for cursor positions within a cell
|
/// type for cursor positions within a cell
|
||||||
typedef lyx::pos_type pos_type;
|
typedef lyx::pos_type pos_type;
|
||||||
/// type for row indices
|
/// type for row indices
|
||||||
@ -65,9 +65,9 @@ public:
|
|||||||
/// return the last cell in this inset
|
/// return the last cell in this inset
|
||||||
idx_type lastidx() const { return nargs() - 1; }
|
idx_type lastidx() const { return nargs() - 1; }
|
||||||
/// return the paragraph this cursor is in
|
/// return the paragraph this cursor is in
|
||||||
par_type par() const { return par_; }
|
pit_type pit() const { return pit_; }
|
||||||
/// set the paragraph this cursor is in
|
/// set the paragraph this cursor is in
|
||||||
par_type & par() { return par_; }
|
pit_type & pit() { return pit_; }
|
||||||
/// increments the paragraph this cursor is in
|
/// increments the paragraph this cursor is in
|
||||||
void incrementPar();
|
void incrementPar();
|
||||||
/// increments the paragraph this cursor is in
|
/// increments the paragraph this cursor is in
|
||||||
@ -122,7 +122,7 @@ private:
|
|||||||
/// cell index of a position in this inset
|
/// cell index of a position in this inset
|
||||||
idx_type idx_;
|
idx_type idx_;
|
||||||
/// paragraph in this cell (used by texted)
|
/// paragraph in this cell (used by texted)
|
||||||
par_type par_;
|
pit_type pit_;
|
||||||
/// true of 'pit' was properly initialized
|
/// true of 'pit' was properly initialized
|
||||||
bool pit_valid_;
|
bool pit_valid_;
|
||||||
/// position in this cell
|
/// position in this cell
|
||||||
|
@ -156,7 +156,7 @@ Row const & DocIterator::textRow() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DocIterator::par_type DocIterator::lastpar() const
|
DocIterator::pit_type DocIterator::lastpit() const
|
||||||
{
|
{
|
||||||
return inMathed() ? 0 : text()->paragraphs().size() - 1;
|
return inMathed() ? 0 : text()->paragraphs().size() - 1;
|
||||||
}
|
}
|
||||||
@ -308,9 +308,9 @@ void DocIterator::forwardPos()
|
|||||||
//lyxerr << "... no next pos" << endl;
|
//lyxerr << "... no next pos" << endl;
|
||||||
|
|
||||||
// otherwise move on one paragraph if possible
|
// otherwise move on one paragraph if possible
|
||||||
if (top.par() < lastpar()) {
|
if (top.pit() < lastpit()) {
|
||||||
//lyxerr << "... next par" << endl;
|
//lyxerr << "... next par" << endl;
|
||||||
++top.par();
|
++top.pit();
|
||||||
top.pos() = 0;
|
top.pos() = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -320,7 +320,7 @@ void DocIterator::forwardPos()
|
|||||||
if (top.idx() < lastidx()) {
|
if (top.idx() < lastidx()) {
|
||||||
//lyxerr << "... next idx" << endl;
|
//lyxerr << "... next idx" << endl;
|
||||||
++top.idx();
|
++top.idx();
|
||||||
top.par() = 0;
|
top.pit() = 0;
|
||||||
top.pos() = 0;
|
top.pos() = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -372,7 +372,7 @@ void DocIterator::backwardPos()
|
|||||||
if (empty()) {
|
if (empty()) {
|
||||||
push_back(CursorSlice(*inset_));
|
push_back(CursorSlice(*inset_));
|
||||||
back().idx() = lastidx();
|
back().idx() = lastidx();
|
||||||
back().par() = lastpar();
|
back().pit() = lastpit();
|
||||||
back().pos() = lastpos();
|
back().pos() = lastpos();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -381,13 +381,13 @@ void DocIterator::backwardPos()
|
|||||||
|
|
||||||
if (top.pos() != 0) {
|
if (top.pos() != 0) {
|
||||||
--top.pos();
|
--top.pos();
|
||||||
} else if (top.par() != 0) {
|
} else if (top.pit() != 0) {
|
||||||
--top.par();
|
--top.pit();
|
||||||
top.pos() = lastpos();
|
top.pos() = lastpos();
|
||||||
return;
|
return;
|
||||||
} else if (top.idx() != 0) {
|
} else if (top.idx() != 0) {
|
||||||
--top.idx();
|
--top.idx();
|
||||||
top.par() = lastpar();
|
top.pit() = lastpit();
|
||||||
top.pos() = lastpos();
|
top.pos() = lastpos();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -408,7 +408,7 @@ void DocIterator::backwardPos()
|
|||||||
if (n && n->isActive()) {
|
if (n && n->isActive()) {
|
||||||
push_back(CursorSlice(*n));
|
push_back(CursorSlice(*n));
|
||||||
back().idx() = lastidx();
|
back().idx() = lastidx();
|
||||||
back().par() = lastpar();
|
back().pit() = lastpit();
|
||||||
back().pos() = lastpos();
|
back().pos() = lastpos();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
/// type for cell number in inset
|
/// type for cell number in inset
|
||||||
typedef CursorSlice::idx_type idx_type;
|
typedef CursorSlice::idx_type idx_type;
|
||||||
/// type for paragraph numbers positions within a cell
|
/// type for paragraph numbers positions within a cell
|
||||||
typedef CursorSlice::par_type par_type;
|
typedef CursorSlice::pit_type pit_type;
|
||||||
/// type for cursor positions within a cell
|
/// type for cursor positions within a cell
|
||||||
typedef CursorSlice::pos_type pos_type;
|
typedef CursorSlice::pos_type pos_type;
|
||||||
/// type for row indices
|
/// type for row indices
|
||||||
@ -81,11 +81,11 @@ public:
|
|||||||
/// return the last possible cell in this inset
|
/// return the last possible cell in this inset
|
||||||
idx_type lastidx() const;
|
idx_type lastidx() const;
|
||||||
/// return the paragraph this cursor is in
|
/// return the paragraph this cursor is in
|
||||||
par_type par() const { return back().par(); }
|
pit_type pit() const { return back().pit(); }
|
||||||
/// return the paragraph this cursor is in
|
/// return the paragraph this cursor is in
|
||||||
par_type & par() { return back().par(); }
|
pit_type & pit() { return back().pit(); }
|
||||||
/// return the last possible paragraph in this inset
|
/// return the last possible paragraph in this inset
|
||||||
par_type lastpar() const;
|
pit_type lastpit() const;
|
||||||
/// return the position within the paragraph
|
/// return the position within the paragraph
|
||||||
pos_type pos() const { return back().pos(); }
|
pos_type pos() const { return back().pos(); }
|
||||||
/// return the position within the paragraph
|
/// return the position within the paragraph
|
||||||
|
@ -384,14 +384,14 @@ void InsetTabular::edit(LCursor & cur, bool left)
|
|||||||
cur.idx() = tabular.getLastCellInRow(0);
|
cur.idx() = tabular.getLastCellInRow(0);
|
||||||
else
|
else
|
||||||
cur.idx() = 0;
|
cur.idx() = 0;
|
||||||
cur.par() = 0;
|
cur.pit() = 0;
|
||||||
cur.pos() = 0;
|
cur.pos() = 0;
|
||||||
} else {
|
} else {
|
||||||
if (isRightToLeft(cur))
|
if (isRightToLeft(cur))
|
||||||
cur.idx() = tabular.getFirstCellInRow(tabular.rows() - 1);
|
cur.idx() = tabular.getFirstCellInRow(tabular.rows() - 1);
|
||||||
else
|
else
|
||||||
cur.idx() = tabular.getNumberOfCells() - 1;
|
cur.idx() = tabular.getNumberOfCells() - 1;
|
||||||
cur.par() = 0;
|
cur.pit() = 0;
|
||||||
cur.pos() = cur.lastpos(); // FIXME crude guess
|
cur.pos() = cur.lastpos(); // FIXME crude guess
|
||||||
}
|
}
|
||||||
// this accesses the position cache before it is initialized
|
// this accesses the position cache before it is initialized
|
||||||
@ -506,7 +506,7 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
if (sl == cur.top())
|
if (sl == cur.top())
|
||||||
if (tabular.row_of_cell(cur.idx()) != tabular.rows() - 1) {
|
if (tabular.row_of_cell(cur.idx()) != tabular.rows() - 1) {
|
||||||
cur.idx() = tabular.getCellBelow(cur.idx());
|
cur.idx() = tabular.getCellBelow(cur.idx());
|
||||||
cur.par() = 0;
|
cur.pit() = 0;
|
||||||
cur.pos() = 0;
|
cur.pos() = 0;
|
||||||
resetPos(cur);
|
resetPos(cur);
|
||||||
}
|
}
|
||||||
@ -523,7 +523,7 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
if (sl == cur.top())
|
if (sl == cur.top())
|
||||||
if (tabular.row_of_cell(cur.idx()) != 0) {
|
if (tabular.row_of_cell(cur.idx()) != 0) {
|
||||||
cur.idx() = tabular.getCellAbove(cur.idx());
|
cur.idx() = tabular.getCellAbove(cur.idx());
|
||||||
cur.par() = cur.lastpar();
|
cur.pit() = cur.lastpit();
|
||||||
cur.pos() = cur.lastpos();
|
cur.pos() = cur.lastpos();
|
||||||
resetPos(cur);
|
resetPos(cur);
|
||||||
}
|
}
|
||||||
@ -544,7 +544,7 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
} else {
|
} else {
|
||||||
cur.idx() = tabular.getFirstCellInRow(tabular.rows() - 1) + col;
|
cur.idx() = tabular.getFirstCellInRow(tabular.rows() - 1) + col;
|
||||||
}
|
}
|
||||||
cur.par() = 0;
|
cur.pit() = 0;
|
||||||
cur.pos() = 0;
|
cur.pos() = 0;
|
||||||
resetPos(cur);
|
resetPos(cur);
|
||||||
break;
|
break;
|
||||||
@ -564,7 +564,7 @@ void InsetTabular::priv_dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
} else {
|
} else {
|
||||||
cur.idx() = col;
|
cur.idx() = col;
|
||||||
}
|
}
|
||||||
cur.par() = cur.lastpar();
|
cur.pit() = cur.lastpit();
|
||||||
cur.pos() = cur.lastpos();
|
cur.pos() = cur.lastpos();
|
||||||
resetPos(cur);
|
resetPos(cur);
|
||||||
break;
|
break;
|
||||||
@ -1043,7 +1043,7 @@ void InsetTabular::moveNextCell(LCursor & cur)
|
|||||||
return;
|
return;
|
||||||
++cur.idx();
|
++cur.idx();
|
||||||
}
|
}
|
||||||
cur.par() = 0;
|
cur.pit() = 0;
|
||||||
cur.pos() = 0;
|
cur.pos() = 0;
|
||||||
lyxerr << "InsetTabular::moveNextCell 2 cur: " << cur.top() << endl;
|
lyxerr << "InsetTabular::moveNextCell 2 cur: " << cur.top() << endl;
|
||||||
resetPos(cur);
|
resetPos(cur);
|
||||||
@ -1069,7 +1069,7 @@ void InsetTabular::movePrevCell(LCursor & cur)
|
|||||||
return;
|
return;
|
||||||
--cur.idx();
|
--cur.idx();
|
||||||
}
|
}
|
||||||
cur.par() = 0;
|
cur.pit() = 0;
|
||||||
cur.pos() = 0;
|
cur.pos() = 0;
|
||||||
resetPos(cur);
|
resetPos(cur);
|
||||||
}
|
}
|
||||||
@ -1222,7 +1222,7 @@ void InsetTabular::tabularFeatures(LCursor & cur,
|
|||||||
if (sel_row_start >= tabular.rows())
|
if (sel_row_start >= tabular.rows())
|
||||||
--sel_row_start;
|
--sel_row_start;
|
||||||
cur.idx() = tabular.getCellNumber(sel_row_start, column);
|
cur.idx() = tabular.getCellNumber(sel_row_start, column);
|
||||||
cur.par() = 0;
|
cur.pit() = 0;
|
||||||
cur.pos() = 0;
|
cur.pos() = 0;
|
||||||
cur.selection() = false;
|
cur.selection() = false;
|
||||||
break;
|
break;
|
||||||
@ -1233,7 +1233,7 @@ void InsetTabular::tabularFeatures(LCursor & cur,
|
|||||||
if (sel_col_start >= tabular.columns())
|
if (sel_col_start >= tabular.columns())
|
||||||
--sel_col_start;
|
--sel_col_start;
|
||||||
cur.idx() = tabular.getCellNumber(row, sel_col_start);
|
cur.idx() = tabular.getCellNumber(row, sel_col_start);
|
||||||
cur.par() = 0;
|
cur.pit() = 0;
|
||||||
cur.pos() = 0;
|
cur.pos() = 0;
|
||||||
cur.selection() = false;
|
cur.selection() = false;
|
||||||
break;
|
break;
|
||||||
@ -1343,7 +1343,7 @@ void InsetTabular::tabularFeatures(LCursor & cur,
|
|||||||
CursorSlice::idx_type const s_end = cur.selEnd().idx();
|
CursorSlice::idx_type const s_end = cur.selEnd().idx();
|
||||||
tabular.setMultiColumn(bv.buffer(), s_start, s_end - s_start + 1);
|
tabular.setMultiColumn(bv.buffer(), s_start, s_end - s_start + 1);
|
||||||
cur.idx() = s_start;
|
cur.idx() = s_start;
|
||||||
cur.par() = 0;
|
cur.pit() = 0;
|
||||||
cur.pos() = 0;
|
cur.pos() = 0;
|
||||||
cur.selection() = false;
|
cur.selection() = false;
|
||||||
break;
|
break;
|
||||||
|
@ -250,9 +250,9 @@ void InsetText::updateLocal(LCursor & cur)
|
|||||||
lv->view_state_changed();
|
lv->view_state_changed();
|
||||||
lv->updateMenubar();
|
lv->updateMenubar();
|
||||||
lv->updateToolbars();
|
lv->updateToolbars();
|
||||||
if (old_par != cur.par()) {
|
if (old_par != cur.pit()) {
|
||||||
lv->setLayout(text_.getPar(cur.par()).layout()->name());
|
lv->setLayout(text_.getPar(cur.pit()).layout()->name());
|
||||||
old_par = cur.par();
|
old_par = cur.pit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
int frame_color_;
|
int frame_color_;
|
||||||
///
|
///
|
||||||
mutable lyx::par_type old_par;
|
mutable lyx::pit_type old_par;
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
mutable LyXText text_;
|
mutable LyXText text_;
|
||||||
|
@ -38,7 +38,7 @@ using lyx::support::lowercase;
|
|||||||
using lyx::support::uppercase;
|
using lyx::support::uppercase;
|
||||||
using lyx::support::split;
|
using lyx::support::split;
|
||||||
|
|
||||||
using lyx::par_type;
|
using lyx::pit_type;
|
||||||
using lyx::pos_type;
|
using lyx::pos_type;
|
||||||
|
|
||||||
using std::advance;
|
using std::advance;
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
///
|
///
|
||||||
typedef lyx::pos_type pos_type;
|
typedef lyx::pos_type pos_type;
|
||||||
///
|
///
|
||||||
typedef lyx::par_type par_type;
|
typedef lyx::pit_type pit_type;
|
||||||
|
|
||||||
/// constructor
|
/// constructor
|
||||||
explicit LyXText(BufferView *);
|
explicit LyXText(BufferView *);
|
||||||
@ -61,20 +61,20 @@ public:
|
|||||||
///
|
///
|
||||||
LyXFont getFont(Paragraph const & par, pos_type pos) const;
|
LyXFont getFont(Paragraph const & par, pos_type pos) const;
|
||||||
///
|
///
|
||||||
LyXFont getLayoutFont(par_type pit) const;
|
LyXFont getLayoutFont(pit_type pit) const;
|
||||||
///
|
///
|
||||||
LyXFont getLabelFont(Paragraph const & par) const;
|
LyXFont getLabelFont(Paragraph const & par) const;
|
||||||
///
|
///
|
||||||
void setCharFont(par_type pit, pos_type pos, LyXFont const & font);
|
void setCharFont(pit_type pit, pos_type pos, LyXFont const & font);
|
||||||
///
|
///
|
||||||
void setCharFont(par_type pit, pos_type pos, LyXFont const & font,
|
void setCharFont(pit_type pit, pos_type pos, LyXFont const & font,
|
||||||
bool toggleall);
|
bool toggleall);
|
||||||
|
|
||||||
/// what you expect when pressing <enter> at cursor position
|
/// what you expect when pressing <enter> at cursor position
|
||||||
void breakParagraph(LCursor & cur, char keep_layout = 0);
|
void breakParagraph(LCursor & cur, char keep_layout = 0);
|
||||||
|
|
||||||
/// set layout over selection
|
/// set layout over selection
|
||||||
par_type setLayout(par_type start, par_type end,
|
pit_type setLayout(pit_type start, pit_type end,
|
||||||
std::string const & layout);
|
std::string const & layout);
|
||||||
///
|
///
|
||||||
void setLayout(LCursor & cur, std::string const & layout);
|
void setLayout(LCursor & cur, std::string const & layout);
|
||||||
@ -94,15 +94,15 @@ public:
|
|||||||
void setFont(LCursor & cur, LyXFont const &, bool toggleall = false);
|
void setFont(LCursor & cur, LyXFont const &, bool toggleall = false);
|
||||||
|
|
||||||
/// rebreaks all paragaphs between the given pars.
|
/// rebreaks all paragaphs between the given pars.
|
||||||
void redoParagraphs(par_type begin, par_type end);
|
void redoParagraphs(pit_type begin, pit_type end);
|
||||||
/// rebreaks the given par
|
/// rebreaks the given par
|
||||||
void redoParagraph(par_type pit);
|
void redoParagraph(pit_type pit);
|
||||||
/// rebreaks the cursor par
|
/// rebreaks the cursor par
|
||||||
void redoParagraph(LCursor & cur);
|
void redoParagraph(LCursor & cur);
|
||||||
|
|
||||||
/// returns pos in given par at given x coord
|
/// returns pos in given par at given x coord
|
||||||
pos_type x2pos(par_type pit, int row, int x) const;
|
pos_type x2pos(pit_type pit, int row, int x) const;
|
||||||
int pos2x(par_type pit, pos_type pos) const;
|
int pos2x(pit_type pit, pos_type pos) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
void toggleFree(LCursor & cur, LyXFont const &, bool toggleall = false);
|
void toggleFree(LCursor & cur, LyXFont const &, bool toggleall = false);
|
||||||
@ -139,7 +139,7 @@ public:
|
|||||||
BufferView * bv() const;
|
BufferView * bv() const;
|
||||||
|
|
||||||
/// access to individual paragraphs
|
/// access to individual paragraphs
|
||||||
Paragraph & getPar(par_type par) const;
|
Paragraph & getPar(pit_type par) const;
|
||||||
// Returns the current font and depth as a message.
|
// Returns the current font and depth as a message.
|
||||||
std::string LyXText::currentState(LCursor & cur);
|
std::string LyXText::currentState(LCursor & cur);
|
||||||
|
|
||||||
@ -147,12 +147,12 @@ public:
|
|||||||
* y-coordinate (relative to the whole text). y is set to the
|
* y-coordinate (relative to the whole text). y is set to the
|
||||||
* real beginning of this row
|
* real beginning of this row
|
||||||
*/
|
*/
|
||||||
Row const & getRowNearY(int y, par_type & pit) const;
|
Row const & getRowNearY(int y, pit_type & pit) const;
|
||||||
|
|
||||||
/** returns the column near the specified x-coordinate of the row
|
/** returns the column near the specified x-coordinate of the row
|
||||||
x is set to the real beginning of this column
|
x is set to the real beginning of this column
|
||||||
*/
|
*/
|
||||||
pos_type getColumnNearX(par_type pit,
|
pos_type getColumnNearX(pit_type pit,
|
||||||
Row const & row, int & x, bool & boundary) const;
|
Row const & row, int & x, bool & boundary) const;
|
||||||
|
|
||||||
/** Find the word under \c from in the relative location
|
/** Find the word under \c from in the relative location
|
||||||
@ -170,21 +170,21 @@ public:
|
|||||||
void rejectChange(LCursor & cur);
|
void rejectChange(LCursor & cur);
|
||||||
|
|
||||||
/// returns true if par was empty and was removed
|
/// returns true if par was empty and was removed
|
||||||
bool setCursor(LCursor & cur, par_type par, pos_type pos,
|
bool setCursor(LCursor & cur, pit_type par, pos_type pos,
|
||||||
bool setfont = true, bool boundary = false);
|
bool setfont = true, bool boundary = false);
|
||||||
///
|
///
|
||||||
void setCursor(CursorSlice &, par_type par,
|
void setCursor(CursorSlice &, pit_type par,
|
||||||
pos_type pos, bool boundary = false);
|
pos_type pos, bool boundary = false);
|
||||||
///
|
///
|
||||||
void setCursorIntern(LCursor & cur, par_type par,
|
void setCursorIntern(LCursor & cur, pit_type par,
|
||||||
pos_type pos, bool setfont = true, bool boundary = false);
|
pos_type pos, bool setfont = true, bool boundary = false);
|
||||||
///
|
///
|
||||||
void setCurrentFont(LCursor & cur);
|
void setCurrentFont(LCursor & cur);
|
||||||
|
|
||||||
///
|
///
|
||||||
void recUndo(par_type first, par_type last) const;
|
void recUndo(pit_type first, pit_type last) const;
|
||||||
///
|
///
|
||||||
void recUndo(par_type first) const;
|
void recUndo(pit_type first) const;
|
||||||
///
|
///
|
||||||
void setCursorFromCoordinates(LCursor & cur, int x, int y);
|
void setCursorFromCoordinates(LCursor & cur, int x, int y);
|
||||||
///
|
///
|
||||||
@ -289,14 +289,14 @@ public:
|
|||||||
* in LaTeX the beginning of the text fits in some cases
|
* in LaTeX the beginning of the text fits in some cases
|
||||||
* (for example sections) exactly the label-width.
|
* (for example sections) exactly the label-width.
|
||||||
*/
|
*/
|
||||||
int leftMargin(par_type pit, pos_type pos) const;
|
int leftMargin(pit_type pit, pos_type pos) const;
|
||||||
int leftMargin(par_type pit) const;
|
int leftMargin(pit_type pit) const;
|
||||||
///
|
///
|
||||||
int rightMargin(Paragraph const & par) const;
|
int rightMargin(Paragraph const & par) const;
|
||||||
|
|
||||||
/** this calculates the specified parameters. needed when setting
|
/** this calculates the specified parameters. needed when setting
|
||||||
* the cursor and when creating a visible row */
|
* the cursor and when creating a visible row */
|
||||||
RowMetrics computeRowMetrics(par_type pit, Row const & row) const;
|
RowMetrics computeRowMetrics(pit_type pit, Row const & row) const;
|
||||||
|
|
||||||
/// access to our paragraphs
|
/// access to our paragraphs
|
||||||
ParagraphList & paragraphs() const;
|
ParagraphList & paragraphs() const;
|
||||||
@ -307,9 +307,9 @@ public:
|
|||||||
Row const & firstRow() const;
|
Row const & firstRow() const;
|
||||||
|
|
||||||
/// is this row the last in the text?
|
/// is this row the last in the text?
|
||||||
bool isLastRow(par_type pit, Row const & row) const;
|
bool isLastRow(pit_type pit, Row const & row) const;
|
||||||
/// is this row the first in the text?
|
/// is this row the first in the text?
|
||||||
bool isFirstRow(par_type pit, Row const & row) const;
|
bool isFirstRow(pit_type pit, Row const & row) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
double spacing(Paragraph const & par) const;
|
double spacing(Paragraph const & par) const;
|
||||||
@ -371,15 +371,15 @@ public:
|
|||||||
private:
|
private:
|
||||||
/// return past-the-last paragraph influenced by a layout
|
/// return past-the-last paragraph influenced by a layout
|
||||||
/// change on pit
|
/// change on pit
|
||||||
par_type undoSpan(par_type pit);
|
pit_type undoSpan(pit_type pit);
|
||||||
|
|
||||||
/// rebreaks the given par
|
/// rebreaks the given par
|
||||||
void redoParagraphInternal(par_type pit);
|
void redoParagraphInternal(pit_type pit);
|
||||||
/// used in setlayout
|
/// used in setlayout
|
||||||
void makeFontEntriesLayoutSpecific(BufferParams const &, Paragraph & par);
|
void makeFontEntriesLayoutSpecific(BufferParams const &, Paragraph & par);
|
||||||
|
|
||||||
/// Calculate and set the height of the row
|
/// Calculate and set the height of the row
|
||||||
void setHeightOfRow(par_type, Row & row);
|
void setHeightOfRow(pit_type, Row & row);
|
||||||
|
|
||||||
// fix the cursor `cur' after a characters has been deleted at `where'
|
// fix the cursor `cur' after a characters has been deleted at `where'
|
||||||
// position. Called by deleteEmptyParagraphMechanism
|
// position. Called by deleteEmptyParagraphMechanism
|
||||||
@ -389,7 +389,7 @@ private:
|
|||||||
bool deleteEmptyParagraphMechanism(LCursor & cur, LCursor const & old);
|
bool deleteEmptyParagraphMechanism(LCursor & cur, LCursor const & old);
|
||||||
|
|
||||||
///
|
///
|
||||||
void setCounter(Buffer const &, par_type pit);
|
void setCounter(Buffer const &, pit_type pit);
|
||||||
///
|
///
|
||||||
void deleteWordForward(LCursor & cur);
|
void deleteWordForward(LCursor & cur);
|
||||||
///
|
///
|
||||||
@ -399,13 +399,13 @@ private:
|
|||||||
|
|
||||||
/// sets row.end to the pos value *after* which a row should break.
|
/// sets row.end to the pos value *after* which a row should break.
|
||||||
/// for example, the pos after which isNewLine(pos) == true
|
/// for example, the pos after which isNewLine(pos) == true
|
||||||
void rowBreakPoint(par_type pit, Row & row) const;
|
void rowBreakPoint(pit_type pit, Row & row) const;
|
||||||
/// sets row.width to the minimum space a row needs on the screen in pixel
|
/// sets row.width to the minimum space a row needs on the screen in pixel
|
||||||
void setRowWidth(par_type pit, Row & row) const;
|
void setRowWidth(pit_type pit, Row & row) const;
|
||||||
/// the minimum space a manual label needs on the screen in pixels
|
/// the minimum space a manual label needs on the screen in pixels
|
||||||
int labelFill(Paragraph const & par, Row const & row) const;
|
int labelFill(Paragraph const & par, Row const & row) const;
|
||||||
/// FIXME
|
/// FIXME
|
||||||
int labelEnd(par_type pit) const;
|
int labelEnd(pit_type pit) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
void charInserted();
|
void charInserted();
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
using lyx::pos_type;
|
using lyx::pos_type;
|
||||||
using lyx::par_type;
|
using lyx::pit_type;
|
||||||
|
|
||||||
using lyx::support::ascii_lowercase;
|
using lyx::support::ascii_lowercase;
|
||||||
using lyx::support::bformat;
|
using lyx::support::bformat;
|
||||||
@ -88,7 +88,7 @@ bool moveItem(Paragraph & from, Paragraph & to,
|
|||||||
|
|
||||||
|
|
||||||
void breakParagraph(BufferParams const & bparams,
|
void breakParagraph(BufferParams const & bparams,
|
||||||
ParagraphList & pars, par_type par_offset, pos_type pos, int flag)
|
ParagraphList & pars, pit_type par_offset, pos_type pos, int flag)
|
||||||
{
|
{
|
||||||
// create a new paragraph, and insert into the list
|
// create a new paragraph, and insert into the list
|
||||||
ParagraphList::iterator tmp =
|
ParagraphList::iterator tmp =
|
||||||
@ -182,7 +182,7 @@ void breakParagraph(BufferParams const & bparams,
|
|||||||
|
|
||||||
|
|
||||||
void breakParagraphConservative(BufferParams const & bparams,
|
void breakParagraphConservative(BufferParams const & bparams,
|
||||||
ParagraphList & pars, par_type par_offset, pos_type pos)
|
ParagraphList & pars, pit_type par_offset, pos_type pos)
|
||||||
{
|
{
|
||||||
// create a new paragraph
|
// create a new paragraph
|
||||||
Paragraph & tmp = *pars.insert(pars.begin() + par_offset + 1, Paragraph());
|
Paragraph & tmp = *pars.insert(pars.begin() + par_offset + 1, Paragraph());
|
||||||
@ -208,7 +208,7 @@ void breakParagraphConservative(BufferParams const & bparams,
|
|||||||
|
|
||||||
|
|
||||||
void mergeParagraph(BufferParams const & bparams,
|
void mergeParagraph(BufferParams const & bparams,
|
||||||
ParagraphList & pars, par_type par_offset)
|
ParagraphList & pars, pit_type par_offset)
|
||||||
{
|
{
|
||||||
Paragraph & next = pars[par_offset + 1];
|
Paragraph & next = pars[par_offset + 1];
|
||||||
Paragraph & par = pars[par_offset];
|
Paragraph & par = pars[par_offset];
|
||||||
@ -225,10 +225,10 @@ void mergeParagraph(BufferParams const & bparams,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
par_type depthHook(par_type pit,
|
pit_type depthHook(pit_type pit,
|
||||||
ParagraphList const & pars, Paragraph::depth_type depth)
|
ParagraphList const & pars, Paragraph::depth_type depth)
|
||||||
{
|
{
|
||||||
par_type newpit = pit;
|
pit_type newpit = pit;
|
||||||
|
|
||||||
if (newpit != 0)
|
if (newpit != 0)
|
||||||
--newpit;
|
--newpit;
|
||||||
@ -243,7 +243,7 @@ par_type depthHook(par_type pit,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
par_type outerHook(par_type par_offset, ParagraphList const & pars)
|
pit_type outerHook(pit_type par_offset, ParagraphList const & pars)
|
||||||
{
|
{
|
||||||
Paragraph const & par = pars[par_offset];
|
Paragraph const & par = pars[par_offset];
|
||||||
|
|
||||||
@ -253,11 +253,11 @@ par_type outerHook(par_type par_offset, ParagraphList const & pars)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool isFirstInSequence(par_type par_offset, ParagraphList const & pars)
|
bool isFirstInSequence(pit_type par_offset, ParagraphList const & pars)
|
||||||
{
|
{
|
||||||
Paragraph const & par = pars[par_offset];
|
Paragraph const & par = pars[par_offset];
|
||||||
|
|
||||||
par_type dhook_offset = depthHook(par_offset, pars, par.getDepth());
|
pit_type dhook_offset = depthHook(par_offset, pars, par.getDepth());
|
||||||
|
|
||||||
Paragraph const & dhook = pars[dhook_offset];
|
Paragraph const & dhook = pars[dhook_offset];
|
||||||
|
|
||||||
@ -267,16 +267,16 @@ bool isFirstInSequence(par_type par_offset, ParagraphList const & pars)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int getEndLabel(par_type p, ParagraphList const & pars)
|
int getEndLabel(pit_type p, ParagraphList const & pars)
|
||||||
{
|
{
|
||||||
par_type pit = p;
|
pit_type pit = p;
|
||||||
Paragraph::depth_type par_depth = pars[p].getDepth();
|
Paragraph::depth_type par_depth = pars[p].getDepth();
|
||||||
while (pit != par_type(pars.size())) {
|
while (pit != pit_type(pars.size())) {
|
||||||
LyXLayout_ptr const & layout = pars[pit].layout();
|
LyXLayout_ptr const & layout = pars[pit].layout();
|
||||||
int const endlabeltype = layout->endlabeltype;
|
int const endlabeltype = layout->endlabeltype;
|
||||||
|
|
||||||
if (endlabeltype != END_LABEL_NO_LABEL) {
|
if (endlabeltype != END_LABEL_NO_LABEL) {
|
||||||
if (p + 1 == par_type(pars.size()))
|
if (p + 1 == pit_type(pars.size()))
|
||||||
return endlabeltype;
|
return endlabeltype;
|
||||||
|
|
||||||
Paragraph::depth_type const next_depth =
|
Paragraph::depth_type const next_depth =
|
||||||
@ -289,24 +289,24 @@ int getEndLabel(par_type p, ParagraphList const & pars)
|
|||||||
if (par_depth == 0)
|
if (par_depth == 0)
|
||||||
break;
|
break;
|
||||||
pit = outerHook(pit, pars);
|
pit = outerHook(pit, pars);
|
||||||
if (pit != par_type(pars.size()))
|
if (pit != pit_type(pars.size()))
|
||||||
par_depth = pars[pit].getDepth();
|
par_depth = pars[pit].getDepth();
|
||||||
}
|
}
|
||||||
return END_LABEL_NO_LABEL;
|
return END_LABEL_NO_LABEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LyXFont const outerFont(par_type par_offset, ParagraphList const & pars)
|
LyXFont const outerFont(pit_type par_offset, ParagraphList const & pars)
|
||||||
{
|
{
|
||||||
Paragraph::depth_type par_depth = pars[par_offset].getDepth();
|
Paragraph::depth_type par_depth = pars[par_offset].getDepth();
|
||||||
LyXFont tmpfont(LyXFont::ALL_INHERIT);
|
LyXFont tmpfont(LyXFont::ALL_INHERIT);
|
||||||
|
|
||||||
// Resolve against environment font information
|
// Resolve against environment font information
|
||||||
while (par_offset != par_type(pars.size())
|
while (par_offset != pit_type(pars.size())
|
||||||
&& par_depth
|
&& par_depth
|
||||||
&& !tmpfont.resolved()) {
|
&& !tmpfont.resolved()) {
|
||||||
par_offset = outerHook(par_offset, pars);
|
par_offset = outerHook(par_offset, pars);
|
||||||
if (par_offset != par_type(pars.size())) {
|
if (par_offset != pit_type(pars.size())) {
|
||||||
tmpfont.realize(pars[par_offset].layout()->font);
|
tmpfont.realize(pars[par_offset].layout()->font);
|
||||||
par_depth = pars[par_offset].getDepth();
|
par_depth = pars[par_offset].getDepth();
|
||||||
}
|
}
|
||||||
@ -316,7 +316,7 @@ LyXFont const outerFont(par_type par_offset, ParagraphList const & pars)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
par_type outerPar(Buffer const & buf, InsetBase const * inset)
|
pit_type outerPar(Buffer const & buf, InsetBase const * inset)
|
||||||
{
|
{
|
||||||
ParIterator pit = const_cast<Buffer &>(buf).par_iterator_begin();
|
ParIterator pit = const_cast<Buffer &>(buf).par_iterator_begin();
|
||||||
ParIterator end = const_cast<Buffer &>(buf).par_iterator_end();
|
ParIterator end = const_cast<Buffer &>(buf).par_iterator_end();
|
||||||
@ -341,11 +341,11 @@ par_type outerPar(Buffer const & buf, InsetBase const * inset)
|
|||||||
|
|
||||||
/// return the range of pars [beg, end[ owning the range of y [ystart, yend]
|
/// return the range of pars [beg, end[ owning the range of y [ystart, yend]
|
||||||
void getParsInRange(ParagraphList & pars, int ystart, int yend,
|
void getParsInRange(ParagraphList & pars, int ystart, int yend,
|
||||||
par_type & beg, par_type & end)
|
pit_type & beg, pit_type & end)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(!pars.empty());
|
BOOST_ASSERT(!pars.empty());
|
||||||
par_type const endpar = pars.size();
|
pit_type const endpar = pars.size();
|
||||||
par_type const begpar = 0;
|
pit_type const begpar = 0;
|
||||||
|
|
||||||
for (beg = endpar - 1; beg != begpar && pars[beg].y > ystart; --beg)
|
for (beg = endpar - 1; beg != begpar && pars[beg].y > ystart; --beg)
|
||||||
;
|
;
|
||||||
|
@ -25,14 +25,14 @@ class ParagraphList;
|
|||||||
///
|
///
|
||||||
void breakParagraph(BufferParams const & bparams,
|
void breakParagraph(BufferParams const & bparams,
|
||||||
ParagraphList & paragraphs,
|
ParagraphList & paragraphs,
|
||||||
lyx::par_type par,
|
lyx::pit_type par,
|
||||||
lyx::pos_type pos,
|
lyx::pos_type pos,
|
||||||
int flag);
|
int flag);
|
||||||
|
|
||||||
///
|
///
|
||||||
void breakParagraphConservative(BufferParams const & bparams,
|
void breakParagraphConservative(BufferParams const & bparams,
|
||||||
ParagraphList & paragraphs,
|
ParagraphList & paragraphs,
|
||||||
lyx::par_type par,
|
lyx::pit_type par,
|
||||||
lyx::pos_type pos);
|
lyx::pos_type pos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,32 +40,32 @@ void breakParagraphConservative(BufferParams const & bparams,
|
|||||||
* Be careful, this doesent make any check at all.
|
* Be careful, this doesent make any check at all.
|
||||||
*/
|
*/
|
||||||
void mergeParagraph(BufferParams const & bparams,
|
void mergeParagraph(BufferParams const & bparams,
|
||||||
ParagraphList & paragraphs, lyx::par_type par);
|
ParagraphList & paragraphs, lyx::pit_type par);
|
||||||
|
|
||||||
|
|
||||||
/// for the environments
|
/// for the environments
|
||||||
lyx::par_type depthHook(lyx::par_type par,
|
lyx::pit_type depthHook(lyx::pit_type par,
|
||||||
ParagraphList const & plist, lyx::depth_type depth);
|
ParagraphList const & plist, lyx::depth_type depth);
|
||||||
|
|
||||||
lyx::par_type outerHook(lyx::par_type par, ParagraphList const & plist);
|
lyx::pit_type outerHook(lyx::pit_type par, ParagraphList const & plist);
|
||||||
|
|
||||||
/// Is it the first par with same depth and layout?
|
/// Is it the first par with same depth and layout?
|
||||||
bool isFirstInSequence(lyx::par_type par, ParagraphList const & plist);
|
bool isFirstInSequence(lyx::pit_type par, ParagraphList const & plist);
|
||||||
|
|
||||||
/** Check if the current paragraph is the last paragraph in a
|
/** Check if the current paragraph is the last paragraph in a
|
||||||
proof environment */
|
proof environment */
|
||||||
int getEndLabel(lyx::par_type par, ParagraphList const & plist);
|
int getEndLabel(lyx::pit_type par, ParagraphList const & plist);
|
||||||
|
|
||||||
LyXFont const outerFont(lyx::par_type par, ParagraphList const & plist);
|
LyXFont const outerFont(lyx::pit_type par, ParagraphList const & plist);
|
||||||
|
|
||||||
/// find outermost paragraph containing an inset
|
/// find outermost paragraph containing an inset
|
||||||
lyx::par_type outerPar(Buffer const & buf, InsetBase const * inset);
|
lyx::pit_type outerPar(Buffer const & buf, InsetBase const * inset);
|
||||||
|
|
||||||
/// return the range of pars [beg, end[ owning the range of y [ystart, yend]
|
/// return the range of pars [beg, end[ owning the range of y [ystart, yend]
|
||||||
void getParsInRange(ParagraphList & plist,
|
void getParsInRange(ParagraphList & plist,
|
||||||
int ystart, int yend,
|
int ystart, int yend,
|
||||||
lyx::par_type & beg,
|
lyx::pit_type & beg,
|
||||||
lyx::par_type & end);
|
lyx::pit_type & end);
|
||||||
|
|
||||||
/// return the number of InsetOptArg in a paragraph
|
/// return the number of InsetOptArg in a paragraph
|
||||||
int numberOfOptArgs(Paragraph const & par);
|
int numberOfOptArgs(Paragraph const & par);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "insets/inset.h"
|
#include "insets/inset.h"
|
||||||
|
|
||||||
using lyx::par_type;
|
using lyx::pit_type;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -78,25 +78,25 @@ ParIterator & ParIterator::operator--()
|
|||||||
|
|
||||||
Paragraph & ParIterator::operator*() const
|
Paragraph & ParIterator::operator*() const
|
||||||
{
|
{
|
||||||
return text()->getPar(par());
|
return text()->getPar(pit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
par_type ParIterator::pit() const
|
pit_type ParIterator::pit() const
|
||||||
{
|
{
|
||||||
return par();
|
return pit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Paragraph * ParIterator::operator->() const
|
Paragraph * ParIterator::operator->() const
|
||||||
{
|
{
|
||||||
return &text()->getPar(par());
|
return &text()->getPar(pit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
par_type ParIterator::outerPar() const
|
pit_type ParIterator::outerPar() const
|
||||||
{
|
{
|
||||||
return bottom().par();
|
return bottom().pit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -151,13 +151,13 @@ ParConstIterator & ParConstIterator::operator++()
|
|||||||
|
|
||||||
Paragraph const & ParConstIterator::operator*() const
|
Paragraph const & ParConstIterator::operator*() const
|
||||||
{
|
{
|
||||||
return text()->getPar(par());
|
return text()->getPar(pit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Paragraph const * ParConstIterator::operator->() const
|
Paragraph const * ParConstIterator::operator->() const
|
||||||
{
|
{
|
||||||
return &text()->getPar(par());
|
return &text()->getPar(pit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
ParIterator(InsetBase &, lyx::par_type pit);
|
ParIterator(InsetBase &, lyx::pit_type pit);
|
||||||
///
|
///
|
||||||
ParIterator(ParIterator const &);
|
ParIterator(ParIterator const &);
|
||||||
///
|
///
|
||||||
@ -62,9 +62,9 @@ public:
|
|||||||
///
|
///
|
||||||
Paragraph * operator->() const;
|
Paragraph * operator->() const;
|
||||||
/// This gives us the top-most parent paragraph
|
/// This gives us the top-most parent paragraph
|
||||||
lyx::par_type outerPar() const;
|
lyx::pit_type outerPar() const;
|
||||||
///
|
///
|
||||||
lyx::par_type pit() const;
|
lyx::pit_type pit() const;
|
||||||
///
|
///
|
||||||
ParagraphList & plist() const;
|
ParagraphList & plist() const;
|
||||||
};
|
};
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#include "support/textutils.h"
|
#include "support/textutils.h"
|
||||||
|
|
||||||
using lyx::pos_type;
|
using lyx::pos_type;
|
||||||
using lyx::par_type;
|
using lyx::pit_type;
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::max;
|
using std::max;
|
||||||
@ -57,7 +57,7 @@ class RowPainter {
|
|||||||
public:
|
public:
|
||||||
/// initialise and run painter
|
/// initialise and run painter
|
||||||
RowPainter(BufferView const & bv, Painter & pain, LyXText const & text,
|
RowPainter(BufferView const & bv, Painter & pain, LyXText const & text,
|
||||||
par_type pit, RowList::iterator rit, int y);
|
pit_type pit, RowList::iterator rit, int y);
|
||||||
private:
|
private:
|
||||||
// paint various parts
|
// paint various parts
|
||||||
void paintBackground();
|
void paintBackground();
|
||||||
@ -104,7 +104,7 @@ private:
|
|||||||
Row & row_;
|
Row & row_;
|
||||||
|
|
||||||
/// Row's paragraph
|
/// Row's paragraph
|
||||||
par_type const pit_;
|
pit_type const pit_;
|
||||||
Paragraph const & par_;
|
Paragraph const & par_;
|
||||||
|
|
||||||
// Looks ugly - is
|
// Looks ugly - is
|
||||||
@ -119,7 +119,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
RowPainter::RowPainter(BufferView const & bv, Painter & pain,
|
RowPainter::RowPainter(BufferView const & bv, Painter & pain,
|
||||||
LyXText const & text, par_type pit, RowList::iterator rit, int y)
|
LyXText const & text, pit_type pit, RowList::iterator rit, int y)
|
||||||
: bv_(bv), pain_(pain), text_(text), pars_(text.paragraphs()),
|
: bv_(bv), pain_(pain), text_(text), pars_(text.paragraphs()),
|
||||||
rit_(rit), row_(*rit), pit_(pit), par_(text.paragraphs()[pit]),
|
rit_(rit), row_(*rit), pit_(pit), par_(text.paragraphs()[pit]),
|
||||||
xo_(text_.xo_), yo_(y), width_(text_.width())
|
xo_(text_.xo_), yo_(y), width_(text_.width())
|
||||||
@ -403,8 +403,8 @@ void RowPainter::paintSelection()
|
|||||||
LCursor const & cur = bv_.cursor();
|
LCursor const & cur = bv_.cursor();
|
||||||
int const starty = text_.cursorY(cur.selBegin());
|
int const starty = text_.cursorY(cur.selBegin());
|
||||||
int const endy = text_.cursorY(cur.selEnd());
|
int const endy = text_.cursorY(cur.selEnd());
|
||||||
par_type startpit = cur.selBegin().par();
|
pit_type startpit = cur.selBegin().pit();
|
||||||
par_type endpit = cur.selEnd().par();
|
pit_type endpit = cur.selEnd().pit();
|
||||||
RowList::iterator startrow = pars_[startpit].getRow(cur.selBegin().pos());
|
RowList::iterator startrow = pars_[startpit].getRow(cur.selBegin().pos());
|
||||||
RowList::iterator endrow = pars_[endpit].getRow(cur.selEnd().pos());
|
RowList::iterator endrow = pars_[endpit].getRow(cur.selEnd().pos());
|
||||||
int const h = row_.height();
|
int const h = row_.height();
|
||||||
@ -530,7 +530,7 @@ void RowPainter::paintDepthBar()
|
|||||||
|
|
||||||
Paragraph::depth_type prev_depth = 0;
|
Paragraph::depth_type prev_depth = 0;
|
||||||
if (!text_.isFirstRow(pit_, row_)) {
|
if (!text_.isFirstRow(pit_, row_)) {
|
||||||
par_type pit2 = pit_;
|
pit_type pit2 = pit_;
|
||||||
if (row_.pos() == 0)
|
if (row_.pos() == 0)
|
||||||
--pit2;
|
--pit2;
|
||||||
prev_depth = pars_[pit2].getDepth();
|
prev_depth = pars_[pit2].getDepth();
|
||||||
@ -538,7 +538,7 @@ void RowPainter::paintDepthBar()
|
|||||||
|
|
||||||
Paragraph::depth_type next_depth = 0;
|
Paragraph::depth_type next_depth = 0;
|
||||||
if (!text_.isLastRow(pit_, row_)) {
|
if (!text_.isLastRow(pit_, row_)) {
|
||||||
par_type pit2 = pit_;
|
pit_type pit2 = pit_;
|
||||||
if (row_.endpos() >= pars_[pit2].size())
|
if (row_.endpos() >= pars_[pit2].size())
|
||||||
++pit2;
|
++pit2;
|
||||||
next_depth = pars_[pit2].getDepth();
|
next_depth = pars_[pit2].getDepth();
|
||||||
@ -854,7 +854,7 @@ void RowPainter::paintText()
|
|||||||
|
|
||||||
|
|
||||||
int paintPars(BufferView const & bv, Painter & pain,
|
int paintPars(BufferView const & bv, Painter & pain,
|
||||||
LyXText const & text, par_type pit, par_type end)
|
LyXText const & text, pit_type pit, pit_type end)
|
||||||
{
|
{
|
||||||
//lyxerr << " paintRows: pit: " << &*pit << endl;
|
//lyxerr << " paintRows: pit: " << &*pit << endl;
|
||||||
ParagraphList & pars = text.paragraphs();
|
ParagraphList & pars = text.paragraphs();
|
||||||
@ -882,7 +882,7 @@ int paintPars(BufferView const & bv, Painter & pain,
|
|||||||
} // namespace anon
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
void refreshPar(BufferView const & bv, LyXText const & text, par_type pit)
|
void refreshPar(BufferView const & bv, LyXText const & text, pit_type pit)
|
||||||
{
|
{
|
||||||
static NullPainter nop;
|
static NullPainter nop;
|
||||||
paintPars(bv, nop, text, pit, pit + 1);
|
paintPars(bv, nop, text, pit, pit + 1);
|
||||||
@ -891,7 +891,7 @@ void refreshPar(BufferView const & bv, LyXText const & text, par_type pit)
|
|||||||
|
|
||||||
int paintText(BufferView const & bv)
|
int paintText(BufferView const & bv)
|
||||||
{
|
{
|
||||||
par_type pit, end;
|
pit_type pit, end;
|
||||||
getParsInRange(bv.text()->paragraphs(), bv.top_y(),
|
getParsInRange(bv.text()->paragraphs(), bv.top_y(),
|
||||||
bv.top_y() + bv.workHeight(), pit, end);
|
bv.top_y() + bv.workHeight(), pit, end);
|
||||||
//lyxerr << "top_y: " << bv.top_y() << " y: " << pit->y << endl;
|
//lyxerr << "top_y: " << bv.top_y() << " y: " << pit->y << endl;
|
||||||
|
@ -24,7 +24,7 @@ int paintText(BufferView const & bv);
|
|||||||
|
|
||||||
/// refresh a par of the main text
|
/// refresh a par of the main text
|
||||||
void refreshPar(BufferView const & bv, LyXText const & text,
|
void refreshPar(BufferView const & bv, LyXText const & text,
|
||||||
lyx::par_type pit);
|
lyx::pit_type pit);
|
||||||
|
|
||||||
/// paint the rows of a text inset
|
/// paint the rows of a text inset
|
||||||
void paintTextInset(LyXText const & text, PainterInfo & pi);
|
void paintTextInset(LyXText const & text, PainterInfo & pi);
|
||||||
|
@ -28,7 +28,7 @@ namespace lyx {
|
|||||||
/// a type for paragraph offsets
|
/// a type for paragraph offsets
|
||||||
// FIXME: should be unsigned as well.
|
// FIXME: should be unsigned as well.
|
||||||
// however, simply changing it breaks a downward loop somewhere...
|
// however, simply changing it breaks a downward loop somewhere...
|
||||||
typedef ptrdiff_t par_type;
|
typedef ptrdiff_t pit_type;
|
||||||
|
|
||||||
/// a type for the nesting depth of a paragraph
|
/// a type for the nesting depth of a paragraph
|
||||||
typedef size_t depth_type;
|
typedef size_t depth_type;
|
||||||
|
146
src/text.C
146
src/text.C
@ -69,7 +69,7 @@
|
|||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
using lyx::par_type;
|
using lyx::pit_type;
|
||||||
using lyx::pos_type;
|
using lyx::pos_type;
|
||||||
using lyx::word_location;
|
using lyx::word_location;
|
||||||
|
|
||||||
@ -409,8 +409,8 @@ double LyXText::spacing(Paragraph const & par) const
|
|||||||
|
|
||||||
void LyXText::updateParPositions()
|
void LyXText::updateParPositions()
|
||||||
{
|
{
|
||||||
par_type pit = 0;
|
pit_type pit = 0;
|
||||||
par_type end = pars_.size();
|
pit_type end = pars_.size();
|
||||||
for (height_ = 0; pit != end; ++pit) {
|
for (height_ = 0; pit != end; ++pit) {
|
||||||
pars_[pit].y = height_;
|
pars_[pit].y = height_;
|
||||||
height_ += pars_[pit].height;
|
height_ += pars_[pit].height;
|
||||||
@ -467,13 +467,13 @@ int LyXText::singleWidth(Paragraph const & par,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LyXText::leftMargin(par_type pit) const
|
int LyXText::leftMargin(pit_type pit) const
|
||||||
{
|
{
|
||||||
return leftMargin(pit, pars_[pit].size());
|
return leftMargin(pit, pars_[pit].size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LyXText::leftMargin(par_type const pit, pos_type const pos) const
|
int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
|
||||||
{
|
{
|
||||||
Paragraph const & par = pars_[pit];
|
Paragraph const & par = pars_[pit];
|
||||||
LyXTextClass const & tclass =
|
LyXTextClass const & tclass =
|
||||||
@ -491,8 +491,8 @@ int LyXText::leftMargin(par_type const pit, pos_type const pos) const
|
|||||||
|
|
||||||
if (par.getDepth() != 0) {
|
if (par.getDepth() != 0) {
|
||||||
// find the next level paragraph
|
// find the next level paragraph
|
||||||
par_type newpar = outerHook(pit, pars_);
|
pit_type newpar = outerHook(pit, pars_);
|
||||||
if (newpar != par_type(pars_.size())) {
|
if (newpar != pit_type(pars_.size())) {
|
||||||
if (pars_[newpar].layout()->isEnvironment()) {
|
if (pars_[newpar].layout()->isEnvironment()) {
|
||||||
l_margin = leftMargin(newpar);
|
l_margin = leftMargin(newpar);
|
||||||
}
|
}
|
||||||
@ -643,7 +643,7 @@ int LyXText::rightMargin(Paragraph const & par) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LyXText::labelEnd(par_type const pit) const
|
int LyXText::labelEnd(pit_type const pit) const
|
||||||
{
|
{
|
||||||
// labelEnd is only needed if the layout fills a flushleft label.
|
// labelEnd is only needed if the layout fills a flushleft label.
|
||||||
if (pars_[pit].layout()->margintype != MARGIN_MANUAL)
|
if (pars_[pit].layout()->margintype != MARGIN_MANUAL)
|
||||||
@ -670,7 +670,7 @@ pos_type addressBreakPoint(pos_type i, Paragraph const & par)
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void LyXText::rowBreakPoint(par_type const pit, Row & row) const
|
void LyXText::rowBreakPoint(pit_type const pit, Row & row) const
|
||||||
{
|
{
|
||||||
Paragraph const & par = pars_[pit];
|
Paragraph const & par = pars_[pit];
|
||||||
pos_type const end = par.size();
|
pos_type const end = par.size();
|
||||||
@ -786,7 +786,7 @@ void LyXText::rowBreakPoint(par_type const pit, Row & row) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::setRowWidth(par_type const pit, Row & row) const
|
void LyXText::setRowWidth(pit_type const pit, Row & row) const
|
||||||
{
|
{
|
||||||
// get the pure distance
|
// get the pure distance
|
||||||
pos_type const end = row.endpos();
|
pos_type const end = row.endpos();
|
||||||
@ -855,7 +855,7 @@ LColor_color LyXText::backgroundColor() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::setHeightOfRow(par_type const pit, Row & row)
|
void LyXText::setHeightOfRow(pit_type const pit, Row & row)
|
||||||
{
|
{
|
||||||
Paragraph const & par = pars_[pit];
|
Paragraph const & par = pars_[pit];
|
||||||
// get the maximum ascent and the maximum descent
|
// get the maximum ascent and the maximum descent
|
||||||
@ -959,7 +959,7 @@ void LyXText::setHeightOfRow(par_type const pit, Row & row)
|
|||||||
// a section, or between the items of a itemize or enumerate
|
// a section, or between the items of a itemize or enumerate
|
||||||
// environment.
|
// environment.
|
||||||
|
|
||||||
par_type prev = depthHook(pit, pars_, par.getDepth());
|
pit_type prev = depthHook(pit, pars_, par.getDepth());
|
||||||
if (prev != pit
|
if (prev != pit
|
||||||
&& pars_[prev].layout() == layout
|
&& pars_[prev].layout() == layout
|
||||||
&& pars_[prev].getDepth() == par.getDepth()
|
&& pars_[prev].getDepth() == par.getDepth()
|
||||||
@ -972,7 +972,7 @@ void LyXText::setHeightOfRow(par_type const pit, Row & row)
|
|||||||
}
|
}
|
||||||
|
|
||||||
prev = outerHook(pit, pars_);
|
prev = outerHook(pit, pars_);
|
||||||
if (prev != par_type(pars_.size())) {
|
if (prev != pit_type(pars_.size())) {
|
||||||
maxasc += int(pars_[prev].layout()->parsep * dh);
|
maxasc += int(pars_[prev].layout()->parsep * dh);
|
||||||
} else if (pit != 0) {
|
} else if (pit != 0) {
|
||||||
if (pars_[pit - 1].getDepth() != 0 ||
|
if (pars_[pit - 1].getDepth() != 0 ||
|
||||||
@ -987,9 +987,9 @@ void LyXText::setHeightOfRow(par_type const pit, Row & row)
|
|||||||
// add the layout spaces, for example before and after
|
// add the layout spaces, for example before and after
|
||||||
// a section, or between the items of a itemize or enumerate
|
// a section, or between the items of a itemize or enumerate
|
||||||
// environment
|
// environment
|
||||||
par_type nextpit = pit + 1;
|
pit_type nextpit = pit + 1;
|
||||||
if (nextpit != par_type(pars_.size())) {
|
if (nextpit != pit_type(pars_.size())) {
|
||||||
par_type cpit = pit;
|
pit_type cpit = pit;
|
||||||
double usual = 0;
|
double usual = 0;
|
||||||
double unusual = 0;
|
double unusual = 0;
|
||||||
|
|
||||||
@ -1029,7 +1029,7 @@ void LyXText::breakParagraph(LCursor & cur, char keep_layout)
|
|||||||
BOOST_ASSERT(this == cur.text());
|
BOOST_ASSERT(this == cur.text());
|
||||||
// allow only if at start or end, or all previous is new text
|
// allow only if at start or end, or all previous is new text
|
||||||
Paragraph & cpar = cur.paragraph();
|
Paragraph & cpar = cur.paragraph();
|
||||||
par_type cpit = cur.par();
|
pit_type cpit = cur.pit();
|
||||||
|
|
||||||
if (cur.pos() != 0 && cur.pos() != cur.lastpos()
|
if (cur.pos() != 0 && cur.pos() != cur.lastpos()
|
||||||
&& cpar.isChangeEdited(0, cur.pos()))
|
&& cpar.isChangeEdited(0, cur.pos()))
|
||||||
@ -1045,7 +1045,7 @@ void LyXText::breakParagraph(LCursor & cur, char keep_layout)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// a layout change may affect also the following paragraph
|
// a layout change may affect also the following paragraph
|
||||||
recUndo(cur.par(), undoSpan(cur.par()) - 1);
|
recUndo(cur.pit(), undoSpan(cur.pit()) - 1);
|
||||||
|
|
||||||
// Always break behind a space
|
// Always break behind a space
|
||||||
// It is better to erase the space (Dekel)
|
// It is better to erase the space (Dekel)
|
||||||
@ -1066,8 +1066,8 @@ void LyXText::breakParagraph(LCursor & cur, char keep_layout)
|
|||||||
::breakParagraph(cur.buffer().params(), paragraphs(), cpit,
|
::breakParagraph(cur.buffer().params(), paragraphs(), cpit,
|
||||||
cur.pos(), keep_layout);
|
cur.pos(), keep_layout);
|
||||||
|
|
||||||
cpit = cur.par();
|
cpit = cur.pit();
|
||||||
par_type next_par = cpit + 1;
|
pit_type next_par = cpit + 1;
|
||||||
|
|
||||||
// well this is the caption hack since one caption is really enough
|
// well this is the caption hack since one caption is really enough
|
||||||
if (layout->labeltype == LABEL_SENSITIVE) {
|
if (layout->labeltype == LABEL_SENSITIVE) {
|
||||||
@ -1099,9 +1099,9 @@ void LyXText::breakParagraph(LCursor & cur, char keep_layout)
|
|||||||
// This check is necessary. Otherwise the new empty paragraph will
|
// This check is necessary. Otherwise the new empty paragraph will
|
||||||
// be deleted automatically. And it is more friendly for the user!
|
// be deleted automatically. And it is more friendly for the user!
|
||||||
if (cur.pos() != 0 || isempty)
|
if (cur.pos() != 0 || isempty)
|
||||||
setCursor(cur, cur.par() + 1, 0);
|
setCursor(cur, cur.pit() + 1, 0);
|
||||||
else
|
else
|
||||||
setCursor(cur, cur.par(), 0);
|
setCursor(cur, cur.pit(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1110,8 +1110,8 @@ void LyXText::redoParagraph(LCursor & cur)
|
|||||||
{
|
{
|
||||||
BOOST_ASSERT(this == cur.text());
|
BOOST_ASSERT(this == cur.text());
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
redoParagraph(cur.par());
|
redoParagraph(cur.pit());
|
||||||
setCursorIntern(cur, cur.par(), cur.pos());
|
setCursorIntern(cur, cur.pit(), cur.pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1126,7 +1126,7 @@ void LyXText::insertChar(LCursor & cur, char c)
|
|||||||
|
|
||||||
Paragraph & par = cur.paragraph();
|
Paragraph & par = cur.paragraph();
|
||||||
// try to remove this
|
// try to remove this
|
||||||
par_type const pit = cur.par();
|
pit_type const pit = cur.pit();
|
||||||
|
|
||||||
bool const freeSpacing = par.layout()->free_spacing ||
|
bool const freeSpacing = par.layout()->free_spacing ||
|
||||||
par.isFreeSpacing();
|
par.isFreeSpacing();
|
||||||
@ -1212,7 +1212,7 @@ void LyXText::insertChar(LCursor & cur, char c)
|
|||||||
current_font = rawtmpfont;
|
current_font = rawtmpfont;
|
||||||
real_current_font = realtmpfont;
|
real_current_font = realtmpfont;
|
||||||
redoParagraph(cur);
|
redoParagraph(cur);
|
||||||
setCursor(cur, cur.par(), cur.pos() + 1, false, cur.boundary());
|
setCursor(cur, cur.pit(), cur.pos() + 1, false, cur.boundary());
|
||||||
charInserted();
|
charInserted();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1231,7 +1231,7 @@ void LyXText::charInserted()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RowMetrics LyXText::computeRowMetrics(par_type const pit, Row const & row) const
|
RowMetrics LyXText::computeRowMetrics(pit_type const pit, Row const & row) const
|
||||||
{
|
{
|
||||||
RowMetrics result;
|
RowMetrics result;
|
||||||
Paragraph const & par = pars_[pit];
|
Paragraph const & par = pars_[pit];
|
||||||
@ -1349,8 +1349,8 @@ RowMetrics LyXText::computeRowMetrics(par_type const pit, Row const & row) const
|
|||||||
void LyXText::cursorRightOneWord(LCursor & cur)
|
void LyXText::cursorRightOneWord(LCursor & cur)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(this == cur.text());
|
BOOST_ASSERT(this == cur.text());
|
||||||
if (cur.pos() == cur.lastpos() && cur.par() != cur.lastpar()) {
|
if (cur.pos() == cur.lastpos() && cur.pit() != cur.lastpit()) {
|
||||||
++cur.par();
|
++cur.pit();
|
||||||
cur.pos() = 0;
|
cur.pos() = 0;
|
||||||
} else {
|
} else {
|
||||||
// Skip through initial nonword stuff.
|
// Skip through initial nonword stuff.
|
||||||
@ -1361,15 +1361,15 @@ void LyXText::cursorRightOneWord(LCursor & cur)
|
|||||||
while (cur.pos() != cur.lastpos() && cur.paragraph().isLetter(cur.pos()))
|
while (cur.pos() != cur.lastpos() && cur.paragraph().isLetter(cur.pos()))
|
||||||
++cur.pos();
|
++cur.pos();
|
||||||
}
|
}
|
||||||
setCursor(cur, cur.par(), cur.pos());
|
setCursor(cur, cur.pit(), cur.pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::cursorLeftOneWord(LCursor & cur)
|
void LyXText::cursorLeftOneWord(LCursor & cur)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(this == cur.text());
|
BOOST_ASSERT(this == cur.text());
|
||||||
if (cur.pos() == 0 && cur.par() != 0) {
|
if (cur.pos() == 0 && cur.pit() != 0) {
|
||||||
--cur.par();
|
--cur.pit();
|
||||||
cur.pos() = cur.lastpos();
|
cur.pos() = cur.lastpos();
|
||||||
} else {
|
} else {
|
||||||
// Skip through initial nonword stuff.
|
// Skip through initial nonword stuff.
|
||||||
@ -1380,7 +1380,7 @@ void LyXText::cursorLeftOneWord(LCursor & cur)
|
|||||||
while (cur.pos() != 0 && cur.paragraph().isLetter(cur.pos() - 1))
|
while (cur.pos() != 0 && cur.paragraph().isLetter(cur.pos() - 1))
|
||||||
--cur.pos();
|
--cur.pos();
|
||||||
}
|
}
|
||||||
setCursor(cur, cur.par(), cur.pos());
|
setCursor(cur, cur.pit(), cur.pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1391,11 +1391,11 @@ void LyXText::selectWord(LCursor & cur, word_location loc)
|
|||||||
CursorSlice to = cur.top();
|
CursorSlice to = cur.top();
|
||||||
getWord(from, to, loc);
|
getWord(from, to, loc);
|
||||||
if (cur.top() != from)
|
if (cur.top() != from)
|
||||||
setCursor(cur, from.par(), from.pos());
|
setCursor(cur, from.pit(), from.pos());
|
||||||
if (to == from)
|
if (to == from)
|
||||||
return;
|
return;
|
||||||
cur.resetAnchor();
|
cur.resetAnchor();
|
||||||
setCursor(cur, to.par(), to.pos());
|
setCursor(cur, to.pit(), to.pos());
|
||||||
cur.setSelection();
|
cur.setSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1420,13 +1420,13 @@ void LyXText::acceptChange(LCursor & cur)
|
|||||||
|
|
||||||
CursorSlice const & startc = cur.selBegin();
|
CursorSlice const & startc = cur.selBegin();
|
||||||
CursorSlice const & endc = cur.selEnd();
|
CursorSlice const & endc = cur.selEnd();
|
||||||
if (startc.par() == endc.par()) {
|
if (startc.pit() == endc.pit()) {
|
||||||
recordUndoSelection(cur, Undo::INSERT);
|
recordUndoSelection(cur, Undo::INSERT);
|
||||||
pars_[startc.par()].acceptChange(startc.pos(), endc.pos());
|
pars_[startc.pit()].acceptChange(startc.pos(), endc.pos());
|
||||||
finishUndo();
|
finishUndo();
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
redoParagraph(startc.par());
|
redoParagraph(startc.pit());
|
||||||
setCursorIntern(cur, startc.par(), 0);
|
setCursorIntern(cur, startc.pit(), 0);
|
||||||
}
|
}
|
||||||
#ifdef WITH_WARNINGS
|
#ifdef WITH_WARNINGS
|
||||||
#warning handle multi par selection
|
#warning handle multi par selection
|
||||||
@ -1442,13 +1442,13 @@ void LyXText::rejectChange(LCursor & cur)
|
|||||||
|
|
||||||
CursorSlice const & startc = cur.selBegin();
|
CursorSlice const & startc = cur.selBegin();
|
||||||
CursorSlice const & endc = cur.selEnd();
|
CursorSlice const & endc = cur.selEnd();
|
||||||
if (startc.par() == endc.par()) {
|
if (startc.pit() == endc.pit()) {
|
||||||
recordUndoSelection(cur, Undo::INSERT);
|
recordUndoSelection(cur, Undo::INSERT);
|
||||||
pars_[startc.par()].rejectChange(startc.pos(), endc.pos());
|
pars_[startc.pit()].rejectChange(startc.pos(), endc.pos());
|
||||||
finishUndo();
|
finishUndo();
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
redoParagraph(startc.par());
|
redoParagraph(startc.pit());
|
||||||
setCursorIntern(cur, startc.par(), 0);
|
setCursorIntern(cur, startc.pit(), 0);
|
||||||
}
|
}
|
||||||
#ifdef WITH_WARNINGS
|
#ifdef WITH_WARNINGS
|
||||||
#warning handle multi par selection
|
#warning handle multi par selection
|
||||||
@ -1521,16 +1521,16 @@ void LyXText::changeCase(LCursor & cur, LyXText::TextCase action)
|
|||||||
} else {
|
} else {
|
||||||
from = cur.top();
|
from = cur.top();
|
||||||
getWord(from, to, lyx::PARTIAL_WORD);
|
getWord(from, to, lyx::PARTIAL_WORD);
|
||||||
setCursor(cur, to.par(), to.pos() + 1);
|
setCursor(cur, to.pit(), to.pos() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
recordUndoSelection(cur);
|
recordUndoSelection(cur);
|
||||||
|
|
||||||
pos_type pos = from.pos();
|
pos_type pos = from.pos();
|
||||||
int par = from.par();
|
int par = from.pit();
|
||||||
|
|
||||||
while (par != int(pars_.size()) && (pos != to.pos() || par != to.par())) {
|
while (par != int(pars_.size()) && (pos != to.pos() || par != to.pit())) {
|
||||||
par_type pit = par;
|
pit_type pit = par;
|
||||||
if (pos == pars_[pit].size()) {
|
if (pos == pars_[pit].size()) {
|
||||||
++par;
|
++par;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
@ -1564,8 +1564,8 @@ void LyXText::Delete(LCursor & cur)
|
|||||||
{
|
{
|
||||||
BOOST_ASSERT(this == cur.text());
|
BOOST_ASSERT(this == cur.text());
|
||||||
if (cur.pos() != cur.lastpos()) {
|
if (cur.pos() != cur.lastpos()) {
|
||||||
recordUndo(cur, Undo::DELETE, cur.par());
|
recordUndo(cur, Undo::DELETE, cur.pit());
|
||||||
setCursorIntern(cur, cur.par(), cur.pos() + 1, false, cur.boundary());
|
setCursorIntern(cur, cur.pit(), cur.pos() + 1, false, cur.boundary());
|
||||||
backspace(cur);
|
backspace(cur);
|
||||||
}
|
}
|
||||||
// should we do anything in an else branch?
|
// should we do anything in an else branch?
|
||||||
@ -1595,7 +1595,7 @@ void LyXText::backspace(LCursor & cur)
|
|||||||
// left and let the DeleteEmptyParagraphMechanism
|
// left and let the DeleteEmptyParagraphMechanism
|
||||||
// handle the actual deletion of the paragraph.
|
// handle the actual deletion of the paragraph.
|
||||||
|
|
||||||
if (cur.par() != 0) {
|
if (cur.pit() != 0) {
|
||||||
cursorLeft(cur);
|
cursorLeft(cur);
|
||||||
// the layout things can change the height of a row !
|
// the layout things can change the height of a row !
|
||||||
redoParagraph(cur);
|
redoParagraph(cur);
|
||||||
@ -1603,18 +1603,18 @@ void LyXText::backspace(LCursor & cur)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cur.par() != 0)
|
if (cur.pit() != 0)
|
||||||
recordUndo(cur, Undo::DELETE, cur.par() - 1);
|
recordUndo(cur, Undo::DELETE, cur.pit() - 1);
|
||||||
|
|
||||||
par_type tmppit = cur.par();
|
pit_type tmppit = cur.pit();
|
||||||
// We used to do cursorLeftIntern() here, but it is
|
// We used to do cursorLeftIntern() here, but it is
|
||||||
// not a good idea since it triggers the auto-delete
|
// not a good idea since it triggers the auto-delete
|
||||||
// mechanism. So we do a cursorLeftIntern()-lite,
|
// mechanism. So we do a cursorLeftIntern()-lite,
|
||||||
// without the dreaded mechanism. (JMarc)
|
// without the dreaded mechanism. (JMarc)
|
||||||
if (cur.par() != 0) {
|
if (cur.pit() != 0) {
|
||||||
// steps into the above paragraph.
|
// steps into the above paragraph.
|
||||||
setCursorIntern(cur, cur.par() - 1,
|
setCursorIntern(cur, cur.pit() - 1,
|
||||||
pars_[cur.par() - 1].size(),
|
pars_[cur.pit() - 1].size(),
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1625,7 +1625,7 @@ void LyXText::backspace(LCursor & cur)
|
|||||||
Buffer & buf = cur.buffer();
|
Buffer & buf = cur.buffer();
|
||||||
BufferParams const & bufparams = buf.params();
|
BufferParams const & bufparams = buf.params();
|
||||||
LyXTextClass const & tclass = bufparams.getLyXTextClass();
|
LyXTextClass const & tclass = bufparams.getLyXTextClass();
|
||||||
par_type const cpit = cur.par();
|
pit_type const cpit = cur.pit();
|
||||||
|
|
||||||
if (cpit != tmppit
|
if (cpit != tmppit
|
||||||
&& (pars_[cpit].layout() == pars_[tmppit].layout()
|
&& (pars_[cpit].layout() == pars_[tmppit].layout()
|
||||||
@ -1638,7 +1638,7 @@ void LyXText::backspace(LCursor & cur)
|
|||||||
|
|
||||||
// the counters may have changed
|
// the counters may have changed
|
||||||
updateCounters();
|
updateCounters();
|
||||||
setCursor(cur, cur.par(), cur.pos(), false);
|
setCursor(cur, cur.pit(), cur.pos(), false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// this is the code for a normal backspace, not pasting
|
// this is the code for a normal backspace, not pasting
|
||||||
@ -1648,7 +1648,7 @@ void LyXText::backspace(LCursor & cur)
|
|||||||
// not a good idea since it triggers the auto-delete
|
// not a good idea since it triggers the auto-delete
|
||||||
// mechanism. So we do a cursorLeftIntern()-lite,
|
// mechanism. So we do a cursorLeftIntern()-lite,
|
||||||
// without the dreaded mechanism. (JMarc)
|
// without the dreaded mechanism. (JMarc)
|
||||||
setCursorIntern(cur, cur.par(), cur.pos() - 1,
|
setCursorIntern(cur, cur.pit(), cur.pos() - 1,
|
||||||
false, cur.boundary());
|
false, cur.boundary());
|
||||||
cur.paragraph().erase(cur.pos());
|
cur.paragraph().erase(cur.pos());
|
||||||
}
|
}
|
||||||
@ -1657,11 +1657,11 @@ void LyXText::backspace(LCursor & cur)
|
|||||||
setCurrentFont(cur);
|
setCurrentFont(cur);
|
||||||
|
|
||||||
redoParagraph(cur);
|
redoParagraph(cur);
|
||||||
setCursor(cur, cur.par(), cur.pos(), false, cur.boundary());
|
setCursor(cur, cur.pit(), cur.pos(), false, cur.boundary());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Paragraph & LyXText::getPar(par_type par) const
|
Paragraph & LyXText::getPar(pit_type par) const
|
||||||
{
|
{
|
||||||
//lyxerr << "getPar: " << par << " from " << paragraphs().size() << endl;
|
//lyxerr << "getPar: " << par << " from " << paragraphs().size() << endl;
|
||||||
BOOST_ASSERT(par >= 0);
|
BOOST_ASSERT(par >= 0);
|
||||||
@ -1676,7 +1676,7 @@ Row const & LyXText::firstRow() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::redoParagraphInternal(par_type const pit)
|
void LyXText::redoParagraphInternal(pit_type const pit)
|
||||||
{
|
{
|
||||||
// remove rows of paragraph, keep track of height changes
|
// remove rows of paragraph, keep track of height changes
|
||||||
Paragraph & par = pars_[pit];
|
Paragraph & par = pars_[pit];
|
||||||
@ -1717,7 +1717,7 @@ void LyXText::redoParagraphInternal(par_type const pit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::redoParagraphs(par_type pit, par_type end)
|
void LyXText::redoParagraphs(pit_type pit, pit_type end)
|
||||||
{
|
{
|
||||||
for (; pit != end; ++pit)
|
for (; pit != end; ++pit)
|
||||||
redoParagraphInternal(pit);
|
redoParagraphInternal(pit);
|
||||||
@ -1726,7 +1726,7 @@ void LyXText::redoParagraphs(par_type pit, par_type end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::redoParagraph(par_type pit)
|
void LyXText::redoParagraph(pit_type pit)
|
||||||
{
|
{
|
||||||
redoParagraphInternal(pit);
|
redoParagraphInternal(pit);
|
||||||
updateParPositions();
|
updateParPositions();
|
||||||
@ -1777,14 +1777,14 @@ void LyXText::drawSelection(PainterInfo &, int, int) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LyXText::isLastRow(par_type pit, Row const & row) const
|
bool LyXText::isLastRow(pit_type pit, Row const & row) const
|
||||||
{
|
{
|
||||||
return row.endpos() >= pars_[pit].size()
|
return row.endpos() >= pars_[pit].size()
|
||||||
&& pit + 1 == par_type(paragraphs().size());
|
&& pit + 1 == pit_type(paragraphs().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LyXText::isFirstRow(par_type pit, Row const & row) const
|
bool LyXText::isFirstRow(pit_type pit, Row const & row) const
|
||||||
{
|
{
|
||||||
return row.pos() == 0 && pit == 0;
|
return row.pos() == 0 && pit == 0;
|
||||||
}
|
}
|
||||||
@ -1793,7 +1793,7 @@ bool LyXText::isFirstRow(par_type pit, Row const & row) const
|
|||||||
void LyXText::getWord(CursorSlice & from, CursorSlice & to,
|
void LyXText::getWord(CursorSlice & from, CursorSlice & to,
|
||||||
word_location const loc)
|
word_location const loc)
|
||||||
{
|
{
|
||||||
Paragraph const & from_par = pars_[from.par()];
|
Paragraph const & from_par = pars_[from.pit()];
|
||||||
switch (loc) {
|
switch (loc) {
|
||||||
case lyx::WHOLE_WORD_STRICT:
|
case lyx::WHOLE_WORD_STRICT:
|
||||||
if (from.pos() == 0 || from.pos() == from_par.size()
|
if (from.pos() == 0 || from.pos() == from_par.size()
|
||||||
@ -1824,7 +1824,7 @@ void LyXText::getWord(CursorSlice & from, CursorSlice & to,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
to = from;
|
to = from;
|
||||||
Paragraph & to_par = pars_[to.par()];
|
Paragraph & to_par = pars_[to.pit()];
|
||||||
while (to.pos() < to_par.size() && to_par.isLetter(to.pos()))
|
while (to.pos() < to_par.size() && to_par.isLetter(to.pos()))
|
||||||
++to.pos();
|
++to.pos();
|
||||||
}
|
}
|
||||||
@ -1914,7 +1914,7 @@ int LyXText::descent() const
|
|||||||
|
|
||||||
int LyXText::cursorX(CursorSlice const & cur) const
|
int LyXText::cursorX(CursorSlice const & cur) const
|
||||||
{
|
{
|
||||||
par_type const pit = cur.par();
|
pit_type const pit = cur.pit();
|
||||||
Paragraph const & par = pars_[pit];
|
Paragraph const & par = pars_[pit];
|
||||||
if (par.rows.empty())
|
if (par.rows.empty())
|
||||||
return xo_;
|
return xo_;
|
||||||
@ -1977,7 +1977,7 @@ int LyXText::cursorX(CursorSlice const & cur) const
|
|||||||
|
|
||||||
int LyXText::cursorY(CursorSlice const & cur) const
|
int LyXText::cursorY(CursorSlice const & cur) const
|
||||||
{
|
{
|
||||||
Paragraph const & par = getPar(cur.par());
|
Paragraph const & par = getPar(cur.pit());
|
||||||
Row const & row = *par.getRow(cur.pos());
|
Row const & row = *par.getRow(cur.pos());
|
||||||
return yo_ + par.y + row.y_offset() + row.baseline();
|
return yo_ + par.y + row.y_offset() + row.baseline();
|
||||||
}
|
}
|
||||||
@ -2048,7 +2048,7 @@ string LyXText::currentState(LCursor & cur)
|
|||||||
|
|
||||||
#ifdef DEVEL_VERSION
|
#ifdef DEVEL_VERSION
|
||||||
os << _(", Inset: ") << &cur.inset();
|
os << _(", Inset: ") << &cur.inset();
|
||||||
os << _(", Paragraph: ") << cur.par();
|
os << _(", Paragraph: ") << cur.pit();
|
||||||
os << _(", Id: ") << par.id();
|
os << _(", Id: ") << par.id();
|
||||||
os << _(", Position: ") << cur.pos();
|
os << _(", Position: ") << cur.pos();
|
||||||
Row & row = cur.textRow();
|
Row & row = cur.textRow();
|
||||||
@ -2060,7 +2060,7 @@ string LyXText::currentState(LCursor & cur)
|
|||||||
|
|
||||||
string LyXText::getPossibleLabel(LCursor & cur) const
|
string LyXText::getPossibleLabel(LCursor & cur) const
|
||||||
{
|
{
|
||||||
par_type pit = cur.par();
|
pit_type pit = cur.pit();
|
||||||
|
|
||||||
LyXLayout_ptr layout = pars_[pit].layout();
|
LyXLayout_ptr layout = pars_[pit].layout();
|
||||||
|
|
||||||
|
188
src/text2.C
188
src/text2.C
@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
using lyx::par_type;
|
using lyx::pit_type;
|
||||||
using lyx::pos_type;
|
using lyx::pos_type;
|
||||||
using lyx::support::bformat;
|
using lyx::support::bformat;
|
||||||
|
|
||||||
@ -86,8 +86,8 @@ void LyXText::init(BufferView * bv)
|
|||||||
width_ = maxwidth_;
|
width_ = maxwidth_;
|
||||||
height_ = 0;
|
height_ = 0;
|
||||||
|
|
||||||
par_type const end = paragraphs().size();
|
pit_type const end = paragraphs().size();
|
||||||
for (par_type pit = 0; pit != end; ++pit)
|
for (pit_type pit = 0; pit != end; ++pit)
|
||||||
pars_[pit].rows.clear();
|
pars_[pit].rows.clear();
|
||||||
|
|
||||||
current_font = getFont(pars_[0], 0);
|
current_font = getFont(pars_[0], 0);
|
||||||
@ -105,8 +105,8 @@ bool LyXText::isMainText() const
|
|||||||
// takes absolute x,y coordinates
|
// takes absolute x,y coordinates
|
||||||
InsetBase * LyXText::checkInsetHit(int x, int y) const
|
InsetBase * LyXText::checkInsetHit(int x, int y) const
|
||||||
{
|
{
|
||||||
par_type pit;
|
pit_type pit;
|
||||||
par_type end;
|
pit_type end;
|
||||||
|
|
||||||
getParsInRange(paragraphs(),
|
getParsInRange(paragraphs(),
|
||||||
bv()->top_y() - yo_,
|
bv()->top_y() - yo_,
|
||||||
@ -191,7 +191,7 @@ LyXFont LyXText::getFont(Paragraph const & par, pos_type const pos) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LyXFont LyXText::getLayoutFont(par_type const pit) const
|
LyXFont LyXText::getLayoutFont(pit_type const pit) const
|
||||||
{
|
{
|
||||||
LyXLayout_ptr const & layout = pars_[pit].layout();
|
LyXLayout_ptr const & layout = pars_[pit].layout();
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ LyXFont LyXText::getLabelFont(Paragraph const & par) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::setCharFont(par_type pit, pos_type pos, LyXFont const & fnt)
|
void LyXText::setCharFont(pit_type pit, pos_type pos, LyXFont const & fnt)
|
||||||
{
|
{
|
||||||
LyXFont font = fnt;
|
LyXFont font = fnt;
|
||||||
LyXLayout_ptr const & layout = pars_[pit].layout();
|
LyXLayout_ptr const & layout = pars_[pit].layout();
|
||||||
@ -237,12 +237,12 @@ void LyXText::setCharFont(par_type pit, pos_type pos, LyXFont const & fnt)
|
|||||||
|
|
||||||
// Realize against environment font information
|
// Realize against environment font information
|
||||||
if (pars_[pit].getDepth()) {
|
if (pars_[pit].getDepth()) {
|
||||||
par_type tp = pit;
|
pit_type tp = pit;
|
||||||
while (!layoutfont.resolved() &&
|
while (!layoutfont.resolved() &&
|
||||||
tp != par_type(paragraphs().size()) &&
|
tp != pit_type(paragraphs().size()) &&
|
||||||
pars_[tp].getDepth()) {
|
pars_[tp].getDepth()) {
|
||||||
tp = outerHook(tp, paragraphs());
|
tp = outerHook(tp, paragraphs());
|
||||||
if (tp != par_type(paragraphs().size()))
|
if (tp != pit_type(paragraphs().size()))
|
||||||
layoutfont.realize(pars_[tp].layout()->font);
|
layoutfont.realize(pars_[tp].layout()->font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -279,10 +279,10 @@ void LyXText::makeFontEntriesLayoutSpecific(BufferParams const & params,
|
|||||||
|
|
||||||
|
|
||||||
// return past-the-last paragraph influenced by a layout change on pit
|
// return past-the-last paragraph influenced by a layout change on pit
|
||||||
par_type LyXText::undoSpan(par_type pit)
|
pit_type LyXText::undoSpan(pit_type pit)
|
||||||
{
|
{
|
||||||
par_type end = paragraphs().size();
|
pit_type end = paragraphs().size();
|
||||||
par_type nextpit = pit + 1;
|
pit_type nextpit = pit + 1;
|
||||||
if (nextpit == end)
|
if (nextpit == end)
|
||||||
return nextpit;
|
return nextpit;
|
||||||
//because of parindents
|
//because of parindents
|
||||||
@ -297,16 +297,16 @@ par_type LyXText::undoSpan(par_type pit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
par_type LyXText::setLayout(par_type start, par_type end, string const & layout)
|
pit_type LyXText::setLayout(pit_type start, pit_type end, string const & layout)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(start != end);
|
BOOST_ASSERT(start != end);
|
||||||
par_type undopit = undoSpan(end - 1);
|
pit_type undopit = undoSpan(end - 1);
|
||||||
recUndo(start, undopit - 1);
|
recUndo(start, undopit - 1);
|
||||||
|
|
||||||
BufferParams const & bufparams = bv()->buffer()->params();
|
BufferParams const & bufparams = bv()->buffer()->params();
|
||||||
LyXLayout_ptr const & lyxlayout = bufparams.getLyXTextClass()[layout];
|
LyXLayout_ptr const & lyxlayout = bufparams.getLyXTextClass()[layout];
|
||||||
|
|
||||||
for (par_type pit = start; pit != end; ++pit) {
|
for (pit_type pit = start; pit != end; ++pit) {
|
||||||
pars_[pit].applyLayout(lyxlayout);
|
pars_[pit].applyLayout(lyxlayout);
|
||||||
makeFontEntriesLayoutSpecific(bufparams, pars_[pit]);
|
makeFontEntriesLayoutSpecific(bufparams, pars_[pit]);
|
||||||
if (lyxlayout->margintype == MARGIN_MANUAL)
|
if (lyxlayout->margintype == MARGIN_MANUAL)
|
||||||
@ -338,9 +338,9 @@ void LyXText::setLayout(LCursor & cur, string const & layout)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
par_type start = cur.selBegin().par();
|
pit_type start = cur.selBegin().pit();
|
||||||
par_type end = cur.selEnd().par() + 1;
|
pit_type end = cur.selEnd().pit() + 1;
|
||||||
par_type endpit = setLayout(start, end, layout);
|
pit_type endpit = setLayout(start, end, layout);
|
||||||
redoParagraphs(start, endpit);
|
redoParagraphs(start, endpit);
|
||||||
updateCounters();
|
updateCounters();
|
||||||
}
|
}
|
||||||
@ -349,14 +349,14 @@ void LyXText::setLayout(LCursor & cur, string const & layout)
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
||||||
void getSelectionSpan(LCursor & cur, par_type & beg, par_type & end)
|
void getSelectionSpan(LCursor & cur, pit_type & beg, pit_type & end)
|
||||||
{
|
{
|
||||||
if (!cur.selection()) {
|
if (!cur.selection()) {
|
||||||
beg = cur.par();
|
beg = cur.pit();
|
||||||
end = cur.par() + 1;
|
end = cur.pit() + 1;
|
||||||
} else {
|
} else {
|
||||||
beg = cur.selBegin().par();
|
beg = cur.selBegin().pit();
|
||||||
end = cur.selEnd().par() + 1;
|
end = cur.selEnd().pit() + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,13 +381,13 @@ bool changeDepthAllowed(LyXText::DEPTH_CHANGE type,
|
|||||||
bool LyXText::changeDepthAllowed(LCursor & cur, DEPTH_CHANGE type) const
|
bool LyXText::changeDepthAllowed(LCursor & cur, DEPTH_CHANGE type) const
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(this == cur.text());
|
BOOST_ASSERT(this == cur.text());
|
||||||
par_type beg, end;
|
pit_type beg, end;
|
||||||
getSelectionSpan(cur, beg, end);
|
getSelectionSpan(cur, beg, end);
|
||||||
int max_depth = 0;
|
int max_depth = 0;
|
||||||
if (beg != 0)
|
if (beg != 0)
|
||||||
max_depth = pars_[beg - 1].getMaxDepthAfter();
|
max_depth = pars_[beg - 1].getMaxDepthAfter();
|
||||||
|
|
||||||
for (par_type pit = beg; pit != end; ++pit) {
|
for (pit_type pit = beg; pit != end; ++pit) {
|
||||||
if (::changeDepthAllowed(type, pars_[pit], max_depth))
|
if (::changeDepthAllowed(type, pars_[pit], max_depth))
|
||||||
return true;
|
return true;
|
||||||
max_depth = pars_[pit].getMaxDepthAfter();
|
max_depth = pars_[pit].getMaxDepthAfter();
|
||||||
@ -399,7 +399,7 @@ bool LyXText::changeDepthAllowed(LCursor & cur, DEPTH_CHANGE type) const
|
|||||||
void LyXText::changeDepth(LCursor & cur, DEPTH_CHANGE type)
|
void LyXText::changeDepth(LCursor & cur, DEPTH_CHANGE type)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(this == cur.text());
|
BOOST_ASSERT(this == cur.text());
|
||||||
par_type beg, end;
|
pit_type beg, end;
|
||||||
getSelectionSpan(cur, beg, end);
|
getSelectionSpan(cur, beg, end);
|
||||||
recordUndoSelection(cur);
|
recordUndoSelection(cur);
|
||||||
|
|
||||||
@ -407,7 +407,7 @@ void LyXText::changeDepth(LCursor & cur, DEPTH_CHANGE type)
|
|||||||
if (beg != 0)
|
if (beg != 0)
|
||||||
max_depth = pars_[beg - 1].getMaxDepthAfter();
|
max_depth = pars_[beg - 1].getMaxDepthAfter();
|
||||||
|
|
||||||
for (par_type pit = beg; pit != end; ++pit) {
|
for (pit_type pit = beg; pit != end; ++pit) {
|
||||||
if (::changeDepthAllowed(type, pars_[pit], max_depth)) {
|
if (::changeDepthAllowed(type, pars_[pit], max_depth)) {
|
||||||
int const depth = pars_[pit].params().depth();
|
int const depth = pars_[pit].params().depth();
|
||||||
if (type == INC_DEPTH)
|
if (type == INC_DEPTH)
|
||||||
@ -431,7 +431,7 @@ void LyXText::setFont(LCursor & cur, LyXFont const & font, bool toggleall)
|
|||||||
if (!cur.selection()) {
|
if (!cur.selection()) {
|
||||||
// Determine basis font
|
// Determine basis font
|
||||||
LyXFont layoutfont;
|
LyXFont layoutfont;
|
||||||
par_type pit = cur.par();
|
pit_type pit = cur.pit();
|
||||||
if (cur.pos() < pars_[pit].beginOfBody())
|
if (cur.pos() < pars_[pit].beginOfBody())
|
||||||
layoutfont = getLabelFont(pars_[pit]);
|
layoutfont = getLabelFont(pars_[pit]);
|
||||||
else
|
else
|
||||||
@ -454,8 +454,8 @@ void LyXText::setFont(LCursor & cur, LyXFont const & font, bool toggleall)
|
|||||||
// Ok, we have a selection.
|
// Ok, we have a selection.
|
||||||
recordUndoSelection(cur);
|
recordUndoSelection(cur);
|
||||||
|
|
||||||
par_type const beg = cur.selBegin().par();
|
pit_type const beg = cur.selBegin().pit();
|
||||||
par_type const end = cur.selEnd().par();
|
pit_type const end = cur.selEnd().pit();
|
||||||
|
|
||||||
DocIterator dit = cur.selectionBegin();
|
DocIterator dit = cur.selectionBegin();
|
||||||
DocIterator ditend = cur.selectionEnd();
|
DocIterator ditend = cur.selectionEnd();
|
||||||
@ -468,7 +468,7 @@ void LyXText::setFont(LCursor & cur, LyXFont const & font, bool toggleall)
|
|||||||
if (dit.pos() != dit.lastpos()) {
|
if (dit.pos() != dit.lastpos()) {
|
||||||
LyXFont f = getFont(dit.paragraph(), dit.pos());
|
LyXFont f = getFont(dit.paragraph(), dit.pos());
|
||||||
f.update(font, params.language, toggleall);
|
f.update(font, params.language, toggleall);
|
||||||
setCharFont(dit.par(), dit.pos(), f);
|
setCharFont(dit.pit(), dit.pos(), f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,7 +482,7 @@ void LyXText::setFont(LCursor & cur, LyXFont const & font, bool toggleall)
|
|||||||
void LyXText::cursorHome(LCursor & cur)
|
void LyXText::cursorHome(LCursor & cur)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(this == cur.text());
|
BOOST_ASSERT(this == cur.text());
|
||||||
setCursor(cur, cur.par(), cur.textRow().pos());
|
setCursor(cur, cur.pit(), cur.textRow().pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -492,7 +492,7 @@ void LyXText::cursorEnd(LCursor & cur)
|
|||||||
// if not on the last row of the par, put the cursor before
|
// if not on the last row of the par, put the cursor before
|
||||||
// the final space
|
// the final space
|
||||||
pos_type const end = cur.textRow().endpos();
|
pos_type const end = cur.textRow().endpos();
|
||||||
setCursor(cur, cur.par(), end == cur.lastpos() ? end : end - 1);
|
setCursor(cur, cur.pit(), end == cur.lastpos() ? end : end - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -506,7 +506,7 @@ void LyXText::cursorTop(LCursor & cur)
|
|||||||
void LyXText::cursorBottom(LCursor & cur)
|
void LyXText::cursorBottom(LCursor & cur)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(this == cur.text());
|
BOOST_ASSERT(this == cur.text());
|
||||||
setCursor(cur, cur.lastpar(), boost::prior(paragraphs().end())->size());
|
setCursor(cur, cur.lastpit(), boost::prior(paragraphs().end())->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -556,7 +556,7 @@ string LyXText::getStringToIndex(LCursor & cur)
|
|||||||
string idxstring;
|
string idxstring;
|
||||||
if (!cur.selection())
|
if (!cur.selection())
|
||||||
cur.message(_("Nothing to index!"));
|
cur.message(_("Nothing to index!"));
|
||||||
else if (cur.selBegin().par() != cur.selEnd().par())
|
else if (cur.selBegin().pit() != cur.selEnd().pit())
|
||||||
cur.message(_("Cannot index more than one paragraph!"));
|
cur.message(_("Cannot index more than one paragraph!"));
|
||||||
else
|
else
|
||||||
idxstring = cur.selectionAsString(false);
|
idxstring = cur.selectionAsString(false);
|
||||||
@ -579,10 +579,10 @@ void LyXText::setParagraph(LCursor & cur,
|
|||||||
{
|
{
|
||||||
BOOST_ASSERT(cur.text());
|
BOOST_ASSERT(cur.text());
|
||||||
// make sure that the depth behind the selection are restored, too
|
// make sure that the depth behind the selection are restored, too
|
||||||
par_type undopit = undoSpan(cur.selEnd().par());
|
pit_type undopit = undoSpan(cur.selEnd().pit());
|
||||||
recUndo(cur.selBegin().par(), undopit - 1);
|
recUndo(cur.selBegin().pit(), undopit - 1);
|
||||||
|
|
||||||
for (par_type pit = cur.selBegin().par(), end = cur.selEnd().par();
|
for (pit_type pit = cur.selBegin().pit(), end = cur.selEnd().pit();
|
||||||
pit <= end; ++pit) {
|
pit <= end; ++pit) {
|
||||||
Paragraph & par = pars_[pit];
|
Paragraph & par = pars_[pit];
|
||||||
ParagraphParameters & params = par.params();
|
ParagraphParameters & params = par.params();
|
||||||
@ -603,7 +603,7 @@ void LyXText::setParagraph(LCursor & cur,
|
|||||||
params.noindent(noindent);
|
params.noindent(noindent);
|
||||||
}
|
}
|
||||||
|
|
||||||
redoParagraphs(cur.selBegin().par(), undopit);
|
redoParagraphs(cur.selBegin().pit(), undopit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -631,7 +631,7 @@ string expandLabel(LyXTextClass const & textclass,
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void incrementItemDepth(ParagraphList & pars, par_type pit, par_type first_pit)
|
void incrementItemDepth(ParagraphList & pars, pit_type pit, pit_type first_pit)
|
||||||
{
|
{
|
||||||
int const cur_labeltype = pars[pit].layout()->labeltype;
|
int const cur_labeltype = pars[pit].layout()->labeltype;
|
||||||
|
|
||||||
@ -640,7 +640,7 @@ void incrementItemDepth(ParagraphList & pars, par_type pit, par_type first_pit)
|
|||||||
|
|
||||||
int const cur_depth = pars[pit].getDepth();
|
int const cur_depth = pars[pit].getDepth();
|
||||||
|
|
||||||
par_type prev_pit = pit - 1;
|
pit_type prev_pit = pit - 1;
|
||||||
while (true) {
|
while (true) {
|
||||||
int const prev_depth = pars[prev_pit].getDepth();
|
int const prev_depth = pars[prev_pit].getDepth();
|
||||||
int const prev_labeltype = pars[prev_pit].layout()->labeltype;
|
int const prev_labeltype = pars[prev_pit].layout()->labeltype;
|
||||||
@ -668,14 +668,14 @@ void incrementItemDepth(ParagraphList & pars, par_type pit, par_type first_pit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void resetEnumCounterIfNeeded(ParagraphList & pars, par_type pit,
|
void resetEnumCounterIfNeeded(ParagraphList & pars, pit_type pit,
|
||||||
par_type firstpit, Counters & counters)
|
pit_type firstpit, Counters & counters)
|
||||||
{
|
{
|
||||||
if (pit == firstpit)
|
if (pit == firstpit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int const cur_depth = pars[pit].getDepth();
|
int const cur_depth = pars[pit].getDepth();
|
||||||
par_type prev_pit = pit - 1;
|
pit_type prev_pit = pit - 1;
|
||||||
while (true) {
|
while (true) {
|
||||||
int const prev_depth = pars[prev_pit].getDepth();
|
int const prev_depth = pars[prev_pit].getDepth();
|
||||||
int const prev_labeltype = pars[prev_pit].layout()->labeltype;
|
int const prev_labeltype = pars[prev_pit].layout()->labeltype;
|
||||||
@ -706,7 +706,7 @@ void resetEnumCounterIfNeeded(ParagraphList & pars, par_type pit,
|
|||||||
|
|
||||||
|
|
||||||
// set the counter of a paragraph. This includes the labels
|
// set the counter of a paragraph. This includes the labels
|
||||||
void LyXText::setCounter(Buffer const & buf, par_type pit)
|
void LyXText::setCounter(Buffer const & buf, pit_type pit)
|
||||||
{
|
{
|
||||||
Paragraph & par = pars_[pit];
|
Paragraph & par = pars_[pit];
|
||||||
BufferParams const & bufparams = buf.params();
|
BufferParams const & bufparams = buf.params();
|
||||||
@ -812,8 +812,8 @@ void LyXText::setCounter(Buffer const & buf, par_type pit)
|
|||||||
|
|
||||||
// the caption hack:
|
// the caption hack:
|
||||||
if (layout->labeltype == LABEL_SENSITIVE) {
|
if (layout->labeltype == LABEL_SENSITIVE) {
|
||||||
par_type end = paragraphs().size();
|
pit_type end = paragraphs().size();
|
||||||
par_type tmppit = pit;
|
pit_type tmppit = pit;
|
||||||
InsetBase * in = 0;
|
InsetBase * in = 0;
|
||||||
bool isOK = false;
|
bool isOK = false;
|
||||||
while (tmppit != end) {
|
while (tmppit != end) {
|
||||||
@ -881,8 +881,8 @@ void LyXText::updateCounters()
|
|||||||
|
|
||||||
bool update_pos = false;
|
bool update_pos = false;
|
||||||
|
|
||||||
par_type end = paragraphs().size();
|
pit_type end = paragraphs().size();
|
||||||
for (par_type pit = 0; pit != end; ++pit) {
|
for (pit_type pit = 0; pit != end; ++pit) {
|
||||||
string const oldLabel = pars_[pit].params().labelString();
|
string const oldLabel = pars_[pit].params().labelString();
|
||||||
size_t maxdepth = 0;
|
size_t maxdepth = 0;
|
||||||
if (pit != 0)
|
if (pit != 0)
|
||||||
@ -919,8 +919,8 @@ void LyXText::insertInset(LCursor & cur, InsetBase * inset)
|
|||||||
// needed to insert the selection
|
// needed to insert the selection
|
||||||
void LyXText::insertStringAsLines(LCursor & cur, string const & str)
|
void LyXText::insertStringAsLines(LCursor & cur, string const & str)
|
||||||
{
|
{
|
||||||
par_type pit = cur.par();
|
pit_type pit = cur.pit();
|
||||||
par_type endpit = cur.par() + 1;
|
pit_type endpit = cur.pit() + 1;
|
||||||
pos_type pos = cur.pos();
|
pos_type pos = cur.pos();
|
||||||
recordUndo(cur);
|
recordUndo(cur);
|
||||||
|
|
||||||
@ -928,9 +928,9 @@ void LyXText::insertStringAsLines(LCursor & cur, string const & str)
|
|||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
cur.buffer().insertStringAsLines(pars_, pit, pos, current_font, str);
|
cur.buffer().insertStringAsLines(pars_, pit, pos, current_font, str);
|
||||||
|
|
||||||
redoParagraphs(cur.par(), endpit);
|
redoParagraphs(cur.pit(), endpit);
|
||||||
cur.resetAnchor();
|
cur.resetAnchor();
|
||||||
setCursor(cur, cur.par(), pos);
|
setCursor(cur, cur.pit(), pos);
|
||||||
cur.setSelection();
|
cur.setSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -962,7 +962,7 @@ void LyXText::insertStringAsParagraphs(LCursor & cur, string const & str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LyXText::setCursor(LCursor & cur, par_type par, pos_type pos,
|
bool LyXText::setCursor(LCursor & cur, pit_type par, pos_type pos,
|
||||||
bool setfont, bool boundary)
|
bool setfont, bool boundary)
|
||||||
{
|
{
|
||||||
LCursor old = cur;
|
LCursor old = cur;
|
||||||
@ -971,12 +971,12 @@ bool LyXText::setCursor(LCursor & cur, par_type par, pos_type pos,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::setCursor(CursorSlice & cur, par_type par,
|
void LyXText::setCursor(CursorSlice & cur, pit_type par,
|
||||||
pos_type pos, bool boundary)
|
pos_type pos, bool boundary)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(par != int(paragraphs().size()));
|
BOOST_ASSERT(par != int(paragraphs().size()));
|
||||||
|
|
||||||
cur.par() = par;
|
cur.pit() = par;
|
||||||
cur.pos() = pos;
|
cur.pos() = pos;
|
||||||
cur.boundary() = boundary;
|
cur.boundary() = boundary;
|
||||||
|
|
||||||
@ -1023,7 +1023,7 @@ void LyXText::setCursor(CursorSlice & cur, par_type par,
|
|||||||
|
|
||||||
|
|
||||||
void LyXText::setCursorIntern(LCursor & cur,
|
void LyXText::setCursorIntern(LCursor & cur,
|
||||||
par_type par, pos_type pos, bool setfont, bool boundary)
|
pit_type par, pos_type pos, bool setfont, bool boundary)
|
||||||
{
|
{
|
||||||
setCursor(cur.top(), par, pos, boundary);
|
setCursor(cur.top(), par, pos, boundary);
|
||||||
cur.x_target() = cursorX(cur.top());
|
cur.x_target() = cursorX(cur.top());
|
||||||
@ -1074,7 +1074,7 @@ void LyXText::setCurrentFont(LCursor & cur)
|
|||||||
// x is an absolute screen coord
|
// x is an absolute screen coord
|
||||||
// returns the column near the specified x-coordinate of the row
|
// returns the column near the specified x-coordinate of the row
|
||||||
// x is set to the real beginning of this column
|
// x is set to the real beginning of this column
|
||||||
pos_type LyXText::getColumnNearX(par_type const pit,
|
pos_type LyXText::getColumnNearX(pit_type const pit,
|
||||||
Row const & row, int & x, bool & boundary) const
|
Row const & row, int & x, bool & boundary) const
|
||||||
{
|
{
|
||||||
x -= xo_;
|
x -= xo_;
|
||||||
@ -1176,11 +1176,11 @@ pos_type LyXText::getColumnNearX(par_type const pit,
|
|||||||
|
|
||||||
// y is relative to this LyXText's top
|
// y is relative to this LyXText's top
|
||||||
// this is only used in the two functions below
|
// this is only used in the two functions below
|
||||||
Row const & LyXText::getRowNearY(int y, par_type & pit) const
|
Row const & LyXText::getRowNearY(int y, pit_type & pit) const
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(!paragraphs().empty());
|
BOOST_ASSERT(!paragraphs().empty());
|
||||||
BOOST_ASSERT(!paragraphs().begin()->rows.empty());
|
BOOST_ASSERT(!paragraphs().begin()->rows.empty());
|
||||||
par_type const pend = paragraphs().size() - 1;
|
pit_type const pend = paragraphs().size() - 1;
|
||||||
pit = 0;
|
pit = 0;
|
||||||
while (int(pars_[pit].y + pars_[pit].height) < y && pit != pend)
|
while (int(pars_[pit].y + pars_[pit].height) < y && pit != pend)
|
||||||
++pit;
|
++pit;
|
||||||
@ -1201,7 +1201,7 @@ void LyXText::setCursorFromCoordinates(LCursor & cur, int x, int y)
|
|||||||
{
|
{
|
||||||
x -= xo_;
|
x -= xo_;
|
||||||
y -= yo_;
|
y -= yo_;
|
||||||
par_type pit;
|
pit_type pit;
|
||||||
Row const & row = getRowNearY(y, pit);
|
Row const & row = getRowNearY(y, pit);
|
||||||
lyxerr[Debug::DEBUG] << "setCursorFromCoordinates:: hit row at: "
|
lyxerr[Debug::DEBUG] << "setCursorFromCoordinates:: hit row at: "
|
||||||
<< row.pos() << endl;
|
<< row.pos() << endl;
|
||||||
@ -1216,13 +1216,13 @@ void LyXText::setCursorFromCoordinates(LCursor & cur, int x, int y)
|
|||||||
// sets cursor recursively descending into nested editable insets
|
// sets cursor recursively descending into nested editable insets
|
||||||
InsetBase * LyXText::editXY(LCursor & cur, int x, int y) const
|
InsetBase * LyXText::editXY(LCursor & cur, int x, int y) const
|
||||||
{
|
{
|
||||||
par_type pit;
|
pit_type pit;
|
||||||
Row const & row = getRowNearY(y - yo_, pit);
|
Row const & row = getRowNearY(y - yo_, pit);
|
||||||
bool bound = false;
|
bool bound = false;
|
||||||
|
|
||||||
int xx = x; // is modified by getColumnNearX
|
int xx = x; // is modified by getColumnNearX
|
||||||
pos_type const pos = row.pos() + getColumnNearX(pit, row, xx, bound);
|
pos_type const pos = row.pos() + getColumnNearX(pit, row, xx, bound);
|
||||||
cur.par() = pit;
|
cur.pit() = pit;
|
||||||
cur.pos() = pos;
|
cur.pos() = pos;
|
||||||
cur.boundary() = bound;
|
cur.boundary() = bound;
|
||||||
|
|
||||||
@ -1262,18 +1262,18 @@ void LyXText::cursorLeft(LCursor & cur)
|
|||||||
{
|
{
|
||||||
if (cur.pos() != 0) {
|
if (cur.pos() != 0) {
|
||||||
bool boundary = cur.boundary();
|
bool boundary = cur.boundary();
|
||||||
setCursor(cur, cur.par(), cur.pos() - 1, true, false);
|
setCursor(cur, cur.pit(), cur.pos() - 1, true, false);
|
||||||
if (!checkAndActivateInset(cur, false)) {
|
if (!checkAndActivateInset(cur, false)) {
|
||||||
if (false && !boundary &&
|
if (false && !boundary &&
|
||||||
bidi.isBoundary(cur.buffer(), cur.paragraph(), cur.pos() + 1))
|
bidi.isBoundary(cur.buffer(), cur.paragraph(), cur.pos() + 1))
|
||||||
setCursor(cur, cur.par(), cur.pos() + 1, true, true);
|
setCursor(cur, cur.pit(), cur.pos() + 1, true, true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cur.par() != 0) {
|
if (cur.pit() != 0) {
|
||||||
// steps into the paragraph above
|
// steps into the paragraph above
|
||||||
setCursor(cur, cur.par() - 1, getPar(cur.par() - 1).size());
|
setCursor(cur, cur.pit() - 1, getPar(cur.pit() - 1).size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1281,22 +1281,22 @@ void LyXText::cursorLeft(LCursor & cur)
|
|||||||
void LyXText::cursorRight(LCursor & cur)
|
void LyXText::cursorRight(LCursor & cur)
|
||||||
{
|
{
|
||||||
if (false && cur.boundary()) {
|
if (false && cur.boundary()) {
|
||||||
setCursor(cur, cur.par(), cur.pos(), true, false);
|
setCursor(cur, cur.pit(), cur.pos(), true, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cur.pos() != cur.lastpos()) {
|
if (cur.pos() != cur.lastpos()) {
|
||||||
if (!checkAndActivateInset(cur, true)) {
|
if (!checkAndActivateInset(cur, true)) {
|
||||||
setCursor(cur, cur.par(), cur.pos() + 1, true, false);
|
setCursor(cur, cur.pit(), cur.pos() + 1, true, false);
|
||||||
if (false && bidi.isBoundary(cur.buffer(), cur.paragraph(),
|
if (false && bidi.isBoundary(cur.buffer(), cur.paragraph(),
|
||||||
cur.pos()))
|
cur.pos()))
|
||||||
setCursor(cur, cur.par(), cur.pos(), true, true);
|
setCursor(cur, cur.pit(), cur.pos(), true, true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cur.par() != cur.lastpar())
|
if (cur.pit() != cur.lastpit())
|
||||||
setCursor(cur, cur.par() + 1, 0);
|
setCursor(cur, cur.pit() + 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1333,18 +1333,18 @@ void LyXText::cursorDown(LCursor & cur)
|
|||||||
void LyXText::cursorUpParagraph(LCursor & cur)
|
void LyXText::cursorUpParagraph(LCursor & cur)
|
||||||
{
|
{
|
||||||
if (cur.pos() > 0)
|
if (cur.pos() > 0)
|
||||||
setCursor(cur, cur.par(), 0);
|
setCursor(cur, cur.pit(), 0);
|
||||||
else if (cur.par() != 0)
|
else if (cur.pit() != 0)
|
||||||
setCursor(cur, cur.par() - 1, 0);
|
setCursor(cur, cur.pit() - 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::cursorDownParagraph(LCursor & cur)
|
void LyXText::cursorDownParagraph(LCursor & cur)
|
||||||
{
|
{
|
||||||
if (cur.par() != cur.lastpar())
|
if (cur.pit() != cur.lastpit())
|
||||||
setCursor(cur, cur.par() + 1, 0);
|
setCursor(cur, cur.pit() + 1, 0);
|
||||||
else
|
else
|
||||||
setCursor(cur, cur.par(), cur.lastpos());
|
setCursor(cur, cur.pit(), cur.lastpos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1354,7 +1354,7 @@ void LyXText::fixCursorAfterDelete(CursorSlice & cur, CursorSlice const & where)
|
|||||||
{
|
{
|
||||||
// do notheing if cursor is not in the paragraph where the
|
// do notheing if cursor is not in the paragraph where the
|
||||||
// deletion occured,
|
// deletion occured,
|
||||||
if (cur.par() != where.par())
|
if (cur.pit() != where.pit())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// if cursor position is after the deletion place update it
|
// if cursor position is after the deletion place update it
|
||||||
@ -1376,7 +1376,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur, LCursor const & old)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
//lyxerr[Debug::DEBUG] << "DEPM: cur:\n" << cur << "old:\n" << old << endl;
|
//lyxerr[Debug::DEBUG] << "DEPM: cur:\n" << cur << "old:\n" << old << endl;
|
||||||
Paragraph const & oldpar = pars_[old.par()];
|
Paragraph const & oldpar = pars_[old.pit()];
|
||||||
|
|
||||||
// We allow all kinds of "mumbo-jumbo" when freespacing.
|
// We allow all kinds of "mumbo-jumbo" when freespacing.
|
||||||
if (oldpar.isFreeSpacing())
|
if (oldpar.isFreeSpacing())
|
||||||
@ -1406,14 +1406,14 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur, LCursor const & old)
|
|||||||
// MISSING
|
// MISSING
|
||||||
|
|
||||||
// If the chars around the old cursor were spaces, delete one of them.
|
// If the chars around the old cursor were spaces, delete one of them.
|
||||||
if (old.par() != cur.par() || old.pos() != cur.pos()) {
|
if (old.pit() != cur.pit() || old.pos() != cur.pos()) {
|
||||||
|
|
||||||
// Only if the cursor has really moved.
|
// Only if the cursor has really moved.
|
||||||
if (old.pos() > 0
|
if (old.pos() > 0
|
||||||
&& old.pos() < oldpar.size()
|
&& old.pos() < oldpar.size()
|
||||||
&& oldpar.isLineSeparator(old.pos())
|
&& oldpar.isLineSeparator(old.pos())
|
||||||
&& oldpar.isLineSeparator(old.pos() - 1)) {
|
&& oldpar.isLineSeparator(old.pos() - 1)) {
|
||||||
pars_[old.par()].erase(old.pos() - 1);
|
pars_[old.pit()].erase(old.pos() - 1);
|
||||||
#ifdef WITH_WARNINGS
|
#ifdef WITH_WARNINGS
|
||||||
#warning This will not work anymore when we have multiple views of the same buffer
|
#warning This will not work anymore when we have multiple views of the same buffer
|
||||||
// In this case, we will have to correct also the cursors held by
|
// In this case, we will have to correct also the cursors held by
|
||||||
@ -1431,7 +1431,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur, LCursor const & old)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// only do our magic if we changed paragraph
|
// only do our magic if we changed paragraph
|
||||||
if (old.par() == cur.par())
|
if (old.pit() == cur.pit())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// don't delete anything if this is the ONLY paragraph!
|
// don't delete anything if this is the ONLY paragraph!
|
||||||
@ -1453,25 +1453,25 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur, LCursor const & old)
|
|||||||
deleted = true;
|
deleted = true;
|
||||||
|
|
||||||
bool selection_position_was_oldcursor_position =
|
bool selection_position_was_oldcursor_position =
|
||||||
cur.anchor().par() == old.par() && cur.anchor().pos() == old.pos();
|
cur.anchor().pit() == old.pit() && cur.anchor().pos() == old.pos();
|
||||||
|
|
||||||
// This is a bit of a overkill. We change the old and the cur par
|
// This is a bit of a overkill. We change the old and the cur par
|
||||||
// at max, certainly not everything in between...
|
// at max, certainly not everything in between...
|
||||||
recUndo(old.par(), cur.par());
|
recUndo(old.pit(), cur.pit());
|
||||||
|
|
||||||
// Delete old par.
|
// Delete old par.
|
||||||
pars_.erase(pars_.begin() + old.par());
|
pars_.erase(pars_.begin() + old.pit());
|
||||||
|
|
||||||
// Update cursor par offset if necessary.
|
// Update cursor par offset if necessary.
|
||||||
// Some 'iterator registration' would be nice that takes care of
|
// Some 'iterator registration' would be nice that takes care of
|
||||||
// such events. Maybe even signal/slot?
|
// such events. Maybe even signal/slot?
|
||||||
if (cur.par() > old.par())
|
if (cur.pit() > old.pit())
|
||||||
--cur.par();
|
--cur.pit();
|
||||||
#ifdef WITH_WARNINGS
|
#ifdef WITH_WARNINGS
|
||||||
#warning DEPM, look here
|
#warning DEPM, look here
|
||||||
#endif
|
#endif
|
||||||
// if (cur.anchor().par() > old.par())
|
// if (cur.anchor().pit() > old.pit())
|
||||||
// --cur.anchor().par();
|
// --cur.anchor().pit();
|
||||||
|
|
||||||
if (selection_position_was_oldcursor_position) {
|
if (selection_position_was_oldcursor_position) {
|
||||||
// correct selection
|
// correct selection
|
||||||
@ -1482,7 +1482,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur, LCursor const & old)
|
|||||||
if (deleted)
|
if (deleted)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (pars_[old.par()].stripLeadingSpaces())
|
if (pars_[old.pit()].stripLeadingSpaces())
|
||||||
cur.resetAnchor();
|
cur.resetAnchor();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1495,13 +1495,13 @@ ParagraphList & LyXText::paragraphs() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::recUndo(par_type first, par_type last) const
|
void LyXText::recUndo(pit_type first, pit_type last) const
|
||||||
{
|
{
|
||||||
recordUndo(bv()->cursor(), Undo::ATOMIC, first, last);
|
recordUndo(bv()->cursor(), Undo::ATOMIC, first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::recUndo(par_type par) const
|
void LyXText::recUndo(pit_type par) const
|
||||||
{
|
{
|
||||||
recordUndo(bv()->cursor(), Undo::ATOMIC, par, par);
|
recordUndo(bv()->cursor(), Undo::ATOMIC, par, par);
|
||||||
}
|
}
|
||||||
|
30
src/text3.C
30
src/text3.C
@ -108,7 +108,7 @@ namespace {
|
|||||||
text->bidi.isBoundary(cur.buffer(), par,
|
text->bidi.isBoundary(cur.buffer(), par,
|
||||||
cur.pos(),
|
cur.pos(),
|
||||||
text->real_current_font))
|
text->real_current_font))
|
||||||
text->setCursor(cur, cur.par(), cur.pos(),
|
text->setCursor(cur, cur.pit(), cur.pos(),
|
||||||
false, !cur.boundary());
|
false, !cur.boundary());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,8 +188,8 @@ bool LyXText::gotoNextInset(LCursor & cur,
|
|||||||
vector<InsetOld_code> const & codes, string const & contents)
|
vector<InsetOld_code> const & codes, string const & contents)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(this == cur.text());
|
BOOST_ASSERT(this == cur.text());
|
||||||
par_type end = paragraphs().size();
|
pit_type end = paragraphs().size();
|
||||||
par_type pit = cur.par();
|
pit_type pit = cur.pit();
|
||||||
pos_type pos = cur.pos();
|
pos_type pos = cur.pos();
|
||||||
|
|
||||||
InsetBase * inset;
|
InsetBase * inset;
|
||||||
@ -233,9 +233,9 @@ void LyXText::gotoInset(LCursor & cur,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!gotoNextInset(cur, codes, contents)) {
|
if (!gotoNextInset(cur, codes, contents)) {
|
||||||
if (cur.pos() || cur.par() != 0) {
|
if (cur.pos() || cur.pit() != 0) {
|
||||||
CursorSlice tmp = cur.top();
|
CursorSlice tmp = cur.top();
|
||||||
cur.par() = 0;
|
cur.pit() = 0;
|
||||||
cur.pos() = 0;
|
cur.pos() = 0;
|
||||||
if (!gotoNextInset(cur, codes, contents)) {
|
if (!gotoNextInset(cur, codes, contents)) {
|
||||||
cur.top() = tmp;
|
cur.top() = tmp;
|
||||||
@ -258,13 +258,13 @@ void LyXText::gotoInset(LCursor & cur, InsetOld_code code, bool same_content)
|
|||||||
void LyXText::cursorPrevious(LCursor & cur)
|
void LyXText::cursorPrevious(LCursor & cur)
|
||||||
{
|
{
|
||||||
pos_type cpos = cur.pos();
|
pos_type cpos = cur.pos();
|
||||||
lyx::par_type cpar = cur.par();
|
lyx::pit_type cpar = cur.pit();
|
||||||
|
|
||||||
int x = cur.x_target();
|
int x = cur.x_target();
|
||||||
int y = cur.bv().top_y();
|
int y = cur.bv().top_y();
|
||||||
setCursorFromCoordinates(cur, x, y);
|
setCursorFromCoordinates(cur, x, y);
|
||||||
|
|
||||||
if (cpar == cur.par() && cpos == cur.pos()) {
|
if (cpar == cur.pit() && cpos == cur.pos()) {
|
||||||
// we have a row which is taller than the workarea. The
|
// we have a row which is taller than the workarea. The
|
||||||
// simplest solution is to move to the previous row instead.
|
// simplest solution is to move to the previous row instead.
|
||||||
cursorUp(cur);
|
cursorUp(cur);
|
||||||
@ -278,13 +278,13 @@ void LyXText::cursorPrevious(LCursor & cur)
|
|||||||
void LyXText::cursorNext(LCursor & cur)
|
void LyXText::cursorNext(LCursor & cur)
|
||||||
{
|
{
|
||||||
pos_type cpos = cur.pos();
|
pos_type cpos = cur.pos();
|
||||||
lyx::par_type cpar = cur.par();
|
lyx::pit_type cpar = cur.pit();
|
||||||
|
|
||||||
int x = cur.x_target();
|
int x = cur.x_target();
|
||||||
int y = cur.bv().top_y() + cur.bv().workHeight();
|
int y = cur.bv().top_y() + cur.bv().workHeight();
|
||||||
setCursorFromCoordinates(cur, x, y);
|
setCursorFromCoordinates(cur, x, y);
|
||||||
|
|
||||||
if (cpar == cur.par() && cpos == cur.pos()) {
|
if (cpar == cur.pit() && cpos == cur.pos()) {
|
||||||
// we have a row which is taller than the workarea. The
|
// we have a row which is taller than the workarea. The
|
||||||
// simplest solution is to move to the next row instead.
|
// simplest solution is to move to the next row instead.
|
||||||
cursorDown(cur);
|
cursorDown(cur);
|
||||||
@ -362,7 +362,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
bool start = !par.params().startOfAppendix();
|
bool start = !par.params().startOfAppendix();
|
||||||
|
|
||||||
// ensure that we have only one start_of_appendix in this document
|
// ensure that we have only one start_of_appendix in this document
|
||||||
for (par_type tmp = 0, end = pars_.size(); tmp != end; ++tmp) {
|
for (pit_type tmp = 0, end = pars_.size(); tmp != end; ++tmp) {
|
||||||
if (pars_[tmp].params().startOfAppendix()) {
|
if (pars_[tmp].params().startOfAppendix()) {
|
||||||
recUndo(tmp);
|
recUndo(tmp);
|
||||||
pars_[tmp].params().startOfAppendix(false);
|
pars_[tmp].params().startOfAppendix(false);
|
||||||
@ -585,7 +585,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
if (!cur.mark())
|
if (!cur.mark())
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
finishChange(cur, false);
|
finishChange(cur, false);
|
||||||
if (cur.par() == 0 && cur.textRow().pos() == 0) {
|
if (cur.pit() == 0 && cur.textRow().pos() == 0) {
|
||||||
cur.undispatched();
|
cur.undispatched();
|
||||||
cmd = FuncRequest(LFUN_FINISHED_UP);
|
cmd = FuncRequest(LFUN_FINISHED_UP);
|
||||||
} else {
|
} else {
|
||||||
@ -598,7 +598,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
if (!cur.mark())
|
if (!cur.mark())
|
||||||
cur.clearSelection();
|
cur.clearSelection();
|
||||||
finishChange(cur, false);
|
finishChange(cur, false);
|
||||||
if (cur.par() == cur.lastpar()
|
if (cur.pit() == cur.lastpit()
|
||||||
&& cur.textRow().endpos() == cur.lastpos()) {
|
&& cur.textRow().endpos() == cur.lastpos()) {
|
||||||
cur.undispatched();
|
cur.undispatched();
|
||||||
cmd = FuncRequest(LFUN_FINISHED_DOWN);
|
cmd = FuncRequest(LFUN_FINISHED_DOWN);
|
||||||
@ -938,10 +938,10 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
bool change_layout = (current_layout != layout);
|
bool change_layout = (current_layout != layout);
|
||||||
|
|
||||||
if (!change_layout && cur.selection() &&
|
if (!change_layout && cur.selection() &&
|
||||||
cur.selBegin().par() != cur.selEnd().par())
|
cur.selBegin().pit() != cur.selEnd().pit())
|
||||||
{
|
{
|
||||||
par_type spit = cur.selBegin().par();
|
pit_type spit = cur.selBegin().pit();
|
||||||
par_type epit = cur.selEnd().par() + 1;
|
pit_type epit = cur.selEnd().pit() + 1;
|
||||||
while (spit != epit) {
|
while (spit != epit) {
|
||||||
if (pars_[spit].layout()->name() != current_layout) {
|
if (pars_[spit].layout()->name() != current_layout) {
|
||||||
change_layout = true;
|
change_layout = true;
|
||||||
|
42
src/undo.C
42
src/undo.C
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using lyx::par_type;
|
using lyx::pit_type;
|
||||||
|
|
||||||
using std::advance;
|
using std::advance;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
@ -49,12 +49,12 @@ std::ostream & operator<<(std::ostream & os, Undo const & undo)
|
|||||||
|
|
||||||
void recordUndo(Undo::undo_kind kind,
|
void recordUndo(Undo::undo_kind kind,
|
||||||
DocIterator & cell,
|
DocIterator & cell,
|
||||||
par_type first_par, par_type last_par,
|
pit_type first_pit, pit_type last_pit,
|
||||||
DocIterator & cur,
|
DocIterator & cur,
|
||||||
limited_stack<Undo> & stack)
|
limited_stack<Undo> & stack)
|
||||||
{
|
{
|
||||||
if (first_par > last_par)
|
if (first_pit > last_pit)
|
||||||
std::swap(first_par, last_par);
|
std::swap(first_pit, last_pit);
|
||||||
|
|
||||||
// create the position information of the Undo entry
|
// create the position information of the Undo entry
|
||||||
Undo undo;
|
Undo undo;
|
||||||
@ -64,8 +64,8 @@ void recordUndo(Undo::undo_kind kind,
|
|||||||
lyxerr << "recordUndo: cur: " << cur << endl;
|
lyxerr << "recordUndo: cur: " << cur << endl;
|
||||||
lyxerr << "recordUndo: pos: " << cur.pos() << endl;
|
lyxerr << "recordUndo: pos: " << cur.pos() << endl;
|
||||||
//lyxerr << "recordUndo: cell: " << cell << endl;
|
//lyxerr << "recordUndo: cell: " << cell << endl;
|
||||||
undo.from = first_par;
|
undo.from = first_pit;
|
||||||
undo.end = cell.lastpar() - last_par;
|
undo.end = cell.lastpit() - last_pit;
|
||||||
|
|
||||||
// Undo::ATOMIC are always recorded (no overlapping there).
|
// Undo::ATOMIC are always recorded (no overlapping there).
|
||||||
// As nobody wants all removed character appear one by one when undoing,
|
// As nobody wants all removed character appear one by one when undoing,
|
||||||
@ -91,9 +91,9 @@ void recordUndo(Undo::undo_kind kind,
|
|||||||
BOOST_ASSERT(text);
|
BOOST_ASSERT(text);
|
||||||
ParagraphList & plist = text->paragraphs();
|
ParagraphList & plist = text->paragraphs();
|
||||||
ParagraphList::iterator first = plist.begin();
|
ParagraphList::iterator first = plist.begin();
|
||||||
advance(first, first_par);
|
advance(first, first_pit);
|
||||||
ParagraphList::iterator last = plist.begin();
|
ParagraphList::iterator last = plist.begin();
|
||||||
advance(last, last_par + 1);
|
advance(last, last_pit + 1);
|
||||||
undo.pars = ParagraphList(first, last);
|
undo.pars = ParagraphList(first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,13 +106,13 @@ void recordUndo(Undo::undo_kind kind,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void recordUndo(Undo::undo_kind kind,
|
void recordUndo(Undo::undo_kind kind,
|
||||||
LCursor & cur, par_type first_par, par_type last_par,
|
LCursor & cur, pit_type first_pit, pit_type last_pit,
|
||||||
limited_stack<Undo> & stack)
|
limited_stack<Undo> & stack)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(first_par <= cur.lastpar());
|
BOOST_ASSERT(first_pit <= cur.lastpit());
|
||||||
BOOST_ASSERT(last_par <= cur.lastpar());
|
BOOST_ASSERT(last_pit <= cur.lastpit());
|
||||||
|
|
||||||
recordUndo(kind, cur, first_par, last_par, cur, stack);
|
recordUndo(kind, cur, first_pit, last_pit, cur, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -194,13 +194,13 @@ bool textUndoOrRedo(BufferView & bv,
|
|||||||
|
|
||||||
if (cur_dit.size() == cell_dit.size()) {
|
if (cur_dit.size() == cell_dit.size()) {
|
||||||
recordUndo(Undo::ATOMIC, cell_dit,
|
recordUndo(Undo::ATOMIC, cell_dit,
|
||||||
cell_dit.par(), cur_dit.par(),
|
cell_dit.pit(), cur_dit.pit(),
|
||||||
cur_dit, otherstack);
|
cur_dit, otherstack);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
recordUndo(Undo::ATOMIC, ancestor_dit,
|
recordUndo(Undo::ATOMIC, ancestor_dit,
|
||||||
ancestor_dit.par(),
|
ancestor_dit.pit(),
|
||||||
ancestor_dit.par(),
|
ancestor_dit.pit(),
|
||||||
cur_dit, otherstack);
|
cur_dit, otherstack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ bool textRedo(BufferView & bv)
|
|||||||
|
|
||||||
|
|
||||||
void recordUndo(Undo::undo_kind kind,
|
void recordUndo(Undo::undo_kind kind,
|
||||||
LCursor & cur, par_type first, par_type last)
|
LCursor & cur, pit_type first, pit_type last)
|
||||||
{
|
{
|
||||||
Buffer * buf = cur.bv().buffer();
|
Buffer * buf = cur.bv().buffer();
|
||||||
recordUndo(kind, cur, first, last, buf->undostack());
|
recordUndo(kind, cur, first, last, buf->undostack());
|
||||||
@ -250,7 +250,7 @@ void recordUndo(Undo::undo_kind kind,
|
|||||||
|
|
||||||
void recordUndo(LCursor & cur, Undo::undo_kind kind)
|
void recordUndo(LCursor & cur, Undo::undo_kind kind)
|
||||||
{
|
{
|
||||||
recordUndo(kind, cur, cur.par(), cur.par());
|
recordUndo(kind, cur, cur.pit(), cur.pit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -264,18 +264,18 @@ void recordUndoInset(LCursor & cur, Undo::undo_kind kind)
|
|||||||
|
|
||||||
void recordUndoSelection(LCursor & cur, Undo::undo_kind kind)
|
void recordUndoSelection(LCursor & cur, Undo::undo_kind kind)
|
||||||
{
|
{
|
||||||
recordUndo(kind, cur, cur.selBegin().par(), cur.selEnd().par());
|
recordUndo(kind, cur, cur.selBegin().pit(), cur.selEnd().pit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void recordUndo(LCursor & cur, Undo::undo_kind kind, par_type from)
|
void recordUndo(LCursor & cur, Undo::undo_kind kind, pit_type from)
|
||||||
{
|
{
|
||||||
recordUndo(kind, cur, cur.par(), from);
|
recordUndo(kind, cur, cur.pit(), from);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void recordUndo(LCursor & cur, Undo::undo_kind kind,
|
void recordUndo(LCursor & cur, Undo::undo_kind kind,
|
||||||
par_type from, par_type to)
|
pit_type from, pit_type to)
|
||||||
{
|
{
|
||||||
recordUndo(kind, cur, from, to);
|
recordUndo(kind, cur, from, to);
|
||||||
}
|
}
|
||||||
|
@ -73,9 +73,9 @@ struct Undo {
|
|||||||
/// the position of the cell described
|
/// the position of the cell described
|
||||||
StableDocIterator cell;
|
StableDocIterator cell;
|
||||||
/// counted from begin of cell
|
/// counted from begin of cell
|
||||||
lyx::par_type from;
|
lyx::pit_type from;
|
||||||
/// complement to end of this cell
|
/// complement to end of this cell
|
||||||
lyx::par_type end;
|
lyx::pit_type end;
|
||||||
/// the contents of the saved Paragraphs (for texted)
|
/// the contents of the saved Paragraphs (for texted)
|
||||||
ParagraphList pars;
|
ParagraphList pars;
|
||||||
/// the stringified contents of the saved MathArray (for mathed)
|
/// the stringified contents of the saved MathArray (for mathed)
|
||||||
@ -102,10 +102,10 @@ void finishUndo();
|
|||||||
|
|
||||||
/// The general case: prepare undo for an arbitrary range.
|
/// The general case: prepare undo for an arbitrary range.
|
||||||
void recordUndo(LCursor & cur, Undo::undo_kind kind,
|
void recordUndo(LCursor & cur, Undo::undo_kind kind,
|
||||||
lyx::par_type from, lyx::par_type to);
|
lyx::pit_type from, lyx::pit_type to);
|
||||||
|
|
||||||
/// Convenience: prepare undo for the range between 'from' and cursor.
|
/// Convenience: prepare undo for the range between 'from' and cursor.
|
||||||
void recordUndo(LCursor & cur, Undo::undo_kind kind, lyx::par_type from);
|
void recordUndo(LCursor & cur, Undo::undo_kind kind, lyx::pit_type from);
|
||||||
|
|
||||||
/// Convenience: prepare undo for the single paragraph or cell
|
/// Convenience: prepare undo for the single paragraph or cell
|
||||||
/// containing the cursor
|
/// containing the cursor
|
||||||
|
Loading…
Reference in New Issue
Block a user