[Gtkada-wrapper-devel] SF.net SVN: gtkada-wrapper: [4] trunk
Brought to you by:
bechir_zalila
From: <bec...@us...> - 2006-11-25 00:05:57
|
Revision: 4 http://svn.sourceforge.net/gtkada-wrapper/?rev=4&view=rev Author: bechir_zalila Date: 2006-11-24 16:05:56 -0800 (Fri, 24 Nov 2006) Log Message: ----------- * Adde a stub for the library and for an example directory Modified Paths: -------------- trunk/TODO trunk/configure.ac trunk/src/Makefile.am Added Paths: ----------- trunk/examples/ trunk/examples/Makefile.am trunk/examples/empty_windows/ trunk/examples/empty_windows/Makefile.am trunk/examples/empty_windows/README trunk/src/gtkada_wrapper.adb trunk/src/gtkada_wrapper.ads trunk/src/gtkada_wrapper.gpr Modified: trunk/TODO =================================================================== --- trunk/TODO 2006-11-24 23:18:02 UTC (rev 3) +++ trunk/TODO 2006-11-25 00:05:56 UTC (rev 4) @@ -0,0 +1,9 @@ +/src: + * Complete the code + +/doc: + * Write the documentation + +/: + * Add a projects subdirectory that will contain the project + files that will be installed. Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2006-11-24 23:18:02 UTC (rev 3) +++ trunk/configure.ac 2006-11-25 00:05:56 UTC (rev 4) @@ -86,6 +86,8 @@ AC_OUTPUT([ Makefile doc/Makefile + examples/Makefile + examples/empty_windows/Makefile src/Makefile ]) Added: trunk/examples/Makefile.am =================================================================== --- trunk/examples/Makefile.am (rev 0) +++ trunk/examples/Makefile.am 2006-11-25 00:05:56 UTC (rev 4) @@ -0,0 +1 @@ +SRCDIRS=empty_windows \ No newline at end of file Added: trunk/examples/empty_windows/Makefile.am =================================================================== Added: trunk/examples/empty_windows/README =================================================================== --- trunk/examples/empty_windows/README (rev 0) +++ trunk/examples/empty_windows/README 2006-11-25 00:05:56 UTC (rev 4) @@ -0,0 +1,3 @@ +This example test the creation, the display, and the destruction of a +main windows. The main windows is destroyed when the user close it or +clic on it. Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2006-11-24 23:18:02 UTC (rev 3) +++ trunk/src/Makefile.am 2006-11-25 00:05:56 UTC (rev 4) @@ -0,0 +1,28 @@ +ADA_SPECS_WITH_BODY = + +ADA_SPECS = $(ADA_SPECS_WITH_BODY) + +ADA_BODIES = $(ADA_SPECS_WITH_BODY:.ads=.adb) + +PROJECT_FILE = gtkada_wrapper.gpr + +EXTRA_DIST = $(PROJECT_FILE) $(ADA_SPECS) $(ADA_BODIES) + +headers_dir = $(includedir)/gtkada_wrapper +ali_dir = $(libdir)/gtkada_wrappe + +all-local: + $(GNATMAKE) -P $(PROJECT_FILE) $(GNATFLAGS) + +install-data-local: + $(INSTALL) -d $(DESTDIR)$(headers_dir) + $(INSTALL) -d $(DESTDIR)$(ali_dir) + for f in $(ADA_SPECS) $(ADA_BODIES); do \ + $(INSTALL) -m 444 $$f $(DESTDIR)$(headers_dir); \ + done; \ + for f in $(srcdir)/libs/*.ali; do \ + $(INSTALL) -m 444 $$f $(DESTDIR)$(ali_dir); \ + done + for f in $(srcdir)/libs/lib*; do \ + $(INSTALL) -m 444 $$f $(DESTDIR)$(libdir); \ + done \ No newline at end of file Added: trunk/src/gtkada_wrapper.adb =================================================================== --- trunk/src/gtkada_wrapper.adb (rev 0) +++ trunk/src/gtkada_wrapper.adb 2006-11-25 00:05:56 UTC (rev 4) @@ -0,0 +1,337 @@ +package body Gtkada_Wrapper is + + ----------------------- + -- Clear_Main_Window -- + ----------------------- + + procedure Clear_Main_Window is + begin + null; + end Clear_Main_Window; + + ------------------------ + -- Create_Main_Window -- + ------------------------ + + procedure Create_Main_Window + (X_Max : Float := 512.0; + Y_Max : Float := 512.0; + Text_Area : Boolean := False; + Drawing_Area : Boolean := True) + is + begin + null; + end Create_Main_Window; + + ------------------------- + -- Destroy_Main_Window -- + ------------------------- + + procedure Destroy_Main_Window is + begin + null; + end Destroy_Main_Window; + + --------- + -- Get -- + --------- + + function Get return String is + begin + return Get; + end Get; + + --------------- + -- Get_Angle -- + --------------- + + function Get_Angle return Float is + begin + return Get_Angle; + end Get_Angle; + + -------------------- + -- Get_Fill_Color -- + -------------------- + + function Get_Fill_Color return Color_Type is + begin + return Get_Fill_Color; + end Get_Fill_Color; + + ------------------- + -- Get_Immediate -- + ------------------- + + procedure Get_Immediate (Item : out Character) is + begin + null; + end Get_Immediate; + + -------------- + -- Get_Line -- + -------------- + + function Get_Line return String is + begin + return Get_Line; + end Get_Line; + + -------------------- + -- Get_Line_Color -- + -------------------- + + function Get_Line_Color return Color_Type is + begin + return Get_Line_Color; + end Get_Line_Color; + + ----------------------- + -- Get_Mouse_Pointer -- + ----------------------- + + procedure Get_Mouse_Pointer + (X : out Float; + Y : out Float; + Button : out Natural) + is + begin + null; + end Get_Mouse_Pointer; + + ------------------ + -- Get_Position -- + ------------------ + + procedure Get_Position (X : out Float; Y : out Float) is + begin + null; + end Get_Position; + + ------------------- + -- Get_Thickness -- + ------------------- + + function Get_Thickness return Float is + begin + return Get_Thickness; + end Get_Thickness; + + ------------------ + -- Insert_Image -- + ------------------ + + procedure Insert_Image + (File_Name : String; + Scale : Float := 1.0; + X_Justification : X_Justification_Type := Center; + Y_Justification : Y_Justification_Type := Center) + is + begin + null; + end Insert_Image; + + ----------------- + -- Insert_Text -- + ----------------- + + procedure Insert_Text + (Text : String; + Size : Float := 10.0; + X_Justification : X_Justification_Type := Center; + Y_Justification : Y_Justification_Type := Center) + is + begin + null; + end Insert_Text; + + ---------- + -- Jump -- + ---------- + + procedure Jump (Distance : Float) is + begin + null; + end Jump; + + ---------- + -- Jump -- + ---------- + + procedure Jump (X : Float; Y : Float) is + begin + null; + end Jump; + + ---------- + -- Line -- + ---------- + + procedure Line (Distance : Float) is + begin + null; + end Line; + + ---------- + -- Line -- + ---------- + + procedure Line (X : Float; Y : Float) is + begin + null; + end Line; + + ---------- + -- Line -- + ---------- + + procedure Line + (X_Start : Float; + Y_Start : Float; + Distance : Float) + is + begin + null; + end Line; + + ---------- + -- Line -- + ---------- + + procedure Line + (X_Start : Float; + Y_Start : Float; + X_End : Float; + Y_End : Float) + is + begin + null; + end Line; + + -------------- + -- New_Line -- + -------------- + + procedure New_Line (Spacing : Positive := 1) is + begin + null; + end New_Line; + + --------- + -- Put -- + --------- + + procedure Put (Item : String) is + begin + null; + end Put; + + --------- + -- Put -- + --------- + + procedure Put (Item : Character) is + begin + null; + end Put; + + -------------- + -- Put_Line -- + -------------- + + procedure Put_Line (Item : String) is + begin + null; + end Put_Line; + + -------------- + -- Put_Line -- + -------------- + + procedure Put_Line (Item : Character) is + begin + null; + end Put_Line; + + ------------- + -- Rafresh -- + ------------- + + procedure Rafresh is + begin + null; + end Rafresh; + + --------- + -- RGB -- + --------- + + function RGB (R : Integer; G : Integer; B : Integer) return Color_Type is + begin + return RGB (R, G, B); + end RGB; + + ------------ + -- Rotate -- + ------------ + + procedure Rotate (Angle : Float) is + begin + null; + end Rotate; + + --------------- + -- Set_Angle -- + --------------- + + procedure Set_Angle (Angle : Float) is + begin + null; + end Set_Angle; + + -------------------- + -- Set_Fill_Color -- + -------------------- + + procedure Set_Fill_Color (C : Color_Type) is + begin + null; + end Set_Fill_Color; + + -------------------- + -- Set_Line_Color -- + -------------------- + + procedure Set_Line_Color (C : Color_Type) is + begin + null; + end Set_Line_Color; + + ------------------ + -- Set_Position -- + ------------------ + + procedure Set_Position (X : Float; Y : Float) is + begin + null; + end Set_Position; + + ------------------- + -- Set_Thickness -- + ------------------- + + procedure Set_Thickness (T : Float) is + begin + null; + end Set_Thickness; + + ---------- + -- Spot -- + ---------- + + procedure Spot (Radius : Float := 4.0) is + begin + null; + end Spot; + +end Gtkada_Wrapper; Property changes on: trunk/src/gtkada_wrapper.adb ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native Added: trunk/src/gtkada_wrapper.ads =================================================================== --- trunk/src/gtkada_wrapper.ads (rev 0) +++ trunk/src/gtkada_wrapper.ads 2006-11-25 00:05:56 UTC (rev 4) @@ -0,0 +1,239 @@ +-- $Id$ +-- AUTHOR: Bechir Zalila <bec...@en...> + +-- This package provides a simplified api to build graphic Ada +-- applications. Its purpose is to encapsulate the complexity of GTK +-- (and GTKAda) and provide a simple way to build graphical Ada +-- application for beginner programmers. + +-- This package has been inspired from the Ada TurtleGraphic project +-- available at http://www.eecs.usma.edu/research/ + +package Gtkada_Wrapper is + + procedure Create_Main_Window + (X_Max : Float := 512.0; + Y_Max : Float := 512.0; + Text_Area : Boolean := False; + Drawing_Area : Boolean := True); + -- Creates the main window of the application. X_Max and Y_Max + -- represent respectively the width and the height of each one of + -- the windows parts: the drawing area and the typing area. The + -- flags Text_Area and Drawing_Area control the creation of these + -- parts. Note that at least one of these two flags has to be set + -- to true. + + procedure Clear_Main_Window; + -- Clear the main window. If the drwing area exists, then it will + -- be ``blanked''. If the text area exist then all text will be + -- erased. + + procedure Destroy_Main_Window; + -- Close and destroy the main window + + ------------------------------------ + -- Drawing Area Specific Routines -- + ------------------------------------ + + -- All the drawing is performed using a virtual brush. the brush + -- has the following intrinsic characteristics: + + -- 1 - A position relatively to the lower left corner of the + -- drowing area. This position can be got/set using the Cartesian + -- coordinate system as we as the Polar coordinate system. + + -- 2 - An Orientation relatively to the horizontal orientation and + -- counter clockwise. For the sake of simplicity, all the angles + -- are expressed in 'Degree'. + + -- Its obvious that only one of these characteristics is + -- sufficient to perform all kinds of drawing. However, combining + -- both systems may simplify enormously some complex drawings. + + type Color_Type is private; + -- The color type + + function RGB (R : Integer; G : Integer; B : Integer) return Color_Type; + -- Create an RGB (Red Green Blue) color. All the given parameter + -- are considered modulo 256. + + Black : constant Color_Type; + Red : constant Color_Type; + Green : constant Color_Type; + Yellow : constant Color_Type; + Blue : constant Color_Type; + Magenta : constant Color_Type; + Cyan : constant Color_Type; + Orange : constant Color_Type; + Pink : constant Color_Type; + Dark_Gray : constant Color_Type; + Gray : constant Color_Type; + Light_Gray : constant Color_Type; + White : constant Color_Type; + -- Predefined colors + + procedure Set_Line_Color (C : Color_Type); + -- Set the line color of the virtual brush to C + + function Get_Line_Color return Color_Type; + -- Return the Current line color of the virtual brush + + procedure Set_Fill_Color (C : Color_Type); + -- Set the fill color of the virtual brush to C. The fill + -- color is the color of the inside part of closed drawn forms + -- (circles, square...). + + function Get_Fill_Color return Color_Type; + -- Return the Current fill color of the virtual brush + + procedure Set_Thickness (T : Float); + -- Set the thickness of the virtual brush to T + + function Get_Thickness return Float; + -- Get the current thickness of the virtual brush + + -- FIXME: May be add routines for line style + + procedure Set_Angle (Angle : Float); + -- Set the angle between the horizontal and the virtual brush + -- orientation to 'Angle'. + + function Get_Angle return Float; + -- Return the angle between the horizontal and the virtual brush + -- orientation. + + procedure Rotate (Angle : Float); + -- Modify the virtual brush orientation to + -- Angle+Current_Orientation. + + procedure Set_Position (X : Float; Y : Float); + -- Set the current Cartesian position of the virtual brush to + -- (X,Y). + + procedure Get_Position (X : out Float; Y : out Float); + -- Get the current Cartesian position of the virtual brush + + procedure Jump (Distance : Float); + -- Jump straight forward the given distance in the direction the + -- virtual brush without drawing any line. + + procedure Jump (X : Float; Y : Float); + -- Same as above but using the Cartesian coordinate + + procedure Line (Distance : Float); + -- Jump straight forward the given distance in the direction the + -- virtual brush and draws a line between the start and the end + -- points. The color, style and thickness of the line are + -- specified using the appropriate routines. + + procedure Line (X : Float; Y : Float); + -- Same as above but using the Cartesian coordinate + + procedure Line (X_Start : Float; + Y_Start : Float; + Distance : Float); + -- Same as above but start from (X_Start, Y_Start). At the end of + -- execution, the virtual brush is located at the end of the drwn + -- line. + + procedure Line + (X_Start : Float; + Y_Start : Float; + X_End : Float; + Y_End : Float); + -- Same as above, but with the Cartesian destination. + + procedure Spot (Radius : Float := 4.0); + -- Draw a spot in the current position with the given radius + + type X_Justification_Type is (Left, Center, Right); + type Y_Justification_Type is (Top, Center, Bottom); + procedure Insert_Image + (File_Name : String; + Scale : Float := 1.0; + X_Justification : X_Justification_Type := Center; + Y_Justification : Y_Justification_Type := Center); + -- Draw a graphic justified at the virtual brush's current + -- location. This will draw any graphic that Gtk understands, + -- including JPEG, GIF, BMP, PNG, PBM, TIFF, and perhaps some + -- others. + + procedure Insert_Text + (Text : String; + Size : Float := 10.0; + X_Justification : X_Justification_Type := Center; + Y_Justification : Y_Justification_Type := Center); + -- Draw a text string justified at the virtual brush's current + -- location. The size is expressed in points. + + -- FIXME: Add routines for predefined forms (circle, square...) + + procedure Rafresh; + -- Redraw the drawing area + + procedure Get_Mouse_Pointer + (X : out Float; + Y : out Float; + Button : out Natural); + -- Wait for a mous button action and stores the mouse pointer + -- coordinate in X and Y and the mouse button used to do the + -- action. + + --------------------------------- + -- Text Area Specific Routines -- + --------------------------------- + + procedure Put(Item : String); + -- Type the given text on the current cursor position of the text + -- area. + + procedure Put(Item : Character); + -- Same as above but with a character + + procedure New_Line(Spacing : Positive := 1); + -- Jump to the beginning of the last line of the next 'Spacing' + -- lines. + + procedure Put_Line(Item : String); + -- Equivalent to Put (Item); New_Line; + + procedure Put_Line(Item : Character); + -- Equivalent to Put (Item); New_Line; + + function Get return String; + -- Block until the user types a string followed by pressing ENTER + + function Get_Line return String; + -- Equivalent to ... := Get; New_Line; + + procedure Get_Immediate(Item : out Character); + -- Block until the user press a key. The value of the key is + -- stored in Item. The user does not need to press ENTER. + + -- FIXME: Maybe some I/O function for intergers, floats... + +private + + type Single_Color is mod 256; + + type Color_Type is record + R : Single_Color; + G : Single_Color; + B : Single_Color; + end record; + + Black : constant Color_Type := RGB (0, 0, 0); + Red : constant Color_Type := RGB (255, 0, 0); + Green : constant Color_Type := RGB (0, 255, 0); + Yellow : constant Color_Type := RGB (255, 255, 0); + Blue : constant Color_Type := RGB (0, 0, 255); + Magenta : constant Color_Type := RGB (255, 0, 255); + Cyan : constant Color_Type := RGB (0, 255, 255); + Dark_Gray : constant Color_Type := RGB (77, 77, 77); + Orange : constant Color_Type := RGB (255, 165, 0); + Pink : constant Color_Type := RGB (255, 192, 203); + Gray : constant Color_Type := RGB (127, 127, 127); + Light_Gray : constant Color_Type := RGB (179, 179, 179); + White : constant Color_Type := RGB (255, 255, 255); + +end Gtkada_Wrapper; Property changes on: trunk/src/gtkada_wrapper.ads ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native Added: trunk/src/gtkada_wrapper.gpr =================================================================== --- trunk/src/gtkada_wrapper.gpr (rev 0) +++ trunk/src/gtkada_wrapper.gpr 2006-11-25 00:05:56 UTC (rev 4) @@ -0,0 +1,40 @@ +project GTKAda_Wrapper is + for Library_Kind use "static"; + for Source_Dirs use ("."); + for Object_Dir use "objects"; + for Library_Dir use "libs"; + + for Library_Name use "gtkada_wrapper"; + + -- Build options + + type Build_Type is ("release", "debug"); + Build : Build_Type := External ("BUILD", "debug"); + + -- Compiler flags + + package Compiler is + case Build is + when "debug" => + for Default_Switches ("Ada") use + ("-g", "-gnat05", "-gnatfy", "-gnatwae", "-gnatoa", + "-fstack-check", "-gnatg"); + when "release" => + for Default_Switches ("Ada") use + ("-g", "-O2", "-gnat05", "-gnatfy", "-gnatwae", "-gnatpn", + "-gnatg"); + end case; + end Compiler; + + -- Binder options + + package Binder is + case Build is + when "debug" => + for Default_Switches ("Ada") use + ("-E"); + when "release" => + null; + end case; + end Binder; +end GTKAda_Wrapper; \ No newline at end of file Property changes on: trunk/src/gtkada_wrapper.gpr ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |