preview layout is almost done

it's reading my coordinates and the number of items to output. just
need to make it count the number of items per preview row correctly.