[longomatch/drawing: 1/3] Initial drawing tool support



commit 8255987d66bef5b94fbf007c121da1ad024e2563
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Oct 1 03:39:13 2009 +0200

    Initial drawing tool support
    	All tools working out except for the eraser

 LongoMatch.mds                                     |   12 +-
 LongoMatch/Gui/Component/DrawingWidget.cs          |  259 ++++++++++++++++++++
 LongoMatch/LongoMatch.mdp                          |    2 +
 .../LongoMatch.Gui.Component.DrawingToolBox.cs     |  249 ++++++++++++++------
 .../LongoMatch.Gui.Component.DrawingWidget.cs      |   50 ++++
 LongoMatch/gtk-gui/gui.stetic                      |  137 ++++++++++-
 LongoMatch/gtk-gui/objects.xml                     |   12 +-
 7 files changed, 637 insertions(+), 84 deletions(-)
---
diff --git a/LongoMatch.mds b/LongoMatch.mds
index c56d9d4..dc320a3 100644
--- a/LongoMatch.mds
+++ b/LongoMatch.mds
@@ -1,12 +1,12 @@
 <Combine fileversion="2.0" description="LongoMatch : The Digital Coach" outputpath="build/bin/" releaseversion="0.9.0" name="LongoMatch">
   <Policies>
-    <StandardHeader inheritsSet="GPLv2License" />
-    <TextStylePolicy FileWidth="120" TabWidth="4" TabsToSpaces="False" NoTabsAfterNonTabs="False" RemoveTrailingWhitespace="False" EolMarker="Native" />
-    <VersionControlPolicy inheritsSet="Mono" />
-    <DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="FileFormatDefault" />
     <ChangeLogPolicy UpdateMode="None" inheritsSet="Mono">
       <MessageStyle LineAlign="0" />
     </ChangeLogPolicy>
+    <VersionControlPolicy inheritsSet="Mono" />
+    <DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="FileFormatDefault" />
+    <TextStylePolicy FileWidth="120" TabWidth="4" TabsToSpaces="False" NoTabsAfterNonTabs="False" RemoveTrailingWhitespace="False" EolMarker="Native" />
+    <StandardHeader inheritsSet="GPLv2License" />
   </Policies>
   <Configurations active="Release">
     <Configuration name="Debug" ctype="CombineConfiguration">
@@ -14,12 +14,14 @@
       <Entry build="True" name="libcesarplayer" configuration="Debug" />
       <Entry build="True" name="Translations" configuration="Debug" />
       <Entry build="True" name="CesarPlayer" configuration="Debug" />
+      <Entry build="True" name="Test" configuration="Debug" />
     </Configuration>
     <Configuration name="Release" ctype="CombineConfiguration">
       <Entry build="True" name="LongoMatch" configuration="Release" />
       <Entry build="True" name="libcesarplayer" configuration="Release" />
       <Entry build="True" name="Translations" configuration="Release" />
       <Entry build="True" name="CesarPlayer" configuration="Release" />
+      <Entry build="True" name="Test" configuration="Release" />
     </Configuration>
   </Configurations>
   <StartMode startupentry="LongoMatch" single="True">
@@ -27,6 +29,7 @@
     <Execute type="None" entry="libcesarplayer" />
     <Execute type="None" entry="Translations" />
     <Execute type="None" entry="CesarPlayer" />
+    <Execute type="None" entry="Test" />
   </StartMode>
   <MonoDevelop.ChangeLogAddIn.ChangeLogInfo policy="UpdateNearestChangeLog" />
   <Entries>
@@ -34,5 +37,6 @@
     <Entry filename="libcesarplayer/liblongomatch.mdp" />
     <Entry filename="Translations/Translations.mdse" />
     <Entry filename="CesarPlayer/CesarPlayer.mdp" />
+    <Entry filename="Test/Test.mdp" />
   </Entries>
 </Combine>
