< Back to IRCAM Forum

Writing a BPF-like editor with ruler between 0 and 1

Hi,

I am writing an OM library that requires a BPF-like editor class, but with a vertical ruler ranging from 0 to 1. Following the BPF I set the range like this:

(defmethod init-coor-system ((self my-panel))  
  (set-ranges self '(0 10) '(0 1))  
  (redraw-rulers self)  
  (om-invalidate-view self))

This doesn’t give me any steps on the ruler between 0 and 1, however (see the attached screenshot). From other OM editors (like the Maquette) I know that it’s possible to achieve this, but I’m obviously missing some setting. I tried defining the ruler like this:

(om-make-view 'ruler   
              :axe 'y  
              :zoom 1000  
              :minzoom 0.001  
              :assoc-view panel  
              :position (om-make-point 0 0)  
              :size (om-make-point 25 (- (h self) 25)))

But that doesn’t give me what I want either. I’ve dug deep into the code, but can’t seem to figure this one out. Any pointers would be greatly appreciated.

Many thanks,
Chris

editor.png

Hi Chris

BPF editors in OM (and BPF objects in general) internally deal only with integer values.
This means that when a BPF has 2 decimals precision and ranges from 0 to 1, it “internally” ranges from 0 to 100.

If the “real” (internal) range is [0 1] then there is no step in between.

So I think what you should do is set the ruler ranges according to your decimals precision (0 10^decimals)

I hope this helps,

Jean

Ah, I understand now. My mental picture of how the BPF works internally was incorrect. Thanks for your help Jean!

Best,
Chris