profile: pass print-mode add construction of ProfileScene

Setting the profile and grayscale mode of the profile via
functions is from a time when the same profile widget was
used for printing and the UI. It is simpler to set the mode
when constructing the object and not deal with changes.

To prepare for this scenario, take the flag at construction
time. This still keeps the callers as-is. These will be
adapted later.

Logically, then the printFlag also has to be set in
DiveCartesianAxis at construction time.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-08-03 15:39:25 +02:00 committed by Dirk Hohndel
parent 1327043d6e
commit 84ebd1d67a
5 changed files with 23 additions and 45 deletions

View file

@ -61,22 +61,22 @@ PartialPressureGasItem *ProfileScene::createPPGas(int column, color_index_t colo
return item;
}
ProfileScene::ProfileScene(double fontPrintScale) :
ProfileScene::ProfileScene(double fontPrintScale, bool printMode, bool isGrayscale) :
d(nullptr),
dc(-1),
fontPrintScale(fontPrintScale),
printMode(false),
isGrayscale(false),
printMode(printMode),
isGrayscale(isGrayscale),
maxtime(-1),
maxdepth(-1),
dataModel(new DivePlotDataModel(this)),
profileYAxis(new DepthAxis(fontPrintScale, *this)),
gasYAxis(new PartialGasPressureAxis(*dataModel, fontPrintScale, *this)),
temperatureAxis(new TemperatureAxis(fontPrintScale, *this)),
timeAxis(new TimeAxis(fontPrintScale, *this)),
cylinderPressureAxis(new DiveCartesianAxis(fontPrintScale, *this)),
heartBeatAxis(new DiveCartesianAxis(fontPrintScale, *this)),
percentageAxis(new DiveCartesianAxis(fontPrintScale, *this)),
profileYAxis(new DepthAxis(fontPrintScale, printMode, *this)),
gasYAxis(new PartialGasPressureAxis(*dataModel, fontPrintScale, printMode, *this)),
temperatureAxis(new TemperatureAxis(fontPrintScale, printMode, *this)),
timeAxis(new TimeAxis(fontPrintScale, printMode, *this)),
cylinderPressureAxis(new DiveCartesianAxis(fontPrintScale, printMode, *this)),
heartBeatAxis(new DiveCartesianAxis(fontPrintScale, printMode, *this)),
percentageAxis(new DiveCartesianAxis(fontPrintScale, printMode, *this)),
diveProfileItem(createItem<DiveProfileItem>(*profileYAxis, DivePlotDataModel::DEPTH, 0, fontPrintScale)),
temperatureItem(createItem<DiveTemperatureItem>(*temperatureAxis, DivePlotDataModel::TEMPERATURE, 1, fontPrintScale)),
meanDepthItem(createItem<DiveMeanDepthItem>(*profileYAxis, DivePlotDataModel::INSTANT_MEANDEPTH, 1, fontPrintScale)),