\ No newline at end of file
diff --git a/LongoMatch/Gui/Component/DrawingWidget.cs b/LongoMatch/Gui/Component/DrawingWidget.cs
new file mode 100644
index 0000000..d9a56a0
--- /dev/null
+++ b/LongoMatch/Gui/Component/DrawingWidget.cs
@@ -0,0 +1,259 @@
+// 
+//  Copyright (C) 2007-2009 Andoni Morales Alastruey
+// 
+//  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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+// 
+
+using System;
+using Gdk;
+using Gtk;
+using Cairo;
+
+
+namespace LongoMatch.Gui.Component
+{
+	public enum DrawTool{
+		PEN,
+		LINE,
+		CIRCLE,
+		RECTANGLE,
+		CROSS,
+		ERASER
+	}
+	
+	[System.ComponentModel.ToolboxItem(true)]
+	public partial class DrawingWidget : Gtk.Bin
+	{
+		private Surface source;
+		private Surface drawings;
+		
+		private Cairo.Color lineColor;
+		private int lineWidth;
+		private DrawTool selectedTool;
+		
+		private Cairo.PointD initialPoint,finalPoint;
+	
+		private int sourceWidth,sourceHeight;
+		
+		private bool loaded;
+		private bool visible;
+		private bool preview;
+		
+		//Offset values to keep image in center
+		private int xOffset;
+		private int yOffset;
+		
+		//Mouse motion
+		private double lastx=0;
+		private double lasty=0;
+		
+		public DrawingWidget()
+		{
+			this.Build();	
+			lineColor = new Cairo.Color(Double.MaxValue,0,0);
+			lineWidth = 6;
+			selectedTool = DrawTool.PEN;
+			loaded = false;
+			visible = true;
+			preview=false;
+		}
+		
+		public Pixbuf SourceImage{
+			set{
+				sourceWidth = value.Width;
+				sourceHeight = value.Height;
+				source = new ImageSurface(Format.RGB24,sourceWidth,sourceHeight);
+				drawings = new ImageSurface (Format.ARGB32,sourceWidth,sourceHeight);
+				using (Context sourceCR = new Context(source)){					
+					CairoHelper.SetSourcePixbuf(sourceCR,value,0,0);
+					sourceCR.Paint();
+				}
+				drawingarea.WidthRequest=sourceWidth;
+				drawingarea.HeightRequest=sourceHeight;
+				loaded = true;
+			}			
+		}
+		
+		public int LineWidth{
+			set{lineWidth = value;}
+		}		
+		
+		public Gdk.Color LineColor{
+			set{lineColor = new Cairo.Color(value.Red,value.Green,value.Blue);}
+		}
+				
+		public DrawTool DrawTool{
+			set{this.selectedTool = value;}
+			get{return selectedTool;}
+		}
+		
+		public bool DrawingsVisible{
+			set{visible = value;}
+		}
+		
+		private void SetContextProperties(Context c){
+			c.LineWidth = lineWidth;
+			c.LineCap = LineCap.Round;
+			c.Color =lineColor;
+		}
+			
+		private void DrawLine(Context c, double x1, double y1, double x2, double y2){		
+			SetContextProperties(c);
+			c.MoveTo(x1-xOffset,y1-yOffset);
+			c.LineTo(x2-xOffset,y2-yOffset);
+			c.Stroke();
+			c.Fill();		
+		}
+		
+		private void DrawRectangle(Context c, double x1, double y1, double x2, double y2){	
+			SetContextProperties(c);
+			c.Rectangle(x1-xOffset,y1-yOffset,x2-xOffset,y2-yOffset);
+			c.Stroke();
+			c.Fill();
+		}
+		
+		private void DrawCross(Context c, double x1, double y1, double x2, double y2){	
+			DrawLine(c, x1, y1, x2, y2);
+			DrawLine(c, x2, y1, x1, y2);
+		}
+		
+		private void DrawCircle(Context c, double x1, double y1, double x2, double y2){	
+			double xc,yc,radius,angle1,angle2;
+			
+			xc=x1+(x2-x1)/2 - xOffset;
+			yc=y1+(y2-y1)/2 - yOffset;
+			radius = Math.Sqrt(Math.Pow((x2-x1),2)+
+			                   Math.Pow((y2-y1),2));
+			radius /=2;
+			angle1 = 45.0 *  (Math.PI/180);
+			angle2 = 360.0 *  (Math.PI/180);
+			
+			SetContextProperties(c);
+			c.Arc(xc,yc,radius,angle1,angle2);
+			
+			c.Stroke();
+			c.Fill();
+		}			
+
+		protected virtual void OnDrawingareaExposeEvent (object o, Gtk.ExposeEventArgs args)
+		{
+			if (!loaded)
+				return;
+					
+			using (Context c = CairoHelper.Create(drawingarea.GdkWindow)){
+				c.SetSourceSurface(source,xOffset,yOffset);
+				c.Paint();
+				if (visible){
+					c.SetSourceSurface(drawings,xOffset,yOffset);
+					c.Paint();					
+				}
+				
+				//Preview
+				if (preview){
+				switch (selectedTool){
+						case DrawTool.LINE:
+							DrawLine(c,initialPoint.X+xOffset,initialPoint.Y+yOffset,finalPoint.X+xOffset,finalPoint.Y+yOffset);
+							break;
+						case DrawTool.RECTANGLE:
+							DrawRectangle(c,initialPoint.X+xOffset,initialPoint.Y+yOffset,finalPoint.X+xOffset,finalPoint.Y+yOffset);
+							break;
+						case DrawTool.CIRCLE:
+							DrawCircle(c,initialPoint.X+xOffset,initialPoint.Y+yOffset,finalPoint.X+xOffset,finalPoint.Y+yOffset);
+							break;
+						case DrawTool.CROSS:
+							DrawCross(c,initialPoint.X+xOffset,initialPoint.Y+yOffset,finalPoint.X+xOffset,finalPoint.Y+yOffset);
+							break;
+						default:
+							break;						
+					}
+				}
+			}	
+		}
+		
+		protected virtual void OnDrawingareaButtonPressEvent (object o, Gtk.ButtonPressEventArgs args)
+		{
+			preview = true;
+			initialPoint = new Cairo.PointD(args.Event.X,args.Event.Y);
+			
+			if (selectedTool == DrawTool.PEN){
+				lastx = args.Event.X;
+				lasty = args.Event.Y;
+			
+				if (args.Event.Button == 1){
+					using (Context c = new Context(drawings)){
+						DrawLine(c,args.Event.X,args.Event.Y,args.Event.X,args.Event.Y);
+					}
+				}
+			}
+		}
+
+		protected virtual void OnDrawingareaButtonReleaseEvent (object o, Gtk.ButtonReleaseEventArgs args)
+		{
+			preview = false;
+			finalPoint = new Cairo.PointD(args.Event.X,args.Event.Y);
+			using (Context c = new Context(drawings)){
+				switch (selectedTool){
+					case DrawTool.PEN:
+						lastx=0;
+						lasty=0;
+						break;
+					case DrawTool.LINE:
+						DrawLine(c,initialPoint.X,initialPoint.Y,finalPoint.X,finalPoint.Y);
+						break;
+					case DrawTool.RECTANGLE:
+						DrawRectangle(c,initialPoint.X,initialPoint.Y,finalPoint.X,finalPoint.Y);
+						break;
+					case DrawTool.CIRCLE:
+						DrawCircle(c,initialPoint.X,initialPoint.Y,finalPoint.X,finalPoint.Y);
+						break;
+					case DrawTool.CROSS:
+						DrawCross(c,initialPoint.X,initialPoint.Y,finalPoint.X,finalPoint.Y);
+						break;
+					default:
+						DrawLine(c,initialPoint.X,initialPoint.Y,finalPoint.X,finalPoint.Y);
+						break;						
+				}
+			}
+			QueueDraw();			
+		}
+
+		protected virtual void OnDrawingareaMotionNotifyEvent (object o, Gtk.MotionNotifyEventArgs args)
+		{
+			finalPoint = new Cairo.PointD(args.Event.X,args.Event.Y);
+			
+			if (selectedTool == DrawTool.PEN){
+				using (Context c = new Context(drawings)){
+					DrawLine (c,lastx,lasty,args.Event.X,args.Event.Y);
+				}
+				lastx = args.Event.X;
+				lasty = args.Event.Y;
+			}
+			QueueDraw();
+		}
+
+		protected virtual void OnDrawingareaSizeAllocated (object o, Gtk.SizeAllocatedArgs args)
+		{
+			if (args.Allocation.Width > sourceWidth)
+				xOffset = (Allocation.Width - sourceWidth) / 2;
+			else 
+				xOffset = 0;
+
+			if (args.Allocation.Height > sourceHeight)
+				yOffset = (Allocation.Height -sourceHeight) / 2;
+			else
+				yOffset = 0;		
+		}	
+	}
+}
diff --git a/LongoMatch/LongoMatch.mdp b/LongoMatch/LongoMatch.mdp
index 99188c4..15c631a 100644
--- a/LongoMatch/LongoMatch.mdp
+++ b/LongoMatch/LongoMatch.mdp
@@ -155,6 +155,8 @@
     <File name="gtk-gui/LongoMatch.Gui.Component.PlayersListTreeWidget.cs" subtype="Code" buildaction="Compile" />
     <File name="gtk-gui/LongoMatch.Gui.Dialog.ProjectTemplateEditorDialog.cs" subtype="Code" buildaction="Compile" />
     <File name="Gui/Dialog/TeamTemplateEditor.cs" subtype="Code" buildaction="Compile" />
