xforms-development
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XForms] positioner


From: alessandro basili
Subject: Re: [XForms] positioner
Date: Sat, 7 Apr 2012 22:01:12 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

On 4/6/2012 11:41 PM, Jens Thoms Toerring wrote:
> Hi Al,
> 
> On Fri, Apr 06, 2012 at 04:23:16PM +0200, alessandro basili wrote:
>> is there a way to have two cross-hair cursors in the positioner?
>> I'd like to use it to zoom in and out in a 2d picture.
> 
> Sorry, but there's only a single cross-hair to a positioner.
> Otherwise this would be a rather different object, e.g. you
> would need additional functions to switch which of the
> tow cross-hairs is controlled by the mouse at a certain
> time.

well, the idea was to have each cross-hair controlled by one mouse
button.  The approach was kind of natural to me since I was used to an
EDA tool for circuits simulations which allowed to have the cross-hair
moving independently.
[...]
> Instead of "faking" the cross-hair you could also try to
> put two positioners on top of each other and deactivate
> one of them at first, and, when the one still active is
> finished, deactivate it and activate the one previously
> deactivated.

that sounds interesting, I will try that.
Indeed another idea come to mind, instead of having the two cross-hair I
may have a zoom and a positioner. The latter would only take care about
moving around the picture, while the former would be needed for the
zooming functionality. In this case drawing a square, showing the zoomed
area, around the cross-hair would facilitate the usage, but I guess is
not necessary.

> 
> But mind, this won't work with version 0.89 (and even some
> newer ones, I think you need at least 1.0.92).

One of the biggest problem I have now is to find the documentation
matching to our release (which is 1.0 - released december 2002). Any
reference online would be appreciated.

> 
>                          Best regards, Jens
> 
> -----------------8<----------------------------------------
> 
> #include <stdio.h>
> #include "forms.h"
> 
> static FL_OBJECT * xval,
>                  * yval;
> static FL_OBJECT * pos1,
>                  * pos2;
> 
> /***************************************
>  ***************************************/
> 
> static void
> positioner_cb( FL_OBJECT * obj,
>                long        data )
> {
>     char str[ 30 ];
> 
>     sprintf( str, "%f", fl_get_positioner_xvalue( obj ) );
>     fl_set_object_label( xval, str );
>     sprintf( str, "%f", fl_get_positioner_yvalue( obj ) );
>     fl_set_object_label( yval, str );
> 
>     if ( fl_get_object_return_state( obj ) & FL_RETURN_END )
>     {
>         if ( data == 0 )
>         {
>             fl_deactivate_object( pos1 );
>             fl_activate_object( pos2 );
>         }
>         else
>         {
>             fl_deactivate_object( pos2 );
>             fl_activate_object( pos1 );
>         }
>     }
> }
> 
> /***************************************
>  ***************************************/
> 
> int
> main( int    argc,
>       char * argv[ ] )
> {
>     FL_FORM   * form;
> 
>     fl_initialize( &argc, argv, "FormDemo", 0, 0 );
> 
>     form = fl_bgn_form( FL_UP_BOX, 400, 280 );
> 
>     pos1 = fl_add_positioner( FL_NORMAL_POSITIONER, 40, 40, 200, 200, "" );
>     fl_set_positioner_xbounds( pos1, 0, 1 );
>     fl_set_positioner_ybounds( pos1, 0, 1 );
>     fl_set_object_callback( pos1, positioner_cb, 0 );
>     fl_set_object_return( pos1, FL_RETURN_CHANGED | FL_RETURN_END );
>     fl_deactivate_object( pos1 );
> 
>     pos2 = fl_add_positioner( FL_OVERLAY_POSITIONER, 40, 40, 200, 200, "" );
>     fl_set_positioner_xbounds( pos2, 0, 1 );
>     fl_set_positioner_ybounds( pos2, 0, 1 );
>     fl_set_object_callback( pos2, positioner_cb, 1 );
>     fl_set_object_color( pos2, FL_YELLOW, FL_YELLOW );
>     fl_set_object_return( pos2, FL_RETURN_CHANGED | FL_RETURN_END );
> 
>     xval = fl_add_box( FL_DOWN_BOX, 270, 40, 100, 30, "" );
>     fl_set_object_color( xval, FL_COL1, FL_COL1 );
> 
>     yval = fl_add_box( FL_DOWN_BOX, 270, 90, 100, 30, "" );
>     fl_set_object_color( yval, FL_COL1, FL_COL1 );
> 
>     fl_add_button( FL_NORMAL_BUTTON, 270, 210, 100, 30, "Exit" );
> 
>     fl_end_form( );
> 
>     fl_show_form( form, FL_PLACE_CENTER, FL_NOBORDER, "positioner2" );
> 
>     fl_do_forms( );
>     fl_hide_form( form );
>     fl_finish( );
> 
>     return 0;
> }
> 
> -----------------8<----------------------------------------
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]