Migrated Core Animation,CFNetwork,CoreTextArcMonoMac to uniifed

This commit is contained in:
GouriKumari 2014-12-02 12:11:51 -05:00
Родитель 4e6df5ffd6
Коммит a15c772634
16 изменённых файлов: 113 добавлений и 121 удалений

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

@ -6,7 +6,7 @@
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D7C26BE0-9517-4773-954C-4E74A53BEA09}</ProjectGuid>
<ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectTypeGuids>{42C0BBD9-55CE-4FC1-8D90-A7348ABAFB23};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>MonoMac.CFNetwork.Test</RootNamespace>
<AssemblyName>MonoMac.CFNetwork.Test</AssemblyName>
@ -72,13 +72,11 @@
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Net.Http" />
<Reference Include="MonoMac">
<HintPath>\Applications\MonoDevelop.app\Contents\MacOS\lib\monodevelop\AddIns\MonoDevelop.MonoMac\MonoMac.dll</HintPath>
</Reference>
<Reference Include="MonoMac.CFNetwork">
<HintPath>\Applications\MonoDevelop.app\Contents\MacOS\lib\monodevelop\AddIns\MonoDevelop.MonoMac\MonoMac.CFNetwork.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
<Reference Include="XamMac" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainWindow.cs" />

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

