xforms-development
[Top][All Lists]
Advanced

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

[XForms] Fdesign bugs regarding scrollbars and scrollbuttons


From: SBP
Subject: [XForms] Fdesign bugs regarding scrollbars and scrollbuttons
Date: Wed, 10 Aug 2016 00:48:00 -0500

Hi there!

I found some bugs in fdesign regarding scrollbars and
scrollbuttons (still present in 1.2.5pre1), fixes follow:

Adding a scrollbutton and saving causes crash, because the defobj for
FL_SCROLLBUTTON is not defined in function 'create_default_button'.

<< PATCH
--- sp_button.c 2014-06-28 15:34:29.000000000 -0500
+++ xforms-1.2.4/fdesign/sp_button.c
2016-08-09 20:32:06.187303390 -0500 @@ -606,6 +606,8 @@
         defobj = fl_create_checkbutton( ob->type, 0, 0, 0, 0, "" );
     else if ( ob->objclass == FL_ROUND3DBUTTON )
         defobj = fl_create_round3dbutton( ob->type, 0, 0, 0, 0, "" );
+       else if ( ob->objclass == FL_SCROLLBUTTON )
+        defobj = fl_create_scrollbutton( ob->type, 0, 0, 0, 0,
"" ); else
         fprintf( stderr, "Unknown Button Class: %d\n", ob->objclass );
PATCH

Changing the scrollbar type does not redraw it as the appropriate type,
also creating a horizontal scrollbar and then changing to a vertical
one (or vice versa) doesn't change the orientation of the buttons nor
the slider. This was fixed by adding a '*_change_type' function to
scrollbars that sets the labels and changes the type of slider
accordingly. Added swapping width and height when changing from
horizontal to vertical (or vice versa) to avoid ugly scrollbars;
however these still occur if the scrollbar is scaled to odd geometries.

Also, in function 'scrollbar_reread_spec_form', when setting scrollbar
increment ldelta is referenced twice, where it should be rdelta the
second time.

<< PATCH
--- fd_spec.c   2014-06-28 15:34:29.000000000 -0500
+++ xforms-1.2.4/fdesign/fd_spec.c
2016-08-09 23:11:01.558567907 -0500 @@ -231,7 +231,7 @@
 
     {
         { FL_SCROLLBAR },
-        NULL,
+        scrollbar_change_type,
         scrollbar_create_spec_form,
         scrollbar_adjust_spec_form,
         scrollbar_fill_in_spec_form,
PATCH

<< PATCH
--- sp_scrollbar.h      2013-11-23 15:32:53.000000000 -0600
+++ xforms-1.2.4/fdesign/sp_scrollbar.h
2016-08-09 23:28:54.355609037 -0500
@@ -23,6 +23,8 @@
 #include "include/forms.h"
 #include <stdio.h>
 
+void scrollbar_change_type( FL_OBJECT * obj,
+                            int         new_type );
 FL_FORM * scrollbar_create_spec_form( void );
 void scrollbar_adjust_spec_form( FL_OBJECT * obj );
 void scrollbar_fill_in_spec_form( FL_OBJECT * obj );
PATCH

<< PATCH
--- sp_scrollbar.c      2013-12-14 07:26:10.000000000 -0600
+++ xforms-1.2.4/fdesign/sp_scrollbar.c
2016-08-10 00:20:09.949982052 -0500
@@ -41,6 +41,54 @@
 static FL_OBJECT * curobj;
 
 
+#define is_vert( t ) (    t == FL_VERT_SCROLLBAR      \
+                       || t == FL_VERT_NICE_SCROLLBAR \
+                       || t == FL_VERT_THIN_SCROLLBAR \
+                       || t == FL_VERT_PLAIN_SCROLLBAR)
+
+
+/***************************************
+ ***************************************/
+
+void
+scrollbar_change_type( FL_OBJECT * obj,
+                       int         new_type )
+{
+    FLI_SCROLLBAR_SPEC *sp = obj->spec;
+
+       if( is_vert( new_type ) )
+       {
+               fl_set_object_label( sp->up , "8" );
+               fl_set_object_label( sp->down , "2" );
+
+               if ( new_type == FL_VERT_SCROLLBAR )
+                       sp->slider->type = FL_VERT_BROWSER_SLIDER2;
+               else if ( new_type == FL_VERT_THIN_SCROLLBAR )
+                       sp->slider->type = FL_VERT_THIN_SLIDER;
+               else if ( new_type == FL_VERT_PLAIN_SCROLLBAR )
+                       sp->slider->type = FL_VERT_BASIC_SLIDER;
+               else if ( new_type == FL_VERT_NICE_SCROLLBAR )
+                       sp->slider->type = FL_VERT_NICE_SLIDER2;
+
+               if( ! is_vert( obj->type ) )
+                       fl_set_object_size( obj, obj->h, obj->w );
+       }
+       else
+       {
+               fl_set_object_label( sp->up , "6" );
+               fl_set_object_label( sp->down , "4" );
+
+               if ( new_type == FL_HOR_SCROLLBAR )
+                       sp->slider->type = FL_HOR_BROWSER_SLIDER2;
+               else if ( new_type == FL_HOR_THIN_SCROLLBAR )
+                       sp->slider->type = FL_HOR_THIN_SLIDER;
+               else if ( new_type == FL_HOR_PLAIN_SCROLLBAR )
+                       sp->slider->type = FL_HOR_BASIC_SLIDER;
+               else if ( new_type == FL_HOR_NICE_SCROLLBAR )
+                       sp->slider->type = FL_HOR_NICE_SLIDER2;
+
+               if( is_vert( obj->type ) )
+                       fl_set_object_size( obj, obj->h, obj->w );
+       }
+
+       obj->type = new_type;
+}
+
+
 /***************************************
  ***************************************/
 
@@ -65,11 +113,6 @@
 /***************************************
  ***************************************/
 
-#define is_vert( t ) (    t == FL_VERT_SCROLLBAR      \
-                       || t == FL_VERT_NICE_SCROLLBAR \
-                       || t == FL_VERT_THIN_SCROLLBAR )
-
-
 void
 scrollbar_adjust_spec_form( FL_OBJECT * obj )
 {
@@ -132,7 +175,7 @@
         fl_set_scrollbar_size( obj, r1 );
 
     if (    get_checked_float( fl_get_input( scb_attrib->ldelta ), &r1
)
-         && get_checked_float( fl_get_input( scb_attrib->ldelta ), &r2
) )
+         && get_checked_float( fl_get_input( scb_attrib->rdelta ), &r2
) )
         fl_set_scrollbar_increment( obj, r1, r2 );
 
     redraw_the_form( 0 );
PATCH

Cheers!

Sirius



reply via email to

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