Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Bockover <abock@xamarin.com>2014-05-28 02:48:19 +0400
committerAaron Bockover <abock@xamarin.com>2014-05-28 02:49:04 +0400
commit23d53065d9de82f1d502222ddbd93932e0e86092 (patch)
tree557952a91572e263e24a692fd5982d6372b6cba0
parent76793bb2e1d7edb65cae9b7622ae4ce7fc8202a7 (diff)
[xammac-2.0] initial port of MacPlatform to Xamarin.Mac 2.0
-rw-r--r--.gitignore1
-rw-r--r--main/external/Makefile.am9
-rw-r--r--main/src/addins/MacPlatform/Dialogs/Layout.cs2
-rw-r--r--main/src/addins/MacPlatform/Dialogs/MDBox.cs10
-rw-r--r--main/src/addins/MacPlatform/Dialogs/MacAddFileDialogHandler.cs6
-rw-r--r--main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs13
-rw-r--r--main/src/addins/MacPlatform/Dialogs/MacExceptionDialogHandler.cs35
-rw-r--r--main/src/addins/MacPlatform/Dialogs/MacOpenFileDialogHandler.cs6
-rw-r--r--main/src/addins/MacPlatform/Dialogs/MacSelectFileDialogHandler.cs22
-rw-r--r--main/src/addins/MacPlatform/Dialogs/SelectEncodingPanel.cs55
-rw-r--r--main/src/addins/MacPlatform/Dialogs/SelectEncodingPopUpButton.cs8
-rw-r--r--main/src/addins/MacPlatform/ExtendedTitleBarDialogBackend.cs2
-rw-r--r--main/src/addins/MacPlatform/ExtendedTitleBarWindowBackend.cs2
-rw-r--r--main/src/addins/MacPlatform/MacIntegrationCommands.cs2
-rw-r--r--main/src/addins/MacPlatform/MacInterop/GtkQuartz.cs6
-rw-r--r--main/src/addins/MacPlatform/MacInterop/LaunchServices.cs4
-rw-r--r--main/src/addins/MacPlatform/MacMenu/MDLinkMenuItem.cs4
-rw-r--r--main/src/addins/MacPlatform/MacMenu/MDMenu.cs4
-rw-r--r--main/src/addins/MacPlatform/MacMenu/MDMenuItem.cs6
-rw-r--r--main/src/addins/MacPlatform/MacMenu/MDServicesMenuItem.cs2
-rw-r--r--main/src/addins/MacPlatform/MacMenu/MDSubMenuItem.cs2
-rw-r--r--main/src/addins/MacPlatform/MacPlatform.cs46
-rw-r--r--main/src/addins/MacPlatform/MacPlatform.csproj5
-rw-r--r--main/src/addins/MacPlatform/MacProxyCredentialProvider.cs4
24 files changed, 132 insertions, 124 deletions
diff --git a/.gitignore b/.gitignore
index 31c374e8ed..cd0bd61cdd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,6 +54,7 @@ test-results/
*.dmg
*.app
/main/build/MacOSX/render.exe
+/main/external/Xamarin.Mac.dll*
# Autogenerated stuff
/local-config/
diff --git a/main/external/Makefile.am b/main/external/Makefile.am
index c17913b0bd..89dce1d610 100644
--- a/main/external/Makefile.am
+++ b/main/external/Makefile.am
@@ -5,11 +5,14 @@ all:
clean:
if ENABLE_MACPLATFORM
-all:
- $(MAKE) -C monomac/src
+all: Xamarin.Mac.dll
+
+Xamarin.Mac.dll: /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/i386/full/Xamarin.Mac.dll
+ cp $< $@
+ cp $<.mdb $@.mdb
clean:
- $(MAKE) -C monomac/src clean
+ rm -f Xamarin.Mac.dll*
endif
install:
diff --git a/main/src/addins/MacPlatform/Dialogs/Layout.cs b/main/src/addins/MacPlatform/Dialogs/Layout.cs
index 1fe6946a0c..732bbe66d7 100644
--- a/main/src/addins/MacPlatform/Dialogs/Layout.cs
+++ b/main/src/addins/MacPlatform/Dialogs/Layout.cs
@@ -27,7 +27,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
-using MonoMac.AppKit;
+using AppKit;
using System.Linq;
namespace MonoDevelop.MacIntegration
diff --git a/main/src/addins/MacPlatform/Dialogs/MDBox.cs b/main/src/addins/MacPlatform/Dialogs/MDBox.cs
index a390dcb6d2..dab5eabbea 100644
--- a/main/src/addins/MacPlatform/Dialogs/MDBox.cs
+++ b/main/src/addins/MacPlatform/Dialogs/MDBox.cs
@@ -27,7 +27,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
-using MonoMac.AppKit;
+using AppKit;
using System.Linq;
namespace MonoDevelop.MacIntegration
@@ -121,8 +121,8 @@ namespace MonoDevelop.MacIntegration
Autosize ();
} else {
var size = view.Frame.Size;
- MinHeight = size.Height;
- MinWidth = size.Width;
+ MinHeight = (float)size.Height;
+ MinWidth = (float)size.Width;
}
}
@@ -138,8 +138,8 @@ namespace MonoDevelop.MacIntegration
{
((NSControl)View).SizeToFit ();
var size = View.Frame.Size;
- MinHeight = size.Height;
- MinWidth = size.Width;
+ MinHeight = (float)size.Height;
+ MinWidth = (float)size.Width;
}
protected override void OnLayoutEnded (RectangleF frame)
diff --git a/main/src/addins/MacPlatform/Dialogs/MacAddFileDialogHandler.cs b/main/src/addins/MacPlatform/Dialogs/MacAddFileDialogHandler.cs
index 69bc81075d..5e9a4e9247 100644
--- a/main/src/addins/MacPlatform/Dialogs/MacAddFileDialogHandler.cs
+++ b/main/src/addins/MacPlatform/Dialogs/MacAddFileDialogHandler.cs
@@ -28,8 +28,8 @@ using System;
using System.Drawing;
using System.Linq;
using System.Collections.Generic;
-using MonoMac.Foundation;
-using MonoMac.AppKit;
+using Foundation;
+using AppKit;
using MonoDevelop.Core;
using MonoDevelop.Ide;
@@ -64,7 +64,7 @@ namespace MonoDevelop.MacIntegration
};
box.Layout ();
panel.AccessoryView = box.View;
- box.Layout (box.View.Superview.Frame.Size);
+ box.Layout ((SizeF)box.View.Superview.Frame.Size);
} else {
dropdownBox.Layout ();
panel.AccessoryView = dropdownBox.View;
diff --git a/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs b/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs
index a40909f59a..1fb3534323 100644
--- a/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs
+++ b/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs
@@ -28,8 +28,9 @@ using System;
using System.Drawing;
using System.Linq;
using System.Collections.Generic;
-using MonoMac.Foundation;
-using MonoMac.AppKit;
+using Foundation;
+using AppKit;
+using CoreGraphics;
using MonoDevelop.Core;
using MonoDevelop.Ide;
@@ -135,7 +136,7 @@ namespace MonoDevelop.MacIntegration
// Hack up a slightly wider than normal alert dialog. I don't know how to do this in a nicer way
// as the min size constraints are apparently ignored.
var frame = ((NSPanel) alert.Window).Frame;
- ((NSPanel) alert.Window).SetFrame (new RectangleF (frame.X, frame.Y, Math.Max (frame.Width, 600), frame.Height), true);
+ ((NSPanel) alert.Window).SetFrame (new CGRect (frame.X, frame.Y, NMath.Max (frame.Width, 600), frame.Height), true);
alert.Layout ();
bool completed = false;
@@ -150,10 +151,10 @@ namespace MonoDevelop.MacIntegration
}
if (!data.Message.CancellationToken.IsCancellationRequested) {
- int result = alert.RunModal () - (int)NSAlertButtonReturn.First;
+ var result = (int)alert.RunModal () - (long)(int)NSAlertButtonReturn.First;
completed = true;
if (result >= 0 && result < buttons.Count) {
- data.ResultButton = buttons [result];
+ data.ResultButton = buttons [(int)result];
} else {
data.ResultButton = null;
}
@@ -165,7 +166,7 @@ namespace MonoDevelop.MacIntegration
if (optionButtons != null) {
foreach (var button in optionButtons) {
- var option = data.Options[button.Tag];
+ var option = data.Options[(int)button.Tag];
data.Message.SetOptionValue (option.Id, button.State != 0);
}
}
diff --git a/main/src/addins/MacPlatform/Dialogs/MacExceptionDialogHandler.cs b/main/src/addins/MacPlatform/Dialogs/MacExceptionDialogHandler.cs
index 3151d6ac88..cbe58b40af 100644
--- a/main/src/addins/MacPlatform/Dialogs/MacExceptionDialogHandler.cs
+++ b/main/src/addins/MacPlatform/Dialogs/MacExceptionDialogHandler.cs
@@ -25,11 +25,12 @@
// THE SOFTWARE.
using System;
-using System.Drawing;
using System.Linq;
using System.Collections.Generic;
-using MonoMac.Foundation;
-using MonoMac.AppKit;
+
+using Foundation;
+using CoreGraphics;
+using AppKit;
using MonoDevelop.Core;
using MonoDevelop.Ide;
@@ -43,7 +44,7 @@ namespace MonoDevelop.MacIntegration
{
class MyTextView : NSTextView
{
- public MyTextView (RectangleF frame)
+ public MyTextView (CGRect frame)
: base (frame)
{
@@ -103,13 +104,13 @@ namespace MonoDevelop.MacIntegration
}
if (data.Exception != null) {
- var scrollSize = new SizeF (400, 130);
+ var scrollSize = new CGSize (400, 130);
float spacing = 4;
string title = GettextCatalog.GetString ("View details");
string altTitle = GettextCatalog.GetString ("Hide details");
- var buttonFrame = new RectangleF (0, 0, 0, 0);
+ var buttonFrame = new CGRect (0, 0, 0, 0);
var button = new NSButton (buttonFrame) {
BezelStyle = NSBezelStyle.Disclosure,
Title = "",
@@ -123,23 +124,23 @@ namespace MonoDevelop.MacIntegration
};
label.SizeToFit ();
- button.SetFrameSize (new SizeF (button.Frame.Width, Math.Max (button.Frame.Height, label.Frame.Height)));
- label.SetFrameOrigin (new PointF (button.Frame.Width + 5, button.Frame.Y));
+ button.SetFrameSize (new CGSize (button.Frame.Width, NMath.Max (button.Frame.Height, label.Frame.Height)));
+ label.SetFrameOrigin (new CGPoint (button.Frame.Width + 5, button.Frame.Y));
- var text = new MyTextView (new RectangleF (0, 0, float.MaxValue, float.MaxValue)) {
+ var text = new MyTextView (new CGRect (0, 0, float.MaxValue, float.MaxValue)) {
HorizontallyResizable = true,
};
- text.TextContainer.ContainerSize = new SizeF (float.MaxValue, float.MaxValue);
+ text.TextContainer.ContainerSize = new CGSize (float.MaxValue, float.MaxValue);
text.TextContainer.WidthTracksTextView = true;
text.InsertText (new NSString (data.Exception.ToString ()));
text.Editable = false;
- var scrollView = new NSScrollView (new RectangleF (PointF.Empty, SizeF.Empty)) {
+ var scrollView = new NSScrollView (new CGRect (CGPoint.Empty, CGSize.Empty)) {
HasHorizontalScroller = true,
HasVerticalScroller = true,
};
- var accessory = new NSView (new RectangleF (0, 0, scrollSize.Width, button.Frame.Height));
+ var accessory = new NSView (new CGRect (0, 0, scrollSize.Width, button.Frame.Height));
accessory.AddSubview (scrollView);
accessory.AddSubview (button);
accessory.AddSubview (label);
@@ -147,18 +148,18 @@ namespace MonoDevelop.MacIntegration
alert.AccessoryView = accessory;
button.Activated += delegate {
- float change;
+ nfloat change;
if (button.State == NSCellStateValue.On) {
change = scrollSize.Height + spacing;
label.StringValue = altTitle;
scrollView.Hidden = false;
- scrollView.Frame = new RectangleF (PointF.Empty, scrollSize);
+ scrollView.Frame = new CGRect (CGPoint.Empty, scrollSize);
scrollView.DocumentView = text;
} else {
change = -(scrollSize.Height + spacing);
label.StringValue = title;
scrollView.Hidden = true;
- scrollView.Frame = new RectangleF (PointF.Empty, SizeF.Empty);
+ scrollView.Frame = new CGRect (CGPoint.Empty, CGSize.Empty);
}
var f = accessory.Frame;
f.Height += change;
@@ -182,7 +183,7 @@ namespace MonoDevelop.MacIntegration
label.OnMouseUp += (sender, e) => button.PerformClick (e.Event);
}
- int result = alert.RunModal () - (int)NSAlertButtonReturn.First;
+ var result = (int)(nint)alert.RunModal () - (int)(long)NSAlertButtonReturn.First;
data.ResultButton = buttons != null ? buttons [result] : null;
GtkQuartz.FocusWindow (data.TransientFor ?? MessageService.RootWindow);
}
@@ -257,4 +258,4 @@ namespace MonoDevelop.MacIntegration
public NSEvent Event { get; private set; }
}
}
-} \ No newline at end of file
+}
diff --git a/main/src/addins/MacPlatform/Dialogs/MacOpenFileDialogHandler.cs b/main/src/addins/MacPlatform/Dialogs/MacOpenFileDialogHandler.cs
index 8de26a5fa2..26ebb22236 100644
--- a/main/src/addins/MacPlatform/Dialogs/MacOpenFileDialogHandler.cs
+++ b/main/src/addins/MacPlatform/Dialogs/MacOpenFileDialogHandler.cs
@@ -28,8 +28,8 @@ using System;
using System.Drawing;
using System.Linq;
using System.Collections.Generic;
-using MonoMac.Foundation;
-using MonoMac.AppKit;
+using Foundation;
+using AppKit;
using MonoDevelop.Core;
using MonoDevelop.Ide;
@@ -189,7 +189,7 @@ namespace MonoDevelop.MacIntegration
if (closeSolutionButton != null)
data.CloseCurrentWorkspace = closeSolutionButton.State != NSCellStateValue.Off;
data.SelectedViewer = viewerSelector.IndexOfSelectedItem >= 0 ?
- currentViewers[viewerSelector.IndexOfSelectedItem] : null;
+ currentViewers[(int)viewerSelector.IndexOfSelectedItem] : null;
}
GtkQuartz.FocusWindow (data.TransientFor ?? MessageService.RootWindow);
diff --git a/main/src/addins/MacPlatform/Dialogs/MacSelectFileDialogHandler.cs b/main/src/addins/MacPlatform/Dialogs/MacSelectFileDialogHandler.cs
index 688c647d43..dc66a08485 100644
--- a/main/src/addins/MacPlatform/Dialogs/MacSelectFileDialogHandler.cs
+++ b/main/src/addins/MacPlatform/Dialogs/MacSelectFileDialogHandler.cs
@@ -30,8 +30,10 @@ using System.Drawing;
using System.Linq;
using System.Text.RegularExpressions;
using System.Collections.Generic;
-using MonoMac.Foundation;
-using MonoMac.AppKit;
+
+using Foundation;
+using CoreGraphics;
+using AppKit;
using MonoDevelop.Core;
using MonoDevelop.Ide;
@@ -185,7 +187,7 @@ namespace MonoDevelop.MacIntegration
var popup = new NSPopUpButton (new RectangleF (0, 6, 200, 18), false);
popup.SizeToFit ();
var rect = popup.Frame;
- popup.Frame = new RectangleF (rect.X, rect.Y, 200, rect.Height);
+ popup.Frame = new CGRect (rect.X, rect.Y, 200, rect.Height);
foreach (var filter in filters)
popup.AddItem (filter.Name);
@@ -197,7 +199,7 @@ namespace MonoDevelop.MacIntegration
panel.ShouldEnableUrl = GetFileFilter (filters[defaultIndex]);
popup.Activated += delegate {
- panel.ShouldEnableUrl = GetFileFilter (filters[popup.IndexOfSelectedItem]);
+ panel.ShouldEnableUrl = GetFileFilter (filters[(int)popup.IndexOfSelectedItem]);
panel.Display ();
};
@@ -219,7 +221,7 @@ namespace MonoDevelop.MacIntegration
AutoresizingMask = NSViewResizingMask.WidthSizable | NSViewResizingMask.MaxXMargin,
};
- var text = new NSTextField (new RectangleF (0, 6, 100, 20)) {
+ var text = new NSTextField (new CGRect (0, 6, 100, 20)) {
StringValue = label,
DrawsBackground = false,
Bordered = false,
@@ -227,17 +229,17 @@ namespace MonoDevelop.MacIntegration
Selectable = false
};
text.SizeToFit ();
- float textWidth = text.Frame.Width;
- float textHeight = text.Frame.Height;
+ var textWidth = text.Frame.Width;
+ var textHeight = text.Frame.Height;
control.SizeToFit ();
var rect = control.Frame;
- float controlHeight = rect.Height;
- control.Frame = new RectangleF (textWidth + 5, 0, controlWidth, rect.Height);
+ var controlHeight = rect.Height;
+ control.Frame = new CGRect (textWidth + 5, 0, controlWidth, rect.Height);
rect = view.Frame;
rect.Width = control.Frame.Width + textWidth + 5;
- rect.Height = Math.Max (controlHeight, textHeight);
+ rect.Height = NMath.Max (controlHeight, textHeight);
view.Frame = rect;
view.AddSubview (text);
diff --git a/main/src/addins/MacPlatform/Dialogs/SelectEncodingPanel.cs b/main/src/addins/MacPlatform/Dialogs/SelectEncodingPanel.cs
index 344b014a62..bc74f58ea1 100644
--- a/main/src/addins/MacPlatform/Dialogs/SelectEncodingPanel.cs
+++ b/main/src/addins/MacPlatform/Dialogs/SelectEncodingPanel.cs
@@ -30,8 +30,9 @@ using System.Drawing;
using System.Linq;
using MonoDevelop.Core;
using MonoDevelop.Projects.Text;
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+using AppKit;
+using Foundation;
+using CoreGraphics;
namespace MonoDevelop.MacIntegration
{
@@ -81,19 +82,19 @@ namespace MonoDevelop.MacIntegration
buttonView.Frame = buttonRect;
view.AddSubview (buttonView);
- float buttonAreaTop = buttonRect.Height + padding * 2;
-
+ var buttonAreaTop = buttonRect.Height + padding * 2;
+
var label = CreateLabel (GettextCatalog.GetString ("Available encodings:"));
var labelSize = label.Frame.Size;
- float labelBottom = size.Height - 12 - labelSize.Height;
- label.Frame = new RectangleF (12, labelBottom, labelSize.Width, labelSize.Height);
+ var labelBottom = size.Height - 12 - labelSize.Height;
+ label.Frame = new CGRect (12, labelBottom, labelSize.Width, labelSize.Height);
view.AddSubview (label);
var moveButtonWidth = 32;
var tableHeight = labelBottom - buttonAreaTop - padding;
var tableWidth = size.Width / 2 - padding * 3 - moveButtonWidth + padding / 2;
- allTable = new NSTableView (new RectangleF (padding, buttonAreaTop, tableWidth, tableHeight));
+ allTable = new NSTableView (new CGRect (padding, buttonAreaTop, tableWidth, tableHeight));
allTable.HeaderView = null;
var allScroll = new NSScrollView (allTable.Frame) {
BorderType = NSBorderType.BezelBorder,
@@ -107,10 +108,10 @@ namespace MonoDevelop.MacIntegration
var selectedLabel = CreateLabel (GettextCatalog.GetString ("Encodings shown in menu:"));
var selectedLabelSize = selectedLabel.Frame.Size;
- selectedLabel.Frame = new RectangleF (center, labelBottom, selectedLabelSize.Width, selectedLabelSize.Height);
+ selectedLabel.Frame = new CGRect (center, labelBottom, selectedLabelSize.Width, selectedLabelSize.Height);
view.AddSubview (selectedLabel);
- selectedTable = new NSTableView (new RectangleF (center, buttonAreaTop, tableWidth, tableHeight));
+ selectedTable = new NSTableView (new CGRect (center, buttonAreaTop, tableWidth, tableHeight));
selectedTable.HeaderView = null;
var selectedScroll = new NSScrollView (selectedTable.Frame) {
BorderType = NSBorderType.BezelBorder,
@@ -120,12 +121,12 @@ namespace MonoDevelop.MacIntegration
};
view.AddSubview (selectedScroll);
- float buttonLevel = tableHeight / 2 + buttonAreaTop;
+ var buttonLevel = tableHeight / 2 + buttonAreaTop;
var goRightImage = NSImage.ImageNamed ("NSGoRightTemplate");
addButton = new NSButton (
- new RectangleF (tableWidth + padding * 2, buttonLevel + padding / 2,
+ new CGRect (tableWidth + padding * 2, buttonLevel + padding / 2,
moveButtonWidth, moveButtonWidth)) {
//Title = "\u2192",
BezelStyle = NSBezelStyle.SmallSquare,
@@ -135,7 +136,7 @@ namespace MonoDevelop.MacIntegration
view.AddSubview (addButton);
removeButton = new NSButton (
- new RectangleF (tableWidth + padding * 2, buttonLevel - padding / 2 - moveButtonWidth,
+ new CGRect (tableWidth + padding * 2, buttonLevel - padding / 2 - moveButtonWidth,
moveButtonWidth, moveButtonWidth)) {
//Title = "\u2190",
BezelStyle = NSBezelStyle.SmallSquare,
@@ -145,7 +146,7 @@ namespace MonoDevelop.MacIntegration
view.AddSubview (removeButton);
upButton = new NSButton (
- new RectangleF (center + tableWidth + padding, buttonLevel + padding / 2,
+ new CGRect (center + tableWidth + padding, buttonLevel + padding / 2,
moveButtonWidth, moveButtonWidth)) {
//Title = "\u2191",
BezelStyle = NSBezelStyle.SmallSquare,
@@ -155,7 +156,7 @@ namespace MonoDevelop.MacIntegration
view.AddSubview (upButton);
downButton = new NSButton (
- new RectangleF (center + tableWidth + padding, buttonLevel - padding / 2 - moveButtonWidth,
+ new CGRect (center + tableWidth + padding, buttonLevel - padding / 2 - moveButtonWidth,
moveButtonWidth, moveButtonWidth)) {
//Title = "\u2193",
BezelStyle = NSBezelStyle.SmallSquare,
@@ -204,9 +205,9 @@ namespace MonoDevelop.MacIntegration
void Add (object sender, EventArgs e)
{
- var fromIndex = allTable.SelectedRow;
+ int fromIndex = (int)allTable.SelectedRow;
var encoding = allSource.encodings[fromIndex];
- var toIndex = selectedTable.SelectedRow + 1;
+ var toIndex = (int)(selectedTable.SelectedRow + 1);
if (toIndex <= 0)
toIndex = selectedSource.encodings.Count;
selectedSource.encodings.Insert (toIndex, encoding);
@@ -217,7 +218,7 @@ namespace MonoDevelop.MacIntegration
void Remove (object sender, EventArgs e)
{
- var index = selectedTable.SelectedRow;
+ var index = (int)selectedTable.SelectedRow;
selectedSource.encodings.RemoveAt (index);
selectedTable.ReloadData ();
if (index >= selectedSource.encodings.Count)
@@ -228,7 +229,7 @@ namespace MonoDevelop.MacIntegration
void MoveUp (object sender, EventArgs e)
{
- var index = selectedTable.SelectedRow;
+ var index = (int)selectedTable.SelectedRow;
var selected = selectedSource.encodings[index];
selectedSource.encodings[index] = selectedSource.encodings[index - 1];
selectedSource.encodings[index - 1] = selected;
@@ -239,7 +240,7 @@ namespace MonoDevelop.MacIntegration
void MoveDown (object sender, EventArgs e)
{
- var index = selectedTable.SelectedRow;
+ var index = (int)selectedTable.SelectedRow;
var selected = selectedSource.encodings[index];
selectedSource.encodings[index] = selectedSource.encodings[index + 1];
selectedSource.encodings[index + 1] = selected;
@@ -250,11 +251,11 @@ namespace MonoDevelop.MacIntegration
void UpdateButtons ()
{
- var allIndex = allTable.SelectedRow;
+ var allIndex = (int)allTable.SelectedRow;
var allEncoding = allIndex >= 0? allSource.encodings[allIndex] : null;
addButton.Enabled = allEncoding != null && !selectedSource.encodings.Any (e => e.Id == allEncoding.Id);
- var selectedIndex = selectedTable.SelectedRow;
+ var selectedIndex = (int)selectedTable.SelectedRow;
removeButton.Enabled = selectedIndex >= 0 && selectedSource.encodings.Count > 0;
upButton.Enabled = selectedIndex > 0;
downButton.Enabled = selectedIndex >= 0 && selectedIndex < selectedSource.encodings.Count - 1;
@@ -277,7 +278,7 @@ namespace MonoDevelop.MacIntegration
{
this.DidResignKey += StopSharedAppModal;
try {
- return SaveIfOk (NSApplication.SharedApplication.RunModalForWindow (this));
+ return SaveIfOk ((int)NSApplication.SharedApplication.RunModalForWindow (this));
} finally {
this.DidResignKey -= StopSharedAppModal;
}
@@ -292,12 +293,12 @@ namespace MonoDevelop.MacIntegration
public int RunModalSheet (NSWindow parent)
{
- var sel = new MonoMac.ObjCRuntime.Selector ("sheetSel");
+ var sel = new ObjCRuntime.Selector ("sheetSel");
NSApplication.SharedApplication.BeginSheet (this, parent, this, sel, IntPtr.Zero);
this.DidResignKey += StopSharedAppModal;
try {
sheet = true;
- return SaveIfOk (NSApplication.SharedApplication.RunModalForWindow (this));
+ return SaveIfOk ((int)NSApplication.SharedApplication.RunModalForWindow (this));
} finally {
sheet = false;
this.DidResignKey -= StopSharedAppModal;
@@ -336,14 +337,14 @@ namespace MonoDevelop.MacIntegration
this.encodings = new List<TextEncoding> (encodings);
}
- public override int GetRowCount (NSTableView tableView)
+ public override nint GetRowCount (NSTableView tableView)
{
return encodings.Count;
}
- public override NSObject GetObjectValue (NSTableView tableView, NSTableColumn tableColumn, int row)
+ public override NSObject GetObjectValue (NSTableView tableView, NSTableColumn tableColumn, nint row)
{
- var encoding = encodings[row];
+ var encoding = encodings[(int)row];
return new NSString (string.Format ("{0} ({1})", encoding.Name, encoding.Id));
}
}
diff --git a/main/src/addins/MacPlatform/Dialogs/SelectEncodingPopUpButton.cs b/main/src/addins/MacPlatform/Dialogs/SelectEncodingPopUpButton.cs
index 14a71e5795..05db8544dd 100644
--- a/main/src/addins/MacPlatform/Dialogs/SelectEncodingPopUpButton.cs
+++ b/main/src/addins/MacPlatform/Dialogs/SelectEncodingPopUpButton.cs
@@ -28,8 +28,8 @@ using System;
using System.Drawing;
using System.Linq;
using System.Collections.Generic;
-using MonoMac.Foundation;
-using MonoMac.AppKit;
+using Foundation;
+using AppKit;
using MonoDevelop.Core;
using MonoDevelop.Ide;
@@ -43,8 +43,8 @@ namespace MonoDevelop.MacIntegration
{
class SelectEncodingPopUpButton : NSPopUpButton
{
- MonoMac.ObjCRuntime.Selector itemActivationSel = new MonoMac.ObjCRuntime.Selector ("itemActivated:");
- MonoMac.ObjCRuntime.Selector addRemoveActivationSel = new MonoMac.ObjCRuntime.Selector ("addRemoveActivated:");
+ ObjCRuntime.Selector itemActivationSel = new ObjCRuntime.Selector ("itemActivated:");
+ ObjCRuntime.Selector addRemoveActivationSel = new ObjCRuntime.Selector ("addRemoveActivated:");
NSMenuItem autoDetectedItem, addRemoveItem;
int[] encodings;
diff --git a/main/src/addins/MacPlatform/ExtendedTitleBarDialogBackend.cs b/main/src/addins/MacPlatform/ExtendedTitleBarDialogBackend.cs
index 3081634794..b65f0debb0 100644
--- a/main/src/addins/MacPlatform/ExtendedTitleBarDialogBackend.cs
+++ b/main/src/addins/MacPlatform/ExtendedTitleBarDialogBackend.cs
@@ -25,7 +25,7 @@
// THE SOFTWARE.
using System;
using MonoDevelop.MacInterop;
-using MonoMac.AppKit;
+using AppKit;
using MonoDevelop.Components;
using Mono.TextEditor;
using MonoDevelop.Components.Extensions;
diff --git a/main/src/addins/MacPlatform/ExtendedTitleBarWindowBackend.cs b/main/src/addins/MacPlatform/ExtendedTitleBarWindowBackend.cs
index 085e0cad85..d6dc9051d1 100644
--- a/main/src/addins/MacPlatform/ExtendedTitleBarWindowBackend.cs
+++ b/main/src/addins/MacPlatform/ExtendedTitleBarWindowBackend.cs
@@ -25,7 +25,7 @@
// THE SOFTWARE.
using System;
using MonoDevelop.MacInterop;
-using MonoMac.AppKit;
+using AppKit;
using MonoDevelop.Components;
using Mono.TextEditor;
using MonoDevelop.Components.Extensions;
diff --git a/main/src/addins/MacPlatform/MacIntegrationCommands.cs b/main/src/addins/MacPlatform/MacIntegrationCommands.cs
index 24519e8e03..046fd91843 100644
--- a/main/src/addins/MacPlatform/MacIntegrationCommands.cs
+++ b/main/src/addins/MacPlatform/MacIntegrationCommands.cs
@@ -26,7 +26,7 @@
using MonoDevelop.Ide;
using MonoDevelop.Components.Commands;
-using MonoMac.AppKit;
+using AppKit;
using System.Linq;
namespace MonoDevelop.MacIntegration
diff --git a/main/src/addins/MacPlatform/MacInterop/GtkQuartz.cs b/main/src/addins/MacPlatform/MacInterop/GtkQuartz.cs
index 9d68c0a904..f065f106ae 100644
--- a/main/src/addins/MacPlatform/MacInterop/GtkQuartz.cs
+++ b/main/src/addins/MacPlatform/MacInterop/GtkQuartz.cs
@@ -26,7 +26,7 @@
using System;
using System.Runtime.InteropServices;
-using MonoMac.AppKit;
+using AppKit;
using System.Linq;
using System.Collections.Generic;
@@ -70,7 +70,7 @@ namespace MonoDevelop.MacInterop
var ptr = gdk_quartz_window_get_nswindow (window.GdkWindow.Handle);
if (ptr == IntPtr.Zero)
return null;
- return MonoMac.ObjCRuntime.Runtime.GetNSObject (ptr) as NSWindow;
+ return ObjCRuntime.Runtime.GetNSObject<NSWindow> (ptr);
}
public static NSView GetView (Gtk.Widget widget)
@@ -78,7 +78,7 @@ namespace MonoDevelop.MacInterop
var ptr = gdk_quartz_window_get_nsview (widget.GdkWindow.Handle);
if (ptr == IntPtr.Zero)
return null;
- return MonoMac.ObjCRuntime.Runtime.GetNSObject (ptr) as NSView;
+ return ObjCRuntime.Runtime.GetNSObject<NSView> (ptr);
}
[DllImport (LIBQUARTZ)]
diff --git a/main/src/addins/MacPlatform/MacInterop/LaunchServices.cs b/main/src/addins/MacPlatform/MacInterop/LaunchServices.cs
index 4cb8a7955e..cba21f5a40 100644
--- a/main/src/addins/MacPlatform/MacInterop/LaunchServices.cs
+++ b/main/src/addins/MacPlatform/MacInterop/LaunchServices.cs
@@ -27,7 +27,7 @@
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
-using MonoMac.Foundation;
+using Foundation;
namespace MonoDevelop.MacInterop
{
@@ -132,7 +132,7 @@ namespace MonoDevelop.MacInterop
appParams.environment = dict.Handle;
}
- var cfUrl = global::MonoMac.CoreFoundation.CFUrl.FromFile (application.Application);
+ var cfUrl = global::CoreFoundation.CFUrl.FromFile (application.Application);
ProcessSerialNumber psn;
try {
diff --git a/main/src/addins/MacPlatform/MacMenu/MDLinkMenuItem.cs b/main/src/addins/MacPlatform/MacMenu/MDLinkMenuItem.cs
index ecc041a5f9..d222a44fbe 100644
--- a/main/src/addins/MacPlatform/MacMenu/MDLinkMenuItem.cs
+++ b/main/src/addins/MacPlatform/MacMenu/MDLinkMenuItem.cs
@@ -24,9 +24,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using MonoMac.AppKit;
+using AppKit;
using MonoDevelop.Components.Commands;
-using MonoMac.Foundation;
+using Foundation;
namespace MonoDevelop.MacIntegration.MacMenu
{
diff --git a/main/src/addins/MacPlatform/MacMenu/MDMenu.cs b/main/src/addins/MacPlatform/MacMenu/MDMenu.cs
index c181434c06..cb63868a02 100644
--- a/main/src/addins/MacPlatform/MacMenu/MDMenu.cs
+++ b/main/src/addins/MacPlatform/MacMenu/MDMenu.cs
@@ -26,9 +26,9 @@
using System;
using System.Linq;
-using MonoMac.AppKit;
+using AppKit;
using MonoDevelop.Components.Commands;
-using MonoMac.Foundation;
+using Foundation;
using System.Diagnostics;
using MonoDevelop.Core;
diff --git a/main/src/addins/MacPlatform/MacMenu/MDMenuItem.cs b/main/src/addins/MacPlatform/MacMenu/MDMenuItem.cs
index af2df66f57..170a6e9d76 100644
--- a/main/src/addins/MacPlatform/MacMenu/MDMenuItem.cs
+++ b/main/src/addins/MacPlatform/MacMenu/MDMenuItem.cs
@@ -25,12 +25,12 @@
// THE SOFTWARE.
using System;
-using MonoMac.AppKit;
+using AppKit;
using MonoDevelop.Components.Commands;
using MonoDevelop.Core;
using System.Text;
-using MonoMac.Foundation;
-using MonoMac.ObjCRuntime;
+using Foundation;
+using ObjCRuntime;
using System.Collections.Generic;
namespace MonoDevelop.MacIntegration.MacMenu
diff --git a/main/src/addins/MacPlatform/MacMenu/MDServicesMenuItem.cs b/main/src/addins/MacPlatform/MacMenu/MDServicesMenuItem.cs
index dac947161a..bfbbe42b14 100644
--- a/main/src/addins/MacPlatform/MacMenu/MDServicesMenuItem.cs
+++ b/main/src/addins/MacPlatform/MacMenu/MDServicesMenuItem.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using MonoMac.AppKit;
+using AppKit;
using MonoDevelop.Core;
namespace MonoDevelop.MacIntegration.MacMenu
diff --git a/main/src/addins/MacPlatform/MacMenu/MDSubMenuItem.cs b/main/src/addins/MacPlatform/MacMenu/MDSubMenuItem.cs
index 84de750319..6d2b198662 100644
--- a/main/src/addins/MacPlatform/MacMenu/MDSubMenuItem.cs
+++ b/main/src/addins/MacPlatform/MacMenu/MDSubMenuItem.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using MonoMac.AppKit;
+using AppKit;
using MonoDevelop.Components.Commands;
using System.Linq;
diff --git a/main/src/addins/MacPlatform/MacPlatform.cs b/main/src/addins/MacPlatform/MacPlatform.cs
index ce552b1e04..5d5fa63b97 100644
--- a/main/src/addins/MacPlatform/MacPlatform.cs
+++ b/main/src/addins/MacPlatform/MacPlatform.cs
@@ -35,8 +35,9 @@ using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+using AppKit;
+using Foundation;
+using CoreGraphics;
using MonoDevelop.Core;
using MonoDevelop.Core.Execution;
@@ -418,7 +419,7 @@ namespace MonoDevelop.MacIntegration
public static Gdk.Pixbuf GetPixbufFromNSImageRep (NSImageRep rep, int width, int height)
{
- var rect = new RectangleF (0, 0, width, height);
+ var rect = new CGRect (0, 0, width, height);
var bitmap = rep as NSBitmapImageRep;
try {
@@ -438,7 +439,7 @@ namespace MonoDevelop.MacIntegration
public static Gdk.Pixbuf GetPixbufFromNSImage (NSImage icon, int width, int height)
{
- var rect = new RectangleF (0, 0, width, height);
+ var rect = new CGRect (0, 0, width, height);
var rep = icon.BestRepresentation (rect, null, null);
var bitmap = rep as NSBitmapImageRep;
@@ -467,7 +468,7 @@ namespace MonoDevelop.MacIntegration
System.Runtime.InteropServices.Marshal.Copy (tiff.Bytes, data, 0, data.Length);
}
- int pw = bitmap.PixelsWide, ph = bitmap.PixelsHigh;
+ int pw = (int)bitmap.PixelsWide, ph = (int)bitmap.PixelsHigh;
var pixbuf = new Gdk.Pixbuf (data, pw, ph);
// if one dimension matches, and the other is same or smaller, use as-is
@@ -549,7 +550,7 @@ namespace MonoDevelop.MacIntegration
//for now, just filter out the duplicates
var checkUniqueName = new HashSet<string> ();
var checkUniquePath = new HashSet<string> ();
-
+
//FIXME: bundle path is wrong because of how MD is built into an app
//var thisPath = NSBundle.MainBundle.BundleUrl.Path;
//checkUniquePath.Add (thisPath);
@@ -557,11 +558,13 @@ namespace MonoDevelop.MacIntegration
checkUniqueName.Add ("MonoDevelop");
checkUniqueName.Add (BrandingService.ApplicationName);
- string def = CoreFoundation.GetApplicationUrl (filename, CoreFoundation.LSRolesMask.All);
+ string def = MonoDevelop.MacInterop.CoreFoundation.GetApplicationUrl (filename,
+ MonoDevelop.MacInterop.CoreFoundation.LSRolesMask.All);
var apps = new List<DesktopApplication> ();
- foreach (var app in CoreFoundation.GetApplicationUrls (filename, CoreFoundation.LSRolesMask.All)) {
+ foreach (var app in MonoDevelop.MacInterop.CoreFoundation.GetApplicationUrls (filename,
+ MonoDevelop.MacInterop.CoreFoundation.LSRolesMask.All)) {
if (string.IsNullOrEmpty (app) || !checkUniquePath.Add (app))
continue;
var name = NSFileManager.DefaultManager.DisplayName (app);
@@ -591,14 +594,14 @@ namespace MonoDevelop.MacIntegration
NSWorkspace.SharedWorkspace.OpenFile (file, Id);
}
}
-
+
public override Gdk.Rectangle GetUsableMonitorGeometry (Gdk.Screen screen, int monitor_id)
{
Gdk.Rectangle ygeometry = screen.GetMonitorGeometry (monitor_id);
Gdk.Rectangle xgeometry = screen.GetMonitorGeometry (0);
NSScreen monitor = NSScreen.Screens[monitor_id];
- RectangleF visible = monitor.VisibleFrame;
- RectangleF frame = monitor.Frame;
+ var visible = monitor.VisibleFrame;
+ var frame = monitor.Frame;
// Note: Frame and VisibleFrame rectangles are relative to monitor 0, but we need absolute
// coordinates.
@@ -611,11 +614,11 @@ namespace MonoDevelop.MacIntegration
//
// We need to swap the Y offset with the menu height because our callers expect the Y offset
// to be from the top of the screen, not from the bottom of the screen.
- float x, y, width, height;
+ nfloat x, y, width, height;
if (visible.Height <= frame.Height) {
- float dockHeight = visible.Y - frame.Y;
- float menubarHeight = (frame.Height - visible.Height) - dockHeight;
+ var dockHeight = visible.Y - frame.Y;
+ var menubarHeight = (frame.Height - visible.Height) - dockHeight;
height = frame.Height - menubarHeight - dockHeight;
y = ygeometry.Y + menubarHeight;
@@ -625,8 +628,8 @@ namespace MonoDevelop.MacIntegration
}
// Takes care of the possibility of the Dock being positioned on the left or right edge of the screen.
- width = Math.Min (visible.Width, frame.Width);
- x = Math.Max (visible.X, frame.X);
+ width = NMath.Min (visible.Width, frame.Width);
+ x = NMath.Max (visible.X, frame.X);
return new Gdk.Rectangle ((int) x, (int) y, (int) width, (int) height);
}
@@ -639,7 +642,7 @@ namespace MonoDevelop.MacIntegration
static Cairo.Color ConvertColor (NSColor color)
{
- float r, g, b, a;
+ nfloat r, g, b, a;
if (color.ColorSpaceName == NSColorSpace.DeviceWhite) {
a = 1.0f;
r = g = b = color.WhiteComponent;
@@ -725,13 +728,8 @@ namespace MonoDevelop.MacIntegration
}
NSWindow nswin = GtkQuartz.GetWindow (window);
- if (isFullscreen != ((nswin.StyleMask & NSWindowStyle.FullScreenWindow) != 0)) {
- //HACK: workaround for MonoMac not allowing null as argument
- MonoMac.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr (
- nswin.Handle,
- MonoMac.ObjCRuntime.Selector.GetHandle ("toggleFullScreen:"),
- IntPtr.Zero);
- }
+ if (isFullscreen != ((nswin.StyleMask & NSWindowStyle.FullScreenWindow) != 0))
+ nswin.ToggleFullScreen (null);
}
public override bool IsModalDialogRunning ()
diff --git a/main/src/addins/MacPlatform/MacPlatform.csproj b/main/src/addins/MacPlatform/MacPlatform.csproj
index 8f810e5492..a26c3cd4d7 100644
--- a/main/src/addins/MacPlatform/MacPlatform.csproj
+++ b/main/src/addins/MacPlatform/MacPlatform.csproj
@@ -48,8 +48,8 @@
<Reference Include="Mono.Posix" />
<Reference Include="System.Web" />
<Reference Include="System.Drawing" />
- <Reference Include="MonoMac">
- <HintPath>..\..\..\external\monomac\src\MonoMac.dll</HintPath>
+ <Reference Include="Xamarin.Mac">
+ <HintPath>..\..\..\external\Xamarin.Mac.dll</HintPath>
</Reference>
<Reference Include="Mono.Cairo" />
</ItemGroup>
@@ -128,6 +128,7 @@
<Compile Include="MacProxyCredentialProvider.cs" />
<Compile Include="ExtendedTitleBarWindowBackend.cs" />
<Compile Include="ExtendedTitleBarDialogBackend.cs" />
+ <Compile Include="MacInterop\NMath.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am" />
diff --git a/main/src/addins/MacPlatform/MacProxyCredentialProvider.cs b/main/src/addins/MacPlatform/MacProxyCredentialProvider.cs
index 1413de25e6..12c2b8ac41 100644
--- a/main/src/addins/MacPlatform/MacProxyCredentialProvider.cs
+++ b/main/src/addins/MacPlatform/MacProxyCredentialProvider.cs
@@ -31,8 +31,8 @@ using MonoDevelop.Core;
using MonoDevelop.Core.Web;
using MonoDevelop.Ide;
-using MonoMac.AppKit;
-using MonoMac.Foundation;
+using AppKit;
+using Foundation;
using MonoDevelop.MacInterop;
namespace MonoDevelop.MacIntegration