]> O.S.I.I.S - jp/crow.git/commitdiff
divers
authorjpbruyere <jp.bruyere@hotmail.com>
Sun, 6 Mar 2016 21:48:20 +0000 (22:48 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Sun, 6 Mar 2016 21:49:34 +0000 (22:49 +0100)
GtkCrow/CrowContainer.cs
LinuxCrow/LinuxCrow.csproj [deleted file]
src/GraphicObjects/Container.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/ListBox.cs

index 9fd9a69c40dccb33fbef7a2ad933cf0e4314d84b..d404d6229482b9cc90720a24a3e003416e50e7c4 100644 (file)
@@ -80,161 +80,15 @@ namespace Crow
                }
                #endregion
 
-<<<<<<< 70bcdc77ff42c74fcd8e6e7dffd4eb6b16f24f39
-               public List<GraphicObject> GraphicObjects = new List<GraphicObject>();
-               public Color Background = Color.Transparent;
-
-               internal static OpenTKGameWindow currentWindow;
-
-               Rectangles _redrawClip = new Rectangles();//should find another way to access it from child
-               List<GraphicObject> _gobjsToRedraw = new List<GraphicObject>();
-
-               #region IGOLibHost implementation
-               public Rectangles clipping {
-                       get { return _redrawClip; }
-                       set { _redrawClip = value; }
-               }
-               public XCursor MouseCursor {
-                       set {
-//                             if (value == null) {
-//                                     Cursor = null;
-//                                     return;
-//                             }
-//                             Cursor = new MouseCursor
-//                                     ((int)value.Xhot, (int)value.Yhot, (int)value.Width, (int)value.Height,value.data);
-                       }
-               }
-               public List<GraphicObject> gobjsToRedraw {
-                       get { return _gobjsToRedraw; }
-                       set { _gobjsToRedraw = value; }
-               }
-               public void AddWidget(GraphicObject g)
-               {
-                       g.Parent = this;
-                       GraphicObjects.Insert (0, g);
-
-                       g.RegisterForLayouting (LayoutingType.Sizing);
-               }
-               public void DeleteWidget(GraphicObject g)
-               {
-                       g.Visible = false;//trick to ensure clip is added to refresh zone
-                       g.ClearBinding();
-                       GraphicObjects.Remove (g);
-               }
-               public void PutOnTop(GraphicObject g)
-               {
-                       if (GraphicObjects.IndexOf(g) > 0)
-                       {
-                               GraphicObjects.Remove(g);
-                               GraphicObjects.Insert(0, g);
-                               //g.registerClipRect ();
-                       }
-               }
-               public void Quit ()
-               {
-                       Gtk.Application.Quit ();
-               }
-
-               #region focus
-               GraphicObject _activeWidget;    //button is pressed on widget
-               GraphicObject _hoverWidget;             //mouse is over
-               GraphicObject _focusedWidget;   //has keyboard (or other perif) focus
-
-               public GraphicObject activeWidget
-               {
-                       get { return _activeWidget; }
-                       set
-                       {
-                               if (_activeWidget == value)
-                                       return;
-
-                               if (_activeWidget != null)
-                                       _activeWidget.IsActive = false;
-
-                               _activeWidget = value;
-
-                               if (_activeWidget != null)
-                                       _activeWidget.IsActive = true;
-                       }
-               }
-               public GraphicObject hoverWidget
-               {
-                       get { return _hoverWidget; }
-                       set {
-                               if (_hoverWidget == value)
-                                       return;
-                               _hoverWidget = value;
-                       }
-               }
-               public GraphicObject FocusedWidget {
-                       get { return _focusedWidget; }
-                       set {
-                               if (_focusedWidget == value)
-                                       return;
-                               if (_focusedWidget != null)
-                                       _focusedWidget.onUnfocused (this, null);
-                               _focusedWidget = value;
-                               if (_focusedWidget != null)
-                                       _focusedWidget.onFocused (this, null);
-                       }
-               }
-               #endregion
-
-               #endregion
-
-               /// <summary> Remove all Graphic objects from top container </summary>
-               public void ClearInterface()
-               {
-                       int i = 0;
-                       while (GraphicObjects.Count>0) {
-                               //TODO:parent is not reset to null because object will be added
-                               //to ObjectToRedraw list, and without parent, it fails
-                               GraphicObject g = GraphicObjects [i];
-                               g.Visible = false;
-                               g.ClearBinding ();
-                               GraphicObjects.RemoveAt (0);
-                       }
-               }
-               public GraphicObject FindByName (string nameToFind)
-               {
-                       foreach (GraphicObject w in GraphicObjects) {
-                               GraphicObject r = w.FindByName (nameToFind);
-                               if (r != null)
-                                       return r;
-                       }
-                       return null;
-               }
-               #region Events
-               //those events are raised only if mouse isn't in a graphic object
-               public event EventHandler<MouseWheelEventArgs> MouseWheelChanged;
-               public event EventHandler<MouseButtonEventArgs> MouseButtonUp;
-               public event EventHandler<MouseButtonEventArgs> MouseButtonDown;
-               public event EventHandler<MouseButtonEventArgs> MouseClick;
-               public event EventHandler<MouseMoveEventArgs> MouseMove;
-               public event EventHandler<KeyboardKeyEventArgs> KeyboardKeyDown;
-               #endregion
-
-               #region graphic contexte
-               Context ctx;
-               Surface surf;
-               byte[] bmp;
-
-=======
                protected void Quit (object sender, EventArgs e)
                {
                        Gtk.Application.Quit ();
                }
