<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<WarningLevel>4</WarningLevel>
<NoWin32Manifest>False</NoWin32Manifest>
<SignAssembly>true</SignAssembly>
- <DelaySign>False</DelaySign>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<Description>C# Rapid Open Widget</Description>
<IntermediateOutputPath>$(SolutionDir)build\obj\$(Configuration)</IntermediateOutputPath>
<AssemblyOriginatorKeyFile>crow.key</AssemblyOriginatorKeyFile>
<ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
<ReleaseVersion>0.5</ReleaseVersion>
+ <UseMSBuildEngine>false</UseMSBuildEngine>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
- <DefineConstants>DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_LAYOUTING0;TRACE0;DEBUG;__linux__;MEASURE_TIME0;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
+ <DefineConstants>DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_LAYOUTING0;TRACE0;DEBUG0;__linux__;MEASURE_TIME0;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<dllmap os="!windows,osx" dll="libgobject-2.0-0.dll" target="libgobject-2.0.so.0"/>
<dllmap os="!windows,osx" dll="libgdk-3-0.dll" target="libgdk-3.so.0"/>
<dllmap os="!windows,osx" dll="libgdk_pixbuf-2.0-0.dll" target="libgdk_pixbuf-2.0.so.0"/>
- <dllmap os="!windows,osx" dll="rsvg-2" target="librsvg-2.so.2"/>
+ <dllmap os="!windows,osx" dll="rsvg" target="librsvg-2.so.2"/>
<dllmap os="windows" dll="rsvg-2" target="librsvg-2-2.dll"/>
<dllmap os="osx" dll="libgdk-3.0.dll" target="libgdk-quartz-3.0.0.dylib"/>
<dllmap os="osx" dll="libgdk_pixbuf-2.0-0.dll" target="libgdk_pixbuf-2.0.0.dylib"/>
</configuration>
+
\ No newline at end of file
/// <param name="methodName">Extention method name</param>
internal static MethodInfo SearchExtMethod(Type t, string methodName){
MethodInfo mi = null;
- mi = GetExtensionMethods (Assembly.GetEntryAssembly(), t)
- .Where (em => em.Name == methodName).FirstOrDefault ();
+ Assembly entryAss = Assembly.GetEntryAssembly ();
+ if (entryAss!=null)
+ mi = GetExtensionMethods (entryAss, t)
+ .Where (em => em.Name == methodName).FirstOrDefault ();
if (mi != null)
return mi;
static Dictionary<string, ConfigItem> items;
static Configuration ()
- {
+ {
items = new Dictionary<string, ConfigItem> ();
string configRoot =
Path.Combine(
--- /dev/null
+//
+// ILayoutable.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+// Copyright (c) 2013-2017 Jean-Philippe Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Collections.Generic;
+
+namespace Crow
+{
+ public class Layoutable
+ {
+ /// <summary> Parent in the graphic tree </summary>
+ Layoutable Parent { get; set; }
+ /// <summary> The logical parent (used mainly for bindings) as opposed
+ /// to the parent in the graphic tree </summary>
+ Layoutable LogicalParent { get; set; }
+
+ Rectangle ClientRectangle { get; }
+ Rectangle getSlot();
+
+ bool ArrangeChildren { get; }
+ LayoutingType RegisteredLayoutings { get; set; }
+ void RegisterForLayouting(LayoutingType layoutType);
+ void RegisterClip(Rectangle clip);
+ bool UpdateLayout(LayoutingType layoutType);
+
+
+ Rectangle ContextCoordinates(Rectangle r);
+ Rectangle ScreenCoordinates (Rectangle r);
+
+ }
+}
+
namespace Crow
{
+ //TODO: I'm waiting c#8 for default interface members implementation to set NumericControl and other widget base
+ //mecanics as interface to allow multiple inheritance.
public abstract class NumericControl : TemplatedControl
{
#region CTOR
ctx.il.Emit (OpCodes.Ldloc_0);
ctx.il.Emit (OpCodes.Ldloc_0);
+ //TODO: optimize this
Type t = Type.GetType ("Crow." + reader.Name);
if (t == null) {
- Assembly a = Assembly.GetEntryAssembly ();
- foreach (Type expT in a.GetExportedTypes ()) {
+ Assembly ea = Assembly.GetEntryAssembly ();
+ foreach (Type expT in ea.GetExportedTypes ()) {
if (expT.Name == reader.Name) {
t = expT;
break;
}
}
+ if (t == null) {
+ foreach (AssemblyName an in Assembly.GetEntryAssembly().GetReferencedAssemblies()) {
+ Assembly a = Assembly.Load (an);
+ foreach (Type expT in a.GetExportedTypes ()) {
+ if (expT.Name == reader.Name) {
+ t = expT;
+ break;
+ }
+ }
+ if (t != null)
+ break;
+ }
+ }
}
if (t == null)
throw new Exception (reader.Name + " type not found");
/// - the resulting bitmap of the interface
/// </summary>
public class Interface : ILayoutable
- {
+ {
#region CTOR
static Interface(){
loadCursors ();
FontRenderingOptions.SubpixelOrder = SubpixelOrder.Rgb;
}
public Interface(){
+ Console.WriteLine ("Interface CTOR");
CurrentInterface = this;
CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
}
}
/// <summary> Search for .style resources in assembly </summary>
static void loadStylingFromAssembly (Assembly assembly) {
+ if (assembly == null)
+ return;
foreach (string s in assembly
.GetManifestResourceNames ()
.Where (r => r.EndsWith (".style", StringComparison.OrdinalIgnoreCase))) {
}
static void loadCursors(){
//Load cursors
- XCursor.Cross = XCursorFile.Load("#Crow.Images.Icons.Cursors.cross").Cursors[0];
- XCursor.Default = XCursorFile.Load("#Crow.Images.Icons.Cursors.arrow").Cursors[0];
- XCursor.NW = XCursorFile.Load("#Crow.Images.Icons.Cursors.top_left_corner").Cursors[0];
- XCursor.NE = XCursorFile.Load("#Crow.Images.Icons.Cursors.top_right_corner").Cursors[0];
- XCursor.SW = XCursorFile.Load("#Crow.Images.Icons.Cursors.bottom_left_corner").Cursors[0];
- XCursor.SE = XCursorFile.Load("#Crow.Images.Icons.Cursors.bottom_right_corner").Cursors[0];
- XCursor.H = XCursorFile.Load("#Crow.Images.Icons.Cursors.sb_h_double_arrow").Cursors[0];
- XCursor.V = XCursorFile.Load("#Crow.Images.Icons.Cursors.sb_v_double_arrow").Cursors[0];
- XCursor.Text = XCursorFile.Load("#Crow.Images.Icons.Cursors.ibeam").Cursors[0];
+ XCursor.Cross = XCursorFile.Load ("#Crow.Images.Icons.Cursors.cross").Cursors [0];
+ XCursor.Default = XCursorFile.Load ("#Crow.Images.Icons.Cursors.arrow").Cursors [0];
+ XCursor.NW = XCursorFile.Load ("#Crow.Images.Icons.Cursors.top_left_corner").Cursors [0];
+ XCursor.NE = XCursorFile.Load ("#Crow.Images.Icons.Cursors.top_right_corner").Cursors [0];
+ XCursor.SW = XCursorFile.Load ("#Crow.Images.Icons.Cursors.bottom_left_corner").Cursors [0];
+ XCursor.SE = XCursorFile.Load ("#Crow.Images.Icons.Cursors.bottom_right_corner").Cursors [0];
+ XCursor.H = XCursorFile.Load ("#Crow.Images.Icons.Cursors.sb_h_double_arrow").Cursors [0];
+ XCursor.V = XCursorFile.Load ("#Crow.Images.Icons.Cursors.sb_v_double_arrow").Cursors [0];
+ XCursor.Text = XCursorFile.Load ("#Crow.Images.Icons.Cursors.ibeam").Cursors [0];
}
#endregion
searchTemplatesIn (Assembly.GetExecutingAssembly ());
}
static void searchTemplatesIn(Assembly assembly){
+ if (assembly == null)
+ return;
foreach (string resId in assembly
.GetManifestResourceNames ()
.Where (r => r.EndsWith (".template", StringComparison.OrdinalIgnoreCase))) {
public static Stream GetStreamFromPath (string path)
{
Stream stream = null;
+ Assembly ass = null;
if (path.StartsWith ("#")) {
string resId = path.Substring (1);
//try/catch added to prevent nunit error
try {
- stream = System.Reflection.Assembly.GetEntryAssembly ().GetManifestResourceStream (resId);
+ ass = Assembly.GetEntryAssembly ();
+ if (ass != null)
+ stream = ass.GetManifestResourceStream (resId);
} catch{}
if (stream == null)//try to find ressource in Crow assembly
stream = System.Reflection.Assembly.GetExecutingAssembly ().GetManifestResourceStream (resId);
}
#endregion
- public void ProcessResize(Rectangle bounds){
+ public void ProcessResize(Rectangle bounds){
lock (UpdateMutex) {
clientRectangle = bounds;
int stride = 4 * ClientRectangle.Width;
#region Autogenerated code
public class Global {
- [DllImport("rsvg-2")]
+ [DllImport(Handle.librsvg)]
static extern void rsvg_set_default_dpi_x_y(double dpi_x, double dpi_y);
public static void SetDefaultDpiXY(double dpi_x, double dpi_y) {
rsvg_set_default_dpi_x_y(dpi_x, dpi_y);
}
- [DllImport("rsvg-2")]
+ [DllImport(Handle.librsvg)]
static extern int rsvg_error_quark();
public static int ErrorQuark {
}
}
- [DllImport("rsvg-2")]
+ [DllImport(Handle.librsvg)]
static extern void rsvg_set_default_dpi(double dpi);
public static double DefaultDpi {
using System.Runtime.InteropServices;
public class Handle {
-
+ public const string librsvg = "rsvg";
public IntPtr Raw;
- [DllImport("rsvg-2")]
+ [DllImport(librsvg)]
static extern IntPtr rsvg_handle_new();
public Handle ()
Raw = rsvg_handle_new();
}
- [DllImport("rsvg-2")]
+ [DllImport(librsvg)]
static extern unsafe IntPtr rsvg_handle_new_from_data(byte[] data, UIntPtr n_data, out IntPtr error);
public unsafe Handle (byte[] data)
if (error != IntPtr.Zero) throw new Exception (error.ToString());
}
- [DllImport("rsvg-2")]
+ [DllImport(librsvg)]
static extern unsafe IntPtr rsvg_handle_new_from_file(string file_name, out IntPtr error);
public unsafe Handle (string file_name)
if (error != IntPtr.Zero) throw new Exception (error.ToString());
}
- [DllImport("rsvg-2")]
+ [DllImport(librsvg)]
static extern IntPtr rsvg_handle_get_base_uri(IntPtr raw);
- [DllImport("rsvg-2")]
+ [DllImport(librsvg)]
static extern void rsvg_handle_set_dpi(IntPtr raw, double dpi);
public double Dpi {
}
}
- [DllImport("rsvg-2")]
+ [DllImport(librsvg)]
static extern void rsvg_handle_render_cairo(IntPtr raw, IntPtr cr);
public void RenderCairo(Cairo.Context cr) {
}
}
- [DllImport("rsvg-2")]
+ [DllImport(librsvg)]
static extern void rsvg_handle_set_dpi_x_y(IntPtr raw, double dpi_x, double dpi_y);
public void SetDpiXY(double dpi_x, double dpi_y) {
rsvg_handle_set_dpi_x_y(Raw, dpi_x, dpi_y);
}
- [DllImport("rsvg-2")]
+ [DllImport(librsvg)]
static extern void rsvg_handle_get_dimensions(IntPtr raw, IntPtr dimension_data);
public Rsvg.DimensionData Dimensions {
}
}
- [DllImport("rsvg-2")]
+ [DllImport(librsvg)]
static extern unsafe bool rsvg_handle_close(IntPtr raw, out IntPtr error);
public unsafe bool Close() {
return raw_ret;
}
- [DllImport("rsvg-2")]
+ [DllImport(librsvg)]
static extern IntPtr rsvg_handle_get_title(IntPtr raw);
public string Title {
}
}
- [DllImport("rsvg-2")]
+ [DllImport(librsvg)]
static extern void rsvg_handle_render_cairo_sub(IntPtr raw, IntPtr cr, string id);
public void RenderCairoSub(Cairo.Context cr, string id) {
rsvg_handle_render_cairo_sub(Raw, cr == null ? IntPtr.Zero : cr.Handle, id);
}
- [DllImport("rsvg-2")]
+ [DllImport(librsvg)]
static extern IntPtr rsvg_handle_get_metadata(IntPtr raw);
public string Metadata {