Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Zoom working strange with text
Zoom working strange with text [message #235253] Thu, 07 June 2007 17:38 Go to next message
Eclipse UserFriend
Originally posted by: mgauthier.trisotech.com

Hi,

I'm having a hard time finding which cause the zooming behavior to act in a
very strange way with all the text elements: only some of them are actually
zoomed in/out. They all use the same font (the default Eclipse font, which
is Tahoma). The figure is zoomed in but the text flow it content doesn't for
most of the figure. If I move some shape around or if I play with the
scrolled bar or with the square region in the Outline, it sometime pick the
right size, but the behavior seems random. The shape are simply figure using
a TextFlow added to a flow page.

By looking in the new thread, I found someone who had the same problem
(thread 'Adding children editparts with zoom does not scale the text')
Unfortunately, the thread didn't lead to a solution. However, Randy Hudson
said "I suspect you might have been calling push/pop in a non-symmetric
way?", but I don't know what he meant by that.

Any clue to where I should start looking?

Thanks

Melanie



  • Attachment: zoom100.gif
    (Size: 3.36KB, Downloaded 165 times)
  • Attachment: zoom150.gif
    (Size: 4.13KB, Downloaded 155 times)
Re: Zoom working strange with text [message #235271 is a reply to message #235253] Thu, 07 June 2007 18:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mgauthier.trisotech.com

Here the code where the figure is actually paint (and where there's
actually push and pop):

protected void paintFigure(Graphics graphics) {
if (shape != null) {
graphics.pushState();
graphics.clipRect(getBounds());
shape.paint(graphics);
graphics.popState();
}
if (label != null) {
graphics.pushState();
graphics.clipRect(getBounds());
flowPage.paint(graphics);
graphics.popState();
}
}
}

The shape is a RoundedRectangle and the label is simply the text to
display. The text flow and the flow page have been created in the
constructor along with the shape using this code:

flowPage = new FlowPage();
textFlow = new TextFlow();
textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
ParagraphTextLayout.WORD_WRAP_SOFT));
flowPage.add(textFlow);
RoundedRectangle shape = new RoundedRectangle();
shape.setSize(60, 60);
Re: Zoom working strange with text [message #235366 is a reply to message #235271] Mon, 11 June 2007 13:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mgauthier.trisotech.com

Here's where I am with my zooming problem. I was checking how the GEF logic
example created the shapes since their zooming works fine and I was trying
to make my creation looks closer to that, but it didn't seem to work so I
took the StrickyNote and the BentFigure and I added them to my drawing.
Unfortunatly, the text was still not zooming properly while it does in the
GEF example. I didn't transfer the label edit part, but I didn't think it
was affect by the zooming.

Does someone have any idea to what I should be looking for?

Thanks

Melanie
Re: Zoom working strange with text [message #235422 is a reply to message #235271] Tue, 12 June 2007 14:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

It looks like you are asking an unparented figure to paint. It may be
setting the Graphic's font to null, which would not scale perhaps. All
figure's need a parent.

> protected void paintFigure(Graphics graphics) {
....
> flowPage.paint(graphics);
Re: Zoom working strange with text [message #235506 is a reply to message #235422] Tue, 12 June 2007 20:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mgauthier.trisotech.com

Thanks for the answer. I'm going to check that.
Re: Zoom working strange with text [message #236062 is a reply to message #235422] Wed, 20 June 2007 14:37 Go to previous message
Eclipse UserFriend
Originally posted by: mgauthier.trisotech.com

Here's an update about that scaling problem...

My college found a way to patch the problem but couldn't figure what was
causing it in the first place. All the push and pop are properly done, he
checked that in the debugger.

The way he fixed the problem is by setting the font each time the figure
is painted, which allow the first figure - that had always scaled properly
- and all the following to work well with the zoom.

Here is the new paintFigure method of our shape which extends Figure:
graphics.pushState();
try {
if (shape != null) {
shape.paint(graphics);
}
if (label != null) {
Font font = new Font(getFont().getDevice(),
getFont().getFontData());
graphics.setFont(font);
flowPage.paint(graphics);
font.dispose();
}
} finally {
graphics.popState();
}

The line "flowPage.setParent(this);" has also been added to the creation
of the shape to make sure the flowPage has a parent, but it didn't make
any difference.

Note that when a figure is painted alone (when it is selected for
example), it was scaling properly even before the patch. The problem
occurs when more than one figure is painted.

Since our solution seems to go around the problem instead of solving it,
feel free to give your input if you know what could really causing it!

Thanks

Melanie
Previous Topic:Automatically creating additional shapes on a drop from the pallete
Next Topic:GEF and draw2d : importing and editing images
Goto Forum:
  


Current Time: Mon Aug 15 17:22:48 GMT 2022

Powered by FUDForum. Page generated in 0.02264 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top