Baruch's fixes and draw fix for insettext

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1107 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2000-10-12 13:53:52 +00:00
parent 325dccab09
commit 06f595812c
5 changed files with 27 additions and 17 deletions

View File

@ -1,5 +1,15 @@
2000-10-12 Baruch Even <baruch.even@writeme.com>
* src/graphics/GraphicsCacheItem_pimpl.C:
* src/graphics/Renderer.C:
* src/graphics/XPM_Renderer.C: Corrected resolution of conflicts.
It now compiles.
2000-10-12 Juergen Vigna <jug@sad.it> 2000-10-12 Juergen Vigna <jug@sad.it>
* src/insets/insettext.C (draw): fixed drawing bug (specifically
visible when selecting).
* development/Code_rules/Rules: fixed some typos. * development/Code_rules/Rules: fixed some typos.
2000-10-09 Baruch Even <baruch.even@writeme.com> 2000-10-09 Baruch Even <baruch.even@writeme.com>

View File

@ -41,9 +41,7 @@ GraphicsCacheItem_pimpl::GraphicsCacheItem_pimpl()
GraphicsCacheItem_pimpl::~GraphicsCacheItem_pimpl() GraphicsCacheItem_pimpl::~GraphicsCacheItem_pimpl()
{ {
if (imageStatus_ == GraphicsCacheItem::Loaded) { delete pixmap_;
XFreePixmap(fl_get_display(), pixmap_);
}
delete renderer; delete renderer;
} }

View File

@ -87,5 +87,5 @@ string const & Renderer::getFilename() const
void Renderer::freePixmap() void Renderer::freePixmap()
{ {
if (pixmapLoaded_) if (pixmapLoaded_)
XFreePixmap(fl_get_display(), pixmap_); XFreePixmap(fl_get_display(), pixmap_->getPixmap());
} }

View File

@ -45,7 +45,7 @@ bool XPM_Renderer::renderImage()
//(BE 2000-08-05) //(BE 2000-08-05)
#warning This might be a dirty thing, but I dont know any other solution. #warning This might be a dirty thing, but I dont know any other solution.
Screen * screen = ScreenOfDisplay(fl_get_display(), fl_screen); //DefaultScreen(display); Screen * screen = ScreenOfDisplay(display, fl_screen);
int status = XpmReadFileToPixmap( int status = XpmReadFileToPixmap(
display, display,

View File

@ -315,32 +315,34 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
x += TEXT_TO_INSET_OFFSET; x += TEXT_TO_INSET_OFFSET;
int y = 0; int y = 0;
Row * row = TEXT(bv)->GetRowNearY(y); Row * row = TEXT(bv)->GetRowNearY(y);
int fa = row->ascent_of_text(); int y_offset = baseline - row->ascent_of_text();
y += baseline - fa; int ph = pain.paperHeight();
while (row != 0) { y += y_offset;
if (((y+row->height()) > 0) && (y < pain.paperHeight())) while ((row != 0) && ((y+row->height()) <= 0)) {
break;
y += row->height(); y += row->height();
row = row->next(); row = row->next();
} }
TEXT(bv)->first = y - top_baseline + fa; y -= y_offset;
TEXT(bv)->first = y;
if (cleared || !locked || (need_update == FULL)) { if (cleared || !locked || (need_update == FULL)) {
while (row != 0) { int first = y;
if (((y+row->height()) > 0) && (y < pain.paperHeight())) y = 0;
TEXT(bv)->GetVisibleRow(bv, int(y), int(x), row, y, cleared); while ((row != 0) && (y < ph)) {
TEXT(bv)->GetVisibleRow(bv, y+first+y_offset, int(x), row,
y+first, cleared);
y += row->height(); y += row->height();
row = row->next(); row = row->next();
} }
} else if (need_update == SELECTION) { } else if (need_update == SELECTION) {
bv->screen()->ToggleToggle(TEXT(bv), int(y), int(x)); bv->screen()->ToggleToggle(TEXT(bv), y+y_offset, int(x));
} else { } else {
locked = false; locked = false;
if (need_update == CURSOR) { if (need_update == CURSOR) {
bv->screen()->ToggleSelection(TEXT(bv), true, int(y), int(x)); bv->screen()->ToggleSelection(TEXT(bv), true, y+y_offset, int(x));
TEXT(bv)->ClearSelection(); TEXT(bv)->ClearSelection();
TEXT(bv)->sel_cursor = TEXT(bv)->cursor; TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
} }
bv->screen()->Update(TEXT(bv), int(y), int(x)); bv->screen()->Update(TEXT(bv), y, int(x));
locked = true; locked = true;
} }
TEXT(bv)->refresh_y = 0; TEXT(bv)->refresh_y = 0;