------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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-2020, Frank Singhoff, Alain Plantec, Jerome Legrand, -- Hai Nam Tran, Stephane Rubini -- -- The Cheddar project was started in 2002 by -- Frank Singhoff, Lab-STICC UMR 6285, 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$ -- $Date$ -- $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 (drawing_area_cheddar), "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;