From: Jean-Philippe Bruyère Date: Mon, 11 Sep 2017 16:03:35 +0000 (+0200) Subject: revert 65cf1452510c336fcd69f9922774389d6c3b1aee, to allow widget creation from code X-Git-Tag: 0.6.0~19^2~4 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=a83f4cd81b0a67045aa710f3e3c42323c51450b0;p=jp%2Fcrow.git revert 65cf1452510c336fcd69f9922774389d6c3b1aee, to allow widget creation from code --- diff --git a/Crow.OpenTK.nuspec b/Crow.OpenTK.nuspec index 21570980..eb3b1216 100644 --- a/Crow.OpenTK.nuspec +++ b/Crow.OpenTK.nuspec @@ -2,7 +2,7 @@ Crow.OpenTK - 0.5.4 + 0.5.5 C# Rapid Open Widget Toolkit JP Bruyere Grand Tetras Software @@ -27,6 +27,7 @@ Precompiled binaries of those libs are available at http://ftp.gnome.org/pub/GNO For more information, please visit https://jpbruyere.github.io/Crow/. + - Bug fix (#35) of 0.5.4 - embed Cairo bindings in Crow. - use of CairoRegion to handle clipping - IDisposable for GraphicObject diff --git a/Tests/CrowWindow.cs b/Tests/CrowWindow.cs index e66fa7b3..2934af23 100644 --- a/Tests/CrowWindow.cs +++ b/Tests/CrowWindow.cs @@ -63,7 +63,7 @@ namespace Crow ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMin", fpsMin)); } #endif - if (frameCpt % 20 == 0) { + if (frameCpt % 3 == 0) { ValueChanged.Raise (this, new ValueChangeEventArgs ("fps", _fps)); #if MEASURE_TIME foreach (PerformanceMeasure m in ifaceControl[0].PerfMeasures) diff --git a/src/CompilerServices/CompilerServices.cs b/src/CompilerServices/CompilerServices.cs index 752655f8..5409aa5e 100644 --- a/src/CompilerServices/CompilerServices.cs +++ b/src/CompilerServices/CompilerServices.cs @@ -76,7 +76,7 @@ namespace Crow internal static MethodInfo miDSChangeEmitHelper = typeof(Instantiator).GetMethod("dataSourceChangedEmitHelper", BindingFlags.Instance | BindingFlags.NonPublic); internal static MethodInfo miDSReverseBinding = typeof(Instantiator).GetMethod("dataSourceReverseBinding", BindingFlags.Static | BindingFlags.NonPublic); - internal static FieldInfo miSetCurIface = typeof(GraphicObject).GetField ("currentInterface", BindingFlags.Public | BindingFlags.Instance); + internal static FieldInfo miSetCurIface = typeof(GraphicObject).GetField ("currentInterface", BindingFlags.NonPublic | BindingFlags.Instance); internal static MethodInfo miFindByName = typeof (GraphicObject).GetMethod ("FindByName"); internal static MethodInfo miGetGObjItem = typeof(List).GetMethod("get_Item", new Type[] { typeof(Int32) }); internal static MethodInfo miLoadDefaultVals = typeof (GraphicObject).GetMethod ("loadDefaultValues"); diff --git a/src/CrowThread.cs b/src/CrowThread.cs index 823fe1a6..c3a4ba3b 100644 --- a/src/CrowThread.cs +++ b/src/CrowThread.cs @@ -41,15 +41,15 @@ namespace Crow thread = new Thread (start); thread.IsBackground = true; Host = host; - lock (Host.currentInterface.CrowThreads) - Host.currentInterface.CrowThreads.Add (this); + lock (Host.CurrentInterface.CrowThreads) + Host.CurrentInterface.CrowThreads.Add (this); } public void CheckState(){ if (thread.ThreadState != ThreadState.Stopped) return; Finished.Raise (Host, null); - lock (Host.currentInterface.CrowThreads) - Host.currentInterface.CrowThreads.Remove (this); + lock (Host.CurrentInterface.CrowThreads) + Host.CurrentInterface.CrowThreads.Remove (this); } public void Start() { thread.Start();} public void Cancel(){ @@ -57,8 +57,8 @@ namespace Crow cancelRequested = true; thread.Join (); } - lock (Host.currentInterface.CrowThreads) - Host.currentInterface.CrowThreads.Remove (this); + lock (Host.CurrentInterface.CrowThreads) + Host.CurrentInterface.CrowThreads.Remove (this); } } } diff --git a/src/GraphicObjects/ColorSelector.cs b/src/GraphicObjects/ColorSelector.cs index 596d332e..c9f3a198 100644 --- a/src/GraphicObjects/ColorSelector.cs +++ b/src/GraphicObjects/ColorSelector.cs @@ -43,7 +43,7 @@ namespace Crow public override void onMouseMove (object sender, MouseMoveEventArgs e) { base.onMouseMove (sender, e); - if (currentInterface.Mouse.LeftButton == ButtonState.Released) + if (CurrentInterface.Mouse.LeftButton == ButtonState.Released) return; updateMouseLocalPos (e.Position); } diff --git a/src/GraphicObjects/FileDialog.cs b/src/GraphicObjects/FileDialog.cs index 47a6fb54..8182e021 100644 --- a/src/GraphicObjects/FileDialog.cs +++ b/src/GraphicObjects/FileDialog.cs @@ -117,11 +117,11 @@ namespace Crow CurrentDirectory = SelectedDirectory; else { OkClicked.Raise (this, null); - unloadDialog ((sender as GraphicObject).currentInterface); + unloadDialog ((sender as GraphicObject).CurrentInterface); } } void onCancel(object sender, MouseButtonEventArgs e){ - unloadDialog ((sender as GraphicObject).currentInterface); + unloadDialog ((sender as GraphicObject).CurrentInterface); } void unloadDialog(Interface host){ host.DeleteWidget (this); diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs index 77f1cb1f..cecdaffd 100644 --- a/src/GraphicObjects/GenericStack.cs +++ b/src/GraphicObjects/GenericStack.cs @@ -127,7 +127,7 @@ namespace Crow //if no layouting remains in queue for item, registre for redraw if (RegisteredLayoutings == LayoutingType.None && IsDirty) - currentInterface.EnqueueForRepaint (this); + CurrentInterface.EnqueueForRepaint (this); return true; } diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 7b9f0c56..0957f8ac 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -91,7 +91,20 @@ namespace Crow internal static ulong currentUid = 0; internal ulong uid = 0; - public Interface currentInterface = null; + Interface currentInterface = null; + + [XmlIgnore]public Interface CurrentInterface { + get { + if (currentInterface == null) { + currentInterface = Interface.CurrentInterface; + Initialize (); + } + return currentInterface; + } + set { + currentInterface = value; + } + } public Region Clipping; @@ -107,12 +120,23 @@ namespace Crow #region CTOR public GraphicObject () { + Clipping = new Region (); #if DEBUG uid = currentUid; currentUid++; #endif } #endregion + internal bool initialized = false; + /// + /// Initialize this Graphic object instance by setting style and default values and loading template if required + /// + public virtual void Initialize(){ + if (currentInterface == null) + currentInterface = Interface.CurrentInterface; + loadDefaultValues (); + initialized = true; + } #region private fields LayoutingType registeredLayoutings = LayoutingType.All; ILayoutable logicalParent; @@ -677,8 +701,6 @@ namespace Crow Debug.WriteLine ("LoadDefValues for " + this.ToString ()); #endif - Clipping = new Region (); - Type thisType = this.GetType (); if (!string.IsNullOrEmpty (Style)) { @@ -910,7 +932,7 @@ namespace Crow if (Width.IsFit || Height.IsFit) RegisterForLayouting (LayoutingType.Sizing); else if (RegisteredLayoutings == LayoutingType.None) - currentInterface.EnqueueForRepaint (this); + CurrentInterface.EnqueueForRepaint (this); } /// query an update of the content, a redraw [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -921,7 +943,7 @@ namespace Crow #endif IsDirty = true; if (RegisteredLayoutings == LayoutingType.None) - currentInterface.EnqueueForRepaint (this); + CurrentInterface.EnqueueForRepaint (this); } #endregion @@ -933,12 +955,13 @@ namespace Crow contentSize.Width + 2 * Margin: contentSize.Height + 2 * Margin; } /// By default in groups, LayoutingType.ArrangeChildren is reset - public virtual void ChildrenLayoutingConstraints(ref LayoutingType layoutType){} + public virtual void ChildrenLayoutingConstraints(ref LayoutingType layoutType){ + } public virtual bool ArrangeChildren { get { return false; } } public virtual void RegisterForLayouting(LayoutingType layoutType){ if (Parent == null) return; - lock (currentInterface.LayoutMutex) { + lock (CurrentInterface.LayoutMutex) { //prevent queueing same LayoutingType for this layoutType &= (~RegisteredLayoutings); @@ -957,20 +980,23 @@ namespace Crow if (Parent is GraphicObject) (Parent as GraphicObject).ChildrenLayoutingConstraints (ref layoutType); +// //prevent queueing same LayoutingType for this +// layoutType &= (~RegisteredLayoutings); + if (layoutType == LayoutingType.None) return; //enqueue LQI LayoutingTypes separately if (layoutType.HasFlag (LayoutingType.Width)) - currentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Width, this)); + CurrentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Width, this)); if (layoutType.HasFlag (LayoutingType.Height)) - currentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Height, this)); + CurrentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Height, this)); if (layoutType.HasFlag (LayoutingType.X)) - currentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.X, this)); + CurrentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.X, this)); if (layoutType.HasFlag (LayoutingType.Y)) - currentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Y, this)); + CurrentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Y, this)); if (layoutType.HasFlag (LayoutingType.ArrangeChildren)) - currentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.ArrangeChildren, this)); + CurrentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.ArrangeChildren, this)); } } @@ -1143,7 +1169,7 @@ namespace Crow //if no layouting remains in queue for item, registre for redraw if (this.registeredLayoutings == LayoutingType.None && IsDirty) - currentInterface.EnqueueForRepaint (this); + CurrentInterface.EnqueueForRepaint (this); return true; } @@ -1276,8 +1302,8 @@ namespace Crow } public virtual void checkHoverWidget(MouseMoveEventArgs e) { - if (currentInterface.HoverWidget != this) { - currentInterface.HoverWidget = this; + if (CurrentInterface.HoverWidget != this) { + CurrentInterface.HoverWidget = this; onMouseEnter (this, e); } @@ -1293,19 +1319,19 @@ namespace Crow MouseMove.Raise (this, e); } public virtual void onMouseDown(object sender, MouseButtonEventArgs e){ - if (currentInterface.eligibleForDoubleClick == this && currentInterface.clickTimer.ElapsedMilliseconds < Interface.DoubleClick) + if (CurrentInterface.eligibleForDoubleClick == this && CurrentInterface.clickTimer.ElapsedMilliseconds < Interface.DoubleClick) onMouseDoubleClick (this, e); else currentInterface.clickTimer.Restart(); - currentInterface.eligibleForDoubleClick = null; + CurrentInterface.eligibleForDoubleClick = null; - if (currentInterface.ActiveWidget == null) - currentInterface.ActiveWidget = this; + if (CurrentInterface.ActiveWidget == null) + CurrentInterface.ActiveWidget = this; if (this.Focusable && !Interface.FocusOnHover) { BubblingMouseButtonEventArg be = e as BubblingMouseButtonEventArg; if (be.Focused == null) { be.Focused = this; - currentInterface.FocusedWidget = this; + CurrentInterface.FocusedWidget = this; } } //bubble event to the top @@ -1324,8 +1350,8 @@ namespace Crow MouseUp.Raise (this, e); if (MouseIsIn (e.Position) && IsActive) { - if (currentInterface.clickTimer.ElapsedMilliseconds < Interface.DoubleClick) - currentInterface.eligibleForDoubleClick = this; + if (CurrentInterface.clickTimer.ElapsedMilliseconds < Interface.DoubleClick) + CurrentInterface.eligibleForDoubleClick = this; onMouseClick (this, e); } } diff --git a/src/GraphicObjects/Grid.cs b/src/GraphicObjects/Grid.cs index b2a13150..3d1847a2 100644 --- a/src/GraphicObjects/Grid.cs +++ b/src/GraphicObjects/Grid.cs @@ -161,7 +161,7 @@ namespace Crow //if no layouting remains in queue for item, registre for redraw if (RegisteredLayoutings == LayoutingType.None && IsDirty) - currentInterface.EnqueueForRepaint (this); + CurrentInterface.EnqueueForRepaint (this); return true; } diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index 917087cc..e4e9ba20 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -73,9 +73,14 @@ namespace Crow public virtual void RemoveChild(GraphicObject child) { child.LayoutChanged -= OnChildLayoutChanges; + //check if HoverWidget is removed from Tree + if (CurrentInterface.HoverWidget != null) { + if (this.Contains (CurrentInterface.HoverWidget)) + CurrentInterface.HoverWidget = null; + } lock (children) - Children.Remove(child); + Children.Remove(child); child.Dispose (); if (child == largestChild && Width == Measure.Fit) @@ -344,8 +349,8 @@ namespace Crow #region Mouse handling public override void checkHoverWidget (MouseMoveEventArgs e) { - if (currentInterface.HoverWidget != this) { - currentInterface.HoverWidget = this; + if (CurrentInterface.HoverWidget != this) { + CurrentInterface.HoverWidget = this; onMouseEnter (this, e); } for (int i = Children.Count - 1; i >= 0; i--) { diff --git a/src/GraphicObjects/Image.cs b/src/GraphicObjects/Image.cs index f2d540be..6a4c590d 100644 --- a/src/GraphicObjects/Image.cs +++ b/src/GraphicObjects/Image.cs @@ -79,7 +79,7 @@ namespace Crow if (string.IsNullOrEmpty(value)) Picture = null; else { - lock(currentInterface.LayoutMutex){ + lock(CurrentInterface.LayoutMutex){ LoadImage (value); } } diff --git a/src/GraphicObjects/Label.cs b/src/GraphicObjects/Label.cs index 7a802bda..64ee9688 100644 --- a/src/GraphicObjects/Label.cs +++ b/src/GraphicObjects/Label.cs @@ -686,12 +686,12 @@ namespace Crow { base.onMouseEnter (sender, e); if (Selectable) - currentInterface.MouseCursor = XCursor.Text; + CurrentInterface.MouseCursor = XCursor.Text; } public override void onMouseLeave (object sender, MouseMoveEventArgs e) { base.onMouseLeave (sender, e); - currentInterface.MouseCursor = XCursor.Default; + CurrentInterface.MouseCursor = XCursor.Default; } protected override void onFocused (object sender, EventArgs e) { diff --git a/src/GraphicObjects/MessageBox.cs b/src/GraphicObjects/MessageBox.cs index 8c8380ef..d8ce1dae 100644 --- a/src/GraphicObjects/MessageBox.cs +++ b/src/GraphicObjects/MessageBox.cs @@ -134,8 +134,8 @@ namespace Crow public static MessageBox Show (Type msgBoxType, string message, string okMsg = "", string cancelMsg = ""){ lock (Interface.CurrentInterface.UpdateMutex) { MessageBox mb = new MessageBox (); - mb.loadDefaultValues (); - mb.currentInterface.AddWidget (mb); + mb.Initialize (); + mb.CurrentInterface.AddWidget (mb); mb.MsgType = msgBoxType; mb.Message = message; if (!string.IsNullOrEmpty(okMsg)) diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs index d6e36346..72a3fa8d 100644 --- a/src/GraphicObjects/Popper.cs +++ b/src/GraphicObjects/Popper.cs @@ -204,8 +204,8 @@ namespace Crow } public override void checkHoverWidget (MouseMoveEventArgs e) { - if (currentInterface.HoverWidget != this) { - currentInterface.HoverWidget = this; + if (CurrentInterface.HoverWidget != this) { + CurrentInterface.HoverWidget = this; onMouseEnter (this, e); } if (Content != null){ @@ -225,10 +225,10 @@ namespace Crow if (Content != null) { Content.Visible = true; if (Content.Parent == null) - currentInterface.AddWidget (Content, true); + CurrentInterface.AddWidget (Content, true); if (Content.LogicalParent != this) Content.LogicalParent = this; - currentInterface.PutOnTop (Content, true); + CurrentInterface.PutOnTop (Content, true); _content_LayoutChanged (this, new LayoutingEventArgs (LayoutingType.Sizing)); } Popped.Raise (this, e); diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs index 077f732f..c40bceb4 100644 --- a/src/GraphicObjects/PrivateContainer.cs +++ b/src/GraphicObjects/PrivateContainer.cs @@ -54,6 +54,10 @@ namespace Crow if (child != null) { //check if HoverWidget is removed from Tree + if (CurrentInterface.HoverWidget != null) { + if (this.Contains (CurrentInterface.HoverWidget)) + CurrentInterface.HoverWidget = null; + } contentSize = new Size (0, 0); child.LayoutChanged -= OnChildLayoutChanges; child.Dispose (); diff --git a/src/GraphicObjects/ScrollingObject.cs b/src/GraphicObjects/ScrollingObject.cs index 42acdbf9..09558984 100644 --- a/src/GraphicObjects/ScrollingObject.cs +++ b/src/GraphicObjects/ScrollingObject.cs @@ -146,7 +146,7 @@ namespace Crow public override void onMouseWheel (object sender, MouseWheelEventArgs e) { base.onMouseWheel (sender, e); - if (currentInterface.Keyboard.IsKeyDown (Key.ShiftLeft)) + if (CurrentInterface.Keyboard.IsKeyDown (Key.ShiftLeft)) ScrollX += e.Delta * MouseWheelSpeed; else ScrollY -= e.Delta * MouseWheelSpeed; diff --git a/src/GraphicObjects/ScrollingTextBox.cs b/src/GraphicObjects/ScrollingTextBox.cs index c409d022..a435f9ee 100644 --- a/src/GraphicObjects/ScrollingTextBox.cs +++ b/src/GraphicObjects/ScrollingTextBox.cs @@ -464,12 +464,12 @@ namespace Crow public override void onMouseEnter (object sender, MouseMoveEventArgs e) { base.onMouseEnter (sender, e); - currentInterface.MouseCursor = XCursor.Text; + CurrentInterface.MouseCursor = XCursor.Text; } public override void onMouseLeave (object sender, MouseMoveEventArgs e) { base.onMouseLeave (sender, e); - currentInterface.MouseCursor = XCursor.Default; + CurrentInterface.MouseCursor = XCursor.Default; } protected override void onFocused (object sender, EventArgs e) { @@ -555,7 +555,7 @@ namespace Crow if (!MoveRight ()) return; }else if (e.Shift) - currentInterface.Clipboard = this.SelectedText; + CurrentInterface.Clipboard = this.SelectedText; this.DeleteChar (); break; case Key.Enter: @@ -601,9 +601,9 @@ namespace Crow break; case Key.Insert: if (e.Shift) - this.Insert (currentInterface.Clipboard); + this.Insert (CurrentInterface.Clipboard); else if (e.Control && !selectionIsEmpty) - currentInterface.Clipboard = this.SelectedText; + CurrentInterface.Clipboard = this.SelectedText; break; case Key.Left: if (e.Shift) { diff --git a/src/GraphicObjects/Splitter.cs b/src/GraphicObjects/Splitter.cs index 503e1eca..2f5dd15b 100644 --- a/src/GraphicObjects/Splitter.cs +++ b/src/GraphicObjects/Splitter.cs @@ -86,14 +86,14 @@ namespace Crow { base.onMouseEnter (sender, e); if ((Parent as GenericStack).Orientation == Orientation.Horizontal) - currentInterface.MouseCursor = XCursor.H; + CurrentInterface.MouseCursor = XCursor.H; else - currentInterface.MouseCursor = XCursor.V; + CurrentInterface.MouseCursor = XCursor.V; } public override void onMouseLeave (object sender, MouseMoveEventArgs e) { base.onMouseLeave (sender, e); - currentInterface.MouseCursor = XCursor.Default; + CurrentInterface.MouseCursor = XCursor.Default; } public override void onMouseDown (object sender, MouseButtonEventArgs e) { diff --git a/src/GraphicObjects/TabView.cs b/src/GraphicObjects/TabView.cs index c0c07fc7..ecf38f10 100644 --- a/src/GraphicObjects/TabView.cs +++ b/src/GraphicObjects/TabView.cs @@ -139,7 +139,7 @@ namespace Crow //if no layouting remains in queue for item, registre for redraw if (RegisteredLayoutings == LayoutingType.None && IsDirty) - currentInterface.EnqueueForRepaint (this); + CurrentInterface.EnqueueForRepaint (this); return true; } @@ -177,8 +177,8 @@ namespace Crow #region Mouse handling public override void checkHoverWidget (MouseMoveEventArgs e) { - if (currentInterface.HoverWidget != this) { - currentInterface.HoverWidget = this; + if (CurrentInterface.HoverWidget != this) { + CurrentInterface.HoverWidget = this; onMouseEnter (this, e); } diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs index ba580dae..c4ef5788 100644 --- a/src/GraphicObjects/TemplatedControl.cs +++ b/src/GraphicObjects/TemplatedControl.cs @@ -62,7 +62,7 @@ namespace Crow if (string.IsNullOrEmpty(_template)) loadTemplate (); else - loadTemplate (currentInterface.Load (_template)); + loadTemplate (CurrentInterface.Load (_template)); } } [XmlAttributeAttribute()][DefaultValue("Templated Control")] @@ -76,6 +76,11 @@ namespace Crow } } #region GraphicObject overrides + public override void Initialize () + { + loadTemplate (); + base.Initialize (); + } public override GraphicObject FindByName (string nameToFind) { //prevent name searching in template @@ -108,7 +113,7 @@ namespace Crow if (template == null) { if (!Interface.DefaultTemplates.ContainsKey (this.GetType ().FullName)) throw new Exception (string.Format ("No default template found for '{0}'", this.GetType ().FullName)); - this.SetChild (currentInterface.Load (Interface.DefaultTemplates[this.GetType ().FullName])); + this.SetChild (CurrentInterface.Load (Interface.DefaultTemplates[this.GetType ().FullName])); }else this.SetChild (template); } diff --git a/src/GraphicObjects/TemplatedGroup.cs b/src/GraphicObjects/TemplatedGroup.cs index 1cbc4935..60f18994 100644 --- a/src/GraphicObjects/TemplatedGroup.cs +++ b/src/GraphicObjects/TemplatedGroup.cs @@ -159,7 +159,7 @@ namespace Crow NotifyValueChanged ("Data", data); - lock (currentInterface.LayoutMutex) + lock (CurrentInterface.LayoutMutex) ClearItems (); if (data == null) @@ -298,8 +298,8 @@ namespace Crow itemPerPage = int.MaxValue; } else if (typeof(GenericStack).IsAssignableFrom (items.GetType ())) { GenericStack gs = new GenericStack (); - gs.currentInterface = items.currentInterface; - gs.loadDefaultValues (); + gs.CurrentInterface = items.CurrentInterface; + gs.Initialize (); gs.Orientation = (items as GenericStack).Orientation; gs.Width = items.Width; gs.Height = items.Height; @@ -327,7 +327,7 @@ namespace Crow if (page == items) return; - lock (currentInterface.LayoutMutex) + lock (CurrentInterface.LayoutMutex) items.AddChild (page); #if DEBUG_LOAD @@ -380,8 +380,8 @@ namespace Crow iTemp = ItemTemplates ["default"]; } - lock (currentInterface.LayoutMutex) { - g = iTemp.CreateInstance(currentInterface); + lock (CurrentInterface.LayoutMutex) { + g = iTemp.CreateInstance(CurrentInterface); page.AddChild (g); //g.LogicalParent = this; registerItemClick (g); diff --git a/src/GraphicObjects/TextBox.cs b/src/GraphicObjects/TextBox.cs index 5e2d55cb..0cbee9f8 100644 --- a/src/GraphicObjects/TextBox.cs +++ b/src/GraphicObjects/TextBox.cs @@ -85,7 +85,7 @@ namespace Crow if (!MoveRight ()) return; }else if (e.Shift) - currentInterface.Clipboard = this.SelectedText; + CurrentInterface.Clipboard = this.SelectedText; this.DeleteChar (); break; case Key.Enter: @@ -134,9 +134,9 @@ namespace Crow break; case Key.Insert: if (e.Shift) - this.Insert (currentInterface.Clipboard); + this.Insert (CurrentInterface.Clipboard); else if (e.Control && !selectionIsEmpty) - currentInterface.Clipboard = this.SelectedText; + CurrentInterface.Clipboard = this.SelectedText; break; case Key.Left: if (e.Shift) { diff --git a/src/GraphicObjects/Window.cs b/src/GraphicObjects/Window.cs index 176e8d90..7ea4db75 100644 --- a/src/GraphicObjects/Window.cs +++ b/src/GraphicObjects/Window.cs @@ -152,7 +152,7 @@ namespace Crow alwaysOnTop = value; if (alwaysOnTop && Parent != null) - currentInterface.PutOnTop (this); + CurrentInterface.PutOnTop (this); NotifyValueChanged ("AlwaysOnTop", alwaysOnTop); } @@ -178,11 +178,11 @@ namespace Crow { base.onMouseMove (sender, e); - Interface otkgw = currentInterface; + Interface otkgw = CurrentInterface; if (!hoverBorder) { currentDirection = Direction.None; - currentInterface.MouseCursor = XCursor.Default; + CurrentInterface.MouseCursor = XCursor.Default; return; } @@ -323,7 +323,7 @@ namespace Crow #endregion protected void onMaximized (object sender, EventArgs e){ - lock (currentInterface.LayoutMutex) { + lock (CurrentInterface.LayoutMutex) { if (!IsMinimized) savedBounds = this.LastPaintedSlot; this.Left = this.Top = 0; @@ -342,7 +342,7 @@ namespace Crow } protected void onUnmaximized (object sender, EventArgs e){ - lock (currentInterface.LayoutMutex) { + lock (CurrentInterface.LayoutMutex) { this.Left = savedBounds.Left; this.Top = savedBounds.Top; this.Width = savedBounds.Width; @@ -357,7 +357,7 @@ namespace Crow Unmaximized.Raise (sender, e); } protected void onMinimized (object sender, EventArgs e){ - lock (currentInterface.LayoutMutex) { + lock (CurrentInterface.LayoutMutex) { if (IsNormal) savedBounds = this.LastPaintedSlot; Width = 200; @@ -375,7 +375,7 @@ namespace Crow { hoverBorder = false; currentDirection = Direction.None; - currentInterface.MouseCursor = XCursor.Default; + CurrentInterface.MouseCursor = XCursor.Default; } protected void onBorderMouseEnter (object sender, MouseMoveEventArgs e) { @@ -385,7 +385,7 @@ namespace Crow protected void butQuitPress (object sender, MouseButtonEventArgs e) { - currentInterface.MouseCursor = XCursor.Default; + CurrentInterface.MouseCursor = XCursor.Default; close (); } diff --git a/src/GraphicObjects/Wrapper.cs b/src/GraphicObjects/Wrapper.cs index 22410919..8b282ebb 100644 --- a/src/GraphicObjects/Wrapper.cs +++ b/src/GraphicObjects/Wrapper.cs @@ -189,7 +189,7 @@ namespace Crow //if no layouting remains in queue for item, registre for redraw if (RegisteredLayoutings == LayoutingType.None && IsDirty) - currentInterface.EnqueueForRepaint (this); + CurrentInterface.EnqueueForRepaint (this); return true; } diff --git a/src/LayoutingQueueItem.cs b/src/LayoutingQueueItem.cs index 47807a99..7f272d98 100644 --- a/src/LayoutingQueueItem.cs +++ b/src/LayoutingQueueItem.cs @@ -116,7 +116,7 @@ namespace Crow #endif if (LayoutingTries < Interface.MaxLayoutingTries) { Layoutable.RegisteredLayoutings |= LayoutType; - (Layoutable as GraphicObject).currentInterface.LayoutingQueue.Enqueue (this); + (Layoutable as GraphicObject).CurrentInterface.LayoutingQueue.Enqueue (this); } else if (DiscardCount < Interface.MaxDiscardCount) { #if DEBUG_LAYOUTING Debug.WriteLine ("\t\tDiscarded"); @@ -124,7 +124,7 @@ namespace Crow LayoutingTries = 0; DiscardCount++; Layoutable.RegisteredLayoutings |= LayoutType; - (Layoutable as GraphicObject).currentInterface.DiscardQueue.Enqueue (this); + (Layoutable as GraphicObject).CurrentInterface.DiscardQueue.Enqueue (this); } #if DEBUG_LAYOUTING else