text
stringlengths
0
234
function Object_Count (Self : Window) return Natural is (Self.object_Count);
-- status display
--
function Show_Status (Self : Window) return Boolean is (Self.Show_Status);
procedure Show_Status (Self : in out Window;
Show : Boolean := True) is
begin
Self.Show_Status := Show;
end Show_Status;
-- Devices
--
function Keyboard (Self : access Window'Class) return Devices.p_Keyboard is (Self.all.Keyboard'Access);
function Mouse (Self : access Window'Class) return Devices.p_Mouse is (Self.all.Mouse'Access);
-- Proxy for Ada 2005 Ada.Calendar.Formatting.Image
function Image (Date : Ada.Calendar.Time) return String is
use Ada.Calendar;
subtype Sec_int is Long_Integer; -- must contain 86_400
m, s : Sec_int;
begin
s := Sec_int (Seconds (Date));
m := s / 60;
declare
-- + 100 : trick for obtaining 0x
sY : constant String := Integer'Image (Year (Date));
sM : constant String := Integer'Image (Month (Date) + 100);
sD : constant String := Integer'Image (Day (Date) + 100);
shr : constant String := Sec_int'Image (m / 60 + 100);
smn : constant String := Sec_int'Image (m mod 60 + 100);
ssc : constant String := Sec_int'Image (s mod 60 + 100);
begin
return
sY (sY'Last - 3 .. sY'Last) & '-' & -- not Year 10'000 compliant.
sM (sM'Last - 1 .. sM'Last) & '-' &
sD (sD'Last - 1 .. sD'Last) &
" " &
shr (shr'Last - 1 .. shr'Last) & '.' &
smn (smn'Last - 1 .. smn'Last) & '.' &
ssc (ssc'Last - 1 .. ssc'Last);
Function Definition: function New_List_Id return List_Ids;
Function Body: private
Available_List_Id : List_Ids := List_Ids'First;
end List_Id_Generator;
package body List_Id_Generator is
function New_List_Id return List_Ids is
begin
Available_List_Id := Available_List_Id + 1;
return Available_List_Id - 1;
end New_List_Id;
end List_Id_Generator;
--
function Image (r : Real) return String is
s : String (1 .. 10);
begin
RIO.Put (s, r, 4, 0);
return s;
exception
when Ada.Text_IO.Layout_Error =>
return Real'Image (r);
end Image;
function Coords (p : Point_3D) return String is
begin
return ' (' & Image (p (0)) &
', ' & Image (p (1)) &
', ' & Image (p (2)) &
')';
end Coords;
-- normal support
--
procedure Add_Normal_of_3p (o : in Object_3d'Class;
Pn0, Pn1, Pn2 : in Integer;
N : in out Vector_3D) is
use GL, G3dm;
function Params return String is
begin
return
" Object : " & Trim (o.id, right) &
" Pn0=" & Integer'Image (Pn0) &
" Pn1=" & Integer'Image (Pn1) &
" Pn2=" & Integer'Image (Pn2);
end Params;
N_contrib : Vector_3D;
begin
if Pn0=0 or Pn1=0 or Pn2=0 then return; end if;
N_contrib := (o.point (Pn1) - o.point (Pn0))* (o.point (Pn2) - o.point (Pn0)) ;