public SearchBarView() { TranslatesAutoresizingMaskIntoConstraints = false; WantsLayer = true; Layer.BackgroundColor = NSColor.White.CGColor; searchIcon = new NSImageView(); searchIcon.Image = NSImage.ImageNamed("Search"); searchIcon.TranslatesAutoresizingMaskIntoConstraints = false; SearchField = new NSTextField(); SearchField.DrawsBackground = false; SearchField.FocusRingType = NSFocusRingType.None; SearchField.Bordered = false; SearchField.TranslatesAutoresizingMaskIntoConstraints = false; SearchField.Font = NSFont.FromFontName("SF UI Display Regular", 14); SearchField.TextColor = NSColor.FromRgb(100, 100, 100); SearchField.PlaceholderString = "Search music here..."; ProgressIndicator = new NSProgressIndicator(); ProgressIndicator.TranslatesAutoresizingMaskIntoConstraints = false; ProgressIndicator.Style = NSProgressIndicatorStyle.Spinning; //ProgressIndicator.Hidden = true; AddSubview(searchIcon); AddSubview(SearchField); AddSubview(ProgressIndicator); ProgressIndicator.StartAnimation(this); BuildConstraints(); }
public ImageView(NSImageView imageView) : base(imageView) { this.imageView = imageView; //this.imageView.WantsLayer = true; this.imageView.TranslatesAutoresizingMaskIntoConstraints = false; //imageLayer = new CALayer(); }
public MacDebuggerObjectNameView(MacObjectValueTreeView treeView) : base(treeView, "name") { ImageView = new NSImageView { TranslatesAutoresizingMaskIntoConstraints = false }; TextField = new MacDebuggerTextField(this) { TranslatesAutoresizingMaskIntoConstraints = false, MaximumNumberOfLines = 1, DrawsBackground = false, Bordered = false, Editable = false }; AddSubview(ImageView); AddSubview(TextField); AddNewExpressionButton = new NSButton { TranslatesAutoresizingMaskIntoConstraints = false, AccessibilityTitle = GettextCatalog.GetString("Add new expression"), Image = GetImage("gtk-add", Gtk.IconSize.Menu), BezelStyle = NSBezelStyle.Inline, Bordered = false }; AddNewExpressionButton.Activated += OnAddNewExpressionButtonClicked; PreviewButton = new NSButton { TranslatesAutoresizingMaskIntoConstraints = false, Image = GetImage("md-empty", Gtk.IconSize.Menu), BezelStyle = NSBezelStyle.Inline, Bordered = false }; PreviewButton.Activated += OnPreviewButtonClicked; }
public NativeMacOsCell(NSString cellId) { Identifier = cellId; WantsLayer = true; Layer.BackgroundColor = NSColor.FromRgb(218, 255, 127).CGColor; _imageView = new NSImageView(); _headingLabel = new NSTextField() { Font = NSFont.FromFontName("Cochin-BoldItalic", 22f), TextColor = NSColor.FromRgb(127, 51, 0), BackgroundColor = NSColor.Clear }; _subheadingLabel = new NSTextField() { Font = NSFont.FromFontName("AmericanTypewriter", 12f), TextColor = NSColor.FromRgb(38, 127, 0), Alignment = NSTextAlignment.Center, BackgroundColor = NSColor.Clear }; AddSubview(_headingLabel); AddSubview(_subheadingLabel); AddSubview(_imageView); }
public override Id InitWithFrame(NSRect aFrameRect) { this.NativePointer = this.SendMessageSuper <IntPtr>(ThisClass, "initWithFrame:", aFrameRect); // create the sub views and attach if (iImage == null) { iImage = new NSImageView(); iImageOver = new NSImageView(); this.AddSubview(iImage); iImage.AddSubview(iImageOver); } // initialise the subviews NSRect frame = new NSRect(0, 0, aFrameRect.Width, aFrameRect.Height); iImage.InitWithFrame(frame); iImage.ImageAlignment = NSImageAlignment.NSImageAlignCenter; iImage.ImageFrameStyle = NSImageFrameStyle.NSImageFrameNone; iImage.ImageScaling = NSImageScaling.NSImageScaleNone; iImageOver.InitWithFrame(frame); iImageOver.ImageAlignment = NSImageAlignment.NSImageAlignCenter; iImageOver.ImageFrameStyle = NSImageFrameStyle.NSImageFrameNone; iImageOver.ImageScaling = NSImageScaling.NSImageScaleNone; iImageOver.AlphaValue = 0.0f; return(this); }
public SetupWindow() { SetFrame (new RectangleF (0, 0, 640, 420), true); StyleMask = NSWindowStyle.Titled; MaxSize = new SizeF (640, 420); MinSize = new SizeF (640, 420); HasShadow = true; IsOpaque = false; BackingType = NSBackingStore.Buffered; Level = NSWindowLevel.Floating; Center (); this.side_splash = NSImage.ImageNamed ("side-splash"); this.side_splash.Size = new SizeF (150, 482); this.side_splash_view = new NSImageView () { Image = this.side_splash, Frame = new RectangleF (0, 0, 150, 482) }; this.header_text_field = new SparkleLabel ("", NSTextAlignment.Left) { Frame = new RectangleF (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) }; this.header_text_field.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; }
public GroupAnimationView(RectangleF frame) : base(frame) { float xInset = 3 * (frame.Width / 8); float yInset = 3 * (frame.Height / 8); RectangleF moverFrame = frame.Inset(xInset, yInset); PointF location = moverFrame.Location; location.X = this.Bounds.GetMidX() - moverFrame.Width / 2; location.Y = this.Bounds.GetMidY() - moverFrame.Height / 2; moverFrame.Location = location; mover = new NSImageView(moverFrame); mover.ImageScaling = NSImageScale.AxesIndependently; mover.Image = NSImage.ImageNamed("photo.jpg"); NSDictionary animations = NSDictionary.FromObjectsAndKeys( new object[] { GroupAnimation(moverFrame) }, new object[] { "frameRotation" }); mover.Animations = animations; AddSubview(mover); }
public TimedAnimation(RectangleF frame) : base(frame) { float xInset = frame.Width / 3; float yInset = frame.Height / 3; RectangleF aniFrame = frame.Inset(xInset, yInset); // photo1 starts and the left edge PointF origin = frame.Location; origin.X = 0.0f; origin.Y = Bounds.GetMidY() - aniFrame.Height / 2; aniFrame.Location = origin; photo1 = new NSImageView(aniFrame); photo1.ImageScaling = NSImageScale.AxesIndependently; photo1.Image = NSImage.ImageNamed("photo1.jpg"); AddSubview(photo1); // photo2 starts in the center origin.X = Bounds.GetMidX() - aniFrame.Width / 2; aniFrame.Location = origin; photo2 = new NSImageView(aniFrame); photo2.ImageScaling = NSImageScale.AxesIndependently; photo2.Image = NSImage.ImageNamed("photo2.jpg"); AddSubview(photo2); }
public SearchResultsTabView(bool darkTheme) { this.darkTheme = darkTheme; TranslatesAutoresizingMaskIntoConstraints = false; ImageView = new NSImageView(); ImageView.TranslatesAutoresizingMaskIntoConstraints = false; AddSubview(ImageView); TextField = NSLabel.CreateWithFont("SF UI Text", 14); TextField.TextColor = darkTheme ? NSColor.FromDeviceWhite(1.0f, 0.0f) : NSColor.FromDeviceWhite(0, 1); AddSubview(TextField); var hFormat = "H:|-(16)-[image(16)]-[text]-(16)-|"; var objects = new object [] { "image", ImageView, "text", TextField }; AddConstraints(NSLayoutConstraint.FromVisualFormat(hFormat, NSLayoutFormatOptions.AlignAllCenterY, objects)); AddConstraint(NSLayoutConstraint.Create(ImageView, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1.0f, 0.0f)); }
public override NSView GetViewForItem(iCarousel carousel, nint index, NSView view) { NSTextField label = null; NSImageView imageView = null; if (view == null) { // create new view if no view is available for recycling imageView = new NSImageView(new CGRect(0, 0, 200.0f, 200.0f)); imageView.Image = NSImage.ImageNamed("page"); imageView.ImageAlignment = NSImageAlignment.Center; label = new NSTextField(imageView.Bounds); label.BackgroundColor = NSColor.Clear; label.Alignment = NSTextAlignment.Center; label.Font = NSFont.LabelFontOfSize(50); label.Bordered = false; label.Editable = false; label.Tag = 1; imageView.AddSubview(label); } else { // get a reference to the label in the recycled view imageView = (NSImageView)view; label = (NSTextField)view.ViewWithTag(1); } // set the values of the view label.StringValue = items[index].ToString(); return(imageView); }
public MacDebuggerObjectNameView(MacObjectValueTreeView treeView) : base(treeView, "name") { ImageView = new NSImageView { TranslatesAutoresizingMaskIntoConstraints = false }; TextField = new EditableTextField(this) { AutoresizingMask = NSViewResizingMask.WidthSizable, TranslatesAutoresizingMaskIntoConstraints = false, DrawsBackground = false, Bordered = false, Editable = false }; TextField.Cell.UsesSingleLineMode = true; TextField.Cell.Wraps = false; AddSubview(ImageView); AddSubview(TextField); PreviewButton = new NSButton { TranslatesAutoresizingMaskIntoConstraints = false, Image = GetImage("md-empty", Gtk.IconSize.Menu), BezelStyle = NSBezelStyle.Inline, Bordered = false }; PreviewButton.Activated += OnPreviewButtonClicked; }
public OutputRecorder(NSImageView imageView, Label label, CocoSsdMobilenet mobilenet) #endif { _imageView = imageView; _label = label; _mobilenet = mobilenet; }
public override void ViewDidLoad() { base.ViewDidLoad(); NSImageView imgV = new NSImageView(); this.View.AddSubview(imgV); imgV.Frame = this.View.Bounds; var bmp = new ARGB32WinBitmap(200, 200); for (uint i = 0; i < 200; i++) { for (uint j = 0; j < 200; j++) { bmp.PutPixel(i, j, (i > 20 && i < 50) ? ARGB32.Black : ARGB32.White); } } using (var stream = bmp.OutputStream()) { imgV.Image = NSImage.FromStream(stream); } imgV.ImageScaling = NSImageScale.AxesIndependently; }
public PlayerView() { TranslatesAutoresizingMaskIntoConstraints = false; WantsLayer = true; Layer.ZPosition = 100; Layer.MasksToBounds = false; CoverImage = new NSImageView(); CoverImage.Image = NSImage.ImageNamed("EmptyCover"); CoverImage.TranslatesAutoresizingMaskIntoConstraints = false; PlayerControls = new PlayerControlsView(); SoundControl = new SoundControlView(); SongTitle = NSLabel.CreateWithFont("SF UI Display Regular", 12); SongTitle.StringValue = "Artist - Song Title"; SongTitle.Alignment = NSTextAlignment.Center; SongTitle.TextColor = NSColor.FromRgb(84, 84, 84); SongTitle.SetContentCompressionResistancePriority(500, NSLayoutConstraintOrientation.Horizontal); SongTitle.MaximumNumberOfLines = 2; SongTitle.LineBreakMode = NSLineBreakMode.TruncatingTail; Progress = new PlayerProgressControl(); AddSubview(Progress); AddSubview(CoverImage); AddSubview(PlayerControls); AddSubview(SongTitle); AddSubview(SoundControl); BuildConstraints(); }
protected async void LoadImageInBackground(NSImageView imageView, string url) { if (string.IsNullOrWhiteSpace(url)) { imageView.Image = PlaceHolder; return; } NSImage image; imageView.Tag = url.GetHashCode(); if (!_cache.TryGetValue(url, out image)) { imageView.Image = PlaceHolder; try { image = await Task.Run(() => new NSImage(NSData.FromUrl(new NSUrl(url)))); _cache[url] = image; } catch { } } if (imageView.Tag == url.GetHashCode() && image != null) { imageView.Image = image; } }
public WelcomeView() { TranslatesAutoresizingMaskIntoConstraints = false; redditIcon = new NSImageView(); redditIcon.TranslatesAutoresizingMaskIntoConstraints = false; redditIcon.Image = NSImage.ImageNamed("RedditIconBig"); applicationName = NSLabel.CreateWithFont("SF UI Display Medium", 23); applicationName.TextColor = NSColor.FromRgb(34, 34, 34); applicationName.StringValue = "Reddit Player"; helperText = NSLabel.CreateWithFont("SF UI Display Regular", 14); helperText.TextColor = NSColor.FromRgb(170, 170, 170); helperText.StringValue = "Welcome to reddit player. You can start listening by selecting one of the featured genres from the sidebar or you can use search bar to find your favorite genre subreddit."; helperText.Alignment = NSTextAlignment.Center; //helperText.UsesSingleLineMode = false; helperText.LineBreakMode = NSLineBreakMode.ByWordWrapping; AddSubview(redditIcon); AddSubview(applicationName); AddSubview(helperText); BuildDefaultContstraints(); }
public ServerFastestSelectionButton(bool isSelected) : base() { const int constButtonHeight = 61; const int constImgHeight = 24; const string title = "Fastest server"; Title = ""; // flag icon var flagView = new NSImageView(); flagView.Frame = new CGRect(20, (constButtonHeight - constImgHeight) / 2, constImgHeight, constImgHeight); flagView.Image = NSImage.ImageNamed("iconAutomaticServerSelection"); AddSubview(flagView); // title __Title = UIUtils.NewLabel(title); __Title.Frame = new CGRect(49, flagView.Frame.Y + 3, 200, 18); __Title.Font = UIUtils.GetSystemFontOfSize(14.0f, NSFontWeight.Semibold); __Title.SizeToFit(); AddSubview(__Title); // image __Image = new NSImageView(); __Image.Frame = new CGRect(__Title.Frame.X + __Title.Frame.Width, flagView.Frame.Y, 25, 25); __Image.Image = NSImage.ImageNamed("iconSelected"); __Image.Hidden = true; AddSubview(__Image); IsSelected = isSelected; }
private void CreateSessionView() { View = new NSImageView() { Image = ImageAccessor.GetIcon("Icon.png").Icon256 }.Autorelease <NSImageView>(); }
public MediaElement(NSImageView imageView) { this.ImageView = imageView; this.mediaElementCore = new MediaElementCore(this, false); // RoutedEvent event bindings mediaElementCore.MediaOpening += (s, e) => { }; mediaElementCore.MediaClosed += (s, e) => { }; mediaElementCore.MediaOpened += (s, e) => { }; mediaElementCore.MediaFailed += (s, e) => { }; mediaElementCore.MediaEnded += (s, e) => { }; mediaElementCore.BufferingStarted += (s, e) => { }; mediaElementCore.BufferingEnded += (s, e) => { }; mediaElementCore.SeekingStarted += (s, e) => { }; mediaElementCore.SeekingEnded += (s, e) => { }; // Non-RoutedEvent event bindings mediaElementCore.MessageLogged += (s, e) => { // TODO: This is incomplete if (e.MessageType == MediaLogMessageType.Trace) { return; } Console.WriteLine($"{e.MessageType,10} - {e.Message}"); }; mediaElementCore.PositionChanged += (s, e) => { }; // INotifyPropertyChanged PropertyChanged Event binding mediaElementCore.PropertyChanged += (s, e) => { }; }
public override void ViewDidLoad() { base.ViewDidLoad(); // Do any additional setup after loading the view. // First initialize FFmpeg dependencies MediaElement.FFmpegDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "ffmpeg"); // Create image view that will show each frame imageView = new NSImageView(new CoreGraphics.CGRect( (View.Bounds.Width - 640) / 2, (View.Bounds.Height - 480) / 2, 640, 480)) { Image = new NSImage(new NSUrl("https://github.com/unosquare/ffmediaelement/raw/master/Support/ffme.png")) }; View.AddSubview(imageView); imageView.AutoresizingMask = NSViewResizingMask.WidthSizable | NSViewResizingMask.HeightSizable; // Create a player and start playing sample video var mediaElement = new MediaElement(imageView); var uri = @"http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4"; var openTask = mediaElement.Open(new Uri(uri)); }
public TimedAnimation (RectangleF frame) : base(frame) { float xInset = frame.Width / 3; float yInset = frame.Height / 3; RectangleF aniFrame = frame.Inset (xInset, yInset); // photo1 starts and the left edge PointF origin = frame.Location; origin.X = 0.0f; origin.Y = Bounds.GetMidY () - aniFrame.Height / 2; aniFrame.Location = origin; photo1 = new NSImageView (aniFrame); photo1.ImageScaling = NSImageScale.AxesIndependently; photo1.Image = NSImage.ImageNamed ("photo1.jpg"); AddSubview (photo1); // photo2 starts in the center origin.X = Bounds.GetMidX () - aniFrame.Width / 2; aniFrame.Location = origin; photo2 = new NSImageView (aniFrame); photo2.ImageScaling = NSImageScale.AxesIndependently; photo2.Image = NSImage.ImageNamed ("photo2.jpg"); AddSubview (photo2); }
public ImageView(NSImageView imageView) : base(imageView) { this.imageView = imageView; this.imageView.WantsLayer = true; imageLayer = new CALayer(); imageView.Layer.AddSublayer(imageLayer); }
public ImageView(NSImageView imageView) : base(imageView) { this.imageView = imageView; this.imageView.WantsLayer = true; //imageLayer = new CALayer(); //imageLayer.BackgroundColor = NSColor.Blue.CGColor; //imageView.Layer.AddSublayer(imageLayer); }
void ReleaseDesignerOutlets() { if (SplashScreenImageView != null) { SplashScreenImageView.Dispose(); SplashScreenImageView = null; } }
public ArtistCellView() { Frame = new CoreGraphics.CGRect(0, 0, 250, 250); Identifier = Key; AddSubview(ImageView = new NSImageView(new CGRect(0, 0, ImageWidth, ImageWidth))); AddSubview(TextView = new TwoLabelView()); AddSubview(OfflineImageView = new NSImageView(new CGRect(0, 0, offlineIconWidth, offlineIconWidth))); }
void InitializeCoverView() { if (BookInfo == null) { return; } CGRect viewFrame = CoverImageView.Frame; var coverFrame = new CGRect(0, 0, viewFrame.Size.Width, viewFrame.Size.Height); var imageView = new BookCoverView(coverFrame); imageView.ColorPrimary = BookInfo.ColorPrimary; imageView.ColorSecondary = BookInfo.ColorSecondary; imageView.FontColor = BookInfo.FontColor; imageView.Title = BookInfo.Name; imageView.DaysRemaining = BookInfo.DaysRemaining; imageView.IsLoan = BookInfo.IsLoan; imageView.IsFTC = isFTC; imageView.InitializeValue(0); CoverImageView.AddSubview(imageView); if (BookInfo.DaysRemaining < 0) { //float rate = viewFrame.Size.Width / viewFrame.Size.Height; float rate = 200.0f / 270.0f; float width = 90 * rate + 3; nfloat orgx = viewFrame.Size.Width - width; nfloat orgy = viewFrame.Size.Height - width; var expiredSashView = new NSImageView(new CGRect(orgx, orgy, width, width)); expiredSashView.Image = Utility.ImageWithFilePath("/Images/Publication/Expired-Sash.png"); expiredSashView.ImageScaling = NSImageScale.AxesIndependently; CoverImageView.AddSubview(expiredSashView); } ProgressView.Hidden = true; if (BookInfo.DaysRemaining < 0) { UpdateButton.Title = "Open"; UpdateButton.Enabled = true; } else { UpdateButton.Title = "Update"; if (BookInfo.PublicationStatus == PublicationStatusEnum.RequireUpdate) { UpdateButton.Enabled = true; } else { UpdateButton.Title = "Open"; UpdateButton.Enabled = true; } } }
public ImageView(NSImageView imageView) : base(imageView) { this.imageView = imageView; this.imageView.WantsLayer = true; this.imageView.TranslatesAutoresizingMaskIntoConstraints = false; //imageLayer = new CALayer(); //imageLayer.BackgroundColor = NSColor.Blue.CGColor; //imageView.Layer.AddSublayer(imageLayer); }
void UpdateReachability (NetworkReachabilityFlags flags, NSImageView icon, NSTextField statusField) { if (flags.HasFlag (NetworkReachabilityFlags.Reachable) && !flags.HasFlag (NetworkReachabilityFlags.ConnectionRequired)) { icon.Image = NSImage.ImageNamed ("connected"); } else { icon.Image = NSImage.ImageNamed ("disconnected"); } statusField.StringValue = flags == 0 ? String.Empty : flags.ToString (); }
void AddFTCImageView() { if (isFTC) { var frame = new CGRect(10, PUBLICATION_VIEW_HEIGHT - 50, 30, 50); var imageView = new NSImageView(frame); imageView.Image = Utility.ImageWithFilePath("/Images/Publication/FTC.png"); AddSubview(imageView); } }
public static void LoadSvg(this NSImageView imageView, string svg) { if (string.IsNullOrWhiteSpace(svg)) { return; } var s = imageView.Bounds.Size; LoadSvg(imageView, svg, new Size(s.Width, s.Height)); }
public StatusIcon (StatusBar bar) : base (CGRect.Empty) { imageView = new NSImageView (CGRect.Empty); AddSubview (imageView); var trackingArea = new NSTrackingArea (CGRect.Empty, NSTrackingAreaOptions.ActiveInKeyWindow | NSTrackingAreaOptions.InVisibleRect | NSTrackingAreaOptions.MouseEnteredAndExited, this, null); AddTrackingArea (trackingArea); this.bar = bar; }
private void Initialize() { imageView = new NSImageView(new RectangleF(0, 0, 16, 16)); textView = new NSTextField(); textView.Bordered = false; textView.DrawsBackground = false; badgteView = new NSButton(); badgteView.BezelStyle = NSBezelStyle.TexturedRounded; }
public void SetPauseButton(NSImageView btn) { __PauseButton = btn; __TrackingAreaPauseBtn = new NSTrackingArea(__PauseButton.Frame, NSTrackingAreaOptions.ActiveInKeyWindow | NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.MouseMoved, this, null); AddTrackingArea(__TrackingAreaPauseBtn); NeedsDisplay = true; }
public SparkleWindow() : base() { SetFrame(new RectangleF(0, 0, 640, 380), true); StyleMask = NSWindowStyle.Titled; MaxSize = new SizeF(640, 380); MinSize = new SizeF(640, 380); HasShadow = true; BackingType = NSBackingStore.Buffered; Center(); string side_splash_path = Path.Combine(NSBundle.MainBundle.ResourcePath, "Pixmaps", "side-splash.png"); SideSplash = new NSImage(side_splash_path) { Size = new SizeF(150, 407) }; SideSplashView = new NSImageView() { Image = SideSplash, Frame = new RectangleF(0, 0, 150, 407) }; Buttons = new List <NSButton> (); HeaderTextField = new NSTextField() { Frame = new RectangleF(190, Frame.Height - 100, Frame.Width, 48), BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Bold, 0, 15) }; DescriptionTextField = new NSTextField() { Frame = new RectangleF(190, Frame.Height - 155, 640 - 240, 64), BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Font = SparkleUI.Font }; NSApplication.SharedApplication.ActivateIgnoringOtherApps(true); MakeKeyAndOrderFront(this); OrderFrontRegardless(); }
void InitializeFramePositions () { CGRect moverRect = Bounds.Inset(Bounds.Size.Width / 4, Bounds.Size.Height / 4); CGPoint origin = moverRect.Location; origin.X = 0; moverRect.Location = origin; mover = new NSImageView (moverRect); leftPosition = new CGPoint (0, moverRect.GetMinY ()); rightPosition = new CGPoint (Bounds.GetMaxX () - moverRect.Width, moverRect.GetMinY ()); isRight = false; }
public SparkleSetupWindow() : base() { SetFrame (new RectangleF (0, 0, 640, 420), true); StyleMask = NSWindowStyle.Titled; MaxSize = new SizeF (640, 420); MinSize = new SizeF (640, 420); HasShadow = true; BackingType = NSBackingStore.Buffered; Center (); string side_splash_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "side-splash.png"); SideSplash = new NSImage (side_splash_path) { Size = new SizeF (150, 482) }; SideSplashView = new NSImageView () { Image = SideSplash, Frame = new RectangleF (0, 0, 150, 482) }; Buttons = new List <NSButton> (); HeaderTextField = new NSTextField () { Frame = new RectangleF (190, Frame.Height - 100, Frame.Width, 48), BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Bold, 0, 15) }; DescriptionTextField = new NSTextField () { Frame = new RectangleF (190, Frame.Height - 130, 640 - 240, 44), BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Font = SparkleUI.Font }; NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); MakeKeyAndOrderFront (this); OrderFrontRegardless (); if (Program.UI != null) Program.UI.UpdateDockIconVisibility (); }
void SetupMover() { CGRect moverFrame = Bounds.Inset(Bounds.Width / 4.0f, Bounds.Height / 4.0f); CGPoint origin = moverFrame.Location; origin.X = 0.0f; moverFrame.Location = origin; mover = new NSImageView(moverFrame); mover.ImageScaling = NSImageScale.AxesIndependently; mover.Image = NSImage.ImageNamed("photo.jpg"); AddSubview(mover); }
public BegrippenSource(string[] begripDefinities, QTMovieView movieViewer, NSScrollView tekeningenView, string filmPath, NSImageView[] handvormen, NSImageView[] fotos ) { this.BegripMgr = new BegrippenManager(begripDefinities); this.MovieViewer = movieViewer; this.TekeningenViewer = tekeningenView; this.FilmPath = filmPath; if (handvormen != null) this.Handvormen = new List<NSImageView>(handvormen); if (fotos != null) this.Fotos = new List<NSImageView>(fotos); }
public KeyFrameView(CGRect frame) : base(frame) { nfloat xInset = 3 * (frame.Width / 8); nfloat yInset = 3 * (frame.Height / 8); CGRect moverFrame = frame.Inset (xInset, yInset); mover = new NSImageView (moverFrame); mover.ImageScaling = NSImageScale.AxesIndependently; mover.Image = NSImage.ImageNamed ("photo.jpg"); AddSubview (mover); addBounceAnimation (); }
public SparkleSetupWindow() : base() { SetFrame (new RectangleF (0, 0, 640, 420), true); StyleMask = NSWindowStyle.Titled; MaxSize = new SizeF (640, 420); MinSize = new SizeF (640, 420); HasShadow = true; BackingType = NSBackingStore.Buffered; Center (); string side_splash_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "side-splash.png"); this.side_splash = new NSImage (side_splash_path) { Size = new SizeF (150, 482) }; this.side_splash_view = new NSImageView () { Image = this.side_splash, Frame = new RectangleF (0, 0, 150, 482) }; this.header_text_field = new NSTextField () { Frame = new RectangleF (190, Frame.Height - 80, Frame.Width, 24), BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Font = NSFontManager.SharedFontManager.FontWithFamily ( "Lucida Grande", NSFontTraitMask.Bold, 0, 15), }; this.header_text_field.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; this.description_text_field = new NSTextField () { Frame = new RectangleF (190, Frame.Height - 130, 640 - 240, 44), BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Font = NSFontManager.SharedFontManager.FontWithFamily ( "Lucida Grande", NSFontTraitMask.Condensed, 0, 13) }; if (Program.UI != null) Program.UI.UpdateDockIconVisibility (); }
public override void awakeFromNib() { _priorityViewIndex = 1; _minTopLeft = 200; _minBottomRight = 200; _maxTopLeft = INT_MAX; _maxBottomRight = INT_MAX; // divider style is thin by default setDividerStyle(NSSplitViewDividerStyle.NSSplitViewDividerStyleThin); // create and adjust handle image handleImage = new NSImageView(); handleImage.setImageAlignment(NSImageAlignCenter); handleImage.setImageScaling(NSImageScaleNone); NSImage i = NSImage.imageNamed("VerticalSplit"); handleImage.setImage(i); this.setHandleOnRight(false); this.adjustSubviews(); this.setDelegate(this); }
public SparkleSetupWindow() : base() { SetFrame (new RectangleF (0, 0, 450, 542), true); StyleMask = NSWindowStyle.Titled | NSWindowStyle.Closable | NSWindowStyle.Miniaturizable; MaxSize = new SizeF (450, 542); MinSize = new SizeF (450, 542); HasShadow = true; BackingType = NSBackingStore.Buffered; Center (); this.background_image_view = new NSImageView () { //Image = this.background_image, Frame = new RectangleF (0, 0, 450, 542) }; this.header_text_field = new NSTextField () { Frame = new RectangleF (190, Frame.Height - 100, Frame.Width, 48), BackgroundColor = NSColor.Clear, Bordered = false, Editable = false, Font = NSFontManager.SharedFontManager.FontWithFamily ( "Lucida Grande", NSFontTraitMask.Bold, 0, 16) }; this.description_text_field = new NSTextField () { Frame = new RectangleF (190, Frame.Height - 210, 640 - 240, 105), BackgroundColor = NSColor.Clear, Bordered = false, Editable = false, Font = NSFontManager.SharedFontManager.FontWithFamily ( "Lucida Grande", NSFontTraitMask.Condensed, 0, 13) }; if (Program.UI != null) Program.UI.UpdateDockIconVisibility (); }
public SparkleSetupWindow() : base() { SetFrame (new RectangleF (0, 0, 640, 420), true); StyleMask = NSWindowStyle.Titled; MaxSize = new SizeF (640, 420); MinSize = new SizeF (640, 420); HasShadow = true; BackingType = NSBackingStore.Buffered; Center (); this.side_splash = NSImage.ImageNamed ("side-splash"); this.side_splash.Size = new SizeF (150, 482); this.side_splash_view = new NSImageView () { Image = this.side_splash, Frame = new RectangleF (0, 0, 150, 482) }; this.header_text_field = new SparkleLabel ("", NSTextAlignment.Left) { Frame = new RectangleF (190, Frame.Height - 80, Frame.Width, 24), Font = NSFontManager.SharedFontManager.FontWithFamily ( "Lucida Grande", NSFontTraitMask.Bold, 0, 15), }; this.description_text_field = new SparkleLabel ("", NSTextAlignment.Left) { Frame = new RectangleF (190, Frame.Height - 130, 640 - 240, 44), Font = NSFontManager.SharedFontManager.FontWithFamily ( "Lucida Grande", NSFontTraitMask.Condensed, 0, 13) }; this.header_text_field.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; if (Program.UI != null) Program.UI.UpdateDockIconVisibility (); }
public GroupAnimationView(CGRect frame) : base(frame) { nfloat xInset = 3 * (frame.Width / 8); nfloat yInset = 3 * (frame.Height / 8); CGRect moverFrame = frame.Inset (xInset, yInset); CGPoint location = moverFrame.Location; location.X = this.Bounds.GetMidX () - moverFrame.Width / 2; location.Y = this.Bounds.GetMidY () - moverFrame.Height / 2; moverFrame.Location = location; mover = new NSImageView (moverFrame); mover.ImageScaling = NSImageScale.AxesIndependently; mover.Image = NSImage.ImageNamed ("photo.jpg"); NSDictionary animations = NSDictionary.FromObjectsAndKeys ( new object[] {GroupAnimation(moverFrame)}, new object[] {"frameRotation"}); mover.Animations = animations; AddSubview (mover); }
private void CreateAbout() { string about_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "about.png"); AboutImage = new NSImage (about_image_path) { Size = new SizeF (640, 260) }; AboutImageView = new NSImageView () { Image = AboutImage, Frame = new RectangleF (0, 0, 640, 260) }; VersionTextField = new NSTextField () { StringValue = "version " + Controller.RunningVersion, Frame = new RectangleF (295, 140, 318, 22), BackgroundColor = NSColor.White, Bordered = false, Editable = false, DrawsBackground = false, TextColor = NSColor.White, Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Unbold, 0, 11) }; UpdatesTextField = new NSTextField () { StringValue = "Checking for updates...", Frame = new RectangleF (295, Frame.Height - 232, 318, 98), Bordered = false, Editable = false, DrawsBackground = false, Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Unbold, 0, 11), TextColor = NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f) // Tango Sky Blue #1 }; CreditsTextField = new NSTextField () { StringValue = @"Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others." + "\n" + "\n" + "SparkleShare is Free and Open Source Software. You are free to use, modify, and redistribute it " + "under the GNU General Public License version 3 or later.", Frame = new RectangleF (295, Frame.Height - 260, 318, 98), TextColor = NSColor.White, DrawsBackground = false, Bordered = false, Editable = false, Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Unbold, 0, 11), }; // WebsiteButton.Activated += delegate { // NSUrl url = new NSUrl ("http://www.sparkleshare.org/"); // NSWorkspace.SharedWorkspace.OpenUrl (url); // }; // CreditsButton.Activated += delegate { // NSUrl url = new NSUrl ("http://www.sparkleshare.org/credits/"); // NSWorkspace.SharedWorkspace.OpenUrl (url); // }; ContentView.AddSubview (AboutImageView); ContentView.AddSubview (VersionTextField); ContentView.AddSubview (UpdatesTextField); ContentView.AddSubview (CreditsTextField); }
public void ShowPage (PageType type, string [] warnings) { if (type == PageType.Setup) { Header = "Welcome to 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); FullNameTextField = new NSTextField () { Frame = new RectangleF (330, Frame.Height - 238, 196, 22), StringValue = UnixUserInfo.GetRealUser ().RealName, Delegate = new SparkleTextFieldDelegate () }; EmailLabel = new SparkleLabel ("Email:", NSTextAlignment.Right); EmailLabel.Frame = new RectangleF (165, Frame.Height - 264, 160, 17); EmailTextField = new NSTextField () { Frame = new RectangleF (330, Frame.Height - 268, 196, 22), Delegate = new SparkleTextFieldDelegate () }; CancelButton = new NSButton () { Title = "Cancel" }; ContinueButton = new NSButton () { Title = "Continue", Enabled = false }; (FullNameTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckSetupPage (FullNameTextField.StringValue, EmailTextField.StringValue); }; (EmailTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckSetupPage (FullNameTextField.StringValue, EmailTextField.StringValue); }; ContinueButton.Activated += delegate { string full_name = FullNameTextField.StringValue.Trim (); string email = EmailTextField.StringValue.Trim (); Controller.SetupPageCompleted (full_name, email); }; CancelButton.Activated += delegate { Controller.SetupPageCancelled (); }; Controller.UpdateSetupContinueButtonEvent += delegate (bool button_enabled) { Program.Controller.Invoke (() => { ContinueButton.Enabled = button_enabled; }); }; ContentView.AddSubview (FullNameLabel); ContentView.AddSubview (FullNameTextField); ContentView.AddSubview (EmailLabel); ContentView.AddSubview (EmailTextField); Buttons.Add (ContinueButton); Buttons.Add (CancelButton); Controller.CheckSetupPage (FullNameTextField.StringValue, EmailTextField.StringValue); } if (type == PageType.Invite) { Header = "You’ve received an invite!"; Description = "Do you want to add this project to SparkleShare?"; AddressLabel = new SparkleLabel ("Address:", NSTextAlignment.Right); AddressLabel.Frame = new RectangleF (165, Frame.Height - 240, 160, 17); AddressTextField = new SparkleLabel (Controller.PendingInvite.Address, NSTextAlignment.Left) { Frame = new RectangleF (330, Frame.Height - 240, 260, 17), Font = SparkleUI.BoldFont }; PathLabel = new SparkleLabel ("Remote Path:", NSTextAlignment.Right); PathLabel.Frame = new RectangleF (165, Frame.Height - 264, 160, 17); PathTextField = new SparkleLabel (Controller.PendingInvite.RemotePath, NSTextAlignment.Left) { Frame = new RectangleF (330, Frame.Height - 264, 260, 17), Font = SparkleUI.BoldFont }; CancelButton = new NSButton () { Title = "Cancel" }; AddButton = new NSButton () { Title = "Add" }; CancelButton.Activated += delegate { Controller.PageCancelled (); }; AddButton.Activated += delegate { Controller.InvitePageCompleted (); }; ContentView.AddSubview (AddressLabel); ContentView.AddSubview (PathLabel); ContentView.AddSubview (AddressTextField); ContentView.AddSubview (PathTextField); Buttons.Add (AddButton); Buttons.Add (CancelButton); } if (type == PageType.Add) { Header = "Where’s your project hosted?"; Description = ""; AddressLabel = new SparkleLabel ("Address:", NSTextAlignment.Left) { Frame = new RectangleF (190, Frame.Height - 308, 160, 17), Font = SparkleUI.BoldFont }; AddressTextField = new NSTextField () { Frame = new RectangleF (190, Frame.Height - 336, 196, 22), Font = SparkleUI.Font, Enabled = (Controller.SelectedPlugin.Address == null), Delegate = new SparkleTextFieldDelegate (), StringValue = "" + Controller.PreviousAddress }; AddressTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; PathLabel = new SparkleLabel ("Remote Path:", NSTextAlignment.Left) { Frame = new RectangleF (190 + 196 + 16, Frame.Height - 308, 160, 17), Font = SparkleUI.BoldFont }; PathTextField = new NSTextField () { Frame = new RectangleF (190 + 196 + 16, Frame.Height - 336, 196, 22), Enabled = (Controller.SelectedPlugin.Path == null), Delegate = new SparkleTextFieldDelegate (), StringValue = "" + Controller.PreviousPath }; PathTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; PathHelpLabel = new SparkleLabel (Controller.SelectedPlugin.PathExample, NSTextAlignment.Left) { TextColor = NSColor.DisabledControlText, Frame = new RectangleF (190 + 196 + 16, Frame.Height - 355, 204, 17), Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 11), }; AddressHelpLabel = new SparkleLabel (Controller.SelectedPlugin.AddressExample, NSTextAlignment.Left) { TextColor = NSColor.DisabledControlText, Frame = new RectangleF (190, Frame.Height - 355, 204, 17), Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 11), }; if (TableView == null || TableView.RowCount != Controller.Plugins.Count) { TableView = new NSTableView () { Frame = new RectangleF (0, 0, 0, 0), RowHeight = 34, IntercellSpacing = new SizeF (8, 12), HeaderView = null, Delegate = new SparkleTableViewDelegate () }; ScrollView = new NSScrollView () { Frame = new RectangleF (190, Frame.Height - 280, 408, 185), DocumentView = TableView, HasVerticalScroller = true, BorderType = NSBorderType.BezelBorder }; IconColumn = new NSTableColumn () { Width = 36, HeaderToolTip = "Icon", DataCell = new NSImageCell () { ImageAlignment = NSImageAlignment.Right } }; DescriptionColumn = new NSTableColumn () { Width = 350, HeaderToolTip = "Description", Editable = false }; DescriptionColumn.DataCell.Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 11); TableView.AddColumn (IconColumn); TableView.AddColumn (DescriptionColumn); // Hi-res display support was added after Snow Leopard if (Environment.OSVersion.Version.Major < 11) DataSource = new SparkleDataSource (1, Controller.Plugins); else DataSource = new SparkleDataSource (BackingScaleFactor, Controller.Plugins); TableView.DataSource = DataSource; TableView.ReloadData (); (TableView.Delegate as SparkleTableViewDelegate).SelectionChanged += delegate { Controller.SelectedPluginChanged (TableView.SelectedRow); Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); }; } TableView.SelectRow (Controller.SelectedPluginIndex, false); TableView.ScrollRowToVisible (Controller.SelectedPluginIndex); HistoryCheckButton = new NSButton () { Frame = new RectangleF (190, Frame.Height - 400, 300, 18), Title = "Fetch prior revisions" }; if (Controller.FetchPriorHistory) HistoryCheckButton.State = NSCellStateValue.On; HistoryCheckButton.SetButtonType (NSButtonType.Switch); AddButton = new NSButton () { Title = "Add", Enabled = false }; CancelButton = new NSButton () { Title = "Cancel" }; Controller.ChangeAddressFieldEvent += delegate (string text, string example_text, FieldState state) { Program.Controller.Invoke (() => { AddressTextField.StringValue = text; AddressTextField.Enabled = (state == FieldState.Enabled); AddressHelpLabel.StringValue = example_text; }); }; Controller.ChangePathFieldEvent += delegate (string text, string example_text, FieldState state) { Program.Controller.Invoke (() => { PathTextField.StringValue = text; PathTextField.Enabled = (state == FieldState.Enabled); PathHelpLabel.StringValue = example_text; }); }; (AddressTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); }; (PathTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); }; HistoryCheckButton.Activated += delegate { Controller.HistoryItemChanged (HistoryCheckButton.State == NSCellStateValue.On); }; AddButton.Activated += delegate { Controller.AddPageCompleted (AddressTextField.StringValue, PathTextField.StringValue); }; CancelButton.Activated += delegate { Controller.PageCancelled (); }; Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) { Program.Controller.Invoke (() => { AddButton.Enabled = button_enabled; }); }; ContentView.AddSubview (ScrollView); ContentView.AddSubview (AddressLabel); ContentView.AddSubview (AddressTextField); ContentView.AddSubview (AddressHelpLabel); ContentView.AddSubview (PathLabel); ContentView.AddSubview (PathTextField); ContentView.AddSubview (PathHelpLabel); ContentView.AddSubview (HistoryCheckButton); Buttons.Add (AddButton); Buttons.Add (CancelButton); Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); } if (type == PageType.Syncing) { Header = "Adding project ‘" + Controller.SyncingFolder + "’…"; 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), Style = NSProgressIndicatorStyle.Bar, MinValue = 0.0, MaxValue = 100.0, Indeterminate = false, DoubleValue = Controller.ProgressBarPercentage }; ProgressIndicator.StartAnimation (this); CancelButton = new NSButton () { Title = "Cancel" }; FinishButton = new NSButton () { Title = "Finish", Enabled = false }; Controller.UpdateProgressBarEvent += delegate (double percentage) { Program.Controller.Invoke (() => { ProgressIndicator.DoubleValue = percentage; }); }; CancelButton.Activated += delegate { Controller.SyncingCancelled (); }; ContentView.AddSubview (ProgressIndicator); Buttons.Add (FinishButton); Buttons.Add (CancelButton); } if (type == PageType.Error) { Header = "Oops! Something went wrong…"; Description = "Please check the following:"; // 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); string html = "<style>" + "* {" + " font-family: 'Lucida Grande';" + " font-size: 12px; cursor: default;" + "}" + "body {" + " -webkit-user-select: none;" + " margin: 0;" + " padding: 3px;" + "}" + "li {" + " margin-bottom: 16px;" + " margin-left: 0;" + " padding-left: 0;" + " line-height: 20px;" + " word-wrap: break-word;" + "}" + "ul {" + " padding-left: 24px;" + "}" + "</style>" + "<ul>" + " <li><b>" + Controller.PreviousUrl + "</b> is the address we’ve compiled. Does this look alright?</li>" + " <li>Is this computer’s Client ID known by the host?</li>" + "</ul>"; if (warnings.Length > 0) { string warnings_markup = ""; foreach (string warning in warnings) warnings_markup += "<br><b>" + warning + "</b>"; html = html.Replace ("</ul>", "<li>Here’s the raw error message: " + warnings_markup + "</li></ul>"); } web_view.MainFrame.LoadHtmlString (html, new NSUrl ("")); web_view.DrawsBackground = false; CancelButton = new NSButton () { Title = "Cancel" }; TryAgainButton = new NSButton () { Title = "Try Again…" }; CancelButton.Activated += delegate { Controller.PageCancelled (); }; TryAgainButton.Activated += delegate { Controller.ErrorPageCompleted (); }; ContentView.AddSubview (web_view); Buttons.Add (TryAgainButton); Buttons.Add (CancelButton); } if (type == PageType.CryptoSetup || type == PageType.CryptoPassword) { if (type == PageType.CryptoSetup) { Header = "Set up file encryption"; Description = "Please a provide a strong password that you don’t use elsewhere."; } else { Header = "This project contains encrypted files"; Description = "Please enter the password to see their contents."; } int extra_pos_y = 0; if (type == PageType.CryptoPassword) extra_pos_y = 20; PasswordLabel = new SparkleLabel ("Password:"******"Show password", State = NSCellStateValue.Off }; ShowPasswordCheckButton.SetButtonType (NSButtonType.Switch); WarningImage = NSImage.ImageNamed ("NSInfo"); WarningImage.Size = new SizeF (24, 24); WarningImageView = new NSImageView () { Image = WarningImage, Frame = new RectangleF (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), }; CancelButton = new NSButton () { Title = "Cancel" }; ContinueButton = new NSButton () { Title = "Continue", Enabled = false }; Controller.UpdateCryptoPasswordContinueButtonEvent += delegate (bool button_enabled) { Program.Controller.Invoke (() => { ContinueButton.Enabled = button_enabled; }); }; Controller.UpdateCryptoSetupContinueButtonEvent += delegate (bool button_enabled) { Program.Controller.Invoke (() => { ContinueButton.Enabled = button_enabled; }); }; ShowPasswordCheckButton.Activated += delegate { if (PasswordTextField.Superview == ContentView) { PasswordTextField.RemoveFromSuperview (); ContentView.AddSubview (VisiblePasswordTextField); } else { VisiblePasswordTextField.RemoveFromSuperview (); ContentView.AddSubview (PasswordTextField); } }; (PasswordTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { VisiblePasswordTextField.StringValue = PasswordTextField.StringValue; if (type == PageType.CryptoSetup) Controller.CheckCryptoSetupPage (PasswordTextField.StringValue); else Controller.CheckCryptoPasswordPage (PasswordTextField.StringValue); }; (VisiblePasswordTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { PasswordTextField.StringValue = VisiblePasswordTextField.StringValue; if (type == PageType.CryptoSetup) Controller.CheckCryptoSetupPage (PasswordTextField.StringValue); else Controller.CheckCryptoPasswordPage (PasswordTextField.StringValue); }; ContinueButton.Activated += delegate { if (type == PageType.CryptoSetup) Controller.CryptoSetupPageCompleted (PasswordTextField.StringValue); else Controller.CryptoPasswordPageCompleted (PasswordTextField.StringValue); }; CancelButton.Activated += delegate { Controller.CryptoPageCancelled (); }; ContentView.AddSubview (PasswordLabel); ContentView.AddSubview (PasswordTextField); ContentView.AddSubview (ShowPasswordCheckButton); if (type == PageType.CryptoSetup) { ContentView.AddSubview (WarningImageView); ContentView.AddSubview (WarningTextField); } Buttons.Add (ContinueButton); Buttons.Add (CancelButton); NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.CriticalRequest); } if (type == PageType.Finished) { Header = "Your shared project is ready!"; Description = "You can find the files in your SparkleShare folder."; if (warnings.Length > 0) { WarningImage = NSImage.ImageNamed ("NSInfo"); WarningImage.Size = new SizeF (24, 24); WarningImageView = new NSImageView () { Image = WarningImage, Frame = new RectangleF (200, Frame.Height - 175, 24, 24) }; WarningTextField = new SparkleLabel (warnings [0], NSTextAlignment.Left); WarningTextField.Frame = new RectangleF (235, Frame.Height - 245, 325, 100); ContentView.AddSubview (WarningImageView); ContentView.AddSubview (WarningTextField); } ShowFilesButton = new NSButton () { Title = "Show Files…" }; FinishButton = new NSButton () { Title = "Finish" }; ShowFilesButton.Activated += delegate { Controller.ShowFilesClicked (); }; FinishButton.Activated += delegate { Controller.FinishPageCompleted (); }; Buttons.Add (FinishButton); Buttons.Add (ShowFilesButton); NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.CriticalRequest); } if (type == PageType.Tutorial) { SlideImage = NSImage.ImageNamed ("tutorial-slide-" + Controller.TutorialPageNumber); if (SlideImage != null) { SlideImage.Size = new SizeF (324, 200); SlideImageView = new NSImageView () { Image = SlideImage, Frame = new RectangleF (228, Frame.Height - 350, 324, 200) }; ContentView.AddSubview (SlideImageView); } switch (Controller.TutorialPageNumber) { case 1: { Header = "What’s happening next?"; Description = "SparkleShare creates a special folder on your computer " + "that will keep track of your projects."; SkipTutorialButton = new NSButton () { Title = "Skip Tutorial" }; ContinueButton = new NSButton () { Title = "Continue" }; SkipTutorialButton.Activated += delegate { Controller.TutorialSkipped (); }; ContinueButton.Activated += delegate { Controller.TutorialPageCompleted (); }; ContentView.AddSubview (SlideImageView); Buttons.Add (ContinueButton); Buttons.Add (SkipTutorialButton); break; } case 2: { Header = "Sharing files with others"; Description = "All files added to your project folders are synced automatically with " + "the host and your team members."; ContinueButton = new NSButton () { Title = "Continue" }; ContinueButton.Activated += delegate { Controller.TutorialPageCompleted (); }; Buttons.Add (ContinueButton); break; } case 3: { Header = "The status icon helps you"; Description = "It shows the syncing progress, provides easy access to " + "your projects, and lets you view recent changes."; ContinueButton = new NSButton () { Title = "Continue" }; ContinueButton.Activated += delegate { Controller.TutorialPageCompleted (); }; Buttons.Add (ContinueButton); break; } case 4: { Header = "Here’s your unique Client ID"; Description = "You’ll need it whenever you want to link this computer to a host. " + "You can also find it in the status icon menu."; LinkCodeTextField = new NSTextField () { StringValue = Program.Controller.CurrentUser.PublicKey, Enabled = false, Selectable = false, Frame = new RectangleF (230, Frame.Height - 238, 246, 22) }; LinkCodeTextField.Cell.UsesSingleLineMode = true; LinkCodeTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; CopyButton = new NSButton () { Title = "Copy", BezelStyle = NSBezelStyle.RoundRect, Frame = new RectangleF (480, Frame.Height - 238, 60, 22) }; StartupCheckButton = new NSButton () { Frame = new RectangleF (190, Frame.Height - 400, 300, 18), Title = "Add SparkleShare to startup items", State = NSCellStateValue.On }; StartupCheckButton.SetButtonType (NSButtonType.Switch); FinishButton = new NSButton () { Title = "Finish" }; StartupCheckButton.Activated += delegate { Controller.StartupItemChanged (StartupCheckButton.State == NSCellStateValue.On); }; CopyButton.Activated += delegate { Controller.CopyToClipboardClicked (); }; FinishButton.Activated += delegate { Controller.TutorialPageCompleted (); }; ContentView.AddSubview (LinkCodeTextField); ContentView.AddSubview (CopyButton); ContentView.AddSubview (StartupCheckButton); Buttons.Add (FinishButton); break; } } } }
private void CreateNote() { this.cover = new NSBox () { Frame = new RectangleF ( new PointF (-1, 58), new SizeF (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 }; this.user_name_text_field = new NSTextField () { Alignment = NSTextAlignment.Left, 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)), StringValue = SparkleShare.Controller.CurrentUser.Name, Font = NSFont.FromFontName (UserInterface.FontName + " Bold", NSFont.SystemFontSize) }; this.user_email_text_field = new NSTextField () { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.FromCalibratedRgba (0.77f, 0.77f, 0.75f, 1.0f), TextColor = NSColor.DisabledControlText, Bordered = false, Editable = false, Frame = new RectangleF ( new PointF (85, ContentView.Frame.Height - 60), new SizeF (320, 20)), StringValue = SparkleShare.Controller.CurrentUser.Email, }; this.balloon_text_field = new NSTextField () { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.White, Bordered = false, Editable = true, Frame = new RectangleF ( new PointF (30, ContentView.Frame.Height - 137), new SizeF (418, 48)) }; (this.balloon_text_field.Cell as NSTextFieldCell).PlaceholderString = "Anything to add?"; (this.balloon_text_field.Cell as NSTextFieldCell).LineBreakMode = NSLineBreakMode.ByWordWrapping; (this.balloon_text_field.Cell as NSTextFieldCell).UsesSingleLineMode = false; this.balloon_text_field.Cell.FocusRingType = NSFocusRingType.None; this.cancel_button = new NSButton () { Title = "Cancel", BezelStyle = NSBezelStyle.Rounded, Frame = new RectangleF (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), }; this.cancel_button.Activated += delegate { Controller.CancelClicked (); }; this.sync_button.Activated += delegate { Controller.SyncClicked (this.balloon_text_field.StringValue); }; DefaultButtonCell = this.sync_button.Cell; if (BackingScaleFactor >= 2) this.balloon_image = NSImage.ImageNamed ("text-balloon@2x"); else this.balloon_image = NSImage.ImageNamed ("text-balloon"); this.balloon_image.Size = new SizeF (438, 72); this.balloon_image_view = new NSImageView () { Image = this.balloon_image, Frame = new RectangleF (21, ContentView.Frame.Height - 145, 438, 72) }; if (!string.IsNullOrEmpty (Controller.AvatarFilePath)) this.user_image = new NSImage (Controller.AvatarFilePath); else this.user_image = NSImage.ImageNamed ("user-icon-default"); this.user_image.Size = new SizeF (48, 48); this.user_image_view = new NSImageView () { Image = this.user_image, Frame = new RectangleF (21, ContentView.Frame.Height - 65, 48, 48) }; this.user_image_view.WantsLayer = true; this.user_image_view.Layer.CornerRadius = 5.0f; this.user_image_view.Layer.MasksToBounds = true; ContentView.AddSubview (this.cover); ContentView.AddSubview (this.cancel_button); ContentView.AddSubview (this.sync_button); ContentView.AddSubview (this.user_name_text_field); ContentView.AddSubview (this.user_email_text_field); ContentView.AddSubview (this.user_image_view); ContentView.AddSubview (this.balloon_image_view); ContentView.AddSubview (this.balloon_text_field); MakeFirstResponder ((NSResponder) this.balloon_text_field); }
private void CreateAbout () { using (var a = new NSAutoreleasePool ()) { string about_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "about.png"); this.about_image = new NSImage (about_image_path) { Size = new SizeF (640, 260) }; this.about_image_view = new NSImageView () { Image = this.about_image, Frame = new RectangleF (0, 0, 640, 260) }; this.version_text_field = new NSTextField () { StringValue = "version " + Controller.RunningVersion, Frame = new RectangleF (295, 140, 318, 22), BackgroundColor = NSColor.White, Bordered = false, Editable = false, DrawsBackground = false, TextColor = NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f), Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Unbold, 0, 11) }; this.updates_text_field = new NSTextField () { StringValue = "Checking for updates...", Frame = new RectangleF (295, Frame.Height - 232, 318, 98), Bordered = false, Editable = false, DrawsBackground = false, Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Unbold, 0, 11), TextColor = NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f) // Tango Sky Blue #1 }; this.credits_text_field = new NSTextField () { StringValue = @"Copyright © 2013-" + DateTime.Now.Year + " GRAU DATA AG, Hylke Bons and others." + "\n" + "\n" + "DataSpace Sync is Open Source software. You are free to use, modify, and redistribute it " + "under the GNU General Public License version 3 or later.", Frame = new RectangleF (295, Frame.Height - 260, 318, 98), TextColor = NSColor.FromCalibratedRgba (0.45f, 0.62f, 0.81f, 1.0f), DrawsBackground = false, Bordered = false, Editable = false, Font = NSFontManager.SharedFontManager.FontWithFamily ( "Lucida Grande", NSFontTraitMask.Unbold, 0, 11), }; ContentView.AddSubview (this.about_image_view); ContentView.AddSubview (this.version_text_field); //ContentView.AddSubview (this.updates_text_field); ContentView.AddSubview (this.credits_text_field); } }
public void ShowPage(PageType type, string [] warnings) { if (type == PageType.Setup) { Header = "Welcome to SparkleShare!"; Description = "First off, what's your name and email?\n(visible only to team members)"; FullNameLabel = new NSTextField () { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (165, Frame.Height - 234, 160, 17), StringValue = "Full Name:", Font = SparkleUI.Font }; FullNameTextField = new NSTextField () { Frame = new RectangleF (330, Frame.Height - 238, 196, 22), StringValue = UnixUserInfo.GetRealUser ().RealName, Delegate = new SparkleTextFieldDelegate () }; EmailLabel = new NSTextField () { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (165, Frame.Height - 264, 160, 17), StringValue = "Email:", Font = SparkleUI.Font }; EmailTextField = new NSTextField () { Frame = new RectangleF (330, Frame.Height - 268, 196, 22), Delegate = new SparkleTextFieldDelegate () }; CancelButton = new NSButton () { Title = "Cancel" }; ContinueButton = new NSButton () { Title = "Continue", Enabled = false }; (FullNameTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckSetupPage (FullNameTextField.StringValue, EmailTextField.StringValue); }; (EmailTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckSetupPage (FullNameTextField.StringValue, EmailTextField.StringValue); }; ContinueButton.Activated += delegate { string full_name = FullNameTextField.StringValue.Trim (); string email = EmailTextField.StringValue.Trim (); Controller.SetupPageCompleted (full_name, email); }; CancelButton.Activated += delegate { Controller.SetupPageCancelled (); }; Controller.UpdateSetupContinueButtonEvent += delegate (bool button_enabled) { InvokeOnMainThread (delegate { ContinueButton.Enabled = button_enabled; }); }; ContentView.AddSubview (FullNameLabel); ContentView.AddSubview (FullNameTextField); ContentView.AddSubview (EmailLabel); ContentView.AddSubview (EmailTextField); Buttons.Add (ContinueButton); Buttons.Add (CancelButton); Controller.CheckSetupPage (FullNameTextField.StringValue, EmailTextField.StringValue); } if (type == PageType.Invite) { Header = "You've received an invite!"; Description = "Do you want to add this project to SparkleShare?"; AddressLabel = new NSTextField () { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (165, Frame.Height - 240, 160, 17), StringValue = "Address:", Font = SparkleUI.Font }; PathLabel = new NSTextField () { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (165, Frame.Height - 264, 160, 17), StringValue = "Remote Path:", Font = SparkleUI.Font }; AddressTextField = new NSTextField () { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (330, Frame.Height - 240, 260, 17), StringValue = Controller.PendingInvite.Address, Font = SparkleUI.BoldFont }; PathTextField = new NSTextField () { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (330, Frame.Height - 264, 260, 17), StringValue = Controller.PendingInvite.RemotePath, Font = SparkleUI.BoldFont }; CancelButton = new NSButton () { Title = "Cancel" }; AddButton = new NSButton () { Title = "Add" }; CancelButton.Activated += delegate { Controller.PageCancelled (); }; AddButton.Activated += delegate { Controller.InvitePageCompleted (); }; ContentView.AddSubview (AddressLabel); ContentView.AddSubview (PathLabel); ContentView.AddSubview (AddressTextField); ContentView.AddSubview (PathTextField); Buttons.Add (AddButton); Buttons.Add (CancelButton); } if (type == PageType.Add) { Header = "Where's your project hosted?"; Description = ""; AddressLabel = new NSTextField () { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (190, Frame.Height - 308, 160, 17), StringValue = "Address:", Font = SparkleUI.BoldFont }; AddressTextField = new NSTextField () { Frame = new RectangleF (190, Frame.Height - 336, 196, 22), Font = SparkleUI.Font, Enabled = (Controller.SelectedPlugin.Address == null), Delegate = new SparkleTextFieldDelegate (), StringValue = "" + Controller.PreviousAddress }; AddressTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; PathLabel = new NSTextField () { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (190 + 196 + 16, Frame.Height - 308, 160, 17), StringValue = "Remote Path:", Font = SparkleUI.BoldFont }; PathTextField = new NSTextField () { Frame = new RectangleF (190 + 196 + 16, Frame.Height - 336, 196, 22), Enabled = (Controller.SelectedPlugin.Path == null), Delegate = new SparkleTextFieldDelegate (), StringValue = "" + Controller.PreviousPath }; PathTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; PathHelpLabel = new NSTextField () { BackgroundColor = NSColor.WindowBackground, Bordered = false, TextColor = NSColor.DisabledControlText, Editable = false, Frame = new RectangleF (190 + 196 + 16, Frame.Height - 355, 204, 17), Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 11), StringValue = "" + Controller.SelectedPlugin.PathExample }; AddressHelpLabel = new NSTextField () { BackgroundColor = NSColor.WindowBackground, Bordered = false, TextColor = NSColor.DisabledControlText, Editable = false, Frame = new RectangleF (190, Frame.Height - 355, 204, 17), Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 11), StringValue = "" + Controller.SelectedPlugin.AddressExample }; TableView = new NSTableView () { Frame = new RectangleF (0, 0, 0, 0), RowHeight = 34, IntercellSpacing = new SizeF (8, 12), HeaderView = null, Delegate = new SparkleTableViewDelegate () }; ScrollView = new NSScrollView () { Frame = new RectangleF (190, Frame.Height - 280, 408, 185), DocumentView = TableView, HasVerticalScroller = true, BorderType = NSBorderType.BezelBorder }; IconColumn = new NSTableColumn (new NSImage ()) { Width = 36, HeaderToolTip = "Icon", DataCell = new NSImageCell () { ImageAlignment = NSImageAlignment.Right } }; DescriptionColumn = new NSTableColumn () { Width = 350, HeaderToolTip = "Description", Editable = false }; DescriptionColumn.DataCell.Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 11); TableView.AddColumn (IconColumn); TableView.AddColumn (DescriptionColumn); DataSource = new SparkleDataSource (Controller.Plugins); TableView.DataSource = DataSource; TableView.ReloadData (); HistoryCheckButton = new NSButton () { Frame = new RectangleF (190, Frame.Height - 400, 300, 18), Title = "Fetch prior revisions" }; if (Controller.FetchPriorHistory) HistoryCheckButton.State = NSCellStateValue.On; HistoryCheckButton.SetButtonType (NSButtonType.Switch); AddButton = new NSButton () { Title = "Add", Enabled = false }; CancelButton = new NSButton () { Title = "Cancel" }; Controller.ChangeAddressFieldEvent += delegate (string text, string example_text, FieldState state) { InvokeOnMainThread (delegate { AddressTextField.StringValue = text; AddressTextField.Enabled = (state == FieldState.Enabled); AddressHelpLabel.StringValue = example_text; }); }; Controller.ChangePathFieldEvent += delegate (string text, string example_text, FieldState state) { InvokeOnMainThread (delegate { PathTextField.StringValue = text; PathTextField.Enabled = (state == FieldState.Enabled); PathHelpLabel.StringValue = example_text; }); }; TableView.SelectRow (Controller.SelectedPluginIndex, false); TableView.ScrollRowToVisible (Controller.SelectedPluginIndex); (AddressTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); }; (PathTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); }; (TableView.Delegate as SparkleTableViewDelegate).SelectionChanged += delegate { Controller.SelectedPluginChanged (TableView.SelectedRow); Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); }; HistoryCheckButton.Activated += delegate { Controller.HistoryItemChanged (HistoryCheckButton.State == NSCellStateValue.On); }; AddButton.Activated += delegate { Controller.AddPageCompleted (AddressTextField.StringValue, PathTextField.StringValue); }; CancelButton.Activated += delegate { Controller.PageCancelled (); }; Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) { InvokeOnMainThread (delegate { AddButton.Enabled = button_enabled; }); }; ContentView.AddSubview (ScrollView); ContentView.AddSubview (AddressLabel); ContentView.AddSubview (AddressTextField); ContentView.AddSubview (AddressHelpLabel); ContentView.AddSubview (PathLabel); ContentView.AddSubview (PathTextField); ContentView.AddSubview (PathHelpLabel); ContentView.AddSubview (HistoryCheckButton); Buttons.Add (AddButton); Buttons.Add (CancelButton); Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); } if (type == PageType.Syncing) { Header = "Adding project ‘" + Controller.SyncingFolder + "’…"; Description = "This may take a while on big projects. Isn't it coffee-o'clock?"; ProgressIndicator = new NSProgressIndicator () { Frame = new RectangleF (190, Frame.Height - 200, 640 - 150 - 80, 20), Style = NSProgressIndicatorStyle.Bar, MinValue = 0.0, MaxValue = 100.0, Indeterminate = false, DoubleValue = Controller.ProgressBarPercentage }; ProgressIndicator.StartAnimation (this); CancelButton = new NSButton () { Title = "Cancel" }; FinishButton = new NSButton () { Title = "Finish", Enabled = false }; Controller.UpdateProgressBarEvent += delegate (double percentage) { InvokeOnMainThread (() => { ProgressIndicator.DoubleValue = percentage; }); }; CancelButton.Activated += delegate { Controller.SyncingCancelled (); }; ContentView.AddSubview (ProgressIndicator); Buttons.Add (FinishButton); Buttons.Add (CancelButton); } if (type == PageType.Error) { Header = "Oops! Something went wrong…"; Description = "Please check the following:"; // 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); string html = "<style>" + "* {" + " font-family: 'Lucida Grande';" + " font-size: 12px; cursor: default;" + "}" + "body {" + " -webkit-user-select: none;" + " margin: 0;" + " padding: 3px;" + "}" + "li {" + " margin-bottom: 16px;" + " margin-left: 0;" + " padding-left: 0;" + " line-height: 20px;" + "}" + "ul {" + " padding-left: 24px;" + "}" + "</style>" + "<ul>" + " <li><b>" + Controller.PreviousUrl + "</b> is the address we've compiled. Does this look alright?</li>" + " <li>Do you have access rights to this remote project?</li>" + "</ul>"; if (warnings.Length > 0) { string warnings_markup = ""; foreach (string warning in warnings) warnings_markup += "<br><b>" + warning + "</b>"; html = html.Replace ("</ul>", "<li>Here's the raw error message: " + warnings_markup + "</li></ul>"); } web_view.MainFrame.LoadHtmlString (html, new NSUrl ("")); web_view.DrawsBackground = false; CancelButton = new NSButton () { Title = "Cancel" }; TryAgainButton = new NSButton () { Title = "Try again…" }; CancelButton.Activated += delegate { Controller.PageCancelled (); }; TryAgainButton.Activated += delegate { Controller.ErrorPageCompleted (); }; ContentView.AddSubview (web_view); Buttons.Add (TryAgainButton); Buttons.Add (CancelButton); } if (type == PageType.CryptoSetup) { Header = "Set up file encryption"; Description = "This project is supposed to be encrypted, but it doesn't yet have a password set. Please provide one below:"; PasswordLabel = new NSTextField () { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (155, Frame.Height - 204, 160, 17), StringValue = "Password:"******"Show password", State = NSCellStateValue.Off }; ShowPasswordCheckButton.SetButtonType (NSButtonType.Switch); WarningImage = NSImage.ImageNamed ("NSInfo"); WarningImage.Size = new SizeF (24, 24); WarningImageView = new NSImageView () { Image = WarningImage, Frame = new RectangleF (200, Frame.Height - 320, 24, 24) }; WarningTextField = new NSTextField () { Frame = new RectangleF (235, Frame.Height - 390, 325, 100), StringValue = "This password can't be changed later, and your files can't be recovered if it's forgotten.", BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Font = SparkleUI.Font }; CancelButton = new NSButton () { Title = "Cancel" }; ContinueButton = new NSButton () { Title = "Continue", Enabled = false }; ShowPasswordCheckButton.Activated += delegate { if (PasswordTextField.Superview == ContentView) { PasswordTextField.RemoveFromSuperview (); ContentView.AddSubview (VisiblePasswordTextField); } else { VisiblePasswordTextField.RemoveFromSuperview (); ContentView.AddSubview (PasswordTextField); } }; (PasswordTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { VisiblePasswordTextField.StringValue = PasswordTextField.StringValue; Controller.CheckCryptoSetupPage (PasswordTextField.StringValue); }; (VisiblePasswordTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { PasswordTextField.StringValue = VisiblePasswordTextField.StringValue; Controller.CheckCryptoSetupPage (PasswordTextField.StringValue); }; Controller.UpdateCryptoSetupContinueButtonEvent += delegate (bool button_enabled) { InvokeOnMainThread (() => { ContinueButton.Enabled = button_enabled; }); }; ContinueButton.Activated += delegate { Controller.CryptoSetupPageCompleted (PasswordTextField.StringValue); }; CancelButton.Activated += delegate { Controller.CryptoPageCancelled (); }; ContentView.AddSubview (PasswordLabel); ContentView.AddSubview (PasswordTextField); ContentView.AddSubview (ShowPasswordCheckButton); ContentView.AddSubview (WarningImageView); ContentView.AddSubview (WarningTextField); Buttons.Add (ContinueButton); Buttons.Add (CancelButton); NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.CriticalRequest); } if (type == PageType.CryptoPassword) { Header = "This project contains encrypted files"; Description = "Please enter the password to see their contents."; PasswordLabel = new NSTextField () { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (155, Frame.Height - 224, 160, 17), StringValue = "Password:"******"Show password", State = NSCellStateValue.Off }; ShowPasswordCheckButton.SetButtonType (NSButtonType.Switch); CancelButton = new NSButton () { Title = "Cancel" }; ContinueButton = new NSButton () { Title = "Continue", Enabled = false }; Controller.UpdateCryptoPasswordContinueButtonEvent += delegate (bool button_enabled) { InvokeOnMainThread (() => { ContinueButton.Enabled = button_enabled; }); }; ShowPasswordCheckButton.Activated += delegate { if (PasswordTextField.Superview == ContentView) { PasswordTextField.RemoveFromSuperview (); ContentView.AddSubview (VisiblePasswordTextField); } else { VisiblePasswordTextField.RemoveFromSuperview (); ContentView.AddSubview (PasswordTextField); } }; (PasswordTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { VisiblePasswordTextField.StringValue = PasswordTextField.StringValue; Controller.CheckCryptoPasswordPage (PasswordTextField.StringValue); }; (VisiblePasswordTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { PasswordTextField.StringValue = VisiblePasswordTextField.StringValue; Controller.CheckCryptoPasswordPage (PasswordTextField.StringValue); }; ContinueButton.Activated += delegate { Controller.CryptoPasswordPageCompleted (PasswordTextField.StringValue); }; CancelButton.Activated += delegate { Controller.CryptoPageCancelled (); }; ContentView.AddSubview (PasswordLabel); ContentView.AddSubview (PasswordTextField); ContentView.AddSubview (ShowPasswordCheckButton); Buttons.Add (ContinueButton); Buttons.Add (CancelButton); NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.CriticalRequest); } if (type == PageType.Finished) { Header = "Your shared project is ready!"; Description = "You can find the files in your SparkleShare folder."; if (warnings.Length > 0) { WarningImage = NSImage.ImageNamed ("NSInfo"); WarningImage.Size = new SizeF (24, 24); WarningImageView = new NSImageView () { Image = WarningImage, Frame = new RectangleF (200, Frame.Height - 175, 24, 24) }; WarningTextField = new NSTextField () { Frame = new RectangleF (235, Frame.Height - 245, 325, 100), StringValue = warnings [0], BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Font = SparkleUI.Font }; ContentView.AddSubview (WarningImageView); ContentView.AddSubview (WarningTextField); } OpenFolderButton = new NSButton () { Title = string.Format ("Open {0}", Path.GetFileName (Controller.PreviousPath)) }; FinishButton = new NSButton () { Title = "Finish" }; OpenFolderButton.Activated += delegate { Controller.OpenFolderClicked (); }; FinishButton.Activated += delegate { Controller.FinishPageCompleted (); }; Buttons.Add (FinishButton); Buttons.Add (OpenFolderButton); NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.CriticalRequest); } if (type == PageType.Tutorial) { string slide_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "tutorial-slide-" + Controller.TutorialPageNumber + ".png"); SlideImage = new NSImage (slide_image_path) { Size = new SizeF (350, 200) }; SlideImageView = new NSImageView () { Image = SlideImage, Frame = new RectangleF (215, Frame.Height - 350, 350, 200) }; ContentView.AddSubview (SlideImageView); switch (Controller.TutorialPageNumber) { case 1: { Header = "What's happening next?"; Description = "SparkleShare creates a special folder on your computer " + "that will keep track of your projects."; SkipTutorialButton = new NSButton () { Title = "Skip Tutorial" }; ContinueButton = new NSButton () { Title = "Continue" }; SkipTutorialButton.Activated += delegate { Controller.TutorialSkipped (); }; ContinueButton.Activated += delegate { Controller.TutorialPageCompleted (); }; ContentView.AddSubview (SlideImageView); Buttons.Add (ContinueButton); Buttons.Add (SkipTutorialButton); break; } case 2: { Header = "Sharing files with others"; Description = "All files added to your project folders are synced automatically with " + "the host and your team members."; ContinueButton = new NSButton () { Title = "Continue" }; ContinueButton.Activated += delegate { Controller.TutorialPageCompleted (); }; Buttons.Add (ContinueButton); break; } case 3: { Header = "The status icon is here to help"; Description = "It shows the syncing progress, provides easy access to " + "your projects and let's you view recent changes."; ContinueButton = new NSButton () { Title = "Continue" }; ContinueButton.Activated += delegate { Controller.TutorialPageCompleted (); }; Buttons.Add (ContinueButton); break; } case 4: { Header = "Adding projects to SparkleShare"; Description = "You can do this through the status icon menu, or by clicking " + "magic buttons on webpages that look like this:"; StartupCheckButton = new NSButton () { Frame = new RectangleF (190, Frame.Height - 400, 300, 18), Title = "Add SparkleShare to startup items", State = NSCellStateValue.On }; StartupCheckButton.SetButtonType (NSButtonType.Switch); FinishButton = new NSButton () { Title = "Finish" }; SlideImage.Size = new SizeF (350, 64); StartupCheckButton.Activated += delegate { Controller.StartupItemChanged (StartupCheckButton.State == NSCellStateValue.On); }; FinishButton.Activated += delegate { Controller.TutorialPageCompleted (); }; ContentView.AddSubview (StartupCheckButton); Buttons.Add (FinishButton); break; } } } }
private NSImageView Mover() { if (mover == null) { float xInset = 0.25f * Bounds.Width; float yInset = 0.25f * Bounds.Height; RectangleF moverFrame = Bounds.Inset (xInset,yInset); moverFrame.Location = new PointF (Bounds.GetMidX () - moverFrame.Width / 2.0f, Bounds.GetMidY () - moverFrame.Height / 2.0f); mover = new NSImageView (Bounds) { ImageScaling = NSImageScale.AxesIndependently, Image = NSImage.ImageNamed("photo.jpg"), Frame = moverFrame, AlphaValue = 0.5f }; } return mover; }
public SparkleSetup() : base() { Controller.ChangePageEvent += delegate (PageType type, string [] warnings) { InvokeOnMainThread (delegate { Reset (); switch (type) { case PageType.Setup: { Header = "Welcome to SparkleShare!"; Description = "Before we can create a SparkleShare folder on this " + "computer, we need some information from you."; FullNameLabel = new NSTextField () { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (165, Frame.Height - 234, 160, 17), StringValue = "Full Name:", Font = SparkleUI.Font }; FullNameTextField = new NSTextField () { Frame = new RectangleF (330, Frame.Height - 238, 196, 22), StringValue = Controller.GuessedUserName, Delegate = new SparkleTextFieldDelegate () }; EmailLabel = new NSTextField () { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (165, Frame.Height - 264, 160, 17), StringValue = "Email:", Font = SparkleUI.Font }; EmailTextField = new NSTextField () { Frame = new RectangleF (330, Frame.Height - 268, 196, 22), StringValue = Controller.GuessedUserEmail, Delegate = new SparkleTextFieldDelegate () }; (FullNameTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckSetupPage ( FullNameTextField.StringValue, EmailTextField.StringValue ); }; (EmailTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckSetupPage ( FullNameTextField.StringValue, EmailTextField.StringValue ); }; ContinueButton = new NSButton () { Title = "Continue", Enabled = false }; ContinueButton.Activated += delegate { string full_name = FullNameTextField.StringValue.Trim (); string email = EmailTextField.StringValue.Trim (); Controller.SetupPageCompleted (full_name, email); }; Controller.UpdateSetupContinueButtonEvent += delegate (bool button_enabled) { InvokeOnMainThread (delegate { ContinueButton.Enabled = button_enabled; }); }; ContentView.AddSubview (FullNameLabel); ContentView.AddSubview (FullNameTextField); ContentView.AddSubview (EmailLabel); ContentView.AddSubview (EmailTextField); Buttons.Add (ContinueButton); break; } case PageType.Add: { Header = "Where's your project hosted?"; Description = ""; AddressLabel = new NSTextField () { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (190, Frame.Height - 308, 160, 17), StringValue = "Address:", Font = SparkleUI.Font }; AddressTextField = new NSTextField () { Frame = new RectangleF (190, Frame.Height - 336, 196, 22), Font = SparkleUI.Font, StringValue = Controller.PreviousAddress, Enabled = (Controller.SelectedPlugin.Address == null), Delegate = new SparkleTextFieldDelegate () }; PathLabel = new NSTextField () { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (190 + 196 + 16, Frame.Height - 308, 160, 17), StringValue = "Remote Path:", Font = SparkleUI.Font }; PathTextField = new NSTextField () { Frame = new RectangleF (190 + 196 + 16, Frame.Height - 336, 196, 22), StringValue = Controller.PreviousPath, Enabled = (Controller.SelectedPlugin.Path == null), Delegate = new SparkleTextFieldDelegate () }; AddressTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; PathTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; PathHelpLabel = new NSTextField () { BackgroundColor = NSColor.WindowBackground, Bordered = false, TextColor = NSColor.DisabledControlText, Editable = false, Frame = new RectangleF (190 + 196 + 16, Frame.Height - 355, 204, 17), StringValue = "e.g. ‘rupert/website-design’", Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 11) }; TableView = new NSTableView () { Frame = new RectangleF (0, 0, 0, 0), RowHeight = 30, IntercellSpacing = new SizeF (0, 12), HeaderView = null, Delegate = new SparkleTableViewDelegate () }; ScrollView = new NSScrollView () { Frame = new RectangleF (190, Frame.Height - 280, 408, 175), DocumentView = TableView, HasVerticalScroller = true, BorderType = NSBorderType.BezelBorder }; IconColumn = new NSTableColumn (new NSImage ()) { Width = 42, HeaderToolTip = "Icon", DataCell = new NSImageCell () }; DescriptionColumn = new NSTableColumn () { Width = 350, HeaderToolTip = "Description", Editable = false }; DescriptionColumn.DataCell.Font = NSFontManager.SharedFontManager.FontWithFamily ( "Lucida Grande", NSFontTraitMask.Condensed, 0, 11); TableView.AddColumn (IconColumn); TableView.AddColumn (DescriptionColumn); DataSource = new SparkleDataSource (); foreach (SparklePlugin plugin in Controller.Plugins) DataSource.Items.Add (plugin); TableView.DataSource = DataSource; TableView.ReloadData (); Controller.ChangeAddressFieldEvent += delegate (string text, string example_text, FieldState state) { InvokeOnMainThread (delegate { AddressTextField.StringValue = text; AddressTextField.Enabled = (state == FieldState.Enabled); }); }; Controller.ChangePathFieldEvent += delegate (string text, string example_text, FieldState state) { InvokeOnMainThread (delegate { PathTextField.StringValue = text; PathTextField.Enabled = (state == FieldState.Enabled); if (!string.IsNullOrEmpty (example_text)) PathHelpLabel.StringValue = "e.g. " + example_text; }); }; TableView.SelectRow (Controller.SelectedPluginIndex, false); (AddressTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckAddPage ( AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow ); }; (PathTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckAddPage ( AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow ); }; (TableView.Delegate as SparkleTableViewDelegate).SelectionChanged += delegate { Controller.SelectedPluginChanged (TableView.SelectedRow); Controller.CheckAddPage ( AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow ); }; Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) { InvokeOnMainThread (delegate { SyncButton.Enabled = button_enabled; }); }; ContentView.AddSubview (ScrollView); ContentView.AddSubview (AddressLabel); ContentView.AddSubview (AddressTextField); ContentView.AddSubview (PathLabel); ContentView.AddSubview (PathTextField); ContentView.AddSubview (PathHelpLabel); SyncButton = new NSButton () { Title = "Add", Enabled = false }; SyncButton.Activated += delegate { Controller.AddPageCompleted ( AddressTextField.StringValue, PathTextField.StringValue ); }; Buttons.Add (SyncButton); CancelButton = new NSButton () { Title = "Cancel" }; CancelButton.Activated += delegate { InvokeOnMainThread (delegate { PerformClose (this); }); }; Buttons.Add (CancelButton); break; } case PageType.Syncing: { Header = "Adding project ‘" + Controller.SyncingFolder + "’…"; Description = "This may take a while.\n" + "Are you sure it’s not coffee o'clock?"; ProgressIndicator = new NSProgressIndicator () { Frame = new RectangleF (190, Frame.Height - 200, 640 - 150 - 80, 20), Style = NSProgressIndicatorStyle.Bar, MinValue = 0.0, MaxValue = 100.0, Indeterminate = false, DoubleValue = 1.0 }; ProgressIndicator.StartAnimation (this); Controller.UpdateProgressBarEvent += delegate (double percentage) { InvokeOnMainThread (delegate { ProgressIndicator.DoubleValue = percentage; }); }; ContentView.AddSubview (ProgressIndicator); FinishButton = new NSButton () { Title = "Finish", Enabled = false }; CancelButton = new NSButton () { Title = "Cancel" }; CancelButton.Activated += delegate { Controller.SyncingCancelled (); }; Buttons.Add (FinishButton); Buttons.Add (CancelButton); break; } case PageType.Error: { Header = "Something went wrong…"; Description = "Please check the following:"; // 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); string html = "<style>" + "* {" + " font-family: 'Lucida Grande';" + " font-size: 12px; cursor: default;" + "}" + "body {" + " -webkit-user-select: none;" + " margin: 0;" + " padding: 3px;" + "}" + "li {" + " margin-bottom: 16px;" + " margin-left: 0;" + " padding-left: 0;" + " line-height: 20px;" + "}" + "ul {" + " padding-left: 24px;" + "}" + "</style>" + "<ul>" + " <li>First, have you tried turning it off and on again?</li>" + " <li><b>" + Controller.PreviousUrl + "</b> is the address we've compiled. Does this look alright?</li>" + " <li>The host needs to know who you are. Did you upload the key that's in your SparkleShare folder?</li>" + "</ul>"; web_view.MainFrame.LoadHtmlString (html, new NSUrl ("")); web_view.DrawsBackground = false; ContentView.AddSubview (web_view); TryAgainButton = new NSButton () { Title = "Try again…" }; TryAgainButton.Activated += delegate { Controller.ErrorPageCompleted (); }; Buttons.Add (TryAgainButton); break; } case PageType.Finished: { Header = "Project succesfully added!"; Description = "Now you can access the files from " + "‘" + Controller.SyncingFolder + "’ in " + "your SparkleShare folder."; if (warnings != null) { WarningImage = NSImage.ImageNamed ("NSCaution"); WarningImage.Size = new SizeF (24, 24); WarningImageView = new NSImageView () { Image = WarningImage, Frame = new RectangleF (190, Frame.Height - 175, 24, 24) }; WarningTextField = new NSTextField () { Frame = new RectangleF (230, Frame.Height - 245, 325, 100), StringValue = warnings [0], BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Font = SparkleUI.Font }; ContentView.AddSubview (WarningImageView); ContentView.AddSubview (WarningTextField); } FinishButton = new NSButton () { Title = "Finish" }; FinishButton.Activated += delegate { InvokeOnMainThread (delegate { Controller.FinishedPageCompleted (); PerformClose (this); }); }; OpenFolderButton = new NSButton () { Title = "Open Folder" }; OpenFolderButton.Activated += delegate { Program.Controller.OpenSparkleShareFolder (Controller.SyncingFolder); }; Buttons.Add (FinishButton); Buttons.Add (OpenFolderButton); NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.CriticalRequest); NSSound.FromName ("Glass").Play (); break; } case PageType.Tutorial: { switch (Controller.TutorialPageNumber) { case 1: { Header = "What's happening next?"; Description = "SparkleShare creates a special folder in your personal folder " + "that will keep track of your projects."; SkipTutorialButton = new NSButton () { Title = "Skip Tutorial" }; SkipTutorialButton.Activated += delegate { Controller.TutorialSkipped (); }; ContinueButton = new NSButton () { Title = "Continue" }; ContinueButton.Activated += delegate { Controller.TutorialPageCompleted (); }; string slide_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "tutorial-slide-1.png"); SlideImage = new NSImage (slide_image_path) { Size = new SizeF (350, 200) }; SlideImageView = new NSImageView () { Image = SlideImage, Frame = new RectangleF (215, Frame.Height - 350, 350, 200) }; ContentView.AddSubview (SlideImageView); Buttons.Add (ContinueButton); Buttons.Add (SkipTutorialButton); break; } case 2: { Header = "Sharing files with others"; Description = "All files added to your project folders are synced with the host " + "automatically, as well as with your collaborators."; ContinueButton = new NSButton () { Title = "Continue" }; ContinueButton.Activated += delegate { Controller.TutorialPageCompleted (); }; string slide_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "tutorial-slide-2.png"); SlideImage = new NSImage (slide_image_path) { Size = new SizeF (350, 200) }; SlideImageView = new NSImageView () { Image = SlideImage, Frame = new RectangleF (215, Frame.Height - 350, 350, 200) }; ContentView.AddSubview (SlideImageView); Buttons.Add (ContinueButton); break; } case 3: { Header = "The status icon is here to help"; Description = "It shows the syncing process status, " + "and contains links to your projects and the event log."; ContinueButton = new NSButton () { Title = "Continue" }; ContinueButton.Activated += delegate { Controller.TutorialPageCompleted (); }; string slide_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "tutorial-slide-3.png"); SlideImage = new NSImage (slide_image_path) { Size = new SizeF (350, 200) }; SlideImageView = new NSImageView () { Image = SlideImage, Frame = new RectangleF (215, Frame.Height - 350, 350, 200) }; ContentView.AddSubview (SlideImageView); Buttons.Add (ContinueButton); break; } case 4: { Header = "Adding projects to SparkleShare"; Description = "Just click this button when you see it on the web, and " + "the project will be automatically added:"; AddProjectTextField = new NSTextField () { Frame = new RectangleF (190, Frame.Height - 290, 640 - 240, 44), BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Font = SparkleUI.Font, StringValue = "…or select ‘Add Hosted Project…’ from the status icon menu " + "to add one by hand." }; FinishButton = new NSButton () { Title = "Finish" }; FinishButton.Activated += delegate { InvokeOnMainThread (delegate { PerformClose (this); }); }; string slide_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "tutorial-slide-4.png"); SlideImage = new NSImage (slide_image_path) { Size = new SizeF (350, 64) }; SlideImageView = new NSImageView () { Image = SlideImage, Frame = new RectangleF (215, Frame.Height - 215, 350, 64) }; ContentView.AddSubview (SlideImageView); ContentView.AddSubview (AddProjectTextField); Buttons.Add (FinishButton); break; } } break; } } ShowAll (); }); }; }
private void Initialize() { imageView = new NSImageView (new RectangleF (0, 0, 16, 16)); textView = new NSTextField (); textView.Bordered = false; textView.DrawsBackground = false; badgteView = new NSButton (); badgteView.BezelStyle = NSBezelStyle.TexturedRounded; }
static void GlobalSetup () { if (initedGlobal || setupFail) return; initedGlobal = true; //FIXME: should we remove these when finalizing? try { ApplicationEvents.Quit += delegate (object sender, ApplicationQuitEventArgs e) { if (!IdeApp.Exit ()) e.UserCancelled = true; e.Handled = true; }; ApplicationEvents.Reopen += delegate (object sender, ApplicationEventArgs e) { if (IdeApp.Workbench != null && IdeApp.Workbench.RootWindow != null) { IdeApp.Workbench.RootWindow.Deiconify (); IdeApp.Workbench.RootWindow.Visible = true; e.Handled = true; } }; ApplicationEvents.OpenDocuments += delegate (object sender, ApplicationDocumentEventArgs e) { //OpenFiles may pump the mainloop, but can't do that from an AppleEvent, so use a brief timeout GLib.Timeout.Add (10, delegate { IdeApp.OpenFiles (e.Documents.Select (doc => new FileOpenInformation (doc.Key, doc.Value, 1, true))); return false; }); e.Handled = true; }; if (!System.Reflection.Assembly.GetExecutingAssembly ().Location.Contains ("MonoDevelop.app")) { var icons = Path.Combine (Directory.GetCurrentDirectory (), "theme-icons", "Mac", "monodevelop.icns"); if (File.Exists (icons)) { var tile = NSApplication.SharedApplication.DockTile; var view = new NSImageView (new System.Drawing.RectangleF (0, 0, tile.Size.Width, tile.Size.Height)) { Image = new NSImage (icons) }; tile.ContentView = view; tile.Display (); } } } catch (Exception ex) { MonoDevelop.Core.LoggingService.LogError ("Could not install app event handlers", ex); setupFail = true; } }
private void CreateAbout() { this.about_image = NSImage.ImageNamed ("about"); this.about_image.Size = new SizeF (720, 260); this.about_image_view = new NSImageView () { Image = this.about_image, Frame = new RectangleF (0, 0, 720, 260) }; this.version_text_field = new SparkleLabel ("version " + Controller.RunningVersion, NSTextAlignment.Left) { DrawsBackground = false, Frame = new RectangleF (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), TextColor = NSColor.FromCalibratedRgba (1.0f, 1.0f, 1.0f, 0.5f) }; this.credits_text_field = new SparkleLabel ( @"Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others" + "\n\n" + "SparkleShare is Open Source. You are free to use, modify, and redistribute it " + "under the GNU GPLv3", NSTextAlignment.Left) { DrawsBackground = false, Frame = new RectangleF (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.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.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.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.Size); ContentView.AddSubview (this.about_image_view); ContentView.AddSubview (this.version_text_field); ContentView.AddSubview (this.updates_text_field); ContentView.AddSubview (this.credits_text_field); ContentView.AddSubview (this.website_link); ContentView.AddSubview (this.credits_link); ContentView.AddSubview (this.report_problem_link); ContentView.AddSubview (this.debug_log_link); }
private void CreateAbout() { using (var a = new NSAutoreleasePool()) { string about_image_path = UIHelpers.GetImagePathname("about"); this.about_image = new NSImage(about_image_path) { Size = new SizeF(640, 260) }; this.about_image_view = new NSImageView() { Image = this.about_image, Frame = new RectangleF(0, 0, 640, 260) }; this.version_text_field = new NSTextField() { StringValue = string.Format(Properties_Resources.Version, Controller.RunningVersion, Controller.CreateTime.GetValueOrDefault().ToString("d")), Frame = new RectangleF(295, 140, 318, 22), BackgroundColor = NSColor.White, Bordered = false, Editable = false, DrawsBackground = false, TextColor = NSColor.FromCalibratedRgba(0.45f, 0.62f, 0.81f, 1.0f), Font = NSFontManager.SharedFontManager.FontWithFamily("Lucida Grande", NSFontTraitMask.Unbold, 0, 11) }; this.credits_text_field = new NSTextField() { StringValue = @"Copyright © 2013-" + DateTime.Now.Year + " GRAU DATA AG, Hylke Bons and others." + "\n" + "\n" + "DataSpace Sync is Open Source software. You are free to use, modify, and redistribute it " + "under the GNU General Public License version 3 or later.", Frame = new RectangleF(295, Frame.Height - 260, 318, 98), TextColor = NSColor.FromCalibratedRgba(0.45f, 0.62f, 0.81f, 1.0f), DrawsBackground = false, Bordered = false, Editable = false, Font = NSFontManager.SharedFontManager.FontWithFamily("Lucida Grande", NSFontTraitMask.Unbold, 0, 11), }; ContentView.AddSubview(this.about_image_view); ContentView.AddSubview(this.version_text_field); ContentView.AddSubview(this.credits_text_field); } }
public void ShowPage (PageType type, string [] warnings) { if (type == PageType.Setup) { Header = "Welcome to 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); FullNameTextField = new NSTextField () { Frame = new RectangleF (330, Frame.Height - 238, 196, 22), StringValue = UnixUserInfo.GetRealUser ().RealName, Delegate = new SparkleTextFieldDelegate () }; EmailLabel = new SparkleLabel ("Email:", NSTextAlignment.Right); EmailLabel.Frame = new RectangleF (165, Frame.Height - 264, 160, 17); EmailTextField = new NSTextField () { Frame = new RectangleF (330, Frame.Height - 268, 196, 22), Delegate = new SparkleTextFieldDelegate () }; CancelButton = new NSButton () { Title = "Cancel" }; ContinueButton = new NSButton () { Title = "Continue", Enabled = false }; (FullNameTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckSetupPage (FullNameTextField.StringValue, EmailTextField.StringValue); }; (EmailTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckSetupPage (FullNameTextField.StringValue, EmailTextField.StringValue); }; ContinueButton.Activated += delegate { string full_name = FullNameTextField.StringValue.Trim (); string email = EmailTextField.StringValue.Trim (); Controller.SetupPageCompleted (full_name, email); }; CancelButton.Activated += delegate { Controller.SetupPageCancelled (); }; Controller.UpdateSetupContinueButtonEvent += delegate (bool button_enabled) { SparkleShare.Controller.Invoke (() => { ContinueButton.Enabled = button_enabled; }); }; ContentView.AddSubview (FullNameLabel); ContentView.AddSubview (FullNameTextField); ContentView.AddSubview (EmailLabel); ContentView.AddSubview (EmailTextField); Buttons.Add (ContinueButton); Buttons.Add (CancelButton); Controller.CheckSetupPage (FullNameTextField.StringValue, EmailTextField.StringValue); if (FullNameTextField.StringValue.Equals ("")) MakeFirstResponder ((NSResponder) FullNameTextField); else MakeFirstResponder ((NSResponder) EmailTextField); } if (type == PageType.Invite) { Header = "You’ve received an invite!"; 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.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) }; PathLabel = new SparkleLabel ("Remote Path:", NSTextAlignment.Right); PathLabel.Frame = new RectangleF (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) }; CancelButton = new NSButton () { Title = "Cancel" }; AddButton = new NSButton () { Title = "Add" }; CancelButton.Activated += delegate { Controller.PageCancelled (); }; AddButton.Activated += delegate { Controller.InvitePageCompleted (); }; ContentView.AddSubview (AddressLabel); ContentView.AddSubview (PathLabel); ContentView.AddSubview (AddressTextField); ContentView.AddSubview (PathTextField); Buttons.Add (AddButton); Buttons.Add (CancelButton); } if (type == PageType.Add) { Header = "Where’s your project hosted?"; Description = ""; AddressLabel = new SparkleLabel ("Address:", NSTextAlignment.Left) { Frame = new RectangleF (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), Enabled = (Controller.SelectedPreset.Address == null), Delegate = new SparkleTextFieldDelegate (), StringValue = "" + Controller.PreviousAddress }; AddressTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; PathLabel = new SparkleLabel ("Remote Path:", NSTextAlignment.Left) { Frame = new RectangleF (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), Enabled = (Controller.SelectedPreset.Path == null), Delegate = new SparkleTextFieldDelegate (), StringValue = "" + Controller.PreviousPath }; PathTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; PathHelpLabel = new SparkleLabel (Controller.SelectedPreset.PathExample, NSTextAlignment.Left) { TextColor = NSColor.DisabledControlText, Frame = new RectangleF (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) }; if (TableView == null || TableView.RowCount != Controller.Presets.Count) { TableView = new NSTableView () { Frame = new RectangleF (0, 0, 0, 0), RowHeight = 38, IntercellSpacing = new SizeF (8, 12), HeaderView = null, Delegate = new SparkleTableViewDelegate () }; ScrollView = new NSScrollView () { Frame = new RectangleF (190, Frame.Height - 280, 408, 185), DocumentView = TableView, HasVerticalScroller = true, BorderType = NSBorderType.BezelBorder }; IconColumn = new NSTableColumn () { Width = 36, HeaderToolTip = "Icon", DataCell = new NSImageCell () { ImageAlignment = NSImageAlignment.Right } }; DescriptionColumn = new NSTableColumn () { Width = 350, HeaderToolTip = "Description", Editable = false }; DescriptionColumn.DataCell.Font = NSFontManager.SharedFontManager.FontWithFamily ( UserInterface.FontName, NSFontTraitMask.Condensed, 0, 11); TableView.AddColumn (IconColumn); TableView.AddColumn (DescriptionColumn); // Hi-res display support was added after Snow Leopard if (Environment.OSVersion.Version.Major < 11) DataSource = new SparkleDataSource (1, Controller.Presets); else DataSource = new SparkleDataSource (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); }; } TableView.SelectRow (Controller.SelectedPresetIndex, false); TableView.ScrollRowToVisible (Controller.SelectedPresetIndex); MakeFirstResponder ((NSResponder) TableView); HistoryCheckButton = new NSButton () { Frame = new RectangleF (190, Frame.Height - 400, 300, 18), Title = "Fetch prior revisions" }; if (Controller.FetchPriorHistory) HistoryCheckButton.State = NSCellStateValue.On; HistoryCheckButton.SetButtonType (NSButtonType.Switch); AddButton = new NSButton () { Title = "Add", Enabled = false }; CancelButton = new NSButton () { Title = "Cancel" }; Controller.ChangeAddressFieldEvent += delegate (string text, string example_text, FieldState state) { SparkleShare.Controller.Invoke (() => { AddressTextField.StringValue = text; AddressTextField.Enabled = (state == FieldState.Enabled); AddressHelpLabel.StringValue = example_text; }); }; Controller.ChangePathFieldEvent += delegate (string text, string example_text, FieldState state) { SparkleShare.Controller.Invoke (() => { PathTextField.StringValue = text; PathTextField.Enabled = (state == FieldState.Enabled); PathHelpLabel.StringValue = example_text; }); }; (AddressTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); }; (PathTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); }; HistoryCheckButton.Activated += delegate { Controller.HistoryItemChanged (HistoryCheckButton.State == NSCellStateValue.On); }; AddButton.Activated += delegate { Controller.AddPageCompleted (AddressTextField.StringValue, PathTextField.StringValue); }; CancelButton.Activated += delegate { Controller.PageCancelled (); }; Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) { SparkleShare.Controller.Invoke (() => { AddButton.Enabled = button_enabled; }); }; ContentView.AddSubview (ScrollView); ContentView.AddSubview (AddressLabel); ContentView.AddSubview (AddressTextField); ContentView.AddSubview (AddressHelpLabel); ContentView.AddSubview (PathLabel); ContentView.AddSubview (PathTextField); ContentView.AddSubview (PathHelpLabel); ContentView.AddSubview (HistoryCheckButton); Buttons.Add (AddButton); Buttons.Add (CancelButton); Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow); } if (type == PageType.Syncing) { Header = "Adding project ‘" + Controller.SyncingFolder + "’…"; 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), Style = NSProgressIndicatorStyle.Bar, MinValue = 0.0, MaxValue = 100.0, Indeterminate = false, DoubleValue = Controller.ProgressBarPercentage }; ProgressIndicator.StartAnimation (this); CancelButton = new NSButton () { Title = "Cancel" }; FinishButton = new NSButton () { Title = "Finish", Enabled = false }; ProgressLabel = new SparkleLabel ("Preparing to fetch files…", NSTextAlignment.Right); ProgressLabel.Frame = new RectangleF (Frame.Width - 40 - 250, 185, 250, 25); Controller.UpdateProgressBarEvent += delegate (double percentage, string speed) { SparkleShare.Controller.Invoke (() => { ProgressIndicator.DoubleValue = percentage; ProgressLabel.StringValue = speed; }); }; CancelButton.Activated += delegate { Controller.SyncingCancelled (); }; ContentView.AddSubview (ProgressLabel); ContentView.AddSubview (ProgressIndicator); Buttons.Add (FinishButton); Buttons.Add (CancelButton); } if (type == PageType.Error) { Header = "Oops! Something went wrong…"; Description = "Please check the following:"; // 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); string html = "<style>" + "* {" + " font-family: '" + UserInterface.FontName + "';" + " font-size: 12px; cursor: default;" + "}" + "body {" + " -webkit-user-select: none;" + " margin: 0;" + " padding: 3px;" + "}" + "li {" + " margin-bottom: 16px;" + " margin-left: 0;" + " padding-left: 0;" + " line-height: 20px;" + " word-wrap: break-word;" + "}" + "ul {" + " padding-left: 24px;" + "}" + "</style>" + "<ul>" + " <li><b>" + Controller.PreviousUrl + "</b> is the address we’ve compiled. Does this look alright?</li>" + " <li>Is this computer’s Client ID known by the host?</li>" + "</ul>"; if (warnings.Length > 0) { string warnings_markup = ""; foreach (string warning in warnings) warnings_markup += "<br><b>" + warning + "</b>"; html = html.Replace ("</ul>", "<li>Here’s the raw error message: " + warnings_markup + "</li></ul>"); } web_view.MainFrame.LoadHtmlString (html, new NSUrl ("")); web_view.DrawsBackground = false; CancelButton = new NSButton () { Title = "Cancel" }; TryAgainButton = new NSButton () { Title = "Retry" }; CancelButton.Activated += delegate { Controller.PageCancelled (); }; TryAgainButton.Activated += delegate { Controller.ErrorPageCompleted (); }; ContentView.AddSubview (web_view); Buttons.Add (TryAgainButton); Buttons.Add (CancelButton); } if (type == PageType.StorageSetup) { Header = string.Format ("Storage type for ‘{0}’", Controller.SyncingFolder); Description = "What type of storage would you like to use?"; storage_type_descriptions = new List<NSTextField> (); ButtonCellProto = new NSButtonCell (); 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, ButtonCellProto, SparkleShare.Controller.FetcherAvailableStorageTypes.Count, 1); Matrix.CellSize = new SizeF (256, 36); Matrix.IntercellSpacing = new SizeF (32, 32); int i = 0; foreach (StorageTypeInfo storage_type in SparkleShare.Controller.FetcherAvailableStorageTypes) { Matrix.Cells [i].Title = " " + storage_type.Name; 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) }; storage_type_descriptions.Add (storage_type_description); ContentView.AddSubview (storage_type_description); i++; } ContentView.AddSubview (Matrix); CancelButton = new NSButton () { Title = "Cancel" }; ContinueButton = new NSButton () { Title = "Continue" }; ContinueButton.Activated += delegate { StorageTypeInfo selected_storage_type = SparkleShare.Controller.FetcherAvailableStorageTypes [Matrix.SelectedRow]; Controller.StoragePageCompleted (selected_storage_type.Type); }; CancelButton.Activated += delegate { Controller.SyncingCancelled (); }; Buttons.Add (ContinueButton); Buttons.Add (CancelButton); NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.CriticalRequest); } if (type == PageType.CryptoSetup || type == PageType.CryptoPassword) { if (type == PageType.CryptoSetup) { Header = "Set up file encryption"; Description = "Please a provide a strong password that you don’t use elsewhere."; } else { Header = "This project contains encrypted files"; Description = "Please enter the password to see their contents."; } int extra_pos_y = 0; if (type == PageType.CryptoPassword) extra_pos_y = 20; PasswordLabel = new SparkleLabel ("Password:"******" Bold", NSFont.SystemFontSize) }; PasswordTextField = new NSSecureTextField () { Frame = new RectangleF (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), Delegate = new SparkleTextFieldDelegate () }; ShowPasswordCheckButton = new NSButton () { Frame = new RectangleF (318, Frame.Height - 235 - extra_pos_y, 300, 18), Title = "Show password", State = NSCellStateValue.Off }; ShowPasswordCheckButton.SetButtonType (NSButtonType.Switch); WarningImage = NSImage.ImageNamed ("NSInfo"); WarningImage.Size = new SizeF (24, 24); WarningImageView = new NSImageView () { Image = WarningImage, Frame = new RectangleF (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), }; CancelButton = new NSButton () { Title = "Cancel" }; ContinueButton = new NSButton () { Title = "Continue", Enabled = false }; Controller.UpdateCryptoPasswordContinueButtonEvent += delegate (bool button_enabled) { SparkleShare.Controller.Invoke (() => { ContinueButton.Enabled = button_enabled; }); }; Controller.UpdateCryptoSetupContinueButtonEvent += delegate (bool button_enabled) { SparkleShare.Controller.Invoke (() => { ContinueButton.Enabled = button_enabled; }); }; ShowPasswordCheckButton.Activated += delegate { if (PasswordTextField.Superview == ContentView) { PasswordTextField.RemoveFromSuperview (); ContentView.AddSubview (VisiblePasswordTextField); } else { VisiblePasswordTextField.RemoveFromSuperview (); ContentView.AddSubview (PasswordTextField); } }; (PasswordTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { VisiblePasswordTextField.StringValue = PasswordTextField.StringValue; if (type == PageType.CryptoSetup) Controller.CheckCryptoSetupPage (PasswordTextField.StringValue); else Controller.CheckCryptoPasswordPage (PasswordTextField.StringValue); }; (VisiblePasswordTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { PasswordTextField.StringValue = VisiblePasswordTextField.StringValue; if (type == PageType.CryptoSetup) Controller.CheckCryptoSetupPage (PasswordTextField.StringValue); else Controller.CheckCryptoPasswordPage (PasswordTextField.StringValue); }; ContinueButton.Activated += delegate { if (type == PageType.CryptoSetup) Controller.CryptoSetupPageCompleted (PasswordTextField.StringValue); else Controller.CryptoPasswordPageCompleted (PasswordTextField.StringValue); }; CancelButton.Activated += delegate { Controller.CryptoPageCancelled (); }; ContentView.AddSubview (PasswordLabel); ContentView.AddSubview (PasswordTextField); ContentView.AddSubview (ShowPasswordCheckButton); if (type == PageType.CryptoSetup) { ContentView.AddSubview (WarningImageView); ContentView.AddSubview (WarningTextField); } Buttons.Add (ContinueButton); Buttons.Add (CancelButton); MakeFirstResponder ((NSResponder) PasswordTextField); NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.CriticalRequest); } if (type == PageType.Finished) { Header = "Your shared project is ready!"; Description = "You can find the files in your SparkleShare folder."; if (warnings.Length > 0) { WarningImage = NSImage.ImageNamed ("NSInfo"); WarningImage.Size = new SizeF (24, 24); WarningImageView = new NSImageView () { Image = WarningImage, Frame = new RectangleF (200, Frame.Height - 175, 24, 24) }; WarningTextField = new SparkleLabel (warnings [0], NSTextAlignment.Left); WarningTextField.Frame = new RectangleF (235, Frame.Height - 245, 325, 100); ContentView.AddSubview (WarningImageView); ContentView.AddSubview (WarningTextField); } ShowFilesButton = new NSButton () { Title = "Show Files" }; FinishButton = new NSButton () { Title = "Finish" }; ShowFilesButton.Activated += delegate { Controller.ShowFilesClicked (); }; FinishButton.Activated += delegate { Controller.FinishPageCompleted (); }; Buttons.Add (FinishButton); Buttons.Add (ShowFilesButton); NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.CriticalRequest); } }
public SparkleSetup() : base() { Controller.HideWindowEvent += delegate { InvokeOnMainThread (delegate { PerformClose (this); }); }; Controller.ShowWindowEvent += delegate { InvokeOnMainThread (delegate { OrderFrontRegardless (); }); }; Controller.ChangePageEvent += delegate (PageType type, string [] warnings) { using (var a = new NSAutoreleasePool ()) { InvokeOnMainThread (delegate { Reset (); switch (type) { case PageType.Setup: { Header = "Welcome to SparkleShare!"; Description = "Before we get started, what's your name and email?\n" + "Don't worry, this information will only visible to any team members."; FullNameLabel = new NSTextField () { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (165, Frame.Height - 234, 160, 17), StringValue = "Full Name:", Font = SparkleUI.Font }; FullNameTextField = new NSTextField () { Frame = new RectangleF (330, Frame.Height - 238, 196, 22), StringValue = Controller.GuessedUserName, Delegate = new SparkleTextFieldDelegate () }; EmailLabel = new NSTextField () { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (165, Frame.Height - 264, 160, 17), StringValue = "Email:", Font = SparkleUI.Font }; EmailTextField = new NSTextField () { Frame = new RectangleF (330, Frame.Height - 268, 196, 22), StringValue = Controller.GuessedUserEmail, Delegate = new SparkleTextFieldDelegate () }; (FullNameTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckSetupPage ( FullNameTextField.StringValue, EmailTextField.StringValue ); }; (EmailTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckSetupPage ( FullNameTextField.StringValue, EmailTextField.StringValue ); }; ContinueButton = new NSButton () { Title = "Continue", Enabled = false }; ContinueButton.Activated += delegate { string full_name = FullNameTextField.StringValue.Trim (); string email = EmailTextField.StringValue.Trim (); Controller.SetupPageCompleted (full_name, email); }; CancelButton = new NSButton () { Title = "Cancel" }; CancelButton.Activated += delegate { Controller.SetupPageCancelled (); }; Controller.UpdateSetupContinueButtonEvent += delegate (bool button_enabled) { InvokeOnMainThread (delegate { ContinueButton.Enabled = button_enabled; }); }; ContentView.AddSubview (FullNameLabel); ContentView.AddSubview (FullNameTextField); ContentView.AddSubview (EmailLabel); ContentView.AddSubview (EmailTextField); Buttons.Add (ContinueButton); Buttons.Add (CancelButton); Controller.CheckSetupPage ( FullNameTextField.StringValue, EmailTextField.StringValue ); break; } case PageType.Invite: { Header = "You've received an invite!"; Description = "Do you want to add this project to SparkleShare?"; AddressLabel = new NSTextField () { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (165, Frame.Height - 240, 160, 17), StringValue = "Address:", Font = SparkleUI.Font }; PathLabel = new NSTextField () { Alignment = NSTextAlignment.Right, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (165, Frame.Height - 264, 160, 17), StringValue = "Remote Path:", Font = SparkleUI.Font }; AddressTextField = new NSTextField () { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (330, Frame.Height - 240, 260, 17), StringValue = Controller.PendingInvite.Address, Font = SparkleUI.BoldFont }; PathTextField = new NSTextField () { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (330, Frame.Height - 264, 260, 17), StringValue = Controller.PendingInvite.RemotePath, Font = SparkleUI.BoldFont }; ContentView.AddSubview (AddressLabel); ContentView.AddSubview (PathLabel); ContentView.AddSubview (AddressTextField); ContentView.AddSubview (PathTextField); CancelButton = new NSButton () { Title = "Cancel" }; CancelButton.Activated += delegate { Controller.PageCancelled (); }; AddButton = new NSButton () { Title = "Add" }; AddButton.Activated += delegate { Controller.InvitePageCompleted (); }; Buttons.Add (AddButton); Buttons.Add (CancelButton); break; } case PageType.Add: { Header = "Where's your project hosted?"; Description = ""; AddressLabel = new NSTextField () { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (190, Frame.Height - 308, 160, 17), StringValue = "Address:", Font = SparkleUI.BoldFont }; AddressTextField = new NSTextField () { Frame = new RectangleF (190, Frame.Height - 336, 196, 22), Font = SparkleUI.Font, Enabled = (Controller.SelectedPlugin.Address == null), Delegate = new SparkleTextFieldDelegate () }; if (Controller.PreviousAddress != null) AddressTextField.StringValue = Controller.PreviousAddress; PathLabel = new NSTextField () { Alignment = NSTextAlignment.Left, BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Frame = new RectangleF (190 + 196 + 16, Frame.Height - 308, 160, 17), StringValue = "Remote Path:", Font = SparkleUI.BoldFont }; PathTextField = new NSTextField () { Frame = new RectangleF (190 + 196 + 16, Frame.Height - 336, 196, 22), Enabled = (Controller.SelectedPlugin.Path == null), Delegate = new SparkleTextFieldDelegate () }; if (Controller.PreviousPath != null) PathTextField.StringValue = Controller.PreviousPath; AddressTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; PathTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail; PathHelpLabel = new NSTextField () { BackgroundColor = NSColor.WindowBackground, Bordered = false, TextColor = NSColor.DisabledControlText, Editable = false, Frame = new RectangleF (190 + 196 + 16, Frame.Height - 355, 204, 17), Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 11) }; if (Controller.SelectedPlugin.PathExample != null) PathHelpLabel.StringValue = Controller.SelectedPlugin.PathExample; AddressHelpLabel = new NSTextField () { BackgroundColor = NSColor.WindowBackground, Bordered = false, TextColor = NSColor.DisabledControlText, Editable = false, Frame = new RectangleF (190, Frame.Height - 355, 204, 17), Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 11) }; if (Controller.SelectedPlugin.AddressExample != null) AddressHelpLabel.StringValue = Controller.SelectedPlugin.AddressExample; TableView = new NSTableView () { Frame = new RectangleF (0, 0, 0, 0), RowHeight = 34, IntercellSpacing = new SizeF (8, 12), HeaderView = null, Delegate = new SparkleTableViewDelegate () }; ScrollView = new NSScrollView () { Frame = new RectangleF (190, Frame.Height - 280, 408, 175), DocumentView = TableView, HasVerticalScroller = true, BorderType = NSBorderType.BezelBorder }; IconColumn = new NSTableColumn (new NSImage ()) { Width = 36, HeaderToolTip = "Icon", DataCell = new NSImageCell () { ImageAlignment = NSImageAlignment.Right } }; DescriptionColumn = new NSTableColumn () { Width = 350, HeaderToolTip = "Description", Editable = false }; DescriptionColumn.DataCell.Font = NSFontManager.SharedFontManager.FontWithFamily ( "Lucida Grande", NSFontTraitMask.Condensed, 0, 11); TableView.AddColumn (IconColumn); TableView.AddColumn (DescriptionColumn); DataSource = new SparkleDataSource (Controller.Plugins); TableView.DataSource = DataSource; TableView.ReloadData (); HistoryCheckButton = new NSButton () { Frame = new RectangleF (190, Frame.Height - 400, 300, 18), Title = "Fetch prior revisions" }; if (Controller.FetchPriorHistory) HistoryCheckButton.State = NSCellStateValue.On; HistoryCheckButton.SetButtonType (NSButtonType.Switch); HistoryCheckButton.Activated += delegate { Controller.HistoryItemChanged (HistoryCheckButton.State == NSCellStateValue.On); }; ContentView.AddSubview (HistoryCheckButton); Controller.ChangeAddressFieldEvent += delegate (string text, string example_text, FieldState state) { InvokeOnMainThread (delegate { AddressTextField.StringValue = text; AddressTextField.Enabled = (state == FieldState.Enabled); AddressHelpLabel.StringValue = example_text; }); }; Controller.ChangePathFieldEvent += delegate (string text, string example_text, FieldState state) { InvokeOnMainThread (delegate { PathTextField.StringValue = text; PathTextField.Enabled = (state == FieldState.Enabled); PathHelpLabel.StringValue = example_text; }); }; TableView.SelectRow (Controller.SelectedPluginIndex, false); (AddressTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckAddPage ( AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow ); }; (PathTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate { Controller.CheckAddPage ( AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow ); }; (TableView.Delegate as SparkleTableViewDelegate).SelectionChanged += delegate { Controller.SelectedPluginChanged (TableView.SelectedRow); Controller.CheckAddPage ( AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow ); }; Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) { InvokeOnMainThread (delegate { AddButton.Enabled = button_enabled; }); }; ContentView.AddSubview (ScrollView); ContentView.AddSubview (AddressLabel); ContentView.AddSubview (AddressTextField); ContentView.AddSubview (AddressHelpLabel); ContentView.AddSubview (PathLabel); ContentView.AddSubview (PathTextField); ContentView.AddSubview (PathHelpLabel); AddButton = new NSButton () { Title = "Add", Enabled = false }; AddButton.Activated += delegate { Controller.AddPageCompleted ( AddressTextField.StringValue, PathTextField.StringValue ); }; Buttons.Add (AddButton); CancelButton = new NSButton () { Title = "Cancel" }; CancelButton.Activated += delegate { Controller.PageCancelled (); }; Buttons.Add (CancelButton); Controller.CheckAddPage ( AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow ); break; } case PageType.Syncing: { Header = "Adding project ‘" + Controller.SyncingFolder + "’…"; Description = "This may take a while.\n" + "Are you sure it’s not coffee o'clock?"; ProgressIndicator = new NSProgressIndicator () { Frame = new RectangleF (190, Frame.Height - 200, 640 - 150 - 80, 20), Style = NSProgressIndicatorStyle.Bar, MinValue = 0.0, MaxValue = 100.0, Indeterminate = false, DoubleValue = 1.0 }; ProgressIndicator.StartAnimation (this); Controller.UpdateProgressBarEvent += delegate (double percentage) { InvokeOnMainThread (delegate { ProgressIndicator.DoubleValue = percentage; }); }; ContentView.AddSubview (ProgressIndicator); FinishButton = new NSButton () { Title = "Finish", Enabled = false }; CancelButton = new NSButton () { Title = "Cancel" }; CancelButton.Activated += delegate { Controller.SyncingCancelled (); }; Buttons.Add (FinishButton); Buttons.Add (CancelButton); break; } case PageType.Error: { Header = "Something went wrong…"; Description = "Please check the following:"; // 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); string html = "<style>" + "* {" + " font-family: 'Lucida Grande';" + " font-size: 12px; cursor: default;" + "}" + "body {" + " -webkit-user-select: none;" + " margin: 0;" + " padding: 3px;" + "}" + "li {" + " margin-bottom: 16px;" + " margin-left: 0;" + " padding-left: 0;" + " line-height: 20px;" + "}" + "ul {" + " padding-left: 24px;" + "}" + "</style>" + "<ul>" + " <li>Is the host online?</li>" + " <li><b>" + Controller.PreviousUrl + "</b> is the address we've compiled. Does this look alright?</li>" + " <li>The host needs to know who you are. Did you upload the key that's in your SparkleShare folder?</li>" + "</ul>"; web_view.MainFrame.LoadHtmlString (html, new NSUrl ("")); web_view.DrawsBackground = false; ContentView.AddSubview (web_view); TryAgainButton = new NSButton () { Title = "Try again…" }; TryAgainButton.Activated += delegate { Controller.ErrorPageCompleted (); }; CancelButton = new NSButton () { Title = "Cancel" }; CancelButton.Activated += delegate { Controller.PageCancelled (); }; Buttons.Add (TryAgainButton); Buttons.Add (CancelButton); break; } case PageType.Finished: { Header = "Your shared project is ready!"; Description = "You can find it in your SparkleShare folder"; if (warnings.Length > 0) { WarningImage = NSImage.ImageNamed ("NSInfo"); WarningImage.Size = new SizeF (24, 24); WarningImageView = new NSImageView () { Image = WarningImage, Frame = new RectangleF (190, Frame.Height - 175, 24, 24) }; WarningTextField = new NSTextField () { Frame = new RectangleF (225, Frame.Height - 245, 325, 100), StringValue = warnings [0], BackgroundColor = NSColor.WindowBackground, Bordered = false, Editable = false, Font = SparkleUI.Font }; ContentView.AddSubview (WarningImageView); ContentView.AddSubview (WarningTextField); } FinishButton = new NSButton () { Title = "Finish" }; FinishButton.Activated += delegate { Controller.FinishPageCompleted (); }; OpenFolderButton = new NSButton () { Title = string.Format ("Open {0}", Path.GetFileName (Controller.PreviousPath)) }; OpenFolderButton.Activated += delegate { Controller.OpenFolderClicked (); }; Buttons.Add (FinishButton); Buttons.Add (OpenFolderButton); NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.CriticalRequest); NSSound.FromName ("Glass").Play (); break; } case PageType.Tutorial: { switch (Controller.TutorialPageNumber) { case 1: { Header = "What's happening next?"; Description = "SparkleShare creates a special folder on your computer " + "that will keep track of your projects."; SkipTutorialButton = new NSButton () { Title = "Skip Tutorial" }; SkipTutorialButton.Activated += delegate { Controller.TutorialSkipped (); }; ContinueButton = new NSButton () { Title = "Continue" }; ContinueButton.Activated += delegate { Controller.TutorialPageCompleted (); }; string slide_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "tutorial-slide-1-mac.png"); SlideImage = new NSImage (slide_image_path) { Size = new SizeF (350, 200) }; SlideImageView = new NSImageView () { Image = SlideImage, Frame = new RectangleF (215, Frame.Height - 350, 350, 200) }; ContentView.AddSubview (SlideImageView); Buttons.Add (ContinueButton); Buttons.Add (SkipTutorialButton); break; } case 2: { Header = "Sharing files with others"; Description = "All files added to your project folders are synced automatically with " + "the host and your team members."; ContinueButton = new NSButton () { Title = "Continue" }; ContinueButton.Activated += delegate { Controller.TutorialPageCompleted (); }; string slide_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "tutorial-slide-2-mac.png"); SlideImage = new NSImage (slide_image_path) { Size = new SizeF (350, 200) }; SlideImageView = new NSImageView () { Image = SlideImage, Frame = new RectangleF (215, Frame.Height - 350, 350, 200) }; ContentView.AddSubview (SlideImageView); Buttons.Add (ContinueButton); break; } case 3: { Header = "The status icon is here to help"; Description = "It shows the syncing progress, provides easy access to " + "your projects and let's you view recent changes."; ContinueButton = new NSButton () { Title = "Continue" }; ContinueButton.Activated += delegate { Controller.TutorialPageCompleted (); }; string slide_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "tutorial-slide-3-mac.png"); SlideImage = new NSImage (slide_image_path) { Size = new SizeF (350, 200) }; SlideImageView = new NSImageView () { Image = SlideImage, Frame = new RectangleF (215, Frame.Height - 350, 350, 200) }; ContentView.AddSubview (SlideImageView); Buttons.Add (ContinueButton); break; } case 4: { Header = "Adding projects to SparkleShare"; Description = "You can do this through the status icon menu, or by clicking " + "magic buttons on webpages that look like this:"; StartupCheckButton = new NSButton () { Frame = new RectangleF (190, Frame.Height - 400, 300, 18), Title = "Add SparkleShare to startup items", State = NSCellStateValue.On }; StartupCheckButton.SetButtonType (NSButtonType.Switch); StartupCheckButton.Activated += delegate { Controller.StartupItemChanged (StartupCheckButton.State == NSCellStateValue.On); }; FinishButton = new NSButton () { Title = "Finish" }; FinishButton.Activated += delegate { Controller.TutorialPageCompleted (); }; string slide_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "tutorial-slide-4.png"); SlideImage = new NSImage (slide_image_path) { Size = new SizeF (350, 64) }; SlideImageView = new NSImageView () { Image = SlideImage, Frame = new RectangleF (215, Frame.Height - 215, 350, 64) }; ContentView.AddSubview (SlideImageView); ContentView.AddSubview (StartupCheckButton); Buttons.Add (FinishButton); break; } } break; } } ShowAll (); }); } }; }
void UpdateMapViews() { if (map == null) { return; } for (int row = 0; row < map.Height; row++) { for (int column = 0; column < map.Width; column++) { Map.Map.Position position = new Map.Map.Position { Row = row, Column = column }; CGPoint point = map.PositionToPoint (position); Tile t = map.TileAtPosition (position); var bbox = map.BoundingBoxForTileAtPosition (position); Console.WriteLine ("{0}", point); Console.WriteLine ("bbox: {0}", bbox); NSImageView tileView = new NSImageView (bbox) {Image = t.Image, TranslatesAutoresizingMaskIntoConstraints = false}; AddSubview (tileView, NSWindowOrderingMode.Below, overlay); var constraint = NSLayoutConstraint.Create (this, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, tileView, NSLayoutAttribute.CenterX, 1, -point.X); AddConstraint (constraint); constraint = NSLayoutConstraint.Create (this, NSLayoutAttribute.Top, NSLayoutRelation.Equal, tileView, NSLayoutAttribute.Bottom, 1, -65 + point.Y); AddConstraint (constraint); constraint = NSLayoutConstraint.Create (tileView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, bbox.Width); tileView.AddConstraint (constraint); constraint = NSLayoutConstraint.Create (tileView, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, bbox.Height); tileView.AddConstraint (constraint); } } }
protected override void CreateHandle () { m_helper = new NSImageView(); m_view = m_helper; }
private void CreateAbout() { this.about_image = NSImage.ImageNamed ("about"); this.about_image.Size = new SizeF (640, 260); this.about_image_view = new NSImageView () { Image = this.about_image, Frame = new RectangleF (0, 0, 640, 260) }; this.version_text_field = new PryanetLabel ("version " + Controller.RunningVersion, NSTextAlignment.Left) { DrawsBackground = false, Frame = new RectangleF (295, 140, 318, 22), TextColor = NSColor.White, Font = NSFontManager.SharedFontManager.FontWithFamily ( "Lucida Grande", NSFontTraitMask.Unbold, 0, 11) }; this.updates_text_field = new PryanetLabel ("Checking for updates...", NSTextAlignment.Left) { DrawsBackground = false, Frame = new RectangleF (295, Frame.Height - 232, 318, 98), TextColor = NSColor.FromCalibratedRgba (1.0f, 1.0f, 1.0f, 0.5f), Font = NSFontManager.SharedFontManager.FontWithFamily ( "Lucida Grande", NSFontTraitMask.Unbold, 0, 11) }; this.credits_text_field = new PryanetLabel ( @"SparkleShare Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others.\n" + "PryanetShare Copyright © 2013–" + DateTime.Now.Year + " Pryanet Ltd." + "\n" + "\n" + "PryanetShare is Open Source software. You are free to use, modify, and redistribute it " + "under the GNU General Public License version 3 or later.", NSTextAlignment.Left) { DrawsBackground = false, Frame = new RectangleF (295, Frame.Height - 260, 318, 98), TextColor = NSColor.White, Font = NSFontManager.SharedFontManager.FontWithFamily ( "Lucida Grande", NSFontTraitMask.Unbold, 0, 11), }; this.website_link = new PryanetLink ("Website", Controller.WebsiteLinkAddress); this.website_link.Frame = new RectangleF (new PointF (295, 25), this.website_link.Frame.Size); this.credits_link = new PryanetLink ("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.Size); this.report_problem_link = new PryanetLink ("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.Size); this.debug_log_link = new PryanetLink ("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.Size); ContentView.AddSubview (this.about_image_view); ContentView.AddSubview (this.version_text_field); ContentView.AddSubview (this.updates_text_field); ContentView.AddSubview (this.credits_text_field); ContentView.AddSubview (this.website_link); ContentView.AddSubview (this.credits_link); ContentView.AddSubview (this.report_problem_link); ContentView.AddSubview (this.debug_log_link); }