From: Jean-Philippe Bruyère Date: Wed, 21 Aug 2019 14:03:14 +0000 (+0200) Subject: Cairo namespace renamed to Crow.Cairo to avoid md addins fault X-Git-Tag: v0.9.5-beta~137^2~16 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=c39fc133477d483648ce05cc1c656d9cdf2e1d3b;p=jp%2Fcrow.git Cairo namespace renamed to Crow.Cairo to avoid md addins fault --- diff --git a/Crow.sln b/Crow.sln index 37f1d7b1..465d115b 100644 --- a/Crow.sln +++ b/Crow.sln @@ -37,7 +37,7 @@ Global GlobalSection(MonoDevelopProperties) = preSolution Policies = $0 $0.StandardHeader = $1 - $1.Text = @\n${FileName}\n \nAuthor:\n ${AuthorName} <${AuthorEmail}>\n\nCopyright (c) 2013-2017 Jean-Philippe Bruyère\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. + $1.Text = @Copyright (c) ${Year} ${AuthorName} <${AuthorEmail}>\n\nThis code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) $0.DotNetNamingPolicy = $2 $0.TextStylePolicy = $3 $3.EolMarker = Unix @@ -69,7 +69,6 @@ Global $6.LastFilePostfix = "@:\n " $6.LineAlign = 0 $6.Wrap = False - $5.inheritsSet = Mono description = @C.R.O.W. c# Rapid Open Widgets\n\nCrow is a pure c# widget toolkit with XML definition of interface, bindings, styling...\n version = 0.8.0 EndGlobalSection diff --git a/Crow/Crow.csproj b/Crow/Crow.csproj index 7a133093..857a24e9 100644 --- a/Crow/Crow.csproj +++ b/Crow/Crow.csproj @@ -1,10 +1,10 @@ - net471;netstandard2.0 + net461;net471;netstandard2.0 Crow - 0.8.1 + 0.8.3.2 C.R.O.W. is a widget toolkit and rendering engine entirely developed in C# with templates, styles, compositing, and bindings. true @@ -24,17 +24,18 @@ https://jpbruyere.github.io/Crow/images/crow.png Copyright 2013-2019 xcb backend - https://github.com/jpbruyere/Crow + https://github.com/jpbruyere/Crow + + 7.2 $(SolutionDir)build\$(Configuration)\ DESIGN_MODE - 0.8.0 full TRACE;DESIGN_MODE;_DEBUG_CLIP_RECTANGLE;_DEBUG_FOCUS;_DEBUG_DRAGNDROP;DEBUG;NETFRAMEWORK;NET471 - true + true diff --git a/Crow/src/BmpPicture.cs b/Crow/src/BmpPicture.cs index 98c2a016..540087dc 100644 --- a/Crow/src/BmpPicture.cs +++ b/Crow/src/BmpPicture.cs @@ -26,7 +26,7 @@ using System; using System.IO; -using Cairo; +using Crow.Cairo; namespace Crow { diff --git a/Crow/src/CompilerServices/CompilerServices.cs b/Crow/src/CompilerServices/CompilerServices.cs index d57cb7b5..8819e86d 100644 --- a/Crow/src/CompilerServices/CompilerServices.cs +++ b/Crow/src/CompilerServices/CompilerServices.cs @@ -920,7 +920,8 @@ namespace Crow.IML foreach (Type expT in a.GetExportedTypes ()) { if (expT.Name != strDataType) continue; - knownTypes.Add (strDataType, expT); + if (!knownTypes.ContainsKey(strDataType)) + knownTypes.Add (strDataType, expT); return expT; } } diff --git a/Crow/src/Fill/Fill.cs b/Crow/src/Fill/Fill.cs index 0c0bdf5b..7d521045 100644 --- a/Crow/src/Fill/Fill.cs +++ b/Crow/src/Fill/Fill.cs @@ -26,7 +26,7 @@ using System; using System.Collections.Generic; -using Cairo; +using Crow.Cairo; namespace Crow { diff --git a/Crow/src/Font.cs b/Crow/src/Font.cs index 16353d70..06df4a88 100644 --- a/Crow/src/Font.cs +++ b/Crow/src/Font.cs @@ -25,7 +25,7 @@ // THE SOFTWARE. using System; -using Cairo; +using Crow.Cairo; namespace Crow { diff --git a/Crow/src/Gradient.cs b/Crow/src/Gradient.cs index 2630c42a..e76be7b6 100644 --- a/Crow/src/Gradient.cs +++ b/Crow/src/Gradient.cs @@ -26,7 +26,7 @@ using System; using System.Collections.Generic; -using Cairo; +using Crow.Cairo; namespace Crow { diff --git a/Crow/src/GraphicObjects/Border.cs b/Crow/src/GraphicObjects/Border.cs index 9379c26a..e5a16ec8 100644 --- a/Crow/src/GraphicObjects/Border.cs +++ b/Crow/src/GraphicObjects/Border.cs @@ -28,7 +28,7 @@ using System; using System.Xml.Serialization; using System.ComponentModel; using System.Diagnostics; -using Cairo; +using Crow.Cairo; namespace Crow { diff --git a/Crow/src/GraphicObjects/Button.cs b/Crow/src/GraphicObjects/Button.cs index 30612512..8b15c2ea 100644 --- a/Crow/src/GraphicObjects/Button.cs +++ b/Crow/src/GraphicObjects/Button.cs @@ -33,7 +33,7 @@ using System.Text; using System.Diagnostics; using System.Xml.Serialization; -using Cairo; +using Crow.Cairo; using System.ComponentModel; namespace Crow diff --git a/Crow/src/GraphicObjects/GraduatedSlider.cs b/Crow/src/GraphicObjects/GraduatedSlider.cs index e1d4dd46..71bbff11 100644 --- a/Crow/src/GraphicObjects/GraduatedSlider.cs +++ b/Crow/src/GraphicObjects/GraduatedSlider.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; -using Cairo; +using Crow.Cairo; using System.Xml.Serialization; namespace Crow diff --git a/Crow/src/GraphicObjects/Group.cs b/Crow/src/GraphicObjects/Group.cs index 26a5084d..a0ae35b2 100644 --- a/Crow/src/GraphicObjects/Group.cs +++ b/Crow/src/GraphicObjects/Group.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.Xml.Serialization; -using Cairo; +using Crow.Cairo; using System.Diagnostics; using System.Reflection; using System.Threading; diff --git a/Crow/src/GraphicObjects/HueSelector.cs b/Crow/src/GraphicObjects/HueSelector.cs index d8218fee..e9a31dfb 100644 --- a/Crow/src/GraphicObjects/HueSelector.cs +++ b/Crow/src/GraphicObjects/HueSelector.cs @@ -27,7 +27,7 @@ using System; using System.Xml.Serialization; using System.ComponentModel; -using Cairo; +using Crow.Cairo; namespace Crow { diff --git a/Crow/src/GraphicObjects/Image.cs b/Crow/src/GraphicObjects/Image.cs index 388abb1b..98f86e58 100644 --- a/Crow/src/GraphicObjects/Image.cs +++ b/Crow/src/GraphicObjects/Image.cs @@ -25,7 +25,7 @@ // THE SOFTWARE. using System; -using Cairo; +using Crow.Cairo; using System.Xml.Serialization; using System.ComponentModel; using System.Diagnostics; diff --git a/Crow/src/GraphicObjects/Label.cs b/Crow/src/GraphicObjects/Label.cs index 3736f968..f597f5d7 100644 --- a/Crow/src/GraphicObjects/Label.cs +++ b/Crow/src/GraphicObjects/Label.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Diagnostics; -using Cairo; +using Crow.Cairo; using System.Text.RegularExpressions; using System.Xml.Serialization; using System.ComponentModel; diff --git a/Crow/src/GraphicObjects/PrivateContainer.cs b/Crow/src/GraphicObjects/PrivateContainer.cs index 8b1650e5..1225cbb3 100644 --- a/Crow/src/GraphicObjects/PrivateContainer.cs +++ b/Crow/src/GraphicObjects/PrivateContainer.cs @@ -27,7 +27,7 @@ using System; using System.Xml.Serialization; using System.ComponentModel; -using Cairo; +using Crow.Cairo; namespace Crow { diff --git a/Crow/src/GraphicObjects/ProgressBar.cs b/Crow/src/GraphicObjects/ProgressBar.cs index afaead9b..20fadadc 100644 --- a/Crow/src/GraphicObjects/ProgressBar.cs +++ b/Crow/src/GraphicObjects/ProgressBar.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; -using Cairo; +using Crow.Cairo; using System.Diagnostics; using System.Xml.Serialization; using System.ComponentModel; diff --git a/Crow/src/GraphicObjects/SaturationValueSelector.cs b/Crow/src/GraphicObjects/SaturationValueSelector.cs index 5a25d6a2..535a90df 100644 --- a/Crow/src/GraphicObjects/SaturationValueSelector.cs +++ b/Crow/src/GraphicObjects/SaturationValueSelector.cs @@ -25,7 +25,7 @@ // THE SOFTWARE. using System; -using Cairo; +using Crow.Cairo; using System.Xml.Serialization; namespace Crow diff --git a/Crow/src/GraphicObjects/Scroller.cs b/Crow/src/GraphicObjects/Scroller.cs index e9d14711..a234a3e4 100644 --- a/Crow/src/GraphicObjects/Scroller.cs +++ b/Crow/src/GraphicObjects/Scroller.cs @@ -28,7 +28,7 @@ using System; using System.Xml.Serialization; using System.ComponentModel; using System.Diagnostics; -using Cairo; +using Crow.Cairo; namespace Crow { diff --git a/Crow/src/GraphicObjects/ScrollingObject.cs b/Crow/src/GraphicObjects/ScrollingObject.cs index 0f694236..12804899 100644 --- a/Crow/src/GraphicObjects/ScrollingObject.cs +++ b/Crow/src/GraphicObjects/ScrollingObject.cs @@ -28,7 +28,7 @@ using System; using System.Xml.Serialization; using System.ComponentModel; using System.Collections; -using Cairo; +using Crow.Cairo; namespace Crow diff --git a/Crow/src/GraphicObjects/Shape.cs b/Crow/src/GraphicObjects/Shape.cs index ea0409b1..99678556 100644 --- a/Crow/src/GraphicObjects/Shape.cs +++ b/Crow/src/GraphicObjects/Shape.cs @@ -28,7 +28,7 @@ using System.Xml.Serialization; using System.ComponentModel; using System.IO; using System.Text; -using Cairo; +using Crow.Cairo; namespace Crow { diff --git a/Crow/src/GraphicObjects/Slider.cs b/Crow/src/GraphicObjects/Slider.cs index 2db34f92..bd46b051 100644 --- a/Crow/src/GraphicObjects/Slider.cs +++ b/Crow/src/GraphicObjects/Slider.cs @@ -25,7 +25,7 @@ // THE SOFTWARE. using System; -using Cairo; +using Crow.Cairo; using System.Xml.Serialization; using System.ComponentModel; using System.Diagnostics; diff --git a/Crow/src/GraphicObjects/TabItem.cs b/Crow/src/GraphicObjects/TabItem.cs index 4d9847c7..113a4399 100644 --- a/Crow/src/GraphicObjects/TabItem.cs +++ b/Crow/src/GraphicObjects/TabItem.cs @@ -28,7 +28,7 @@ using System; using System.Xml.Serialization; using System.ComponentModel; using System.Diagnostics; -using Cairo; +using Crow.Cairo; using System.Linq; namespace Crow diff --git a/Crow/src/GraphicObjects/TabView.cs b/Crow/src/GraphicObjects/TabView.cs index 655732f1..550d60aa 100644 --- a/Crow/src/GraphicObjects/TabView.cs +++ b/Crow/src/GraphicObjects/TabView.cs @@ -27,7 +27,7 @@ using System; using System.Xml.Serialization; using System.ComponentModel; -using Cairo; +using Crow.Cairo; using System.Diagnostics; using System.Linq; diff --git a/Crow/src/GraphicObjects/TemplatedControl.cs b/Crow/src/GraphicObjects/TemplatedControl.cs index 2e36eac6..d93cf4c8 100644 --- a/Crow/src/GraphicObjects/TemplatedControl.cs +++ b/Crow/src/GraphicObjects/TemplatedControl.cs @@ -29,7 +29,7 @@ using System.ComponentModel; using System.IO; using System.Xml; using System.Reflection; -using Cairo; +using Crow.Cairo; namespace Crow { diff --git a/Crow/src/GraphicObjects/TemplatedGroup.cs b/Crow/src/GraphicObjects/TemplatedGroup.cs index 8b9e15b8..cb57a721 100644 --- a/Crow/src/GraphicObjects/TemplatedGroup.cs +++ b/Crow/src/GraphicObjects/TemplatedGroup.cs @@ -25,20 +25,13 @@ // THE SOFTWARE. using System; -using System.Xml.Serialization; -using System.Xml; -using System.Reflection; +using System.Collections; using System.Collections.Generic; using System.ComponentModel; -using System.Collections; -using System.Threading; using System.Linq; using Crow.IML; -using System.Diagnostics; -using System.IO; -namespace Crow -{ +namespace Crow { public abstract class TemplatedGroup : TemplatedControl { #if DESIGN_MODE @@ -72,7 +65,7 @@ namespace Crow public event EventHandler Loaded; #endregion - IList data; + IEnumerable data; int _selectedIndex = -1; Color selBackground, selForeground; @@ -172,7 +165,7 @@ namespace Crow } } [XmlIgnore]public virtual object SelectedItem{ - get { return data == null ? null : _selectedIndex < 0 ? data.GetDefaultValue() : data[_selectedIndex]; } + get { return data == null ? null : _selectedIndex < 0 ? data.GetDefaultValue() : ((IList)data)?[_selectedIndex]; } set { if (data == null) { SelectedIndex = -1; @@ -182,13 +175,13 @@ namespace Crow if (value == SelectedItem) return; - SelectedIndex = data.IndexOf (value); + SelectedIndex = (int)((IList)data)?.IndexOf (value); } } [XmlIgnore]public bool HasItems { get { return Items.Count > 0; } } - public IList Data { + public IEnumerable Data { get { return data; } set { if (value == data) @@ -362,7 +355,7 @@ namespace Crow if (loadingThread != null) loadingThread.Cancel (); } - void loadPage(IList _data, Group page, string _dataTest) + void loadPage(IEnumerable _data, Group page, string _dataTest) { #if DEBUG_LOAD Stopwatch loadingTime = Stopwatch.StartNew (); @@ -374,26 +367,27 @@ namespace Crow // typeof(Wrapper).IsAssignableFrom (items.GetType ())) { //page = items; itemPerPage = int.MaxValue; -// } else if (typeof(GenericStack).IsAssignableFrom (items.GetType ())) { -// GenericStack gs = new GenericStack (items.CurrentInterface); -// gs.Orientation = (items as GenericStack).Orientation; -// gs.Width = items.Width; -// gs.Height = items.Height; -// gs.VerticalAlignment = items.VerticalAlignment; -// gs.HorizontalAlignment = items.HorizontalAlignment; -// page = gs; -// page.Name = "page" + pageNum; -// isPaged = true; -// } else { -// page = Activator.CreateInstance (items.GetType ()) as Group; -// page.CurrentInterface = items.CurrentInterface; -// page.Initialize (); -// page.Name = "page" + pageNum; -// isPaged = true; -// } - - for (int i = 0; i < _data.Count; i++) { - loadItem (_data[i], page, _dataTest); + // } else if (typeof(GenericStack).IsAssignableFrom (items.GetType ())) { + // GenericStack gs = new GenericStack (items.CurrentInterface); + // gs.Orientation = (items as GenericStack).Orientation; + // gs.Width = items.Width; + // gs.Height = items.Height; + // gs.VerticalAlignment = items.VerticalAlignment; + // gs.HorizontalAlignment = items.HorizontalAlignment; + // page = gs; + // page.Name = "page" + pageNum; + // isPaged = true; + // } else { + // page = Activator.CreateInstance (items.GetType ()) as Group; + // page.CurrentInterface = items.CurrentInterface; + // page.Initialize (); + // page.Name = "page" + pageNum; + // isPaged = true; + // } + + + foreach (object d in _data) { + loadItem (d, page, _dataTest); if (loadingThread.cancelRequested) break; } @@ -461,22 +455,27 @@ namespace Crow if (iTemp.Expand != null && g is Expandable) { Expandable e = g as Expandable; e.Expand += iTemp.Expand; - e.GetIsExpandable = iTemp.HasSubItems; + if ((o as ICollection) == null) + e.GetIsExpandable = new BooleanTestOnInstance((instance) => true); + else + e.GetIsExpandable = iTemp.HasSubItems; } g.DataSource = o; } -// protected void _list_LayoutChanged (object sender, LayoutingEventArgs e) -// { -// #if DEBUG_LAYOUTING -// Debug.WriteLine("list_LayoutChanged"); -// #endif -// if (_gsList.Orientation == Orientation.Horizontal) { -// if (e.LayoutType == LayoutingType.Width) -// _gsList.Width = approxSize; -// } else if (e.LayoutType == LayoutingType.Height) -// _gsList.Height = approxSize; -// } + + + // protected void _list_LayoutChanged (object sender, LayoutingEventArgs e) + // { + // #if DEBUG_LAYOUTING + // Debug.WriteLine("list_LayoutChanged"); + // #endif + // if (_gsList.Orientation == Orientation.Horizontal) { + // if (e.LayoutType == LayoutingType.Width) + // _gsList.Width = approxSize; + // } else if (e.LayoutType == LayoutingType.Height) + // _gsList.Height = approxSize; + // } int approxSize { get { @@ -487,16 +486,16 @@ namespace Crow return -1; return page1.Orientation == Orientation.Horizontal ? - data.Count < itemPerPage ? + (data as ICollection)?.Count < itemPerPage ? -1: - (int)Math.Ceiling ((double)page1.Slot.Width / (double)itemPerPage * (double)(data.Count+1)): - data.Count < itemPerPage ? + (int)Math.Ceiling ((double)page1.Slot.Width / (double)itemPerPage * (double)((data as ICollection)?.Count+1)): + (data as ICollection)?.Count < itemPerPage ? -1: - (int)Math.Ceiling ((double)page1.Slot.Height / (double)itemPerPage * (double)(data.Count+1)); + (int)Math.Ceiling ((double)page1.Slot.Height / (double)itemPerPage * (double)((data as ICollection)?.Count+1)); } } internal virtual void itemClick(object sender, MouseButtonEventArgs e){ - SelectedIndex = data.IndexOf((sender as Widget).DataSource); + SelectedIndex = (int)((IList)data)?.IndexOf((sender as Widget).DataSource); } bool emitHelperIsAlreadyExpanded (Widget go){ diff --git a/Crow/src/GraphicObjects/TestCairoPatch.cs b/Crow/src/GraphicObjects/TestCairoPatch.cs index cd15adc5..dcfb584c 100644 --- a/Crow/src/GraphicObjects/TestCairoPatch.cs +++ b/Crow/src/GraphicObjects/TestCairoPatch.cs @@ -24,7 +24,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; -using Cairo; +using Crow.Cairo; namespace Crow { diff --git a/Crow/src/GraphicObjects/TextBox.cs b/Crow/src/GraphicObjects/TextBox.cs index 500a0a1a..71fd6205 100644 --- a/Crow/src/GraphicObjects/TextBox.cs +++ b/Crow/src/GraphicObjects/TextBox.cs @@ -25,7 +25,7 @@ // THE SOFTWARE. using System; -using Cairo; +using Crow.Cairo; using System.Diagnostics; using System.Xml.Serialization; diff --git a/Crow/src/GraphicObjects/TextRun.cs b/Crow/src/GraphicObjects/TextRun.cs index 6550411e..f784f90e 100644 --- a/Crow/src/GraphicObjects/TextRun.cs +++ b/Crow/src/GraphicObjects/TextRun.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; -using Cairo; +using Crow.Cairo; using System.Text.RegularExpressions; using System.Xml.Serialization; using System.ComponentModel; diff --git a/Crow/src/GraphicObjects/Trend.cs b/Crow/src/GraphicObjects/Trend.cs index 8fcd8830..b62fd2f2 100644 --- a/Crow/src/GraphicObjects/Trend.cs +++ b/Crow/src/GraphicObjects/Trend.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.ComponentModel; -using Cairo; +using Crow.Cairo; namespace Crow { diff --git a/Crow/src/GraphicObjects/Widget.cs b/Crow/src/GraphicObjects/Widget.cs index d2314138..d85ddfaa 100644 --- a/Crow/src/GraphicObjects/Widget.cs +++ b/Crow/src/GraphicObjects/Widget.cs @@ -31,7 +31,7 @@ using System.Xml.Serialization; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; -using Cairo; +using Crow.Cairo; using System.Diagnostics; using Crow.IML; using System.Threading; @@ -1007,7 +1007,7 @@ namespace Crow #if DEBUG_LOG DbgEvent dbgEvt = DebugLog.AddEvent(DbgEvtType.GOLockLayouting, this); #endif - lock (IFace.LayoutMutex) { + lock (IFace.UpdateMutex) { OnDataSourceChanged (this, dse); NotifyValueChanged ("DataSource", DataSource); } diff --git a/Crow/src/Interface.cs b/Crow/src/Interface.cs index 495ca23b..c4553066 100644 --- a/Crow/src/Interface.cs +++ b/Crow/src/Interface.cs @@ -32,7 +32,7 @@ using System.IO; using System.Linq; using System.Reflection; using System.Threading; -using Cairo; +using Crow.Cairo; using Crow.IML; @@ -62,37 +62,39 @@ namespace Crow /// The resulting surface (a byte array in the OpenTK renderer) is made available and protected with the /// RenderMutex of the interface. /// - public class Interface : ILayoutable, IDisposable ,IValueChange + public class Interface : ILayoutable, IDisposable, IValueChange { #region IValueChange implementation public event EventHandler ValueChanged; - public virtual void NotifyValueChanged(string MemberName, object _value) + public virtual void NotifyValueChanged (string MemberName, object _value) { //Debug.WriteLine ("Value changed: {0}->{1} = {2}", this, MemberName, _value); - ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value)); + ValueChanged.Raise (this, new ValueChangeEventArgs (MemberName, _value)); } #endregion - internal IBackend backend; + protected IBackend backend; + protected bool running; + #region CTOR - static Interface(){ + static Interface () { /*if (Type.GetType ("Mono.Runtime") == null) { throw new Exception (@"C.R.O.W. run only on Mono, download latest version at: http://www.mono-project.com/download/stable/"); }*/ CROW_CONFIG_ROOT = - System.IO.Path.Combine( - Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), + System.IO.Path.Combine ( + Environment.GetFolderPath (Environment.SpecialFolder.UserProfile), ".config"); CROW_CONFIG_ROOT = System.IO.Path.Combine (CROW_CONFIG_ROOT, "crow"); if (!Directory.Exists (CROW_CONFIG_ROOT)) Directory.CreateDirectory (CROW_CONFIG_ROOT); //ensure all assemblies are loaded, because IML could contains classes not instanciated in source - foreach (string af in Directory.GetFiles (AppDomain.CurrentDomain.BaseDirectory, "*.dll")){ + foreach (string af in Directory.GetFiles (AppDomain.CurrentDomain.BaseDirectory, "*.dll")) { try { - Assembly.LoadFrom (af); + Assembly.LoadFrom (af); } catch (Exception ex) { Console.WriteLine ("{0} not loaded as assembly.", af); } @@ -105,54 +107,70 @@ namespace Crow FontRenderingOptions.SubpixelOrder = SubpixelOrder.Default; } - public Interface(int width=800, int height=600){ - + public Interface(int width=800, int height=600, IBackend _backend = null){ + CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.InvariantCulture; + CurrentInterface = this; clientRectangle = new Rectangle (0, 0, width, height); + backend = _backend; - Init (); - - InitBackend (); + Thread t = new Thread (InterfaceThread) { + IsBackground = true + }; + t.Start (); +#if MEASURE_TIME + PerfMeasures.Add (updateMeasure); + PerfMeasures.Add (drawingMeasure); + PerfMeasures.Add (layoutingMeasure); + PerfMeasures.Add (clippingMeasure); +#endif } #endregion - protected bool running; - protected virtual void InitBackend () { - if (Environment.OSVersion.Platform == PlatformID.Unix) - backend = new Crow.XCB.XCBBackend(); - //backend = new Crow.XLib.XLibBackend (); - else - backend = new Crow.Win32.Win32Backend(); - + public virtual void InterfaceThread () + { + if (backend == null) { + if (Environment.OSVersion.Platform == PlatformID.Unix) + backend = new XCB.XCBBackend (); + else + backend = new Win32.Win32Backend (); + } + backend.Init (this); + while (!running) + Thread.Sleep (2); + + while (running) { + Update (); + Thread.Sleep (5); + } + } + protected virtual void Startup () + { + try { + Load ("#main.crow").DataSource = this; + } catch { } + } + public virtual void Run () { + loadStyling (); + initTooltip (); initContextMenus (); running = true; - Thread t = new Thread (interfaceThread); - t.IsBackground = true; - t.Start (); - } - public void Run () { Startup (); + while (running) { ProcessEvents (); Thread.Sleep(1); } } - protected virtual void Startup () - { - //load default main.crow if present - try { - Load ("#main.crow").DataSource = this; - } catch { } - } + public void ProcessKeyPress (char c) { _focusedWidget?.onKeyPress (_focusedWidget, new KeyPressEventArgs(c)); } - public void ProcessKeyUp (Key key) { _focusedWidget?.onKeyUp (_focusedWidget, new KeyEventArgs(key, false)); @@ -173,26 +191,16 @@ namespace Crow // keyboardRepeatThread.IsBackground = true; // keyboardRepeatThread.Start (); } - public bool Shift { get { return backend.Shift; } } - public bool Ctrl { get { return backend.Ctrl; } } - public bool Alt { get { return backend.Alt; } } - void interfaceThread() - { - while (running) { - Update (); - Thread.Sleep (5); - } - } #region IDisposable Support private bool disposedValue = false; // To detect redundant calls @@ -254,24 +262,10 @@ namespace Crow FocusedWidget = w; break; } - w = w.LogicalParent as Widget; + w = w.FocusParent; } } - public void Init () { - CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.InvariantCulture; - - CurrentInterface = this; - //loadCursors (); - loadStyling (); - - #if MEASURE_TIME - PerfMeasures.Add (updateMeasure); - PerfMeasures.Add (drawingMeasure); - PerfMeasures.Add (layoutingMeasure); - PerfMeasures.Add (clippingMeasure); - #endif - } #region Static and constants /// @@ -454,10 +448,10 @@ namespace Crow if (s == null) s = Assembly.GetAssembly (declaringType).GetManifestResourceStream (resId); if (s == null) - throw new Exception ($"Template not found '{path}'"); + throw new Exception ($"Template ressource not found '{path}'"); } else { if (!File.Exists (path)) - throw new FileNotFoundException ("Template not found: ", path); + throw new FileNotFoundException ($"Template not found: {path}", path); s = new FileStream (path, FileMode.Open, FileAccess.Read); } return s; @@ -481,7 +475,7 @@ namespace Crow throw new Exception ("Resource not found: " + path); } else { if (!File.Exists (path)) - throw new FileNotFoundException ("File not found: ", path); + throw new FileNotFoundException ($"File not found: {path}", path); stream = new FileStream (path, FileMode.Open, FileAccess.Read); } return stream; @@ -504,7 +498,7 @@ namespace Crow throw new Exception ("Resource not found: " + path); } else { if (!File.Exists (path)) - throw new FileNotFoundException ("File not found: ", path); + throw new FileNotFoundException ($"File not found: {path}", path); stream = new FileStream (path, FileMode.Open, FileAccess.Read); } return stream; @@ -700,7 +694,7 @@ namespace Crow /// - Drawing /// Result: the Interface bitmap is drawn in memory (byte[] bmp) and a dirtyRect and bitmap are available /// - public void Update(){ + public void Update(Context ctx = null){ CrowThread[] tmpThreads; lock (CrowThreads) { tmpThreads = new CrowThread[CrowThreads.Count]; @@ -734,11 +728,16 @@ namespace Crow clippingRegistration (); - processDrawing (); + if (ctx == null) { + using (ctx = new Context (surf)) { + processDrawing (ctx); + } + }else + processDrawing (ctx); - #if MEASURE_TIME +#if MEASURE_TIME updateMeasure.StopCycle(); - #endif +#endif Monitor.Exit (UpdateMutex); } @@ -800,7 +799,7 @@ namespace Crow } /// Clipping Rectangles drive the drawing process. For compositing, each object under a clip rectangle should be /// repainted. If it contains also clip rectangles, its cache will be update, or if not cached a full redraw will take place - void processDrawing(){ + void processDrawing(Context ctx){ #if MEASURE_TIME drawingMeasure.StartCycle(); #endif @@ -811,7 +810,6 @@ namespace Crow if (DragImage != null) clipping.UnionRectangle(new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight)); //using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) { - using (ctx = new Context (surf)){ if (!clipping.IsEmpty) { IsDirty = true; @@ -872,7 +870,7 @@ namespace Crow backend?.Flush (); } - } + /*#if DEBUG_LOG DebugLog.AddEvent (DbgEvtType.IFaceEndDrawing); #endif*/ @@ -1002,11 +1000,7 @@ namespace Crow /*surf.Dispose (); surf = new Cairo.XlibSurface (xHandle, xwinHnd, xDefaultVisual, clientRectangle.Width, clientRectangle.Height);*/ - if (surf is XlibSurface) - (surf as XlibSurface).SetSize (clientRectangle.Width, clientRectangle.Height); - else if (surf is XcbSurface) - (surf as XcbSurface).SetSize (clientRectangle.Width, clientRectangle.Height); - + surf.SetSize (clientRectangle.Width, clientRectangle.Height); foreach (Widget g in GraphicTree) g.RegisterForLayouting (LayoutingType.All); diff --git a/Crow/src/Mono.Cairo/Antialias.cs b/Crow/src/Mono.Cairo/Antialias.cs index 30c71c0f..64da6443 100644 --- a/Crow/src/Mono.Cairo/Antialias.cs +++ b/Crow/src/Mono.Cairo/Antialias.cs @@ -30,7 +30,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { public enum Antialias diff --git a/Crow/src/Mono.Cairo/Cairo.cs b/Crow/src/Mono.Cairo/Cairo.cs index c0a5f2ab..c32c00d8 100644 --- a/Crow/src/Mono.Cairo/Cairo.cs +++ b/Crow/src/Mono.Cairo/Cairo.cs @@ -1,4 +1,4 @@ -// +// // Cairo.cs - a simplistic binding of the Cairo API to C#. // // Authors: Duncan Mak (duncan@ximian.com) @@ -34,7 +34,7 @@ using System; using System.Runtime.InteropServices; -namespace Cairo +namespace Crow.Cairo { public static class CairoAPI { static public int Version { diff --git a/Crow/src/Mono.Cairo/CairoDebug.cs b/Crow/src/Mono.Cairo/CairoDebug.cs index d694bbb5..faff9338 100644 --- a/Crow/src/Mono.Cairo/CairoDebug.cs +++ b/Crow/src/Mono.Cairo/CairoDebug.cs @@ -28,7 +28,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { static class CairoDebug { diff --git a/Crow/src/Mono.Cairo/Content.cs b/Crow/src/Mono.Cairo/Content.cs index a45370ff..f14305a4 100644 --- a/Crow/src/Mono.Cairo/Content.cs +++ b/Crow/src/Mono.Cairo/Content.cs @@ -30,7 +30,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { //[Flags] diff --git a/Crow/src/Mono.Cairo/Context.cs b/Crow/src/Mono.Cairo/Context.cs index d428b42c..3259294f 100644 --- a/Crow/src/Mono.Cairo/Context.cs +++ b/Crow/src/Mono.Cairo/Context.cs @@ -1,4 +1,4 @@ -// +// // Mono.Cairo.Context.cs // // Author: @@ -39,7 +39,7 @@ using System.Runtime.InteropServices; using System.Text; using Color = Crow.Color; -namespace Cairo { +namespace Crow.Cairo { [Obsolete ("Renamed Cairo.Context per suggestion from cairo binding guidelines.")] public class Graphics : Context { diff --git a/Crow/src/Mono.Cairo/DRMDevice.cs b/Crow/src/Mono.Cairo/DRMDevice.cs index a03195fb..05e142cb 100644 --- a/Crow/src/Mono.Cairo/DRMDevice.cs +++ b/Crow/src/Mono.Cairo/DRMDevice.cs @@ -29,7 +29,7 @@ // using System; -namespace Cairo +namespace Crow.Cairo { public class DRMDevice : Device { diff --git a/Crow/src/Mono.Cairo/DRMSurface.cs b/Crow/src/Mono.Cairo/DRMSurface.cs index 248541c7..f624967f 100644 --- a/Crow/src/Mono.Cairo/DRMSurface.cs +++ b/Crow/src/Mono.Cairo/DRMSurface.cs @@ -30,7 +30,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public class DRMSurface : Surface { diff --git a/Crow/src/Mono.Cairo/Device.cs b/Crow/src/Mono.Cairo/Device.cs index a5452f9d..dc9910cb 100644 --- a/Crow/src/Mono.Cairo/Device.cs +++ b/Crow/src/Mono.Cairo/Device.cs @@ -29,7 +29,7 @@ // using System; -namespace Cairo +namespace Crow.Cairo { public class Device : IDisposable { diff --git a/Crow/src/Mono.Cairo/DirectFBSurface.cs b/Crow/src/Mono.Cairo/DirectFBSurface.cs index afa57b7d..64431574 100644 --- a/Crow/src/Mono.Cairo/DirectFBSurface.cs +++ b/Crow/src/Mono.Cairo/DirectFBSurface.cs @@ -28,7 +28,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public class DirectFBSurface : Surface { internal DirectFBSurface (IntPtr handle, bool owns) : base (handle, owns) diff --git a/Crow/src/Mono.Cairo/Distance.cs b/Crow/src/Mono.Cairo/Distance.cs index 7cba3729..d716ab1f 100644 --- a/Crow/src/Mono.Cairo/Distance.cs +++ b/Crow/src/Mono.Cairo/Distance.cs @@ -34,7 +34,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -namespace Cairo { +namespace Crow.Cairo { public struct Distance { diff --git a/Crow/src/Mono.Cairo/EGLDevice.cs b/Crow/src/Mono.Cairo/EGLDevice.cs index 45c988a3..44590c70 100644 --- a/Crow/src/Mono.Cairo/EGLDevice.cs +++ b/Crow/src/Mono.Cairo/EGLDevice.cs @@ -29,7 +29,7 @@ // using System; -namespace Cairo +namespace Crow.Cairo { public class EGLDevice : Device { diff --git a/Crow/src/Mono.Cairo/Extend.cs b/Crow/src/Mono.Cairo/Extend.cs index 1135c2ff..4af536dc 100644 --- a/Crow/src/Mono.Cairo/Extend.cs +++ b/Crow/src/Mono.Cairo/Extend.cs @@ -32,7 +32,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { public enum Extend diff --git a/Crow/src/Mono.Cairo/FillRule.cs b/Crow/src/Mono.Cairo/FillRule.cs index 24cbfba2..80f61ed5 100644 --- a/Crow/src/Mono.Cairo/FillRule.cs +++ b/Crow/src/Mono.Cairo/FillRule.cs @@ -30,7 +30,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { public enum FillRule diff --git a/Crow/src/Mono.Cairo/Filter.cs b/Crow/src/Mono.Cairo/Filter.cs index 2355fbb3..a73ea58d 100644 --- a/Crow/src/Mono.Cairo/Filter.cs +++ b/Crow/src/Mono.Cairo/Filter.cs @@ -30,7 +30,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { public enum Filter diff --git a/Crow/src/Mono.Cairo/FontExtents.cs b/Crow/src/Mono.Cairo/FontExtents.cs index 76c7e658..ea26d9bb 100644 --- a/Crow/src/Mono.Cairo/FontExtents.cs +++ b/Crow/src/Mono.Cairo/FontExtents.cs @@ -34,7 +34,7 @@ using System; using System.Runtime.InteropServices; -namespace Cairo +namespace Crow.Cairo { [StructLayout (LayoutKind.Sequential)] public struct FontExtents diff --git a/Crow/src/Mono.Cairo/FontFace.cs b/Crow/src/Mono.Cairo/FontFace.cs index 19d8163c..64c428e2 100644 --- a/Crow/src/Mono.Cairo/FontFace.cs +++ b/Crow/src/Mono.Cairo/FontFace.cs @@ -32,7 +32,7 @@ // using System; -namespace Cairo +namespace Crow.Cairo { public class FontFace : IDisposable { diff --git a/Crow/src/Mono.Cairo/FontOptions.cs b/Crow/src/Mono.Cairo/FontOptions.cs index 5269d54d..f90a3a4d 100644 --- a/Crow/src/Mono.Cairo/FontOptions.cs +++ b/Crow/src/Mono.Cairo/FontOptions.cs @@ -28,7 +28,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { public class FontOptions : IDisposable { diff --git a/Crow/src/Mono.Cairo/FontSlant.cs b/Crow/src/Mono.Cairo/FontSlant.cs index b7a5684c..b3d8a1a2 100644 --- a/Crow/src/Mono.Cairo/FontSlant.cs +++ b/Crow/src/Mono.Cairo/FontSlant.cs @@ -30,7 +30,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { public enum FontSlant diff --git a/Crow/src/Mono.Cairo/FontType.cs b/Crow/src/Mono.Cairo/FontType.cs index e9fd263a..5db44d4e 100644 --- a/Crow/src/Mono.Cairo/FontType.cs +++ b/Crow/src/Mono.Cairo/FontType.cs @@ -28,7 +28,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public enum FontType diff --git a/Crow/src/Mono.Cairo/FontWeight.cs b/Crow/src/Mono.Cairo/FontWeight.cs index 5b781095..0b8fc6a8 100644 --- a/Crow/src/Mono.Cairo/FontWeight.cs +++ b/Crow/src/Mono.Cairo/FontWeight.cs @@ -30,7 +30,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { public enum FontWeight diff --git a/Crow/src/Mono.Cairo/Format.cs b/Crow/src/Mono.Cairo/Format.cs index 96e9a0f5..54c8be1e 100644 --- a/Crow/src/Mono.Cairo/Format.cs +++ b/Crow/src/Mono.Cairo/Format.cs @@ -29,7 +29,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { public enum Format diff --git a/Crow/src/Mono.Cairo/GLSurface.cs b/Crow/src/Mono.Cairo/GLSurface.cs index 9486c9cd..60384b02 100644 --- a/Crow/src/Mono.Cairo/GLSurface.cs +++ b/Crow/src/Mono.Cairo/GLSurface.cs @@ -1,4 +1,4 @@ -// +// // Mono.Cairo.GLSurface.cs // // Authors: @@ -30,7 +30,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public class GLSurface : Surface { diff --git a/Crow/src/Mono.Cairo/GLXDevice.cs b/Crow/src/Mono.Cairo/GLXDevice.cs index 189872a2..00cbce1f 100644 --- a/Crow/src/Mono.Cairo/GLXDevice.cs +++ b/Crow/src/Mono.Cairo/GLXDevice.cs @@ -29,7 +29,7 @@ // using System; -namespace Cairo +namespace Crow.Cairo { public class GLXDevice : Device { diff --git a/Crow/src/Mono.Cairo/GlitzSurface.cs b/Crow/src/Mono.Cairo/GlitzSurface.cs index 6da1ac6a..4aa24983 100644 --- a/Crow/src/Mono.Cairo/GlitzSurface.cs +++ b/Crow/src/Mono.Cairo/GlitzSurface.cs @@ -28,7 +28,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public class GlitzSurface : Surface { internal GlitzSurface (IntPtr handle, bool owns) : base (handle, owns) diff --git a/Crow/src/Mono.Cairo/Glyph.cs b/Crow/src/Mono.Cairo/Glyph.cs index ec9c2ff3..ad511562 100644 --- a/Crow/src/Mono.Cairo/Glyph.cs +++ b/Crow/src/Mono.Cairo/Glyph.cs @@ -30,7 +30,7 @@ using System; using System.Runtime.InteropServices; -namespace Cairo +namespace Crow.Cairo { [StructLayout(LayoutKind.Sequential)] public struct Glyph diff --git a/Crow/src/Mono.Cairo/Gradient.cs b/Crow/src/Mono.Cairo/Gradient.cs index c7bc53c6..427cc053 100644 --- a/Crow/src/Mono.Cairo/Gradient.cs +++ b/Crow/src/Mono.Cairo/Gradient.cs @@ -29,7 +29,7 @@ using System; using Color = Crow.Color; -namespace Cairo { +namespace Crow.Cairo { public class Gradient : Pattern { diff --git a/Crow/src/Mono.Cairo/HintMetrics.cs b/Crow/src/Mono.Cairo/HintMetrics.cs index 3bf01d23..d830f3eb 100644 --- a/Crow/src/Mono.Cairo/HintMetrics.cs +++ b/Crow/src/Mono.Cairo/HintMetrics.cs @@ -29,7 +29,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { public enum HintMetrics diff --git a/Crow/src/Mono.Cairo/HintStyle.cs b/Crow/src/Mono.Cairo/HintStyle.cs index b8cca974..343daf3e 100644 --- a/Crow/src/Mono.Cairo/HintStyle.cs +++ b/Crow/src/Mono.Cairo/HintStyle.cs @@ -29,7 +29,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { public enum HintStyle diff --git a/Crow/src/Mono.Cairo/ImageSurface.cs b/Crow/src/Mono.Cairo/ImageSurface.cs index 98143fe8..1dd83296 100644 --- a/Crow/src/Mono.Cairo/ImageSurface.cs +++ b/Crow/src/Mono.Cairo/ImageSurface.cs @@ -1,4 +1,4 @@ -// +// // Mono.Cairo.ImageSurface.cs // // Authors: @@ -35,7 +35,7 @@ using System; using System.Runtime.InteropServices; -namespace Cairo { +namespace Crow.Cairo { public class ImageSurface : Surface { diff --git a/Crow/src/Mono.Cairo/LineCap.cs b/Crow/src/Mono.Cairo/LineCap.cs index 46938c25..1560cda4 100644 --- a/Crow/src/Mono.Cairo/LineCap.cs +++ b/Crow/src/Mono.Cairo/LineCap.cs @@ -29,7 +29,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { public enum LineCap diff --git a/Crow/src/Mono.Cairo/LineJoin.cs b/Crow/src/Mono.Cairo/LineJoin.cs index b5c241b0..1d5389b5 100644 --- a/Crow/src/Mono.Cairo/LineJoin.cs +++ b/Crow/src/Mono.Cairo/LineJoin.cs @@ -29,7 +29,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { public enum LineJoin diff --git a/Crow/src/Mono.Cairo/LinearGradient.cs b/Crow/src/Mono.Cairo/LinearGradient.cs index 85fdea84..100d1e6d 100644 --- a/Crow/src/Mono.Cairo/LinearGradient.cs +++ b/Crow/src/Mono.Cairo/LinearGradient.cs @@ -29,7 +29,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public class LinearGradient : Gradient { diff --git a/Crow/src/Mono.Cairo/Matrix.cs b/Crow/src/Mono.Cairo/Matrix.cs index 12f0cb92..7d5a6acd 100644 --- a/Crow/src/Mono.Cairo/Matrix.cs +++ b/Crow/src/Mono.Cairo/Matrix.cs @@ -1,4 +1,4 @@ -// +// // Mono.Cairo.Matrix.cs // // Author: Duncan Mak @@ -34,7 +34,7 @@ using System; using System.Runtime.InteropServices; -namespace Cairo { +namespace Crow.Cairo { [StructLayout(LayoutKind.Sequential)] public class Matrix //: ICloneable diff --git a/Crow/src/Mono.Cairo/MeshPattern.cs b/Crow/src/Mono.Cairo/MeshPattern.cs index b14c709b..96bc3c85 100644 --- a/Crow/src/Mono.Cairo/MeshPattern.cs +++ b/Crow/src/Mono.Cairo/MeshPattern.cs @@ -29,7 +29,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public class MeshPattern : Pattern { diff --git a/Crow/src/Mono.Cairo/NativeMethods.cs b/Crow/src/Mono.Cairo/NativeMethods.cs index 8ed90290..1b423209 100644 --- a/Crow/src/Mono.Cairo/NativeMethods.cs +++ b/Crow/src/Mono.Cairo/NativeMethods.cs @@ -1,4 +1,4 @@ -// +// // Cairo.cs - a simplistic binding of the Cairo API to C#. // // Authors: Duncan Mak (duncan@ximian.com) @@ -34,7 +34,7 @@ using System; using System.Runtime.InteropServices; -namespace Cairo +namespace Crow.Cairo { // sort the functions like in the following page so it is easier to find what is missing // http://cairographics.org/manual/index-all.html diff --git a/Crow/src/Mono.Cairo/Operator.cs b/Crow/src/Mono.Cairo/Operator.cs index f233a25f..1c11cccc 100644 --- a/Crow/src/Mono.Cairo/Operator.cs +++ b/Crow/src/Mono.Cairo/Operator.cs @@ -31,7 +31,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { public enum Operator diff --git a/Crow/src/Mono.Cairo/PSSurface.cs b/Crow/src/Mono.Cairo/PSSurface.cs index 9d6b73be..cf90794e 100644 --- a/Crow/src/Mono.Cairo/PSSurface.cs +++ b/Crow/src/Mono.Cairo/PSSurface.cs @@ -28,7 +28,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public class PSSurface : Surface { diff --git a/Crow/src/Mono.Cairo/Path.cs b/Crow/src/Mono.Cairo/Path.cs index 184c606c..a55f03b0 100644 --- a/Crow/src/Mono.Cairo/Path.cs +++ b/Crow/src/Mono.Cairo/Path.cs @@ -30,9 +30,9 @@ using System; using System.Runtime.InteropServices; -using Cairo; +using Crow.Cairo; -namespace Cairo { +namespace Crow.Cairo { public class Path : IDisposable { diff --git a/Crow/src/Mono.Cairo/Pattern.cs b/Crow/src/Mono.Cairo/Pattern.cs index bc0a962a..3e933a19 100644 --- a/Crow/src/Mono.Cairo/Pattern.cs +++ b/Crow/src/Mono.Cairo/Pattern.cs @@ -30,7 +30,7 @@ using System; using System.Collections; -namespace Cairo { +namespace Crow.Cairo { public class Pattern : IDisposable { diff --git a/Crow/src/Mono.Cairo/PatternType.cs b/Crow/src/Mono.Cairo/PatternType.cs index f9b9523a..deac3ab7 100644 --- a/Crow/src/Mono.Cairo/PatternType.cs +++ b/Crow/src/Mono.Cairo/PatternType.cs @@ -28,7 +28,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public enum PatternType diff --git a/Crow/src/Mono.Cairo/PdfSurface.cs b/Crow/src/Mono.Cairo/PdfSurface.cs index c980f249..09a2d126 100644 --- a/Crow/src/Mono.Cairo/PdfSurface.cs +++ b/Crow/src/Mono.Cairo/PdfSurface.cs @@ -28,7 +28,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public class PdfSurface : Surface { diff --git a/Crow/src/Mono.Cairo/Point.cs b/Crow/src/Mono.Cairo/Point.cs index e72ca6c5..cf07f311 100644 --- a/Crow/src/Mono.Cairo/Point.cs +++ b/Crow/src/Mono.Cairo/Point.cs @@ -34,7 +34,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -namespace Cairo { +namespace Crow.Cairo { public struct Point { public Point (int x, int y) diff --git a/Crow/src/Mono.Cairo/PointD.cs b/Crow/src/Mono.Cairo/PointD.cs index c2e3587d..8bc019c9 100644 --- a/Crow/src/Mono.Cairo/PointD.cs +++ b/Crow/src/Mono.Cairo/PointD.cs @@ -34,7 +34,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -namespace Cairo { +namespace Crow.Cairo { public struct PointD { diff --git a/Crow/src/Mono.Cairo/RadialGradient.cs b/Crow/src/Mono.Cairo/RadialGradient.cs index 6422e00d..6abe2671 100644 --- a/Crow/src/Mono.Cairo/RadialGradient.cs +++ b/Crow/src/Mono.Cairo/RadialGradient.cs @@ -29,7 +29,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public class RadialGradient : Gradient { diff --git a/Crow/src/Mono.Cairo/Region.cs b/Crow/src/Mono.Cairo/Region.cs index 4a82842a..5e8d8d60 100644 --- a/Crow/src/Mono.Cairo/Region.cs +++ b/Crow/src/Mono.Cairo/Region.cs @@ -23,7 +23,7 @@ using System; using System.Runtime.InteropServices; -namespace Cairo +namespace Crow.Cairo { [StructLayout(LayoutKind.Sequential)] public struct RectangleList { diff --git a/Crow/src/Mono.Cairo/ScaledFont.cs b/Crow/src/Mono.Cairo/ScaledFont.cs index 93719460..594d1be9 100644 --- a/Crow/src/Mono.Cairo/ScaledFont.cs +++ b/Crow/src/Mono.Cairo/ScaledFont.cs @@ -26,7 +26,7 @@ using System; using System.Runtime.InteropServices; -namespace Cairo { +namespace Crow.Cairo { public class ScaledFont : IDisposable { diff --git a/Crow/src/Mono.Cairo/SolidPattern.cs b/Crow/src/Mono.Cairo/SolidPattern.cs index 37864e5b..6cd89f85 100644 --- a/Crow/src/Mono.Cairo/SolidPattern.cs +++ b/Crow/src/Mono.Cairo/SolidPattern.cs @@ -29,7 +29,7 @@ using System; using Color = Crow.Color; -namespace Cairo { +namespace Crow.Cairo { public class SolidPattern : Pattern { diff --git a/Crow/src/Mono.Cairo/Status.cs b/Crow/src/Mono.Cairo/Status.cs index 54b2fec3..2df15580 100644 --- a/Crow/src/Mono.Cairo/Status.cs +++ b/Crow/src/Mono.Cairo/Status.cs @@ -32,7 +32,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { public enum Status diff --git a/Crow/src/Mono.Cairo/SubpixelOrder.cs b/Crow/src/Mono.Cairo/SubpixelOrder.cs index 3c3a3362..95f3cbee 100644 --- a/Crow/src/Mono.Cairo/SubpixelOrder.cs +++ b/Crow/src/Mono.Cairo/SubpixelOrder.cs @@ -28,7 +28,7 @@ using System; -namespace Cairo +namespace Crow.Cairo { public enum SubpixelOrder diff --git a/Crow/src/Mono.Cairo/Surface.cs b/Crow/src/Mono.Cairo/Surface.cs index 14f4a2b1..70821435 100644 --- a/Crow/src/Mono.Cairo/Surface.cs +++ b/Crow/src/Mono.Cairo/Surface.cs @@ -1,4 +1,4 @@ -// +// // Mono.Cairo.Surface.cs // // Authors: @@ -36,7 +36,7 @@ using System; using System.Collections; -namespace Cairo { +namespace Crow.Cairo { public class Surface : IDisposable { diff --git a/Crow/src/Mono.Cairo/SurfacePattern.cs b/Crow/src/Mono.Cairo/SurfacePattern.cs index 4422b11d..53a90d38 100644 --- a/Crow/src/Mono.Cairo/SurfacePattern.cs +++ b/Crow/src/Mono.Cairo/SurfacePattern.cs @@ -29,7 +29,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public class SurfacePattern : Pattern { diff --git a/Crow/src/Mono.Cairo/SurfaceType.cs b/Crow/src/Mono.Cairo/SurfaceType.cs index b0b659c6..bd992db0 100644 --- a/Crow/src/Mono.Cairo/SurfaceType.cs +++ b/Crow/src/Mono.Cairo/SurfaceType.cs @@ -28,7 +28,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public enum SurfaceType diff --git a/Crow/src/Mono.Cairo/SvgSurface.cs b/Crow/src/Mono.Cairo/SvgSurface.cs index 41829501..c7d72988 100644 --- a/Crow/src/Mono.Cairo/SvgSurface.cs +++ b/Crow/src/Mono.Cairo/SvgSurface.cs @@ -28,7 +28,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public class SvgSurface : Surface { diff --git a/Crow/src/Mono.Cairo/SvgVersion.cs b/Crow/src/Mono.Cairo/SvgVersion.cs index 7f0f4620..916fb861 100644 --- a/Crow/src/Mono.Cairo/SvgVersion.cs +++ b/Crow/src/Mono.Cairo/SvgVersion.cs @@ -28,7 +28,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public enum SvgVersion diff --git a/Crow/src/Mono.Cairo/TextExtents.cs b/Crow/src/Mono.Cairo/TextExtents.cs index f9cd560f..965ca046 100644 --- a/Crow/src/Mono.Cairo/TextExtents.cs +++ b/Crow/src/Mono.Cairo/TextExtents.cs @@ -31,7 +31,7 @@ using System; using System.Runtime.InteropServices; -namespace Cairo +namespace Crow.Cairo { [StructLayout (LayoutKind.Sequential)] public struct TextExtents diff --git a/Crow/src/Mono.Cairo/WGLDevice.cs b/Crow/src/Mono.Cairo/WGLDevice.cs index 03f7e3a4..308cfadd 100644 --- a/Crow/src/Mono.Cairo/WGLDevice.cs +++ b/Crow/src/Mono.Cairo/WGLDevice.cs @@ -29,7 +29,7 @@ // using System; -namespace Cairo +namespace Crow.Cairo { public class WGLDevice : Device { diff --git a/Crow/src/Mono.Cairo/Win32Surface.cs b/Crow/src/Mono.Cairo/Win32Surface.cs index dd244286..4776a19b 100644 --- a/Crow/src/Mono.Cairo/Win32Surface.cs +++ b/Crow/src/Mono.Cairo/Win32Surface.cs @@ -28,7 +28,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public class Win32Surface : Surface { diff --git a/Crow/src/Mono.Cairo/XcbSurface.cs b/Crow/src/Mono.Cairo/XcbSurface.cs index 340b0fae..32a67848 100644 --- a/Crow/src/Mono.Cairo/XcbSurface.cs +++ b/Crow/src/Mono.Cairo/XcbSurface.cs @@ -28,7 +28,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public class XcbSurface : Surface { internal XcbSurface (IntPtr handle, bool owns) : base (handle, owns) diff --git a/Crow/src/Mono.Cairo/XlibSurface.cs b/Crow/src/Mono.Cairo/XlibSurface.cs index c0003a49..30b56f04 100644 --- a/Crow/src/Mono.Cairo/XlibSurface.cs +++ b/Crow/src/Mono.Cairo/XlibSurface.cs @@ -34,7 +34,7 @@ using System; -namespace Cairo { +namespace Crow.Cairo { public class XlibSurface : Surface { @@ -58,7 +58,7 @@ namespace Cairo { NativeMethods.cairo_xlib_surface_set_drawable (Handle, drawable, width, height); } - public void SetSize (int width, int height) + public override void SetSize (int width, int height) { NativeMethods.cairo_xlib_surface_set_size (Handle, width, height); } diff --git a/Crow/src/Picture.cs b/Crow/src/Picture.cs index f2f45261..133bc4ef 100644 --- a/Crow/src/Picture.cs +++ b/Crow/src/Picture.cs @@ -26,7 +26,7 @@ using System; using System.IO; -using Cairo; +using Crow.Cairo; using System.Collections.Generic; namespace Crow diff --git a/Crow/src/SolidColor.cs b/Crow/src/SolidColor.cs index d6423d31..f14c7cf7 100644 --- a/Crow/src/SolidColor.cs +++ b/Crow/src/SolidColor.cs @@ -31,7 +31,7 @@ using System.Text; using System.Xml.Serialization; using System.Reflection; using System.Diagnostics; -using Cairo; +using Crow.Cairo; diff --git a/Crow/src/SvgPicture.cs b/Crow/src/SvgPicture.cs index dee6c8e0..33f68955 100644 --- a/Crow/src/SvgPicture.cs +++ b/Crow/src/SvgPicture.cs @@ -26,7 +26,7 @@ using System; using System.IO; -using Cairo; +using Crow.Cairo; namespace Crow { diff --git a/Crow/src/backends/win32/WinBackend.cs b/Crow/src/backends/win32/WinBackend.cs old mode 100755 new mode 100644 diff --git a/Crow/src/debug/DbgEventTypeColors.cs b/Crow/src/debug/DbgEventTypeColors.cs index e0881182..1936704e 100644 --- a/Crow/src/debug/DbgEventTypeColors.cs +++ b/Crow/src/debug/DbgEventTypeColors.cs @@ -24,7 +24,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; -using Cairo; +using Crow.Cairo; using System.Linq; namespace Crow diff --git a/Crow/src/debug/DbgLogViewer.cs b/Crow/src/debug/DbgLogViewer.cs index c10cfdf6..4ff6082e 100644 --- a/Crow/src/debug/DbgLogViewer.cs +++ b/Crow/src/debug/DbgLogViewer.cs @@ -27,7 +27,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using Cairo; +using Crow.Cairo; #if DEBUG_LOG namespace Crow diff --git a/Crow/src/debug/DebugLogger.cs b/Crow/src/debug/DebugLogger.cs index 38cbc2af..f1eaf9c8 100644 --- a/Crow/src/debug/DebugLogger.cs +++ b/Crow/src/debug/DebugLogger.cs @@ -24,7 +24,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; -using Cairo; +using Crow.Cairo; using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/Crow/src/rsvg/Handle.cs b/Crow/src/rsvg/Handle.cs index e13f79ad..26e7869c 100644 --- a/Crow/src/rsvg/Handle.cs +++ b/Crow/src/rsvg/Handle.cs @@ -1,5 +1,5 @@ -//Copyright GPL2 -using Cairo; +//Copyright GPL2 +using Crow.Cairo; namespace Rsvg { @@ -108,7 +108,7 @@ namespace Rsvg { [DllImport("rsvg-2")] static extern void rsvg_handle_render_cairo_sub(IntPtr raw, IntPtr cr, string id); - public void RenderCairoSub(Cairo.Context cr, string id) { + public void RenderCairoSub(Crow.Cairo.Context cr, string id) { rsvg_handle_render_cairo_sub(Raw, cr == null ? IntPtr.Zero : cr.Handle, id); } diff --git a/Samples/HelloWorld/main.cs b/Samples/HelloWorld/main.cs index a9d48fc9..14a1a2ad 100644 --- a/Samples/HelloWorld/main.cs +++ b/Samples/HelloWorld/main.cs @@ -1,13 +1,42 @@ -using Crow; +using System; +using Crow; namespace HelloWorld { class Program : Interface { + Command CMDQuit; static void Main (string[] args) { using (Program vke = new Program ()) { - vke.Load ("#HelloWorld.helloworld.crow"); vke.Run (); } } + protected override void Startup () + { + CMDQuit = new Command (new Action (() => running = false)) { Caption = "Quit", Icon = new SvgPicture ("#Crow.Icons.exit-symbol.svg") }; + + Widget w = Load ("#HelloWorld.helloworld.crow"); + w.KeyPress += W_KeyPress; + w.DataSource = this; + } + + Color [] colors = { Color.Blue, Color.DarkGoldenRod, Color.Red, Color.Azure, Color.Brown, Color.Black, Color.White, Color.Pink }; + int ptr = 0; + + void W_KeyPress (object sender, KeyPressEventArgs e) + { + switch (e.KeyChar) { + case 'w': + LoadIMLFragment ($""); + break; + case 'x': + LoadIMLFragment ($""); + break; + } + + ptr++; + if (ptr == colors.Length) + ptr = 0; + } + } } diff --git a/Samples/ShowCase/main.cs b/Samples/ShowCase/main.cs index c6ffc408..a2b263fe 100644 --- a/Samples/ShowCase/main.cs +++ b/Samples/ShowCase/main.cs @@ -45,18 +45,22 @@ namespace tests using (Showcase app = new Showcase ()) { //app.Keyboard.KeyDown += App_KeyboardKeyDown; - Widget g = app.Load ("#ShowCase.showcase.crow"); - g.DataSource = app; - app.crowContainer = g.FindByName ("CrowContainer") as Container; - //I set an empty object as datasource at this level to force update when new - //widgets are added to the interface - app.crowContainer.DataSource = new object (); - app.hideError (); app.Run (); } } + protected override void Startup () + { + Widget g = Load ("#ShowCase.showcase.crow"); + g.DataSource = this; + crowContainer = g.FindByName ("CrowContainer") as Container; + //I set an empty object as datasource at this level to force update when new + //widgets are added to the interface + crowContainer.DataSource = new object (); + hideError (); + } + static void App_KeyboardKeyDown (object sender, KeyEventArgs e) { #if DEBUG_LOG diff --git a/Samples/common/ui/Interfaces/Container/1.crow b/Samples/common/ui/Interfaces/Container/1.crow index 19af5237..df935b1d 100755 --- a/Samples/common/ui/Interfaces/Container/1.crow +++ b/Samples/common/ui/Interfaces/Container/1.crow @@ -1,5 +1,5 @@  - - + \ No newline at end of file diff --git a/Samples/common/ui/Interfaces/Container/3.crow b/Samples/common/ui/Interfaces/Container/3.crow index 94655ca3..5ca515a8 100755 --- a/Samples/common/ui/Interfaces/Container/3.crow +++ b/Samples/common/ui/Interfaces/Container/3.crow @@ -1,4 +1,4 @@  - -