[Gtkada-wrapper-devel] SF.net SVN: gtkada-wrapper: [23] trunk
Brought to you by:
bechir_zalila
From: <bec...@us...> - 2006-11-30 18:50:56
|
Revision: 23 http://svn.sourceforge.net/gtkada-wrapper/?rev=23&view=rev Author: bechir_zalila Date: 2006-11-30 10:50:56 -0800 (Thu, 30 Nov 2006) Log Message: ----------- * Renamed Spot into Point, removed the radius from points since Fill_Circle does this job now and addad a custom Point procedure that draws a point at the position given as parameter. Modified Paths: -------------- trunk/TODO trunk/examples/basic_drawings/basic_drawings.adb trunk/examples/fractal/fractal.adb trunk/src/gtkada_wrapper.adb trunk/src/gtkada_wrapper.ads Modified: trunk/TODO =================================================================== --- trunk/TODO 2006-11-29 22:48:53 UTC (rev 22) +++ trunk/TODO 2006-11-30 18:50:56 UTC (rev 23) @@ -1,6 +1,5 @@ /src: * Implement text display on the drawing area - * Implement a custom 'Spot' * Implement image insertion * Implement Text area Modified: trunk/examples/basic_drawings/basic_drawings.adb =================================================================== --- trunk/examples/basic_drawings/basic_drawings.adb 2006-11-29 22:48:53 UTC (rev 22) +++ trunk/examples/basic_drawings/basic_drawings.adb 2006-11-30 18:50:56 UTC (rev 23) @@ -39,16 +39,18 @@ Set_Color (My_Color_1); Jump (50.0, 50.0); - Spot (20.0); + Fill_Circle (20.0); Get_Mouse_Pointer (X, Y, Button); Jump (100.0, 100.0); - Spot (10.0); + Fill_Circle (10.0); Set_Color (My_Color_2); Jump (100.0, 400.0); - Spot (10.0); + Fill_Circle (10.0); + Point; + Point (500.0, 500.0); Set_Color (My_Color_2); Set_Thickness (8.0); Modified: trunk/examples/fractal/fractal.adb =================================================================== --- trunk/examples/fractal/fractal.adb 2006-11-29 22:48:53 UTC (rev 22) +++ trunk/examples/fractal/fractal.adb 2006-11-30 18:50:56 UTC (rev 23) @@ -10,6 +10,8 @@ procedure Fractal is + N_Points : Natural := 0; + procedure Draw_Fractal (X1, Y1, X2, Y2 : in Float); -- Draw a fractal recursively @@ -23,7 +25,8 @@ begin if abs (X1 - X2) > 1.0 or abs (Y1 - Y2) > 1.0 then Jump (X1, Y1); - Spot; + Point; + N_Points := N_Points + 1; Draw_Fractal (X1, Y1, X3, Y3); Draw_Fractal (X3, Y3, X2, Y2); end if; @@ -35,9 +38,13 @@ begin Create_Main_Window; + Set_Color (Red); + Draw_Fractal (150.0, 100.0, 350.0, 400.0); Draw_Fractal (350.0, 400.0, 150.0, 100.0); + Ada.Text_IO.Put_Line ("Drawn" & N_Points'Img & " points."); + Get_Mouse_Pointer (X, Y, Button); Ada.Text_IO.Put_Line ("Got Click:"); Ada.Text_IO.Put_Line (" X = " & X'Img); Modified: trunk/src/gtkada_wrapper.adb =================================================================== --- trunk/src/gtkada_wrapper.adb 2006-11-29 22:48:53 UTC (rev 22) +++ trunk/src/gtkada_wrapper.adb 2006-11-30 18:50:56 UTC (rev 23) @@ -171,7 +171,8 @@ A_Fill_Rectangle, A_Draw_Polygon, A_Fill_Polygon, - A_Spot, + A_Point_Current, + A_Point_Custom, A_Image, A_Text, A_Rafresh, @@ -204,6 +205,7 @@ | A_Reset_Handler | A_Destroy | A_Clear_Drawing_Area + | A_Point_Current | A_Rafresh | A_Clear_Text_Area | A_Get_String @@ -252,23 +254,25 @@ null; end case; - when A_Spot + when A_Point_Custom | A_Draw_Circle_From_Current | A_Draw_Circle_From_Custom | A_Fill_Circle_From_Current | A_Fill_Circle_From_Custom => - Radius : Float; + -- This component is not necessary for A_Point_Custom, + -- but we cannot factorize more. - case Action is - when A_Draw_Circle_From_Custom + case Action is + when A_Point_Custom + | A_Draw_Circle_From_Custom | A_Fill_Circle_From_Custom => Center_X : Float; Center_Y : Float; when others => null; - end case; + end case; when A_Image | A_Text => X_Justify : X_Justification_Type; @@ -332,7 +336,8 @@ procedure Do_Fill_Rectangle (Cmd : in out Command); procedure Do_Draw_Polygon (Cmd : in out Command); procedure Do_Fill_Polygon (Cmd : in out Command); - procedure Do_Spot (Cmd : in out Command); + procedure Do_Point_Current (Cmd : in out Command); + procedure Do_Point_Custom (Cmd : in out Command); procedure Do_Image (Cmd : in out Command); procedure Do_Text (Cmd : in out Command); procedure Do_Rafresh (Cmd : in out Command); @@ -385,7 +390,8 @@ A_Rafresh => Do_Rafresh'Access, A_Reset_Handler => null, A_Rotate => Do_Rotate'Access, - A_Spot => Do_Spot'Access, + A_Point_Current => Do_Point_Current'Access, + A_Point_Custom => Do_Point_Custom'Access, A_Text => Do_Text'Access, A_Thickness => Do_Thickness'Access); @@ -1401,6 +1407,55 @@ end Do_New_Line; ---------------------- + -- Do_Point_Current -- + ---------------------- + + procedure Do_Point_Current (Cmd : in out Command) is + pragma Unreferenced (Cmd); + begin + pragma Debug (O ("Do_Point_Current: begin")); + + Draw_Point + (Get_Window (Drawing_Area), + Graphic_Context, + Gint (Brush_X), + Height - Gint (Brush_Y)); + + -- Backup + + Draw_Point + (Pixmap, + Graphic_Context, + Gint (Brush_X), + Height - Gint (Brush_Y)); + pragma Debug (O ("Do_Point_Current: done")); + end Do_Point_Current; + + --------------------- + -- Do_Point_Custom -- + --------------------- + + procedure Do_Point_Custom (Cmd : in out Command) is + begin + pragma Debug (O ("Do_Point_Custom: begin")); + + Draw_Point + (Get_Window (Drawing_Area), + Graphic_Context, + Gint (Cmd.Center_X), + Height - Gint (Cmd.Center_Y)); + + -- Backup + + Draw_Point + (Pixmap, + Graphic_Context, + Gint (Cmd.Center_X), + Height - Gint (Cmd.Center_Y)); + pragma Debug (O ("Do_Point_Custom: done")); + end Do_Point_Custom; + + ---------------------- -- Do_Put_Character -- ---------------------- @@ -1474,43 +1529,6 @@ end Do_Rotate; ------------- - -- Do_Spot -- - ------------- - - procedure Do_Spot (Cmd : in out Command) is - begin - pragma Debug (O ("Do_Spot: begin")); - - Draw_Arc - (Get_Window (Drawing_Area), - Graphic_Context, - True, - Gint (Brush_X) - Gint (Cmd.Radius), - Height - Gint (Brush_Y) - Gint (Cmd.Radius), - 2 * Gint (Cmd.Radius), - 2 * Gint (Cmd.Radius), - 0, - 360 * 64); - - -- Backup - - Draw_Arc - (Pixmap, - Graphic_Context, - True, - Gint (Brush_X) - Gint (Cmd.Radius), - Height - Gint (Brush_Y) - Gint (Cmd.Radius), - 2 * Gint (Cmd.Radius), - 2 * Gint (Cmd.Radius), - 0, - 360 * 64); - - pragma Debug (O ("Drawn a spot of radius" & Cmd.Radius'Img & " at " - & "(" & Brush_X'Img & ", " & Brush_Y'Img & ")")); - pragma Debug (O ("Do_Spot: done")); - end Do_Spot; - - ------------- -- Do_Text -- ------------- @@ -2033,6 +2051,33 @@ Ada.Text_IO.Put_Line (Message); end O; + ----------- + -- Point -- + ----------- + + procedure Point is + begin + Assert_Main_Window_Exits; + pragma Debug (O ("Point from current : begin")); + Command_Queue.Enqueue (Command'(Action => A_Point_Current)); + pragma Debug (O ("Point from current : enqueued")); + end Point; + + ----------- + -- Point -- + ----------- + + procedure Point (Center_X : Float; Center_Y : Float) is + begin + Assert_Main_Window_Exits; + pragma Debug (O ("Point from custom : begin")); + Command_Queue.Enqueue (Command'(Action => A_Point_Custom, + Center_X => Center_X, + Center_Y => Center_Y, + Radius => 0.0)); -- Dummy + pragma Debug (O ("Point from custom : enqueued")); + end Point; + --------- -- Put -- --------- @@ -2211,20 +2256,6 @@ pragma Debug (O ("Set_Thickness : enqueued")); end Set_Thickness; - ---------- - -- Spot -- - ---------- - - procedure Spot (Radius : Float := 1.0) is - begin - Assert_Main_Window_Exits; - pragma Debug (O ("Spot : begin")); - Command_Queue.Enqueue (Command' - (Action => A_Spot, - Radius => Radius)); - pragma Debug (O ("Spot : enqueued")); - end Spot; - ------------------ -- To_Gdk_Color -- ------------------ Modified: trunk/src/gtkada_wrapper.ads =================================================================== --- trunk/src/gtkada_wrapper.ads 2006-11-29 22:48:53 UTC (rev 22) +++ trunk/src/gtkada_wrapper.ads 2006-11-30 18:50:56 UTC (rev 23) @@ -143,9 +143,12 @@ Y_End : Float); -- Same as above, but with the Cartesian destination. - procedure Spot (Radius : Float := 1.0); - -- Draw a spot in the current position with the given radius + procedure Point; + -- Draw a Point in the current position + procedure Point (Center_X : Float; Center_Y : Float); + -- Same as above but with a custom position + type X_Justification_Type is (Left, Center, Right); type Y_Justification_Type is (Top, Center, Bottom); procedure Insert_Image This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |