Proper Makefiles, MD integration, Cairo

Added Cairo extension methods/classes, organized the project a little
more, and added Makefile build support that integrates with the MD
projects.
This commit is contained in:
Aaron Bockover 2010-11-07 14:02:03 -05:00
Родитель 2ba270e4c1
Коммит 800dc22a3a
13 изменённых файлов: 574 добавлений и 39 удалений

Просмотреть файл

@ -16,6 +16,6 @@ Global
{3C4985A8-E1D7-4633-8D79-B2816289F777}.Debug|x86.Build.0 = Debug|Any CPU {3C4985A8-E1D7-4633-8D79-B2816289F777}.Debug|x86.Build.0 = Debug|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Maigre\Maigre.csproj StartupItem = libmaigre\libmaigre.cproj
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

Просмотреть файл

@ -0,0 +1,208 @@
//
// ColorExtensions.cs
//
// Author:
// Aaron Bockover <abockover@novell.com>
//
// Copyright 2010 Novell, Inc.
//
// 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;
namespace Cairo
{
public static class ColorExtensions
{
public static Cairo.Color ToCairoColor (this Gdk.Color color)
{
return ToCairoColor (color, 1.0);
}
public static Cairo.Color ToCairoColor (this Gdk.Color color, double alpha)
{
return new Cairo.Color (
(double)(color.Red >> 8) / 255.0,
(double)(color.Green >> 8) / 255.0,
(double)(color.Blue >> 8) / 255.0,
alpha);
}
public static Cairo.Color AlphaBlend (this Cairo.Color ca, Cairo.Color cb, double alpha)
{
return new Cairo.Color (
(1.0 - alpha) * ca.R + alpha * cb.R,
(1.0 - alpha) * ca.G + alpha * cb.G,
(1.0 - alpha) * ca.B + alpha * cb.B);
}
public static Cairo.Color FromRgb (uint rgbColor)
{
return FromRgba ((rgbColor << 8) | 0x000000ff);
}
public static Cairo.Color FromRgba (uint rgbaColor)
{
return new Cairo.Color (
(byte)(rgbaColor >> 24) / 255.0,
(byte)(rgbaColor >> 16) / 255.0,
(byte)(rgbaColor >> 8) / 255.0,
(byte)(rgbaColor & 0x000000ff) / 255.0);
}
public static bool ColorIsDark (this Cairo.Color color)
{
double h, s, b;
ToHsb (color, out h, out s, out b);
return b < 0.5;
}
public static void ToHsb (this Cairo.Color color, out double hue,
out double saturation, out double brightness)
{
double min, max, delta;
double red = color.R;
double green = color.G;
double blue = color.B;
hue = 0;
saturation = 0;
brightness = 0;
if (red > green) {
max = Math.Max (red, blue);
min = Math.Min (green, blue);
} else {
max = Math.Max (green, blue);
min = Math.Min (red, blue);
}
brightness = (max + min) / 2;
if (Math.Abs (max - min) < 0.0001) {
hue = 0;
saturation = 0;
} else {
saturation = brightness <= 0.5
? (max - min) / (max + min)
: (max - min) / (2 - max - min);
delta = max - min;
if (red == max) {
hue = (green - blue) / delta;
} else if (green == max) {
hue = 2 + (blue - red) / delta;
} else if (blue == max) {
hue = 4 + (red - green) / delta;
}
hue *= 60;
if (hue < 0) {
hue += 360;
}
}
}
private static double Modula (double number, double divisor)
{
return ((int)number % divisor) + (number - (int)number);
}
public static Cairo.Color FromHsb (double hue, double saturation, double brightness)
{
int i;
double [] hue_shift = { 0, 0, 0 };
double [] color_shift = { 0, 0, 0 };
double m1, m2, m3;
m2 = brightness <= 0.5
? brightness * (1 + saturation)
: brightness + saturation - brightness * saturation;
m1 = 2 * brightness - m2;
hue_shift[0] = hue + 120;
hue_shift[1] = hue;
hue_shift[2] = hue - 120;
color_shift[0] = color_shift[1] = color_shift[2] = brightness;
i = saturation == 0 ? 3 : 0;
for (; i < 3; i++) {
m3 = hue_shift[i];
if (m3 > 360) {
m3 = Modula (m3, 360);
} else if(m3 < 0) {
m3 = 360 - Modula (Math.Abs (m3), 360);
}
if (m3 < 60) {
color_shift[i] = m1 + (m2 - m1) * m3 / 60;
} else if (m3 < 180) {
color_shift[i] = m2;
} else if (m3 < 240) {
color_shift[i] = m1 + (m2 - m1) * (240 - m3) / 60;
} else {
color_shift[i] = m1;
}
}
return new Cairo.Color (color_shift[0], color_shift[1], color_shift[2]);
}
public static Cairo.Color Shade (this Cairo.Color @base, double ratio)
{
double h, s, b;
ToHsb (@base, out h, out s, out b);
b = Math.Max (Math.Min (b * ratio, 1), 0);
s = Math.Max (Math.Min (s * ratio, 1), 0);
var color = FromHsb (h, s, b);
color.A = @base.A;
return color;
}
public static Cairo.Color AdjustBrightness (this Cairo.Color @base, double br)
{
double h, s, b;
ToHsb (@base, out h, out s, out b);
b = Math.Max (Math.Min (br, 1), 0);
return FromHsb (h, s, b);
}
public static string GetHexString (this Cairo.Color color, bool withAlpha)
{
return withAlpha
? String.Format ("#{0:x2}{1:x2}{2:x2}{3:x2}",
(byte)(color.R * 255),
(byte)(color.G * 255),
(byte)(color.B * 255),
(byte)(color.A * 255))
: String.Format ("#{0:x2}{1:x2}{2:x2}",
(byte)(color.R * 255),
(byte)(color.G * 255),
(byte)(color.B * 255));
}
}
}

