------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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 Glib; use Glib; with Glib.Object; use Glib.Object; with Gtk; use Gtk; with Gtk.Main; use Gtk.Main; with Ada.Text_IO; use Ada.Text_IO; with graphical_editor.user_message; use graphical_editor.user_message; with Framework_Config; use Framework_Config; with Translate; use Translate; with graphical_editor.generic_package_widget; use graphical_editor.generic_package_widget; with graphical_editor.scheduling_simulation_draw_callbacks; use graphical_editor.scheduling_simulation_draw_callbacks; with Gtk.Drawing_Area; use Gtk.Drawing_Area; with Gtk.Handlers; use Gtk.Handlers; with graphical_editor.Draw_Scheduling; use graphical_editor.Draw_Scheduling; with gdk; use gdk; with Gdk.Color; use Gdk.Color; with Gdk.GC; use Gdk.GC; with Gdk.Window; use Gdk.Window; with pango.font; use pango.font; with Gdk.font; use Gdk.font; with Gdk.Event; use Gdk.Event; with Ada.IO_Exceptions; use Ada.IO_Exceptions; with GNAT.Current_Exception; use GNAT.Current_Exception; with Gtk.File_Chooser; use Gtk.File_Chooser; with Gtk.File_Chooser_Dialog; use Gtk.File_Chooser_Dialog; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Translate; use Translate; with Xml_generic_Parsers; use Xml_generic_Parsers; with Xml_generic_Parsers.architecture; use Xml_generic_Parsers.architecture; with Multiprocessor_Services; use Multiprocessor_Services; package body graphical_editor.event_tables_callbacks is Draw_From_Time : Integer := 0; Draw_To_Time : Integer := 0; function Expose (W : access Gtk.Drawing_Area.Gtk_Drawing_Area_Record'Class) return boolean is begin Draw_Time_Line ( Draw_To_Time, Draw_From_Time, Framework.Sched); return false; end Expose; procedure draw_time_line_from_event_table(Object : access Gtkada_Builder_Record'Class) is Draw_From, Draw_To : Unbounded_String; Ok : Boolean; begin hide(gtk_widget(get_object(object, "window1"))); Draw_From := suppress_space(get_value_buffer_string(Gtk_Text_Buffer(Get_Object(Object, "textbuffer1")))); Draw_To := suppress_space(get_value_buffer_string(Gtk_Text_Buffer(Get_Object(Object, "textbuffer2")))); to_integer (Draw_From, Draw_From_Time, Ok); if not Ok then Show_Message_Box (Lb_Double_Quote & Lb_Draw_From (Current_Language) & Lb_Double_Quote & Lb_Must_Be_Numeric (Current_Language)); return; end if; to_integer (Draw_To, Draw_To_Time, Ok); if not Ok then Show_Message_Box (Lb_Double_Quote & Lb_Draw_To (Current_Language) & Lb_Double_Quote & Lb_Must_Be_Numeric (Current_Language)); return; end if; if (Draw_To_Time <= 0) then Show_Message_Box (Lb_Double_Quote & Lb_Draw_To (Current_Language) & Lb_Double_Quote & Lb_Must_Be (Current_Language) & Lb_greater_than(current_language) & " 0"); return; end if; if (Draw_From_Time < 0) then Show_Message_Box (Lb_Double_Quote & Lb_Draw_From (Current_Language) & Lb_Double_Quote & Lb_Must_Be (Current_Language) & Lb_greater_or_equal_than(current_language) & " 0"); return; end if; if (Draw_From_Time > Draw_To_Time) then Show_Message_Box (Lb_Double_Quote & Lb_Draw_From (Current_Language) & Lb_Must_Be (Current_Language) & Lb_Double_Quote & Lb_greater_or_equal_than(current_language) & Lb_Double_Quote & Lb_Draw_To (Current_Language) & Lb_Double_Quote); return; end if; if (Draw_To_Time - Draw_From_Time > 1500) then Show_Message_Box (Lb_Draw_Time_Line_Too_Large (Current_Language)); return; end if; cb.Connect (Gtk_Drawing_Area(my_area), "expose_event", cb.To_Marshaller(Expose'Access)); Draw_Time_Line(Draw_To_Time, Draw_From_Time, Framework.Sched); end draw_time_line_from_event_table; procedure close_widget(Object : access Gtkada_Builder_Record'Class) is my_widget : GObject; begin my_widget:=Get_Object(Object, "window1"); Unref(my_widget); Hide(Gtk_Widget(my_widget)); Destroy_cb(Gtk_Widget(my_widget)); end Close_Widget; end graphical_editor.event_tables_callbacks;