+    <File name="gtk-gui/LongoMatch.Gui.Component.DrawingWidget.cs" subtype="Code" buildaction="Compile" />
+    <File name="Gui/Component/DrawingWidget.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.DrawingToolBox.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.DrawingToolBox.cs
index 2d65892..4e4aed1 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.DrawingToolBox.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.DrawingToolBox.cs
@@ -15,9 +15,19 @@ namespace LongoMatch.Gui.Component {
         
         private Gtk.VBox vbox2;
         
+        private Gtk.Table table1;
+        
+        private Gtk.Button button49;
+        
+        private Gtk.Button button50;
+        
+        private Gtk.Button button51;
+        
+        private Gtk.Button button52;
+        
         private Gtk.ComboBox combobox1;
         
-        private Gtk.Table table1;
+        private Gtk.Table table2;
         
         private Gtk.RadioButton bbutton;
         
@@ -45,6 +55,105 @@ namespace LongoMatch.Gui.Component {
             this.vbox2.Name = "vbox2";
             this.vbox2.Spacing = 6;
             // Container child vbox2.Gtk.Box+BoxChild
+            this.table1 = new Gtk.Table(((uint)(2)), ((uint)(2)), false);
+            this.table1.Name = "table1";
+            this.table1.RowSpacing = ((uint)(6));
+            this.table1.ColumnSpacing = ((uint)(6));
+            // Container child table1.Gtk.Table+TableChild
+            this.button49 = new Gtk.Button();
+            this.button49.CanFocus = true;
+            this.button49.Name = "button49";
+            this.button49.UseUnderline = true;
+            // Container child button49.Gtk.Container+ContainerChild
+            Gtk.Alignment w1 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+            // Container child GtkAlignment.Gtk.Container+ContainerChild
+            Gtk.HBox w2 = new Gtk.HBox();
+            w2.Spacing = 2;
+            // Container child GtkHBox.Gtk.Container+ContainerChild
+            Gtk.Image w3 = new Gtk.Image();
+            w3.Pixbuf = Stetic.IconLoader.LoadIcon(this, "stock_draw-line-45", Gtk.IconSize.Menu, 16);
+            w2.Add(w3);
+            // Container child GtkHBox.Gtk.Container+ContainerChild
+            Gtk.Label w5 = new Gtk.Label();
+            w2.Add(w5);
+            w1.Add(w2);
+            this.button49.Add(w1);
+            this.table1.Add(this.button49);
+            Gtk.Table.TableChild w9 = ((Gtk.Table.TableChild)(this.table1[this.button49]));
+            w9.TopAttach = ((uint)(1));
+            w9.BottomAttach = ((uint)(2));
+            w9.LeftAttach = ((uint)(1));
+            w9.RightAttach = ((uint)(2));
+            // Container child table1.Gtk.Table+TableChild
+            this.button50 = new Gtk.Button();
+            this.button50.CanFocus = true;
+            this.button50.Name = "button50";
+            this.button50.UseUnderline = true;
+            // Container child button50.Gtk.Container+ContainerChild
+            Gtk.Alignment w10 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+            // Container child GtkAlignment.Gtk.Container+ContainerChild
+            Gtk.HBox w11 = new Gtk.HBox();
+            w11.Spacing = 2;
+            // Container child GtkHBox.Gtk.Container+ContainerChild
+            Gtk.Image w12 = new Gtk.Image();
+            w12.Pixbuf = Stetic.IconLoader.LoadIcon(this, "stock_draw-line-ends-with-arrow", Gtk.IconSize.Menu, 16);
+            w11.Add(w12);
+            // Container child GtkHBox.Gtk.Container+ContainerChild
+            Gtk.Label w14 = new Gtk.Label();
+            w11.Add(w14);
+            w10.Add(w11);
+            this.button50.Add(w10);
+            this.table1.Add(this.button50);
+            // Container child table1.Gtk.Table+TableChild
+            this.button51 = new Gtk.Button();
+            this.button51.CanFocus = true;
+            this.button51.Name = "button51";
+            this.button51.UseUnderline = true;
+            // Container child button51.Gtk.Container+ContainerChild
+            Gtk.Alignment w19 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+            // Container child GtkAlignment.Gtk.Container+ContainerChild
+            Gtk.HBox w20 = new Gtk.HBox();
+            w20.Spacing = 2;
+            // Container child GtkHBox.Gtk.Container+ContainerChild
+            Gtk.Image w21 = new Gtk.Image();
+            w21.Pixbuf = Stetic.IconLoader.LoadIcon(this, "stock_draw-rectangle-unfilled", Gtk.IconSize.Menu, 16);
+            w20.Add(w21);
+            // Container child GtkHBox.Gtk.Container+ContainerChild
+            Gtk.Label w23 = new Gtk.Label();
+            w20.Add(w23);
+            w19.Add(w20);
+            this.button51.Add(w19);
+            this.table1.Add(this.button51);
+            Gtk.Table.TableChild w27 = ((Gtk.Table.TableChild)(this.table1[this.button51]));
+            w27.LeftAttach = ((uint)(1));
+            w27.RightAttach = ((uint)(2));
+            // Container child table1.Gtk.Table+TableChild
+            this.button52 = new Gtk.Button();
+            this.button52.CanFocus = true;
+            this.button52.Name = "button52";
+            this.button52.UseUnderline = true;
+            // Container child button52.Gtk.Container+ContainerChild
+            Gtk.Alignment w28 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+            // Container child GtkAlignment.Gtk.Container+ContainerChild
+            Gtk.HBox w29 = new Gtk.HBox();
+            w29.Spacing = 2;
+            // Container child GtkHBox.Gtk.Container+ContainerChild
+            Gtk.Image w30 = new Gtk.Image();
+            w30.Pixbuf = Stetic.IconLoader.LoadIcon(this, "stock_draw-ellipse-unfilled", Gtk.IconSize.Menu, 16);
+            w29.Add(w30);
+            // Container child GtkHBox.Gtk.Container+ContainerChild
+            Gtk.Label w32 = new Gtk.Label();
+            w29.Add(w32);
+            w28.Add(w29);
+            this.button52.Add(w28);
+            this.table1.Add(this.button52);
+            Gtk.Table.TableChild w36 = ((Gtk.Table.TableChild)(this.table1[this.button52]));
+            w36.TopAttach = ((uint)(1));
+            w36.BottomAttach = ((uint)(2));
+            this.vbox2.Add(this.table1);
+            Gtk.Box.BoxChild w37 = ((Gtk.Box.BoxChild)(this.vbox2[this.table1]));
+            w37.Position = 0;
+            // Container child vbox2.Gtk.Box+BoxChild
             this.combobox1 = Gtk.ComboBox.NewText();
             this.combobox1.AppendText(Mono.Unix.Catalog.GetString("2 px"));
             this.combobox1.AppendText(Mono.Unix.Catalog.GetString("4 px"));
@@ -54,128 +163,128 @@ namespace LongoMatch.Gui.Component {
             this.combobox1.Name = "combobox1";
             this.combobox1.Active = 2;
             this.vbox2.Add(this.combobox1);
-            Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(this.vbox2[this.combobox1]));
-            w1.Position = 0;
-            w1.Expand = false;
-            w1.Fill = false;
+            Gtk.Box.BoxChild w38 = ((Gtk.Box.BoxChild)(this.vbox2[this.combobox1]));
+            w38.Position = 1;
+            w38.Expand = false;
+            w38.Fill = false;
             // Container child vbox2.Gtk.Box+BoxChild
-            this.table1 = new Gtk.Table(((uint)(3)), ((uint)(2)), false);
-            this.table1.Name = "table1";
-            this.table1.RowSpacing = ((uint)(6));
-            this.table1.ColumnSpacing = ((uint)(6));
-            // Container child table1.Gtk.Table+TableChild
+            this.table2 = new Gtk.Table(((uint)(3)), ((uint)(2)), false);
+            this.table2.Name = "table2";
+            this.table2.RowSpacing = ((uint)(6));
+            this.table2.ColumnSpacing = ((uint)(6));
+            // Container child table2.Gtk.Table+TableChild
             this.bbutton = new Gtk.RadioButton("");
             this.bbutton.Name = "bbutton";
             this.bbutton.DrawIndicator = false;
             this.bbutton.UseUnderline = true;
             this.bbutton.FocusOnClick = false;
             this.bbutton.Group = new GLib.SList(System.IntPtr.Zero);
-            this.table1.Add(this.bbutton);
-            Gtk.Table.TableChild w2 = ((Gtk.Table.TableChild)(this.table1[this.bbutton]));
-            w2.LeftAttach = ((uint)(1));
-            w2.RightAttach = ((uint)(2));
-            w2.YOptions = ((Gtk.AttachOptions)(4));
-            // Container child table1.Gtk.Table+TableChild
+            this.table2.Add(this.bbutton);
+            Gtk.Table.TableChild w39 = ((Gtk.Table.TableChild)(this.table2[this.bbutton]));
+            w39.LeftAttach = ((uint)(1));
+            w39.RightAttach = ((uint)(2));
+            w39.YOptions = ((Gtk.AttachOptions)(4));
+            // Container child table2.Gtk.Table+TableChild
             this.blbutton = new Gtk.RadioButton("");
             this.blbutton.Name = "blbutton";
             this.blbutton.DrawIndicator = false;
             this.blbutton.UseUnderline = true;
             this.blbutton.FocusOnClick = false;
             this.blbutton.Group = this.bbutton.Group;
-            this.table1.Add(this.blbutton);
-            Gtk.Table.TableChild w3 = ((Gtk.Table.TableChild)(this.table1[this.blbutton]));
-            w3.TopAttach = ((uint)(1));
-            w3.BottomAttach = ((uint)(2));
-            w3.LeftAttach = ((uint)(1));
-            w3.RightAttach = ((uint)(2));
-            w3.YOptions = ((Gtk.AttachOptions)(4));
-            // Container child table1.Gtk.Table+TableChild
+            this.table2.Add(this.blbutton);
+            Gtk.Table.TableChild w40 = ((Gtk.Table.TableChild)(this.table2[this.blbutton]));
+            w40.TopAttach = ((uint)(1));
+            w40.BottomAttach = ((uint)(2));
+            w40.LeftAttach = ((uint)(1));
+            w40.RightAttach = ((uint)(2));
+            w40.YOptions = ((Gtk.AttachOptions)(4));
+            // Container child table2.Gtk.Table+TableChild
             this.gbutton = new Gtk.RadioButton("");
             this.gbutton.Name = "gbutton";
             this.gbutton.DrawIndicator = false;
             this.gbutton.UseUnderline = true;
             this.gbutton.FocusOnClick = false;
             this.gbutton.Group = this.bbutton.Group;
-            this.table1.Add(this.gbutton);
-            Gtk.Table.TableChild w4 = ((Gtk.Table.TableChild)(this.table1[this.gbutton]));
-            w4.TopAttach = ((uint)(2));
-            w4.BottomAttach = ((uint)(3));
-            w4.YOptions = ((Gtk.AttachOptions)(4));
-            // Container child table1.Gtk.Table+TableChild
+            this.table2.Add(this.gbutton);
+            Gtk.Table.TableChild w41 = ((Gtk.Table.TableChild)(this.table2[this.gbutton]));
+            w41.TopAttach = ((uint)(2));
+            w41.BottomAttach = ((uint)(3));
+            w41.YOptions = ((Gtk.AttachOptions)(4));
+            // Container child table2.Gtk.Table+TableChild
             this.rbutton = new Gtk.RadioButton("");
             this.rbutton.Name = "rbutton";
             this.rbutton.DrawIndicator = false;
             this.rbutton.UseUnderline = true;
             this.rbutton.FocusOnClick = false;
             this.rbutton.Group = this.bbutton.Group;
-            this.table1.Add(this.rbutton);
-            Gtk.Table.TableChild w5 = ((Gtk.Table.TableChild)(this.table1[this.rbutton]));
-            w5.TopAttach = ((uint)(1));
-            w5.BottomAttach = ((uint)(2));
-            w5.YOptions = ((Gtk.AttachOptions)(4));
-            // Container child table1.Gtk.Table+TableChild
+            this.table2.Add(this.rbutton);
+            Gtk.Table.TableChild w42 = ((Gtk.Table.TableChild)(this.table2[this.rbutton]));
+            w42.TopAttach = ((uint)(1));
+            w42.BottomAttach = ((uint)(2));
+            w42.YOptions = ((Gtk.AttachOptions)(4));
+            // Container child table2.Gtk.Table+TableChild
             this.wbutton = new Gtk.RadioButton("");
             this.wbutton.Name = "wbutton";
             this.wbutton.DrawIndicator = false;
             this.wbutton.UseUnderline = true;
             this.wbutton.FocusOnClick = false;
             this.wbutton.Group = this.bbutton.Group;
-            this.table1.Add(this.wbutton);
-            Gtk.Table.TableChild w6 = ((Gtk.Table.TableChild)(this.table1[this.wbutton]));
-            w6.YOptions = ((Gtk.AttachOptions)(4));
-            // Container child table1.Gtk.Table+TableChild
+            this.table2.Add(this.wbutton);
+            Gtk.Table.TableChild w43 = ((Gtk.Table.TableChild)(this.table2[this.wbutton]));
+            w43.YOptions = ((Gtk.AttachOptions)(4));
+            // Container child table2.Gtk.Table+TableChild
             this.ybutton = new Gtk.RadioButton("");
             this.ybutton.Name = "ybutton";
             this.ybutton.DrawIndicator = false;
             this.ybutton.UseUnderline = true;
             this.ybutton.FocusOnClick = false;
             this.ybutton.Group = this.bbutton.Group;
-            this.table1.Add(this.ybutton);
-            Gtk.Table.TableChild w7 = ((Gtk.Table.TableChild)(this.table1[this.ybutton]));
-            w7.TopAttach = ((uint)(2));
-            w7.BottomAttach = ((uint)(3));
-            w7.LeftAttach = ((uint)(1));
-            w7.RightAttach = ((uint)(2));
-            w7.YOptions = ((Gtk.AttachOptions)(4));
-            this.vbox2.Add(this.table1);
-            Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.vbox2[this.table1]));
-            w8.Position = 1;
-            w8.Expand = false;
-            w8.Fill = false;
+            this.table2.Add(this.ybutton);
+            Gtk.Table.TableChild w44 = ((Gtk.Table.TableChild)(this.table2[this.ybutton]));
+            w44.TopAttach = ((uint)(2));
+            w44.BottomAttach = ((uint)(3));
+            w44.LeftAttach = ((uint)(1));
+            w44.RightAttach = ((uint)(2));
+            w44.YOptions = ((Gtk.AttachOptions)(4));
+            this.vbox2.Add(this.table2);
+            Gtk.Box.BoxChild w45 = ((Gtk.Box.BoxChild)(this.vbox2[this.table2]));
+            w45.Position = 2;
+            w45.Expand = false;
+            w45.Fill = false;
             // Container child vbox2.Gtk.Box+BoxChild
             this.clearbutton = new Gtk.Button();
             this.clearbutton.CanFocus = true;
             this.clearbutton.Name = "clearbutton";
             this.clearbutton.UseUnderline = true;
             // Container child clearbutton.Gtk.Container+ContainerChild
