mac: Use updated Xamarin.Mac APIs

This commit is contained in:
Hylke Bons 2017-09-10 13:37:45 +01:00
parent 1673ddbabf
commit 3abb79611d
8 changed files with 191 additions and 189 deletions

View file

@ -1,4 +1,4 @@
// SparkleShare, a collaboration and sharing tool. // SparkleShare, a collaboration and sharing tool.
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@ -67,10 +67,14 @@ namespace SparkleShare {
public override void CreateSparkleShareFolder () public override void CreateSparkleShareFolder ()
{ {
if (!Directory.Exists (SparkleShare.Controller.FoldersPath)) { if (Directory.Exists (SparkleShare.Controller.FoldersPath))
return;
Directory.CreateDirectory (SparkleShare.Controller.FoldersPath); Directory.CreateDirectory (SparkleShare.Controller.FoldersPath);
Syscall.chmod (SparkleShare.Controller.FoldersPath, (FilePermissions) 448); // 448 -> 700
} // TODO: Use proper API
var chmod = new Command ("chmod", "700 " + SparkleShare.Controller.FoldersPath);
chmod.StartAndWaitForExit ();
} }
@ -216,13 +220,12 @@ namespace SparkleShare {
public delegate void Code (); public delegate void Code ();
readonly NSObject obj = new NSObject ();
public void Invoke (Code code) public void Invoke (Code code)
{ {
using (var a = new NSAutoreleasePool ()) using (var a = new NSAutoreleasePool ())
{ {
obj.InvokeOnMainThread (() => code ()); new NSObject ().InvokeOnMainThread (() => code ());
} }
} }
} }

View file

