[PATCH 5/5] Reorder info in information window

Anton Lundin glance at acc.umu.se
Tue Nov 12 14:10:01 UTC 2013


When moving along the plot, its hard to look at a certain value when its
place in the info box moves due to that values are added above it. This
moves the stable values up top in the info box and the values that comes
and goes further down, so that the box expands downwards.

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 profile.c | 88 +++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 43 insertions(+), 45 deletions(-)

diff --git a/profile.c b/profile.c
index a6cd77a..d0b524c 100644
--- a/profile.c
+++ b/profile.c
@@ -1199,7 +1199,6 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize,
 		memcpy(buf2, buf, bufsize);
 		snprintf(buf, bufsize, translate("gettextFromC","%s\nT:%d:%02d"), buf2, FRACTION(entry->sec, 60));
 	}
-
 	if (GET_PRESSURE(entry)) {
 		pressurevalue = get_pressure_units(GET_PRESSURE(entry), &pressure_unit);
 		memcpy(buf2, buf, bufsize);
@@ -1210,7 +1209,6 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize,
 		memcpy(buf2, buf, bufsize);
 		snprintf(buf, bufsize, translate("gettextFromC","%s\nTemp:%.1f %s"), buf2, tempvalue, temp_unit);
 	}
-
 	speedvalue = get_vertical_speed_units(abs(entry->speed), NULL, &vertical_speed_unit);
 	memcpy(buf2, buf, bufsize);
 	/* Ascending speeds are positive, descending are negative */
@@ -1218,20 +1216,37 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize,
 		speedvalue *= -1;
 	snprintf(buf, bufsize, translate("gettextFromC","%s\nV:%.2f %s"), buf2, speedvalue, vertical_speed_unit);
 
