mac: Use updated Xamarin.Mac APIs
This commit is contained in:
parent
1673ddbabf
commit
3abb79611d
|
@ -1,4 +1,4 @@
|
|||
// SparkleShare, a collaboration and sharing tool.
|
||||
// SparkleShare, a collaboration and sharing tool.
|
||||
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
@ -67,10 +67,14 @@ namespace SparkleShare {
|
|||
|
||||
public override void CreateSparkleShareFolder ()
|
||||
{
|
||||
if (!Directory.Exists (SparkleShare.Controller.FoldersPath)) {
|
||||
Directory.CreateDirectory (SparkleShare.Controller.FoldersPath);
|
||||
Syscall.chmod (SparkleShare.Controller.FoldersPath, (FilePermissions) 448); // 448 -> 700
|
||||
}
|
||||
if (Directory.Exists (SparkleShare.Controller.FoldersPath))
|
||||
return;
|
||||
|
||||
Directory.CreateDirectory (SparkleShare.Controller.FoldersPath);
|
||||
|
||||
// TODO: Use proper API
|
||||
var chmod = new Command ("chmod", "700 " + SparkleShare.Controller.FoldersPath);
|
||||
chmod.StartAndWaitForExit ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -89,31 +93,31 @@ namespace SparkleShare {
|
|||
}
|
||||
|
||||
|
||||
// There aren't any bindings in Xamarin.Mac to support this yet, so
|
||||
// we call out to an applescript to do the job
|
||||
// There aren't any bindings in Xamarin.Mac to support this yet, so
|
||||
// we call out to an applescript to do the job
|
||||
public override void CreateStartupItem ()
|
||||
{
|
||||
string args = "-e 'tell application \"System Events\" to " +
|
||||
"make login item at end with properties " +
|
||||
"{path:\"" + NSBundle.MainBundle.BundlePath + "\", hidden:false}'";
|
||||
|
||||
var process = new Command ("osascript", args);
|
||||
process.StartAndWaitForExit ();
|
||||
|
||||
Logger.LogInfo ("Controller", "Added " + NSBundle.MainBundle.BundlePath + " to login items");
|
||||
}
|
||||
|
||||
string args = "-e 'tell application \"System Events\" to " +
|
||||
"make login item at end with properties " +
|
||||
"{path:\"" + NSBundle.MainBundle.BundlePath + "\", hidden:false}'";
|
||||
|
||||
var process = new Command ("osascript", args);
|
||||
process.StartAndWaitForExit ();
|
||||
|
||||
Logger.LogInfo ("Controller", "Added " + NSBundle.MainBundle.BundlePath + " to login items");
|
||||
}
|
||||
|
||||
|
||||
public override void InstallProtocolHandler ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public override void CopyToClipboard (string text)
|
||||
{
|
||||
NSPasteboard.GeneralPasteboard.ClearContents ();
|
||||
NSPasteboard.GeneralPasteboard.SetStringForType (text, "NSStringPboardType");
|
||||
}
|
||||
public override void CopyToClipboard (string text)
|
||||
{
|
||||
NSPasteboard.GeneralPasteboard.ClearContents ();
|
||||
NSPasteboard.GeneralPasteboard.SetStringForType (text, "NSStringPboardType");
|
||||
}
|
||||
|
||||
|
||||
public override void OpenFolder (string path)
|
||||
|
@ -216,13 +220,12 @@ namespace SparkleShare {
|
|||
|
||||
|
||||
public delegate void Code ();
|
||||
readonly NSObject obj = new NSObject ();
|
||||
|
||||
public void Invoke (Code code)
|
||||
{
|
||||
using (var a = new NSAutoreleasePool ())
|
||||
{
|
||||
obj.InvokeOnMainThread (() => code ());
|
||||
new NSObject ().InvokeOnMainThread (() => code ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// SparkleShare, a collaboration and sharing tool.
|
||||
// SparkleShare, a collaboration and sharing tool.
|
||||
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
@ -16,9 +16,9 @@
|
|||
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
using AppKit;
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
|
||||
namespace SparkleShare {
|
||||
|
@ -38,21 +38,21 @@ namespace SparkleShare {
|
|||
|
||||
public About () : base ()
|
||||
{
|
||||
SetFrame (new RectangleF (0, 0, 640, 281), true);
|
||||
SetFrame (new CGRect (0, 0, 640, 281), true);
|
||||
Center ();
|
||||
|
||||
Delegate = new SparkleAboutDelegate ();
|
||||
StyleMask = (NSWindowStyle.Closable | NSWindowStyle.Titled);
|
||||
Title = "About SparkleShare";
|
||||
MaxSize = new SizeF (640, 281);
|
||||
MinSize = new SizeF (640, 281);
|
||||
MaxSize = new CGSize (640, 281);
|
||||
MinSize = new CGSize (640, 281);
|
||||
HasShadow = true;
|
||||
IsOpaque = false;
|
||||
BackingType = NSBackingStore.Buffered;
|
||||
Level = NSWindowLevel.Floating;
|
||||
|
||||
this.hidden_close_button = new NSButton () {
|
||||
Frame = new RectangleF (0, 0, 0, 0),
|
||||
Frame = new CGRect (0, 0, 0, 0),
|
||||
KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
|
||||
KeyEquivalent = "w"
|
||||
};
|
||||
|
@ -82,22 +82,22 @@ namespace SparkleShare {
|
|||
private void CreateAbout ()
|
||||
{
|
||||
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 () {
|
||||
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) {
|
||||
DrawsBackground = false,
|
||||
Frame = new RectangleF (295, 140, 318, 22),
|
||||
Frame = new CGRect (295, 140, 318, 22),
|
||||
TextColor = NSColor.White
|
||||
};
|
||||
|
||||
this.updates_text_field = new SparkleLabel ("Checking for updates...", NSTextAlignment.Left) {
|
||||
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)
|
||||
};
|
||||
|
||||
|
@ -108,26 +108,26 @@ namespace SparkleShare {
|
|||
"under the GNU GPLv3", NSTextAlignment.Left) {
|
||||
|
||||
DrawsBackground = false,
|
||||
Frame = new RectangleF (295, Frame.Height - 260, 318, 98),
|
||||
Frame = new CGRect (295, Frame.Height - 260, 318, 98),
|
||||
TextColor = NSColor.White
|
||||
};
|
||||
|
||||
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.Frame = new RectangleF (
|
||||
new PointF (this.website_link.Frame.X + this.website_link.Frame.Width + 10, 25),
|
||||
this.credits_link.Frame = new CGRect (
|
||||
new CGPoint (this.website_link.Frame.X + this.website_link.Frame.Width + 10, 25),
|
||||
this.credits_link.Frame.Size);
|
||||
|
||||
this.report_problem_link = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress);
|
||||
this.report_problem_link.Frame = new RectangleF (
|
||||
new PointF (this.credits_link.Frame.X + this.credits_link.Frame.Width + 10, 25),
|
||||
this.report_problem_link.Frame = new CGRect (
|
||||
new CGPoint (this.credits_link.Frame.X + this.credits_link.Frame.Width + 10, 25),
|
||||
this.report_problem_link.Frame.Size);
|
||||
|
||||
this.debug_log_link = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress);
|
||||
this.debug_log_link.Frame = new RectangleF (
|
||||
new PointF (this.report_problem_link.Frame.X + this.report_problem_link.Frame.Width + 10, 25),
|
||||
this.debug_log_link.Frame = new CGRect (
|
||||
new CGPoint (this.report_problem_link.Frame.X + this.report_problem_link.Frame.Width + 10, 25),
|
||||
this.debug_log_link.Frame.Size);
|
||||
|
||||
ContentView.AddSubview (this.about_image_view);
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace SparkleShare {
|
|||
var notification = new NSUserNotification {
|
||||
Title = title,
|
||||
InformativeText = subtext,
|
||||
DeliveryDate = DateTime.Now
|
||||
DeliveryDate = (NSDate) DateTime.Now
|
||||
};
|
||||
|
||||
NSUserNotificationCenter center = NSUserNotificationCenter.DefaultUserNotificationCenter;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// SparkleShare, a collaboration and sharing tool.
|
||||
// SparkleShare, a collaboration and sharing tool.
|
||||
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
@ -16,10 +16,10 @@
|
|||
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
|
||||
using AppKit;
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
using WebKit;
|
||||
|
||||
|
@ -56,33 +56,33 @@ namespace SparkleShare {
|
|||
float y = (float) (NSScreen.MainScreen.Frame.Height * 0.5 - (height * 0.5));
|
||||
|
||||
SetFrame (
|
||||
new RectangleF (
|
||||
new PointF (x, y),
|
||||
new SizeF (min_width, height)),
|
||||
new CGRect (
|
||||
new CGPoint (x, y),
|
||||
new CGSize (min_width, height)),
|
||||
true);
|
||||
|
||||
StyleMask = (NSWindowStyle.Closable | NSWindowStyle.Miniaturizable |
|
||||
NSWindowStyle.Titled | NSWindowStyle.Resizable);
|
||||
|
||||
MinSize = new SizeF (min_width, min_height);
|
||||
MinSize = new CGSize (min_width, min_height);
|
||||
HasShadow = true;
|
||||
IsOpaque = false;
|
||||
BackingType = NSBackingStore.Buffered;
|
||||
TitlebarHeight = Frame.Height - ContentView.Frame.Height;
|
||||
TitlebarHeight = (float) (Frame.Height - ContentView.Frame.Height);
|
||||
Level = NSWindowLevel.Floating;
|
||||
|
||||
|
||||
this.web_view = new WebView (new RectangleF (0, 0, 481, 579), "", "") {
|
||||
Frame = new RectangleF (new PointF (0, 0),
|
||||
new SizeF (ContentView.Frame.Width, ContentView.Frame.Height - 39))
|
||||
this.web_view = new WebView (new CGRect (0, 0, 481, 579), "", "") {
|
||||
Frame = new CGRect (new CGPoint (0, 0),
|
||||
new CGSize (ContentView.Frame.Width, ContentView.Frame.Height - 39))
|
||||
};
|
||||
|
||||
this.web_view.Preferences.PlugInsEnabled = false;
|
||||
|
||||
this.cover = new NSBox () {
|
||||
Frame = new RectangleF (
|
||||
new PointF (-1, -1),
|
||||
new SizeF (Frame.Width + 2, this.web_view.Frame.Height + 1)),
|
||||
Frame = new CGRect (
|
||||
new CGPoint (-1, -1),
|
||||
new CGSize (Frame.Width + 2, this.web_view.Frame.Height + 1)),
|
||||
FillColor = NSColor.White,
|
||||
BorderType = NSBorderType.NoBorder,
|
||||
BoxType = NSBoxType.NSBoxCustom
|
||||
|
@ -103,9 +103,9 @@ namespace SparkleShare {
|
|||
BackgroundColor = NSColor.WindowBackground,
|
||||
Bordered = false,
|
||||
Editable = false,
|
||||
Frame = new RectangleF (
|
||||
new PointF (0, ContentView.Frame.Height - 31),
|
||||
new SizeF (60, 20)),
|
||||
Frame = new CGRect (
|
||||
new CGPoint (0, ContentView.Frame.Height - 31),
|
||||
new CGSize (60, 20)),
|
||||
StringValue = "Size:"
|
||||
};
|
||||
|
||||
|
@ -114,9 +114,9 @@ namespace SparkleShare {
|
|||
BackgroundColor = NSColor.WindowBackground,
|
||||
Bordered = false,
|
||||
Editable = false,
|
||||
Frame = new RectangleF (
|
||||
new PointF (60, ContentView.Frame.Height - 27),
|
||||
new SizeF (60, 20)),
|
||||
Frame = new CGRect (
|
||||
new CGPoint (60, ContentView.Frame.Height - 27),
|
||||
new CGSize (60, 20)),
|
||||
StringValue = "…",
|
||||
Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize)
|
||||
};
|
||||
|
@ -127,9 +127,9 @@ namespace SparkleShare {
|
|||
BackgroundColor = NSColor.WindowBackground,
|
||||
Bordered = false,
|
||||
Editable = false,
|
||||
Frame = new RectangleF (
|
||||
new PointF (130, ContentView.Frame.Height - 31),
|
||||
new SizeF (60, 20)),
|
||||
Frame = new CGRect (
|
||||
new CGPoint (130, ContentView.Frame.Height - 31),
|
||||
new CGSize (60, 20)),
|
||||
StringValue = "History:"
|
||||
};
|
||||
|
||||
|
@ -138,34 +138,34 @@ namespace SparkleShare {
|
|||
BackgroundColor = NSColor.WindowBackground,
|
||||
Bordered = false,
|
||||
Editable = false,
|
||||
Frame = new RectangleF (
|
||||
new PointF (190, ContentView.Frame.Height - 27),
|
||||
new SizeF (60, 20)
|
||||
Frame = new CGRect (
|
||||
new CGPoint (190, ContentView.Frame.Height - 27),
|
||||
new CGSize (60, 20)
|
||||
),
|
||||
StringValue = "…",
|
||||
Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize)
|
||||
};
|
||||
|
||||
this.popup_button = new NSPopUpButton () {
|
||||
Frame = new RectangleF (
|
||||
new PointF (ContentView.Frame.Width - 156 - 12, ContentView.Frame.Height - 33),
|
||||
new SizeF (156, 26)),
|
||||
Frame = new CGRect (
|
||||
new CGPoint (ContentView.Frame.Width - 156 - 12, ContentView.Frame.Height - 33),
|
||||
new CGSize (156, 26)),
|
||||
PullsDown = false
|
||||
};
|
||||
|
||||
this.background = new NSBox () {
|
||||
Frame = new RectangleF (
|
||||
new PointF (-1, -1),
|
||||
new SizeF (Frame.Width + 2, this.web_view.Frame.Height + 2)),
|
||||
Frame = new CGRect (
|
||||
new CGPoint (-1, -1),
|
||||
new CGSize (Frame.Width + 2, this.web_view.Frame.Height + 2)),
|
||||
FillColor = NSColor.White,
|
||||
BorderColor = NSColor.LightGray,
|
||||
BoxType = NSBoxType.NSBoxCustom
|
||||
};
|
||||
|
||||
this.progress_indicator = new NSProgressIndicator () {
|
||||
Frame = new RectangleF (
|
||||
new PointF (Frame.Width / 2 - 10, this.web_view.Frame.Height / 2 + 10),
|
||||
new SizeF (20, 20)),
|
||||
Frame = new CGRect (
|
||||
new CGPoint (Frame.Width / 2 - 10, this.web_view.Frame.Height / 2 + 10),
|
||||
new CGSize (20, 20)),
|
||||
Style = NSProgressIndicatorStyle.Spinning
|
||||
};
|
||||
|
||||
|
@ -180,7 +180,7 @@ namespace SparkleShare {
|
|||
ContentView.AddSubview (this.background);
|
||||
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));
|
||||
};
|
||||
|
||||
|
@ -240,7 +240,7 @@ namespace SparkleShare {
|
|||
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);
|
||||
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,
|
||||
new SizeF (new_window_size.Width, new_window_size.Height - TitlebarHeight - 39));
|
||||
this.web_view.Frame = new CGRect (this.web_view.Frame.Location,
|
||||
new CGSize (new_window_size.Width, new_window_size.Height - TitlebarHeight - 39));
|
||||
|
||||
this.cover.Frame = new RectangleF (this.cover.Frame.Location,
|
||||
new SizeF (new_window_size.Width, new_window_size.Height - TitlebarHeight - 39));
|
||||
this.cover.Frame = new CGRect (this.cover.Frame.Location,
|
||||
new CGSize (new_window_size.Width, new_window_size.Height - TitlebarHeight - 39));
|
||||
|
||||
this.background.Frame = new RectangleF (this.background.Frame.Location,
|
||||
new SizeF (new_window_size.Width, new_window_size.Height - TitlebarHeight - 37));
|
||||
this.background.Frame = new CGRect (this.background.Frame.Location,
|
||||
new CGSize (new_window_size.Width, new_window_size.Height - TitlebarHeight - 37));
|
||||
|
||||
this.size_label.Frame = new RectangleF (
|
||||
new PointF (this.size_label.Frame.X, new_window_size.Height - TitlebarHeight - 30),
|
||||
this.size_label.Frame = new CGRect (
|
||||
new CGPoint (this.size_label.Frame.X, new_window_size.Height - TitlebarHeight - 30),
|
||||
this.size_label.Frame.Size);
|
||||
|
||||
this.size_label_value.Frame = new RectangleF (
|
||||
new PointF (this.size_label_value.Frame.X, new_window_size.Height - TitlebarHeight - 27),
|
||||
this.size_label_value.Frame = new CGRect (
|
||||
new CGPoint (this.size_label_value.Frame.X, new_window_size.Height - TitlebarHeight - 27),
|
||||
this.size_label_value.Frame.Size);
|
||||
|
||||
this.history_label.Frame = new RectangleF (
|
||||
new PointF (this.history_label.Frame.X, new_window_size.Height - TitlebarHeight - 30),
|
||||
this.history_label.Frame = new CGRect (
|
||||
new CGPoint (this.history_label.Frame.X, new_window_size.Height - TitlebarHeight - 30),
|
||||
this.history_label.Frame.Size);
|
||||
|
||||
this.history_label_value.Frame = new RectangleF (
|
||||
new PointF (this.history_label_value.Frame.X, new_window_size.Height - TitlebarHeight - 27),
|
||||
this.history_label_value.Frame = new CGRect (
|
||||
new CGPoint (this.history_label_value.Frame.X, new_window_size.Height - TitlebarHeight - 27),
|
||||
this.history_label_value.Frame.Size);
|
||||
|
||||
this.progress_indicator.Frame = new RectangleF (
|
||||
new PointF (new_window_size.Width / 2 - 10, this.web_view.Frame.Height / 2 + 10),
|
||||
this.progress_indicator.Frame = new CGRect (
|
||||
new CGPoint (new_window_size.Width / 2 - 10, this.web_view.Frame.Height / 2 + 10),
|
||||
this.progress_indicator.Frame.Size);
|
||||
|
||||
this.popup_button.RemoveFromSuperview (); // Needed to prevent redraw glitches
|
||||
|
||||
this.popup_button.Frame = new RectangleF (
|
||||
new PointF (new_window_size.Width - this.popup_button.Frame.Width - 12, new_window_size.Height - TitlebarHeight - 33),
|
||||
this.popup_button.Frame = new CGRect (
|
||||
new CGPoint (new_window_size.Width - this.popup_button.Frame.Width - 12, new_window_size.Height - TitlebarHeight - 33),
|
||||
this.popup_button.Frame.Size);
|
||||
|
||||
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-moved-background-image -->", pixmaps_path + "/document-moved-12.png");
|
||||
|
||||
this.web_view = new WebView (new RectangleF (0, 0, 481, 579), "", "") {
|
||||
Frame = new RectangleF (new PointF (0, 0), new SizeF (ContentView.Frame.Width, ContentView.Frame.Height - 39))
|
||||
this.web_view = new WebView (new CGRect (0, 0, 481, 579), "", "") {
|
||||
Frame = new CGRect (new CGPoint (0, 0), new CGSize (ContentView.Frame.Width, ContentView.Frame.Height - 39))
|
||||
};
|
||||
|
||||
this.web_view.MainFrame.LoadHtmlString (html, new NSUrl (""));
|
||||
|
@ -379,9 +379,9 @@ namespace SparkleShare {
|
|||
public class SparkleEventsDelegate : NSWindowDelegate {
|
||||
|
||||
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);
|
||||
return to_frame_size;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// SparkleShare, a collaboration and sharing tool.
|
||||
// SparkleShare, a collaboration and sharing tool.
|
||||
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
@ -16,9 +16,9 @@
|
|||
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
using AppKit;
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
|
||||
namespace SparkleShare {
|
||||
|
@ -38,21 +38,21 @@ namespace SparkleShare {
|
|||
|
||||
public Note () : base ()
|
||||
{
|
||||
SetFrame (new RectangleF (0, 0, 480, 240), true);
|
||||
SetFrame (new CGRect (0, 0, 480, 240), true);
|
||||
Center ();
|
||||
|
||||
Delegate = new SparkleNoteDelegate ();
|
||||
StyleMask = (NSWindowStyle.Closable | NSWindowStyle.Titled);
|
||||
Title = "Add Note";
|
||||
MaxSize = new SizeF (480, 240);
|
||||
MinSize = new SizeF (480, 240);
|
||||
MaxSize = new CGSize (480, 240);
|
||||
MinSize = new CGSize (480, 240);
|
||||
HasShadow = true;
|
||||
IsOpaque = false;
|
||||
BackingType = NSBackingStore.Buffered;
|
||||
Level = NSWindowLevel.Floating;
|
||||
|
||||
this.hidden_close_button = new NSButton () {
|
||||
Frame = new RectangleF (0, 0, 0, 0),
|
||||
Frame = new CGRect (0, 0, 0, 0),
|
||||
KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
|
||||
KeyEquivalent = "w"
|
||||
};
|
||||
|
@ -83,9 +83,9 @@ namespace SparkleShare {
|
|||
private void CreateNote ()
|
||||
{
|
||||
this.cover = new NSBox () {
|
||||
Frame = new RectangleF (
|
||||
new PointF (-1, 58),
|
||||
new SizeF (Frame.Width + 2, this.ContentView.Frame.Height + 1)),
|
||||
Frame = new CGRect (
|
||||
new CGPoint (-1, 58),
|
||||
new CGSize (Frame.Width + 2, this.ContentView.Frame.Height + 1)),
|
||||
FillColor = NSColor.FromCalibratedRgba (0.77f, 0.77f, 0.75f, 1.0f),
|
||||
BorderColor = NSColor.LightGray,
|
||||
BoxType = NSBoxType.NSBoxCustom
|
||||
|
@ -97,9 +97,9 @@ namespace SparkleShare {
|
|||
BackgroundColor = NSColor.FromCalibratedRgba (0.77f, 0.77f, 0.75f, 1.0f),
|
||||
Bordered = false,
|
||||
Editable = false,
|
||||
Frame = new RectangleF (
|
||||
new PointF (85, ContentView.Frame.Height - 41),
|
||||
new SizeF (320, 22)),
|
||||
Frame = new CGRect (
|
||||
new CGPoint (85, ContentView.Frame.Height - 41),
|
||||
new CGSize (320, 22)),
|
||||
StringValue = SparkleShare.Controller.CurrentUser.Name,
|
||||
Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize)
|
||||
};
|
||||
|
@ -110,9 +110,9 @@ namespace SparkleShare {
|
|||
TextColor = NSColor.DisabledControlText,
|
||||
Bordered = false,
|
||||
Editable = false,
|
||||
Frame = new RectangleF (
|
||||
new PointF (85, ContentView.Frame.Height - 60),
|
||||
new SizeF (320, 20)),
|
||||
Frame = new CGRect (
|
||||
new CGPoint (85, ContentView.Frame.Height - 60),
|
||||
new CGSize (320, 20)),
|
||||
StringValue = SparkleShare.Controller.CurrentUser.Email,
|
||||
};
|
||||
|
||||
|
@ -122,9 +122,9 @@ namespace SparkleShare {
|
|||
BackgroundColor = NSColor.White,
|
||||
Bordered = false,
|
||||
Editable = true,
|
||||
Frame = new RectangleF (
|
||||
new PointF (30, ContentView.Frame.Height - 137),
|
||||
new SizeF (418, 48))
|
||||
Frame = new CGRect (
|
||||
new CGPoint (30, ContentView.Frame.Height - 137),
|
||||
new CGSize (418, 48))
|
||||
};
|
||||
|
||||
(this.balloon_text_field.Cell as NSTextFieldCell).PlaceholderString = "Anything to add?";
|
||||
|
@ -137,13 +137,13 @@ namespace SparkleShare {
|
|||
this.cancel_button = new NSButton () {
|
||||
Title = "Cancel",
|
||||
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 () {
|
||||
Title = "Sync",
|
||||
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 (); };
|
||||
|
@ -157,10 +157,10 @@ namespace SparkleShare {
|
|||
else
|
||||
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 () {
|
||||
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
|
||||
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 () {
|
||||
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;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// SparkleShare, a collaboration and sharing tool.
|
||||
// SparkleShare, a collaboration and sharing tool.
|
||||
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
@ -17,12 +17,11 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
|
||||
using Mono.Unix;
|
||||
using Foundation;
|
||||
using AppKit;
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
using WebKit;
|
||||
|
||||
using Sparkles;
|
||||
|
@ -85,19 +84,19 @@ namespace SparkleShare {
|
|||
Description = "First off, what’s your name and email?\n(visible only to team members)";
|
||||
|
||||
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 () {
|
||||
Frame = new RectangleF (330, Frame.Height - 238, 196, 22),
|
||||
StringValue = UnixUserInfo.GetRealUser ().RealName,
|
||||
Frame = new CGRect (330, Frame.Height - 238, 196, 22),
|
||||
StringValue = new NSProcessInfo ().GetFullUserName (),
|
||||
Delegate = new SparkleTextFieldDelegate ()
|
||||
};
|
||||
|
||||
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 () {
|
||||
Frame = new RectangleF (330, Frame.Height - 268, 196, 22),
|
||||
Frame = new CGRect (330, Frame.Height - 268, 196, 22),
|
||||
Delegate = new SparkleTextFieldDelegate ()
|
||||
};
|
||||
|
||||
|
@ -154,20 +153,20 @@ namespace SparkleShare {
|
|||
Description = "Do you want to add this project to SparkleShare?";
|
||||
|
||||
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);
|
||||
|
||||
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.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);
|
||||
|
||||
|
||||
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" };
|
||||
|
@ -192,12 +191,12 @@ namespace SparkleShare {
|
|||
Description = "";
|
||||
|
||||
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)
|
||||
};
|
||||
|
||||
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),
|
||||
Delegate = new SparkleTextFieldDelegate (),
|
||||
StringValue = "" + Controller.PreviousAddress
|
||||
|
@ -206,12 +205,12 @@ namespace SparkleShare {
|
|||
AddressTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail;
|
||||
|
||||
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)
|
||||
};
|
||||
|
||||
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),
|
||||
Delegate = new SparkleTextFieldDelegate (),
|
||||
StringValue = "" + Controller.PreviousPath
|
||||
|
@ -221,25 +220,25 @@ namespace SparkleShare {
|
|||
|
||||
PathHelpLabel = new SparkleLabel (Controller.SelectedPreset.PathExample, NSTextAlignment.Left) {
|
||||
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) {
|
||||
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) {
|
||||
TableView = new NSTableView () {
|
||||
Frame = new RectangleF (0, 0, 0, 0),
|
||||
Frame = new CGRect (0, 0, 0, 0),
|
||||
RowHeight = 38,
|
||||
IntercellSpacing = new SizeF (8, 12),
|
||||
IntercellSpacing = new CGSize (8, 12),
|
||||
HeaderView = null,
|
||||
Delegate = new SparkleTableViewDelegate ()
|
||||
};
|
||||
|
||||
ScrollView = new NSScrollView () {
|
||||
Frame = new RectangleF (190, Frame.Height - 280, 408, 185),
|
||||
Frame = new CGRect (190, Frame.Height - 280, 408, 185),
|
||||
DocumentView = TableView,
|
||||
HasVerticalScroller = true,
|
||||
BorderType = NSBorderType.BezelBorder
|
||||
|
@ -267,14 +266,14 @@ namespace SparkleShare {
|
|||
if (Environment.OSVersion.Version.Major < 11)
|
||||
DataSource = new SparkleDataSource (1, Controller.Presets);
|
||||
else
|
||||
DataSource = new SparkleDataSource (BackingScaleFactor, Controller.Presets);
|
||||
DataSource = new SparkleDataSource ((float) BackingScaleFactor, Controller.Presets);
|
||||
|
||||
TableView.DataSource = DataSource;
|
||||
TableView.ReloadData ();
|
||||
|
||||
(TableView.Delegate as SparkleTableViewDelegate).SelectionChanged += delegate {
|
||||
Controller.SelectedPresetChanged (TableView.SelectedRow);
|
||||
Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow);
|
||||
Controller.SelectedPresetChanged ((int) TableView.SelectedRow);
|
||||
Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, (int) TableView.SelectedRow);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -283,7 +282,7 @@ namespace SparkleShare {
|
|||
MakeFirstResponder ((NSResponder) TableView);
|
||||
|
||||
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"
|
||||
};
|
||||
|
||||
|
@ -318,11 +317,11 @@ namespace SparkleShare {
|
|||
|
||||
|
||||
(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 {
|
||||
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 (CancelButton);
|
||||
|
||||
Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow);
|
||||
Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, (int) TableView.SelectedRow);
|
||||
}
|
||||
|
||||
if (type == PageType.Syncing) {
|
||||
|
@ -362,7 +361,7 @@ namespace SparkleShare {
|
|||
Description = "This may take a while for large projects.\nIsn’t it coffee-o’clock?";
|
||||
|
||||
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,
|
||||
MinValue = 0.0,
|
||||
MaxValue = 100.0,
|
||||
|
@ -380,7 +379,7 @@ namespace SparkleShare {
|
|||
};
|
||||
|
||||
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) {
|
||||
|
@ -408,7 +407,7 @@ namespace SparkleShare {
|
|||
// Displaying marked up text with Cocoa is
|
||||
// a pain, so we just use a webview instead
|
||||
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>" +
|
||||
"* {" +
|
||||
|
@ -473,11 +472,11 @@ namespace SparkleShare {
|
|||
ButtonCellProto.SetButtonType (NSButtonType.Radio);
|
||||
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);
|
||||
|
||||
Matrix.CellSize = new SizeF (256, 36);
|
||||
Matrix.IntercellSpacing = new SizeF (32, 32);
|
||||
Matrix.CellSize = new CGSize (256, 36);
|
||||
Matrix.IntercellSpacing = new CGSize (32, 32);
|
||||
|
||||
int i = 0;
|
||||
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) {
|
||||
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);
|
||||
|
@ -501,7 +500,7 @@ namespace SparkleShare {
|
|||
ContinueButton = new NSButton () { Title = "Continue" };
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
@ -530,22 +529,22 @@ namespace SparkleShare {
|
|||
extra_pos_y = 20;
|
||||
|
||||
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)
|
||||
};
|
||||
|
||||
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 ()
|
||||
};
|
||||
|
||||
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 ()
|
||||
};
|
||||
|
||||
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",
|
||||
State = NSCellStateValue.Off
|
||||
};
|
||||
|
@ -553,15 +552,15 @@ namespace SparkleShare {
|
|||
ShowPasswordCheckButton.SetButtonType (NSButtonType.Switch);
|
||||
|
||||
WarningImage = NSImage.ImageNamed ("NSInfo");
|
||||
WarningImage.Size = new SizeF (24, 24);
|
||||
WarningImage.Size = new CGSize (24, 24);
|
||||
|
||||
WarningImageView = new NSImageView () {
|
||||
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 can’t be changed later, and your files can’t be recovered if it’s 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" };
|
||||
|
@ -642,15 +641,15 @@ namespace SparkleShare {
|
|||
|
||||
if (warnings.Length > 0) {
|
||||
WarningImage = NSImage.ImageNamed ("NSInfo");
|
||||
WarningImage.Size = new SizeF (24, 24);
|
||||
WarningImage.Size = new CGSize (24, 24);
|
||||
|
||||
WarningImageView = new NSImageView () {
|
||||
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.Frame = new RectangleF (235, Frame.Height - 245, 325, 100);
|
||||
WarningTextField.Frame = new CGRect (235, Frame.Height - 245, 325, 100);
|
||||
|
||||
ContentView.AddSubview (WarningImageView);
|
||||
ContentView.AddSubview (WarningTextField);
|
||||
|
@ -783,7 +782,7 @@ namespace SparkleShare {
|
|||
image_path = hi_path;
|
||||
}
|
||||
|
||||
return new NSImage (image_path) { Size = new SizeF (24, 24) };
|
||||
return new NSImage (image_path) { Size = new CGSize (24, 24) };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
@ -16,8 +16,8 @@
|
|||
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
using AppKit;
|
||||
|
||||
|
@ -38,11 +38,11 @@ namespace SparkleShare {
|
|||
|
||||
public SetupWindow ()
|
||||
{
|
||||
SetFrame (new RectangleF (0, 0, 640, 420), true);
|
||||
SetFrame (new CGRect (0, 0, 640, 420), true);
|
||||
|
||||
StyleMask = NSWindowStyle.Titled;
|
||||
MaxSize = new SizeF (640, 420);
|
||||
MinSize = new SizeF (640, 420);
|
||||
MaxSize = new CGSize (640, 420);
|
||||
MinSize = new CGSize (640, 420);
|
||||
HasShadow = true;
|
||||
IsOpaque = false;
|
||||
BackingType = NSBackingStore.Buffered;
|
||||
|
@ -51,21 +51,21 @@ namespace SparkleShare {
|
|||
Center ();
|
||||
|
||||
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 () {
|
||||
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) {
|
||||
Frame = new RectangleF (190, Frame.Height - 80, Frame.Width, 24),
|
||||
Frame = new CGRect (190, Frame.Height - 80, Frame.Width, 24),
|
||||
Font = NSFontManager.SharedFontManager.FontWithFamily (
|
||||
UserInterface.FontName, NSFontTraitMask.Bold, 0, 16)
|
||||
};
|
||||
|
||||
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;
|
||||
|
@ -99,12 +99,12 @@ namespace SparkleShare {
|
|||
|
||||
foreach (NSButton button in Buttons) {
|
||||
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
|
||||
if (button.Title.Contains (" ")) {
|
||||
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);
|
||||
|
||||
x += 22;
|
||||
|
|
|
@ -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>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
@ -17,9 +17,9 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
using AppKit;
|
||||
using CoreGraphics;
|
||||
|
||||
namespace SparkleShare {
|
||||
|
||||
|
@ -114,7 +114,7 @@ namespace SparkleShare {
|
|||
};
|
||||
|
||||
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 () {
|
||||
Title = "Sync Remote Project…",
|
||||
|
@ -217,7 +217,7 @@ namespace SparkleShare {
|
|||
if (!Controller.Projects [i].HasError)
|
||||
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++;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue