13
0

canvas: remove use of Table::Index from API of Table::attach()

This commit is contained in:
Paul Davis 2021-09-14 21:18:16 -06:00
parent c952c57a99
commit 1c42c733f7
2 changed files with 4 additions and 4 deletions

View File

@ -66,7 +66,7 @@ public:
void add_front (Item *);
void remove (Item *);
void attach (Item*, Index const & upper_left, Index const & lower_right, PackOptions row_options = PackOptions (0), PackOptions col_options = PackOptions (0), FourDimensions padding = FourDimensions (0.));
void attach (Item*, Coord upper_left_x, Coord upper_left_y, Coord lower_right_x, Coord lower_right_y, PackOptions row_options = PackOptions (0), PackOptions col_options = PackOptions (0), FourDimensions padding = FourDimensions (0.));
void dettach (Item*);
void set_row_size (uint32_t row, Distance);

View File

@ -52,16 +52,16 @@ Table::Table (Item* item)
}
void
Table::attach (Item* item, Table::Index const & upper_left, Table::Index const & lower_right, PackOptions row_options, PackOptions col_options, FourDimensions pad)
Table::attach (Item* item, Coord ulx, Coord uly, Coord lrx, Coord lry, PackOptions row_options, PackOptions col_options, FourDimensions pad)
{
/* XXX maybe use z-axis to stack elements if the insert fails? Would
* involve making Index 3D and using an actual hash function
*/
if (cells.insert ({ Index (upper_left.x, upper_left.y), CellInfo (item, row_options, col_options, upper_left, lower_right, pad) }).second) {
if (cells.insert ({ Index (ulx, uly), CellInfo (item, row_options, col_options, Index (ulx, uly), Index (lrx, lry), pad) }).second) {
_add (item);
} else {
cerr << "Failed to attach at " << upper_left.x << ", " << upper_left.y << " " << lower_right.x << ", " << lower_right.y << endl;
cerr << "Failed to attach at " << ulx << ", " << uly << " " << lrx << ", " << lry << endl;
}
}