-            Gtk.Alignment w9 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+            Gtk.Alignment w46 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
             // Container child GtkAlignment.Gtk.Container+ContainerChild
-            Gtk.HBox w10 = new Gtk.HBox();
-            w10.Spacing = 2;
+            Gtk.HBox w47 = new Gtk.HBox();
+            w47.Spacing = 2;
             // Container child GtkHBox.Gtk.Container+ContainerChild
-            Gtk.Image w11 = new Gtk.Image();
-            w11.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-clear", Gtk.IconSize.LargeToolbar, 24);
-            w10.Add(w11);
+            Gtk.Image w48 = new Gtk.Image();
+            w48.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-clear", Gtk.IconSize.LargeToolbar, 24);
+            w47.Add(w48);
             // Container child GtkHBox.Gtk.Container+ContainerChild
-            Gtk.Label w13 = new Gtk.Label();
-            w10.Add(w13);
-            w9.Add(w10);
-            this.clearbutton.Add(w9);
+            Gtk.Label w50 = new Gtk.Label();
+            w47.Add(w50);
+            w46.Add(w47);
+            this.clearbutton.Add(w46);
             this.vbox2.Add(this.clearbutton);
-            Gtk.Box.BoxChild w17 = ((Gtk.Box.BoxChild)(this.vbox2[this.clearbutton]));
-            w17.Position = 2;
-            w17.Expand = false;
-            w17.Fill = false;
+            Gtk.Box.BoxChild w54 = ((Gtk.Box.BoxChild)(this.vbox2[this.clearbutton]));
+            w54.Position = 3;
+            w54.Expand = false;
+            w54.Fill = false;
             // Container child vbox2.Gtk.Box+BoxChild
             this.label1 = new Gtk.Label();
             this.label1.Name = "label1";
             this.label1.LabelProp = Mono.Unix.Catalog.GetString("Draw-><b> D</b>\nClear-><b> C</b>\nHide-><b> S</b>\nShow-><b> S</b>\n");
             this.label1.UseMarkup = true;
             this.vbox2.Add(this.label1);
