Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » ruler marks < 0
ruler marks < 0 [message #138025] Mon, 14 June 2004 18:30 Go to next message
steven melzer is currently offline steven melzerFriend
Messages: 38
Registered: July 2009
Member
can you create a ruler that starts with a mark < 0.

i believe the answer is no. i am looking in the RulerFigure's paint
method and the marks are based on the clipped rectangle. a rectangle
cannot have a negative value, so i assume the marks cannot either. i am
looking at:

int startMark = (int)(clippedBounds.y / (dotsPerUnit * unitsPerMajorMark))
* divsPerMajorMark;

specifically.

i would like to add an 'offset' to the line:

String num = "" + (div / divsPerMajorMark) * unitsPerMajorMark;

that would print numbers less than 0. right now i'd imagine that i have
to subclass RulerFigure and just copy and paste the paint method and make
the small change.

i have 2 questions:
1) is this correct?
2) i am not sure how to inject my RulerFigure. i assume i need to
ultimately subclass the RulerComposite to tell it to use my RulerEditPart
and RulerFigure, but i cannot tell where RulerComposite gets created.

thanks,
steve
Re: ruler marks < 0 [message #138059 is a reply to message #138025] Mon, 14 June 2004 20:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Place something in negative coordinates in the logic example to see this
behavior.

"Steven Melzer" <smelzer@paymentech.com> wrote in message
news:cakqsa$d4$1@eclipse.org...
> can you create a ruler that starts with a mark < 0.
>
> i believe the answer is no. i am looking in the RulerFigure's paint
> method and the marks are based on the clipped rectangle. a rectangle
> cannot have a negative value, so i assume the marks cannot either. i am
> looking at:
>
> int startMark = (int)(clippedBounds.y / (dotsPerUnit * unitsPerMajorMark))
> * divsPerMajorMark;
>
> specifically.
>
> i would like to add an 'offset' to the line:
>
> String num = "" + (div / divsPerMajorMark) * unitsPerMajorMark;
>
> that would print numbers less than 0. right now i'd imagine that i have
> to subclass RulerFigure and just copy and paste the paint method and make
> the small change.
>
> i have 2 questions:
> 1) is this correct?
> 2) i am not sure how to inject my RulerFigure. i assume i need to
> ultimately subclass the RulerComposite to tell it to use my RulerEditPart
> and RulerFigure, but i cannot tell where RulerComposite gets created.
>
> thanks,
> steve
>
Re: ruler marks < 0 [message #138129 is a reply to message #138025] Tue, 15 June 2004 06:57 Go to previous message
Eclipse UserFriend
Originally posted by: eostroukhov.hotmail.com

I had to do a lot of tweaking to the rulers - adding offset was one of them.
Right now rulers are limited in the way they can be customized but I do hope
that in the post-GEF3.0 they will be reworked. I filed the bug
https://bugs.eclipse.org - you can try to borrow some code there.

Eugene

"Steven Melzer" <smelzer@paymentech.com> wrote in message
news:cakqsa$d4$1@eclipse.org...
> can you create a ruler that starts with a mark < 0.
>
> i believe the answer is no. i am looking in the RulerFigure's paint
> method and the marks are based on the clipped rectangle. a rectangle
> cannot have a negative value, so i assume the marks cannot either. i am
> looking at:
>
> int startMark = (int)(clippedBounds.y / (dotsPerUnit * unitsPerMajorMark))
> * divsPerMajorMark;
>
> specifically.
>
> i would like to add an 'offset' to the line:
>
> String num = "" + (div / divsPerMajorMark) * unitsPerMajorMark;
>
> that would print numbers less than 0. right now i'd imagine that i have
> to subclass RulerFigure and just copy and paste the paint method and make
> the small change.
>
> i have 2 questions:
> 1) is this correct?
> 2) i am not sure how to inject my RulerFigure. i assume i need to
> ultimately subclass the RulerComposite to tell it to use my RulerEditPart
> and RulerFigure, but i cannot tell where RulerComposite gets created.
>
> thanks,
> steve
>
Previous Topic:Creating multi line Text in GEF
Next Topic:probleme avec les scrolls
Goto Forum:
  


Current Time: Thu Apr 25 23:22:09 GMT 2024

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

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

Back to the top