From: Jean-Philippe Bruyère Date: Fri, 23 Feb 2018 12:25:37 +0000 (+0100) Subject: rename CurrentInterface to IFace X-Git-Tag: 0.7.3~4^2~43 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=1293bc896bdbc6819999d17bda8286a6e1a792b0;p=jp%2Fcrow.git rename CurrentInterface to IFace --- diff --git a/CrowIDE/src/ImlVisualEditor.cs b/CrowIDE/src/ImlVisualEditor.cs index cf799cc7..9e7aae39 100644 --- a/CrowIDE/src/ImlVisualEditor.cs +++ b/CrowIDE/src/ImlVisualEditor.cs @@ -198,7 +198,7 @@ namespace CrowIDE isDirty = imlVE.IsDirty; if (isDirty) { - lock (CurrentInterface.UpdateMutex) + lock (IFace.UpdateMutex) RegisterForRedraw (); } diff --git a/Tests/BasicTests.cs b/Tests/BasicTests.cs index 58131270..66ee3d0a 100644 --- a/Tests/BasicTests.cs +++ b/Tests/BasicTests.cs @@ -271,8 +271,8 @@ namespace Tests return; //tv.AddChild (new TabItem (CurrentInterface) { Caption = "NewTab" }); lock (CurrentInterface.UpdateMutex) { - tv.AddChild (Crow.IML.Instantiator.CreateFromImlFragment - (@"").CreateInstance (CurrentInterface)); + tv.AddChild (CurrentInterface.LoadIMLFragment + (@"")); } } [STAThread] diff --git a/src/CompilerServices/CompilerServices.cs b/src/CompilerServices/CompilerServices.cs index eb8f2ecf..955a0d69 100644 --- a/src/CompilerServices/CompilerServices.cs +++ b/src/CompilerServices/CompilerServices.cs @@ -77,7 +77,7 @@ namespace Crow.IML 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 ("IFace", BindingFlags.Public | 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 c3a4ba3b..a1b4c38e 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.IFace.CrowThreads) + Host.IFace.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.IFace.CrowThreads) + Host.IFace.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.IFace.CrowThreads) + Host.IFace.CrowThreads.Remove (this); } } } diff --git a/src/GraphicObjects/ColorSelector.cs b/src/GraphicObjects/ColorSelector.cs index 5b32fc95..e2d6cb6a 100644 --- a/src/GraphicObjects/ColorSelector.cs +++ b/src/GraphicObjects/ColorSelector.cs @@ -47,7 +47,7 @@ namespace Crow public override void onMouseMove (object sender, MouseMoveEventArgs e) { base.onMouseMove (sender, e); - if (CurrentInterface.Mouse.LeftButton == ButtonState.Released) + if (IFace.Mouse.LeftButton == ButtonState.Released) return; updateMouseLocalPos (e.Position); } diff --git a/src/GraphicObjects/Docker.cs b/src/GraphicObjects/Docker.cs index d34e5ba7..bb816dd9 100644 --- a/src/GraphicObjects/Docker.cs +++ b/src/GraphicObjects/Docker.cs @@ -38,9 +38,9 @@ namespace Crow } public Docker () : base () { - instStack = Instantiator.CreateFromImlFragment(CurrentInterface, @""); - instSplit = Instantiator.CreateFromImlFragment(CurrentInterface, @""); - instSpacer = Instantiator.CreateFromImlFragment(CurrentInterface, @""); + instStack = IFace.CreateITorFromIMLFragment (@""); + instSplit = IFace.CreateITorFromIMLFragment (@""); + instSpacer = IFace.CreateITorFromIMLFragment (@""); } #endregion @@ -85,9 +85,9 @@ namespace Crow public override void onMouseMove (object sender, MouseMoveEventArgs e) { - if (CurrentInterface.DragAndDropOperation?.DragSource as DockWindow != null) { - DockWindow dw = CurrentInterface.DragAndDropOperation?.DragSource as DockWindow; - if (CurrentInterface.DragAndDropOperation.DragSource.Parent == this && !dw.IsDocked) + if (IFace.DragAndDropOperation?.DragSource as DockWindow != null) { + DockWindow dw = IFace.DragAndDropOperation?.DragSource as DockWindow; + if (IFace.DragAndDropOperation.DragSource.Parent == this && !dw.IsDocked) dw.MoveAndResize (e.XDelta, e.YDelta); Rectangle r = ClientRectangle; @@ -149,7 +149,7 @@ namespace Crow childrenRWLock.EnterReadLock (); foreach (GraphicObject g in Children) { - if (CurrentInterface.DragAndDropOperation?.DragSource == g) + if (IFace.DragAndDropOperation?.DragSource == g) continue; g.Paint (ref gr); } @@ -184,8 +184,8 @@ namespace Crow gr.Stroke (); } - if (CurrentInterface.DragAndDropOperation != null) - CurrentInterface.DragAndDropOperation.DragSource.Paint (ref gr); + if (IFace.DragAndDropOperation != null) + IFace.DragAndDropOperation.DragSource.Paint (ref gr); gr.Restore (); @@ -194,7 +194,7 @@ namespace Crow public void Dock(DockWindow dw){ if (dockingDirection == Alignment.Center) return; - lock (CurrentInterface.UpdateMutex) { + lock (IFace.UpdateMutex) { Splitter splitter = instSplit.CreateInstance (); diff --git a/src/GraphicObjects/FileDialog.cs b/src/GraphicObjects/FileDialog.cs index 285ca253..8f1a0830 100644 --- a/src/GraphicObjects/FileDialog.cs +++ b/src/GraphicObjects/FileDialog.cs @@ -143,11 +143,11 @@ namespace Crow CurrentDirectory = SelectedDirectory; else { OkClicked.Raise (this, null); - CurrentInterface.DeleteWidget (this); + IFace.DeleteWidget (this); } } void onCancel(object sender, MouseButtonEventArgs e){ - CurrentInterface.DeleteWidget (this); + IFace.DeleteWidget (this); } } } diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs index 7976f837..3d6884e1 100644 --- a/src/GraphicObjects/GenericStack.cs +++ b/src/GraphicObjects/GenericStack.cs @@ -128,7 +128,7 @@ namespace Crow //if no layouting remains in queue for item, registre for redraw if (RegisteredLayoutings == LayoutingType.None && IsDirty) - CurrentInterface.EnqueueForRepaint (this); + IFace.EnqueueForRepaint (this); return true; } diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index f671239d..8c9afa0e 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -70,17 +70,17 @@ namespace Crow throw new Exception("Trying to dispose an object queued for Redraw: " + this.ToString()); #endif - if (CurrentInterface.HoverWidget != null) { - if (CurrentInterface.HoverWidget.IsOrIsInside(this)) - CurrentInterface.HoverWidget = null; + if (IFace.HoverWidget != null) { + if (IFace.HoverWidget.IsOrIsInside(this)) + IFace.HoverWidget = null; } - if (CurrentInterface.ActiveWidget != null) { - if (CurrentInterface.ActiveWidget.IsOrIsInside (this)) - CurrentInterface.ActiveWidget = null; + if (IFace.ActiveWidget != null) { + if (IFace.ActiveWidget.IsOrIsInside (this)) + IFace.ActiveWidget = null; } - if (CurrentInterface.FocusedWidget != null) { - if (CurrentInterface.FocusedWidget.IsOrIsInside (this)) - CurrentInterface.FocusedWidget = null; + if (IFace.FocusedWidget != null) { + if (IFace.FocusedWidget.IsOrIsInside (this)) + IFace.FocusedWidget = null; } if (!localDataSourceIsNull) DataSource = null; @@ -107,7 +107,7 @@ namespace Crow /// /// interface this widget is bound to, this should not be changed once the instance is created /// - public Interface CurrentInterface = null; + public Interface IFace = null; /// /// contains the dirty rectangles in the coordinate system of the cache. those dirty zones @@ -159,7 +159,7 @@ namespace Crow /// Iface. public GraphicObject (Interface iface) : this() { - CurrentInterface = iface; + IFace = iface; Initialize (); } #endregion @@ -867,17 +867,17 @@ namespace Crow Type thisType = this.GetType (); if (!string.IsNullOrEmpty (Style)) { - if (CurrentInterface.DefaultValuesLoader.ContainsKey (Style)) { - CurrentInterface.DefaultValuesLoader [Style] (this); + if (IFace.DefaultValuesLoader.ContainsKey (Style)) { + IFace.DefaultValuesLoader [Style] (this); return; } } else { - if (CurrentInterface.DefaultValuesLoader.ContainsKey (thisType.FullName)) { - CurrentInterface.DefaultValuesLoader [thisType.FullName] (this); + if (IFace.DefaultValuesLoader.ContainsKey (thisType.FullName)) { + IFace.DefaultValuesLoader [thisType.FullName] (this); return; - } else if (!CurrentInterface.Styling.ContainsKey (thisType.FullName)) { - if (CurrentInterface.DefaultValuesLoader.ContainsKey (thisType.Name)) { - CurrentInterface.DefaultValuesLoader [thisType.Name] (this); + } else if (!IFace.Styling.ContainsKey (thisType.FullName)) { + if (IFace.DefaultValuesLoader.ContainsKey (thisType.Name)) { + IFace.DefaultValuesLoader [thisType.Name] (this); return; } } @@ -892,17 +892,17 @@ namespace Crow // those files being placed in a Styles folder string styleKey = Style; if (!string.IsNullOrEmpty (Style)) { - if (CurrentInterface.Styling.ContainsKey (Style)) { - styling.Add (CurrentInterface.Styling [Style]); + if (IFace.Styling.ContainsKey (Style)) { + styling.Add (IFace.Styling [Style]); } } - if (CurrentInterface.Styling.ContainsKey (thisType.FullName)) { - styling.Add (CurrentInterface.Styling [thisType.FullName]); + if (IFace.Styling.ContainsKey (thisType.FullName)) { + styling.Add (IFace.Styling [thisType.FullName]); if (string.IsNullOrEmpty (styleKey)) styleKey = thisType.FullName; } - if (CurrentInterface.Styling.ContainsKey (thisType.Name)) { - styling.Add (CurrentInterface.Styling [thisType.Name]); + if (IFace.Styling.ContainsKey (thisType.Name)) { + styling.Add (IFace.Styling [thisType.Name]); if (string.IsNullOrEmpty (styleKey)) styleKey = thisType.Name; } @@ -972,8 +972,8 @@ namespace Crow #endregion try { - CurrentInterface.DefaultValuesLoader[styleKey] = (Interface.LoaderInvoker)dm.CreateDelegate(typeof(Interface.LoaderInvoker)); - CurrentInterface.DefaultValuesLoader[styleKey] (this); + IFace.DefaultValuesLoader[styleKey] = (Interface.LoaderInvoker)dm.CreateDelegate(typeof(Interface.LoaderInvoker)); + IFace.DefaultValuesLoader[styleKey] (this); } catch (Exception ex) { throw new Exception ("Error applying style <" + styleKey + ">:", ex); } @@ -1105,7 +1105,7 @@ namespace Crow /// fired when drag and drop operation start /// protected virtual void onStartDrag (object sender, DragDropEventArgs e){ - CurrentInterface.HoverWidget = null; + IFace.HoverWidget = null; IsDragged = true; StartDrag.Raise (this, e); Debug.WriteLine(this.ToString() + " : START DRAG => " + e.ToString()); @@ -1180,7 +1180,7 @@ namespace Crow if (Width.IsFit || Height.IsFit) RegisterForLayouting (LayoutingType.Sizing); else if (RegisteredLayoutings == LayoutingType.None) - CurrentInterface.EnqueueForRepaint (this); + IFace.EnqueueForRepaint (this); } /// query an update of the content, a redraw [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1191,7 +1191,7 @@ namespace Crow #endif IsDirty = true; if (RegisteredLayoutings == LayoutingType.None) - CurrentInterface.EnqueueForRepaint (this); + IFace.EnqueueForRepaint (this); } #endregion @@ -1209,7 +1209,7 @@ namespace Crow public virtual void RegisterForLayouting(LayoutingType layoutType){ if (Parent == null) return; - lock (CurrentInterface.LayoutMutex) { + lock (IFace.LayoutMutex) { //prevent queueing same LayoutingType for this layoutType &= (~RegisteredLayoutings); @@ -1236,15 +1236,15 @@ namespace Crow //enqueue LQI LayoutingTypes separately if (layoutType.HasFlag (LayoutingType.Width)) - CurrentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Width, this)); + IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Width, this)); if (layoutType.HasFlag (LayoutingType.Height)) - CurrentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Height, this)); + IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Height, this)); if (layoutType.HasFlag (LayoutingType.X)) - CurrentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.X, this)); + IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.X, this)); if (layoutType.HasFlag (LayoutingType.Y)) - CurrentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Y, this)); + IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.Y, this)); if (layoutType.HasFlag (LayoutingType.ArrangeChildren)) - CurrentInterface.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.ArrangeChildren, this)); + IFace.LayoutingQueue.Enqueue (new LayoutingQueueItem (LayoutingType.ArrangeChildren, this)); } } @@ -1420,7 +1420,7 @@ namespace Crow //if no layouting remains in queue for item, registre for redraw if (this.registeredLayoutings == LayoutingType.None && IsDirty) - CurrentInterface.EnqueueForRepaint (this); + IFace.EnqueueForRepaint (this); return true; } @@ -1557,8 +1557,8 @@ namespace Crow } public virtual void checkHoverWidget(MouseMoveEventArgs e) { - if (CurrentInterface.HoverWidget != this) { - CurrentInterface.HoverWidget = this; + if (IFace.HoverWidget != this) { + IFace.HoverWidget = this; onMouseEnter (this, e); } @@ -1567,9 +1567,9 @@ namespace Crow public virtual void onMouseMove(object sender, MouseMoveEventArgs e) { if (AllowDrag & HasFocus & e.Mouse.LeftButton == ButtonState.Pressed) { - if (CurrentInterface.DragAndDropOperation == null) { - CurrentInterface.DragAndDropOperation = new DragDropEventArgs (this); - onStartDrag (this, CurrentInterface.DragAndDropOperation); + if (IFace.DragAndDropOperation == null) { + IFace.DragAndDropOperation = new DragDropEventArgs (this); + onStartDrag (this, IFace.DragAndDropOperation); } } @@ -1585,15 +1585,15 @@ namespace Crow Debug.WriteLine("MOUSE DOWN => " + this.ToString()); #endif - if (CurrentInterface.ActiveWidget == null) - CurrentInterface.ActiveWidget = this; + if (IFace.ActiveWidget == null) + IFace.ActiveWidget = this; if (this.Focusable && !Interface.FocusOnHover) { BubblingMouseButtonEventArg be = e as BubblingMouseButtonEventArg; if (be.Focused == null) { be.Focused = this; - CurrentInterface.FocusedWidget = this; + IFace.FocusedWidget = this; if (e.Button == MouseButton.Right && this.ContextCommands != null) - CurrentInterface.ShowContextMenu (this); + IFace.ShowContextMenu (this); } } //bubble event to the top @@ -1608,13 +1608,13 @@ namespace Crow Debug.WriteLine("MOUSE UP => " + this.ToString()); #endif - if (CurrentInterface.DragAndDropOperation != null){ - if (CurrentInterface.DragAndDropOperation.DragSource == this) { - if (CurrentInterface.DragAndDropOperation.DropTarget != null) - onDrop (this, CurrentInterface.DragAndDropOperation); + if (IFace.DragAndDropOperation != null){ + if (IFace.DragAndDropOperation.DragSource == this) { + if (IFace.DragAndDropOperation.DropTarget != null) + onDrop (this, IFace.DragAndDropOperation); else - onEndDrag (this, CurrentInterface.DragAndDropOperation); - CurrentInterface.DragAndDropOperation = null; + onEndDrag (this, IFace.DragAndDropOperation); + IFace.DragAndDropOperation = null; } } @@ -1656,10 +1656,10 @@ namespace Crow Debug.WriteLine("MouseEnter => " + this.ToString()); #endif - if (CurrentInterface.DragAndDropOperation != null) { + if (IFace.DragAndDropOperation != null) { if (this.AllowDrop) { - if (CurrentInterface.DragAndDropOperation.DragSource != this && CurrentInterface.DragAndDropOperation.DropTarget != this) - onDragEnter (this, CurrentInterface.DragAndDropOperation); + if (IFace.DragAndDropOperation.DragSource != this && IFace.DragAndDropOperation.DropTarget != this) + onDragEnter (this, IFace.DragAndDropOperation); } } @@ -1670,9 +1670,9 @@ namespace Crow #if DEBUG_FOCUS Debug.WriteLine("MouseLeave => " + this.ToString()); #endif - if (CurrentInterface.DragAndDropOperation != null) { - if (CurrentInterface.DragAndDropOperation.DropTarget == this) - onDragLeave (this, CurrentInterface.DragAndDropOperation); + if (IFace.DragAndDropOperation != null) { + if (IFace.DragAndDropOperation.DropTarget == this) + onDragLeave (this, IFace.DragAndDropOperation); } MouseLeave.Raise (this, e); } diff --git a/src/GraphicObjects/Grid.cs b/src/GraphicObjects/Grid.cs index f8a50264..4ae906a7 100644 --- a/src/GraphicObjects/Grid.cs +++ b/src/GraphicObjects/Grid.cs @@ -157,7 +157,7 @@ namespace Crow //if no layouting remains in queue for item, registre for redraw if (RegisteredLayoutings == LayoutingType.None && IsDirty) - CurrentInterface.EnqueueForRepaint (this); + IFace.EnqueueForRepaint (this); return true; } diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index e7604842..cfec7774 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -80,9 +80,9 @@ namespace Crow { child.LayoutChanged -= OnChildLayoutChanges; //check if HoverWidget is removed from Tree - if (CurrentInterface.HoverWidget != null) { - if (this.Contains (CurrentInterface.HoverWidget)) - CurrentInterface.HoverWidget = null; + if (IFace.HoverWidget != null) { + if (this.Contains (IFace.HoverWidget)) + IFace.HoverWidget = null; } childrenRWLock.EnterWriteLock (); @@ -397,8 +397,8 @@ namespace Crow #region Mouse handling public override void checkHoverWidget (MouseMoveEventArgs e) { - if (CurrentInterface.HoverWidget != this) { - CurrentInterface.HoverWidget = this; + if (IFace.HoverWidget != this) { + IFace.HoverWidget = this; onMouseEnter (this, e); } for (int i = Children.Count - 1; i >= 0; i--) { diff --git a/src/GraphicObjects/IMLContainer.cs b/src/GraphicObjects/IMLContainer.cs index a221a78b..84692284 100644 --- a/src/GraphicObjects/IMLContainer.cs +++ b/src/GraphicObjects/IMLContainer.cs @@ -41,7 +41,7 @@ namespace Crow if (path == value) return; path = value; - this.SetChild (CurrentInterface.Load (path)); + this.SetChild (IFace.Load (path)); NotifyValueChanged ("Path", path); } } diff --git a/src/GraphicObjects/Image.cs b/src/GraphicObjects/Image.cs index 75c59f4a..d6392626 100644 --- a/src/GraphicObjects/Image.cs +++ b/src/GraphicObjects/Image.cs @@ -93,7 +93,7 @@ namespace Crow if (string.IsNullOrEmpty(value)) Picture = null; else { - lock(CurrentInterface.LayoutMutex){ + lock(IFace.LayoutMutex){ LoadImage (value); } } diff --git a/src/GraphicObjects/Label.cs b/src/GraphicObjects/Label.cs index ea68fde0..56508d23 100644 --- a/src/GraphicObjects/Label.cs +++ b/src/GraphicObjects/Label.cs @@ -688,12 +688,12 @@ namespace Crow { base.onMouseEnter (sender, e); if (Selectable) - CurrentInterface.MouseCursor = XCursor.Text; + IFace.MouseCursor = XCursor.Text; } public override void onMouseLeave (object sender, MouseMoveEventArgs e) { base.onMouseLeave (sender, e); - CurrentInterface.MouseCursor = XCursor.Default; + IFace.MouseCursor = XCursor.Default; } protected override void onFocused (object sender, EventArgs e) { diff --git a/src/GraphicObjects/MessageBox.cs b/src/GraphicObjects/MessageBox.cs index c0754eaa..e59e0e63 100644 --- a/src/GraphicObjects/MessageBox.cs +++ b/src/GraphicObjects/MessageBox.cs @@ -137,7 +137,7 @@ namespace Crow public static MessageBox Show (Interface iface, Type msgBoxType, string message, string okMsg = "", string cancelMsg = ""){ lock (iface.UpdateMutex) { MessageBox mb = new MessageBox (iface); - mb.CurrentInterface.AddWidget (mb); + mb.IFace.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 70804bda..1186e8e7 100644 --- a/src/GraphicObjects/Popper.cs +++ b/src/GraphicObjects/Popper.cs @@ -201,8 +201,8 @@ namespace Crow } public override void checkHoverWidget (MouseMoveEventArgs e) { - if (CurrentInterface.HoverWidget != this) { - CurrentInterface.HoverWidget = this; + if (IFace.HoverWidget != this) { + IFace.HoverWidget = this; onMouseEnter (this, e); } if (Content != null){ @@ -222,10 +222,10 @@ namespace Crow if (Content != null) { Content.Visible = true; if (Content.Parent == null) - CurrentInterface.AddWidget (Content); + IFace.AddWidget (Content); if (Content.LogicalParent != this) Content.LogicalParent = this; - CurrentInterface.PutOnTop (Content, true); + IFace.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 8383a274..f2626e25 100644 --- a/src/GraphicObjects/PrivateContainer.cs +++ b/src/GraphicObjects/PrivateContainer.cs @@ -52,9 +52,9 @@ namespace Crow if (child != null) { //check if HoverWidget is removed from Tree - if (CurrentInterface.HoverWidget != null) { - if (this.Contains (CurrentInterface.HoverWidget)) - CurrentInterface.HoverWidget = null; + if (IFace.HoverWidget != null) { + if (this.Contains (IFace.HoverWidget)) + IFace.HoverWidget = null; } contentSize = new Size (0, 0); child.LayoutChanged -= OnChildLayoutChanges; diff --git a/src/GraphicObjects/ScrollingObject.cs b/src/GraphicObjects/ScrollingObject.cs index 9059d8ed..b636d993 100644 --- a/src/GraphicObjects/ScrollingObject.cs +++ b/src/GraphicObjects/ScrollingObject.cs @@ -148,7 +148,7 @@ namespace Crow public override void onMouseWheel (object sender, MouseWheelEventArgs e) { base.onMouseWheel (sender, e); - if (CurrentInterface.Keyboard.IsKeyDown (Key.ShiftLeft)) + if (IFace.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 c84594df..d3c4276e 100644 --- a/src/GraphicObjects/ScrollingTextBox.cs +++ b/src/GraphicObjects/ScrollingTextBox.cs @@ -467,12 +467,12 @@ namespace Crow public override void onMouseEnter (object sender, MouseMoveEventArgs e) { base.onMouseEnter (sender, e); - CurrentInterface.MouseCursor = XCursor.Text; + IFace.MouseCursor = XCursor.Text; } public override void onMouseLeave (object sender, MouseMoveEventArgs e) { base.onMouseLeave (sender, e); - CurrentInterface.MouseCursor = XCursor.Default; + IFace.MouseCursor = XCursor.Default; } protected override void onFocused (object sender, EventArgs e) { @@ -558,7 +558,7 @@ namespace Crow if (!MoveRight ()) return; }else if (e.Shift) - CurrentInterface.Clipboard = this.SelectedText; + IFace.Clipboard = this.SelectedText; this.DeleteChar (); break; case Key.Enter: @@ -604,9 +604,9 @@ namespace Crow break; case Key.Insert: if (e.Shift) - this.Insert (CurrentInterface.Clipboard); + this.Insert (IFace.Clipboard); else if (e.Control && !selectionIsEmpty) - CurrentInterface.Clipboard = this.SelectedText; + IFace.Clipboard = this.SelectedText; break; case Key.Left: if (e.Shift) { diff --git a/src/GraphicObjects/Splitter.cs b/src/GraphicObjects/Splitter.cs index c688f773..e8aa60f8 100644 --- a/src/GraphicObjects/Splitter.cs +++ b/src/GraphicObjects/Splitter.cs @@ -91,14 +91,14 @@ namespace Crow { base.onMouseEnter (sender, e); if ((Parent as GenericStack).Orientation == Orientation.Horizontal) - CurrentInterface.MouseCursor = XCursor.H; + IFace.MouseCursor = XCursor.H; else - CurrentInterface.MouseCursor = XCursor.V; + IFace.MouseCursor = XCursor.V; } public override void onMouseLeave (object sender, MouseMoveEventArgs e) { base.onMouseLeave (sender, e); - CurrentInterface.MouseCursor = XCursor.Default; + IFace.MouseCursor = XCursor.Default; } public override void onMouseDown (object sender, MouseButtonEventArgs e) { diff --git a/src/GraphicObjects/TabView.cs b/src/GraphicObjects/TabView.cs index abaa6ac0..707e1dcf 100644 --- a/src/GraphicObjects/TabView.cs +++ b/src/GraphicObjects/TabView.cs @@ -153,7 +153,7 @@ namespace Crow //if no layouting remains in queue for item, registre for redraw if (RegisteredLayoutings == LayoutingType.None && IsDirty) - CurrentInterface.EnqueueForRepaint (this); + IFace.EnqueueForRepaint (this); return true; } @@ -196,8 +196,8 @@ namespace Crow #region Mouse handling public override void checkHoverWidget (MouseMoveEventArgs e) { - if (CurrentInterface.HoverWidget != this) { - CurrentInterface.HoverWidget = this; + if (IFace.HoverWidget != this) { + IFace.HoverWidget = this; onMouseEnter (this, e); } diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs index e0e77fc0..c231fd0f 100644 --- a/src/GraphicObjects/TemplatedControl.cs +++ b/src/GraphicObjects/TemplatedControl.cs @@ -66,7 +66,7 @@ namespace Crow if (string.IsNullOrEmpty(_template)) loadTemplate (); else - loadTemplate (CurrentInterface.Load (_template)); + loadTemplate (IFace.Load (_template)); } } /// @@ -133,9 +133,9 @@ namespace Crow this.ClearTemplateBinding(); if (template == null) { - if (!CurrentInterface.DefaultTemplates.ContainsKey (this.GetType ().FullName)) + if (!IFace.DefaultTemplates.ContainsKey (this.GetType ().FullName)) throw new Exception (string.Format ("No default template found for '{0}'", this.GetType ().FullName)); - this.SetChild (CurrentInterface.Load (CurrentInterface.DefaultTemplates[this.GetType ().FullName])); + this.SetChild (IFace.Load (IFace.DefaultTemplates[this.GetType ().FullName])); }else this.SetChild (template); } diff --git a/src/GraphicObjects/TemplatedGroup.cs b/src/GraphicObjects/TemplatedGroup.cs index cf378dbd..8e0ffb44 100644 --- a/src/GraphicObjects/TemplatedGroup.cs +++ b/src/GraphicObjects/TemplatedGroup.cs @@ -427,7 +427,7 @@ namespace Crow iTemp = ItemTemplates ["default"]; } - lock (CurrentInterface.LayoutMutex) { + lock (IFace.LayoutMutex) { g = iTemp.CreateInstance(); page.AddChild (g); // if (isPaged) diff --git a/src/GraphicObjects/TextBox.cs b/src/GraphicObjects/TextBox.cs index a14aea6a..e29ff9bf 100644 --- a/src/GraphicObjects/TextBox.cs +++ b/src/GraphicObjects/TextBox.cs @@ -86,7 +86,7 @@ namespace Crow if (!MoveRight ()) return; }else if (e.Shift) - CurrentInterface.Clipboard = this.SelectedText; + IFace.Clipboard = this.SelectedText; this.DeleteChar (); break; case Key.Enter: @@ -135,9 +135,9 @@ namespace Crow break; case Key.Insert: if (e.Shift) - this.Insert (CurrentInterface.Clipboard); + this.Insert (IFace.Clipboard); else if (e.Control && !selectionIsEmpty) - CurrentInterface.Clipboard = this.SelectedText; + IFace.Clipboard = this.SelectedText; break; case Key.Left: if (e.Shift) { diff --git a/src/GraphicObjects/Window.cs b/src/GraphicObjects/Window.cs index bbfb196d..cff96a75 100644 --- a/src/GraphicObjects/Window.cs +++ b/src/GraphicObjects/Window.cs @@ -175,7 +175,7 @@ namespace Crow alwaysOnTop = value; if (alwaysOnTop && Parent != null) - CurrentInterface.PutOnTop (this); + IFace.PutOnTop (this); NotifyValueChanged ("AlwaysOnTop", alwaysOnTop); } @@ -278,11 +278,11 @@ namespace Crow { base.onMouseMove (sender, e); - Interface otkgw = CurrentInterface; + Interface otkgw = IFace; if (!hoverBorder) { currentDirection = Direction.None; - CurrentInterface.MouseCursor = XCursor.Default; + IFace.MouseCursor = XCursor.Default; return; } @@ -356,7 +356,7 @@ namespace Crow #endregion protected void onMaximized (object sender, EventArgs e){ - lock (CurrentInterface.LayoutMutex) { + lock (IFace.LayoutMutex) { if (!IsMinimized) savedBounds = this.LastPaintedSlot; this.Left = this.Top = 0; @@ -372,7 +372,7 @@ namespace Crow Maximized.Raise (sender, e); } protected void onUnmaximized (object sender, EventArgs e){ - lock (CurrentInterface.LayoutMutex) { + lock (IFace.LayoutMutex) { this.Left = savedBounds.Left; this.Top = savedBounds.Top; this.Width = savedBounds.Width; @@ -387,7 +387,7 @@ namespace Crow Unmaximized.Raise (sender, e); } protected void onMinimized (object sender, EventArgs e){ - lock (CurrentInterface.LayoutMutex) { + lock (IFace.LayoutMutex) { if (IsNormal) savedBounds = this.LastPaintedSlot; Width = 200; @@ -405,7 +405,7 @@ namespace Crow { hoverBorder = false; currentDirection = Direction.None; - CurrentInterface.MouseCursor = XCursor.Default; + IFace.MouseCursor = XCursor.Default; } protected virtual void onBorderMouseEnter (object sender, MouseMoveEventArgs e) { @@ -415,7 +415,7 @@ namespace Crow protected void butQuitPress (object sender, MouseButtonEventArgs e) { - CurrentInterface.MouseCursor = XCursor.Default; + IFace.MouseCursor = XCursor.Default; close (); } diff --git a/src/GraphicObjects/Wrapper.cs b/src/GraphicObjects/Wrapper.cs index 4fff17ff..3f5dfdf0 100644 --- a/src/GraphicObjects/Wrapper.cs +++ b/src/GraphicObjects/Wrapper.cs @@ -207,7 +207,7 @@ namespace Crow //if no layouting remains in queue for item, registre for redraw if (RegisteredLayoutings == LayoutingType.None && IsDirty) - CurrentInterface.EnqueueForRepaint (this); + IFace.EnqueueForRepaint (this); return true; } diff --git a/src/Interface.cs b/src/Interface.cs index ee95eeb5..5174e37e 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -344,12 +344,20 @@ namespace Crow /// a valid IML string public GraphicObject LoadIMLFragment (string imlFragment) { lock (UpdateMutex) { - GraphicObject tmp = Instantiator.CreateFromImlFragment (this, imlFragment).CreateInstance(); + GraphicObject tmp = CreateITorFromIMLFragment (imlFragment).CreateInstance(); AddWidget (tmp); return tmp; } } /// + /// Add the content of the IML fragment to the graphic tree of this interface + /// + /// return the new instance for convenience, may be ignored + /// a valid IML string + public Instantiator CreateITorFromIMLFragment (string imlFragment) { + return Instantiator.CreateFromImlFragment (this, imlFragment); + } + /// /// Create an instance of a GraphicObject and add it to the GraphicTree of this Interface /// /// new instance of graphic object created diff --git a/src/LayoutingQueueItem.cs b/src/LayoutingQueueItem.cs index ba2f95af..08810aaa 100644 --- a/src/LayoutingQueueItem.cs +++ b/src/LayoutingQueueItem.cs @@ -125,7 +125,7 @@ namespace Crow #endif if (LayoutingTries < Interface.MaxLayoutingTries) { Layoutable.RegisteredLayoutings |= LayoutType; - (Layoutable as GraphicObject).CurrentInterface.LayoutingQueue.Enqueue (this); + (Layoutable as GraphicObject).IFace.LayoutingQueue.Enqueue (this); } else if (DiscardCount < Interface.MaxDiscardCount) { #if DEBUG_LAYOUTING Debug.WriteLine ("\t\tDiscarded"); @@ -133,7 +133,7 @@ namespace Crow LayoutingTries = 0; DiscardCount++; Layoutable.RegisteredLayoutings |= LayoutType; - (Layoutable as GraphicObject).CurrentInterface.DiscardQueue.Enqueue (this); + (Layoutable as GraphicObject).IFace.DiscardQueue.Enqueue (this); } #if DEBUG_LAYOUTING else