setting a viewport [message #220389] |
Mon, 31 July 2006 11:17 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: osipov.appliedtech.ru
Hi, everybody!
Is there any way I can set a viewport for my gef-editor?
I know it will result in scrollbars appearing, but that is ok.
All I want to do is to make (0,0) being in the middle at the very
beginning - there I draw a small red cross. Of course I can do it by just
recalculating that shift internally and always add/subtract it, but why
bother?
thanks a lot.
|
|
|
Re: setting a viewport [message #220485 is a reply to message #220389] |
Mon, 31 July 2006 19:38 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.unknown.com
FigureCanvas has a setViewport() method, but there's probably an easier way
to do what you want.
"Peter Osipov" <osipov@appliedtech.ru> wrote in message
news:eakosr$p9l$1@utils.eclipse.org...
> Hi, everybody!
> Is there any way I can set a viewport for my gef-editor?
> I know it will result in scrollbars appearing, but that is ok.
> All I want to do is to make (0,0) being in the middle at the very
> beginning - there I draw a small red cross. Of course I can do it by just
> recalculating that shift internally and always add/subtract it, but why
> bother?
> thanks a lot.
>
>
|
|
|
Re: setting a viewport [message #220499 is a reply to message #220485] |
Tue, 01 August 2006 05:10 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: osipov.appliedtech.ru
Hi, Pratik!
Thanks for your reply.
What I was trying to do is this:
FigureCanvas editor = getEditor();
Viewport viewport = editor.getViewport();
viewport.getHorizontalRangeModel().setMinimum(-2000);
viewport.getVerticalRangeModel().setMinimum(-2000);
viewport.setViewLocation(-2000, -2000);
Before that I was not using this two lines:
viewport.getHorizontalRangeModel().setMinimum(-2000);
viewport.getVerticalRangeModel().setMinimum(-2000);
But all in all the viewport is not changed at all. In debug mode I see that
for RangeModel those values are changed, but nothing happens. I wander what
is going on. :-|
$qbs$1@utils.eclipse.org...
> FigureCanvas has a setViewport() method, but there's probably an easier
way
> to do what you want.
>
> "Peter Osipov" <osipov@appliedtech.ru> wrote in message
> news:eakosr$p9l$1@utils.eclipse.org...
> > Hi, everybody!
> > Is there any way I can set a viewport for my gef-editor?
> > I know it will result in scrollbars appearing, but that is ok.
> > All I want to do is to make (0,0) being in the middle at the very
> > beginning - there I draw a small red cross. Of course I can do it by
just
> > recalculating that shift internally and always add/subtract it, but why
> > bother?
> > thanks a lot.
> >
> >
>
>
|
|
|
Re: setting a viewport [message #220527 is a reply to message #220499] |
Tue, 01 August 2006 16:26 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: none.unknown.com
That's too hacky. You definitely don't want to go down that route.
Instead, what you can do is have your primary layer report a different
preferred size. Assuming your primary layer is a freeform layer, it will
report its freeform extents based on any children. You could override it to
report certain minimum bounds even if there are no children. Then, it's a
simple matter of scrolling the diagram when the editor's opened (setting the
range model's initial value to be some negative coordinate instead of 0,0).
"Peter Osipov" <osipov@appliedtech.ru> wrote in message
news:eamnne$lr3$1@utils.eclipse.org...
> Hi, Pratik!
> Thanks for your reply.
> What I was trying to do is this:
> FigureCanvas editor = getEditor();
> Viewport viewport = editor.getViewport();
> viewport.getHorizontalRangeModel().setMinimum(-2000);
> viewport.getVerticalRangeModel().setMinimum(-2000);
> viewport.setViewLocation(-2000, -2000);
> Before that I was not using this two lines:
> viewport.getHorizontalRangeModel().setMinimum(-2000);
> viewport.getVerticalRangeModel().setMinimum(-2000);
> But all in all the viewport is not changed at all. In debug mode I see
> that
> for RangeModel those values are changed, but nothing happens. I wander
> what
> is going on. :-|
>
>
> $qbs$1@utils.eclipse.org...
>> FigureCanvas has a setViewport() method, but there's probably an easier
> way
>> to do what you want.
>>
>> "Peter Osipov" <osipov@appliedtech.ru> wrote in message
>> news:eakosr$p9l$1@utils.eclipse.org...
>> > Hi, everybody!
>> > Is there any way I can set a viewport for my gef-editor?
>> > I know it will result in scrollbars appearing, but that is ok.
>> > All I want to do is to make (0,0) being in the middle at the very
>> > beginning - there I draw a small red cross. Of course I can do it by
> just
>> > recalculating that shift internally and always add/subtract it, but why
>> > bother?
>> > thanks a lot.
>> >
>> >
>>
>>
>
>
|
|
|
Re: setting a viewport [message #220548 is a reply to message #220527] |
Wed, 02 August 2006 03:53 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: osipov.appliedtech.ru
Hi, Pratik!
That sounds very reasonable. I was guessing that something with layer bounds
has to be done, but without your piece of advice it would have been a long
way. Let me try it.
Thanks again for your support very much.
> That's too hacky. You definitely don't want to go down that route.
> Instead, what you can do is have your primary layer report a different
> preferred size. Assuming your primary layer is a freeform layer, it will
> report its freeform extents based on any children. You could override it
to
> report certain minimum bounds even if there are no children. Then, it's a
> simple matter of scrolling the diagram when the editor's opened (setting
the
> range model's initial value to be some negative coordinate instead of
0,0).
>
> "Peter Osipov" <osipov@appliedtech.ru> wrote in message
> news:eamnne$lr3$1@utils.eclipse.org...
> > Hi, Pratik!
> > Thanks for your reply.
> > What I was trying to do is this:
> > FigureCanvas editor = getEditor();
> > Viewport viewport = editor.getViewport();
> > viewport.getHorizontalRangeModel().setMinimum(-2000);
> > viewport.getVerticalRangeModel().setMinimum(-2000);
> > viewport.setViewLocation(-2000, -2000);
> > Before that I was not using this two lines:
> > viewport.getHorizontalRangeModel().setMinimum(-2000);
> > viewport.getVerticalRangeModel().setMinimum(-2000);
> > But all in all the viewport is not changed at all. In debug mode I see
> > that
> > for RangeModel those values are changed, but nothing happens. I wander
> > what
> > is going on. :-|
> >
> >
> > $qbs$1@utils.eclipse.org...
> >> FigureCanvas has a setViewport() method, but there's probably an easier
> > way
> >> to do what you want.
> >>
> >> "Peter Osipov" <osipov@appliedtech.ru> wrote in message
> >> news:eakosr$p9l$1@utils.eclipse.org...
> >> > Hi, everybody!
> >> > Is there any way I can set a viewport for my gef-editor?
> >> > I know it will result in scrollbars appearing, but that is ok.
> >> > All I want to do is to make (0,0) being in the middle at the very
> >> > beginning - there I draw a small red cross. Of course I can do it by
> > just
> >> > recalculating that shift internally and always add/subtract it, but
why
> >> > bother?
> >> > thanks a lot.
> >> >
> >> >
> >>
> >>
> >
> >
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05129 seconds