[longomatch] Resize the drawing tool to size of the image



commit 61488c5d3c75c92c0bbd9ad3ecdd99ad1b9c21b8
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sat Oct 6 20:13:53 2012 +0200

    Resize the drawing tool to size of the image

 LongoMatch.GUI/Gui/Component/DrawingWidget.cs |    6 ++----
 LongoMatch.GUI/Gui/Dialog/DrawingTool.cs      |    4 ++++
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Component/DrawingWidget.cs b/LongoMatch.GUI/Gui/Component/DrawingWidget.cs
index 0e4ba50..57e8208 100644
--- a/LongoMatch.GUI/Gui/Component/DrawingWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/DrawingWidget.cs
@@ -84,10 +84,8 @@ namespace LongoMatch.Gui.Component
 					CairoHelper.SetSourcePixbuf(sourceCR,value,0,0);
 					sourceCR.Paint();
 				}
-				drawingarea.WidthRequest=sourceWidth;
-				drawingarea.HeightRequest=sourceHeight;
-				if(drawingarea.GdkWindow != null)
-					drawingarea.GdkWindow.Resize(sourceWidth,sourceHeight);
+				drawingarea.WidthRequest = sourceWidth;
+				drawingarea.HeightRequest = sourceHeight;
 				value.Dispose();
 				loaded = true;
 				QueueDraw();
diff --git a/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs b/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs
index ee129a6..2a06805 100644
--- a/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs
+++ b/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs
@@ -50,6 +50,10 @@ namespace LongoMatch.Gui.Dialog
 
 		public Pixbuf Image {
 			set {
+				Screen screen = Display.Default.DefaultScreen;
+				int width = Math.Min(screen.Width, value.Width + vbox2.Allocation.Width + 10);
+				int height = Math.Min(screen.Height, value.Height + 20);
+				this.Resize(width, height);
 				drawingwidget1.SourceImage = value;
 			}
 		}



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