Просмотреть файл

@ -0,0 +1,142 @@
//
// Style.cs
//
// Author:
// Aaron Bockover <abockover@novell.com>
//
// Copyright 2007-2010 Novell, Inc.
//
// 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;
namespace Cairo
{
public static class ContextExtensions
{
/*public static Pango.Layout CreateCairoLayout (Gtk.Widget widget, Cairo.Context cairo_context)
{
var layout = PangoCairoHelper.CreateLayout (cairo_context);
layout.FontDescription = widget.PangoContext.FontDescription;
double resolution = widget.Screen.Resolution;
if (resolution != -1) {
using (var context = PangoCairoHelper.LayoutGetContext (layout)) {
PangoCairoHelper.ContextSetResolution (context, resolution);
}
}
return layout;
}*/
public static Surface CreateSurfaceForPixbuf (this Cairo.Context cr, Gdk.Pixbuf pixbuf)
{
var surface = cr.Target.CreateSimilar (cr.Target.Content, pixbuf.Width, pixbuf.Height);
using (var surface_cr = new Context (surface)) {
Gdk.CairoHelper.SetSourcePixbuf (surface_cr, pixbuf, 0, 0);
surface_cr.Paint ();
return surface;
}
}
public static void RoundedRectangle (this Cairo.Context cr,
double x, double y, double w, double h, double r)
{
RoundedRectangle (cr, x, y, w, h, r, Corner.All, false);
}
public static void RoundedRectangle (this Cairo.Context cr,
double x, double y, double w, double h,
double r, Corner corners)
{
RoundedRectangle (cr, x, y, w, h, r, corners, false);
}
public static void RoundedRectangle (this Cairo.Context cr,
double x, double y, double w, double h,
double r, Corner corners, bool topBottomFallsThrough)
{
if (topBottomFallsThrough && corners == Corner.None) {
cr.MoveTo (x, y - r);
cr.LineTo (x, y + h + r);
cr.MoveTo (x + w, y - r);
cr.LineTo (x + w, y + h + r);
return;
} else if (r < 0.0001 || corners == Corner.None) {
cr.Rectangle (x, y, w, h);
return;
}
if ((corners & (Corner.TopLeft | Corner.TopRight)) == 0 && topBottomFallsThrough) {
y -= r;
h += r;
cr.MoveTo (x + w, y);
} else {
if ((corners & Corner.TopLeft) != 0) {
cr.MoveTo (x + r, y);
} else {
cr.MoveTo (x, y);
}
if ((corners & Corner.TopRight) != 0) {
cr.Arc (x + w - r, y + r, r, Math.PI * 1.5, Math.PI * 2);
} else {
cr.LineTo (x + w, y);
}
}
if ((corners & (Corner.BottomLeft | Corner.BottomRight)) == 0 && topBottomFallsThrough) {
h += r;
cr.LineTo (x + w, y + h);
cr.MoveTo (x, y + h);
cr.LineTo (x, y + r);
cr.Arc (x + r, y + r, r, Math.PI, Math.PI * 1.5);
} else {
if ((corners & Corner.BottomRight) != 0) {
cr.Arc (x + w - r, y + h - r, r, 0, Math.PI * 0.5);
} else {
cr.LineTo (x + w, y + h);
}
if ((corners & Corner.BottomLeft) != 0) {
cr .Arc(x + r, y + h - r, r, Math.PI * 0.5, Math.PI);
} else {
cr.LineTo (x, y + h);
}
if ((corners & Corner.TopLeft) != 0) {
cr.Arc (x + r, y + r, r, Math.PI, Math.PI * 1.5);
} else {
cr.LineTo (x, y);
}
}
}
public static void DisposeSelfAndTarget (this Cairo.Context cr)
{
((IDisposable)cr.Target).Dispose ();
((IDisposable)cr).Dispose ();
}
public static void SetColor (this Cairo.Context cr, Gdk.Color color)
{
cr.Color = color.ToCairoColor ();
}
}
}

