------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Cheddar is a GNU GPL real-time scheduling analysis tool. -- This program provides services to automatically check schedulability and -- other performance criteria of real-time architecture models. -- -- Copyright (C) 2002-2016, Frank Singhoff, Alain Plantec, Jerome Legrand -- -- The Cheddar project was started in 2002 by -- Frank Singhoff, Lab-STICC UMR 6285 laboratory, Université de Bretagne Occidentale -- -- Cheddar has been published in the "Agence de Protection des Programmes/France" in 2008. -- Since 2008, Ellidiss technologies also contributes to the development of -- Cheddar and provides industrial support. -- -- The full list of contributors and sponsors can be found in AUTHORS.txt and SPONSORS.txt -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- -- Contact : cheddar@listes.univ-brest.fr -- ------------------------------------------------------------------------------ -- Last update : -- $Rev: 1249 $ -- $Date: 2014-08-28 07:02:15 +0200 (Fri, 28 Aug 2014) $ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Gtk.Menu_Item; use Gtk.Menu_Item; with Gtk; use Gtk; with Gtk.Main; use Gtk.Main; with Glib.Error; use Glib.Error; with Gtk.Widget; use Gtk.Widget; with Gtk.Dialog; use Gtk.Dialog; with Gtk.About_Dialog; use Gtk.About_Dialog; with Gtk.Label; use Gtk.Label; with Glib.Object; use Glib.Object; with Gtk.Text_Buffer; use Gtk.Text_Buffer; with Gtk.Combo_Box; use Gtk.Combo_Box; with Gtk.Text_Iter; use Gtk.Text_Iter; with Gtk.List_Store; use Gtk.List_Store; with Gtk.Tree_Model; use Gtk.Tree_Model; with Gtk.Tree_View; use Gtk.Tree_View; with Gtk.Tree_View_Column; use Gtk.Tree_View_Column; with Glib; use Glib; with Glib.Object; use Glib.Object; with Glib.Values; use Glib.Values; with Ada.Text_IO; use Ada.Text_IO; with unbounded_strings; use unbounded_strings; with standards_io; use standards_io; with Ada.Numerics.Aux; use Ada.Numerics.Aux; with graphical_editor; use graphical_editor; with Processor_Set; use Processor_Set; with address_space_Set; use address_space_Set; with resource_Set; use resource_Set; with buffer_Set; use buffer_Set; with task_Set; use task_Set; with task_group_Set; use task_group_Set; with deployment_Set; use deployment_Set; with message_Set; use message_Set; with network_Set; use network_Set; with cache_Set; use cache_Set; with event_analyzer_Set; use event_analyzer_Set; with task_dependencies; use task_dependencies; with systems; use systems; with graphical_editor.user_message; use graphical_editor.user_message; with translate; use translate; with GNAT.Current_Exception; use GNAT.Current_Exception; with Framework_Config; use Framework_Config; with parameters.extended; use parameters.extended; with framework; use framework; with multiprocessor_services_interface; use multiprocessor_services_interface.Scheduling_Result_Per_Processor_Package; with Debug; use Debug; package body graphical_editor.generic_callbacks is procedure Add_View (Object : access Gtkada_Builder_Record'Class) is tree_iter: Gtk_Tree_Iter; begin Initialize(tab, Object); begin Check(tab, Object); Add_In_Sys(tab, Object); exception when Message_Set.Generic_Message_Set.full_set => Show_Message_Box (Lb_Can_Not_Define_More_Messages (Current_Language)); return; when address_space_Not_Found => Show_Message_Box(Lb_address_space_Not_Found (current_language)); return; when cache_Not_Found => Show_Message_Box(Lb_cache_Not_Found (current_language)); return; when dependency_Not_Found => Show_Message_Box(Lb_dependency_Not_Found (current_language)); return; when event_analyzer_Not_Found => Show_Message_Box(Lb_event_analyzer_Not_Found (current_language)); return; when message_Not_Found => Show_Message_Box(Lb_message_Not_Found (current_language)); return; when deployment_Not_Found => Show_Message_Box(Lb_deployment_Not_Found (current_language)); return; when buffer_Not_Found => Show_Message_Box(Lb_buffer_Not_Found (current_language)); return; when task_group_Not_Found => Show_Message_Box(Lb_task_group_Not_Found (current_language)); return; when task_Not_Found => Show_Message_Box(Lb_task_Not_Found (current_language)); return; when resource_Not_Found => Show_Message_Box(Lb_resource_Not_Found (current_language)); return; when Processor_Not_Found => Show_Message_Box(Lb_Processor_Not_Found (current_language)); return; when core_unit_Not_Found => Show_Message_Box(Lb_core_unit_Not_Found (current_language)); return; when Processor_Set.Invalid_Parameter | parameters.extended.Invalid_Parameter | systemS.Invalid_Parameter | task_Set.Invalid_Parameter | buffer_Set.Invalid_Parameter | address_space_Set.Invalid_Parameter | event_analyzer_Set.Invalid_Parameter | message_Set.Invalid_Parameter | resource_Set.Invalid_Parameter | network_Set.Invalid_Parameter | task_group_Set.Invalid_Parameter | deployment_Set.Invalid_Parameter | cache_Set.Invalid_Parameter => Show_Message_Box(Exception_Message); return; when others => Show_Message_Box (Exception_Name & " : " & Exception_Message); return; end; Append(Gtk_List_Store(tab(Number_of_widget-2).list_value), tree_iter); for i in 1..Number_of_widget-3 loop if tab(i).ptype = buffer_string then if (to_string(get_value_buffer_string(Gtk_Text_Buffer(tab(i).buffer_value))) = "") then Gtk.List_Store.Set(Gtk_List_Store(tab(Number_of_widget-2).list_value), tree_iter, Gint(i)-1, ""); else Gtk.List_Store.Set(Gtk_List_Store(tab(Number_of_widget-2).list_value), tree_iter, Gint(i)-1, to_string (get_value_buffer_string(Gtk_Text_Buffer(tab(i).buffer_value)))); end if; end if; if tab(i).ptype = buffer_integer then if (to_string(get_value_buffer_string(Gtk_Text_Buffer(tab(i).buffer_value))) = "") then Gtk.List_Store.Set(Gtk_List_Store(tab(Number_of_widget-2).list_value), tree_iter, Gint(i)-1, Gint(0)); else Gtk.List_Store.Set(Gtk_List_Store(tab(Number_of_widget-2).list_value), tree_iter, Gint(i)-1, Gint(get_value_buffer_integer(Gtk_Text_Buffer(tab(i).buffer_value)))); end if; end if; if tab(i).ptype = buffer_double then if (to_string(get_value_buffer_string(Gtk_Text_Buffer(tab(i).buffer_value))) = "") then Gtk.List_Store.Set(Gtk_List_Store(tab(Number_of_widget-2).list_value), tree_iter, Gint(i)-1, Gint(0)); else Gtk.List_Store.Set(Gtk_List_Store(tab(Number_of_widget-2).list_value), tree_iter, Gint(i)-1, Gint(get_value_buffer_double(Gtk_Text_Buffer(tab(i).buffer_value)))); end if; end if; if tab(i).ptype = combo then Gtk.List_Store.Set(Gtk_List_Store(tab(Number_of_widget-2).list_value), tree_iter, Gint(i)-1, Get_Active_Text(Gtk_Combo_Box(tab(i).combo_value))); end if; end loop; end Add_View; procedure Modify_Lign (Object : access Gtkada_Builder_Record'Class) is tree_iter: Gtk_Tree_Iter; path1: Gtk_Tree_Path; focus1: Gtk_Tree_View_Column; begin Initialize(tab, Object); Get_Cursor(Gtk_Tree_View(tab(Number_of_widget-1).view_value), path1, focus1); if path1 /= null and focus1 /= null then tree_iter:= get_iter(Gtk_Tree_Model(tab(Number_of_widget-2).list_value), path1); begin Check(tab, Object); Modify_In_Sys(tab, Object); exception when address_space_Not_Found => Show_Message_Box(Lb_address_space_Not_Found (current_language)); return; when cache_Not_Found => Show_Message_Box(Lb_cache_Not_Found (current_language)); return; when dependency_Not_Found => Show_Message_Box(Lb_dependency_Not_Found (current_language)); return; when event_analyzer_Not_Found => Show_Message_Box(Lb_event_analyzer_Not_Found (current_language)); return; when task_group_Not_Found => Show_Message_Box(Lb_task_group_Not_Found (current_language)); return; when message_Not_Found => Show_Message_Box(Lb_message_Not_Found (current_language)); return; when deployment_Not_Found => Show_Message_Box(Lb_deployment_Not_Found (current_language)); return; when buffer_Not_Found => Show_Message_Box(Lb_buffer_Not_Found (current_language)); return; when task_Not_Found => Show_Message_Box(Lb_task_Not_Found (current_language)); return; when resource_Not_Found => Show_Message_Box(Lb_resource_Not_Found (current_language)); return; when Processor_Not_Found => Show_Message_Box(Lb_Processor_Not_Found (current_language)); return; when core_unit_Not_Found => Show_Message_Box(Lb_core_unit_Not_Found (current_language)); return; when Processor_Set.Invalid_Parameter | parameters.extended.Invalid_Parameter | systemS.Invalid_Parameter | task_Set.Invalid_Parameter | buffer_Set.Invalid_Parameter | address_space_Set.Invalid_Parameter | message_Set.Invalid_Parameter | resource_Set.Invalid_Parameter | network_Set.Invalid_Parameter | deployment_Set.Invalid_Parameter | cache_Set.Invalid_Parameter => Show_Message_Box(Exception_Message); return; when others => Show_Message_Box (Exception_Name & " : " & Exception_Message); return; end; for i in 1..Number_of_widget-3 loop if tab(i).ptype = buffer_string then Gtk.List_Store.Set(Gtk_List_Store(tab(Number_of_widget-2).list_value), tree_iter, Gint(i)-1, to_string(get_value_buffer_string(Gtk_Text_Buffer(tab(i).buffer_value)))); end if; if tab(i).ptype = buffer_integer then Gtk.List_Store.Set(Gtk_List_Store(tab(Number_of_widget-2).list_value), tree_iter, Gint(i)-1, Gint(get_value_buffer_integer(Gtk_Text_Buffer(tab(i).buffer_value)))); end if; if tab(i).ptype = combo then Gtk.List_Store.Set(Gtk_List_Store(tab(Number_of_widget-2).list_value), tree_iter, Gint(i)-1, Get_Active_Text(Gtk_Combo_Box(tab(i).combo_value))); end if; end loop; else Show_Message_Box (Lb_Select_Line_Before (Current_Language)); end if; end Modify_Lign; procedure Show_Lign_Selected (Object : access Gtkada_Builder_Record'Class) is tree_iter: Gtk_Tree_Iter; path1: Gtk_Tree_Path; focus1: Gtk_Tree_View_Column; combo_text: unbounded_string; begin Initialize(tab, Object); Get_Cursor(Gtk_Tree_View(tab(Number_of_widget-1).view_value), path1, focus1); if path1 /= null and focus1 /= null then tree_iter:= get_iter(Gtk_Tree_Model(tab(Number_of_widget-2).list_value), path1); for i in 1..Number_of_widget-3 loop if tab(i).ptype = buffer_string then Set_Text(Gtk_Text_Buffer(tab(i).buffer_value), Gtk.Tree_Model.Get_String(Gtk_Tree_Model(tab(Number_of_widget-2).list_value), tree_iter, Gint(i)-1)); end if; if tab(i).ptype = buffer_integer then Set_Text(Gtk_Text_Buffer(tab(i).buffer_value), integer'image(integer(Gtk.Tree_Model.Get_Int(Gtk_Tree_Model(tab(Number_of_widget-2).list_value), tree_iter, Gint(i)-1)))); end if; if tab(i).ptype = combo then combo_text := to_unbounded_string(Gtk.Tree_Model.Get_String(Gtk_Tree_Model(tab(Number_of_widget-2).list_value), tree_iter, Gint(i)-1)); Set_Active(Gtk_Combo_Box(tab(i).combo_value), Gint(get_int_combo(Gtk_Combo_Box(tab(i).combo_value), combo_text))); end if; end loop; begin Show_In_Sys(tab, Object); exception when address_space_Not_Found => Show_Message_Box(Lb_address_space_Not_Found (current_language)); return; when cache_Not_Found => Show_Message_Box(Lb_cache_Not_Found (current_language)); return; when dependency_Not_Found => Show_Message_Box(Lb_dependency_Not_Found (current_language)); return; when event_analyzer_Not_Found => Show_Message_Box(Lb_event_analyzer_Not_Found (current_language)); return; when message_Not_Found => Show_Message_Box(Lb_message_Not_Found (current_language)); return; when deployment_Not_Found => Show_Message_Box(Lb_deployment_Not_Found (current_language)); return; when buffer_Not_Found => Show_Message_Box(Lb_buffer_Not_Found (current_language)); return; when task_Not_Found => Show_Message_Box(Lb_task_Not_Found (current_language)); return; when resource_Not_Found => Show_Message_Box(Lb_resource_Not_Found (current_language)); return; when Processor_Not_Found => Show_Message_Box(Lb_Processor_Not_Found (current_language)); return; when core_unit_Not_Found => Show_Message_Box(Lb_core_unit_Not_Found (current_language)); return; when Processor_Set.Invalid_Parameter | parameters.extended.Invalid_Parameter | systemS.Invalid_Parameter | task_Set.Invalid_Parameter | buffer_Set.Invalid_Parameter | address_space_Set.Invalid_Parameter | message_Set.Invalid_Parameter | resource_Set.Invalid_Parameter | network_Set.Invalid_Parameter | deployment_Set.Invalid_Parameter | cache_Set.Invalid_Parameter => Show_Message_Box(Exception_Message); return; when others => Show_Message_Box (Exception_Name & " : Show_Lign_Selected - " & Exception_Message); return; end; end if; end Show_Lign_Selected; procedure Delected_Lign_Selected (Object : access Gtkada_Builder_Record'Class) is tree_iter: Gtk_Tree_Iter; path1: Gtk_Tree_Path; focus1: Gtk_Tree_View_Column; begin Initialize(tab, Object); Get_Cursor(Gtk_Tree_View(tab(Number_of_widget-1).view_value), path1, focus1); if path1 /= null and focus1 /= null then tree_iter:= get_iter(Gtk_Tree_Model(tab(Number_of_widget-2).list_value), path1); begin Deleted_In_Sys(tab, Object); exception when address_space_Not_Found => Show_Message_Box(Lb_address_space_Not_Found (current_language)); return; when cache_Not_Found => Show_Message_Box(Lb_cache_Not_Found (current_language)); return; when dependency_Not_Found => Show_Message_Box(Lb_dependency_Not_Found (current_language)); return; when event_analyzer_Not_Found => Show_Message_Box(Lb_event_analyzer_Not_Found (current_language)); return; when message_Not_Found => Show_Message_Box(Lb_message_Not_Found (current_language)); return; when deployment_Not_Found => Show_Message_Box(Lb_deployment_Not_Found (current_language)); return; when buffer_Not_Found => Show_Message_Box(Lb_buffer_Not_Found (current_language)); return; when task_Not_Found => Show_Message_Box(Lb_task_Not_Found (current_language)); return; when resource_Not_Found => Show_Message_Box(Lb_resource_Not_Found (current_language)); return; when Processor_Not_Found => Show_Message_Box(Lb_Processor_Not_Found (current_language)); return; when core_unit_Not_Found => Show_Message_Box(Lb_core_unit_Not_Found (current_language)); return; when Processor_Set.Invalid_Parameter | parameters.extended.Invalid_Parameter | systemS.Invalid_Parameter | task_Set.Invalid_Parameter | buffer_Set.Invalid_Parameter | address_space_Set.Invalid_Parameter | message_Set.Invalid_Parameter | resource_Set.Invalid_Parameter | network_Set.Invalid_Parameter | deployment_Set.Invalid_Parameter | cache_Set.Invalid_Parameter => Show_Message_Box(Exception_Message); return; when others => Show_Message_Box (Exception_Name & " : " & Exception_Message); return; end; Gtk.List_Store.Remove(Gtk_List_Store(tab(Number_of_widget-2).list_value), tree_iter); for i in 1..Number_of_widget-3 loop if tab(i).ptype = buffer_string then Set_Text(Gtk_Text_Buffer(tab(i).buffer_value), ""); end if; if tab(i).ptype = buffer_integer then Set_Text(Gtk_Text_Buffer(tab(i).buffer_value), ""); end if; if tab(i).ptype = lists then Gtk.List_Store.Clear(Gtk_List_Store(tab(i).list_value)); end if; end loop; else Show_Message_Box (Lb_Select_Line_Before (Current_Language)); end if; end Delected_Lign_Selected; procedure Cancel_View (Object : access Gtkada_Builder_Record'Class) is my_widget : GObject; begin duplicate(sys_buffer, sys); my_widget:=Get_Object(Object, "window1"); Destroy_cb(Gtk_Widget(my_widget)); gtk.main.main_quit; end Cancel_View; procedure Close_View (Object : access Gtkada_Builder_Record'Class) is my_widget : GObject; begin Is_New := False; Is_Saved := False; if framework.sched/=null then initialize(framework.sched.All); end if; my_widget:=Get_Object(Object, "window1"); Destroy_cb(Gtk_Widget(my_widget)); gtk.main.main_quit; end Close_View; end graphical_editor.generic_callbacks;