Compile fixes. Oh boy...

This commit is contained in:
Pietro Gagliardi 2016-04-30 18:07:36 -04:00
parent c87a932a6d
commit 1038b8d892
5 changed files with 15 additions and 17 deletions

View File

@ -3,9 +3,9 @@
NSLayoutConstraint *mkConstraint(id view1, NSLayoutAttribute attr1, NSLayoutRelation relation, id view2, NSLayoutAttribute attr2, CGFloat multiplier, CGFloat c, NSString *desc) 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 attribute:attr1
relatedBy:relation relatedBy:relation
toItem:view2 toItem:view2
@ -13,9 +13,9 @@ NSLayoutConstraint *mkConstraint(id view1, NSLayoutAttribute attr1, NSLayoutRela
multiplier:multiplier multiplier:multiplier
constant:c]; constant:c];
// apparently only added in 10.9 // apparently only added in 10.9
if ([c respondsToSelector:@selector(setIdentifier:)]) if ([constraint respondsToSelector:@selector(setIdentifier:)])
[((id) c) setIdentifier:desc]; [((id) constraint) setIdentifier:desc];
return c; return constraint;
} }
void setHuggingPri(NSView *view, NSLayoutPriority priority, NSLayoutConstraintOrientation orientation) 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 // 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; NSView *dv;
NSLayoutConstraint *constraint; NSLayoutConstraint *constraint;

View File

@ -121,14 +121,14 @@ static void addRemoveNoStretchyView(uiBox *b, BOOL hasStretchy)
// TODO try unsetting spinbox intrinsics and seeing what happens // TODO try unsetting spinbox intrinsics and seeing what happens
static void relayout(uiBox *b) static void relayout(uiBox *b)
{ {
NSLayoutConstraint *constraint;
uintmax_t i, n; uintmax_t i, n;
BOOL hasStretchy; BOOL hasStretchy;
NSView *firstStretchy = nil; NSView *firstStretchy = nil;
CGFloat padding; CGFloat padding;
NSView *prev, *next; NSView *prev, *next;
if ([b->children count] == 0) n = [b->children count];
if (n == 0)
return; return;
padding = 0; padding = 0;
if (b->padded) if (b->padded)
@ -168,7 +168,7 @@ static void relayout(uiBox *b)
// if there is a stretchy control, add the no-stretchy view // if there is a stretchy control, add the no-stretchy view
addRemoveNoStretchyView(b, hasStretchy); addRemoveNoStretchyView(b, hasStretchy);
if (hasStretchy) if (hasStretchy) {
[b->view addConstraint:mkConstraint(b->noStretchyView, b->primaryStart, [b->view addConstraint:mkConstraint(b->noStretchyView, b->primaryStart,
NSLayoutRelationEqual, NSLayoutRelationEqual,
prev, b->primaryEnd, prev, b->primaryEnd,
@ -178,11 +178,11 @@ static void relayout(uiBox *b)
} }
// and finally end the primary direction // and finally end the primary direction
[b->view addConstraint:mkConstraint(prev, p->primaryEnd, [b->view addConstraint:mkConstraint(prev, b->primaryEnd,
NSLayoutRelationEqual, NSLayoutRelationEqual,
b->view, b->primaryEnd, b->view, b->primaryEnd,
1, 0, 1, 0,
@"uiBox last primary constraint"]; @"uiBox last primary constraint")];
// next: assemble the views in the secondary direction // next: assemble the views in the secondary direction
// each of them will span the secondary direction // each of them will span the secondary direction

View File

@ -123,7 +123,7 @@ uiMultilineEntry *uiNewMultilineEntry(void)
[e->sv setDocumentView:e->tv]; [e->sv setDocumentView:e->tv];
[e->tv setTranslatesAutoresizingMaskIntoConstraints:NO]; [e->tv setTranslatesAutoresizingMaskIntoConstraints:NO];
// we don't need to save the NSMutableArray // 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); //TODO:void printinfo(NSScrollView *sv, NSTextView *tv);
//printinfo(e->sv, e->tv); //printinfo(e->sv, e->tv);

View File

@ -33,8 +33,6 @@ struct uiSpinbox {
- (id)initWithFrame:(NSRect)r spinbox:(uiSpinbox *)sb - (id)initWithFrame:(NSRect)r spinbox:(uiSpinbox *)sb
{ {
NSDictionary *views;
self = [super initWithFrame:r]; self = [super initWithFrame:r];
if (self) { if (self) {
self->tf = newEditableTextField(); self->tf = newEditableTextField();
@ -91,9 +89,9 @@ struct uiSpinbox {
self, NSLayoutAttributeBottom, self, NSLayoutAttributeBottom,
1, 0, 1, 0,
@"uiSpinbox bottom edge stepper")]; @"uiSpinbox bottom edge stepper")];
[self addConstraint:mkConstraint(self->stepper, NSLayoutAttributeTrailingEdge, [self addConstraint:mkConstraint(self->stepper, NSLayoutAttributeTrailing,
NSLayoutRelationEqual, NSLayoutRelationEqual,
self->stepper, NSLayoutAttributeLeadingEdge, self->stepper, NSLayoutAttributeLeading,
1, -3, // TODO 1, -3, // TODO
@"uiSpinbox space between text field and stepper")]; @"uiSpinbox space between text field and stepper")];

View File

@ -64,7 +64,7 @@ extern void setHorzHuggingPri(NSView *view, NSLayoutPriority priority);
extern NSLayoutPriority vertHuggingPri(NSView *view); extern NSLayoutPriority vertHuggingPri(NSView *view);
extern void setVertHuggingPri(NSView *view, NSLayoutPriority priority); extern void setVertHuggingPri(NSView *view, NSLayoutPriority priority);
extern void layoutSingleView(NSView *superview, NSView *subview, int margined, NSString *desc); 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 // map.m
extern struct mapTable *newMap(void); extern struct mapTable *newMap(void);