And got the last bit of grid working :D

This commit is contained in:
Pietro Gagliardi 2016-06-12 18:26:13 -04:00
parent 2cd97c8e60
commit 144366c775
1 changed files with 35 additions and 0 deletions

View File

@ -198,6 +198,41 @@ struct uiGrid {
}
}
// if a row or column only contains emptys and spanning cells of a opposite-direction spannings, remove it by duplicating the previous row or column
BOOL onlyEmptyAndSpanning;
for (y = 0; y < ycount; y++) {
onlyEmptyAndSpanning = YES;
for (x = 0; x < xcount; x++)
if (gg[y][x] != -1) {
gc = (gridChild *) [self->children objectAtIndex:gg[y][x]];
if (gc.yspan == 1 || gc.top - ymin == y) {
onlyEmptyAndSpanning = NO;
break;
}
}
if (onlyEmptyAndSpanning)
for (x = 0; x < xcount; x++) {
gg[y][x] = gg[y - 1][x];
gspan[y][x] = YES;
}
}
for (x = 0; x < xcount; x++) {
onlyEmptyAndSpanning = YES;
for (y = 0; y < ycount; y++)
if (gg[y][x] != -1) {
gc = (gridChild *) [self->children objectAtIndex:gg[y][x]];
if (gc.xspan == 1 || gc.left - xmin == x) {
onlyEmptyAndSpanning = NO;
break;
}
}
if (onlyEmptyAndSpanning)
for (y = 0; y < ycount; y++) {
gg[y][x] = gg[y][x - 1];
gspan[y][x] = YES;
}
}
// now build a topological map of the grid's views gv[y][x]
// for any empty cell, create a dummy view
gv = (NSView ***) uiAlloc(ycount * sizeof (NSView **), "NSView *[][]");