summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-11-02 12:39:55 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2011-11-02 12:39:55 -0700
commit55352a051cfa7ac519e397cd3d18851e5050517b (patch)
tree8d42a09d66212b84f992c8d3ce6b8e341cdac94a /profile.c
parente4bfb6597279ca3d9aa3678a617f5f0aef298278 (diff)
parent619ab9e828d4db7b0c4089018b09892c9d04ece9 (diff)
downloadsubsurface-55352a051cfa7ac519e397cd3d18851e5050517b.tar.gz
Merge branch 'add-info-stats-page' of git://github.com/dirkhh/subsurface
* 'add-info-stats-page' of git://github.com/dirkhh/subsurface: Add Info & Stats page to the notebook Even more places with pressure and volume conversions Further cleanup of pressure and volume conversions Use unit functions to get column headers, add unit function for pressure More consistency improvements Add new helper function to get temperature and unit
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c35
1 files changed, 5 insertions, 30 deletions
diff --git a/profile.c b/profile.c
index a7ea885a1..7caa5da9f 100644
--- a/profile.c
+++ b/profile.c
@@ -485,19 +485,13 @@ static int setup_temperature_limits(struct graphics_context *gc, struct plot_inf
static void plot_single_temp_text(struct graphics_context *gc, int sec, int mkelvin)
{
- int deg;
+ double deg;
const char *unit;
static const text_render_options_t tro = {12, 0.2, 0.2, 1.0, LEFT, TOP};
- temperature_t temperature = { mkelvin };
- if (output_units.temperature == FAHRENHEIT) {
- deg = to_F(temperature);
- unit = UTF8_DEGREE "F";
- } else {
- deg = to_C(temperature);
- unit = UTF8_DEGREE "C";
- }
- plot_text(gc, &tro, sec, temperature.mkelvin, "%d%s", deg, unit);
+ deg = get_temp_units(mkelvin, &unit);
+
+ plot_text(gc, &tro, sec, mkelvin, "%d%s", (int)(deg + 0.5), unit);
}
static void plot_temperature_text(struct graphics_context *gc, struct plot_info *pi)
@@ -617,32 +611,13 @@ static void plot_cylinder_pressure(struct graphics_context *gc, struct plot_info
plot_pressure_helper(gc, pi, INTERPOLATED_PR);
}
-static int mbar_to_PSI(int mbar)
-{
- pressure_t p = {mbar};
- return to_PSI(p);
-}
-
static void plot_pressure_value(struct graphics_context *gc, int mbar, int sec,
int xalign, int yalign)
{
int pressure;
const char *unit;
- switch (output_units.pressure) {
- case PASCAL:
- pressure = mbar * 100;
- unit = "pascal";
- break;
- case BAR:
- pressure = (mbar + 500) / 1000;
- unit = "bar";
- break;
- case PSI:
- pressure = mbar_to_PSI(mbar);
- unit = "psi";
- break;
- }
+ pressure = get_pressure_units(mbar, &unit);
text_render_options_t tro = {10, 0.2, 1.0, 0.2, xalign, yalign};
plot_text(gc, &tro, sec, mbar, "%d %s", pressure, unit);
}