->>>>>>> CrowInterface object holding common functions, IGOLibHost removed
+
                void Win_Drawn (object o, Gtk.DrawnArgs args)
                {
                        if (CrowInterface.IsDirty) {
-                               byte[] tmp = new byte[4 * CrowInterface.DirtyRect.Width * CrowInterface.DirtyRect.Height];
-                               for (int y = 0; y < CrowInterface.DirtyRect.Height; y++) {
-                                       Array.Copy(CrowInterface.bmp,
-                                               ((CrowInterface.DirtyRect.Top + y) * CrowInterface.ClientRectangle.Width * 4) + CrowInterface.DirtyRect.Left * 4,
-                                               tmp, y * CrowInterface.DirtyRect.Width * 4, CrowInterface.DirtyRect.Width *4);
-                               }
-                               using (ImageSurface img = new ImageSurface (tmp, Format.Argb32, CrowInterface.DirtyRect.Width, CrowInterface.DirtyRect.Height, 4 * CrowInterface.DirtyRect.Width)) {
+                               using (ImageSurface img = new ImageSurface (CrowInterface.dirtyBmp, Format.Argb32, CrowInterface.DirtyRect.Width, CrowInterface.DirtyRect.Height, 4 * CrowInterface.DirtyRect.Width)) {
                                        args.Cr.SetSourceSurface (img, CrowInterface.DirtyRect.X, CrowInterface.DirtyRect.Y);
                                        args.Cr.Paint();
                                }
diff --git a/LinuxCrow/LinuxCrow.csproj b/LinuxCrow/LinuxCrow.csproj
deleted file mode 100644 (file)
index 116608b..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">Linux_x86</Platform>
-    <ProductVersion>8.0.30703</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{819640AC-C8B0-4E4A-9845-B24D5402F836}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>LinuxCrow</RootNamespace>
-    <AssemblyName>LinuxCrow</AssemblyName>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Linux_x86' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG;</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>false</ConsolePause>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Linux_x86' ">
-    <DebugType>full</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>false</ConsolePause>
-  </PropertyGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-</Project>
\ No newline at end of file
index cb6145a84c1dcf7b1cf4215220bc3c5352daf60d..58512a08046ce09111c7a487ab6003a12f4c239c 100644 (file)
@@ -3,6 +3,7 @@ using System.Xml.Serialization;
 using System.Reflection;
 using System.ComponentModel;
 using System.Linq;
+using System.Threading;
 
 namespace Crow
 {
@@ -50,11 +51,11 @@ namespace Crow
                     return;
 
                 Type t = Type.GetType("Crow." + subTree.Name);
-                GraphicObject go = (GraphicObject)Activator.CreateInstance(t);                                
+                               GraphicObject go = (GraphicObject)Activator.CreateInstance(t);
 
-                (go as IXmlSerializable).ReadXml(subTree);
-                
-                SetChild(go);
+                               (go as IXmlSerializable).ReadXml(subTree);
+
+                               SetChild(go);
 
                 subTree.Read();//closing tag
             }
index b8b2a38fbd49af55f333b93be3fe3e1307c53899..8b6ea18fd82d7733d592d6abb413255d583422de 100644 (file)
@@ -626,7 +626,8 @@ namespace Crow
                public virtual void RegisterClip(Rectangle clip){
                        if (CacheEnabled && bmp != null)
                                Clipping.AddRectangle (clip + ClientRectangle.Position);
-                       Parent.RegisterClip (clip + Slot.Position + ClientRectangle.Position);
+                       if (Parent != null)
+                               Parent.RegisterClip (clip + Slot.Position + ClientRectangle.Position);
                }
                public bool IsQueueForGraphicUpdate = false;
                /// <summary>
@@ -1516,7 +1517,6 @@ namespace Crow
                        #if DEBUG_LOAD
                        Debug.WriteLine ("ApplyStyle for " + this.ToString ());
                        #endif
-
                        using (StreamReader sr = new StreamReader (s)) {
                                while (!sr.EndOfStream) {
                                        string tmp = sr.ReadLine ();
@@ -1544,7 +1544,6 @@ namespace Crow
                                Style = stylePath;
                                applyStyle ();
                        }
-
                        while (reader.MoveToNextAttribute ()) {
                                if (reader.Name == "Style")
                                        continue;
index 2257e62df0eac848d0822410c347d564c89cfde2..b6e174859ee2c31d95a52b526d9b5749a4e0ea35 100644 (file)
@@ -149,10 +149,13 @@ namespace Crow
 
                        //reset size to fit in the dir of the stacking
                        //because _list total size is forced to approx size
-                       if (_gsList.Orientation == Orientation.Horizontal)
+                       if (_gsList.Orientation == Orientation.Horizontal) {
                                page.Width = -1;
-                       else
-                               page.Height = -1;                       
+                               page.Height = 0;
+                       } else {
+                               page.Height = -1;
+                               page.Width = 0;
+                       }
 
 
                        for (int i = (pageNum - 1) * itemPerPage; i < pageNum * itemPerPage; i++) {