-            Gtk.Box.BoxChild w18 = ((Gtk.Box.BoxChild)(this.vbox2[this.label1]));
-            w18.Position = 3;
-            w18.Expand = false;
-            w18.Fill = false;
+            Gtk.Box.BoxChild w55 = ((Gtk.Box.BoxChild)(this.vbox2[this.label1]));
+            w55.Position = 4;
+            w55.Expand = false;
+            w55.Fill = false;
             this.Add(this.vbox2);
             if ((this.Child != null)) {
                 this.Child.ShowAll();
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.DrawingWidget.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.DrawingWidget.cs
new file mode 100644
index 0000000..a7ef8cb
--- /dev/null
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.DrawingWidget.cs
@@ -0,0 +1,50 @@
+// ------------------------------------------------------------------------------
+//  <autogenerated>
+//      This code was generated by a tool.
+//      
+// 
+//      Changes to this file may cause incorrect behavior and will be lost if 
+//      the code is regenerated.
+//  </autogenerated>
+// ------------------------------------------------------------------------------
+
+namespace LongoMatch.Gui.Component {
+    
+    
+    public partial class DrawingWidget {
+        
+        private Gtk.ScrolledWindow GtkScrolledWindow;
+        
+        private Gtk.DrawingArea drawingarea;
+        
+        protected virtual void Build() {
+            Stetic.Gui.Initialize(this);
+            // Widget LongoMatch.Gui.Component.DrawingWidget
+            Stetic.BinContainer.Attach(this);
+            this.Name = "LongoMatch.Gui.Component.DrawingWidget";
+            // Container child LongoMatch.Gui.Component.DrawingWidget.Gtk.Container+ContainerChild
+            this.GtkScrolledWindow = new Gtk.ScrolledWindow();
+            this.GtkScrolledWindow.Name = "GtkScrolledWindow";
+            this.GtkScrolledWindow.ShadowType = ((Gtk.ShadowType)(1));
+            // Container child GtkScrolledWindow.Gtk.Container+ContainerChild
+            Gtk.Viewport w1 = new Gtk.Viewport();
+            w1.ShadowType = ((Gtk.ShadowType)(0));
+            // Container child GtkViewport.Gtk.Container+ContainerChild
+            this.drawingarea = new Gtk.DrawingArea();
+            this.drawingarea.Events = ((Gdk.EventMask)(784));
+            this.drawingarea.Name = "drawingarea";
+            w1.Add(this.drawingarea);
+            this.GtkScrolledWindow.Add(w1);
+            this.Add(this.GtkScrolledWindow);
+            if ((this.Child != null)) {
+                this.Child.ShowAll();
+            }
+            this.Hide();
+            this.drawingarea.ExposeEvent += new Gtk.ExposeEventHandler(this.OnDrawingareaExposeEvent);
+            this.drawingarea.ButtonPressEvent += new Gtk.ButtonPressEventHandler(this.OnDrawingareaButtonPressEvent);
+            this.drawingarea.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler(this.OnDrawingareaButtonReleaseEvent);
+            this.drawingarea.MotionNotifyEvent += new Gtk.MotionNotifyEventHandler(this.OnDrawingareaMotionNotifyEvent);
+            this.drawingarea.SizeAllocated += new Gtk.SizeAllocatedHandler(this.OnDrawingareaSizeAllocated);
+        }
+    }
+}
diff --git a/LongoMatch/gtk-gui/gui.stetic b/LongoMatch/gtk-gui/gui.stetic
index d82fe19..c5f99d1 100644
--- a/LongoMatch/gtk-gui/gui.stetic
+++ b/LongoMatch/gtk-gui/gui.stetic
@@ -4053,7 +4053,7 @@ You can download it using this direct link:</property>
       </widget>
     </child>
   </widget>
-  <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.DrawingToolBox" design-size="67 313">
+  <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.DrawingToolBox" design-size="67 333">
     <property name="MemberName" />
     <property name="Visible">False</property>
     <child>
@@ -4061,6 +4061,103 @@ You can download it using this direct link:</property>
         <property name="MemberName" />
         <property name="Spacing">6</property>
         <child>
+          <widget class="Gtk.Table" id="table1">
+            <property name="MemberName" />
+            <property name="NRows">2</property>
+            <property name="NColumns">2</property>
+            <property name="RowSpacing">6</property>
+            <property name="ColumnSpacing">6</property>
+            <child>
+              <widget class="Gtk.Button" id="button49">
+                <property name="MemberName" />
+                <property name="CanFocus">True</property>
+                <property name="Type">TextAndIcon</property>
+                <property name="Icon">stock:stock_draw-line-45 Menu</property>
+                <property name="Label" translatable="yes" />
+                <property name="UseUnderline">True</property>
+              </widget>
+              <packing>
+                <property name="TopAttach">1</property>
+                <property name="BottomAttach">2</property>
+                <property name="LeftAttach">1</property>
+                <property name="RightAttach">2</property>
+                <property name="AutoSize">False</property>
+                <property name="XExpand">True</property>
+                <property name="XFill">True</property>
+                <property name="XShrink">False</property>
+                <property name="YExpand">True</property>
+                <property name="YFill">True</property>
+                <property name="YShrink">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="Gtk.Button" id="button50">
+                <property name="MemberName" />
+                <property name="CanFocus">True</property>
+                <property name="Type">TextAndIcon</property>
+                <property name="Icon">stock:stock_draw-line-ends-with-arrow Menu</property>
+                <property name="Label" translatable="yes" />
+                <property name="UseUnderline">True</property>
+              </widget>
+              <packing>
+                <property name="AutoSize">False</property>
+                <property name="XExpand">True</property>
+                <property name="XFill">True</property>
+                <property name="XShrink">False</property>
+                <property name="YExpand">True</property>
+                <property name="YFill">True</property>
+                <property name="YShrink">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="Gtk.Button" id="button51">
+                <property name="MemberName" />
+                <property name="CanFocus">True</property>
+                <property name="Type">TextAndIcon</property>
+                <property name="Icon">stock:stock_draw-rectangle-unfilled Menu</property>
+                <property name="Label" translatable="yes" />
+                <property name="UseUnderline">True</property>
+              </widget>
+              <packing>
+                <property name="LeftAttach">1</property>
+                <property name="RightAttach">2</property>
+                <property name="AutoSize">False</property>
+                <property name="XExpand">True</property>
+                <property name="XFill">True</property>
+                <property name="XShrink">False</property>
+                <property name="YExpand">True</property>
+                <property name="YFill">True</property>
+                <property name="YShrink">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="Gtk.Button" id="button52">
+                <property name="MemberName" />
+                <property name="CanFocus">True</property>
+                <property name="Type">TextAndIcon</property>
+                <property name="Icon">stock:stock_draw-ellipse-unfilled Menu</property>
+                <property name="Label" translatable="yes" />
+                <property name="UseUnderline">True</property>
+              </widget>
+              <packing>
+                <property name="TopAttach">1</property>
+                <property name="BottomAttach">2</property>
+                <property name="AutoSize">False</property>
+                <property name="XExpand">True</property>
+                <property name="XFill">True</property>
+                <property name="XShrink">False</property>
+                <property name="YExpand">True</property>
+                <property name="YFill">True</property>
+                <property name="YShrink">False</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="Position">0</property>
+            <property name="AutoSize">False</property>
+          </packing>
+        </child>
+        <child>
           <widget class="Gtk.ComboBox" id="combobox1">
             <property name="MemberName" />
             <property name="IsTextCombo">True</property>
@@ -4073,14 +4170,14 @@ You can download it using this direct link:</property>
             <signal name="Changed" handler="OnCombobox1Changed" />
           </widget>
           <packing>
-            <property name="Position">0</property>
+            <property name="Position">1</property>
             <property name="AutoSize">True</property>
             <property name="Expand">False</property>
             <property name="Fill">False</property>
           </packing>
         </child>
         <child>
-          <widget class="Gtk.Table" id="table1">
+          <widget class="Gtk.Table" id="table2">
             <property name="MemberName" />
             <property name="NRows">3</property>
             <property name="NColumns">2</property>
@@ -4234,7 +4331,7 @@ You can download it using this direct link:</property>
             </child>
           </widget>
           <packing>
-            <property name="Position">1</property>
+            <property name="Position">2</property>
             <property name="AutoSize">True</property>
             <property name="Expand">False</property>
             <property name="Fill">False</property>
@@ -4251,7 +4348,7 @@ You can download it using this direct link:</property>
             <signal name="Clicked" handler="OnClearbuttonClicked" />
           </widget>
           <packing>
-            <property name="Position">2</property>
+            <property name="Position">3</property>
             <property name="AutoSize">False</property>
             <property name="Expand">False</property>
             <property name="Fill">False</property>
@@ -4268,7 +4365,7 @@ Show-&gt;&lt;b&gt; S&lt;/b&gt;
             <property name="UseMarkup">True</property>
           </widget>
           <packing>
-            <property name="Position">3</property>
+            <property name="Position">4</property>
             <property name="AutoSize">True</property>
             <property name="Expand">False</property>
             <property name="Fill">False</property>
@@ -4440,4 +4537,32 @@ Show-&gt;&lt;b&gt; S&lt;/b&gt;
       </widget>
     </child>
   </widget>
+  <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.DrawingWidget" design-size="300 300">
+    <property name="MemberName" />
+    <property name="Visible">False</property>
+    <child>
+      <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow">
+        <property name="MemberName" />
+        <property name="ShadowType">In</property>
+        <child>
+          <widget class="Gtk.Viewport" id="GtkViewport">
+            <property name="MemberName" />
+            <property name="ShadowType">None</property>
+            <child>
+              <widget class="Gtk.DrawingArea" id="drawingarea">
+                <property name="MemberName" />
+                <property name="Events">ButtonMotionMask, ButtonPressMask, ButtonReleaseMask</property>
+                <property name="ShowScrollbars">True</property>
+                <signal name="ExposeEvent" handler="OnDrawingareaExposeEvent" />
+                <signal name="ButtonPressEvent" handler="OnDrawingareaButtonPressEvent" />
+                <signal name="ButtonReleaseEvent" handler="OnDrawingareaButtonReleaseEvent" />
+                <signal name="MotionNotifyEvent" handler="OnDrawingareaMotionNotifyEvent" />
+                <signal name="SizeAllocated" handler="OnDrawingareaSizeAllocated" />
+              </widget>
+            </child>
+          </widget>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </stetic-interface>
\ No newline at end of file
diff --git a/LongoMatch/gtk-gui/objects.xml b/LongoMatch/gtk-gui/objects.xml
index 8365497..bb29036 100644
--- a/LongoMatch/gtk-gui/objects.xml
+++ b/LongoMatch/gtk-gui/objects.xml
@@ -201,10 +201,6 @@
       </itemgroup>
     </signals>
   </object>
-  <object type="LongoMatch.Gui.Popup.TransparentDrawingArea" palette-category="General" allow-children="false" base-type="Gtk.Window">
-    <itemgroups />
-    <signals />
-  </object>
   <object type="LongoMatch.Gui.Component.PlaysListTreeWidget" palette-category="LongoMatch" allow-children="false" base-type="Gtk.Bin">
     <itemgroups />
     <signals>
@@ -237,4 +233,12 @@
       </itemgroup>
     </signals>
   </object>
+  <object type="LongoMatch.Gui.Component.DrawingWidget" palette-category="General" allow-children="false" base-type="Gtk.Bin">
+    <itemgroups />
+    <signals />
+  </object>
+  <object type="LongoMatch.Gui.Popup.TransparentDrawingArea" palette-category="General" allow-children="false" base-type="Gtk.Window">
+    <itemgroups />
+    <signals />
+  </object>
 </objects>
\ No newline at end of file



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]