summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/dive.h1
-rw-r--r--profile-widget/diveprofileitem.cpp34
-rw-r--r--profile-widget/diveprofileitem.h25
-rw-r--r--profile-widget/profilewidget2.cpp2
4 files changed, 31 insertions, 31 deletions
diff --git a/core/dive.h b/core/dive.h
index 5bd5989d7..9c847ee90 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -113,7 +113,6 @@ extern struct dive displayed_dive;
extern unsigned int dc_number;
extern struct dive *current_dive;
#define current_dc (get_dive_dc(current_dive, dc_number))
-#define displayed_dc (get_dive_dc(&displayed_dive, dc_number))
extern struct dive *get_dive(int nr);
extern struct dive *get_dive_from_table(int nr, const struct dive_table *dt);
diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp
index eb343cc5e..fca21b3f4 100644
--- a/profile-widget/diveprofileitem.cpp
+++ b/profile-widget/diveprofileitem.cpp
@@ -31,7 +31,7 @@ void AbstractProfilePolygonItem::setVisible(bool visible)
QGraphicsPolygonItem::setVisible(visible);
}
-void AbstractProfilePolygonItem::replot()
+void AbstractProfilePolygonItem::replot(const dive *)
{
// Calculate the polygon. This is the polygon that will be painted on screen
// on the ::paint method. Here we calculate the correct position of the points
@@ -85,9 +85,9 @@ void DiveProfileItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
painter->restore();
}
-void DiveProfileItem::replot()
+void DiveProfileItem::replot(const dive *d)
{
- AbstractProfilePolygonItem::replot();
+ AbstractProfilePolygonItem::replot(d);
if (polygon().isEmpty())
return;
@@ -165,7 +165,7 @@ DiveHeartrateItem::DiveHeartrateItem(const DivePlotDataModel &model, const DiveC
connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::hrgraphChanged, this, &DiveHeartrateItem::setVisible);
}
-void DiveHeartrateItem::replot()
+void DiveHeartrateItem::replot(const dive *)
{
int last = -300, last_printed_hr = 0, sec = 0;
struct {
@@ -244,7 +244,7 @@ DivePercentageItem::DivePercentageItem(const DivePlotDataModel &model, const Div
connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::percentagegraphChanged, this, &DivePercentageItem::setVisible);
}
-void DivePercentageItem::replot()
+void DivePercentageItem::replot(const dive *d)
{
// Ignore empty values. a heart rate of 0 would be a bad sign.
QPolygonF poly;
@@ -257,7 +257,7 @@ void DivePercentageItem::replot()
double value = dataModel.index(i, vDataColumn).data().toDouble();
struct gasmix gasmix = gasmix_air;
const struct event *ev = NULL;
- gasmix = get_gasmix(&displayed_dive, displayed_dc, sec, &ev, gasmix);
+ gasmix = get_gasmix(d, get_dive_dc_const(d, dc_number), sec, &ev, gasmix);
int inert = get_n2(gasmix) + get_he(gasmix);
colors.push_back(ColorScale(value, inert));
}
@@ -318,7 +318,7 @@ DiveAmbPressureItem::DiveAmbPressureItem(const DivePlotDataModel &model, const D
setPen(pen);
}
-void DiveAmbPressureItem::replot()
+void DiveAmbPressureItem::replot(const dive *)
{
int sec = 0;
@@ -359,7 +359,7 @@ DiveGFLineItem::DiveGFLineItem(const DivePlotDataModel &model, const DiveCartesi
setPen(pen);
}
-void DiveGFLineItem::replot()
+void DiveGFLineItem::replot(const dive *)
{
int sec = 0;
@@ -400,7 +400,7 @@ DiveTemperatureItem::DiveTemperatureItem(const DivePlotDataModel &model, const D
setPen(pen);
}
-void DiveTemperatureItem::replot()
+void DiveTemperatureItem::replot(const dive *)
{
int last = -300, last_printed_temp = 0, sec = 0, last_valid_temp = 0;
@@ -478,7 +478,7 @@ DiveMeanDepthItem::DiveMeanDepthItem(const DivePlotDataModel &model, const DiveC
lastRunningSum = 0.0;
}
-void DiveMeanDepthItem::replot()
+void DiveMeanDepthItem::replot(const dive *)
{
double meandepthvalue = 0.0;
@@ -525,7 +525,7 @@ void DiveMeanDepthItem::createTextItem()
texts.append(text);
}
-void DiveGasPressureItem::replot()
+void DiveGasPressureItem::replot(const dive *d)
{
const struct plot_info *pInfo = &dataModel.data();
std::vector<int> plotted_cyl(pInfo->nr_cylinders, false);
@@ -550,7 +550,7 @@ void DiveGasPressureItem::replot()
QColor color;
if (!in_planner()) {
if (entry->sac)
- color = getSacColor(entry->sac, displayed_dive.sac);
+ color = getSacColor(entry->sac, d->sac);
else
color = MED_GRAY_HIGH_TRANS;
} else {
@@ -629,7 +629,7 @@ void DiveGasPressureItem::replot()
label_y_offset = -7 * axisLog;
}
plotPressureValue(mbar, entry->sec, alignVar, value_y_offset);
- plotGasValue(mbar, entry->sec, get_cylinder(&displayed_dive, cyl)->gasmix, alignVar, label_y_offset);
+ plotGasValue(mbar, entry->sec, get_cylinder(d, cyl)->gasmix, alignVar, label_y_offset);
seen_cyl[cyl] = true;
/* Alternate alignment as we see cylinder use.. */
@@ -699,9 +699,9 @@ DiveCalculatedCeiling::DiveCalculatedCeiling(const DivePlotDataModel &model, con
setVisible(prefs.calcceiling);
}
-void DiveCalculatedCeiling::replot()
+void DiveCalculatedCeiling::replot(const dive *d)
{
- AbstractProfilePolygonItem::replot();
+ AbstractProfilePolygonItem::replot(d);
// Add 2 points to close the polygon.
QPolygonF poly = polygon();
if (poly.isEmpty())
@@ -747,7 +747,7 @@ DiveReportedCeiling::DiveReportedCeiling(const DivePlotDataModel &model, const D
setVisible(prefs.dcceiling);
}
-void DiveReportedCeiling::replot()
+void DiveReportedCeiling::replot(const dive *)
{
QPolygonF p;
p.append(QPointF(hAxis.posAtValue(0), vAxis.posAtValue(0)));
@@ -780,7 +780,7 @@ void DiveReportedCeiling::paint(QPainter *painter, const QStyleOptionGraphicsIte
QGraphicsPolygonItem::paint(painter, option, widget);
}
-void PartialPressureGasItem::replot()
+void PartialPressureGasItem::replot(const dive *)
{
plot_data *entry = dataModel.data().entry;
QPolygonF poly;
diff --git a/profile-widget/diveprofileitem.h b/profile-widget/diveprofileitem.h
index 016d650a2..4d86714c1 100644
--- a/profile-widget/diveprofileitem.h
+++ b/profile-widget/diveprofileitem.h
@@ -28,6 +28,7 @@ class DiveTextItem;
class DiveCartesianAxis;
class QAbstractTableModel;
struct plot_data;
+struct dive;
class AbstractProfilePolygonItem : public QObject, public QGraphicsPolygonItem {
Q_OBJECT
@@ -38,7 +39,7 @@ public:
AbstractProfilePolygonItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn);
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) = 0;
void clear();
- virtual void replot();
+ virtual void replot(const dive *d);
public
slots:
void setVisible(bool visible);
@@ -67,7 +68,7 @@ class DiveProfileItem : public AbstractProfilePolygonItem {
public:
DiveProfileItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
- void replot() override;
+ void replot(const dive *d) override;
void plot_depth_sample(struct plot_data *entry, QFlags<Qt::AlignmentFlag> flags, const QColor &color);
int maxCeiling(int row);
@@ -81,7 +82,7 @@ class DiveMeanDepthItem : public AbstractProfilePolygonItem {
Q_OBJECT
public:
DiveMeanDepthItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn);
- void replot() override;
+ void replot(const dive *d) override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
private:
@@ -94,7 +95,7 @@ class DiveTemperatureItem : public AbstractProfilePolygonItem {
Q_OBJECT
public:
DiveTemperatureItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn);
- void replot() override;
+ void replot(const dive *d) override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
private:
@@ -105,7 +106,7 @@ class DiveHeartrateItem : public AbstractProfilePolygonItem {
Q_OBJECT
public:
DiveHeartrateItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn);
- void replot() override;
+ void replot(const dive *d) override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
private:
@@ -117,7 +118,7 @@ class DivePercentageItem : public AbstractProfilePolygonItem {
Q_OBJECT
public:
DivePercentageItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn, int i);
- void replot() override;
+ void replot(const dive *d) override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
private:
@@ -132,7 +133,7 @@ class DiveAmbPressureItem : public AbstractProfilePolygonItem {
Q_OBJECT
public:
DiveAmbPressureItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn);
- void replot() override;
+ void replot(const dive *d) override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
private:
@@ -143,7 +144,7 @@ class DiveGFLineItem : public AbstractProfilePolygonItem {
Q_OBJECT
public:
DiveGFLineItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn);
- void replot() override;
+ void replot(const dive *d) override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
private:
@@ -155,7 +156,7 @@ class DiveGasPressureItem : public AbstractProfilePolygonItem {
public:
using AbstractProfilePolygonItem::AbstractProfilePolygonItem;
- void replot() override;
+ void replot(const dive *d) override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
private:
@@ -174,7 +175,7 @@ class DiveCalculatedCeiling : public AbstractProfilePolygonItem {
public:
DiveCalculatedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn,
const DiveCartesianAxis &vAxis, int vColumn, ProfileWidget2 *profileWidget);
- void replot() override;
+ void replot(const dive *d) override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
private:
@@ -186,7 +187,7 @@ class DiveReportedCeiling : public AbstractProfilePolygonItem {
public:
DiveReportedCeiling(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn);
- void replot() override;
+ void replot(const dive *d) override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
};
@@ -203,7 +204,7 @@ class PartialPressureGasItem : public AbstractProfilePolygonItem {
public:
PartialPressureGasItem(const DivePlotDataModel &model, const DiveCartesianAxis &hAxis, int hColumn, const DiveCartesianAxis &vAxis, int vColumn);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
- void replot() override;
+ void replot(const dive *d) override;
void setThresholdSettingsKey(const double *prefPointerMin, const double *prefPointerMax);
void setVisibilitySettingsKey(const QString &setVisibilitySettingsKey);
void setColors(const QColor &normalColor, const QColor &alertColor);
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index c3097ed32..7397d1648 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -737,7 +737,7 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict
// Replot dive items
for (AbstractProfilePolygonItem *item: profileItems)
- item->replot();
+ item->replot(&displayed_dive);
// The event items are a bit special since we don't know how many events are going to
// exist on a dive, so I cant create cache items for that. that's why they are here