aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--profile.c49
-rw-r--r--qt-ui/profilegraphics.cpp50
-rw-r--r--qt-ui/profilegraphics.h2
3 files changed, 51 insertions, 50 deletions
diff --git a/profile.c b/profile.c
index 67f83f0a6..15fc2a920 100644
--- a/profile.c
+++ b/profile.c
@@ -470,55 +470,6 @@ int get_local_sac(struct plot_data *entry1, struct plot_data *entry2, struct div
#if USE_GTK_UI
-
-static void plot_pressure_value(struct graphics_context *gc, int mbar, int sec,
- int xalign, int yalign)
-{
- int pressure;
- const char *unit;
-
- pressure = get_pressure_units(mbar, &unit);
- text_render_options_t tro = {PRESSURE_TEXT_SIZE, PRESSURE_TEXT, xalign, yalign};
- plot_text(gc, &tro, sec, mbar, "%d %s", pressure, unit);
-}
-
-static void plot_cylinder_pressure_text(struct graphics_context *gc, struct plot_info *pi)
-{
- int i;
- int mbar, cyl;
- int seen_cyl[MAX_CYLINDERS] = { FALSE, };
- int last_pressure[MAX_CYLINDERS] = { 0, };
- int last_time[MAX_CYLINDERS] = { 0, };
- struct plot_data *entry;
-
- if (!get_cylinder_pressure_range(gc, pi))
- return;
-
- cyl = -1;
- for (i = 0; i < pi->nr; i++) {
- entry = pi->entry + i;
- mbar = GET_PRESSURE(entry);
-
- if (!mbar)
- continue;
- if (cyl != entry->cylinderindex) {
- cyl = entry->cylinderindex;
- if (!seen_cyl[cyl]) {
- plot_pressure_value(gc, mbar, entry->sec, LEFT, BOTTOM);
- seen_cyl[cyl] = TRUE;
- }
- }
- last_pressure[cyl] = mbar;
- last_time[cyl] = entry->sec;
- }
-
- for (cyl = 0; cyl < MAX_CYLINDERS; cyl++) {
- if (last_time[cyl]) {
- plot_pressure_value(gc, last_pressure[cyl], last_time[cyl], CENTER, TOP);
- }
- }
-}
-
static void plot_deco_text(struct graphics_context *gc, struct plot_info *pi)
{
if (prefs.profile_calc_ceiling) {
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index 158cec286..787182389 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -248,8 +248,8 @@ void ProfileGraphicsView::plot(struct dive *dive)
plot_depth_text();
+ plot_cylinder_pressure_text();
#if 0
- plot_cylinder_pressure_text(gc, pi);
plot_deco_text(gc, pi);
#endif
/* Bounding box */
@@ -292,6 +292,54 @@ void ProfileGraphicsView::plot(struct dive *dive)
#endif
}
+void ProfileGraphicsView::plot_cylinder_pressure_text()
+{
+ int i;
+ int mbar, cyl;
+ int seen_cyl[MAX_CYLINDERS] = { FALSE, };
+ int last_pressure[MAX_CYLINDERS] = { 0, };
+ int last_time[MAX_CYLINDERS] = { 0, };
+ struct plot_data *entry;
+ struct plot_info *pi = &gc.pi;
+
+ if (!get_cylinder_pressure_range(&gc))
+ return;
+
+ cyl = -1;
+ for (i = 0; i < pi->nr; i++) {
+ entry = pi->entry + i;
+ mbar = GET_PRESSURE(entry);
+
+ if (!mbar)
+ continue;
+ if (cyl != entry->cylinderindex) {
+ cyl = entry->cylinderindex;
+ if (!seen_cyl[cyl]) {
+ plot_pressure_value(mbar, entry->sec, LEFT, BOTTOM);
+ seen_cyl[cyl] = TRUE;
+ }
+ }
+ last_pressure[cyl] = mbar;
+ last_time[cyl] = entry->sec;
+ }
+
+ for (cyl = 0; cyl < MAX_CYLINDERS; cyl++) {
+ if (last_time[cyl]) {
+ plot_pressure_value(last_pressure[cyl], last_time[cyl], CENTER, TOP);
+ }
+ }
+}
+
+void ProfileGraphicsView::plot_pressure_value(int mbar, int sec, int xalign, int yalign)
+{
+ int pressure;
+ const char *unit;
+
+ pressure = get_pressure_units(mbar, &unit);
+ static text_render_options_t tro = {PRESSURE_TEXT_SIZE, PRESSURE_TEXT, xalign, yalign};
+ plot_text(&tro, sec, mbar, QString("%1 %2").arg(pressure).arg(unit));
+}
+
void ProfileGraphicsView::plot_depth_text()
{
int maxtime, maxdepth;
diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h
index c1c3c2837..39f98f65f 100644
--- a/qt-ui/profilegraphics.h
+++ b/qt-ui/profilegraphics.h
@@ -102,6 +102,8 @@ private:
void plot_depth_text();
void plot_text_samples();
void plot_depth_sample(struct plot_data *entry, text_render_options_t *tro);
+ void plot_cylinder_pressure_text();
+ void plot_pressure_value(int mbar, int sec, int xalign, int yalign);
QColor get_sac_color(int sac, int avg_sac);