[gbrainy] Remove gtk dependency from gbrainy.Core assembly
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gbrainy] Remove gtk dependency from gbrainy.Core assembly
- Date: Sat, 19 Nov 2011 13:36:32 +0000 (UTC)
commit c1764bd7a1963c7b28cbff35a4dc2625f3734fe4
Author: Jordi Mas <jmas softcatala org>
Date: Sat Nov 19 14:36:46 2011 +0100
Remove gtk dependency from gbrainy.Core assembly
.../Classical/Dialogs/PlayerHistoryDialog.cs | 3 ++-
src/Clients/Classical/Widgets/GameDrawingArea.cs | 3 ++-
src/Core/Core.csproj | 2 --
src/Core/Libraries/CairoContext.cs | 15 ++++++++++-----
src/Core/Main/CairoContextEx.cs | 2 +-
5 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs b/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs
index 8018edc..7524f72 100644
--- a/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs
+++ b/src/Clients/Classical/Dialogs/PlayerHistoryDialog.cs
@@ -125,7 +125,8 @@ namespace gbrainy.Clients.Classical.Dialogs
double x = 0, y = 0;
Cairo.Context cc = Gdk.CairoHelper.Create (args.Window);
- CairoContextEx cr = new CairoContextEx (cc.Handle, this);
+ CairoContextEx cr = new CairoContextEx (cc.Handle);
+ cr.PangoFontDescription = PangoContext.FontDescription;
args.Window.GetSize (out w, out h);
nh = nw = Math.Min (w, h);
diff --git a/src/Clients/Classical/Widgets/GameDrawingArea.cs b/src/Clients/Classical/Widgets/GameDrawingArea.cs
index 52a359b..d7c6d79 100644
--- a/src/Clients/Classical/Widgets/GameDrawingArea.cs
+++ b/src/Clients/Classical/Widgets/GameDrawingArea.cs
@@ -88,7 +88,8 @@ namespace gbrainy.Clients.Classical.Widgets
int w, h, total_w, total_h;
Cairo.Context cc = Gdk.CairoHelper.Create (args.Window);
- CairoContextEx cr = new CairoContextEx (cc.Handle, this);
+ CairoContextEx cr = new CairoContextEx (cc.Handle);
+ cr.PangoFontDescription = PangoContext.FontDescription;
args.Window.GetSize (out total_w, out total_h);
diff --git a/src/Core/Core.csproj b/src/Core/Core.csproj
index 79f69c3..a54d5d5 100644
--- a/src/Core/Core.csproj
+++ b/src/Core/Core.csproj
@@ -36,8 +36,6 @@
<Reference Include="System.Xml" />
<Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
</Reference>
- <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
- </Reference>
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
</Reference>
<Reference Include="Mono.CSharp" />
diff --git a/src/Core/Libraries/CairoContext.cs b/src/Core/Libraries/CairoContext.cs
index 7ce7b54..08dfd64 100644
--- a/src/Core/Libraries/CairoContext.cs
+++ b/src/Core/Libraries/CairoContext.cs
@@ -37,13 +37,9 @@ namespace gbrainy.Core.Libraries
const double def_linespace = 0.018;
const double width_margin = 0.04;
- public CairoContext (IntPtr state, Gtk.Widget widget) : base (state)
+ public CairoContext (IntPtr handle) : base (handle)
{
layout = Pango.CairoHelper.CreateLayout (this);
-
- // We do not honor DPI settings or font sizes (just font name)
- // User should resize the window
- font_description = layout.FontDescription = widget.PangoContext.FontDescription.Copy ();
FontLineSpace = def_linespace;
}
@@ -75,6 +71,15 @@ namespace gbrainy.Core.Libraries
public double FontLineSpace { get; set; }
+ // We do not honor DPI settings or font sizes (just font name)
+ // User should resize the window
+ public FontDescription PangoFontDescription {
+ set {
+ font_description = layout.FontDescription = value.Copy ();
+ }
+ }
+
+
// True if we want Pango to process XML entities and formatting attributes
public bool UseMarkup { get; set; }
diff --git a/src/Core/Main/CairoContextEx.cs b/src/Core/Main/CairoContextEx.cs
index fe90e79..5c53440 100644
--- a/src/Core/Main/CairoContextEx.cs
+++ b/src/Core/Main/CairoContextEx.cs
@@ -29,7 +29,7 @@ namespace gbrainy.Core.Main
{
static SVGImage image;
- public CairoContextEx (IntPtr state, Gtk.Widget widget) : base (state, widget)
+ public CairoContextEx (IntPtr handle) : base (handle)
{
CommonConstructor ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]