xforms.git - xforms

index : xforms.git
xforms
summary refs log tree commit diff
diff options
context:
space:
mode:
authorJens Thoms Toerring <jt@toerring.de>2017年07月20日 12:57:04 +0200
committerJens Thoms Toerring <jt@toerring.de>2017年07月20日 12:57:04 +0200
commit8418360229c743e39fd259fc35ae7d4e21b48ba2 (patch)
tree1fda906b56565924ddf450cdd782720f48ea3eee
parent6cea48e4175ca9f3b94adfcf3d5c9aa67e004393 (diff)
downloadxforms-8418360229c743e39fd259fc35ae7d4e21b48ba2.tar.gz
Fixes from ЭлектроРысь integrated
Diffstat
-rw-r--r--demos/iconvert.c 2
-rw-r--r--demos/inout_gui.c 118
-rw-r--r--demos/inout_gui.h 43
-rw-r--r--lib/menu.c 2
4 files changed, 163 insertions, 2 deletions
diff --git a/demos/iconvert.c b/demos/iconvert.c
index 2debaf1..8e6aede 100644
--- a/demos/iconvert.c
+++ b/demos/iconvert.c
@@ -69,7 +69,7 @@ main( int argc,
}
fmt += fmt[ 0 ] == '.';
- im = flimage_load( strdup( args[ 1 ] ) );
+ im = flimage_load( fl_strdup( args[ 1 ] ) );
return flimage_dump( im, args[ 2 ], fmt ) < 0 ? 3 : 0;
}
diff --git a/demos/inout_gui.c b/demos/inout_gui.c
new file mode 100644
index 0000000..344d82b
--- /dev/null
+++ b/demos/inout_gui.c
@@ -0,0 +1,118 @@
+/* Form definition file generated by fdesign on Mon Jan 23 18:30:00 2017 */
+
+#include <stdlib.h>
+#include "inout_gui.h"
+
+
+/***************************************
+ ***************************************/
+
+FD_f *
+create_form_f( void )
+{
+ FL_OBJECT *obj;
+ FD_f *fdui = ( FD_f * ) fl_malloc( sizeof *fdui );
+
+ fdui->vdata = fdui->cdata = NULL;
+ fdui->ldata = 0;
+
+ fdui->f = fl_bgn_form( FL_NO_BOX, 737, 613 );
+
+ obj = fl_add_box( FL_FLAT_BOX, 0, 0, 737, 613, "" );
+
+ obj = fl_add_labelframe( FL_ENGRAVED_FRAME, 180, 325, 320, 100,
+ "PLC managing the process and holding the "
+ "values" );
+
+ obj = fl_add_text( FL_NORMAL_TEXT, 200, 345, 100, 30, "process value 1" );
+
+ fdui->plc_pv1 = obj = fl_add_text( FL_NORMAL_TEXT, 330, 345, 150, 30, "0" );
+ fl_set_object_boxtype( obj, FL_DOWN_BOX );
+ fl_set_object_color( obj, FL_MCOL, FL_MCOL );
+ fl_set_object_lsize( obj, 16 );
+ fl_set_object_lalign( obj, FL_ALIGN_CENTER );
+
+ obj = fl_add_text( FL_NORMAL_TEXT, 200, 385, 100, 30, "process value 2" );
+
+ fdui->plc_pv2 = obj = fl_add_text( FL_NORMAL_TEXT, 330, 380, 150, 30, "0" );
+ fl_set_object_boxtype( obj, FL_DOWN_BOX );
+ fl_set_object_color( obj, FL_MCOL, FL_MCOL );
+ fl_set_object_lsize( obj, 16 );
+ fl_set_object_lalign( obj, FL_ALIGN_CENTER );
+
+ obj = fl_add_labelframe( FL_ENGRAVED_FRAME, 75, 185, 220, 95,
+ "terminal 1 (never stops)" );
+
+ fdui->term1_pv1 = obj = fl_add_input( FL_INT_INPUT, 190, 195, 90, 35,
+ "process value 1" );
+ fl_set_object_color( obj, FL_YELLOW, FL_WHEAT );
+ fl_set_object_callback( obj, cb_write_to_plc, 1 );
+
+ fdui->term1_pv2 = obj = fl_add_input( FL_INT_INPUT, 190, 235, 90, 35,
+ "process value 2" );
+ fl_set_object_color( obj, FL_YELLOW, FL_WHEAT );
+ fl_set_object_callback( obj, cb_write_to_plc, 2 );
+
+ obj = fl_add_labelframe( FL_ENGRAVED_FRAME, 375, 185, 220, 95,
+ "terminal 2 (stops with work around)" );
+
+ fdui->term2_pv1 = obj = fl_add_input( FL_INT_INPUT, 490, 195, 90, 35,
+ "process value 1" );
+ fl_set_object_color( obj, FL_YELLOW, FL_WHEAT );
+ fl_set_object_callback( obj, cb_write_to_plc, 1 );
+
+ fdui->term2_pv2 = obj = fl_add_input( FL_INT_INPUT, 490, 235, 90, 35,
+ "process value 2" );
+ fl_set_object_color( obj, FL_YELLOW, FL_WHEAT );
+ fl_set_object_callback( obj, cb_write_to_plc, 2 );
+
+ obj = fl_add_labelframe( FL_ENGRAVED_FRAME, 145, 445, 415, 100,
+ "terminal 3 using InOut" );
+
+ fdui->term3_pv1 = obj = fl_add_input( FL_INT_INPUT, 257, 460, 88, 35,
+ "process value 1" );
+ fl_set_object_color( obj, FL_YELLOW, FL_WHEAT );
+ fl_set_object_callback( obj, cb_write_to_plc, 1 );
+
+ fdui->term3_pv2 = obj = fl_add_input( FL_INT_INPUT, 257, 500, 88, 35,
+ "process value 2" );
+ fl_set_object_color( obj, FL_YELLOW, FL_WHEAT );
+ fl_set_object_callback( obj, cb_write_to_plc, 2 );
+
+ obj = fl_add_button( FL_NORMAL_BUTTON, 645, 560, 80, 40, "End" );
+
+ fdui->term3_onoff = obj = fl_add_choice( FL_NORMAL_CHOICE2, 415, 485,
+ 105, 25, "InOut mode" );
+ fl_set_object_lalign( obj, FL_ALIGN_TOP );
+ fl_set_object_callback( obj, cb_term3_onoff, 0 );
+ fl_addto_choice( obj, "ON" );
+ fl_addto_choice( obj, "OFF" );
+ fl_set_choice( obj, 1 );
+
+ obj = fl_add_text( FL_NORMAL_TEXT, 75, 290, 550, 20, "change of values of "
+ "one central and active controller from multiple "
+ "terminals" );
+
+ obj = fl_add_text( FL_NORMAL_TEXT, 30, 10, 555, 35, "This program "
+ "demonstrates, why inout-mode is necessary." );
+ fl_set_object_lsize( obj, FL_LARGE_SIZE );
+
+ obj = fl_add_text( FL_NORMAL_TEXT, 20, 45, 695, 115,
+ "All yellow fields are cyclically updated by an idle "
+ "task, getting the values from the PLC.\n"
+ "Editing the fields of 'terminal 1' is not possible "
+ "since they are always overwritten by the idle task.\n\n"
+ "'terminal 2': If you try block the update by using "
+ "'obj->belowmouse', it also will not been updated if "
+ "the cursor\n"
+ "accidently is over the field. Move your mouse over "
+ "the field to verify this.\n\n"
+ "'terminal 3' demonstrates 'inout-mode'." );
+ fl_set_object_lsize( obj, FL_NORMAL_SIZE );
+
+ fl_end_form( );
+
+ fdui->f->fdui = fdui;
+
+ return fdui;
+}
diff --git a/demos/inout_gui.h b/demos/inout_gui.h
new file mode 100644
index 0000000..3ed79f3
--- /dev/null
+++ b/demos/inout_gui.h
@@ -0,0 +1,43 @@
+/* Header file generated by fdesign on Mon Jan 23 18:30:00 2017 */
+
+#ifndef FD_f_h_
+#define FD_f_h_
+
+#include <forms.h>
+
+#if defined __cplusplus
+extern "C"
+{
+#endif
+
+/* Callbacks, globals and object handlers */
+
+void cb_write_to_plc( FL_OBJECT *, long );
+void cb_term3_onoff( FL_OBJECT *, long );
+
+
+/* Forms and Objects */
+
+typedef struct {
+ FL_FORM * f;
+ void * vdata;
+ char * cdata;
+ long ldata;
+ FL_OBJECT * plc_pv1;
+ FL_OBJECT * plc_pv2;
+ FL_OBJECT * term1_pv1;
+ FL_OBJECT * term1_pv2;
+ FL_OBJECT * term2_pv1;
+ FL_OBJECT * term2_pv2;
+ FL_OBJECT * term3_pv1;
+ FL_OBJECT * term3_pv2;
+ FL_OBJECT * term3_onoff;
+} FD_f;
+
+FD_f * create_form_f( void );
+
+#if defined __cplusplus
+}
+#endif
+
+#endif /* FD_f_h_ */
diff --git a/lib/menu.c b/lib/menu.c
index c832e37..f689d93 100644
--- a/lib/menu.c
+++ b/lib/menu.c
@@ -627,7 +627,7 @@ fl_replace_menu_item( FL_OBJECT * ob,
fl_free( sp->items[ numb ] );
sp->cb[ numb ] = NULL;
- s = strdup( str );
+ s = fl_strdup( str );
if ( ( p = strstr( s, "%f" ) ) )
{
generated by cgit v1.2.3 (git 2.25.1) at 2025年11月24日 08:19:28 +0000

AltStyle によって変換されたページ (->オリジナル) /