------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 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.Text_Iter; use Gtk.Text_Iter; with Ada.Text_IO; use Ada.Text_IO; package body graphical_editor.generic_package_widget is function get_value_buffer_string(buffer : Gtk_Text_Buffer) return unbounded_string is start_iterator, end_iterator: Gtk_Text_Iter; begin Get_Start_Iter(buffer, start_iterator); Get_End_Iter(buffer, end_iterator); return to_Unbounded_String(Gtk.Text_Buffer.Get_Text(buffer, start_iterator, end_iterator)); end get_value_buffer_string; function get_value_buffer_integer(buffer : Gtk_Text_Buffer) return integer is start_iterator, end_iterator: Gtk_Text_Iter; a_string : unbounded_string; begin Get_Start_Iter(buffer, start_iterator); Get_End_Iter(buffer, end_iterator); a_string:=suppress_space(Gtk.Text_Buffer.Get_Text(buffer, start_iterator, end_iterator)); if a_string = empty_string then return 0; else return integer'value(to_string(a_string)); end if; end get_value_buffer_integer; function get_value_buffer_double(buffer : Gtk_Text_Buffer) return double is start_iterator, end_iterator: Gtk_Text_Iter; begin Get_Start_Iter(buffer, start_iterator); Get_End_Iter(buffer, end_iterator); return double'value(Gtk.Text_Buffer.Get_Text(buffer, start_iterator, end_iterator)); end get_value_buffer_double; function get_number_elements(treemodel: Gtk_Tree_Model) return integer is number: integer := 0; tree_iter: Gtk_Tree_Iter; begin tree_iter:= Get_Iter_First (treemodel); while tree_iter /= Null_Iter loop number := number + 1; next(treemodel, tree_iter); end loop; return number; end get_number_elements; function get_int_combo(combo: Gtk_Combo_Box; value: unbounded_string) return integer is i: integer :=0; treemodel: Gtk_Tree_Model; tree_iter: Gtk_Tree_Iter; comp: unbounded_string; begin treemodel:=Get_Model(combo); tree_iter:= Get_Iter_First (treemodel); comp := to_unbounded_string(Get_String(treemodel, tree_iter, Gint(0))); while comp /= value and tree_iter /= Null_iter loop next(treemodel, tree_iter); comp := to_unbounded_string(Get_String(treemodel, tree_iter, Gint(0))); i:=i+1; end loop; if comp = value then return i; else return -1; end if; end get_int_combo; end graphical_editor.generic_package_widget;