[Top][All Lists]

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

[XForms] New development release

From: Jens Thoms Toerring
Subject: [XForms] New development release
Date: Sat, 24 May 2014 21:37:23 +0200
User-agent: Mutt/1.5.21 (2010-09-15)


   I've just uploaded a new development version:


It comes with a number of changes to the positioner object:

a) Probably most interesting: the range of values the user can pick can
   now be controlled via a "validator" function. When set each time the
   user moves the postioner to a new postion the coordinates are passed
   to that validation function and the function can then return a value
   (FL_POSITIONER_INVALID) to indicate that the new position is unaccep-
   table, it can flag that    the new position is ok (FL_POSITIONER_VALID),
   or it can indicate that the position isn't ok and should be replaced by
   a different postion also returned (FL_POSITIONER_REPLACED).

   Background is that I attempted to write a color chooser with a HSV color-
   wheel (hi Sian, thanks for the idea) and the colorwheel is a circle
   from which a color is to be picked. With a validator function one now
   can keep the postioner within this circle (but also, in principle, in
   an arbitrarily formed area).

b) There are now functions for setting both the x- and y-value of a positioner
   at once (sometimes necessary when a validator is active since) and to
   get the current boundary settings. Another function allows to tell the
   positioner that its background is going to change to avoid artefacts if
   this happens.

c) Up to now the lines of the positioner were drawn in XOR mode. This let to
   the lines often becoming hard to see. This is now replaced by drawing
   "real" lines in the selected color. And, while the positioner is active
   and the mouse is over it, the cursor is switched of - this makes it easier
   to see were exactly the positioner is.

I hope these changes make sense to you and don't interfer witch any of your
existing programs. Otherwise please complain loudly!

With the changes of the positioner there's now also a new "goodie", a color
chooser. You call it with

int fl_show_color_chooser( const int *rgb_in, int * rgb_out );

The first argument is an array of three RGB values the color chooser should
start up with. If you pass it a NULL pointer it starts with white. The second
argument is an array with three elements for returning the selected color.
If the user clicks on "OK" the funtion returns 1 and sets up 'ref_out',
if s/he clicks on "Cancel" 0 ist returned (and 'rgb_out' remains unchanged).

Here's a short program for testing it:

#include <forms.h>

int main( int argc, char **argv )
    int rgb[ 3 ] = { 171, 13, 198 };

    fl_initialize( &argc, argv, "", 0, 0 );
    if ( fl_show_color_chooser( rgb, rgb ) )
        printf( "You picked %d, %d, %d\n", rgb[ 0 ], rgb[ 1 ], rgb[ 2 ] );
    return 0;

I hope you like the changes;-) Please let me know if they break anything
with your code.
                                 Best regards, Jens
  \   Jens Thoms Toerring  ________      address@hidden
   \_______________________________      http://toerring.de

reply via email to

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