Planner notes ICD: Format HTML with DIV, do table title differently

In the planner notes format the HTML for different sections with
div tags.

Put the table title for the ICD table outside the table because then the
alignment looks a little bit nicer.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
Stefan Fuchs 2018-01-20 13:59:41 +01:00 committed by Robert C. Helling
parent d3bcf02bbc
commit 81e9b230ca

View file

@ -168,10 +168,9 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
if ((dive->cylinder[icyl].cylinder_use == OC_GAS) && (get_he(&dive->cylinder[icyl].gasmix) > 0)) { if ((dive->cylinder[icyl].cylinder_use == OC_GAS) && (get_he(&dive->cylinder[icyl].gasmix) > 0)) {
istrimix = true; istrimix = true;
icdlen = 0; icdlen = 0;
icdlen += snprintf(icdbuffer + icdlen, sz_icdbuf - icdlen, icdlen += snprintf(icdbuffer + icdlen, sz_icdbuf - icdlen, "<div>%s:",
"<table><tbody style='float: left;'><tr><td colspan=5>%s:</td></tr>",
translate("gettextFromC","Isobaric counterdiffusion information")); translate("gettextFromC","Isobaric counterdiffusion information"));
icdlen += snprintf(icdbuffer + icdlen, sz_icdbuf - icdlen, "<tr><td align='left'><b>%s</b></td>", icdlen += snprintf(icdbuffer + icdlen, sz_icdbuf - icdlen, "<table><tr><td align='left'><b>%s</b></td>",
translate("gettextFromC", "runtime")); translate("gettextFromC", "runtime"));
icdlen += snprintf(icdbuffer + icdlen, sz_icdbuf - icdlen, "<td align='center'><b>%s</b></td>", icdlen += snprintf(icdbuffer + icdlen, sz_icdbuf - icdlen, "<td align='center'><b>%s</b></td>",
translate("gettextFromC", "gaschange")); translate("gettextFromC", "gaschange"));
@ -534,7 +533,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
} }
} }
/* Gas consumption: Now finally print all strings to output */ /* Gas consumption: Now finally print all strings to output */
len += snprintf(buffer + len, sz_buffer - len, "%s%s%s<br>", temp, warning, mingas); len += snprintf(buffer + len, sz_buffer - len, "%s%s%s<br></div>", temp, warning, mingas);
} }
/* For trimix OC dives, add the ICD table here */ /* For trimix OC dives, add the ICD table here */
@ -546,7 +545,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
translate("gettextFromC", "Warning:"), translate("gettextFromC", "Warning:"),
translate("gettextFromC", "Isobaric counterdiffusion conditions exceeded")); translate("gettextFromC", "Isobaric counterdiffusion conditions exceeded"));
} }
len += snprintf(buffer + len, sz_buffer - len, "<br>"); // ... and add a line break len += snprintf(buffer + len, sz_buffer - len, "<br></div>");
} }
/* Print warnings for pO2 */ /* Print warnings for pO2 */
@ -564,7 +563,8 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
int decimals; int decimals;
double depth_value = get_depth_units(dp->depth.mm, &decimals, &depth_unit); double depth_value = get_depth_units(dp->depth.mm, &decimals, &depth_unit);
len = strlen(buffer); len = strlen(buffer);
if (!o2warning_exist) len += snprintf(buffer + len, sz_buffer - len, "<br>"); if (!o2warning_exist)
len += snprintf(buffer + len, sz_buffer - len, "<div>");
o2warning_exist = true; o2warning_exist = true;
snprintf(temp, sz_temp, snprintf(temp, sz_temp,
translate("gettextFromC", "high pO₂ value %.2f at %d:%02u with gas %s at depth %.*f %s"), translate("gettextFromC", "high pO₂ value %.2f at %d:%02u with gas %s at depth %.*f %s"),
@ -576,7 +576,8 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
int decimals; int decimals;
double depth_value = get_depth_units(dp->depth.mm, &decimals, &depth_unit); double depth_value = get_depth_units(dp->depth.mm, &decimals, &depth_unit);
len = strlen(buffer); len = strlen(buffer);
if (!o2warning_exist) len += snprintf(buffer + len, sz_buffer - len, "<br>"); if (!o2warning_exist)
len += snprintf(buffer + len, sz_buffer - len, "<div>");
o2warning_exist = true; o2warning_exist = true;
snprintf(temp, sz_temp, snprintf(temp, sz_temp,
translate("gettextFromC", "low pO₂ value %.2f at %d:%02u with gas %s at depth %.*f %s"), translate("gettextFromC", "low pO₂ value %.2f at %d:%02u with gas %s at depth %.*f %s"),