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 *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;

View File

@ -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

View File

@ -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);

View File

@ -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")];

View File

@ -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);