@ -1,4 +1,4 @@
// SparkleShare, a collaboration and sharing tool. // SparkleShare, a collaboration and sharing tool.
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@ -16,9 +16,9 @@
using System; using System;
using System.Drawing;
using AppKit; using AppKit;
using CoreGraphics;
using Foundation; using Foundation;
namespace SparkleShare { namespace SparkleShare {
@ -38,21 +38,21 @@ namespace SparkleShare {
public About () : base () public About () : base ()
{ {
SetFrame (new RectangleF (0, 0, 640, 281), true); SetFrame (new CGRect (0, 0, 640, 281), true);
Center (); Center ();
Delegate = new SparkleAboutDelegate (); Delegate = new SparkleAboutDelegate ();
StyleMask = (NSWindowStyle.Closable | NSWindowStyle.Titled); StyleMask = (NSWindowStyle.Closable | NSWindowStyle.Titled);
Title = "About SparkleShare"; Title = "About SparkleShare";
MaxSize = new SizeF (640, 281); MaxSize = new CGSize (640, 281);
MinSize = new SizeF (640, 281); MinSize = new CGSize (640, 281);
HasShadow = true; HasShadow = true;
IsOpaque = false; IsOpaque = false;
BackingType = NSBackingStore.Buffered; BackingType = NSBackingStore.Buffered;
Level = NSWindowLevel.Floating; Level = NSWindowLevel.Floating;
this.hidden_close_button = new NSButton () { this.hidden_close_button = new NSButton () {
Frame = new RectangleF (0, 0, 0, 0), Frame = new CGRect (0, 0, 0, 0),
KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask, KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
KeyEquivalent = "w" KeyEquivalent = "w"
}; };
@ -82,22 +82,22 @@ namespace SparkleShare {
private void CreateAbout () private void CreateAbout ()
{ {
this.about_image = NSImage.ImageNamed ("about"); this.about_image = NSImage.ImageNamed ("about");
this.about_image.Size = new SizeF (720, 260); this.about_image.Size = new CGSize (720, 260);
this.about_image_view = new NSImageView () { this.about_image_view = new NSImageView () {
Image = this.about_image, Image = this.about_image,
Frame = new RectangleF (0, 0, 720, 260) Frame = new CGRect (0, 0, 720, 260)
}; };
this.version_text_field = new SparkleLabel ("version " + Controller.RunningVersion, NSTextAlignment.Left) { this.version_text_field = new SparkleLabel ("version " + Controller.RunningVersion, NSTextAlignment.Left) {
DrawsBackground = false, DrawsBackground = false,
Frame = new RectangleF (295, 140, 318, 22), Frame = new CGRect (295, 140, 318, 22),
TextColor = NSColor.White TextColor = NSColor.White
}; };
this.updates_text_field = new SparkleLabel ("Checking for updates...", NSTextAlignment.Left) { this.updates_text_field = new SparkleLabel ("Checking for updates...", NSTextAlignment.Left) {
DrawsBackground = false, DrawsBackground = false,
Frame = new RectangleF (295, Frame.Height - 232, 318, 98), Frame = new CGRect (295, Frame.Height - 232, 318, 98),
TextColor = NSColor.FromCalibratedRgba (1.0f, 1.0f, 1.0f, 0.5f) TextColor = NSColor.FromCalibratedRgba (1.0f, 1.0f, 1.0f, 0.5f)
}; };
@ -108,26 +108,26 @@ namespace SparkleShare {
"under the GNU GPLv3", NSTextAlignment.Left) { "under the GNU GPLv3", NSTextAlignment.Left) {
DrawsBackground = false, DrawsBackground = false,
Frame = new RectangleF (295, Frame.Height - 260, 318, 98), Frame = new CGRect (295, Frame.Height - 260, 318, 98),
TextColor = NSColor.White TextColor = NSColor.White
}; };
this.website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress); this.website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress);
this.website_link.Frame = new RectangleF (new PointF (295, 25), this.website_link.Frame.Size); this.website_link.Frame = new CGRect (new CGPoint (295, 25), this.website_link.Frame.Size);
this.credits_link = new SparkleLink ("Credits", Controller.CreditsLinkAddress); this.credits_link = new SparkleLink ("Credits", Controller.CreditsLinkAddress);
this.credits_link.Frame = new RectangleF ( this.credits_link.Frame = new CGRect (
new PointF (this.website_link.Frame.X + this.website_link.Frame.Width + 10, 25), new CGPoint (this.website_link.Frame.X + this.website_link.Frame.Width + 10, 25),
this.credits_link.Frame.Size); this.credits_link.Frame.Size);
this.report_problem_link = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress); this.report_problem_link = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress);
this.report_problem_link.Frame = new RectangleF ( this.report_problem_link.Frame = new CGRect (
new PointF (this.credits_link.Frame.X + this.credits_link.Frame.Width + 10, 25), new CGPoint (this.credits_link.Frame.X + this.credits_link.Frame.Width + 10, 25),
this.report_problem_link.Frame.Size); this.report_problem_link.Frame.Size);
this.debug_log_link = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress); this.debug_log_link = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress);
this.debug_log_link.Frame = new RectangleF ( this.debug_log_link.Frame = new CGRect (
new PointF (this.report_problem_link.Frame.X + this.report_problem_link.Frame.Width + 10, 25), new CGPoint (this.report_problem_link.Frame.X + this.report_problem_link.Frame.Width + 10, 25),
this.debug_log_link.Frame.Size); this.debug_log_link.Frame.Size);
ContentView.AddSubview (this.about_image_view); ContentView.AddSubview (this.about_image_view);

View file

@ -38,7 +38,7 @@ namespace SparkleShare {
var notification = new NSUserNotification { var notification = new NSUserNotification {
Title = title, Title = title,
InformativeText = subtext, InformativeText = subtext,
DeliveryDate = DateTime.Now DeliveryDate = (NSDate) DateTime.Now
}; };
NSUserNotificationCenter center = NSUserNotificationCenter.DefaultUserNotificationCenter; NSUserNotificationCenter center = NSUserNotificationCenter.DefaultUserNotificationCenter;

View file

@ -1,4 +1,4 @@
// SparkleShare, a collaboration and sharing tool. // SparkleShare, a collaboration and sharing tool.
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@ -16,10 +16,10 @@
using System; using System;
using System.Drawing;
using System.IO; using System.IO;
using AppKit; using AppKit;
using CoreGraphics;
using Foundation; using Foundation;
using WebKit; using WebKit;
@ -56,33 +56,33 @@ namespace SparkleShare {
float y = (float) (NSScreen.MainScreen.Frame.Height * 0.5 - (height * 0.5)); float y = (float) (NSScreen.MainScreen.Frame.Height * 0.5 - (height * 0.5));
SetFrame ( SetFrame (
new RectangleF ( new CGRect (
new PointF (x, y), new CGPoint (x, y),
new SizeF (min_width, height)), new CGSize (min_width, height)),
true); true);
StyleMask = (NSWindowStyle.Closable | NSWindowStyle.Miniaturizable | StyleMask = (NSWindowStyle.Closable | NSWindowStyle.Miniaturizable |
NSWindowStyle.Titled | NSWindowStyle.Resizable); NSWindowStyle.Titled | NSWindowStyle.Resizable);
MinSize = new SizeF (min_width, min_height); MinSize = new CGSize (min_width, min_height);
HasShadow = true; HasShadow = true;
IsOpaque = false; IsOpaque = false;
BackingType = NSBackingStore.Buffered; BackingType = NSBackingStore.Buffered;
TitlebarHeight = Frame.Height - ContentView.Frame.Height; TitlebarHeight = (float) (Frame.Height - ContentView.Frame.Height);
Level = NSWindowLevel.Floating; Level = NSWindowLevel.Floating;
this.web_view = new WebView (new RectangleF (0, 0, 481, 579), "", "") { this.web_view = new WebView (new CGRect (0, 0, 481, 579), "", "") {
Frame = new RectangleF (new PointF (0, 0), Frame = new CGRect (new CGPoint (0, 0),
new SizeF (ContentView.Frame.Width, ContentView.Frame.Height - 39)) new CGSize (ContentView.Frame.Width, ContentView.Frame.Height - 39))
}; };
this.web_view.Preferences.PlugInsEnabled = false; this.web_view.Preferences.PlugInsEnabled = false;
this.cover = new NSBox () { this.cover = new NSBox () {
Frame = new RectangleF ( Frame = new CGRect (
new PointF (-1, -1), new CGPoint (-1, -1),
new SizeF (Frame.Width + 2, this.web_view.Frame.Height + 1)), new CGSize (Frame.Width + 2, this.web_view.Frame.Height + 1)),
FillColor = NSColor.White, FillColor = NSColor.White,
BorderType = NSBorderType.NoBorder, BorderType = NSBorderType.NoBorder,
BoxType = NSBoxType.NSBoxCustom BoxType = NSBoxType.NSBoxCustom
@ -103,9 +103,9 @@ namespace SparkleShare {
BackgroundColor = NSColor.WindowBackground, BackgroundColor = NSColor.WindowBackground,
Bordered = false, Bordered = false,
Editable = false, Editable = false,
Frame = new RectangleF ( Frame = new CGRect (
new PointF (0, ContentView.Frame.Height - 31), new CGPoint (0, ContentView.Frame.Height - 31),
new SizeF (60, 20)), new CGSize (60, 20)),
StringValue = "Size:" StringValue = "Size:"
}; };
@ -114,9 +114,9 @@ namespace SparkleShare {
BackgroundColor = NSColor.WindowBackground, BackgroundColor = NSColor.WindowBackground,
Bordered = false, Bordered = false,
Editable = false, Editable = false,
Frame = new RectangleF ( Frame = new CGRect (
new PointF (60, ContentView.Frame.Height - 27), new CGPoint (60, ContentView.Frame.Height - 27),
new SizeF (60, 20)), new CGSize (60, 20)),
StringValue = "…", StringValue = "…",
Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize) Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize)
}; };
@ -127,9 +127,9 @@ namespace SparkleShare {
BackgroundColor = NSColor.WindowBackground, BackgroundColor = NSColor.WindowBackground,
Bordered = false, Bordered = false,
Editable = false, Editable = false,
Frame = new RectangleF ( Frame = new CGRect (
new PointF (130, ContentView.Frame.Height - 31), new CGPoint (130, ContentView.Frame.Height - 31),
new SizeF (60, 20)), new CGSize (60, 20)),
StringValue = "History:" StringValue = "History:"
}; };
@ -138,34 +138,34 @@ namespace SparkleShare {
BackgroundColor = NSColor.WindowBackground, BackgroundColor = NSColor.WindowBackground,
Bordered = false, Bordered = false,
Editable = false, Editable = false,
Frame = new RectangleF ( Frame = new CGRect (
new PointF (190, ContentView.Frame.Height - 27), new CGPoint (190, ContentView.Frame.Height - 27),
new SizeF (60, 20) new CGSize (60, 20)
), ),
StringValue = "…", StringValue = "…",
Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize) Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize)
}; };
this.popup_button = new NSPopUpButton () { this.popup_button = new NSPopUpButton () {
Frame = new RectangleF ( Frame = new CGRect (
new PointF (ContentView.Frame.Width - 156 - 12, ContentView.Frame.Height - 33), new CGPoint (ContentView.Frame.Width - 156 - 12, ContentView.Frame.Height - 33),
new SizeF (156, 26)), new CGSize (156, 26)),
PullsDown = false PullsDown = false
}; };
this.background = new NSBox () { this.background = new NSBox () {
Frame = new RectangleF ( Frame = new CGRect (
new PointF (-1, -1), new CGPoint (-1, -1),
new SizeF (Frame.Width + 2, this.web_view.Frame.Height + 2)), new CGSize (Frame.Width + 2, this.web_view.Frame.Height + 2)),
FillColor = NSColor.White, FillColor = NSColor.White,
BorderColor = NSColor.LightGray, BorderColor = NSColor.LightGray,
BoxType = NSBoxType.NSBoxCustom BoxType = NSBoxType.NSBoxCustom
}; };
this.progress_indicator = new NSProgressIndicator () { this.progress_indicator = new NSProgressIndicator () {
Frame = new RectangleF ( Frame = new CGRect (
new PointF (Frame.Width / 2 - 10, this.web_view.Frame.Height / 2 + 10), new CGPoint (Frame.Width / 2 - 10, this.web_view.Frame.Height / 2 + 10),
new SizeF (20, 20)), new CGSize (20, 20)),
Style = NSProgressIndicatorStyle.Spinning Style = NSProgressIndicatorStyle.Spinning
}; };
@ -180,7 +180,7 @@ namespace SparkleShare {
ContentView.AddSubview (this.background); ContentView.AddSubview (this.background);
ContentView.AddSubview (this.hidden_close_button); ContentView.AddSubview (this.hidden_close_button);
(Delegate as SparkleEventsDelegate).WindowResized += delegate (SizeF new_window_size) { (Delegate as SparkleEventsDelegate).WindowResized += delegate (CGSize new_window_size) {
SparkleShare.Controller.Invoke (() => Relayout (new_window_size)); SparkleShare.Controller.Invoke (() => Relayout (new_window_size));
}; };
@ -240,7 +240,7 @@ namespace SparkleShare {
PreventsApplicationTerminationWhenModal = false PreventsApplicationTerminationWhenModal = false
}; };
if ((NSPanelButtonType) panel.RunModal () == NSPanelButtonType.Ok) { if ((NSPanelButtonType) (int) panel.RunModal () == NSPanelButtonType.Ok) {
string target_file_path = Path.Combine (panel.DirectoryUrl.RelativePath, panel.NameFieldStringValue); string target_file_path = Path.Combine (panel.DirectoryUrl.RelativePath, panel.NameFieldStringValue);
Controller.SaveDialogCompleted (target_file_path); Controller.SaveDialogCompleted (target_file_path);
@ -252,41 +252,41 @@ namespace SparkleShare {
} }
public void Relayout (SizeF new_window_size) public void Relayout (CGSize new_window_size)
{ {
this.web_view.Frame = new RectangleF (this.web_view.Frame.Location, this.web_view.Frame = new CGRect (this.web_view.Frame.Location,
new SizeF (new_window_size.Width, new_window_size.Height - TitlebarHeight - 39)); new CGSize (new_window_size.Width, new_window_size.Height - TitlebarHeight - 39));
this.cover.Frame = new RectangleF (this.cover.Frame.Location, this.cover.Frame = new CGRect (this.cover.Frame.Location,
new SizeF (new_window_size.Width, new_window_size.Height - TitlebarHeight - 39)); new CGSize (new_window_size.Width, new_window_size.Height - TitlebarHeight - 39));
this.background.Frame = new RectangleF (this.background.Frame.Location, this.background.Frame = new CGRect (this.background.Frame.Location,
new SizeF (new_window_size.Width, new_window_size.Height - TitlebarHeight - 37)); new CGSize (new_window_size.Width, new_window_size.Height - TitlebarHeight - 37));
this.size_label.Frame = new RectangleF ( this.size_label.Frame = new CGRect (
new PointF (this.size_label.Frame.X, new_window_size.Height - TitlebarHeight - 30), new CGPoint (this.size_label.Frame.X, new_window_size.Height - TitlebarHeight - 30),
this.size_label.Frame.Size); this.size_label.Frame.Size);
this.size_label_value.Frame = new RectangleF ( this.size_label_value.Frame = new CGRect (
new PointF (this.size_label_value.Frame.X, new_window_size.Height - TitlebarHeight - 27), new CGPoint (this.size_label_value.Frame.X, new_window_size.Height - TitlebarHeight - 27),
this.size_label_value.Frame.Size); this.size_label_value.Frame.Size);
this.history_label.Frame = new RectangleF ( this.history_label.Frame = new CGRect (
new PointF (this.history_label.Frame.X, new_window_size.Height - TitlebarHeight - 30), new CGPoint (this.history_label.Frame.X, new_window_size.Height - TitlebarHeight - 30),
this.history_label.Frame.Size); this.history_label.Frame.Size);
this.history_label_value.Frame = new RectangleF ( this.history_label_value.Frame = new CGRect (
new PointF (this.history_label_value.Frame.X, new_window_size.Height - TitlebarHeight - 27), new CGPoint (this.history_label_value.Frame.X, new_window_size.Height - TitlebarHeight - 27),
this.history_label_value.Frame.Size); this.history_label_value.Frame.Size);
this.progress_indicator.Frame = new RectangleF ( this.progress_indicator.Frame = new CGRect (
new PointF (new_window_size.Width / 2 - 10, this.web_view.Frame.Height / 2 + 10), new CGPoint (new_window_size.Width / 2 - 10, this.web_view.Frame.Height / 2 + 10),
this.progress_indicator.Frame.Size); this.progress_indicator.Frame.Size);
this.popup_button.RemoveFromSuperview (); // Needed to prevent redraw glitches this.popup_button.RemoveFromSuperview (); // Needed to prevent redraw glitches
this.popup_button.Frame = new RectangleF ( this.popup_button.Frame = new CGRect (
new PointF (new_window_size.Width - this.popup_button.Frame.Width - 12, new_window_size.Height - TitlebarHeight - 33), new CGPoint (new_window_size.Width - this.popup_button.Frame.Width - 12, new_window_size.Height - TitlebarHeight - 33),
this.popup_button.Frame.Size); this.popup_button.Frame.Size);
ContentView.AddSubview (this.popup_button); ContentView.AddSubview (this.popup_button);
@ -345,8 +345,8 @@ namespace SparkleShare {
html = html.Replace ("<!-- $document-edited-background-image -->", pixmaps_path + "/document-edited-12.png"); html = html.Replace ("<!-- $document-edited-background-image -->", pixmaps_path + "/document-edited-12.png");
html = html.Replace ("<!-- $document-moved-background-image -->", pixmaps_path + "/document-moved-12.png"); html = html.Replace ("<!-- $document-moved-background-image -->", pixmaps_path + "/document-moved-12.png");
this.web_view = new WebView (new RectangleF (0, 0, 481, 579), "", "") { this.web_view = new WebView (new CGRect (0, 0, 481, 579), "", "") {
Frame = new RectangleF (new PointF (0, 0), new SizeF (ContentView.Frame.Width, ContentView.Frame.Height - 39)) Frame = new CGRect (new CGPoint (0, 0), new CGSize (ContentView.Frame.Width, ContentView.Frame.Height - 39))
}; };
this.web_view.MainFrame.LoadHtmlString (html, new NSUrl ("")); this.web_view.MainFrame.LoadHtmlString (html, new NSUrl (""));
@ -379,9 +379,9 @@ namespace SparkleShare {
public class SparkleEventsDelegate : NSWindowDelegate { public class SparkleEventsDelegate : NSWindowDelegate {
public event WindowResizedHandler WindowResized = delegate { }; public event WindowResizedHandler WindowResized = delegate { };
public delegate void WindowResizedHandler (SizeF new_window_size); public delegate void WindowResizedHandler (CGSize new_window_size);
public override SizeF WillResize (NSWindow sender, SizeF to_frame_size) public override CGSize WillResize (NSWindow sender, CGSize to_frame_size)
{ {
WindowResized (to_frame_size); WindowResized (to_frame_size);
return to_frame_size; return to_frame_size;

View file

@ -1,4 +1,4 @@
// SparkleShare, a collaboration and sharing tool. // SparkleShare, a collaboration and sharing tool.
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@ -16,9 +16,9 @@
using System; using System;
using System.Drawing;
using AppKit; using AppKit;
using CoreGraphics;
using Foundation; using Foundation;
namespace SparkleShare { namespace SparkleShare {
@ -38,21 +38,21 @@ namespace SparkleShare {
public Note () : base () public Note () : base ()
{ {
SetFrame (new RectangleF (0, 0, 480, 240), true); SetFrame (new CGRect (0, 0, 480, 240), true);
Center (); Center ();
Delegate = new SparkleNoteDelegate (); Delegate = new SparkleNoteDelegate ();
StyleMask = (NSWindowStyle.Closable | NSWindowStyle.Titled); StyleMask = (NSWindowStyle.Closable | NSWindowStyle.Titled);
Title = "Add Note"; Title = "Add Note";
MaxSize = new SizeF (480, 240); MaxSize = new CGSize (480, 240);
MinSize = new SizeF (480, 240); MinSize = new CGSize (480, 240);
HasShadow = true; HasShadow = true;
IsOpaque = false; IsOpaque = false;
BackingType = NSBackingStore.Buffered; BackingType = NSBackingStore.Buffered;
Level = NSWindowLevel.Floating; Level = NSWindowLevel.Floating;
this.hidden_close_button = new NSButton () { this.hidden_close_button = new NSButton () {
Frame = new RectangleF (0, 0, 0, 0), Frame = new CGRect (0, 0, 0, 0),
KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask, KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
KeyEquivalent = "w" KeyEquivalent = "w"
}; };
@ -83,9 +83,9 @@ namespace SparkleShare {
private void CreateNote () private void CreateNote ()
{ {
this.cover = new NSBox () { this.cover = new NSBox () {
Frame = new RectangleF ( Frame = new CGRect (
new PointF (-1, 58), new CGPoint (-1, 58),
new SizeF (Frame.Width + 2, this.ContentView.Frame.Height + 1)), new CGSize (Frame.Width + 2, this.ContentView.Frame.Height + 1)),
FillColor = NSColor.FromCalibratedRgba (0.77f, 0.77f, 0.75f, 1.0f), FillColor = NSColor.FromCalibratedRgba (0.77f, 0.77f, 0.75f, 1.0f),
BorderColor = NSColor.LightGray, BorderColor = NSColor.LightGray,
BoxType = NSBoxType.NSBoxCustom BoxType = NSBoxType.NSBoxCustom
@ -97,9 +97,9 @@ namespace SparkleShare {
BackgroundColor = NSColor.FromCalibratedRgba (0.77f, 0.77f, 0.75f, 1.0f), BackgroundColor = NSColor.FromCalibratedRgba (0.77f, 0.77f, 0.75f, 1.0f),
Bordered = false, Bordered = false,
Editable = false, Editable = false,
Frame = new RectangleF ( Frame = new CGRect (
new PointF (85, ContentView.Frame.Height - 41), new CGPoint (85, ContentView.Frame.Height - 41),
new SizeF (320, 22)), new CGSize (320, 22)),
StringValue = SparkleShare.Controller.CurrentUser.Name, StringValue = SparkleShare.Controller.CurrentUser.Name,
Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize) Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize)
}; };
@ -110,9 +110,9 @@ namespace SparkleShare {
TextColor = NSColor.DisabledControlText, TextColor = NSColor.DisabledControlText,
Bordered = false, Bordered = false,
Editable = false, Editable = false,
Frame = new RectangleF ( Frame = new CGRect (
new PointF (85, ContentView.Frame.Height - 60), new CGPoint (85, ContentView.Frame.Height - 60),
new SizeF (320, 20)), new CGSize (320, 20)),
StringValue = SparkleShare.Controller.CurrentUser.Email, StringValue = SparkleShare.Controller.CurrentUser.Email,
}; };
@ -122,9 +122,9 @@ namespace SparkleShare {
BackgroundColor = NSColor.White, BackgroundColor = NSColor.White,
Bordered = false, Bordered = false,
Editable = true, Editable = true,
Frame = new RectangleF ( Frame = new CGRect (
new PointF (30, ContentView.Frame.Height - 137), new CGPoint (30, ContentView.Frame.Height - 137),
new SizeF (418, 48)) new CGSize (418, 48))
}; };
(this.balloon_text_field.Cell as NSTextFieldCell).PlaceholderString = "Anything to add?"; (this.balloon_text_field.Cell as NSTextFieldCell).PlaceholderString = "Anything to add?";
@ -137,13 +137,13 @@ namespace SparkleShare {
this.cancel_button = new NSButton () { this.cancel_button = new NSButton () {
Title = "Cancel", Title = "Cancel",
BezelStyle = NSBezelStyle.Rounded, BezelStyle = NSBezelStyle.Rounded,
Frame = new RectangleF (Frame.Width - 15 - 105 * 2, 12, 105, 32), Frame = new CGRect (Frame.Width - 15 - 105 * 2, 12, 105, 32),
}; };
this.sync_button = new NSButton () { this.sync_button = new NSButton () {
Title = "Sync", Title = "Sync",
BezelStyle = NSBezelStyle.Rounded, BezelStyle = NSBezelStyle.Rounded,
Frame = new RectangleF (Frame.Width - 15 - 105, 12, 105, 32), Frame = new CGRect (Frame.Width - 15 - 105, 12, 105, 32),
}; };
this.cancel_button.Activated += delegate { Controller.CancelClicked (); }; this.cancel_button.Activated += delegate { Controller.CancelClicked (); };
@ -157,10 +157,10 @@ namespace SparkleShare {
else else
this.balloon_image = NSImage.ImageNamed ("text-balloon"); this.balloon_image = NSImage.ImageNamed ("text-balloon");
this.balloon_image.Size = new SizeF (438, 72); this.balloon_image.Size = new CGSize (438, 72);
this.balloon_image_view = new NSImageView () { this.balloon_image_view = new NSImageView () {
Image = this.balloon_image, Image = this.balloon_image,
Frame = new RectangleF (21, ContentView.Frame.Height - 145, 438, 72) Frame = new CGRect (21, ContentView.Frame.Height - 145, 438, 72)
}; };
@ -169,10 +169,10 @@ namespace SparkleShare {
else else
this.user_image = NSImage.ImageNamed ("user-icon-default"); this.user_image = NSImage.ImageNamed ("user-icon-default");
this.user_image.Size = new SizeF (48, 48); this.user_image.Size = new CGSize (48, 48);
this.user_image_view = new NSImageView () { this.user_image_view = new NSImageView () {
Image = this.user_image, Image = this.user_image,
Frame = new RectangleF (21, ContentView.Frame.Height - 65, 48, 48) Frame = new CGRect (21, ContentView.Frame.Height - 65, 48, 48)
}; };
this.user_image_view.WantsLayer = true; this.user_image_view.WantsLayer = true;

View file

@ -1,4 +1,4 @@
// SparkleShare, a collaboration and sharing tool. // SparkleShare, a collaboration and sharing tool.
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@ -17,12 +17,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using Mono.Unix;
using Foundation;
using AppKit; using AppKit;
using CoreGraphics;
using Foundation;
using WebKit; using WebKit;
using Sparkles; using Sparkles;
@ -85,19 +84,19 @@ namespace SparkleShare {
Description = "First off, whats your name and email?\n(visible only to team members)"; Description = "First off, whats your name and email?\n(visible only to team members)";
FullNameLabel = new SparkleLabel ("Full Name:", NSTextAlignment.Right); FullNameLabel = new SparkleLabel ("Full Name:", NSTextAlignment.Right);
FullNameLabel.Frame = new RectangleF (165, Frame.Height - 234, 160, 17); FullNameLabel.Frame = new CGRect (165, Frame.Height - 234, 160, 17);
FullNameTextField = new NSTextField () { FullNameTextField = new NSTextField () {
Frame = new RectangleF (330, Frame.Height - 238, 196, 22), Frame = new CGRect (330, Frame.Height - 238, 196, 22),
StringValue = UnixUserInfo.GetRealUser ().RealName, StringValue = new NSProcessInfo ().GetFullUserName (),
Delegate = new SparkleTextFieldDelegate () Delegate = new SparkleTextFieldDelegate ()
}; };
EmailLabel = new SparkleLabel ("Email:", NSTextAlignment.Right); EmailLabel = new SparkleLabel ("Email:", NSTextAlignment.Right);
EmailLabel.Frame = new RectangleF (165, Frame.Height - 264, 160, 17); EmailLabel.Frame = new CGRect (165, Frame.Height - 264, 160, 17);
EmailTextField = new NSTextField () { EmailTextField = new NSTextField () {
Frame = new RectangleF (330, Frame.Height - 268, 196, 22), Frame = new CGRect (330, Frame.Height - 268, 196, 22),
Delegate = new SparkleTextFieldDelegate () Delegate = new SparkleTextFieldDelegate ()
}; };
@ -154,20 +153,20 @@ namespace SparkleShare {
Description = "Do you want to add this project to SparkleShare?"; Description = "Do you want to add this project to SparkleShare?";
AddressLabel = new SparkleLabel ("Address:", NSTextAlignment.Right); AddressLabel = new SparkleLabel ("Address:", NSTextAlignment.Right);
AddressLabel.Frame = new RectangleF (165, Frame.Height - 238, 160, 17); AddressLabel.Frame = new CGRect (165, Frame.Height - 238, 160, 17);
AddressLabel.Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize); AddressLabel.Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize);
AddressTextField = new SparkleLabel (Controller.PendingInvite.Address, NSTextAlignment.Left) { AddressTextField = new SparkleLabel (Controller.PendingInvite.Address, NSTextAlignment.Left) {
Frame = new RectangleF (330, Frame.Height - 240, 260, 17) Frame = new CGRect (330, Frame.Height - 240, 260, 17)
}; };
PathLabel = new SparkleLabel ("Remote Path:", NSTextAlignment.Right); PathLabel = new SparkleLabel ("Remote Path:", NSTextAlignment.Right);
PathLabel.Frame = new RectangleF (165, Frame.Height - 262, 160, 17); PathLabel.Frame = new CGRect (165, Frame.Height - 262, 160, 17);
PathLabel.Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize); PathLabel.Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize);
PathTextField = new SparkleLabel (Controller.PendingInvite.RemotePath, NSTextAlignment.Left) { PathTextField = new SparkleLabel (Controller.PendingInvite.RemotePath, NSTextAlignment.Left) {
Frame = new RectangleF (330, Frame.Height - 264, 260, 17) Frame = new CGRect (330, Frame.Height - 264, 260, 17)
}; };
CancelButton = new NSButton () { Title = "Cancel" }; CancelButton = new NSButton () { Title = "Cancel" };
@ -192,12 +191,12 @@ namespace SparkleShare {
Description = ""; Description = "";
AddressLabel = new SparkleLabel ("Address:", NSTextAlignment.Left) { AddressLabel = new SparkleLabel ("Address:", NSTextAlignment.Left) {
Frame = new RectangleF (190, Frame.Height - 308, 160, 17), Frame = new CGRect (190, Frame.Height - 308, 160, 17),
Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize) Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize)
}; };
AddressTextField = new NSTextField () { AddressTextField = new NSTextField () {
Frame = new RectangleF (190, Frame.Height - 336, 196, 22), Frame = new CGRect (190, Frame.Height - 336, 196, 22),
Enabled = (Controller.SelectedPreset.Address == null), Enabled = (Controller.SelectedPreset.Address == null),
Delegate = new SparkleTextFieldDelegate (), Delegate = new SparkleTextFieldDelegate (),
StringValue = "" + Controller.PreviousAddress StringValue = "" + Controller.PreviousAddress
@ -206,12 +205,12 @@ namespace SparkleShare {
AddressTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; AddressTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail;
PathLabel = new SparkleLabel ("Remote Path:", NSTextAlignment.Left) { PathLabel = new SparkleLabel ("Remote Path:", NSTextAlignment.Left) {
Frame = new RectangleF (190 + 196 + 16, Frame.Height - 308, 160, 17), Frame = new CGRect (190 + 196 + 16, Frame.Height - 308, 160, 17),
Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize) Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize)
}; };
PathTextField = new NSTextField () { PathTextField = new NSTextField () {
Frame = new RectangleF (190 + 196 + 16, Frame.Height - 336, 196, 22), Frame = new CGRect (190 + 196 + 16, Frame.Height - 336, 196, 22),
Enabled = (Controller.SelectedPreset.Path == null), Enabled = (Controller.SelectedPreset.Path == null),
Delegate = new SparkleTextFieldDelegate (), Delegate = new SparkleTextFieldDelegate (),
StringValue = "" + Controller.PreviousPath StringValue = "" + Controller.PreviousPath
@ -221,25 +220,25 @@ namespace SparkleShare {
PathHelpLabel = new SparkleLabel (Controller.SelectedPreset.PathExample, NSTextAlignment.Left) { PathHelpLabel = new SparkleLabel (Controller.SelectedPreset.PathExample, NSTextAlignment.Left) {
TextColor = NSColor.DisabledControlText, TextColor = NSColor.DisabledControlText,
Frame = new RectangleF (190 + 196 + 16, Frame.Height - 358, 204, 19) Frame = new CGRect (190 + 196 + 16, Frame.Height - 358, 204, 19)
}; };
AddressHelpLabel = new SparkleLabel (Controller.SelectedPreset.AddressExample, NSTextAlignment.Left) { AddressHelpLabel = new SparkleLabel (Controller.SelectedPreset.AddressExample, NSTextAlignment.Left) {
TextColor = NSColor.DisabledControlText, TextColor = NSColor.DisabledControlText,
Frame = new RectangleF (190, Frame.Height - 358, 204, 19) Frame = new CGRect (190, Frame.Height - 358, 204, 19)
}; };
if (TableView == null || TableView.RowCount != Controller.Presets.Count) { if (TableView == null || TableView.RowCount != Controller.Presets.Count) {
TableView = new NSTableView () { TableView = new NSTableView () {
Frame = new RectangleF (0, 0, 0, 0), Frame = new CGRect (0, 0, 0, 0),
RowHeight = 38, RowHeight = 38,
IntercellSpacing = new SizeF (8, 12), IntercellSpacing = new CGSize (8, 12),
HeaderView = null, HeaderView = null,
Delegate = new SparkleTableViewDelegate () Delegate = new SparkleTableViewDelegate ()
}; };
ScrollView = new NSScrollView () { ScrollView = new NSScrollView () {
Frame = new RectangleF (190, Frame.Height - 280, 408, 185), Frame = new CGRect (190, Frame.Height - 280, 408, 185),
DocumentView = TableView, DocumentView = TableView,
HasVerticalScroller = true, HasVerticalScroller = true,
BorderType = NSBorderType.BezelBorder BorderType = NSBorderType.BezelBorder
@ -267,14 +266,14 @@ namespace SparkleShare {
if (Environment.OSVersion.Version.Major < 11) if (Environment.OSVersion.Version.Major < 11)
DataSource = new SparkleDataSource (1, Controller.Presets); DataSource = new SparkleDataSource (1, Controller.Presets);
else else
DataSource = new SparkleDataSource (BackingScaleFactor, Controller.Presets); DataSource = new SparkleDataSource ((float) BackingScaleFactor, Controller.Presets);
TableView.DataSource = DataSource; TableView.DataSource = DataSource;
TableView.ReloadData (); TableView.ReloadData ();
(TableView.Delegate as SparkleTableViewDelegate).SelectionChanged += delegate { (TableView.Delegate as SparkleTableViewDelegate).SelectionChanged += delegate {
Controller.SelectedPresetChanged (TableView.SelectedRow); Controller.SelectedPresetChanged ((int) TableView.SelectedRow);
Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, (int) TableView.SelectedRow);
}; };
} }
@ -283,7 +282,7 @@ namespace SparkleShare {
MakeFirstResponder ((NSResponder) TableView); MakeFirstResponder ((NSResponder) TableView);
HistoryCheckButton = new NSButton () { HistoryCheckButton = new NSButton () {
Frame = new RectangleF (190, Frame.Height - 400, 300, 18), Frame = new CGRect (190, Frame.Height - 400, 300, 18),
Title = "Fetch prior revisions" Title = "Fetch prior revisions"
}; };
@ -318,11 +317,11 @@ namespace SparkleShare {
(AddressTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { (AddressTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate {
Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, (int) TableView.SelectedRow);
}; };
(PathTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { (PathTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate {
Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, (int) TableView.SelectedRow);
}; };
@ -354,7 +353,7 @@ namespace SparkleShare {
Buttons.Add (AddButton); Buttons.Add (AddButton);
Buttons.Add (CancelButton); Buttons.Add (CancelButton);
Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, (int) TableView.SelectedRow);
} }
if (type == PageType.Syncing) { if (type == PageType.Syncing) {
@ -362,7 +361,7 @@ namespace SparkleShare {
Description = "This may take a while for large projects.\nIsnt it coffee-oclock?"; Description = "This may take a while for large projects.\nIsnt it coffee-oclock?";
ProgressIndicator = new NSProgressIndicator () { ProgressIndicator = new NSProgressIndicator () {
Frame = new RectangleF (190, Frame.Height - 200, 640 - 150 - 80, 20), Frame = new CGRect (190, Frame.Height - 200, 640 - 150 - 80, 20),
Style = NSProgressIndicatorStyle.Bar, Style = NSProgressIndicatorStyle.Bar,
MinValue = 0.0, MinValue = 0.0,
MaxValue = 100.0, MaxValue = 100.0,
@ -380,7 +379,7 @@ namespace SparkleShare {
}; };
ProgressLabel = new SparkleLabel ("Preparing to fetch files…", NSTextAlignment.Right); ProgressLabel = new SparkleLabel ("Preparing to fetch files…", NSTextAlignment.Right);
ProgressLabel.Frame = new RectangleF (Frame.Width - 40 - 250, 185, 250, 25); ProgressLabel.Frame = new CGRect (Frame.Width - 40 - 250, 185, 250, 25);
Controller.UpdateProgressBarEvent += delegate (double percentage, string speed) { Controller.UpdateProgressBarEvent += delegate (double percentage, string speed) {
@ -408,7 +407,7 @@ namespace SparkleShare {
// Displaying marked up text with Cocoa is // Displaying marked up text with Cocoa is
// a pain, so we just use a webview instead // a pain, so we just use a webview instead
WebView web_view = new WebView (); WebView web_view = new WebView ();
web_view.Frame = new RectangleF (190, Frame.Height - 525, 375, 400); web_view.Frame = new CGRect (190, Frame.Height - 525, 375, 400);
string html = "<style>" + string html = "<style>" +
"* {" + "* {" +
@ -473,11 +472,11 @@ namespace SparkleShare {
ButtonCellProto.SetButtonType (NSButtonType.Radio); ButtonCellProto.SetButtonType (NSButtonType.Radio);
ButtonCellProto.Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize); ButtonCellProto.Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize);
Matrix = new NSMatrix (new RectangleF (202, Frame.Height - 256 - 128, 256, 256), NSMatrixMode.Radio, Matrix = new NSMatrix (new CGRect (202, Frame.Height - 256 - 128, 256, 256), NSMatrixMode.Radio,
ButtonCellProto, SparkleShare.Controller.FetcherAvailableStorageTypes.Count, 1); ButtonCellProto, SparkleShare.Controller.FetcherAvailableStorageTypes.Count, 1);
Matrix.CellSize = new SizeF (256, 36); Matrix.CellSize = new CGSize (256, 36);
Matrix.IntercellSpacing = new SizeF (32, 32); Matrix.IntercellSpacing = new CGSize (32, 32);
int i = 0; int i = 0;
foreach (StorageTypeInfo storage_type in SparkleShare.Controller.FetcherAvailableStorageTypes) { foreach (StorageTypeInfo storage_type in SparkleShare.Controller.FetcherAvailableStorageTypes) {
@ -485,7 +484,7 @@ namespace SparkleShare {
NSTextField storage_type_description = new SparkleLabel (storage_type.Description, NSTextAlignment.Left) { NSTextField storage_type_description = new SparkleLabel (storage_type.Description, NSTextAlignment.Left) {
TextColor = NSColor.DisabledControlText, TextColor = NSColor.DisabledControlText,
Frame = new RectangleF (223, Frame.Height - 190 - (68 * i), 256, 32) Frame = new CGRect (223, Frame.Height - 190 - (68 * i), 256, 32)
}; };
storage_type_descriptions.Add (storage_type_description); storage_type_descriptions.Add (storage_type_description);
@ -501,7 +500,7 @@ namespace SparkleShare {
ContinueButton = new NSButton () { Title = "Continue" }; ContinueButton = new NSButton () { Title = "Continue" };
ContinueButton.Activated += delegate { ContinueButton.Activated += delegate {
StorageTypeInfo selected_storage_type = SparkleShare.Controller.FetcherAvailableStorageTypes [Matrix.SelectedRow]; StorageTypeInfo selected_storage_type = SparkleShare.Controller.FetcherAvailableStorageTypes [(int) Matrix.SelectedRow];
Controller.StoragePageCompleted (selected_storage_type.Type); Controller.StoragePageCompleted (selected_storage_type.Type);
}; };
@ -530,22 +529,22 @@ namespace SparkleShare {
extra_pos_y = 20; extra_pos_y = 20;
PasswordLabel = new SparkleLabel ("Password:", NSTextAlignment.Right) { PasswordLabel = new SparkleLabel ("Password:", NSTextAlignment.Right) {
Frame = new RectangleF (155, Frame.Height - 202 - extra_pos_y, 160, 17), Frame = new CGRect (155, Frame.Height - 202 - extra_pos_y, 160, 17),
Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize) Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize)
}; };
PasswordTextField = new NSSecureTextField () { PasswordTextField = new NSSecureTextField () {
Frame = new RectangleF (320, Frame.Height - 208 - extra_pos_y, 196, 22), Frame = new CGRect (320, Frame.Height - 208 - extra_pos_y, 196, 22),
Delegate = new SparkleTextFieldDelegate () Delegate = new SparkleTextFieldDelegate ()
}; };
VisiblePasswordTextField = new NSTextField () { VisiblePasswordTextField = new NSTextField () {
Frame = new RectangleF (320, Frame.Height - 208 - extra_pos_y, 196, 22), Frame = new CGRect (320, Frame.Height - 208 - extra_pos_y, 196, 22),
Delegate = new SparkleTextFieldDelegate () Delegate = new SparkleTextFieldDelegate ()
}; };
ShowPasswordCheckButton = new NSButton () { ShowPasswordCheckButton = new NSButton () {
Frame = new RectangleF (318, Frame.Height - 235 - extra_pos_y, 300, 18), Frame = new CGRect (318, Frame.Height - 235 - extra_pos_y, 300, 18),
Title = "Show password", Title = "Show password",
State = NSCellStateValue.Off State = NSCellStateValue.Off
}; };
@ -553,15 +552,15 @@ namespace SparkleShare {
ShowPasswordCheckButton.SetButtonType (NSButtonType.Switch); ShowPasswordCheckButton.SetButtonType (NSButtonType.Switch);
WarningImage = NSImage.ImageNamed ("NSInfo"); WarningImage = NSImage.ImageNamed ("NSInfo");
WarningImage.Size = new SizeF (24, 24); WarningImage.Size = new CGSize (24, 24);
WarningImageView = new NSImageView () { WarningImageView = new NSImageView () {
Image = WarningImage, Image = WarningImage,
Frame = new RectangleF (200, Frame.Height - 320, 24, 24) Frame = new CGRect (200, Frame.Height - 320, 24, 24)
}; };
WarningTextField = new SparkleLabel ("This password cant be changed later, and your files cant be recovered if its forgotten.", NSTextAlignment.Left) { WarningTextField = new SparkleLabel ("This password cant be changed later, and your files cant be recovered if its forgotten.", NSTextAlignment.Left) {
Frame = new RectangleF (235, Frame.Height - 390, 325, 100), Frame = new CGRect (235, Frame.Height - 390, 325, 100),
}; };
CancelButton = new NSButton () { Title = "Cancel" }; CancelButton = new NSButton () { Title = "Cancel" };
@ -642,15 +641,15 @@ namespace SparkleShare {
if (warnings.Length > 0) { if (warnings.Length > 0) {
WarningImage = NSImage.ImageNamed ("NSInfo"); WarningImage = NSImage.ImageNamed ("NSInfo");
WarningImage.Size = new SizeF (24, 24); WarningImage.Size = new CGSize (24, 24);
WarningImageView = new NSImageView () { WarningImageView = new NSImageView () {
Image = WarningImage, Image = WarningImage,
Frame = new RectangleF (200, Frame.Height - 175, 24, 24) Frame = new CGRect (200, Frame.Height - 175, 24, 24)
}; };
WarningTextField = new SparkleLabel (warnings [0], NSTextAlignment.Left); WarningTextField = new SparkleLabel (warnings [0], NSTextAlignment.Left);
WarningTextField.Frame = new RectangleF (235, Frame.Height - 245, 325, 100); WarningTextField.Frame = new CGRect (235, Frame.Height - 245, 325, 100);
ContentView.AddSubview (WarningImageView); ContentView.AddSubview (WarningImageView);
ContentView.AddSubview (WarningTextField); ContentView.AddSubview (WarningTextField);
@ -783,7 +782,7 @@ namespace SparkleShare {
image_path = hi_path; image_path = hi_path;
} }
return new NSImage (image_path) { Size = new SizeF (24, 24) }; return new NSImage (image_path) { Size = new CGSize (24, 24) };
} }
} }

View file

@ -1,4 +1,4 @@
// SparkleShare, an instant update workflow to Git. // SparkleShare, an instant update workflow to Git.
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@ -16,8 +16,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using CoreGraphics;
using Foundation; using Foundation;
using AppKit; using AppKit;
@ -38,11 +38,11 @@ namespace SparkleShare {
public SetupWindow () public SetupWindow ()
{ {
SetFrame (new RectangleF (0, 0, 640, 420), true); SetFrame (new CGRect (0, 0, 640, 420), true);
StyleMask = NSWindowStyle.Titled; StyleMask = NSWindowStyle.Titled;
MaxSize = new SizeF (640, 420); MaxSize = new CGSize (640, 420);
MinSize = new SizeF (640, 420); MinSize = new CGSize (640, 420);
HasShadow = true; HasShadow = true;
IsOpaque = false; IsOpaque = false;
BackingType = NSBackingStore.Buffered; BackingType = NSBackingStore.Buffered;
@ -51,21 +51,21 @@ namespace SparkleShare {
Center (); Center ();
this.side_splash = NSImage.ImageNamed ("side-splash"); this.side_splash = NSImage.ImageNamed ("side-splash");
this.side_splash.Size = new SizeF (150, 482); this.side_splash.Size = new CGSize (150, 482);
this.side_splash_view = new NSImageView () { this.side_splash_view = new NSImageView () {
Image = this.side_splash, Image = this.side_splash,
Frame = new RectangleF (0, 0, 150, 482) Frame = new CGRect (0, 0, 150, 482)
}; };
this.header_text_field = new SparkleLabel ("", NSTextAlignment.Left) { this.header_text_field = new SparkleLabel ("", NSTextAlignment.Left) {
Frame = new RectangleF (190, Frame.Height - 80, Frame.Width, 24), Frame = new CGRect (190, Frame.Height - 80, Frame.Width, 24),
Font = NSFontManager.SharedFontManager.FontWithFamily ( Font = NSFontManager.SharedFontManager.FontWithFamily (
UserInterface.FontName, NSFontTraitMask.Bold, 0, 16) UserInterface.FontName, NSFontTraitMask.Bold, 0, 16)
}; };
this.description_text_field = new SparkleLabel ("", NSTextAlignment.Left) { this.description_text_field = new SparkleLabel ("", NSTextAlignment.Left) {
Frame = new RectangleF (190, Frame.Height - 130, 640 - 240, 44) Frame = new CGRect (190, Frame.Height - 130, 640 - 240, 44)
}; };
this.header_text_field.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; this.header_text_field.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail;
@ -99,12 +99,12 @@ namespace SparkleShare {
foreach (NSButton button in Buttons) { foreach (NSButton button in Buttons) {
button.BezelStyle = NSBezelStyle.Rounded; button.BezelStyle = NSBezelStyle.Rounded;
button.Frame = new RectangleF (Frame.Width - 15 - x - (105 * i), 12, 105, 32); button.Frame = new CGRect (Frame.Width - 15 - x - (105 * i), 12, 105, 32);
// Make the button a bit wider if the text is likely to be longer // Make the button a bit wider if the text is likely to be longer
if (button.Title.Contains (" ")) { if (button.Title.Contains (" ")) {
button.SizeToFit (); button.SizeToFit ();
button.Frame = new RectangleF (Frame.Width - 30 - 15 - (105 * (i - 1)) - button.Frame.Width, button.Frame = new CGRect (Frame.Width - 30 - 15 - (105 * (i - 1)) - button.Frame.Width,
12, button.Frame.Width + 30, 32); 12, button.Frame.Width + 30, 32);
x += 22; x += 22;

View file

@ -1,4 +1,4 @@
// SparkleShare, an instant update workflow to Git. // SparkleShare, an instant update workflow to Git.
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk> // Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@ -17,9 +17,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using AppKit; using AppKit;
using CoreGraphics;
namespace SparkleShare { namespace SparkleShare {
@ -114,7 +114,7 @@ namespace SparkleShare {
}; };
this.folder_item.Image = this.sparkleshare_image; this.folder_item.Image = this.sparkleshare_image;
this.folder_item.Image.Size = new SizeF (16, 16); this.folder_item.Image.Size = new CGSize (16, 16);
this.add_item = new NSMenuItem () { this.add_item = new NSMenuItem () {
Title = "Sync Remote Project…", Title = "Sync Remote Project…",
@ -217,7 +217,7 @@ namespace SparkleShare {
if (!Controller.Projects [i].HasError) if (!Controller.Projects [i].HasError)
this.folder_menu_items [i].Activated += Controller.OpenFolderDelegate (project.Name); this.folder_menu_items [i].Activated += Controller.OpenFolderDelegate (project.Name);
item.Image.Size = new SizeF (16, 16); item.Image.Size = new CGSize (16, 16);
i++; i++;
}; };
} }