mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
A hack fix for #268.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3707 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2fb8a39399
commit
c7fc42d88c
@ -1,5 +1,7 @@
|
||||
2002-03-11 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* insetgraphics.C (draw): hack to fix the redrawing bug.
|
||||
|
||||
* insettext.C (updateInsetInInset): fixed for updates in insets inside
|
||||
this inset text (don't know why I missed this earlier).
|
||||
|
||||
|
@ -96,6 +96,7 @@ TODO Before initial production release:
|
||||
#include "graphics/GraphicsImage.h"
|
||||
|
||||
#include "LyXView.h"
|
||||
#include "lyxtext.h"
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "converter.h"
|
||||
@ -107,7 +108,6 @@ TODO Before initial production release:
|
||||
#include "LaTeXFeatures.h"
|
||||
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "frontends/Alert.h"
|
||||
#include "frontends/controllers/helper_funcs.h" // getVectorFromString
|
||||
|
||||
#include "support/LAssert.h"
|
||||
@ -156,7 +156,7 @@ string const unique_id()
|
||||
|
||||
InsetGraphics::InsetGraphics()
|
||||
: graphic_label(unique_id()),
|
||||
cached_status_(grfx::ErrorUnknown), cache_filled_(false)
|
||||
cached_status_(grfx::ErrorUnknown), cache_filled_(false), old_asc(0)
|
||||
|
||||
{}
|
||||
|
||||
@ -165,7 +165,7 @@ InsetGraphics::InsetGraphics(InsetGraphics const & ig, bool same_id)
|
||||
: Inset(ig, same_id),
|
||||
SigC::Object(),
|
||||
graphic_label(unique_id()),
|
||||
cached_status_(grfx::ErrorUnknown), cache_filled_(false)
|
||||
cached_status_(grfx::ErrorUnknown), cache_filled_(false), old_asc(0)
|
||||
{
|
||||
setParams(ig.params());
|
||||
if (same_id)
|
||||
@ -249,10 +249,10 @@ bool InsetGraphics::drawImage() const
|
||||
|
||||
int InsetGraphics::ascent(BufferView *, LyXFont const &) const
|
||||
{
|
||||
old_asc = 50;
|
||||
if (drawImage())
|
||||
return cached_image_->getHeight();
|
||||
else
|
||||
return 50;
|
||||
old_asc = cached_image_->getHeight();
|
||||
return old_asc;
|
||||
}
|
||||
|
||||
|
||||
@ -293,10 +293,22 @@ int InsetGraphics::width(BufferView *, LyXFont const & font) const
|
||||
void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
||||
int baseline, float & x, bool) const
|
||||
{
|
||||
int oasc = old_asc;
|
||||
|
||||
int ldescent = descent(bv, font);
|
||||
int lascent = ascent(bv, font);
|
||||
int lwidth = width(bv, font);
|
||||
|
||||
// we may have changed while someone other was drawing us so better
|
||||
// to not draw anything as we surely call to redraw ourself soon.
|
||||
// This is not a nice thing to do and should be fixed properly somehow.
|
||||
// But I still don't know the best way to go. So let's do this like this
|
||||
// for now (Jug 20020311)
|
||||
if (lascent != oasc) {
|
||||
// lyxerr << "IG(" << this << "): " << x << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure now that x is updated upon exit from this routine
|
||||
int old_x = int(x);
|
||||
x += lwidth;
|
||||
@ -312,12 +324,12 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
|
||||
Painter & paint = bv->painter();
|
||||
|
||||
if (drawImage()) {
|
||||
|
||||
// lyxerr << "IG(" << this << "): " << old_x << endl;
|
||||
paint.image(old_x + 2, baseline - lascent,
|
||||
lwidth - 4, lascent + ldescent,
|
||||
*cached_image_.get());
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
paint.rectangle(old_x + 2, baseline - lascent,
|
||||
lwidth - 4,
|
||||
|
@ -127,6 +127,8 @@ private:
|
||||
mutable grfx::ImagePtr cached_image_;
|
||||
///
|
||||
mutable bool cache_filled_;
|
||||
///
|
||||
mutable int old_asc;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user