void LyXText::init()
{
+ the_locking_inset = 0;
firstrow = 0;
lastrow = 0;
number_of_rows = 0;
/* this must not happen before the currentrow for clear reasons.
so the trick is just to set the current row onto the previous
row of this row */
- long unused_y;
+ int unused_y;
GetRow(row->par(), row->pos(), unused_y);
if (row->next())
layoutfont = GetFont(bview->buffer(), cursor.par(),-1);
// Update current font
real_current_font.update(font,
- bview->buffer()->params.language_info,
+ bview->buffer()->params.language,
toggleall);
// Reduce to implicit settings
LyXFont newfont = GetFont(bview->buffer(),
cursor.par(), cursor.pos());
newfont.update(font,
- bview->buffer()->params.language_info,
+ bview->buffer()->params.language,
toggleall);
SetCharFont(bview->buffer(),
cursor.par(), cursor.pos(), newfont);
void LyXText::RedoHeightOfParagraph(BufferView * bview, LyXCursor const & cur)
{
Row * tmprow = cur.row();
- long y = cur.y() - tmprow->baseline();
+ int y = cur.y() - tmprow->baseline();
SetHeightOfRow(bview, tmprow);
#ifndef NEW_INSETS
{
Row * tmprow = cur.row();
- long y = cur.y() - tmprow->baseline();
+ int y = cur.y() - tmprow->baseline();
SetHeightOfRow(bview, tmprow);
#ifndef NEW_INSETS
LyXParagraph * first_phys_par = tmprow->par()->FirstPhysicalPar();
Row * tmprow = cur.row();
- long y = cur.y() - tmprow->baseline();
+ int y = cur.y() - tmprow->baseline();
if (!tmprow->previous()){
first_phys_par = FirstParagraph(); // a trick/hack for UNDO
void LyXText::ClearSelection() const
{
+ if (selection)
+ status = LyXText::NEED_MORE_REFRESH;
selection = false;
mark_set = false;
}
/* returns a pointer to the row near the specified y-coordinate
* (relative to the whole text). y is set to the real beginning
* of this row */
-Row * LyXText::GetRowNearY(long & y) const
+Row * LyXText::GetRowNearY(int & y) const
{
Row * tmprow = firstrow;
- long tmpy = 0;
+ int tmpy = 0;
while (tmprow->next() && tmpy + tmprow->height() <= y) {
tmpy += tmprow->height();
// If there is a change in the language the implicit word selection
// is disabled.
LyXCursor resetCursor = cursor;
- bool implicitSelection = (font.language() == ignore_language)
+ bool implicitSelection = (font.language() == ignore_language
+ && font.number() == LyXFont::IGNORE)
? SelectWordWhenUnderCursor(bview) : false;
// Set font
}
+static inline
char alphaCounter(int n)
{
if (n < 1 || n > 26)
}
+static inline
char hebrewCounter(int n)
{
static const char hebrew[22] = {
// entry in the marginnote and the enclosing
// environment is an enum/item then correct for the
// LaTeX behaviour (ARRae)
- if(par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
+ if (par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
&& par->footnotekind == LyXParagraph::MARGIN
&& par->Previous()
&& par->Previous()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE
Floating const & fl
= floatList.getType(tmp->type());
// We should get the correct number here too.
- s = fl.name + " #:";
+ s = fl.name() + " #:";
} else {
/* par->SetLayout(0);
s = layout->labelstring; */
InsertChar(bview, LyXParagraph::META_INSET); /* just to rebreak and refresh correctly.
* The character will not be inserted a
* second time */
+#if 1
+ // If we enter a highly editable inset the cursor should be to before
+ // the inset. This couldn't happen before as Undo was not handled inside
+ // inset now after the Undo LyX tries to call inset->Edit(...) again
+ // and cannot do this as the cursor is behind the inset and GetInset
+ // does not return the inset!
+ if (inset->Editable() == Inset::HIGHLY_EDITABLE) {
+ CursorLeft(bview, true);
+ }
+#endif
}
return;
// OK, we have a selection. This is always between sel_start_cursor
- // and sel_end cursor
+ // and sel_end_cursor
#ifndef NEW_INSETS
// Check whether there are half footnotes in the selection
if (sel_start_cursor.par()->footnoteflag != LyXParagraph::NO_FOOTNOTE
LyXParagraph::size_type pos,
string const & str) const
{
- if (par) {
- LyXParagraph::size_type i = 0;
- while (pos + i < par->Last() && i < str.length()&&
- str[i] == par->GetChar(pos + i)) {
- ++i;
- }
- if (str.length() == i)
- return true;
+ if (!par)
+ return false;
+
+ LyXParagraph::size_type i = 0;
+ while (pos + i < par->Last()
+ && string::size_type(i) < str.length()
+ && str[i] == par->GetChar(pos + i)) {
+ ++i;
}
+ if (str.length() == string::size_type(i))
+ return true;
return false;
}
{
LyXCursor tmpcursor;
- long y = 0;
+ int y = 0;
LyXParagraph::size_type z;
Row * row = GetRow(par, pos, y);
// is there a break one row above
if (row->previous() && row->previous()->par() == row->par()) {
z = NextBreakPoint(bview, row->previous(), workWidth(bview));
- if ( z >= row->pos()) {
+ if (z >= row->pos()) {
// set the dimensions of the row above
y -= row->previous()->height();
refresh_y = y;
// set the cursor again. Otherwise
// dangling pointers are possible
- SetCursor(bview, cursor.par(), cursor.pos());
+ SetCursor(bview, cursor.par(), cursor.pos(),
+ false, cursor.boundary());
sel_cursor = cursor;
return;
}
if (selection) {
tmpcursor = cursor;
- SetCursorIntern(bview, sel_cursor.par(), sel_cursor.pos());
+ SetCursorIntern(bview, sel_cursor.par(), sel_cursor.pos(),
+ false, sel_cursor.boundary());
sel_cursor = cursor;
SetCursorIntern(bview, sel_start_cursor.par(),
- sel_start_cursor.pos());
+ sel_start_cursor.pos(),
+ false, sel_start_cursor.boundary());
sel_start_cursor = cursor;
SetCursorIntern(bview, sel_end_cursor.par(),
- sel_end_cursor.pos());
+ sel_end_cursor.pos(),
+ false, sel_end_cursor.boundary());
sel_end_cursor = cursor;
SetCursorIntern(bview, last_sel_cursor.par(),
- last_sel_cursor.pos());
+ last_sel_cursor.pos(),
+ false, last_sel_cursor.boundary());
last_sel_cursor = cursor;
cursor = tmpcursor;
}
- SetCursorIntern(bview, cursor.par(), cursor.pos());
+ SetCursorIntern(bview, cursor.par(), cursor.pos(),
+ false, cursor.boundary());
}
cur.boundary(boundary);
/* get the cursor y position in text */
- long y = 0;
+ int y = 0;
Row * row = GetRow(par, pos, y);
/* y is now the beginning of the cursor row */
y += row->baseline();
}
-void LyXText::SetCursorFromCoordinates(BufferView * bview, int x, long y) const
+void LyXText::SetCursorFromCoordinates(BufferView * bview, int x, int y) const
{
LyXCursor old_cursor = cursor;
void LyXText::SetCursorFromCoordinates(BufferView * bview, LyXCursor & cur,
- int x, long y) const
+ int x, int y) const
{
/* get the row first */
void LyXText::CursorLeft(BufferView * bview, bool internal) const
-{
- CursorLeftIntern(bview, internal);
-}
-
-
-void LyXText::CursorLeftIntern(BufferView * bview, bool internal) const
{
if (cursor.pos() > 0) {
bool boundary = cursor.boundary();
void LyXText::CursorRight(BufferView * bview, bool internal) const
-{
- CursorRightIntern(bview, internal);
-}
-
-
-void LyXText::CursorRightIntern(BufferView * bview, bool internal) const
{
if (!internal && cursor.boundary() &&
!cursor.par()->IsNewline(cursor.pos()))
LyXCursor tmpcursor;
if (old_cursor.par() != cursor.par()) {
- if ( (old_cursor.par()->Last() == 0
+ if ((old_cursor.par()->Last() == 0
|| (old_cursor.par()->Last() == 1
&& old_cursor.par()->IsLineSeparator(0)))
#ifndef NEW_INSETS
end = end->next;
}
- if (start && end
- && start != end->next
- && (before != behind || (!before && !behind))) {
+ if (start && end && (start != end->next) &&
+ ((before != behind) || (!before && !behind)))
+ {
tmppar = start;
tmppar2 = tmppar->Clone();
tmppar2->id(tmppar->id());