if (par->getChar(pos) == Paragraph::META_INSET) {
Inset * inset = par->getInset(pos);
if (inset) {
- if (inset->editable()==Inset::HIGHLY_EDITABLE) {
+ if (inset->editable()==Inset::IS_EDITABLE) {
UpdatableInset * uinset =
static_cast<UpdatableInset *>(inset);
uinset->setFont(bv, fnt, toggleall, true);
LyXLayout const & layout =
textclasslist.Style(buf->params.textclass, par->getLayout());
- LyXFont layoutfont, tmpfont;
- for (Paragraph::size_type pos = 0;
- pos < par->size(); ++pos) {
+ LyXFont layoutfont;
+ for (Paragraph::size_type pos = 0; pos < par->size(); ++pos) {
if (pos < beginningOfMainBody(buf, par))
layoutfont = layout.labelfont;
else
layoutfont = layout.font;
- tmpfont = par->getFontSettings(buf->params, pos);
+ LyXFont tmpfont = par->getFontSettings(buf->params, pos);
tmpfont.reduce(layoutfont);
par->setFont(pos, tmpfont);
}
selection.cursor = cursor;
setCursor(bview, selection.end.par(), selection.end.pos(), false);
updateCounters(bview, cursor.row());
- clearSelection(bview);
+ clearSelection();
setSelection(bview);
setCursor(bview, tmpcursor.par(), tmpcursor.pos(), true);
}
selection.cursor = cursor;
setCursor(bview, selection.end.par(), selection.end.pos());
updateCounters(bview, cursor.row());
- clearSelection(bview);
+ clearSelection();
setSelection(bview);
setCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
selection.cursor = cursor;
setCursor(bview, selection.end.par(), selection.end.pos());
updateCounters(bview, cursor.row());
- clearSelection(bview);
+ clearSelection();
setSelection(bview);
setCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
setCursor(bview, selection.start.par(), selection.start.pos());
selection.cursor = cursor;
setCursor(bview, selection.end.par(), selection.end.pos());
- clearSelection(bview);
+ clearSelection();
setSelection(bview);
setCursor(bview, tmpcursor.par(), tmpcursor.pos(), true,
tmpcursor.boundary());
// and the specified par
// This function is needed after SetLayout and SetFont etc.
void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
- Paragraph const * endpar) const
+ Paragraph const * endpar) const
{
Row * tmprow2;
Paragraph * tmppar = 0;
} else {
first_phys_par = tmprow->par();
while (tmprow->previous()
- && tmprow->previous()->par() == first_phys_par) {
+ && tmprow->previous()->par() == first_phys_par)
+ {
tmprow = tmprow->previous();
y -= tmprow->height();
}
status(bview, LyXText::NEED_MORE_REFRESH);
refresh_y = y;
refresh_row = tmprow->previous(); /* the real refresh row will
- be deleted, so I store
- the previous here */
+ be deleted, so I store
+ the previous here */
// remove it
if (tmprow->next())
tmppar = tmprow->next()->par();
// remove the first one
tmprow2 = tmprow; /* this is because tmprow->previous()
- can be 0 */
+ can be 0 */
tmprow = tmprow->previous();
removeRow(tmprow2);
}
-void LyXText::clearSelection(BufferView * /*bview*/) const
+void LyXText::clearSelection() const
{
selection.set(false);
selection.mark(false);
// Implicit selections are cleared afterwards
//and cursor is set to the original position.
if (implicitSelection) {
- clearSelection(bview);
+ clearSelection();
cursor = resetCursor;
setCursor(bview, cursor.par(), cursor.pos());
selection.cursor = cursor;
// Implicit selections are cleared afterwards
//and cursor is set to the original position.
if (implicitSelection) {
- clearSelection(bview);
+ clearSelection();
cursor = resetCursor;
setCursor(bview, cursor.par(), cursor.pos());
selection.cursor = cursor;
redoParagraphs(bview, selection.start, endpar);
- clearSelection(bview);
+ clearSelection();
setCursor(bview, selection.start.par(), selection.start.pos());
selection.cursor = cursor;
setCursor(bview, selection.end.par(), selection.end.pos());
cursor = selection.start;
// need a valid cursor. (Lgb)
- clearSelection(bview);
+ clearSelection();
setCursor(bview, cursor.par(), cursor.pos());
selection.cursor = cursor;
redoParagraphs(bview, cursor, endpar);
setCursor(bview, cursor.par(), cursor.pos());
- clearSelection(bview);
+ clearSelection();
selection.cursor = cursor;
setCursor(bview, actpar, pos);
setCursorParUndo(bview);
// only to be sure, should not be neccessary
- clearSelection(bview);
+ clearSelection();
bview->buffer()->insertStringAsLines(par, pos, current_font, str);
void LyXText::setCursorFromCoordinates(BufferView * bview, int x, int y) const
{
LyXCursor old_cursor = cursor;
-
+
+#if 0
// Get the row first.
Row * row = getRowNearY(y);
- cursor.par(row->par());
bool bound = false;
int column = getColumnNearX(bview, row, x, bound);
+
+ cursor.par(row->par());
cursor.pos(row->pos() + column);
cursor.x(x);
cursor.y(y + row->baseline());
cursor.row(row);
cursor.boundary(bound);
+#else
+ setCursorFromCoordinates(bview, cursor, x, y);
+#endif
setCurrentFont(bview);
deleteEmptyParagraphMechanism(bview, old_cursor);
}
Row * row = getRowNearY(y);
bool bound = false;
- int column = getColumnNearX(bview, row, x, bound);
+ int const column = getColumnNearX(bview, row, x, bound);
cur.par(row->par());
cur.pos(row->pos() + column);
status_ = st;
if (inset_owner && st != UNCHANGED) {
bview->text->status(bview, NEED_VERY_LITTLE_REFRESH);
+ if (!bview->text->refresh_row) {
+ bview->text->refresh_row = bview->text->cursor.row();
+ bview->text->refresh_y = bview->text->cursor.y() -
+ bview->text->cursor.row()->baseline();
+ }
}
}
#endif