• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Controlling zoom level of an NSRulerView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Controlling zoom level of an NSRulerView?


  • Subject: Re: Controlling zoom level of an NSRulerView?
  • From: Jonathan del Strother <email@hidden>
  • Date: Thu, 16 Mar 2006 20:26:31 +0000

Well...I've got it working, by calling the following every time the zoom level changes :

[NSRulerView registerUnitWithName:@"Seconds" abbreviation:@"s" unitToPointsConversionFactor:zoom
stepUpCycle:blah1 stepDownCycle:blah2
[[scrollView horizontalRulerView] setMeasurementUnits:@"Seconds"];



Can I doublecheck that this is you meant, scott? Re-registers the definition of "Seconds" on every zoom change seems a rather unpleasant way of doing things.


Jon

On 14 Mar 2006, at 22:42, Volker Runkel wrote:

Hi,

as Scott mentioned, one way is to change the rulers units. I use NSRuler for a time axis and it works like charm (just the units dipslayed are sometimes a bit untypical, like 256,512,768 in samples... :-( ). In code it looks for example like:

[NSRulerView registerUnitWithName:@"milliseconds" abbreviation:@"ms" unitToPointsConversionFactor:(1/reductionFactor)* (srate/(1000*[[NSUserDefaults standardUserDefaults] integerForKey:@"timebase"])) stepUpCycle:[NSArray arrayWithObjects: [NSNumber numberWithFloat:2.0], [NSNumber numberWithFloat:4.0],nil] stepDownCycle:[NSArray arrayWithObjects:[NSNumber numberWithFloat: 0.5],[NSNumber numberWithFloat:0.2],nil]]

This code is called whenever my zoom factor changes, the reductionFactor gives the amount of zoom in my case. Now I just hope that was what Scott understood when he said altering the unit ....


Volker


The NSRulerView zoom level seems to depend on the ratio between the document view's frame and bounds.

However, I'm controlling the document's zoom level separately from the bounds, scaling everything within it by hand. So my bounds are always equal to the frame size, so the rulerview stays at a scaling of 1.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Controlling zoom level of an NSRulerView? (From: Jonathan del Strother <email@hidden>)
 >Re: Controlling zoom level of an NSRulerView? (From: Volker Runkel <email@hidden>)

  • Prev by Date: Re: Accessing window back buffer without deprecated functions in Tiger
  • Next by Date: Res Independence [Was: Accessing window back buffer without deprecated functions in Tiger]
  • Previous by thread: Re: Controlling zoom level of an NSRulerView?
  • Next by thread: dynamic glyph/character advancement
  • Index(es):
    • Date
    • Thread