41
Maigre/Cairo/Corner.cs Normal file
Просмотреть файл

@ -0,0 +1,41 @@
//
// Corner.cs
//
// Author:
// Aaron Bockover <abockover@novell.com>
//
// Copyright 2010 Novell, Inc.
//
// 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;
namespace Cairo
{
[Flags]
public enum Corner
{
None = 0,
TopLeft = 1,
TopRight = 2,
BottomLeft = 4,
BottomRight = 8,
All = 15
}
}

Просмотреть файл

@ -15,7 +15,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>..\engines</OutputPath> <OutputPath>.</OutputPath>
<DefineConstants>DEBUG</DefineConstants> <DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
@ -33,13 +33,37 @@
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>
<Compile Include="Theme.cs" /> <Compile Include="Cairo\Corner.cs" />
<Compile Include="Cairo\ColorExtensions.cs" />
<Compile Include="Cairo\ContextExtensions.cs" />
<Compile Include="Maigre\Theme.cs" />
<Compile Include="Maigre\DrawContext.cs" />
</ItemGroup> </ItemGroup>
<ProjectExtensions>
<MonoDevelop>
<Properties>
<MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="Makefile" BuildTargetName="" CleanTargetName="" SyncReferences="true">
<BuildFilesVar Sync="true" Name="MAIGRE_SOURCES" />
<DeployFilesVar />
<ResourcesVar />
<OthersVar Sync="true" Name="MAIGRE_OTHER" />
<GacRefVar Sync="true" Name="REFERENCES" />
<AsmRefVar Sync="true" Name="REFERENCES" />
<ProjectRefVar Sync="true" Name="REFERENCES" />
</MonoDevelop.Autotools.MakefileInfo>
</Properties>
</MonoDevelop>
</ProjectExtensions>
<ItemGroup> <ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="Mono.Cairo" /> <Reference Include="Mono.Cairo" />
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
</ItemGroup>
<ItemGroup>
<None Include="gtkrc" />
</ItemGroup> </ItemGroup>
</Project> </Project>

Просмотреть файл

