Changeset cd38cda1 in subsurface


Ignore:
Timestamp:
Feb 4, 2017, 7:06:29 AM (8 weeks ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
2516ae7e
Parents:
911d279
git-author:
Stefan Fuchs <sfuchs@…> (02/04/17 06:52:56)
git-committer:
Dirk Hohndel <dirk@…> (02/04/17 07:06:29)
Message:

Bugfix planner output formating (linebreaks)

Changed the markup with <div> and <br> tags of the planner output in
a way that is is a good compromise for both displaying in UI and
printing.

Signed-off-by: Stefan Fuchs <sfuchs@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/planner.c

    r414d7f2 rcd38cda1  
    580580        }
    581581
    582         len = show_disclaimer ? snprintf(buffer, sz_buffer, "<div><b>%s<b></div><br>", disclaimer) : 0;
     582        len = show_disclaimer ? snprintf(buffer, sz_buffer, "<div><b>%s<b><br></div>", disclaimer) : 0;
    583583
    584584        if (diveplan->surface_interval > 60) {
    585                 len += snprintf(buffer + len, sz_buffer - len, "<div><b>%s %d:%02d)</b></div>",
     585                len += snprintf(buffer + len, sz_buffer - len, "<div><b>%s %d:%02d)</b><br>",
    586586                                translate("gettextFromC", "Subsurface dive plan (surface interval "),
    587587                                FRACTION(diveplan->surface_interval / 60, 60));
    588588        } else {
    589                 len += snprintf(buffer + len, sz_buffer - len, "<div><b>%s</b></div>",
     589                len += snprintf(buffer + len, sz_buffer - len, "<div><b>%s</b><br>",
    590590                                translate("gettextFromC", "Subsurface dive plan"));
    591591        }
    592592
    593         len += snprintf(buffer + len, sz_buffer - len, translate("gettextFromC", "<div>Runtime: %dmin</div><br>"),
     593        len += snprintf(buffer + len, sz_buffer - len, translate("gettextFromC", "Runtime: %dmin<br></div>"),
    594594                        diveplan_duration(diveplan));
    595595
    596596        if (!plan_verbatim) {
    597                 len += snprintf(buffer + len, sz_buffer - len, "<div><table><thead><tr><th></th><th>%s</th>",
     597                len += snprintf(buffer + len, sz_buffer - len, "<table><thead><tr><th></th><th>%s</th>",
    598598                                translate("gettextFromC", "depth"));
    599599                if (plan_display_duration)
     
    788788        } while ((dp = nextdp) != NULL);
    789789        if (!plan_verbatim)
    790                 len += snprintf(buffer + len, sz_buffer - len, "</tbody></table></div>");
     790                len += snprintf(buffer + len, sz_buffer - len, "</tbody></table><br>");
    791791
    792792        /* Print the CNS and OTU next.*/
     
    795795        update_cylinder_related_info(dive);
    796796        snprintf(temp, sz_temp, "%s", translate("gettextFromC", "CNS"));
    797         len += snprintf(buffer + len, sz_buffer - len, "<div><br>%s: %i%%", temp, dive->cns);
     797        len += snprintf(buffer + len, sz_buffer - len, "<div>%s: %i%%", temp, dive->cns);
    798798        snprintf(temp, sz_temp, "%s", translate("gettextFromC", "OTU"));
    799         len += snprintf(buffer + len, sz_buffer - len, "<br>%s: %i</div>", temp, dive->otu);
     799        len += snprintf(buffer + len, sz_buffer - len, "<br>%s: %i<br></div>", temp, dive->otu);
    800800
    801801        /* Print the settings for the diveplan next. */
     
    817817                        diveplan->gflow, diveplan->gfhigh);
    818818        }
    819         len += snprintf(buffer + len, sz_buffer - len, "<div><br>%s</div>",temp);
     819        len += snprintf(buffer + len, sz_buffer - len, "<div>%s<br>",temp);
    820820
    821821        const char *depth_unit;
    822822        int altitude = (int) get_depth_units((int) (log(1013.0 / diveplan->surface_pressure) * 7800000), NULL, &depth_unit);
    823823
    824         len += snprintf(buffer + len, sz_buffer - len, translate("gettextFromC", "<div>ATM pressure: %dmbar (%d%s)</div>"),
     824        len += snprintf(buffer + len, sz_buffer - len, translate("gettextFromC", "ATM pressure: %dmbar (%d%s)<br></div>"),
    825825                        diveplan->surface_pressure,
    826826                        altitude,
     
    844844                snprintf(temp, sz_temp, "%s %.*f|%.*f%s/min):", translate("gettextFromC", "Gas consumption (based on SAC"),
    845845                        sacdecimals, bottomsacvalue, sacdecimals, decosacvalue, sacunit);
    846         len += snprintf(buffer + len, sz_buffer - len, "<div><br>%s<br>", temp);
     846        len += snprintf(buffer + len, sz_buffer - len, "<div>%s<br>", temp);
    847847        for (int gasidx = 0; gasidx < MAX_CYLINDERS; gasidx++) {
    848848                double volume, pressure, deco_volume, deco_pressure;
Note: See TracChangeset for help on using the changeset viewer.