Lisp HUG Maillist Archive

Quadratic interfaces

Is there a way to force an interface to be always quadratic even if
the user resizes it?  (I think I've seen something like that in apps
like Photoshop.)

FWIW, in my case this is a very simple interface where the only pane
is an output pane.  A Windows-only solution would be fine.

Thanks,
Edi.


Re: Quadratic interfaces

Hi Edi,

I faced these very problems quite recently in our MMWSim. I haven't had the chance to review your code submission yet, but as far as the "stretching windows" interface goes, I found that the way to control it is to plant a dummy object in the pinboard display list whose rectangle occupies the far corner of the window size you want to achieve. That dummy item will never be drawn on screen, but the pinboard manager doesn't know that, and so it will resize the window to accommodate that most extreme element.

David McClain
Chief Technical Officer
Refined Audiometrics Laboratory
4391 N. Camino Ferreo
Tucson, AZ  85750

email: dbm@refined-audiometrics.com
phone: 1.520.390.3995
web: http://refined-audiometrics.com


On Dec 18, 2007, at 22:25, Edi Weitz wrote:


Is there a way to force an interface to be always quadratic even if
the user resizes it?  (I think I've seen something like that in apps
like Photoshop.)

FWIW, in my case this is a very simple interface where the only pane
is an output pane.  A Windows-only solution would be fine.

Thanks,
Edi.



Re: Quadratic interfaces


Edi Weitz wrote:
> Is there a way to force an interface to be always quadratic even if
> the user resizes it?

So that I can follow along when there are answers, could you explain 
what a quadratic interface is?

Mitch


Re: Quadratic interfaces

Hello,

I use this to force an interface to keep a certain aspect ratio (for
instance 16/9 for some QT movies). Here is a simplified version to get the
aspect quadratic. This method avoid the problem of recursivity by the use of
capi:set-hint-table rather than geometry-change-callback. I'm not sure it's
the best way, but it works just fine for me.

Best

Denis


(defclass quadratic-interface (capi:interface) ((previous-size :initform
nil))))

(defvar *min-size* 120)

(defmethod geometry-change-callback ((self quadratic-interface) x y w h)
 (let ((prev (slot-value self 'previous-size))
       (pane (car (capi:layout-description (capi:pane-layout self)))))
    ;to avoid resizing when the pane is simply moved
     (when (or (not prev) (/= (car prev) w) (/= (cdr prev) h))
       (capi:with-geometry pane
         (capi:set-hint-table pane (list :visible-min-width (max *min-size*
capi:%height%) :visible-max-width t))))
     (setf (slot-value self 'previous-size) (cons w h))))



(capi:display (make-instance 'quadratic-interface :best-width *min-size*
:best-height *min-size*
                             :geometry-change-callback
'geometry-change-callback
                             :layout
                             (make-instance 'capi:simple-layout
:visible-min-height *min-size*
                                            :child (make-instance
'capi:simple-pane))))


Le 19/12/07 6:25, « [NOM] » <[ADRESSE]> a écrit :

> 
> Is there a way to force an interface to be always quadratic even if
> the user resizes it?  (I think I've seen something like that in apps
> like Photoshop.)
> 
> FWIW, in my case this is a very simple interface where the only pane
> is an output pane.  A Windows-only solution would be fine.
> 
> Thanks,
> Edi.
> 

-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------



Re: Quadratic interfaces

On Wed, 19 Dec 2007 16:25:58 +0100, Denis Pousseur <denis.pousseur@gmail.com> wrote:

> I use this to force an interface to keep a certain aspect ratio (for
> instance 16/9 for some QT movies). Here is a simplified version to
> get the aspect quadratic. This method avoid the problem of
> recursivity by the use of capi:set-hint-table rather than
> geometry-change-callback. I'm not sure it's the best way, but it
> works just fine for me.

Yes, that works fine for me as well.  Thanks.  It also avoids the
jitter I saw with other solutions.  (Although, to be fair, the jitter
might have been due to the output pane and not due to the actual
resizing solution.)

But I had to change 

  (max *min-size* capi:%height%)

to

  (max *min-size* (or capi:%height% 0))

because otherwise the interface wouldn't even display for me.  It
seems the first time the geometry change callback is called, the
height is still undefined (at least on Windows).


Updated at: 2020-12-10 08:44 UTC