X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsettext.C;h=8889f2869eaf74df095728353ab3e7f85d664d23;hb=4a5b7a5952ad2381fcdf4830511293e184c7c5a1;hp=1e778567c1865266a53511d44aa5d2966d635efe;hpb=d5fefbb6d896356ed9aa2971a953ec33e03b3731;p=lyx.git diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 1e778567c1..8889f2869e 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -62,6 +62,7 @@ using std::min; using std::max; using std::make_pair; using std::vector; +using std::pair; using lyx::pos_type; using lyx::layout_type; @@ -350,15 +351,13 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, int old_x = top_x; if (top_x != int(x)) { top_x = int(x); + topx_set = true; int nw = getMaxWidth(bv, this); if (nw > 0 && old_max_width != nw) { need_update = INIT; old_max_width = nw; bv->text->status(bv, LyXText::CHANGED_IN_DRAW); - topx_set = true; return; - } else { - top_x = old_x; } } @@ -370,15 +369,11 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, // repaint the background if needed if (cleared && backgroundColor() != LColor::background) { - top_x = int(x); clearInset(bv, baseline, cleared); - top_x = old_x; } // no draw is necessary !!! if ((drawFrame_ == LOCKED) && !locked && !par->size()) { - top_x = int(x); - topx_set = true; top_baseline = baseline; x += width(bv, f); if (need_update & CLEAR_FRAME) @@ -392,15 +387,15 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, x += static_cast(scroll()); // if top_x differs we did it already - if (!cleared && (top_x == int(x)) + if (!cleared && (old_x == int(x)) && ((need_update&(INIT|FULL)) || (top_baseline != baseline) - ||(last_drawn_width != insetWidth))) { + ||(last_drawn_width != insetWidth))) + { // Condition necessary to eliminate bug 59 attachment 37 - if (baseline > 0) clearInset(bv, baseline, cleared); + if (baseline > 0) + clearInset(bv, baseline, cleared); } - top_x = int(x); - topx_set = true; if (cleared) frame_is_visible = false; @@ -674,7 +669,11 @@ void InsetText::edit(BufferView * bv, int x, int y, unsigned int button) showInsetCursor(bv); if (clear) lt = 0; - updateLocal(bv, CURSOR, false); + + int code = CURSOR; + if (drawFrame_ == LOCKED) + code = CURSOR|DRAW_FRAME; + updateLocal(bv, code, false); } @@ -719,7 +718,10 @@ void InsetText::edit(BufferView * bv, bool front) showInsetCursor(bv); if (clear) lt = 0; - updateLocal(bv, CURSOR, false); + int code = CURSOR; + if (drawFrame_ == LOCKED) + code = CURSOR|DRAW_FRAME; + updateLocal(bv, code, false); } @@ -791,7 +793,7 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset) } if ((*it)->getInsetFromID(id)) { getLyXText(bv)->setCursorIntern(bv, p, it.getPos()); - lockInset(bv, static_cast(*it)); + (*it)->edit(bv); return the_locking_inset->lockInsetInInset(bv, inset); } } @@ -1085,7 +1087,7 @@ InsetText::localDispatch(BufferView * bv, updateLocal(bv, CURSOR_PAR, false); return result; } else if (result >= FINISHED) { - switch(result) { + switch (result) { case FINISHED_RIGHT: moveRightIntern(bv, false, false); result = DISPATCHED; @@ -1319,7 +1321,7 @@ InsetText::localDispatch(BufferView * bv, // Derive layout number from given argument (string) // and current buffer's textclass (number). */ textclass_type tclass = bv->buffer()->params.textclass; - std::pair layout = + pair layout = textclasslist.NumberOfLayout(tclass, arg); // If the entry is obsolete, use the new one instead. @@ -1523,7 +1525,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os) const } if (environment_stack[depth] != style.latexname()) { - if(environment_stack.size() == depth + 1) { + if (environment_stack.size() == depth + 1) { environment_stack.push_back("!-- --"); environment_inner.push_back("!-- --"); } @@ -1546,7 +1548,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os) const if (style.latextype == LATEX_ENVIRONMENT) { if (!style.latexparam().empty()) { - if(style.latexparam() == "CDATA") + if (style.latexparam() == "CDATA") os << "sgmlOpenTag(os, depth + command_depth, @@ -1590,7 +1592,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os) const switch (style.latextype) { case LATEX_ENVIRONMENT: if (!style.latexparam().empty()) { - if(style.latexparam() == "CDATA") + if (style.latexparam() == "CDATA") os << "]]>"; else buf->sgmlCloseTag(os, depth + command_depth, @@ -1881,16 +1883,16 @@ bool InsetText::showInsetDialog(BufferView * bv) const } -std::vector const InsetText::getLabelList() const +vector const InsetText::getLabelList() const { - std::vector label_list; + vector label_list; Paragraph * tpar = par; while (tpar) { Paragraph::inset_iterator beg = tpar->inset_iterator_begin(); Paragraph::inset_iterator end = tpar->inset_iterator_end(); for (; beg != end; ++beg) { - std::vector const l = (*beg)->getLabelList(); + vector const l = (*beg)->getLabelList(); label_list.insert(label_list.end(), l.begin(), l.end()); } tpar = tpar->next();