GUI
We provide on this page information to help developers understand the process of implementing GUI features in Cheddar.
Draw scheduling simulation
In this section, we explain the events from the click of the run simulation button to the draw of the simulation timeline.
-
GUI: run simulation button in
cheddar.glade
- Callback :
on_toolbutton11_clicked()
incheddar.adb
. This function shows thescheduling_simulation_draw.glade
widget which then asks for the simulation period. This widget has two buttonsOK
andCancel
. TheOK
button is registered to the callback namedread_scheduling_duration_and_draw_scheduling()
.
- Callback :
-
Simulation: the main entry point of the simulation process is
read_scheduling_duration_and_draw_scheduling()
ingraphical_editor.scheduling_simulations_callbacks.adb
. This function does the tasks below:- Compute the period to draw
- Compute the period to run the simulation
- Call the simulation (either
call_customized_simulation()
orcall_uncustomized_simulation()
) - In
call_customized_simulation
, we call cheddar framework with parameters specified by the user (configurable inscheduling options
widget), retrieve the responses and the computed event table. Then we proceed to draw the simulation timeline by callingdraw_scheduling_events()
.
-
Drawing: the main entry point of the drawing process is
draw_scheduling_events()
ingraphical_editor.draw_scheduling.adb
- Drawing information is stored in a
draw_scheduling_record
. In a record, we have a system model, scheduling simulation parameters, an event table which is the result of the simulation, a Cairo Context, and sizes (width and height) of the canvas.type draw_scheduling_record is new gtk_widget_record with record tasks : tasks_set; resources : resources_set; messages : messages_set; buffers : buffers_set; processors : processors_set; period : Natural; zoomed_period : Natural; start_draw : Natural; sched : scheduling_table_ptr; Cr : Cairo_Context; current_width : gint; current_height : gint; end record;
- Drawing information is stored in a
-
The drawing is done on the widget
drawing_area_cheddar
incheddar.glade
. The binding between the widget and the Cairo_Context is done in theinitialize()
function.drawing_area_cheddar := gtk_drawing_area(Get_Object (builder, "drawing_area_cheddar")); graphical_editor.draw_scheduling.Initialize (graphical_editor.draw_scheduling.draw_scheduling);