-	if (entry->ceiling) {
-		depthvalue = get_depth_units(entry->ceiling, NULL, &depth_unit);
+	if (entry->sac && prefs.show_sac) {
 		memcpy(buf2, buf, bufsize);
-		snprintf(buf, bufsize, translate("gettextFromC","%s\nCalculated ceiling %.0f %s"), buf2, depthvalue, depth_unit);
-		if (prefs.calc_all_tissues){
-			int k;
-			for (k=0; k<16; k++){
-				if (entry->ceilings[k]){
-					depthvalue = get_depth_units(entry->ceilings[k], NULL, &depth_unit);
-					memcpy(buf2, buf, bufsize);
-					snprintf(buf, bufsize, translate("gettextFromC","%s\nTissue %.0fmin: %.0f %s"), buf2, buehlmann_N2_t_halflife[k], depthvalue, depth_unit);
-				}
-			}
-		}
+		snprintf(buf, bufsize, translate("gettextFromC","%s\nSAC:%2.1fl/min"), buf2, entry->sac / 1000.0);
+	}
+	if (entry->cns) {
+		memcpy(buf2, buf, bufsize);
+		snprintf(buf, bufsize, translate("gettextFromC","%s\nCNS:%u%%"), buf2, entry->cns);
+	}
+	if (prefs.pp_graphs.po2) {
+		memcpy(buf2, buf, bufsize);
+		snprintf(buf, bufsize, translate("gettextFromC","%s\npO%s:%.2fbar"), buf2, UTF8_SUBSCRIPT_2, entry->po2);
+	}
+	if (prefs.pp_graphs.pn2) {
+		memcpy(buf2, buf, bufsize);
+		snprintf(buf, bufsize, translate("gettextFromC","%s\npN%s:%.2fbar"), buf2, UTF8_SUBSCRIPT_2, entry->pn2);
+	}
+	if (prefs.pp_graphs.phe) {
+		memcpy(buf2, buf, bufsize);
+		snprintf(buf, bufsize, translate("gettextFromC","%s\npHe:%.2fbar"), buf2, entry->phe);
+	}
+	if (prefs.mod) {
+		mod = (int)get_depth_units(entry->mod, NULL, &depth_unit);
+		memcpy(buf2, buf, bufsize);
+		snprintf(buf, bufsize, translate("gettextFromC","%s\nMOD:%d%s"), buf2, mod, depth_unit);
+	}
+	if (prefs.ead) {
+		ead = (int)get_depth_units(entry->ead, NULL, &depth_unit);
+		end = (int)get_depth_units(entry->end, NULL, &depth_unit);
+		eadd = (int)get_depth_units(entry->eadd, NULL, &depth_unit);
+		memcpy(buf2, buf, bufsize);
+		snprintf(buf, bufsize, translate("gettextFromC","%s\nEAD:%d%s\nEND:%d%s\nEADD:%d%s"), buf2, ead, depth_unit, end, depth_unit, eadd, depth_unit);
 	}
 	if (entry->stopdepth) {
 		depthvalue = get_depth_units(entry->stopdepth, NULL, &depth_unit);
@@ -1261,10 +1276,6 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize,
 		memcpy(buf2, buf, bufsize);
 		snprintf(buf, bufsize, translate("gettextFromC","%s\nNDL:%umin"), buf2, DIV_UP(entry->ndl, 60));
 	}
-	if (entry->sac && prefs.show_sac) {
-		memcpy(buf2, buf, bufsize);
-		snprintf(buf, bufsize, translate("gettextFromC","%s\nSAC:%2.1fl/min"), buf2, entry->sac / 1000.0);
-	}
 	if (entry->stopdepth_calc) {
 		depthvalue = get_depth_units(entry->stopdepth_calc, NULL, &depth_unit);
 		memcpy(buf2, buf, bufsize);
@@ -1297,33 +1308,20 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize,
 		memcpy(buf2, buf, bufsize);
 		snprintf(buf, bufsize, translate("gettextFromC","%s\nTTS:%umin (calc)"), buf2, DIV_UP(entry->tts_calc, 60));
 	}
-	if (entry->cns) {
-		memcpy(buf2, buf, bufsize);
-		snprintf(buf, bufsize, translate("gettextFromC","%s\nCNS:%u%%"), buf2, entry->cns);
-	}
-	if (prefs.pp_graphs.po2) {
-		memcpy(buf2, buf, bufsize);
-		snprintf(buf, bufsize, translate("gettextFromC","%s\npO%s:%.2fbar"), buf2, UTF8_SUBSCRIPT_2, entry->po2);
-	}
-	if (prefs.pp_graphs.pn2) {
-		memcpy(buf2, buf, bufsize);
-		snprintf(buf, bufsize, translate("gettextFromC","%s\npN%s:%.2fbar"), buf2, UTF8_SUBSCRIPT_2, entry->pn2);
-	}
-	if (prefs.pp_graphs.phe) {
-		memcpy(buf2, buf, bufsize);
-		snprintf(buf, bufsize, translate("gettextFromC","%s\npHe:%.2fbar"), buf2, entry->phe);
-	}
-	if (prefs.mod) {
-		mod = (int)get_depth_units(entry->mod, NULL, &depth_unit);
-		memcpy(buf2, buf, bufsize);
-		snprintf(buf, bufsize, translate("gettextFromC","%s\nMOD:%d%s"), buf2, mod, depth_unit);
-	}
-	if (prefs.ead) {
-		ead = (int)get_depth_units(entry->ead, NULL, &depth_unit);
-		end = (int)get_depth_units(entry->end, NULL, &depth_unit);
-		eadd = (int)get_depth_units(entry->eadd, NULL, &depth_unit);
+	if (entry->ceiling) {
+		depthvalue = get_depth_units(entry->ceiling, NULL, &depth_unit);
 		memcpy(buf2, buf, bufsize);
-		snprintf(buf, bufsize, translate("gettextFromC","%s\nEAD:%d%s\nEND:%d%s\nEADD:%d%s"), buf2, ead, depth_unit, end, depth_unit, eadd, depth_unit);
+		snprintf(buf, bufsize, translate("gettextFromC","%s\nCalculated ceiling %.0f %s"), buf2, depthvalue, depth_unit);
+		if (prefs.calc_all_tissues){
+			int k;
+			for (k=0; k<16; k++){
+				if (entry->ceilings[k]){
+					depthvalue = get_depth_units(entry->ceilings[k], NULL, &depth_unit);
+					memcpy(buf2, buf, bufsize);
+					snprintf(buf, bufsize, translate("gettextFromC","%s\nTissue %.0fmin: %.0f %s"), buf2, buehlmann_N2_t_halflife[k], depthvalue, depth_unit);
+				}
+			}
+		}
 	}
 	free(buf2);
 }
-- 
1.8.3.2



More information about the subsurface mailing list