text stringlengths 0 234 |
|---|
------------------------------------------------------------------------ |
-- Función que devuelve la posición de un coche dentro del buffer |
----------------------------------------------------------------------- |
FUNCTION Posicion_Buffer(Id : T_IdCoche; |
Buffer: Pkg_Buffer_Coches.T_Buffer) RETURN T_RangoBufferCoches is |
coche_aux : T_RecordCoche; |
pos : T_RangoBufferCoches; |
BEGIN |
BEGIN |
Pos := Pkg_Buffer_Coches.Posicion_Primer_Item(Buffer); |
Coche_Aux := Pkg_Buffer_Coches.Consulta_Item(Pos, Buffer); |
WHILE Coche_Aux.Id /= Id LOOP |
Pos := Pos+1; |
Coche_Aux := Pkg_Buffer_Coches.Consulta_Item(Pos, Buffer); |
END LOOP; |
exception |
when event: others => |
PKG_debug.Escribir("ERROR en Posicion_Buffer: " & Exception_Name(Exception_Identity(event))); |
Function Definition: procedure Simular_Sistema IS |
Function Body: BEGIN |
Gtk.Main.Main; |
END Simular_Sistema; |
------------------------------------------------------------------------ |
-- Procedure que se encarga de inicializar la interfaz gráfica |
------------------------------------------------------------------------ |
procedure Inicializar_Interfaz_Grafica is |
Win : Gtk_Window; |
Buffer : Gtk_Double_Buffer; |
Vbox, Hbox : Gtk_Box; |
Id : G_Source_Id;--Timeout_Handler_Id; |
Button : Gtk_Button; |
inbuilt_font : Pango.Font.Pango_Font_Description; |
--ventana : Gdk_Window; |
--TAM_BUTTON_EXIT : constant GLib.Gint := 20; |
alinea_button : Gtk.Alignment.Gtk_Alignment; |
begin |
-- ventana principal |
Gtk.Window.Gtk_New (Win, Window_Toplevel); |
Set_Title (Win, "PRACTICA STR: CONTROL DE TRAFICO"); |
Win.Set_Default_Size(CANVAS_WIDTH, CANVAS_HEIGHT);--+TAM_BUTTON_EXIT); |
Void_Cb.Connect (Win, "destroy", Void_Cb.To_Marshaller (Quit'Access)); |
-- botón Exit |
Gtk_New (Button, "EXIT"); |
Destroyed.Object_Connect (Button, |
"clicked", |
Destroyed.To_Marshaller (Quit'Access), |
Slot_Object => Win); |
Button.Set_Size_Request(100, 20);--TAM_BUTTON_EXIT); |
Gtk.Alignment.Gtk_New(alinea_button, 0.5, 0.5, 0.0, 0.0); |
alinea_button.Add(Button); |
-- Double buffer |
Double_Buffer.Gtk_New(Buffer); |
Buffer.Set_Size_Request(CANVAS_WIDTH, CANVAS_HEIGHT);-- -TAM_BUTTON_EXIT); |
-- Asociar widgets a la ventana principal y mostrarla |
Gtk_New_Hbox (Hbox, Homogeneous => True, Spacing => 10); |
Gtk_New_Vbox (Vbox, Homogeneous => False, Spacing => 0); |
Pack_Start (Vbox, Buffer); |
--Pack_Start (Vbox, Button, Expand => False, Fill => False); |
Pack_Start (Vbox, alinea_button);--, Expand => False, Fill => False); |
Pack_Start (Hbox, Vbox); |
Win.Add(Hbox); |
Show_All (Win); |
--ventana := Get_Window(Gtk_Widget(Buffer)); |
--Gdk.Window.Move(ventana, 0, 0); |
Id := Main_Context_Sources.Timeout_Add (PERIODICIDAD_REDIBUJAR_MILISEGUNDOS, |
Draw_Complex_Buffer'Access, |
Gtk_Drawing_Area (Buffer)); |
Gdk_New(pangoLayout, Get_Pango_Context(Buffer)); |
inbuilt_font := Pango.Font.From_String("Courier"); |
Pango.Layout.Set_Font_Description(pangoLayout, inbuilt_font); |
-- INICIALIZACIÓN DEL ESTADO DE TODOS LOS OBJETOS VISUALIZADOS |
Inicializar_Buffer_Coches; |
end Inicializar_Interfaz_Grafica; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.