# HG changeset patch # User Michiel Broek # Date 1663839225 -7200 # Node ID 2c828cc3d9432c76c1170dfcf5fa0af69b94a9c9 # Parent 47f1259378fed2869994a5633cb5c473363f27fd Fix checklist mash steps overflow. diff -r 47f1259378fe -r 2c828cc3d943 src/PrinterDialog.cpp --- a/src/PrinterDialog.cpp Sat Aug 27 13:54:01 2022 +0200 +++ b/src/PrinterDialog.cpp Thu Sep 22 11:33:45 2022 +0200 @@ -1663,10 +1663,42 @@ } } checkLine(&painter, &y, QString(tr("Mill the malts"))); - y += 20; + + int lines = 0; + int loop = 0; + for (int i = 0; i < product->mashs.size(); i++) { + if (loop == 0) { + lines += 3; + if (numsalts > 0) + lines++; + for (int j = 0; j < product->hops.size(); j++) { + if (product->hops.at(j).useat == HOP_USEAT_MASH) { + lines++; + } + } + for (int j = 0; j < product->miscs.size(); j++) { + if ((product->miscs.at(j).use_use == MISC_USES_MASH) && (product->miscs.at(j).type != MISC_TYPES_WATER_AGENT)) { + lines++; + } + } + } else { + lines++; + } + lines++; + loop++; + } + lines++; + qDebug() << "check" << lines << y + (lines * 20) << painter.device()->height(); + if ((y + (lines * 20)) > painter.device()->height()) { + printer->newPage(); + printHeader(&painter); + y = 120; + } else { + y += 20; + } checkHeader(&painter, &y, tr("Mash")); - int loop = 0; + loop = 0; double l, mvol = 0, msugars = 0; for (int i = 0; i < product->mashs.size(); i++) { if (product->mashs.at(i).step_type == 0) @@ -1761,7 +1793,7 @@ if (checkSplit(&painter, &y, 1)) factor = 1; /* Boil, how much space do we need */ - int lines = 0; + lines = 0; if (product->boil_time == 0) { lines = 3; } else {