diff options
author | André Nusser <andre.nusser@googlemail.com> | 2017-05-24 16:21:12 +0200 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2017-05-24 17:12:15 +0200 |
commit | 13ab76b2d587a786112a35b5bcccf5e264700f9e (patch) | |
tree | 0d1756b0a7be57b115c0da9581b4aa4cc12939a2 /plugingui/layout.cc | |
parent | 76c46d5b6cfa400f3bbdc742008dcfed9782a339 (diff) |
Add frame in the GUI for bleed control.
Diffstat (limited to 'plugingui/layout.cc')
-rw-r--r-- | plugingui/layout.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/plugingui/layout.cc b/plugingui/layout.cc index 1e18c40..da64d1b 100644 --- a/plugingui/layout.cc +++ b/plugingui/layout.cc @@ -293,6 +293,35 @@ void GridLayout::setPosition(LayoutItem* item, GridRange const& range) grid_ranges[item] = range; } +int GridLayout::lastUsedRow(int column) const +{ + int last_row = -1; + + for (auto const& grid_range : grid_ranges) { + auto const& range = grid_range.second; + if (column >= range.column_begin && column < range.column_end) { + last_row = std::max(last_row, range.row_end - 1); + } + } + + return last_row; +} + +int GridLayout::lastUsedColumn(int row) const +{ + int last_column = -1; + + for (auto const& grid_range : grid_ranges) { + auto const& range = grid_range.second; + if (row >= range.row_begin && row < range.row_end) { + last_column = std::max(last_column, range.column_end - 1); + } + } + + return last_column; + +} + auto GridLayout::calculateCellSize() const -> CellSize { auto empty_width = (number_of_columns - 1) * spacing; |