diff --git a/redo/osxaltest/box.m b/redo/osxaltest/box.m index ab56fd55..6f37eaf8 100644 --- a/redo/osxaltest/box.m +++ b/redo/osxaltest/box.m @@ -71,12 +71,12 @@ pp.firstStretchy = TRUE; for (i = 0; i < [self->children count]; i++) { id cur; - NSNumber *stretchy; + NSNumber *isStretchy; first[i] = pp.n; cur = (id) [self->children objectAtIndex:i]; - stretchy = (NSNumber *) [self->stretchy objectAtIndex:i]; - pp.stretchy = [stretchy boolValue]; + isStretchy = (NSNumber *) [self->stretchy objectAtIndex:i]; + pp.stretchy = [isStretchy boolValue]; [cur tFillAutoLayout:&pp]; if (pp.stretchy && pp.firstStretchy) { pp.firstStretchy = FALSE; diff --git a/redo/osxaltest/button.m b/redo/osxaltest/button.m index 6eb1ced6..1bf0d8e2 100644 --- a/redo/osxaltest/button.m +++ b/redo/osxaltest/button.m @@ -33,11 +33,27 @@ - (void)tFillAutoLayout:(tAutoLayoutParams *)p { NSString *key; + NSString *horzpred, *vertpred; key = tAutoLayoutKey(p->n); p->n++; - [p->horz addObject:[NSString stringWithFormat:@"[%@]", key]]; - [p->vert addObject:[NSString stringWithFormat:@"[%@]", key]]; + horzpred = @""; + vertpred = @""; + if (p->stretchy) { + NSString *predicate; + + if (p->firstStretchy) + // TODO is this unnecessary? it seems like I need to do other things instead of this to ensure stretchiness... + predicate = @"(>=0)"; + else + predicate = [NSString stringWithFormat:@"(==%@)", tAutoLayoutKey(p->stretchyTo)]; + if (p->stretchyVert) + vertpred = predicate; + else + horzpred = predicate; + } + [p->horz addObject:[NSString stringWithFormat:@"[%@%@]", key, horzpred]]; + [p->vert addObject:[NSString stringWithFormat:@"[%@%@]", key, vertpred]]; [p->views setObject:self->b forKey:key]; } diff --git a/redo/osxaltest/spinbox.m b/redo/osxaltest/spinbox.m index 5971332a..0ccdaf55 100644 --- a/redo/osxaltest/spinbox.m +++ b/redo/osxaltest/spinbox.m @@ -76,11 +76,26 @@ - (void)tFillAutoLayout:(tAutoLayoutParams *)p { NSString *key; + NSString *horzpred, *vertpred; key = tAutoLayoutKey(p->n); p->n++; - [p->horz addObject:[NSString stringWithFormat:@"[%@]", key]]; - [p->vert addObject:[NSString stringWithFormat:@"[%@]", key]]; + horzpred = @"(==96)"; // TODO only the entry + vertpred = @""; + if (p->stretchy) { + NSString *predicate; + + if (p->firstStretchy) + predicate = @"(>=0)"; + else + predicate = [NSString stringWithFormat:@"(==%@)", tAutoLayoutKey(p->stretchyTo)]; + if (p->stretchyVert) + vertpred = predicate; + else + horzpred = predicate; + } + [p->horz addObject:[NSString stringWithFormat:@"[%@%@]", key, horzpred]]; + [p->vert addObject:[NSString stringWithFormat:@"[%@%@]", key, vertpred]]; [p->views setObject:self->c forKey:key]; }