@ -1,8 +1,8 @@
using System;
using System.Drawing;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
using CoreGraphics;
using Foundation;
using AppKit;
using ObjCRuntime;
namespace BackgroundFilteredView
{
@ -14,7 +14,7 @@ namespace BackgroundFilteredView
{
}
public override void FinishedLaunching (NSObject notification)
public override void DidFinishLaunching (NSNotification notification)
{
mainWindowController = new MainWindowController ();
mainWindowController.Window.MakeKeyAndOrderFront (this);

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

@ -2,16 +2,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.CoreAnimation;
using MonoMac.CoreGraphics;
using MonoMac.CoreImage;
using CoreGraphics;
using Foundation;
using AppKit;
using CoreAnimation;
using CoreGraphics;
using CoreImage;
namespace BackgroundFilteredView
{
public partial class BackgroundFilteredView : MonoMac.AppKit.NSView
public partial class BackgroundFilteredView : AppKit.NSView
{
public BackgroundFilteredView (IntPtr handle) : base(handle) {}
@ -55,18 +55,18 @@ namespace BackgroundFilteredView
AddAnimationToTorusFilter ();
}
public override void DrawRect (RectangleF dirtyRect)
public override void DrawRect (CGRect dirtyRect)
{
RectangleF bounds = Bounds;
SizeF stripeSize = bounds.Size;
CGRect bounds = Bounds;
CGSize stripeSize = bounds.Size;
stripeSize.Width = bounds.Width / 10.0f;
RectangleF stripe = bounds;
CGRect stripe = bounds;
stripe.Size = stripeSize;
NSColor[] colors = new NSColor[2] { NSColor.White, NSColor.Blue };
for (int i = 0; i < 10; i++){
colors[i % 2].Set();
NSGraphics.RectFill(stripe);
PointF origin = stripe.Location;
CGPoint origin = stripe.Location;
origin.X += stripe.Size.Width;
stripe.Location = origin;
}

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

@ -6,12 +6,12 @@
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B5F58EC4-8C3E-4B91-ABF8-82691F18873F}</ProjectGuid>
<ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>BackgroundFilteredView</RootNamespace>
<AssemblyName>BackgroundFilteredView</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -36,10 +36,7 @@
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="MonoMac">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Xamarin.Mac" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainWindow.cs">
@ -68,6 +65,5 @@
<None Include="Info.plist" />
<None Include="readme.md" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
</Project>

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

@ -1,5 +1,5 @@
using System;
using MonoMac.AppKit;
using AppKit;
namespace BackgroundFilteredView
{

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

@ -12,7 +12,7 @@ namespace BackgroundFilteredView {
// Should subclass MonoMac.AppKit.NSResponder
[MonoMac.Foundation.Register("AppDelegate")]
[Foundation.Register("AppDelegate")]
public partial class AppDelegate {
}
}

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

@ -2,12 +2,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoMac.Foundation;
using MonoMac.AppKit;
using Foundation;
using AppKit;
namespace BackgroundFilteredView
{
public partial class MainWindow : MonoMac.AppKit.NSWindow
public partial class MainWindow : AppKit.NSWindow
{
public MainWindow (IntPtr handle) : base(handle) {}

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

@ -12,22 +12,22 @@ namespace BackgroundFilteredView {
// Should subclass MonoMac.AppKit.NSView
[MonoMac.Foundation.Register("BackgroundFilteredView")]
[Foundation.Register("BackgroundFilteredView")]
public partial class BackgroundFilteredView {
private global::MonoMac.AppKit.NSView __mt_controls;
private global::AppKit.NSView __mt_controls;
#pragma warning disable 0169
[MonoMac.Foundation.Export("addFilter:")]
partial void AddFilter (MonoMac.AppKit.NSButton sender);
[Foundation.Export("addFilter:")]
partial void AddFilter (AppKit.NSButton sender);
[MonoMac.Foundation.Export("removeFilter:")]
partial void RemoveFilter (MonoMac.AppKit.NSButton sender);
[Foundation.Export("removeFilter:")]
partial void RemoveFilter (AppKit.NSButton sender);
[MonoMac.Foundation.Connect("controls")]
private global::MonoMac.AppKit.NSView controls {
[Foundation.Connect("controls")]
private global::AppKit.NSView controls {
get {
this.__mt_controls = ((global::MonoMac.AppKit.NSView)(this.GetNativeField("controls")));
this.__mt_controls = ((global::AppKit.NSView)(this.GetNativeField("controls")));
return this.__mt_controls;
}
set {
@ -38,12 +38,12 @@ namespace BackgroundFilteredView {
}
// Should subclass MonoMac.AppKit.NSWindow
[MonoMac.Foundation.Register("MainWindow")]
[Foundation.Register("MainWindow")]
public partial class MainWindow {
}
// Should subclass MonoMac.AppKit.NSWindowController
[MonoMac.Foundation.Register("MainWindowController")]
[Foundation.Register("MainWindowController")]
public partial class MainWindowController {
}
}

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

@ -2,12 +2,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoMac.Foundation;
using MonoMac.AppKit;
using Foundation;
using AppKit;
namespace BackgroundFilteredView
{
public partial class MainWindowController : MonoMac.AppKit.NSWindowController
public partial class MainWindowController : AppKit.NSWindowController
{
#region Constructors

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

@ -1,7 +1,7 @@
using System;
using System.Drawing;
using MonoMac.Foundation;
using MonoMac.AppKit;
using CoreGraphics;
using Foundation;
using AppKit;
namespace CoreTextArcMonoMac
{
@ -11,7 +11,7 @@ namespace CoreTextArcMonoMac
{
}
public override void FinishedLaunching (NSObject notification)
public override void DidFinishLaunching (NSNotification notification)
{
// You can put any code here after your app launched.
}

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

@ -6,12 +6,12 @@
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8A201BCD-D384-47A7-B029-88E6187D688A}</ProjectGuid>
<ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>CoreTextArcMonoMac</RootNamespace>
<AssemblyName>CoreTextArcMonoMac</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -36,8 +36,7 @@
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="MonoMac, Version=0.0.0.0, Culture=neutral" />
<Reference Include="Xamarin.Mac" />
</ItemGroup>
<ItemGroup>
<Compile Include="MyDocument.cs">
@ -63,6 +62,5 @@
<None Include="Info.plist" />
<None Include="ReadMe.md" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Mono\MonoMac\v0.0\Mono.MonoMac.targets" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
</Project>

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

@ -1,15 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.CoreGraphics;
using MonoMac.CoreText;
using CoreGraphics;
using Foundation;
using AppKit;
using CoreGraphics;
using CoreText;
namespace CoreTextArcMonoMac
{
public partial class CoreTextArcView : MonoMac.AppKit.NSView
public partial class CoreTextArcView : AppKit.NSView
{
NSFont _font;
string _string;
@ -32,7 +32,7 @@ namespace CoreTextArcMonoMac
}
[Export("initWithFrame:")]
public CoreTextArcView (RectangleF frame) : base(frame)
public CoreTextArcView (CGRect frame) : base(frame)
{
Font = NSFont.FromFontName (ARCVIEW_DEFAULT_FONT_NAME, ARCVIEW_DEFAULT_FONT_SIZE);
Title = "Curvaceous MonoMac";
@ -47,9 +47,9 @@ namespace CoreTextArcMonoMac
// Examine each run in the line, updating glyphOffset to track how far along the run is
// in terms of glyphCount.
long glyphOffset = 0;
float ascent = 0;
float descent = 0;
float leading = 0;
nfloat ascent = 0;
nfloat descent = 0;
nfloat leading = 0;
foreach (var run in runArray) {
var runGlyphCount = run.GlyphCount;
@ -82,7 +82,7 @@ namespace CoreTextArcMonoMac
}
}
public override void DrawRect (RectangleF dirtyRect)
public override void DrawRect (CGRect dirtyRect)
{
// Don't draw if we don't have a font or a title.
if (Font == null || Title == string.Empty)
@ -99,7 +99,7 @@ namespace CoreTextArcMonoMac
//CTLineRef line = CTLineCreateWithAttributedString((CFAttributedStringRef)self.attributedString);
CTLine line = new CTLine (AttributedString);
int glyphCount = line.GlyphCount;
int glyphCount = (int)line.GlyphCount;
if (glyphCount == 0)
return;
@ -113,7 +113,7 @@ namespace CoreTextArcMonoMac
// Stroke the arc in red for verification.
context.BeginPath ();
context.AddArc (0, 0, Radius, (float)Math.PI, 0, true);
context.SetRGBStrokeColor (1, 0, 0, 1);
context.SetStrokeColor (1, 0, 0, 1);
context.StrokePath ();
// Rotate the context 90 degrees counterclockwise.
@ -123,7 +123,7 @@ namespace CoreTextArcMonoMac
// glyph has already been calculated; with that information in hand, draw those glyphs
// overstruck and centered over one another, making sure to rotate the context after each
// glyph so the glyphs are spread along a semicircular path.
PointF textPosition = new PointF (0, Radius);
CGPoint textPosition = new CGPoint (0, Radius);
context.TextPosition = textPosition;
var runArray = line.GetGlyphRuns ();
@ -154,7 +154,7 @@ namespace CoreTextArcMonoMac
// Center this glyph by moving left by half its width.
var glyphWidth = glyphArcInfo[runGlyphIndex + glyphOffset].width;
var halfGlyphWidth = glyphWidth / 2.0;
var positionForThisGlyph = new PointF (textPosition.X - (float)halfGlyphWidth, textPosition.Y);
var positionForThisGlyph = new CGPoint (textPosition.X - (float)halfGlyphWidth, textPosition.Y);
// Glyphs are positioned relative to the text position for the line, so offset text position leftwards by this glyph's
// width in preparation for the next glyph.
@ -179,7 +179,7 @@ namespace CoreTextArcMonoMac
context.SetFont (cgFont);
context.SetFontSize (runFont.Size);
context.SetRGBFillColor (0.25f, 0.25f, 0.25f, 1);
context.SetFillColor (0.25f, 0.25f, 0.25f, 1);
context.ShowGlyphsAtPositions (glyph, position, 1);
}
@ -188,31 +188,31 @@ namespace CoreTextArcMonoMac
if (ShowsGlyphBounds) {
var glyphBounds = run.GetImageBounds (context, glyphRange);
context.SetRGBStrokeColor (0, 0, 1, 1);
context.SetStrokeColor (0, 0, 1, 1);
context.StrokeRect (glyphBounds);
}
// Draw the bounding boxes defined by the line metrics
if (ShowsLineMetrics) {
var lineMetrics = new RectangleF ();
float ascent = 0;
float descent = 0;
float leading = 0;
var lineMetrics = new CGRect ();
nfloat ascent = 0;
nfloat descent = 0;
nfloat leading = 0;
run.GetTypographicBounds (glyphRange, out ascent, out descent, out leading);
// The glyph is centered around the y-axis
lineMetrics.Location = new PointF (-(float)halfGlyphWidth, positionForThisGlyph.Y - descent);
lineMetrics.Size = new SizeF (glyphWidth, ascent + descent);
context.SetRGBStrokeColor (0, 1, 0, 1);
lineMetrics.Location = new CGPoint (-(float)halfGlyphWidth, positionForThisGlyph.Y - descent);
lineMetrics.Size = new CGSize (glyphWidth, ascent + descent);
context.SetStrokeColor (0, 1, 0, 1);
context.StrokeRect (lineMetrics);
}
}
glyphOffset += runGlyphCount;
glyphOffset += (int)runGlyphCount;
}
context.RestoreState ();

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

@ -1,8 +1,8 @@
using System;
using System.Drawing;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;
using CoreGraphics;
using Foundation;
using AppKit;
using ObjCRuntime;
namespace CoreTextArcMonoMac
{

2
CoreTextArcMonoMac/MainMenu.xib.designer.cs сгенерированный
Просмотреть файл

@ -12,7 +12,7 @@ namespace CoreTextArcMonoMac {
// Should subclass MonoMac.AppKit.NSResponder
[MonoMac.Foundation.Register("AppDelegate")]
[Foundation.Register("AppDelegate")]
public partial class AppDelegate {
}
}

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

@ -1,23 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoMac.Foundation;
using MonoMac.AppKit;
using Foundation;
using AppKit;
namespace CoreTextArcMonoMac
{
public partial class MyDocument : MonoMac.AppKit.NSDocument
public partial class MyDocument : AppKit.NSDocument
{
// Called when created from unmanaged code
public MyDocument (IntPtr handle) : base(handle)
{
}
// Called when created directly from a XIB file
/* // Called when created directly from a XIB file
[Export("initWithCoder:")]
public MyDocument (NSCoder coder) : base(coder)
{
}
}*/
public override void WindowControllerDidLoadNib (NSWindowController windowController)
{

52
CoreTextArcMonoMac/MyDocument.xib.designer.cs сгенерированный
Просмотреть файл

@ -12,45 +12,45 @@ namespace CoreTextArcMonoMac {
// Should subclass MonoMac.AppKit.NSView
[MonoMac.Foundation.Register("CoreTextArcView")]
[Foundation.Register("CoreTextArcView")]
public partial class CoreTextArcView {
}
// Should subclass MonoMac.Foundation.NSObject
[MonoMac.Foundation.Register("FirstResponder")]
[Foundation.Register("FirstResponder")]
public partial class FirstResponder {
#pragma warning disable 0169
[MonoMac.Foundation.Export("setDimsSubstitutedGlyphs:")]
partial void setDimsSubstitutedGlyphs (MonoMac.AppKit.NSButton sender);
[Foundation.Export("setDimsSubstitutedGlyphs:")]
partial void setDimsSubstitutedGlyphs (AppKit.NSButton sender);
[MonoMac.Foundation.Export("setShowsGlyphOutlines:")]
partial void setShowsGlyphOutlines (MonoMac.AppKit.NSButton sender);
[Foundation.Export("setShowsGlyphOutlines:")]
partial void setShowsGlyphOutlines (AppKit.NSButton sender);
[MonoMac.Foundation.Export("setShowsLineMetrics:")]
partial void setShowsLineMetrics (MonoMac.AppKit.NSButton sender);
[Foundation.Export("setShowsLineMetrics:")]
partial void setShowsLineMetrics (AppKit.NSButton sender);
[MonoMac.Foundation.Export("toggleBold:")]
partial void toggleBold (MonoMac.AppKit.NSButton sender);
[Foundation.Export("toggleBold:")]
partial void toggleBold (AppKit.NSButton sender);
[MonoMac.Foundation.Export("toggleItalic:")]
partial void toggleItalic (MonoMac.AppKit.NSButton sender);
[Foundation.Export("toggleItalic:")]
partial void toggleItalic (AppKit.NSButton sender);
}
// Should subclass MonoMac.AppKit.NSDocument
[MonoMac.Foundation.Register("MyDocument")]
[Foundation.Register("MyDocument")]
public partial class MyDocument {
private CoreTextArcView __mt_arcView;
private global::MonoMac.AppKit.NSButton __mt_boldButton;
private global::AppKit.NSButton __mt_boldButton;
private global::MonoMac.AppKit.NSButton __mt_italicButton;
private global::AppKit.NSButton __mt_italicButton;
private global::MonoMac.AppKit.NSTextField __mt_txtField;
private global::AppKit.NSTextField __mt_txtField;
#pragma warning disable 0169
[MonoMac.Foundation.Connect("arcView")]
[Foundation.Connect("arcView")]
private CoreTextArcView arcView {
get {
this.__mt_arcView = ((CoreTextArcView)(this.GetNativeField("arcView")));
@ -62,10 +62,10 @@ namespace CoreTextArcMonoMac {
}
}
[MonoMac.Foundation.Connect("boldButton")]
private global::MonoMac.AppKit.NSButton boldButton {
[Foundation.Connect("boldButton")]
private global::AppKit.NSButton boldButton {
get {
this.__mt_boldButton = ((global::MonoMac.AppKit.NSButton)(this.GetNativeField("boldButton")));
this.__mt_boldButton = ((global::AppKit.NSButton)(this.GetNativeField("boldButton")));
return this.__mt_boldButton;
}
set {
@ -74,10 +74,10 @@ namespace CoreTextArcMonoMac {
}
}
[MonoMac.Foundation.Connect("italicButton")]
private global::MonoMac.AppKit.NSButton italicButton {
[Foundation.Connect("italicButton")]
private global::AppKit.NSButton italicButton {
get {
this.__mt_italicButton = ((global::MonoMac.AppKit.NSButton)(this.GetNativeField("italicButton")));
this.__mt_italicButton = ((global::AppKit.NSButton)(this.GetNativeField("italicButton")));
return this.__mt_italicButton;
}
set {
@ -86,10 +86,10 @@ namespace CoreTextArcMonoMac {
}
}
[MonoMac.Foundation.Connect("txtField")]
private global::MonoMac.AppKit.NSTextField txtField {
[Foundation.Connect("txtField")]
private global::AppKit.NSTextField txtField {
get {
this.__mt_txtField = ((global::MonoMac.AppKit.NSTextField)(this.GetNativeField("txtField")));
this.__mt_txtField = ((global::AppKit.NSTextField)(this.GetNativeField("txtField")));
return this.__mt_txtField;
}
set {