return;
}
- if (!cleared && ((need_update == FULL) ||
+ if (!cleared && ((inset->need_update == InsetText::FULL) ||
(top_x!=int(x)) || (top_baseline!=baseline))) {
int w = owner()? width(pain, f) : pain.paperWidth();
int h = ascent(pain,f) + descent(pain, f);
- int tx = (display() && !owner())? 0:int(x);
+ int tx = (needFullRow() && !owner())? 0:int(x);
int ty = baseline - ascent(pain,f);
if (ty < 0)
}
-void InsetCollapsable::update(BufferView * bv,
- LyXFont const & font, bool dodraw)
+void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
+ bool dodraw)
{
if (!widthCollapsed) {
widthCollapsed = width_collapsed(bv->painter(), font);
}
#if 0
if (owner()) {
- w = w - top_x + owner()->x();
- printf("WW2: %d\n",w);
+ w = w - top_x; // + owner()->x();
+// printf("WW2: %d\n",w);
return w; // - top_x + owner()->x();
}
#endif
w -= (2 * TEXT_TO_INSET_OFFSET);
// printf("WW2: %d\n",w);
- return w; // - top_x - (2 * TEXT_TO_INSET_OFFSET);
+ return w - top_x; // - top_x - (2 * TEXT_TO_INSET_OFFSET);
}
if ((drawFrame == ALWAYS) || ((drawFrame == LOCKED) && locked)) {
pain.rectangle(top_x, baseline - insetAscent, insetWidth,
insetAscent + insetDescent, frame_color);
- } else {
+ } else if (need_update == CLEAR_FRAME) {
pain.rectangle(top_x, baseline - insetAscent, insetWidth,
insetAscent + insetDescent,
LColor::background);
}
- x += width(pain, f) - TEXT_TO_INSET_OFFSET;
+ x += insetWidth - TEXT_TO_INSET_OFFSET;
need_update = NONE;
}
}
int oldw = insetWidth;
#if 1
- insetWidth = max(textWidth(bv->painter()),
- static_cast<int>(TEXT(bv)->width) + drawTextXOffset) +
- (2 * TEXT_TO_INSET_OFFSET);
+ insetWidth = TEXT(bv)->width + (2 * TEXT_TO_INSET_OFFSET);
+ // max(textWidth(bv->painter()),
+ // static_cast<int>(TEXT(bv)->width) + drawTextXOffset) +
+ // (2 * TEXT_TO_INSET_OFFSET);
#else
insetWidth = textWidth(bv->painter());
if (insetWidth < 0)
printf("TW(%p): %d-%d-%d-%d\n",this,insetWidth, oldw,
textWidth(bv->painter()),static_cast<int>(TEXT(bv)->width));
deleteLyXText(bv);
+ need_update = FULL;
#if 0
if (owner()) {
- owner()->update(bv, font, dodraw);
- return;
+ owner()->update(bv, font, dodraw);
+ return;
+ } else {
+ update(bv, font, dodraw);
}
#else
#if 1
TEXT(bv)->UpdateInset(bv, the_locking_inset);
}
+ if (TEXT(bv)->status == LyXText::NEED_MORE_REFRESH)
+ need_update = FULL;
+
long int y_temp = 0;
Row * row = TEXT(bv)->GetRowNearY(y_temp);
insetAscent = row->ascent_of_text() + TEXT_TO_INSET_OFFSET;
no_selection = false;
locked = false;
TEXT(bv)->selection = 0;
- UpdateLocal(bv, CURSOR_PAR, false);
+ UpdateLocal(bv, CLEAR_FRAME, false);
bv->owner()->getToolbar()->combox->select(bv->text->cursor.par()->GetLayout()+1);
}
}
-int InsetText::getMaxTextWidth(Painter & pain,
- UpdatableInset const * inset) const
+int InsetText::getMaxWidth(Painter & pain, UpdatableInset const * inset) const
{
- return getMaxWidth(pain, inset) - (2 * TEXT_TO_INSET_OFFSET);
+ return UpdatableInset::getMaxWidth(pain, inset) - (2*TEXT_TO_INSET_OFFSET);
}
if (how != drawFrame) {
drawFrame = how;
if (bv)
- UpdateLocal(bv, FRAME, false);
+ UpdateLocal(bv, DRAW_FRAME, false);
}
}
if (frame_color != col) {
frame_color = col;
if (bv)
- UpdateLocal(bv, FRAME, false);
+ UpdateLocal(bv, DRAW_FRAME, false);
}
}
CURSOR_PAR,
CURSOR,
SELECTION,
- FRAME
+ DRAW_FRAME,
+ CLEAR_FRAME
};
///
enum DrawFrame {
///
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
///
+ int getMaxWidth(Painter &, UpdatableInset const *) const;
+ ///
void init(InsetText const * ins = 0);
///
void WriteParagraphData(Buffer const *, std::ostream &) const;
void deleteLyXText(BufferView *);
LyXParagraph * par;
+ ///
+ mutable UpdateCodes need_update;
protected:
///
void UpdateLocal(BufferView *, UpdateCodes, bool mark_dirty);
- ///
- virtual int getMaxTextWidth(Painter &, UpdatableInset const *) const;
mutable int drawTextXOffset;
mutable int drawTextYOffset;
DrawFrame drawFrame;
///
LColor::color frame_color;
- ///
- mutable UpdateCodes need_update;
private:
///