From 1038b8d892915af6bd85594998144f9df4d24b84 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 30 Apr 2016 18:07:36 -0400 Subject: [PATCH] Compile fixes. Oh boy... --- darwin/autolayout.m | 12 ++++++------ darwin/box.m | 10 +++++----- darwin/multilineentry.m | 2 +- darwin/spinbox.m | 6 ++---- darwin/uipriv_darwin.h | 2 +- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/darwin/autolayout.m b/darwin/autolayout.m index 80095fda..64f2be93 100644 --- a/darwin/autolayout.m +++ b/darwin/autolayout.m @@ -3,9 +3,9 @@ NSLayoutConstraint *mkConstraint(id view1, NSLayoutAttribute attr1, NSLayoutRelation relation, id view2, NSLayoutAttribute attr2, CGFloat multiplier, CGFloat c, NSString *desc) { - NSLayoutConstraint *c; + NSLayoutConstraint *constraint; - c = [NSLayoutConstraint constraintWithItem:view1 + constraint = [NSLayoutConstraint constraintWithItem:view1 attribute:attr1 relatedBy:relation toItem:view2 @@ -13,9 +13,9 @@ NSLayoutConstraint *mkConstraint(id view1, NSLayoutAttribute attr1, NSLayoutRela multiplier:multiplier constant:c]; // apparently only added in 10.9 - if ([c respondsToSelector:@selector(setIdentifier:)]) - [((id) c) setIdentifier:desc]; - return c; + if ([constraint respondsToSelector:@selector(setIdentifier:)]) + [((id) constraint) setIdentifier:desc]; + return constraint; } void setHuggingPri(NSView *view, NSLayoutPriority priority, NSLayoutConstraintOrientation orientation) @@ -85,7 +85,7 @@ void layoutSingleView(NSView *superview, NSView *subview, int margined, NSString } // via https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithScrollViews.html#//apple_ref/doc/uid/TP40010853-CH24-SW1 -NSMutableArray *layoutScrollViewContents(NSScrollView *sv, BOOL noHScroll, BOOL noVScroll NSString *desc) +NSMutableArray *layoutScrollViewContents(NSScrollView *sv, BOOL noHScroll, BOOL noVScroll, NSString *desc) { NSView *dv; NSLayoutConstraint *constraint; diff --git a/darwin/box.m b/darwin/box.m index 86541b9d..5ef801a0 100644 --- a/darwin/box.m +++ b/darwin/box.m @@ -121,14 +121,14 @@ static void addRemoveNoStretchyView(uiBox *b, BOOL hasStretchy) // TODO try unsetting spinbox intrinsics and seeing what happens static void relayout(uiBox *b) { - NSLayoutConstraint *constraint; uintmax_t i, n; BOOL hasStretchy; NSView *firstStretchy = nil; CGFloat padding; NSView *prev, *next; - if ([b->children count] == 0) + n = [b->children count]; + if (n == 0) return; padding = 0; if (b->padded) @@ -168,7 +168,7 @@ static void relayout(uiBox *b) // if there is a stretchy control, add the no-stretchy view addRemoveNoStretchyView(b, hasStretchy); - if (hasStretchy) + if (hasStretchy) { [b->view addConstraint:mkConstraint(b->noStretchyView, b->primaryStart, NSLayoutRelationEqual, prev, b->primaryEnd, @@ -178,11 +178,11 @@ static void relayout(uiBox *b) } // and finally end the primary direction - [b->view addConstraint:mkConstraint(prev, p->primaryEnd, + [b->view addConstraint:mkConstraint(prev, b->primaryEnd, NSLayoutRelationEqual, b->view, b->primaryEnd, 1, 0, - @"uiBox last primary constraint"]; + @"uiBox last primary constraint")]; // next: assemble the views in the secondary direction // each of them will span the secondary direction diff --git a/darwin/multilineentry.m b/darwin/multilineentry.m index ecdfcd68..a6fa48f3 100644 --- a/darwin/multilineentry.m +++ b/darwin/multilineentry.m @@ -123,7 +123,7 @@ uiMultilineEntry *uiNewMultilineEntry(void) [e->sv setDocumentView:e->tv]; [e->tv setTranslatesAutoresizingMaskIntoConstraints:NO]; // we don't need to save the NSMutableArray - [layoutScrollViewContents(e->sv, @"uiMultilineEntry") release]; + [layoutScrollViewContents(e->sv, YES, NO, @"uiMultilineEntry") release]; //TODO:void printinfo(NSScrollView *sv, NSTextView *tv); //printinfo(e->sv, e->tv); diff --git a/darwin/spinbox.m b/darwin/spinbox.m index b47b888f..d2be6d89 100644 --- a/darwin/spinbox.m +++ b/darwin/spinbox.m @@ -33,8 +33,6 @@ struct uiSpinbox { - (id)initWithFrame:(NSRect)r spinbox:(uiSpinbox *)sb { - NSDictionary *views; - self = [super initWithFrame:r]; if (self) { self->tf = newEditableTextField(); @@ -91,9 +89,9 @@ struct uiSpinbox { self, NSLayoutAttributeBottom, 1, 0, @"uiSpinbox bottom edge stepper")]; - [self addConstraint:mkConstraint(self->stepper, NSLayoutAttributeTrailingEdge, + [self addConstraint:mkConstraint(self->stepper, NSLayoutAttributeTrailing, NSLayoutRelationEqual, - self->stepper, NSLayoutAttributeLeadingEdge, + self->stepper, NSLayoutAttributeLeading, 1, -3, // TODO @"uiSpinbox space between text field and stepper")]; diff --git a/darwin/uipriv_darwin.h b/darwin/uipriv_darwin.h index 1fed99e0..32b96381 100644 --- a/darwin/uipriv_darwin.h +++ b/darwin/uipriv_darwin.h @@ -64,7 +64,7 @@ extern void setHorzHuggingPri(NSView *view, NSLayoutPriority priority); extern NSLayoutPriority vertHuggingPri(NSView *view); extern void setVertHuggingPri(NSView *view, NSLayoutPriority priority); extern void layoutSingleView(NSView *superview, NSView *subview, int margined, NSString *desc); -extern NSMutableArray *layoutScrollViewContents(NSScrollView *sv, BOOL noHScroll, BOOL noVScroll NSString *desc); +extern NSMutableArray *layoutScrollViewContents(NSScrollView *sv, BOOL noHScroll, BOOL noVScroll, NSString *desc); // map.m extern struct mapTable *newMap(void);