@ -1,5 +1,5 @@
// //
// Style.cs // DrawContext.cs
// //
// Author: // Author:
// Aaron Bockover <abockover@novell.com> // Aaron Bockover <abockover@novell.com>
@ -25,9 +25,6 @@
// THE SOFTWARE. // THE SOFTWARE.
using System; using System;
using Gtk;
using Gdk;
using Cairo;
namespace Maigre namespace Maigre
{ {
@ -36,8 +33,8 @@ namespace Maigre
public string Method { get; private set; } public string Method { get; private set; }
public Gtk.Style Style { get; private set; } public Gtk.Style Style { get; private set; }
public Gdk.Window Window { get; private set; } public Gdk.Window Window { get; private set; }
public Gtk.StateType StateType { get; private set; } public Gtk.StateType State { get; private set; }
public Gtk.ShadowType ShadowType { get; private set; } public Gtk.ShadowType Shadow { get; private set; }
public Gdk.Rectangle Area { get; private set; } public Gdk.Rectangle Area { get; private set; }
public Gtk.Widget Widget { get; private set; } public Gtk.Widget Widget { get; private set; }
public string Detail { get; private set; } public string Detail { get; private set; }
@ -56,19 +53,6 @@ namespace Maigre
public int Y1 { get; private set; } public int Y1 { get; private set; }
public int Y2 { get; private set; } public int Y2 { get; private set; }
public bool Fill { get; private set; } public bool Fill { get; private set; }
public Gtk.ArrowType ArrowType { get; private set; } public Gtk.ArrowType Arrow { get; private set; }
}
public static class Theme
{
public static void DrawBox (DrawContext context)
{
Console.WriteLine ("{0}:{1} ({2})", context.Method, context.Detail, context.Area);
using (var cr = Gdk.CairoHelper.Create (context.Window)) {
cr.Color = new Cairo.Color (0, 1, 1);
cr.Rectangle (context.X, context.Y, context.Width, context.Height);
cr.Fill ();
}
}
} }
} }

47
Maigre/Maigre/Theme.cs Normal file
Просмотреть файл

@ -0,0 +1,47 @@
//
// Style.cs
//
// Author:
// Aaron Bockover <abockover@novell.com>
//
// Copyright 2010 Novell, Inc.
//
// 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 Cairo;
namespace Maigre
{
public static class Theme
{
public static void DrawBox (DrawContext ctx)
{
using (var cr = Gdk.CairoHelper.Create (ctx.Window)) {
switch (ctx.Detail) {
case "button":
cr.RoundedRectangle (ctx.X, ctx.Y, ctx.Width, ctx.Height, 3);
cr.SetColor (ctx.Widget.Style.Background (ctx.State));
cr.Fill ();
break;
}
}
}
}
}

24
Maigre/Makefile Normal file
Просмотреть файл

@ -0,0 +1,24 @@
MAIGRE_SOURCES = \
Cairo/ColorExtensions.cs \
Cairo/ContextExtensions.cs \
Cairo/Corner.cs \
Maigre/DrawContext.cs \
Maigre/Theme.cs
MAIGRE_OTHER = gtkrc
REFERENCES = \
Mono.Cairo \
-pkg:gtk-sharp-2.0 \
System \
System.Core
REFERENCES_BUILD = \
$(filter -pkg:%, $(REFERENCES)) \
$(foreach r, $(filter-out -pkg:%, $(REFERENCES)), -r:$(r))
Maigre.dll: $(MAIGRE_SOURCES)
gmcs -out:$@ -target:library -debug $(REFERENCES_BUILD) $(MAIGRE_SOURCES)
clean:
rm -rf Maigre.dll* obj/

Просмотреть файл

Просмотреть файл

@ -1,7 +1,15 @@
all:
$(MAKE) -C libmaigre
$(MAKE) -C Maigre
clean: clean:
rm -rf engines $(MAKE) -C libmaigre clean
rm -rf Maigre.dll* $(MAKE) -C Maigre clean
rm -rf lib
test: test:
cp engines/Maigre.dll* . rm -rf lib
GTK_PATH=$$PWD GTK2_RC_FILES=maigre.gtkrc gtk-demo mkdir -p lib/engines
cp Maigre/gtkrc lib
cp libmaigre/libmaigre.so Maigre/Maigre.dll lib/engines
GTK_PATH=$$PWD/lib GTK2_RC_FILES=lib/gtkrc gtk-demo

46
libmaigre/Makefile Normal file
Просмотреть файл

@ -0,0 +1,46 @@
LIBMAIGRE_SOURCES = \
maigre-mono-bridge.c \
maigre-rc-style.c \
maigre-style.c \
maigre-theme-module.c
LIBMAIGRE_OTHER = \
maigre-gtk-style-generator \
maigre-mono-bridge.h \
maigre-rc-style.h \
maigre-style.h
PC_DEPS = \
mono \
gtk+-2.0
CC = gcc
LIBMAIGRE_CFLAGS = \
-Wall -O2 -ggdb3 \
$(shell pkg-config --cflags $(PC_DEPS)) \
$(CFLAGS)
LIBMAIGRE_LDFLAGS = \
-shared \
$(shell pkg-config --libs $(PC_DEPS)) \
$(LDFLAGS)
LIBMAIGRE_OBJECTS = $(LIBMAIGRE_SOURCES:.c=.o)
all: libmaigre.so
libmaigre.so: maigre-style-overrides.c $(LIBMAIGRE_OBJECTS)
$(CC) $(LIBMAIGRE_LDFLAGS) $(LIBMAIGRE_OBJECTS) -o $@
.c.o:
$(CC) -c $(LIBMAIGRE_CFLAGS) $< -o $@
maigre-style-overrides.c: maigre-gtk-style-generator
./$<
clean:
rm -rf $(LIBMAIGRE_OBJECTS) libmaigre.so maigre-style-overrides.c
test:
$(MAKE) -C .. test

