From 2eb48aa1293ef3a542f59d6e0d69bb757cc7edb2 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 2 Aug 2015 22:41:07 -0400 Subject: [PATCH] Changed button.m and spinbox.m to use the new model. Let's test this one... --- redo/osxaltest/box.m | 1 + redo/osxaltest/button.m | 31 +++++-------------------------- redo/osxaltest/spinbox.m | 31 +++++-------------------------- 3 files changed, 11 insertions(+), 52 deletions(-) diff --git a/redo/osxaltest/box.m b/redo/osxaltest/box.m index 838775f1..0cc80f2d 100644 --- a/redo/osxaltest/box.m +++ b/redo/osxaltest/box.m @@ -29,6 +29,7 @@ self = [super init]; if (self) { self->v = [[NSView alloc] initWithFrame:NSZeroRect]; + [self->v setTranslatesAutoresizingMaskIntoConstraints:NO]; self->children = [NSMutableArray new]; self->stretchy = [NSMutableArray new]; self->vertical = vert; diff --git a/redo/osxaltest/button.m b/redo/osxaltest/button.m index 45990e97..3a8d77fa 100644 --- a/redo/osxaltest/button.m +++ b/redo/osxaltest/button.m @@ -33,32 +33,11 @@ - (void)tFillAutoLayout:(tAutoLayoutParams *)p { - NSString *key; - NSString *horzpred, *vertpred; - - key = tAutoLayoutKey(p->n); - p->n++; - horzpred = @""; - if (p->horzStretchy) - if (p->horzFirstStretchy) - // TODO is this unnecessary? it seems like I need to do other things instead of this to ensure stretchiness... - horzpred = @"(>=0)"; - else - horzpred = [NSString stringWithFormat:@"(==%@)", tAutoLayoutKey(p->horzStretchyTo)]; - vertpred = @""; - if (p->vertStretchy) - if (p->vertFirstStretchy) - // TODO is this unnecessary? it seems like I need to do other things instead of this to ensure stretchiness... - vertpred = @"(>=0)"; - else - vertpred = [NSString stringWithFormat:@"(==%@)", tAutoLayoutKey(p->vertStretchyTo)]; - [p->horz addObject:[NSString stringWithFormat:@"[%@%@]", key, horzpred]]; - [p->horzAttachLeft addObject:[NSNumber numberWithBool:p->horzFirst]]; - [p->horzAttachRight addObject:[NSNumber numberWithBool:p->horzLast]]; - [p->vert addObject:[NSString stringWithFormat:@"[%@%@]", key, vertpred]]; - [p->vertAttachTop addObject:[NSNumber numberWithBool:p->vertFirst]]; - [p->vertAttachBottom addObject:[NSNumber numberWithBool:p->vertLast]]; - [p->views setObject:self->b forKey:key]; + p->view = self->b; + p->attachLeft = YES; + p->attachTop = YES; + p->attachRight = YES; + p->attachBottom = YES; } - (void)tRelayout diff --git a/redo/osxaltest/spinbox.m b/redo/osxaltest/spinbox.m index b649c268..4c443dd8 100644 --- a/redo/osxaltest/spinbox.m +++ b/redo/osxaltest/spinbox.m @@ -77,32 +77,11 @@ - (void)tFillAutoLayout:(tAutoLayoutParams *)p { - NSString *key; - NSString *horzpred, *vertpred; - - key = tAutoLayoutKey(p->n); - p->n++; - horzpred = @"(==96)"; // TODO only the entry - if (p->horzStretchy) - if (p->horzFirstStretchy) - // TODO is this unnecessary? it seems like I need to do other things instead of this to ensure stretchiness... - horzpred = @"(>=0)"; - else - horzpred = [NSString stringWithFormat:@"(==%@)", tAutoLayoutKey(p->horzStretchyTo)]; - vertpred = @""; - if (p->vertStretchy) - if (p->vertFirstStretchy) - // TODO is this unnecessary? it seems like I need to do other things instead of this to ensure stretchiness... - vertpred = @"(>=0)"; - else - vertpred = [NSString stringWithFormat:@"(==%@)", tAutoLayoutKey(p->vertStretchyTo)]; - [p->horz addObject:[NSString stringWithFormat:@"[%@%@]", key, horzpred]]; - [p->horzAttachLeft addObject:[NSNumber numberWithBool:p->horzFirst]]; - [p->horzAttachRight addObject:[NSNumber numberWithBool:p->horzLast]]; - [p->vert addObject:[NSString stringWithFormat:@"[%@%@]", key, vertpred]]; - [p->vertAttachTop addObject:[NSNumber numberWithBool:p->vertFirst]]; - [p->vertAttachBottom addObject:[NSNumber numberWithBool:p->vertLast]]; - [p->views setObject:self->c forKey:key]; + p->view = self->c; + p->attachLeft = YES; + p->attachTop = YES; + p->attachRight = YES; + p->attachBottom = YES; } - (void)tRelayout