From: jpbruyere Date: Sun, 6 Mar 2016 21:48:20 +0000 (+0100) Subject: divers X-Git-Tag: v0.4~91 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=bf1c5457f87dbe1a30693f18c1599bd3fd1dd860;p=jp%2Fcrow.git divers --- diff --git a/GtkCrow/CrowContainer.cs b/GtkCrow/CrowContainer.cs index 9fd9a69c..d404d622 100644 --- a/GtkCrow/CrowContainer.cs +++ b/GtkCrow/CrowContainer.cs @@ -80,161 +80,15 @@ namespace Crow } #endregion -<<<<<<< 70bcdc77ff42c74fcd8e6e7dffd4eb6b16f24f39 - public List GraphicObjects = new List(); - public Color Background = Color.Transparent; - - internal static OpenTKGameWindow currentWindow; - - Rectangles _redrawClip = new Rectangles();//should find another way to access it from child - List _gobjsToRedraw = new List(); - - #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 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 - - /// Remove all Graphic objects from top container - 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 MouseWheelChanged; - public event EventHandler MouseButtonUp; - public event EventHandler MouseButtonDown; - public event EventHandler MouseClick; - public event EventHandler MouseMove; - public event EventHandler 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 index 116608be..00000000 --- a/LinuxCrow/LinuxCrow.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - - Debug - Linux_x86 - 8.0.30703 - 2.0 - {819640AC-C8B0-4E4A-9845-B24D5402F836} - Exe - LinuxCrow - LinuxCrow - v4.5 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - - - full - true - bin\Release - prompt - 4 - false - - - \ No newline at end of file diff --git a/src/GraphicObjects/Container.cs b/src/GraphicObjects/Container.cs index cb6145a8..58512a08 100644 --- a/src/GraphicObjects/Container.cs +++ b/src/GraphicObjects/Container.cs @@ -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 } diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index b8b2a38f..8b6ea18f 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -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; /// @@ -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; diff --git a/src/GraphicObjects/ListBox.cs b/src/GraphicObjects/ListBox.cs index 2257e62d..b6e17485 100644 --- a/src/GraphicObjects/ListBox.cs +++ b/src/GraphicObjects/ListBox.cs @@ -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++) {