Просмотреть файл

@ -11,12 +11,6 @@
<Compiler> <Compiler>
<Compiler ctype="GccCompiler" /> <Compiler ctype="GccCompiler" />
</Compiler> </Compiler>
<Packages>
<Packages>
<Package file="/usr/lib/pkgconfig/mono.pc" name="Mono" IsProject="false" />
<Package file="/usr/lib/pkgconfig/gtk+-2.0.pc" name="GTK+" IsProject="false" />
</Packages>
</Packages>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -55,4 +49,19 @@
<None Include="maigre-mono-bridge.h" /> <None Include="maigre-mono-bridge.h" />
<None Include="maigre-gtk-style-generator" /> <None Include="maigre-gtk-style-generator" />
</ItemGroup> </ItemGroup>
<ProjectExtensions>
<MonoDevelop>
<Properties>
<MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="Makefile" ExecuteTargetName="test" ParallelProcesses="2">
<BuildFilesVar Sync="true" Name="LIBMAIGRE_SOURCES" />
<DeployFilesVar />
<ResourcesVar />
<OthersVar Sync="true" Name="LIBMAIGRE_OTHER" />
<GacRefVar />
<AsmRefVar />
<ProjectRefVar />
</MonoDevelop.Autotools.MakefileInfo>
</Properties>
</MonoDevelop>
</ProjectExtensions>
</Project> </Project>

Просмотреть файл

@ -80,8 +80,8 @@ maigre_mono_bridge_load_draw_context (MaigreMonoBridge *bridge)
"<Method>k__BackingField", "<Method>k__BackingField",
"<Style>k__BackingField", "<Style>k__BackingField",
"<Window>k__BackingField", "<Window>k__BackingField",
"<StateType>k__BackingField", "<State>k__BackingField",
"<ShadowType>k__BackingField", "<Shadow>k__BackingField",
"<Area>k__BackingField", "<Area>k__BackingField",
"<Widget>k__BackingField", "<Widget>k__BackingField",
"<Detail>k__BackingField", "<Detail>k__BackingField",
@ -100,7 +100,7 @@ maigre_mono_bridge_load_draw_context (MaigreMonoBridge *bridge)
"<Y1>k__BackingField", "<Y1>k__BackingField",
"<Y2>k__BackingField", "<Y2>k__BackingField",
"<Fill>k__BackingField", "<Fill>k__BackingField",
"<ArrowType>k__BackingField", "<Arrow>k__BackingField",
NULL NULL
}; };
@ -131,6 +131,8 @@ maigre_mono_bridge ()
{ {
static MaigreMonoBridge *bridge; static MaigreMonoBridge *bridge;
gchar *path;
if (bridge != NULL) { if (bridge != NULL) {
return bridge; return bridge;
} }
@ -145,11 +147,11 @@ maigre_mono_bridge ()
if (bridge->domain == NULL) { if (bridge->domain == NULL) {
mono_config_parse (NULL); mono_config_parse (NULL);
bridge->domain = mono_jit_init ("Maigre.dll"); bridge->domain = mono_jit_init ("lib/engines/Maigre.dll");
} }
if ((bridge->assembly = mono_domain_assembly_open ( if ((bridge->assembly = mono_domain_assembly_open (
bridge->domain, "Maigre.dll")) == NULL || bridge->domain, "lib/engines/Maigre.dll")) == NULL ||
(bridge->image = mono_assembly_get_image (bridge->assembly)) == NULL) { (bridge->image = mono_assembly_get_image (bridge->assembly)) == NULL) {
g_warning ("Could not load Maigre.dll assembly"); g_warning ("Could not load Maigre.dll assembly");
return bridge; return bridge;