Move a folio's border dimensions into the project database

Adds a folio_border table and wires BorderTitleBlock's column/row
grid (counts, widths, header sizes, display flags) through it, the
same way folio_titleblock already covers the title block itself.
Closes the one gap DB-ACCESSORS 4.6 found still living only in the
folio's own XML.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-22 22:55:34 +13:00
parent b98193dbe2
commit 489676b155
4 changed files with 151 additions and 25 deletions
+49 -10
View File
@@ -345,6 +345,18 @@ const TitleBlockProperties *BorderTitleBlock::stored() const
return nullptr;
}
/**
@brief BorderTitleBlock::storedBorder
@return the properties the project's store holds for this folio's
border, or nullptr if it is not placed.
*/
const BorderProperties *BorderTitleBlock::storedBorder() const
{
if (projectDataBase *store = placedStore())
return store->storedFolioBorder(m_owner_folio->uuid());
return nullptr;
}
/**
@brief BorderTitleBlock::setOwnerFolio
@param folio : the folio this border and title block belongs to
@@ -378,6 +390,17 @@ void BorderTitleBlock::storeTitleBlock()
store->storeFolioTitleBlock(m_owner_folio->uuid(), localTitleBlock());
}
/**
@brief BorderTitleBlock::storeBorder
Write this folio's border properties to its project's store, once its
folio is placed: every change of them comes through here.
*/
void BorderTitleBlock::storeBorder()
{
if (projectDataBase *store = placedStore())
store->storeFolioBorder(m_owner_folio->uuid(), exportBorder());
}
/**
@brief BorderTitleBlock::importTitleBlock
@param ip the new properties of titleblock
@@ -418,15 +441,19 @@ void BorderTitleBlock::importTitleBlock(const TitleBlockProperties &ip)
*/
BorderProperties BorderTitleBlock::exportBorder()
{
//Read the members directly, not the getters: a folio placed in a
//project reads those back from the store, which storeBorder() is
//about to update from this very value -- going through them here
//would echo back the old stored value instead of the new one.
BorderProperties bp;
bp.columns_count = columnsCount();
bp.columns_width = columnsWidth();
bp.columns_header_height = columnsHeaderHeight();
bp.display_columns = columnsAreDisplayed();
bp.rows_count = rowsCount();
bp.rows_height = rowsHeight();
bp.rows_header_width = rowsHeaderWidth();
bp.display_rows = rowsAreDisplayed();
bp.columns_count = columns_count_;
bp.columns_width = columns_width_;
bp.columns_header_height = columns_header_height_;
bp.display_columns = display_columns_;
bp.rows_count = rows_count_;
bp.rows_height = rows_height_;
bp.rows_header_width = rows_header_width_;
bp.display_rows = display_rows_;
return(bp);
}
@@ -530,7 +557,10 @@ void BorderTitleBlock::displayTitleBlock(bool di) {
void BorderTitleBlock::displayColumns(bool dc) {
bool change = (dc != display_columns_);
display_columns_ = dc;
if (change) emit(displayChanged());
if (change) {
storeBorder();
emit(displayChanged());
}
}
/**
@@ -541,7 +571,10 @@ void BorderTitleBlock::displayColumns(bool dc) {
void BorderTitleBlock::displayRows(bool dr) {
bool change = (dr != display_rows_);
display_rows_ = dr;
if (change) emit(displayChanged());
if (change) {
storeBorder();
emit(displayChanged());
}
}
/**
@@ -831,6 +864,7 @@ void BorderTitleBlock::setColumnsCount(int nb_c) {
if (nb_c == columnsCount()) return;
columns_count_ = qMax(MIN_COLUMN_COUNT , nb_c);
updateRectangles();
storeBorder();
}
/**
@@ -850,6 +884,7 @@ void BorderTitleBlock::setColumnsWidth(const qreal &new_cw) {
if (new_cw == columnsWidth()) return;
columns_width_ = qMax(MIN_COLUMN_WIDTH , new_cw);
updateRectangles();
storeBorder();
}
/**
@@ -865,6 +900,7 @@ void BorderTitleBlock::setColumnsWidth(const qreal &new_cw) {
void BorderTitleBlock::setColumnsHeaderHeight(const qreal &new_chh) {
columns_header_height_ = qBound(qreal(5.0), new_chh, qreal(50.0));
updateRectangles();
storeBorder();
}
/**
@@ -884,6 +920,7 @@ void BorderTitleBlock::setRowsCount(int nb_r) {
if (nb_r == rowsCount()) return;
rows_count_ = qMax(MIN_ROW_COUNT, nb_r);
updateRectangles();
storeBorder();
}
/**
@@ -903,6 +940,7 @@ void BorderTitleBlock::setRowsHeight(const qreal &new_rh) {
if (new_rh == rowsHeight()) return;
rows_height_ = qMax(MIN_ROW_HEIGHT, new_rh);
updateRectangles();
storeBorder();
}
/**
@@ -918,6 +956,7 @@ void BorderTitleBlock::setRowsHeight(const qreal &new_rh) {
void BorderTitleBlock::setRowsHeaderWidth(const qreal &new_rhw) {
rows_header_width_ = qBound(qreal(5.0), new_rhw, qreal(50.0));
updateRectangles();
storeBorder();
}
/**