Zoom and Thumbnail [message #175395] |
Mon, 04 April 2005 12:41  |
Eclipse User |
|
|
|
Hi,
I have a problem concerning zoom and thumbnail view. I'am in this
situation:
My principal draw2D view: LwSystem->FigureCanvas-> my figure (Simple
Figure)
The thumbnail of my figure : LwSystem2-> ScrollableThumbnail-> my figure
(as content of the ScrollableThumbnail, and the viewPort of the Figure
Canvas is passed to the its constructor)
Where ("->" means "contents").
First, It works nice, I don't have any problem.
But I have added some zoom functionalities, I have followed the
ZoomContainer example and I have introduced the these methods directly in
"my figure".
Then if I use the code below in the paintClientArea(gracphics) of my
figure, the thumbnail doesn't works !
(http://cs-devel.ulb.ac.be/tmp/vbm.png)
paintClientArea(Graphics gracphics) {
if (getChildren().isEmpty())
return;
boolean optimizeClip = getBorder() == null ||
getBorder().isOpaque();
graphics.pushState();
ScaledGraphics g = new ScaledGraphics(graphics);
if (!optimizeClip)
g.clipRect(getBounds().getCropped(getInsets()));
g.translate(getBounds().x + getInsets().left, getBounds().y
+ getInsets().top);
g.scale(zoomFactor);
g.pushState();
paintChildren(g);
g.popState();
g.dispose();
graphics.popState();
graphics.restoreState();
}
But if remove the code and if I replace it by this:
paintClientArea(Graphics gracphics) {
super.paintClientArea(graphics);
}
the thumbnail works well!! But, of course, the zoom doens't works.
Some can say me:
1. if I have done something wrong ?
2. What is the link between paintClientArea() of my figure and the
thumbnail ? Why is it so sensible to this method ?
Thanks !
|
|
|
Re: Zoom and Thumbnail [message #175489 is a reply to message #175395] |
Mon, 04 April 2005 19:45   |
Eclipse User |
|
|
|
It should work. This is, in essence, the same setup as the logic example,
where the editor's contents are being shown in an overview in the outline
page. The ZoomExample you mention also has some commented code. Uncomment
it to see the thumbnail. You can use a FigureCanvas for the original LWS
and change the code to be a ScrollableThumbnail, and that should work too.
You can compare your setup to that one. You'll just have to debug to find
out what's going wrong.
BTW, take the methods from ScalableLayerPane instead of ZoomContainer.
They're more correct. I don't think that's the problem here, though.
"Skhiri Sabri" <sskhirid@ulb.ac.be> wrote in message
news:2ae7888ae6451299f93014d565f66a46$1@www.eclipse.org...
> Hi,
>
> I have a problem concerning zoom and thumbnail view. I'am in this
> situation:
> My principal draw2D view: LwSystem->FigureCanvas-> my figure (Simple
> Figure)
> The thumbnail of my figure : LwSystem2-> ScrollableThumbnail-> my figure
> (as content of the ScrollableThumbnail, and the viewPort of the Figure
> Canvas is passed to the its constructor)
>
> Where ("->" means "contents").
>
> First, It works nice, I don't have any problem.
> But I have added some zoom functionalities, I have followed the
> ZoomContainer example and I have introduced the these methods directly in
> "my figure".
> Then if I use the code below in the paintClientArea(gracphics) of my
> figure, the thumbnail doesn't works !
> (http://cs-devel.ulb.ac.be/tmp/vbm.png)
> paintClientArea(Graphics gracphics) {
> if (getChildren().isEmpty())
> return;
> boolean optimizeClip = getBorder() == null ||
> getBorder().isOpaque();
> graphics.pushState();
> ScaledGraphics g = new ScaledGraphics(graphics);
> if (!optimizeClip)
> g.clipRect(getBounds().getCropped(getInsets()));
>
> g.translate(getBounds().x + getInsets().left, getBounds().y
> + getInsets().top);
> g.scale(zoomFactor);
> g.pushState();
> paintChildren(g);
> g.popState();
> g.dispose();
> graphics.popState();
> graphics.restoreState();
> }
>
> But if remove the code and if I replace it by this:
>
> paintClientArea(Graphics gracphics) {
> super.paintClientArea(graphics);
> }
>
> the thumbnail works well!! But, of course, the zoom doens't works.
>
> Some can say me:
> 1. if I have done something wrong ?
> 2. What is the link between paintClientArea() of my figure and the
> thumbnail ? Why is it so sensible to this method ?
>
>
> Thanks !
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03324 seconds