------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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-2023, 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 README.md -- -- 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: 4029 $ -- $Date: 2021-08-27 12:44:15 +0200 (ven., 27 août 2021) $ -- $Author: singhoff $ ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with Ada.Text_IO; use Ada.Text_IO; with unbounded_strings; use unbounded_strings; with Glib; use Glib; with Glib.Object; use Glib.Object; with Gtk.Text_Buffer; use Gtk.Text_Buffer; with Gtk.Text_Tag_Table; use Gtk.Text_Tag_Table; with Gtk.Text_Tag; use Gtk.Text_Tag; with Gdk.Color; use Gdk.Color; with Gdk.RGBA; use Gdk.RGBA; with Gtk; use Gtk; with Gtk.Enums; use Gtk.Enums; with Gtk.Text_Iter; use Gtk.Text_Iter; with Gtk.Text_Buffer; use Gtk.Text_Buffer; with Gtk.Text_Mark; use Gtk.Text_Mark; with Gtk.Widget; use Gtk.Widget; with Pango.Font; use Pango.Font; with task_set; use task_set; use task_set.generic_task_set; with translate; use translate; with framework_config; use framework_config; package body graphical_editor.message_text is iter : gtk_text_iter; start_iter : gtk_text_iter; Success : Boolean; Tags : Gtk_Text_Tag_Table; Tag : Gtk_Text_Tag; Color : Gdk_RGBA; procedure Insert_With_Tag (Buffer : access Gtk_Text_Buffer_Record'Class; Tag : String; Text : String) is T : Gtk_Text_Tag; Iter, Start_Iter : Gtk_Text_Iter; Table : Gtk_Text_Tag_Table; Result : Boolean; pragma Warnings (Off, Result); begin Get_End_Iter (Buffer, Iter); if Tag = "" then Insert (Buffer, Iter, Text & ASCII.LF); else Table := Get_Tag_Table (Buffer); T := Lookup (Table, Tag); Insert (Buffer, Iter, Text & ASCII.LF); Start_Iter := Iter; Backward_Chars (Start_Iter, Text'Length + 1, Result); Apply_Tag (Buffer, T, Start_Iter, Iter); end if; end Insert_With_Tag; procedure write_title (response_list : in framework_response_table) is begin Insert_with_tag (buffer_editor_cheddar, "red_tag", To_String (response_list.entries (0).title)); end write_title; procedure write_text (response_list : in framework_response_table) is begin for j in 0 .. response_list.nb_entries - 1 loop Insert_with_tag (buffer_editor_cheddar, "", To_String (response_list.entries (j).text)); end loop; end write_text; procedure write_text (msg : in String) is begin Insert_with_tag (buffer_editor_cheddar, "", msg); end write_text; procedure write_title_and_text (response_list : in framework_response_table) is begin for j in 0 .. response_list.nb_entries - 1 loop Insert_with_tag (buffer_editor_cheddar, "red_tag", To_String (response_list.entries (j).title)); Insert_with_tag (buffer_editor_cheddar, "", To_String (response_list.entries (j).text)); end loop; end write_title_and_text; procedure initialize_message_text_properties is begin -- Create the tags that will be used to change the rendering of the -- text. -- tags := get_tag_table (buffer_editor_cheddar); Parse (Color, "red", Success); Gtk_New (Tag, "red_tag"); Add (Tags, Tag); Set_Property (Tag, Foreground_Rgba_Property, Color); end initialize_message_text_properties; procedure starting_text is begin if (get_number_of_elements (sys.tasks) = 0) then write_text (to_string (lb_minus & lb_start_message1 (current_language)) & To_String (unbounded_lf)); else write_text (to_string (lb_minus & lb_start_message2 (current_language)) & To_String (unbounded_lf)); end if; end starting_text; end graphical_editor.message_text;