Marcin Mielzynski
1/12/2006 8:24:00 PM
Jacek Olszak wrote:
> Fox can be very good.. I've read some docs on FXRuby site and shown that
> FreeRide is using it :)
>
Fox is very good :D. It has very consistent API (every constructor takes
pointer/reference to parent widget/container so it is easy to create
automation code that read's configuration file and builds the whole gui
at runtime (and actually this solution works very fast). The
interpreting code takes approximately 500 loc. An example is attached
(it can be xml or indentation based format)
lopex
!icon:file=res/images/dialogs/player_fwd.png|id=fwd_icon
!icon:file=res/images/dialogs/player_play.png|id=play_icon
!icon:file=res/images/dialogs/player_pause.png|id=pause_icon
!icon:file=res/images/dialogs/player_stop.png|id=stop_icon
!icon:file=res/images/dialogs/clock.png|id=clock_icon
!icon:file=res/images/dialogs/parameters.png|id=parameters_icon
!icon:file=res/images/dialogs/options.png|id=options_icon
!icon:file=res/images/dialogs/statistics.png|id=statistics_icon
!icon:file=res/images/dialogs/kchart.png|id=chart_icon
!icon:file=res/images/dialogs/add.png|id=adds_icon
!icon:file=res/images/dialogs/remove.png|id=removes_icon
_main_window
dialog_box:options=$simulation_title,DECOR_TITLE+DECOR_BORDER+DECOR_CLOSE+PLACEMENT_OWNER+PLACEMENT_VISIBLE,0,0,0,0,2,2,2|main|id=simulation_dialog
vframe:options=LAYOUT_FILL_X+LAYOUT_FILL_Y+FRAME_GROOVE
hframe:options=LAYOUT_FILL_X+LAYOUT_FILL_Y
group_box:options=$simulation_control,FRAME_THICK+GROUPBOX_TITLE_LEFT+LAYOUT_RIGHT+LAYOUT_FILL_X
hframe
label:options=$simulation_control_time
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=time_text
label:options=$simulation_control_ktime
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=ktime_text
label:options='(s)'
check_button:options=$simulation_control_update,*update_graph(true)
hframe:options=LAYOUT_FILL_X
label:options='',%clock_icon,LAYOUT_CENTER_Y,TEXT_ABOVE_ICON
group_box:options='',LAYOUT_FILL_X+FRAME_THICK
hframe:options=LAYOUT_FILL_X
button:options=$simulation_control_loop,%fwd_icon,nil,0,BUTTON_TOOLBAR+BUTTON_NORMAL+LAYOUT_CENTER_X+TEXT_AFTER_ICON|event=command(on_loop)|id=loop_button
button:options=$simulation_control_step,%play_icon,nil,0,BUTTON_TOOLBAR+BUTTON_NORMAL+LAYOUT_CENTER_X+TEXT_AFTER_ICON|event=command(on_step)|id=step_button
button:options=$simulation_control_pause,%pause_icon,nil,0,BUTTON_TOOLBAR+BUTTON_NORMAL+LAYOUT_CENTER_X+TEXT_AFTER_ICON|event=command(on_pause)|id=pause_button
button:options=$simulation_control_stop,%stop_icon,nil,0,BUTTON_TOOLBAR+BUTTON_NORMAL+LAYOUT_CENTER_X+TEXT_AFTER_ICON|event=command(on_stop)|id=stop_button
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_control_delay_title
hframe:options=LAYOUT_RIGHT+LAYOUT_FILL_X
label:options=$simulation_control_delta
slider:options=*delay(100),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=delay_slider
spinner:options=3,*delay|id=delay_spinner
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_control_kernel_steps_title
hframe:options=LAYOUT_RIGHT+LAYOUT_FILL_X
label:options=$simulation_control_kernel_steps
slider:options=*kernel_steps(1),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=kernel_steps_slider
spinner:options=3,*kernel_steps|id=kernel_steps_spinner
tab_book:options=nil,0,LAYOUT_FILL_X+LAYOUT_FILL_Y+LAYOUT_RIGHT|id=tab_book|event=command(tab_changed)
# parameters
tab_item:options=$simulation_parameters_tab_title,%parameters_icon
vframe:options=FRAME_THICK+FRAME_RAISED+LAYOUT_FILL_Y
group_box:options=$simulation_parameters_settings,FRAME_THICK+LAYOUT_FILL_X+LAYOUT_FILL_Y+GROUPBOX_TITLE_LEFT,0,0,0,0,0,0,0,0,0,0
# ni
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_parameters_alpha_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_parameters_alpha
slider:options=*alpha(10),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=alpha_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=alpha_text
# alpha
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_parameters_ni_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_parameters_ni
slider:options=*ni(10),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=ni_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=ni_text
# gamma
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_parameters_gamma_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_parameters_gamma
slider:options=*gamma(10),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=gamma_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=gamma_text
# c1
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_parameters_c1_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_parameters_c1
slider:options=*c1(10),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=c1_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=c1_text
# c2
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_parameters_c2_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_parameters_c2
slider:options=*c2(10),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=c2_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=c2_text
# c
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_parameters_c_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_parameters_c
slider:options=*c(10),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=c_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=c_text
# a
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_parameters_a_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_parameters_a
slider:options=*a(10),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=a_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=a_text
# options
tab_item:options=$simulation_options_tab_title,%options_icon
vframe:options=FRAME_THICK+FRAME_RAISED+LAYOUT_FILL_Y
group_box:options=$simulation_options_settings,FRAME_THICK+LAYOUT_FILL_X+LAYOUT_FILL_Y+GROUPBOX_TITLE_LEFT,0,0,0,0,0,0,0,0,0,0
# ttl
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_options_ttl_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_options_ttl
slider:options=*ttl(0),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=ttl_slider
spinner:options=3,*ttl|id=ttl_spinner
# forward packet size
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_options_fpacket_size_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_options_fpacket_size
slider:options=*fpacket_size(0),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=fpacket_size_slider
spinner:options=3,*fpacket_size|id=fpacket_size_spinner
# backward packet size
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_options_bpacket_size_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_options_bpacket_size
slider:options=*bpacket_size(0),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=bpacket_size_slider
spinner:options=3,*bpacket_size|id=bpacket_size_spinner
# delta
vframe:options=LAYOUT_FILL_X,0,0,0,0,2,0,0,0,0,0
label:options=$simulation_options_delta_title
hframe:options=LAYOUT_FILL_X
label:options=$simulation_options_delta
slider:options=*delta(0),SLIDER_HORIZONTAL+LAYOUT_FILL_X+SLIDER_ARROW_UP,0,0,100,25|id=delta_slider
text_field:options=5,nil,0,TEXTFIELD_READONLY|id=delta_text
#spinner:options=3,*delta|id=delta_spinner
# statistics
tab_item:options=$simulation_statistics_tab_title,%statistics_icon|id=stats_tab
vframe:options=FRAME_THICK+FRAME_RAISED+LAYOUT_FILL_Y
group_box:options=$simulation_statistics_cycle,FRAME_THICK+LAYOUT_FILL_X+LAYOUT_FILL_Y+GROUPBOX_TITLE_LEFT,0,0,0,0,0,0,0,0,0,0
matrix:options=2,MATRIX_BY_COLUMNS+LAYOUT_FILL_X+LAYOUT_FILL_Y
label:options=$simulation_statistics_ants_reached
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=ants_reached_text
label:options=$simulation_statistics_times_reached
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_reached_text
label:options=$simulation_statistics_times_to_ants_reached
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_to_ants_reached_text
label:options=$simulation_statistics_ants_returned
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=ants_returned_text
label:options=$simulation_statistics_times_returned
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_returned_text
label:options=$simulation_statistics_times_to_ants_returned
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_to_ants_returned_text
label:options=$simulation_statistics_ants_expired
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=ants_expired_text
group_box:options=$simulation_statistics_overall,FRAME_THICK+LAYOUT_FILL_X+LAYOUT_FILL_Y+GROUPBOX_TITLE_LEFT,0,0,0,0,0,0,0,0,0,0
matrix:options=2,MATRIX_BY_COLUMNS+LAYOUT_FILL_X+LAYOUT_FILL_Y
label:options=$simulation_statistics_ants_reached_OA
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=ants_reached_OA_text
label:options=$simulation_statistics_times_reached_OA
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_reached_OA_text
label:options=$simulation_statistics_times_to_ants_reached_OA
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_to_ants_reached_OA_text
label:options=$simulation_statistics_ants_returned_OA
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=ants_returned_OA_text
label:options=$simulation_statistics_times_returned_OA
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_returned_OA_text
label:options=$simulation_statistics_times_to_ants_returned_OA
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=times_to_ants_returned_OA_text
label:options=$simulation_statistics_ants_expired_OA
text_field:options=10,nil,0,TEXTFIELD_READONLY|id=ants_expired_OA_text
tab_item:options=$simulation_chart_title,%chart_icon
vframe:options=FRAME_THICK+FRAME_RAISED+LAYOUT_FILL_Y
group_box:options=$simulation_chart_serie,FRAME_THICK+LAYOUT_FILL_X+GROUPBOX_TITLE_LEFT+LAYOUT_CENTER_X
hframe:options=LAYOUT_CENTER_X
matrix:options=2,MATRIX_BY_COLUMNS+LAYOUT_FILL_X+LAYOUT_FILL_Y
combo_box:options=10,nil,0,LAYOUT_FILL_X+COMBOBOX_STATIC+FRAME_SUNKEN+FRAME_THICK|id=series_combo
button:options=$simulation_chart_serie_add,%adds_icon,nil,0,BUTTON_TOOLBAR+BUTTON_NORMAL|event=command(add_serie)
combo_box:options=10,nil,0,LAYOUT_FILL_X+COMBOBOX_STATIC+FRAME_SUNKEN+FRAME_THICK|id=added_combo
button:options=$simulation_chart_serie_remove,%removes_icon,nil,0,BUTTON_TOOLBAR+BUTTON_NORMAL|event=command(remove_serie)
group_box:options=$simulation_chart_gb_serie,FRAME_THICK+LAYOUT_FILL_X+GROUPBOX_TITLE_LEFT
hframe:options=LAYOUT_CENTER_X
button:options=$simulation_chart_statistics|event=command(normal_chart)
button:options=$simulation_chart_queue_load|event=command(column_chart)
button:options=$simulation_chart_clear|event=command(clear_chart)