+2000-06-28 Juergen Vigna <jug@sad.it>
+
+ * src/text.C (GetVisibleRow): fixed clearing of text if rowHeight >
+ insetHeight.
+
2000-06-28 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/insets/insetindex.C (Edit): add a callback when popup is
void InsetCollapsable::Write(Buffer const * buf, ostream & os) const
{
- os << "collapsed " << tostr(!display()) << "\n";
- WriteParagraphData(buf, os);
+ os << "collapsed " << tostr(!display()) << "\n";
+ WriteParagraphData(buf, os);
}
button_length = width_collapsed(pain, labelfont) + 2;
button_top_y = -ascent_collapsed(pain, f);
button_bottom_y = descent_collapsed(pain, f);
- top_x = int(x);
- top_baseline = baseline;
if (collapsed) {
draw_collapsed(pain, f, baseline, x);
return;
}
- draw_collapsed(pain, f, baseline, x);
- x -= TEXT_TO_INSET_OFFSET;
+ if (!cleared && ((need_update==FULL) || (topx!=int(x)) ||
+ (topbaseline!=baseline))) {
+ int w = width(pain, f);
+ int h = ascent(pain,f) + descent(pain, f);
+ int tx = display()? 0:topx;
+ int ty = baseline - ascent(pain,f);
+
+ if (ty < 0)
+ ty = 0;
+ if ((ty + h) > pain.paperHeight())
+ h = pain.paperHeight();
+ if ((topx + w) > pain.paperWidth())
+ w = pain.paperWidth();
+ pain.fillRectangle(tx, ty-1, w, h+2);
+ cleared = true;
+ }
+
+ // not needed if collapsed
+ topx = int(x);
+ topbaseline = baseline;
int w = InsetText::width(pain, f) + (2 * TEXT_TO_INSET_OFFSET);
int h = ascent(pain,f) + descent(pain, f);
+
+ draw_collapsed(pain, f, baseline, x);
+ x -= TEXT_TO_INSET_OFFSET;
+
int save_x = static_cast<int>(x);
x += TEXT_TO_INSET_OFFSET;
InsetText::draw(bv, f, baseline, x, cleared);
private:
///
int widthOffset;
+ ///
+ mutable int topx;
+ mutable int topbaseline;
};
#endif
void InsetFoot::Write(Buffer const * buf, ostream & os) const
{
- os << getInsetName() << "\n";
- InsetCollapsable::Write(buf, os);
+ os << getInsetName() << "\n";
+ InsetCollapsable::Write(buf, os);
}
InsetMarginal::InsetMarginal() : InsetCollapsable()
{
- setLabel(_("margin"));
- LyXFont font(LyXFont::ALL_SANE);
- font.decSize();
- font.decSize();
- font.setColor(LColor::footnote);
- setLabelFont(font);
- setAutoCollapse(false);
- setInsetName("Marginal");
+ setLabel(_("margin"));
+ LyXFont font(LyXFont::ALL_SANE);
+ font.decSize();
+ font.decSize();
+ font.setColor(LColor::footnote);
+ setLabelFont(font);
+ setAutoCollapse(false);
+ setInsetName("Marginal");
}
void InsetMarginal::Write(Buffer const * buf, ostream & os) const
{
- os << getInsetName() << "\n";
- InsetCollapsable::Write(buf, os);
+ os << getInsetName() << "\n";
+ InsetCollapsable::Write(buf, os);
}
Inset * InsetMarginal::Clone() const
{
- InsetMarginal * result = new InsetMarginal;
- result->init(this);
-
- result->collapsed = collapsed;
- return result;
+ InsetMarginal * result = new InsetMarginal;
+ result->init(this);
+
+ result->collapsed = collapsed;
+ return result;
}
char const * InsetMarginal::EditMessage() const
{
- return _("Opened Marginal Note Inset");
+ return _("Opened Marginal Note Inset");
}
float cx;
UpdatableInset::draw(bv,font,baseline,x,cleared);
- if ((need_update == INIT)|| (top_x != int(x)) || (top_baseline != baseline)) {
+ if (!cleared && ((need_update == INIT) || (need_update == FULL) ||
+ (top_x != int(x)) || (top_baseline != baseline))) {
+#if 1
+ int h = ascent(pain, font) + descent(pain, font);
+ int tx = display()? 0:top_x;
+ int w = tx? width(pain, font):pain.paperWidth();
+ int ty = baseline - ascent(pain, font);
+
+ if (ty < 0)
+ ty = 0;
+ if ((ty + h) > pain.paperHeight())
+ h = pain.paperHeight();
+ if ((top_x + w) > pain.paperWidth())
+ w = pain.paperWidth();
+ pain.fillRectangle(tx, ty, w, h);
+ need_update = FULL;
+ cleared = true;
+#else
need_update = FULL;
- top_x = int(x);
- top_baseline = baseline;
resetPos(pain);
if (locked) { // repaint this way as the background was not cleared
if (the_locking_inset)
locked = true;
return;
}
+#endif
}
+ top_x = int(x);
+ top_baseline = baseline;
bool dodraw;
x += ADD_TO_TABULAR_WIDTH;
- if (cleared || !locked || (need_update == FULL) || (need_update == CELL)) {
+ if (cleared || (need_update == FULL) || (need_update == CELL)) {
for(i=0;i<tabular->rows();++i) {
nx = int(x);
dodraw = ((baseline+tabular->GetDescentOfRow(i)) > 0) &&
if (!cleared && ((need_update==FULL) || (top_x!=int(x)) ||
(top_baseline!=baseline))) {
-#if 0
- // && locked && ((need_update==FULL) || (top_x!=int(x)) ||
- // (top_baseline!=baseline))) {
- need_update = NONE;
- top_x = int(x);
- top_baseline = baseline;
- locked = false;
- bv->updateInset(const_cast<InsetText *>(this), false);
- locked = true;
- if (drawLockedFrame)
- pain.rectangle(top_x, baseline - ascent(pain, f),
- width(pain, f), ascent(pain,f)+descent(pain, f),
- frame_color);
- return;
-#else
- pain.fillRectangle(top_x+drawTextXOffset, top_y, last_width,
- last_height);
+ int w = insetWidth;
+ int h = insetAscent + insetDescent;
+ int ty = baseline - insetAscent;
+
+ if (ty < 0)
+ ty = 0;
+ if ((ty + h) > pain.paperHeight())
+ h = pain.paperHeight();
+ if ((top_x + drawTextXOffset + w) > pain.paperWidth())
+ w = pain.paperWidth();
+ pain.fillRectangle(top_x+drawTextXOffset, ty, w, h);
+ cleared = true;
need_update = FULL;
-#endif
}
if (!cleared && (need_update == NONE))
inset_x = cx(bv) - top_x + drawTextXOffset;
inset_y = cy(bv) + drawTextYOffset;
}
- if (need_update == CURSOR) {
+ if (!cleared && (need_update == CURSOR)) {
x += width(pain, f);
need_update = NONE;
return;
locked = true;
the_locking_inset = 0;
inset_pos = inset_x = inset_y = 0;
-#warning Fix cursor setting here!!! (Jug)
- TEXT(bv)->SetCursor(bv, par, 0);
-// setPos(bv->painter(), x, y);
+ TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset,
+ y+TEXT(bv)->first-drawTextYOffset+
+ insetAscent);
checkAndActivateInset(bv, x, y, button);
-// selection_start_cursor = selection_end_cursor = cursor;
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
bv->text->FinishUndo();
UpdateLocal(bv, FULL, false);
UpdateLocal(bv, FULL, false);
}
no_selection = false;
- TEXT(bv)->SetCursorFromCoordinates(bv, x, y+TEXT(bv)->first);
+ TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset,
+ y+TEXT(bv)->first-drawTextYOffset+
+ insetAscent);
if (the_locking_inset) {
UpdatableInset * inset = 0;
if (cpar(bv)->GetChar(cpos(bv)) == LyXParagraph::META_INSET)
if (!autoBreakRows)
return DISPATCHED;
TEXT(bv)->BreakParagraph(bv, 0);
- UpdateLocal(bv, CURSOR_PAR, true);
+ UpdateLocal(bv, FULL, true);
break;
case LFUN_BREAKLINE:
if (!autoBreakRows)
bool drawLockedFrame;
///
LColor::color frame_color;
+ ///
+ mutable UpdateCodes need_update;
private:
///
LyXParagraph * cpar(BufferView *) const;
Row * crow(BufferView *) const;
- /// This instead of a macro
- LyXText * TEXT(BufferView * bv) const {
- return getLyXText(bv);
- }
+ /// This instead of a macro
+ LyXText * TEXT(BufferView * bv) const {
+ return getLyXText(bv);
+ }
/* Private structures and variables */
///
///
mutable float xpos;
///
- mutable UpdateCodes need_update;
- ///
UpdatableInset * the_locking_inset;
///
LyXParagraph * old_par;
ww = bview->workWidth();
bool clear_area = true;
+ Inset * inset = 0;
if ((last == row_ptr->pos()) &&
(row_ptr->par()->GetChar(row_ptr->pos()) == LyXParagraph::META_INSET) &&
- (row_ptr->par()->GetInset(row_ptr->pos())))
+ (inset=row_ptr->par()->GetInset(row_ptr->pos())))
{
- clear_area = row_ptr->par()->GetInset(row_ptr->pos())->doClearArea();
+ clear_area = inset->doClearArea();
}
if (clear_area) {
int w;
else
w = ww;
pain.fillRectangle(x_offset, y_offset, w, row_ptr->height());
+ } else if (inset != 0) {
+ int h = row_ptr->baseline() - inset->ascent(pain, font);
+ if (h > 0) {
+ int w;
+ if (inset_owner)
+ w = inset_owner->width(bview->painter(), font);
+ else
+ w = ww;
+ pain.fillRectangle(x_offset, y_offset, w, h);
+ }
}
if (selection) {