mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Disable stack zoom controls when stacked view is disabled.
This commit is contained in:
@@ -657,8 +657,6 @@ AllPlotWindow::setAllPlotWidgets(RideItem *ride)
|
||||
scrollRight->hide();
|
||||
|
||||
// show stacked view
|
||||
stackZoomDown->setEnabled(true);
|
||||
stackZoomUp->setEnabled(true);
|
||||
stackFrame->show();
|
||||
|
||||
} else {
|
||||
@@ -1073,17 +1071,36 @@ AllPlotWindow::resetStackedDatas()
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
AllPlotWindow::stackZoomUpShouldEnable(int sw)
|
||||
{
|
||||
if (sw >= 200 || sw >= allPlot->rideItem->ride()->dataPoints().last()->secs/60) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
AllPlotWindow::stackZoomDownShouldEnable(int sw)
|
||||
{
|
||||
if (sw <= 4) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AllPlotWindow::setStackZoomUp()
|
||||
{
|
||||
if (stackWidth<200 && stackWidth<allPlot->rideItem->ride()->dataPoints().last()->secs/60) {
|
||||
|
||||
stackWidth = ceil(stackWidth * 1.25);
|
||||
stackZoomDown->setEnabled(true);
|
||||
setupStackPlots();
|
||||
|
||||
if (stackWidth>=200 || stackWidth>=allPlot->rideItem->ride()->dataPoints().last()->secs/60)
|
||||
stackZoomUp->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1093,10 +1110,8 @@ AllPlotWindow::setStackZoomDown()
|
||||
if (stackWidth>4) {
|
||||
|
||||
stackWidth = floor(stackWidth / 1.25);
|
||||
stackZoomUp->setEnabled(true);
|
||||
setupStackPlots();
|
||||
|
||||
if (stackWidth<=4) stackZoomDown->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1117,6 +1132,8 @@ AllPlotWindow::showStackChanged(int value)
|
||||
if (value) {
|
||||
// refresh plots
|
||||
resetStackedDatas();
|
||||
stackZoomUp->setEnabled(stackZoomUpShouldEnable(stackWidth));
|
||||
stackZoomDown->setEnabled(stackZoomDownShouldEnable(stackWidth));
|
||||
|
||||
// now they are all set, lets replot them
|
||||
foreach(AllPlot *plot, allPlots) plot->replot();
|
||||
@@ -1254,6 +1271,9 @@ AllPlotWindow::setupStackPlots()
|
||||
|
||||
// we are now happy for a screen refresh to take place
|
||||
stackFrame->setUpdatesEnabled(true);
|
||||
|
||||
stackZoomUp->setEnabled(stackZoomUpShouldEnable(stackWidth));
|
||||
stackZoomDown->setEnabled(stackZoomDownShouldEnable(stackWidth));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -140,6 +140,9 @@ class AllPlotWindow : public QWidget
|
||||
private slots:
|
||||
|
||||
void addPickers(AllPlot *allPlot2);
|
||||
bool stackZoomUpShouldEnable(int sw);
|
||||
bool stackZoomDownShouldEnable(int sw);
|
||||
|
||||
void plotPickerMoved(const QPoint &);
|
||||
void plotPickerSelected(const QPoint &);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user