| author | Jens Thoms Toerring <jt@toerring.de> | 2017年07月24日 08:05:10 +0200 |
|---|---|---|
| committer | Jens Thoms Toerring <jt@toerring.de> | 2017年07月24日 08:05:10 +0200 |
| commit | 4ca05a78fe30757a87a156714ec2d75f35158fcd (patch) | |
| tree | 11a596a44f64f85e108d7989f4e53f45b7ffec84 | |
| parent | 8418360229c743e39fd259fc35ae7d4e21b48ba2 (diff) | |
| download | xforms-4ca05a78fe30757a87a156714ec2d75f35158fcd.tar.gz | |
| -rw-r--r-- | doc/part5_overview.texi | 19 | ||||
| -rw-r--r-- | fdesign/fd_file.c | 2 | ||||
| -rw-r--r-- | fdesign/fd_printC.c | 2 | ||||
| -rw-r--r-- | lib/forms.c | 214 | ||||
| -rw-r--r-- | lib/objects.c | 211 |
diff --git a/doc/part5_overview.texi b/doc/part5_overview.texi index d4b6ddd..fa97af1 100644 --- a/doc/part5_overview.texi +++ b/doc/part5_overview.texi @@ -968,6 +968,12 @@ void fl_get_object_position(FL_OBJECT *obj, FL_Coord *x, FL_Coord *y); @end example @noindent exist. If the object is visible it's redrawn at the new position. +Applying @code{fl_set_object_position()} to an object representing a +group (i.e., as obtained via a call of @code{@ref{fl_bgn_group()}}) +has no effect (as a group has no position and moving all objects in +a group to the same position does not make much sense). Using +@code{fl_get_object_position()} on such an object leaves the contents +of the @code{x} and @code{y} pointer arguments unmodified. An object can also be moved relative to its current position using the function @@ -977,8 +983,13 @@ the function void fl_move_object(FL_OBJECT *obj, FL_Coord dx, FL_Coord dy); @end example @noindent -where @code{dx} and @code{dy} are the amounts by which the object -is moved to the right and down. +where @code{dx} and @code{dy} are the amounts by which the object is +moved to x- and y-direction. As with +@code{@ref{fl_set_object_position()}} visible objects get redrawn at +their new positions. Note: if applied to an object representing a group +(as returned by @code{@ref{fl_bgn_group()}}) all objects belonging to +that group are moved. + To change or inquire about the size of an object use @findex fl_set_object_size() @@ -1235,8 +1246,8 @@ void fl_show_object(FL_OBJECT *obj); @end example @noindent @code{obj} can be the pseudo-object returned by -@code{@ref{fl_bgn_group()}} and then allows to hide or show whole -groups of objects. +@code{@ref{fl_bgn_group()}} and then the call will hide or show all +objects belonging to that group. To determine if an object is visible (given that the form it belongs to is also visible) use diff --git a/fdesign/fd_file.c b/fdesign/fd_file.c index 51ade10..abe7ebd 100644 --- a/fdesign/fd_file.c +++ b/fdesign/fd_file.c @@ -66,7 +66,7 @@ save_object( FILE * fp, char *label; double sc = get_conversion_factor( ); FL_OBJECT *defobj, - fake_obj; + fake_obj = { 0 }; if ( obj->parent ) return; diff --git a/fdesign/fd_printC.c b/fdesign/fd_printC.c index 7db363c..453c32d 100644 --- a/fdesign/fd_printC.c +++ b/fdesign/fd_printC.c @@ -1537,7 +1537,7 @@ output_object( FILE * fp, int altfmt ) { FL_OBJECT * defobj, - fakeobj; + fakeobj = { 0 }; char name[ MAX_VAR_LEN ], cbname[ MAX_VAR_LEN ], argname[ MAX_VAR_LEN ], diff --git a/lib/forms.c b/lib/forms.c index 9e91449..81f10d9 100644 --- a/lib/forms.c +++ b/lib/forms.c @@ -134,7 +134,7 @@ move_form_to_visible_list( FL_FORM * form ) if ( fli_int.hidden_formnumb == 0 || ( i = get_hidden_forms_index( form ) ) < 0 ) { - M_err( "move_form_to_visble_list", "Form not in hidden list" ); + M_err( __func__, "Form not in hidden list" ); return -1; } @@ -170,7 +170,7 @@ move_form_to_hidden_list( FL_FORM * form ) if ( fli_int.formnumb == 0 || ( i = fli_get_visible_forms_index( form ) ) < 0 ) { - M_err( "move_form_to_hidden_list", "Form not in visible list" ); + M_err( __func__, "Form not in visible list" ); return -1; } @@ -188,7 +188,7 @@ move_form_to_hidden_list( FL_FORM * form ) if ( form->num_auto_objects > 0 ) { if ( fli_int.auto_count == 0 ) - M_err( "move_form_to_hidden_list", "Bad auto count" ); + M_err( __func__, "Bad auto count" ); else fli_int.auto_count--; } @@ -213,7 +213,7 @@ remove_form_from_hidden_list( FL_FORM * form ) if ( fli_int.hidden_formnumb == 0 || ( i = get_hidden_forms_index( form ) ) < 0 ) { - M_err( "remove_form_from_hidden_list", "Form not in hidden list" ); + M_err( __func__, "Form not in hidden list" ); return -1; } @@ -294,7 +294,7 @@ create_new_form( FL_Coord w, break; default : - M_err( "create_new_form", "Unknown unit: %d, using pixel", + M_err( __func__, "Unknown unit: %d, using pixel", fli_cntl.coordUnit ); fli_cntl.coordUnit = FL_COORD_PIXEL; } @@ -344,7 +344,7 @@ fl_bgn_form( int type, { if ( ! fli_no_connection && ! flx->display ) { - M_err( "fl_bgn_form", "Missing or failed call of fl_initialize()" ); + M_err( __func__, "Missing or failed call of fl_initialize()" ); exit( 1 ); } @@ -354,7 +354,7 @@ fl_bgn_form( int type, if ( fl_current_form ) { - M_err( "fl_bgn_form", "You forgot to call fl_end_form" ); + M_err( __func__, "You forgot to call fl_end_form" ); exit( 1 ); } @@ -386,13 +386,13 @@ fl_end_form( void ) if ( ! fl_current_form ) { - M_err( "fl_end_form", "No current form" ); + M_err( __func__, "No current form" ); return; } if ( fli_current_group ) { - M_err( "fl_end_form", "You forgot to call fl_end_group." ); + M_err( __func__, "You forgot to call fl_end_group." ); fl_end_group( ); } @@ -416,7 +416,7 @@ fl_addto_form( FL_FORM * form ) { if ( ! form ) { - M_err( "fl_addto_form", "NULL form" ); + M_err( __func__, "NULL form" ); return NULL; } @@ -425,12 +425,12 @@ fl_addto_form( FL_FORM * form ) if ( fl_current_form && fl_current_form != form ) { - M_err( "fl_addto_form", "You forgot to call fl_end_form" ); + M_err( __func__, "You forgot to call fl_end_form" ); return NULL; } if ( fl_current_form ) - M_warn( "fl_addto_form", "Form was never closed." ); + M_warn( __func__, "Form was never closed." ); return fl_current_form = form; } @@ -447,13 +447,13 @@ fl_bgn_group( void ) if ( ! fl_current_form ) { - M_err( "fl_bgn_group", "NULL form" ); + M_err( __func__, "No form is open for additions" ); return NULL; } if ( fli_current_group ) { - M_err( "fl_bgn_group", "You forgot to call fl_end_group." ); + M_err( __func__, "You forgot to call fl_end_group(), adding it" ); fl_end_group( ); } @@ -484,13 +484,13 @@ fli_end_group( void ) if ( ! fl_current_form ) { - M_err( "fl_end_group", "NULL form" ); + M_err( __func__, "No form is open for additions" ); return NULL; } if ( ! fli_current_group ) { - M_err( "fl_end_group", "NULL group." ); + M_err( __func__, "No preceeding call of fl_bgn_form()" ); return NULL; } @@ -771,7 +771,7 @@ fl_scale_form( FL_FORM * form, { if ( ! form ) { - M_err( "fl_scale_form", "NULL form" ); + M_err( __func__, "NULL form" ); return; } @@ -799,7 +799,7 @@ fl_set_form_minsize( FL_FORM * form, { if ( ! form ) { - M_err( "fl_set_form_minsize", "Null form" ); + M_err( __func__, "Null form" ); return; } @@ -818,7 +818,7 @@ fl_set_form_maxsize( FL_FORM * form, { if ( ! form ) { - M_err( "fl_set_form_maxsize", "NULL form" ); + M_err( __func__, "NULL form" ); return; } @@ -838,7 +838,7 @@ fl_set_form_dblbuffer( FL_FORM * form, { if ( ! form ) { - M_err( "fl_set_form_dblbuffer", "NULL form" ); + M_err( __func__, "NULL form" ); return; } @@ -869,7 +869,7 @@ fl_set_form_size( FL_FORM * form, { if ( ! form ) { - M_err( "fl_set_form_size", "NULL form" ); + M_err( __func__, "NULL form" ); return; } @@ -892,7 +892,7 @@ fl_set_form_position( FL_FORM * form, if ( ! form ) { - M_err( "fl_set_form_position", "NULL form" ); + M_err( __func__, "NULL form" ); return; } @@ -965,7 +965,7 @@ fl_set_form_background_color( FL_FORM * form, { if ( ! form ) { - M_err( "fl_set_forms_background_color", "NULL form" ); + M_err( __func__, "NULL form" ); return; } @@ -974,7 +974,7 @@ fl_set_form_background_color( FL_FORM * form, if ( ! form->first ) { - M_err( "fl_set_forms_background_color", "Form has no background" ); + M_err( __func__, "Form has no background" ); return; } @@ -999,7 +999,7 @@ fl_get_form_background_color( FL_FORM * form ) { if ( ! form ) { - M_err( "fl_get_forms_background_color", "NULL form" ); + M_err( __func__, "NULL form" ); return FL_COL1; } @@ -1008,7 +1008,7 @@ fl_get_form_background_color( FL_FORM * form ) if ( ! form->first ) { - M_err( "fl_get_forms_background_color", "Form has no background" ); + M_err( __func__, "Form has no background" ); return FL_COL1; } @@ -1030,7 +1030,7 @@ fl_set_form_hotspot( FL_FORM * form, { if ( ! form ) { - M_err( "fl_set_form_hotspot", "NULL form" ); + M_err( __func__, "NULL form" ); return; } @@ -1050,19 +1050,19 @@ fl_set_form_hotobject( FL_FORM * form, { if ( ! form ) { - M_err( "fl_set_form_hotobject", "NULL form" ); + M_err( __func__, "NULL form" ); return; } if ( ! obj ) { - M_err( "fl_set_form_hotobject", "NULL object" ); + M_err( __func__, "NULL object" ); return; } if ( obj->form != form ) { - M_err( "fl_set_form_hotobject", "Object not part of form" ); + M_err( __func__, "Object not part of form" ); return; } @@ -1102,7 +1102,7 @@ fl_set_form_title( FL_FORM * form, { if ( ! form ) { - M_err( "fl_set_form_title", "NULL form" ); + M_err( __func__, "NULL form" ); return; } @@ -1127,9 +1127,19 @@ fl_set_form_title_f( FL_FORM * form, const char * fmt, ... ) { - char *buf; + char * buf; + + if ( ! form ) + { + M_err( __func__, "NULL form" ); + return; + } + + if ( fmt ) + EXPAND_FORMAT_STRING( buf, fmt ); + else + buf = fl_strdup( "" ); - EXPAND_FORMAT_STRING( buf, fmt ); fl_set_form_title( form, buf ); fl_free( buf ); } @@ -1157,14 +1167,14 @@ fl_prepare_form_window( FL_FORM * form, if ( fl_current_form ) { - M_err( "fl_prepare_form_window", "You forgot to call fl_end_form() %s", + M_err( __func__, "You forgot to call fl_end_form() %s", name ? name : "" ); fl_current_form = NULL; } if ( ! form ) { - M_err( "fl_prepare_form", "NULL form" ); + M_err( __func__, "NULL form" ); return None; } @@ -1281,7 +1291,7 @@ fl_prepare_form_window( FL_FORM * form, } else { - M_err( "fl_prepare_form_window", "Unknown requests: %d", place ); + M_err( __func__, "Unknown requests: %d", place ); fl_initial_wingeometry( form->x, form->y, form->w, form->h ); } @@ -1334,7 +1344,17 @@ fl_prepare_form_window_f( FL_FORM * form, Window w; char *buf; - EXPAND_FORMAT_STRING( buf, fmt ); + if ( ! form ) + { + M_err( __func__, "NULL form" ); + return None; + } + + if ( fmt ) + EXPAND_FORMAT_STRING( buf, fmt ); + else + buf = fl_strdup(""); + w = fl_prepare_form_window( form, place, border, buf ); fl_free( buf ); return w; @@ -1352,7 +1372,7 @@ fl_show_form_window( FL_FORM * form ) if ( ! form ) { - M_err( "fl_show_form_window", "NULL form" ); + M_err( __func__, "NULL form" ); return None; } @@ -1399,7 +1419,7 @@ fl_show_form( FL_FORM * form, { if ( ! form ) { - M_err( "fl_show_form", "NULL form" ); + M_err( __func__, "NULL form" ); return None; } @@ -1422,7 +1442,17 @@ fl_show_form_f( FL_FORM * form, Window w; char *buf; - EXPAND_FORMAT_STRING( buf, fmt ); + if ( ! form ) + { + M_err( __func__, "NULL form" ); + return None; + } + + if ( fmt ) + EXPAND_FORMAT_STRING( buf, fmt ); + else + buf = fl_strdup( "" ); + w = fl_show_form( form, place, border, buf ); fl_free( buf ); return w; @@ -1489,7 +1519,7 @@ set_form_property( FL_FORM * form, { if ( ! form ) { - M_err( "set_form_property", "NULL form" ); + M_err( __func__, "NULL form" ); return; } @@ -1498,7 +1528,7 @@ set_form_property( FL_FORM * form, if ( ! ( prop & FLI_COMMAND_PROP ) ) { - M_err( "set_form_property", "Unknown form property request %u", + M_err( __func__, "Unknown form property request %u", prop ); return; } @@ -1525,19 +1555,19 @@ fl_hide_form( FL_FORM * form ) if ( ! form ) { - M_err( "fl_hide_form", "NULL form" ); + M_err( __func__, "NULL form" ); return; } if ( fli_get_visible_forms_index( form ) < 0 ) { - M_err( "fl_hide_form", "Hiding unknown form" ); + M_err( __func__, "Hiding unknown form" ); return; } if ( form->visible == FL_BEING_HIDDEN ) { - M_err( "fl_hide_form", "Recursive call?" ); + M_err( __func__, "Recursive call?" ); return; } @@ -1609,7 +1639,7 @@ fl_hide_form( FL_FORM * form ) fli_int.unmanaged_count--; if ( fli_int.unmanaged_count < 0 ) { - M_err( "fl_hide_form", "Bad unmanaged count" ); + M_err( __func__, "Bad unmanaged count" ); fli_int.unmanaged_count = 0; } } @@ -1635,19 +1665,19 @@ fl_free_form( FL_FORM * form ) if ( ! form ) { - M_err( "fl_free_form", "NULL form" ); + M_err( __func__, "NULL form" ); return; } if ( form->visible == FL_VISIBLE ) { - M_warn( "fl_free_form", "Freeing visible form" ); + M_warn( __func__, "Freeing visible form" ); fl_hide_form( form ); } if ( get_hidden_forms_index( form ) < 0 ) { - M_err( "fl_free_form", "Freeing unknown form" ); + M_err( __func__, "Freeing unknown form" ); return; } @@ -1692,7 +1722,7 @@ fl_form_is_activated( FL_FORM * form ) { if ( ! form ) { - M_err( "fl_form_is_activated", "NULL form" ); + M_err( __func__, "NULL form" ); return 0; } @@ -1710,7 +1740,7 @@ fl_activate_form( FL_FORM * form ) { if ( ! form ) { - M_err( "fl_activate_form", "NULL form" ); + M_err( __func__, "NULL form" ); return; } @@ -1737,7 +1767,7 @@ fl_deactivate_form( FL_FORM * form ) { if ( ! form ) { - M_err( "fl_deactivate_form", "NULL form" ); + M_err( __func__, "NULL form" ); return; } @@ -1769,7 +1799,7 @@ fl_set_form_atactivate( FL_FORM * form, if ( ! form ) { - M_err( "fl_set_form_atactivate", "NULL form" ); + M_err( __func__, "NULL form" ); return NULL; } @@ -1794,7 +1824,7 @@ fl_set_form_atdeactivate( FL_FORM * form, if ( ! form ) { - M_err( "fl_set_form_atdeactivate", "NULL form" ); + M_err( __func__, "NULL form" ); return NULL; } @@ -1843,15 +1873,13 @@ fl_set_form_atclose( FL_FORM * form, FL_FORM_ATCLOSE fmclose, void * data ) { - FL_FORM_ATCLOSE old; - if ( ! form ) { - M_err( "fl_set_form_atclose", "NULL form" ); + M_err( __func__, "NULL form" ); return NULL; } - old = form->close_callback; + FL_FORM_ATCLOSE old = form->close_callback; form->close_callback = fmclose; form->close_data = data; @@ -1887,6 +1915,12 @@ fl_set_form_geometry( FL_FORM * form, FL_Coord w, FL_Coord h ) { + if ( ! form ) + { + M_err( __func__, "NULL form" ); + return; + } + fl_set_form_position( form, x, y ); fl_set_form_size( form, w, h ); @@ -1911,7 +1945,7 @@ fl_register_raw_callback( FL_FORM * form, if ( ! form ) { - M_err( "fl_register_raw_callback", "Null form" ); + M_err( __func__, "Null form" ); return NULL; } @@ -1956,7 +1990,7 @@ fl_register_raw_callback( FL_FORM * form, } if ( ! valid ) /* unsupported mask */ - M_err( "fl_register_raw_callback", "Unsupported mask 0x%x", mask ); + M_err( __func__, "Unsupported mask 0x%x", mask ); return old_rcb; } @@ -1969,8 +2003,13 @@ void fl_set_form_event_cmask( FL_FORM * form, unsigned long cmask ) { - if ( form ) - form->compress_mask = cmask; + if ( ! form ) + { + M_err( __func__, "NULL form" ); + return; + } + + form->compress_mask = cmask; } @@ -1995,7 +2034,7 @@ fl_set_form_callback( FL_FORM * form, { if ( ! form ) { - M_err( "fl_set_form_callback", "NULL form" ); + M_err( __func__, "NULL form" ); return; } @@ -2013,7 +2052,10 @@ fl_set_form_icon( FL_FORM * form, Pixmap m ) { if ( ! form ) + { + M_err( __func__, "NULL form" ); return; + } form->icon_pixmap = p; form->icon_mask = m; @@ -2028,6 +2070,12 @@ fl_set_form_icon( FL_FORM * form, void fl_set_app_mainform( FL_FORM * form ) { + if ( ! form ) + { + M_err( __func__, "NULL form" ); + return; + } + fli_mainform = form; set_form_property( form, FLI_COMMAND_PROP ); } @@ -2103,6 +2151,12 @@ fl_fit_object_label( FL_OBJECT * obj, if ( fli_no_connection ) return; + if ( ! obj ) + { + M_err( __func__, "NULL object" ); + return; + } + if ( fl_is_outside_lalign( obj->align ) || obj->type == FL_BEGIN_GROUP || obj->type == FL_END_GROUP @@ -2177,31 +2231,30 @@ fl_addto_group( FL_OBJECT * group ) { if ( ! group ) { - M_err( "fl_addto_group", "NULL group." ); + M_err( __func__, "NULL group." ); return NULL; } if ( group->objclass != FL_BEGIN_GROUP ) { - M_err( "fl_addto_group", "Parameter is not a group object." ); + M_err( __func__, "Parameter is not a group object." ); return NULL; } if ( fl_current_form && fl_current_form != group->form ) { - M_err( "fl_addto_group", - "Can't switch to a group on a different form" ); + M_err( __func__, "Can't switch to a group on a different form" ); return NULL; } if ( fli_current_group && fli_current_group != group ) { - M_err( "fl_addto_group", "You forgot to call fl_end_group" ); + M_err( __func__, "You forgot to call fl_end_group" ); return NULL; } if ( fli_current_group ) - M_warn( "fl_addto_group", "Group was never closed" ); + M_warn( __func__, "Group was never closed" ); reopened_group = fl_current_form ? 1 : 2; fl_current_form = group->form; @@ -2218,7 +2271,7 @@ fl_form_is_visible( FL_FORM * form ) { if ( ! form ) { - M_warn( "fl_form_is_visible", "NULL form" ); + M_warn( __func__, "NULL form" ); return FL_INVISIBLE; } @@ -2245,6 +2298,12 @@ fl_adjust_form_size( FL_FORM * form ) osize, bw; + if ( ! form ) + { + M_warn( __func__, "NULL form" ); + return -1.0; + } + if ( fli_no_connection ) return 1.0; @@ -2317,7 +2376,7 @@ fl_raise_form( FL_FORM * form ) if ( form && form->window ) XRaiseWindow( fl_display, form->window ); else - M_err( "fl_raise_form", "NULL form or form window not shown" ); + M_err( __func__, "NULL form or form window not shown" ); } @@ -2330,7 +2389,7 @@ fl_lower_form( FL_FORM * form ) if ( form && form->window ) XLowerWindow( fl_display, form->window ); else - M_err( "fl_lower_form", "NULL form or forn window not shown" ); + M_err( __func__, "NULL form or forn window not shown" ); } @@ -2355,8 +2414,13 @@ fl_get_decoration_sizes( FL_FORM * form, { Atom a; - if ( ! form - || ! form->window + if ( ! form ) + { + M_warn( __func__, "NULL form" ); + return 1; + } + + if ( ! form->window || form->visible != FL_VISIBLE || form->parent ) return 1; @@ -2518,7 +2582,7 @@ fl_form_is_iconified( FL_FORM * form ) if ( ! form ) { - M_err( "fl_form_is_iconified", "NULL form" ); + M_err( __func__, "NULL form" ); return 0; } diff --git a/lib/objects.c b/lib/objects.c index 76a1ef9..4aa3a99 100644 --- a/lib/objects.c +++ b/lib/objects.c @@ -180,8 +180,8 @@ fl_make_object( int objclass, break; default: - M_err( "fl_make_object", "Unknown unit: %d. Reset", - fli_cntl.coordUnit ); + M_warn( __func__, "Unknown unit: %d, using FL_COORD_PIXEL", + fli_cntl.coordUnit ); fli_cntl.coordUnit = FL_COORD_PIXEL; } @@ -250,26 +250,25 @@ fl_add_object( FL_FORM * form, if ( ! obj ) { - M_err( "fl_add_object", "NULL object" ); + M_err( __func__, "NULL object" ); return; } if ( ! form ) { - M_err( "fl_add_object", "NULL form for '%s'", - fli_object_class_name( obj ) ); + M_err( __func__, "NULL form for '%s'", fli_object_class_name( obj ) ); return; } if ( obj->form ) { - M_err( "fl_add_object", "Object already belongs to a form" ); + M_err( __func__, "Object already belongs to a form" ); return; } if ( obj->objclass == FL_BEGIN_GROUP || obj->objclass == FL_END_GROUP ) { - M_err( "fl_add_object", "Can't add an pseudo-object that marks the " + M_err( __func__, "Can't add an pseudo-object that marks the " "start or end of a group" ); return; } @@ -399,13 +398,13 @@ fli_insert_object( FL_OBJECT * obj, if ( ! obj || ! before ) { - M_err( "fli_insert_object", "NULL object" ); + M_err( __func__, "NULL object" ); return; } if ( ! before->form ) { - M_err( "fli_insert_object", "Trying to insert object into NULL form" ); + M_err( __func__, "Trying to insert object into NULL form" ); return; } @@ -477,13 +476,13 @@ fl_delete_object( FL_OBJECT * obj ) if ( ! obj ) { - M_err( "fl_delete_object", "NULL object" ); + M_err( __func__, "NULL object" ); return; } if ( ! obj->form ) { - M_err( "fl_delete_object", "Delete '%s' from NULL form", + M_err( __func__, "Delete '%s' from NULL form", ( obj->label && *obj->label ) ? obj->label : "object" ); return; } @@ -540,7 +539,7 @@ fl_delete_object( FL_OBJECT * obj ) if ( o != obj ) { - M_err( "fl_delete_object", "Can't delete end of group object " + M_err( __func__, "Can't delete end of group object " "while the group still has members" ); return; } @@ -609,7 +608,7 @@ fl_free_object( FL_OBJECT * obj ) if ( ! obj ) { - M_err( "fl_free_object", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -651,7 +650,7 @@ fl_free_object( FL_OBJECT * obj ) if ( o != obj ) { - M_err( "fl_free_object", "Can't free end of group object " + M_err( __func__, "Can't free end of group object " "while the group still has members" ); return; } @@ -727,7 +726,7 @@ fl_get_object_objclass( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_get_object_objNULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -744,7 +743,7 @@ fl_get_object_type( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_get_object_type", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -764,7 +763,7 @@ fl_set_object_boxtype( FL_OBJECT * obj, if ( ! obj ) { - M_err( "fl_set_object_boxtype", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -794,7 +793,7 @@ fl_get_object_boxtype( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_get_object_boxtype", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -812,7 +811,7 @@ fl_set_object_resize( FL_OBJECT * obj, { if ( ! obj ) { - M_err( "fl_set_object_resize", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -842,7 +841,7 @@ fl_get_object_resize( FL_OBJECT * obj, { if ( ! obj ) { - M_err( "fl_get_object_resize", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -862,7 +861,7 @@ fl_set_object_gravity( FL_OBJECT * obj, { if ( ! obj ) { - M_err( "fl_set_object_gravity", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -896,7 +895,7 @@ fl_get_object_gravity( FL_OBJECT * obj, { if ( ! obj ) { - M_err( "fl_get_object_gravity", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -920,13 +919,13 @@ fl_set_object_color( FL_OBJECT * obj, if ( ! obj ) { - M_err( "fl_set_object_color", "NULL object" ); + M_err( __func__, "NULL object" ); return; } if ( col1 >= FL_MAX_COLORS || col2 >= FL_MAX_COLORS ) { - M_err( "fl_set_object_color", "Invalid color" ); + M_err( __func__, "Invalid color" ); return; } @@ -971,7 +970,7 @@ fl_get_object_color( FL_OBJECT * obj, { if ( ! obj ) { - M_err( "fl_get_object_color", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -995,7 +994,7 @@ fl_set_object_dblclick( FL_OBJECT * obj, { if ( ! obj ) { - M_err( "fl_set_object_dblclick", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -1012,7 +1011,7 @@ fl_get_object_dblclick( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_get_object_dblclick", "NULL object" ); + M_err( __func__, "NULL object" ); return ULONG_MAX; } @@ -1031,7 +1030,7 @@ fl_set_object_dblbuffer( FL_OBJECT * obj, if ( ! obj ) { - M_err( "fl_set_object_dblbuffer", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -1071,7 +1070,7 @@ fl_set_object_label( FL_OBJECT * obj, if ( ! obj ) { - M_err( "fl_set_object_label", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -1127,7 +1126,7 @@ fl_get_object_label( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_get_object_label", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -1147,7 +1146,7 @@ fl_set_object_lcol( FL_OBJECT * obj, if ( ! obj ) { - M_err( "fl_set_object_lcol", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -1189,7 +1188,7 @@ fl_get_object_lcol( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_get_object_lcol", "NULL object" ); + M_err( __func__, "NULL object" ); return FL_NOCOLOR; } @@ -1210,7 +1209,7 @@ fl_set_object_lsize( FL_OBJECT * obj, if ( ! obj ) { - M_err( "fl_set_object_lsize", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -1259,7 +1258,7 @@ fl_get_object_lsize( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_get_object_lsize", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -1280,7 +1279,7 @@ fl_set_object_lstyle( FL_OBJECT * obj, if ( ! obj ) { - M_err( "fl_set_object_lstyle", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -1325,7 +1324,7 @@ fl_get_object_lstyle( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_get_object_lstyle", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -1345,7 +1344,7 @@ fl_set_object_lalign( FL_OBJECT * obj, if ( ! obj ) { - M_err( "fl_set_object_lalign", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -1386,7 +1385,7 @@ fl_get_object_lalign( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_get_object_lalign", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -1423,7 +1422,7 @@ fl_activate_object( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_activate_object", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -1467,7 +1466,7 @@ fl_deactivate_object( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_deactive_object", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -1494,7 +1493,7 @@ fl_object_is_active( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_object_is_active", "NULL object" ); + M_err( __func__, "NULL object" ); return 0; } @@ -1534,7 +1533,7 @@ fl_show_object( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_show_object", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -1563,7 +1562,7 @@ fl_object_is_visible( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_object_is_visible", "NULL object" ); + M_err( __func__, "NULL object" ); return 0; } @@ -1641,16 +1640,12 @@ fl_hide_object( FL_OBJECT * obj ) if ( ! obj ) { - M_err( "fl_hide_object", "NULL object" ); + M_err( __func__, "NULL object" ); return; } if ( ! obj->visible ) - { - M_warn( "fl_hide_object", "Object '%s' already is invisible", - obj->label ? obj->label : "Object" ); return; - } reg = XCreateRegion( ); @@ -1813,7 +1808,7 @@ fli_convert_shortcut( const char * str, if ( *c ) { - M_err( "fli_convert_shortcut", "Too many shortcuts (>%d)", + M_err( __func__, "Too many shortcuts (>%d)", MAX_SHORTCUTS ); } @@ -1878,7 +1873,7 @@ fl_set_object_shortcut( FL_OBJECT * obj, if ( ! obj ) { - M_err( "fl_set_object_shortcut", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -1945,7 +1940,7 @@ fl_set_focus_object( FL_FORM * form, { if ( ! form ) { - M_err( "fl_set_focus_object", "NULL form" ); + M_err( __func__, "NULL form" ); return; } @@ -2150,7 +2145,7 @@ mark_object_for_redraw( FL_OBJECT * obj ) if ( ! obj ) { - M_err( "mark_object_for_redraw", "Redrawing NULL object" ); + M_err( __func__, "Request to redraw NULL object" ); return; } @@ -2232,7 +2227,7 @@ fl_redraw_object( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_redraw_object", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -2407,7 +2402,7 @@ fl_freeze_form( FL_FORM * form ) { if ( ! form ) { - M_err( "fl_freeze_form", "NULL form" ); + M_err( __func__, "NULL form" ); return; } @@ -2424,15 +2419,12 @@ fl_unfreeze_form( FL_FORM * form ) { if ( ! form ) { - M_err( "fl_unfreeze_form", "NULL form" ); + M_err( __func__, "NULL form" ); return; } if ( form->frozen == 0 ) - { - M_err( "fl_unfreeze_form", "Unfreezing non-frozen form" ); return; - } /* If the form becomes unfrozen at last and is visible recalculate overlaps between the objects and then redraw all objects that have @@ -2577,7 +2569,7 @@ handle_object( FL_OBJECT * obj, && event != FL_ATTRIB && event != FL_RESIZED ) { - M_err( "handle_object", "Bad object '%s', event = %s", + M_err( __func__, "Bad object '%s', event = %s", obj->label ? obj->label : "", fli_event_name( event ) ); return FL_RETURN_NONE; @@ -2790,7 +2782,7 @@ fl_set_object_callback( FL_OBJECT * obj, if ( ! obj ) { - M_err( "fl_set_object_callback", "NULL object" ); + M_err( __func__, "NULL object" ); return NULL; } @@ -2838,7 +2830,7 @@ fl_set_object_bw( FL_OBJECT * obj, if ( ! obj ) { - M_err( "fl_set_object_bw", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -2886,7 +2878,7 @@ fl_get_object_bw( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_get_object_bw", "NULL object" ); + M_err( __func__, "NULL object" ); return -1; } @@ -3116,7 +3108,7 @@ fl_call_object_callback( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_call_object_callback", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -3295,6 +3287,15 @@ fl_move_object( FL_OBJECT * obj, if ( fli_inverted_y ) dy = - dy; + if ( ! obj ) + { + M_err( __func__, "NULL object" ); + return; + } + + if ( ( dx == 0 && dy == 0 ) || obj->objclass == FL_END_GROUP ) + return; + if ( obj->objclass == FL_BEGIN_GROUP ) { FL_FORM * form = obj->form; @@ -3329,8 +3330,19 @@ fl_get_object_position( FL_OBJECT * obj, FL_Coord * x, FL_Coord * y ) { - *x = obj->x; - *y = fli_inverted_y ? TRANSLATE_Y( obj, obj->form ) : obj->y; + if ( ! obj ) + { + M_err( __func__, "NULL object" ); + return; + } + + if (obj->objclass == FL_BEGIN_GROUP || obj->objclass == FL_END_GROUP) + return; + + if (x) + *x = obj->x; + if (y) + *y = fli_inverted_y ? TRANSLATE_Y( obj, obj->form ) : obj->y; } @@ -3346,10 +3358,18 @@ fl_set_object_position( FL_OBJECT * obj, int need_show = 0; double diff; + if ( ! obj ) + { + M_err( __func__, "NULL object" ); + return; + } + if ( fli_inverted_y ) y = obj->form->h - obj->h - y; - if ( obj->x == x && obj->y == y ) + if ( ( obj->x == x && obj->y == y ) + || obj->objclass == FL_BEGIN_GROUP + || obj->objclass == FL_END_GROUP) return; /* If the object is displayed hide it to get its background redrawn */ @@ -3396,8 +3416,19 @@ fl_get_object_size( FL_OBJECT * obj, FL_Coord * w, FL_Coord * h ) { - *w = obj->w; - *h = obj->h; + if ( ! obj ) + { + M_err( __func__, "NULL object" ); + return; + } + + if (obj->objclass == FL_BEGIN_GROUP || obj->objclass == FL_END_GROUP) + return; + + if (w) + *w = obj->w; + if (h) + *h = obj->h; } @@ -3533,15 +3564,31 @@ fl_get_object_bbox( FL_OBJECT * obj, { XRectangle rect; + if ( ! obj ) + { + M_err( __func__, "NULL object" ); + return; + } + + if (obj->objclass == FL_BEGIN_GROUP || obj->objclass == FL_END_GROUP) + return; + get_object_rect( obj, &rect, 0 ); - *x = rect.x; - if ( ! fli_inverted_y || ! obj->form ) - *y = rect.y; - else - *y = obj->form->h - rect.height - rect.y; - *w = rect.width; - *h = rect.height; + if (x) + *x = rect.x; + if (y) + { + if ( ! fli_inverted_y || ! obj->form ) + *y = rect.y; + else + *y = obj->form->h - rect.height - rect.y; + } + if (w) + *w = rect.width; + + if (h) + *h = rect.height; } @@ -3667,7 +3714,7 @@ fl_object_is_automatic( FL_OBJECT * obj ) { if ( ! obj ) { - M_err( "fl_object_is_automatic", "NULL object" ); + M_err( __func__, "NULL object" ); return 0; } @@ -3722,13 +3769,13 @@ fl_for_all_objects( FL_FORM * form, if ( ! form ) { - M_err( "fl_for_all_objects", "NULL form" ); + M_err( __func__, "NULL form" ); return; } if ( ! fp ) { - M_err( "fl_for_all_objects", "NULL callback function" ); + M_err( __func__, "NULL callback function" ); return; } @@ -3746,7 +3793,7 @@ fl_set_object_helper( FL_OBJECT * obj, { if ( ! obj ) { - M_err( "fl_set_object_helper", "NULL object" ); + M_err( __func__, "NULL object" ); return; } @@ -3812,6 +3859,12 @@ fl_set_object_return( FL_OBJECT * obj, unsigned int fl_get_object_return( FL_OBJECT * obj ) { + if ( ! obj ) + { + M_err( __func__, "NULL object" ); + return -1; + } + return obj->how_return; } |