From 699839dc0e214457e7fd5e74f550ce372f94b7c1 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Fri, 6 Jan 2017 14:29:20 -0600 Subject: [PATCH] Replace tabs with spaces to fit coding standard --- csharp/Mac/ApiDefinition.cs | 8 +- csharp/Mac/CustomBuildAction.targets | 14 +- .../Mac/Facebook.Yoga.Mac.Test/AppDelegate.cs | 28 +-- csharp/Mac/Facebook.Yoga.Mac.Test/Main.cs | 16 +- .../Facebook.Yoga.Mac.Test/ViewController.cs | 184 +++++++++--------- 5 files changed, 125 insertions(+), 125 deletions(-) diff --git a/csharp/Mac/ApiDefinition.cs b/csharp/Mac/ApiDefinition.cs index 584caa75..3919f76f 100644 --- a/csharp/Mac/ApiDefinition.cs +++ b/csharp/Mac/ApiDefinition.cs @@ -7,8 +7,8 @@ using CoreGraphics; namespace Facebook.Yoga.Mac { - // Xamarin.Mac binding projects allow you to include native libraries inside C# DLLs for easy consumption - // later. However, the binding project build files currently assume you are binding some objective-c API - // and that you need an ApiDefinition.cs for that. yoga is all C APIs, so just include this "blank" file so - // the dylib gets packaged + // Xamarin.Mac binding projects allow you to include native libraries inside C# DLLs for easy consumption + // later. However, the binding project build files currently assume you are binding some objective-c API + // and that you need an ApiDefinition.cs for that. yoga is all C APIs, so just include this "blank" file so + // the dylib gets packaged } diff --git a/csharp/Mac/CustomBuildAction.targets b/csharp/Mac/CustomBuildAction.targets index 53f9c849..e20e70b8 100644 --- a/csharp/Mac/CustomBuildAction.targets +++ b/csharp/Mac/CustomBuildAction.targets @@ -1,11 +1,11 @@ - - CopyInNativeLib;$(CompileDependsOn) - + + CopyInNativeLib;$(CompileDependsOn) + - - - - + + + + diff --git a/csharp/Mac/Facebook.Yoga.Mac.Test/AppDelegate.cs b/csharp/Mac/Facebook.Yoga.Mac.Test/AppDelegate.cs index a0d8df6e..391f80a7 100644 --- a/csharp/Mac/Facebook.Yoga.Mac.Test/AppDelegate.cs +++ b/csharp/Mac/Facebook.Yoga.Mac.Test/AppDelegate.cs @@ -3,20 +3,20 @@ using Foundation; namespace Facebook.Yoga.Mac.Test { - [Register("AppDelegate")] - public class AppDelegate : NSApplicationDelegate - { - public AppDelegate() - { - } + [Register("AppDelegate")] + public class AppDelegate : NSApplicationDelegate + { + public AppDelegate() + { + } - public override void DidFinishLaunching(NSNotification notification) - { - } + public override void DidFinishLaunching(NSNotification notification) + { + } - public override void WillTerminate(NSNotification notification) - { - // Insert code here to tear down your application - } - } + public override void WillTerminate(NSNotification notification) + { + // Insert code here to tear down your application + } + } } diff --git a/csharp/Mac/Facebook.Yoga.Mac.Test/Main.cs b/csharp/Mac/Facebook.Yoga.Mac.Test/Main.cs index e25f1106..78081058 100644 --- a/csharp/Mac/Facebook.Yoga.Mac.Test/Main.cs +++ b/csharp/Mac/Facebook.Yoga.Mac.Test/Main.cs @@ -2,12 +2,12 @@ namespace Facebook.Yoga.Mac.Test { - static class MainClass - { - static void Main(string[] args) - { - NSApplication.Init(); - NSApplication.Main(args); - } - } + static class MainClass + { + static void Main(string[] args) + { + NSApplication.Init(); + NSApplication.Main(args); + } + } } diff --git a/csharp/Mac/Facebook.Yoga.Mac.Test/ViewController.cs b/csharp/Mac/Facebook.Yoga.Mac.Test/ViewController.cs index 44b1e283..3de4735f 100644 --- a/csharp/Mac/Facebook.Yoga.Mac.Test/ViewController.cs +++ b/csharp/Mac/Facebook.Yoga.Mac.Test/ViewController.cs @@ -7,123 +7,123 @@ using CoreGraphics; namespace Facebook.Yoga.Mac.Test { - public static class NSViewYogaExtensions - { - public static void ApplyYogaLayout (this NSView view, YogaNode n, bool root = true) - { + public static class NSViewYogaExtensions + { + public static void ApplyYogaLayout (this NSView view, YogaNode n, bool root = true) + { #if DEBUG_LAYOUT - Console.WriteLine ($"ApplyYogaLayout {view.ToolTip}, {n.LayoutX}, {n.LayoutY}, {n.LayoutWidth}, {n.LayoutHeight}"); + Console.WriteLine ($"ApplyYogaLayout {view.ToolTip}, {n.LayoutX}, {n.LayoutY}, {n.LayoutWidth}, {n.LayoutHeight}"); #endif - // A bit of gross special casing - // This really should mostly go away if/when the UIView+Yoga.m magic gets ported to AppKit - if (root) - view.Frame = new CGRect (n.LayoutX, n.LayoutY, n.LayoutWidth, n.LayoutHeight); + // A bit of gross special casing + // This really should mostly go away if/when the UIView+Yoga.m magic gets ported to AppKit + if (root) + view.Frame = new CGRect (n.LayoutX, n.LayoutY, n.LayoutWidth, n.LayoutHeight); #if DEBUG_LAYOUT - Console.WriteLine ($"Setting {view.ToolTip} frame to {view.Frame}"); + Console.WriteLine ($"Setting {view.ToolTip} frame to {view.Frame}"); #endif - // This assumes your YogaNode and NSView children were inserted in same order - for (int i = 0; i < n.Count; ++i) { - YogaNode childNode = n[i]; - // Cocoa coord space is from bottom left not top left - view.Subviews[i].Frame = new CGRect (childNode.LayoutX, n.LayoutHeight - childNode.LayoutY - childNode.LayoutHeight, childNode.LayoutWidth, childNode.LayoutHeight); + // This assumes your YogaNode and NSView children were inserted in same order + for (int i = 0; i < n.Count; ++i) { + YogaNode childNode = n[i]; + // Cocoa coord space is from bottom left not top left + view.Subviews[i].Frame = new CGRect (childNode.LayoutX, n.LayoutHeight - childNode.LayoutY - childNode.LayoutHeight, childNode.LayoutWidth, childNode.LayoutHeight); #if DEBUG_LAYOUT - Console.WriteLine ($"Setting {view.Subviews[i].ToolTip} frame to {view.Subviews[i].Frame}"); + Console.WriteLine ($"Setting {view.Subviews[i].ToolTip} frame to {view.Subviews[i].Frame}"); #endif - if (childNode.Count > 0){ + if (childNode.Count > 0){ #if DEBUG_LAYOUT - Console.WriteLine ($"Calling ApplyYogaLayout recursively on {view.Subviews[i].ToolTip}"); + Console.WriteLine ($"Calling ApplyYogaLayout recursively on {view.Subviews[i].ToolTip}"); #endif - ApplyYogaLayout (view.Subviews[i], childNode, false); - } - } - } - } - - public partial class ViewController : NSViewController - { - public ViewController(IntPtr handle) : base(handle) - { - } + ApplyYogaLayout (view.Subviews[i], childNode, false); + } + } + } + } + + public partial class ViewController : NSViewController + { + public ViewController(IntPtr handle) : base(handle) + { + } - public override void ViewDidLoad() - { - base.ViewDidLoad (); + public override void ViewDidLoad() + { + base.ViewDidLoad (); - NSImage image = NSImage.ImageNamed (NSImageName.TrashFull); + NSImage image = NSImage.ImageNamed (NSImageName.TrashFull); - NSView root = CreateViewHierarchy (image); - var rootNode = CalculateLayout (View.Frame, image.Size); + NSView root = CreateViewHierarchy (image); + var rootNode = CalculateLayout (View.Frame, image.Size); - root.ApplyYogaLayout (rootNode); + root.ApplyYogaLayout (rootNode); - View.AddSubview (root); - } + View.AddSubview (root); + } - static NSView CreateViewHierarchy (NSImage image) - { - var root = new NSView () { - WantsLayer = true, - ToolTip = "Root" - }; - root.Layer.BackgroundColor = NSColor.Red.CGColor; + static NSView CreateViewHierarchy (NSImage image) + { + var root = new NSView () { + WantsLayer = true, + ToolTip = "Root" + }; + root.Layer.BackgroundColor = NSColor.Red.CGColor; - NSView child1 = new NSView () { - WantsLayer = true, - ToolTip = "Child 1" - }; - child1.Layer.BackgroundColor = NSColor.Blue.CGColor; + NSView child1 = new NSView () { + WantsLayer = true, + ToolTip = "Child 1" + }; + child1.Layer.BackgroundColor = NSColor.Blue.CGColor; - NSView child2 = new NSView () { - WantsLayer = true, - ToolTip = "Child 2" - }; - child2.Layer.BackgroundColor = NSColor.Green.CGColor; + NSView child2 = new NSView () { + WantsLayer = true, + ToolTip = "Child 2" + }; + child2.Layer.BackgroundColor = NSColor.Green.CGColor; - NSView child3 = new NSView () { - WantsLayer = true, - ToolTip = "Child 3" - }; - child3.Layer.BackgroundColor = NSColor.Yellow.CGColor; + NSView child3 = new NSView () { + WantsLayer = true, + ToolTip = "Child 3" + }; + child3.Layer.BackgroundColor = NSColor.Yellow.CGColor; - root.AddSubview (child1); - root.AddSubview (child2); - child2.AddSubview (child3); + root.AddSubview (child1); + root.AddSubview (child2); + child2.AddSubview (child3); - return root; - } + return root; + } - static YogaNode CalculateLayout (CGRect rootFrame, CGSize imageSize) - { - var rootNode = new YogaNode () { - Width = (float)rootFrame.Width, - Height = (float)rootFrame.Height, - AlignItems = YogaAlign.Center, - JustifyContent = YogaJustify.Center - }; + static YogaNode CalculateLayout (CGRect rootFrame, CGSize imageSize) + { + var rootNode = new YogaNode () { + Width = (float)rootFrame.Width, + Height = (float)rootFrame.Height, + AlignItems = YogaAlign.Center, + JustifyContent = YogaJustify.Center + }; - var child1Node = new YogaNode () { - Width = 100, - Height = 100 - }; + var child1Node = new YogaNode () { + Width = 100, + Height = 100 + }; - var child2Node = new YogaNode () { - Width = 200, - Height = 100 - }; + var child2Node = new YogaNode () { + Width = 200, + Height = 100 + }; - var child3Node = new YogaNode () { - Width = 100, - Height = 100 - }; + var child3Node = new YogaNode () { + Width = 100, + Height = 100 + }; - rootNode.Insert (0, child1Node); - rootNode.Insert (1, child2Node); - child2Node.Insert (0, child3Node); - rootNode.CalculateLayout (); + rootNode.Insert (0, child1Node); + rootNode.Insert (1, child2Node); + child2Node.Insert (0, child3Node); + rootNode.CalculateLayout (); - return rootNode; - } - } + return rootNode; + } + } }