From: Linus Torvalds Date: Sun, 4 Sep 2011 18:49:49 +0000 (-0700) Subject: Merge branch 'ui-improvements' of https://github.com/nathansamson/diveclog X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=230a13476d9af732cb60b2c0393feeadb5b39e67;hp=31123f63af0a2b6a9756b8496f56359d1c68a645;p=ext%2Fsubsurface.git Merge branch 'ui-improvements' of https://github.com/nathansamson/diveclog * 'ui-improvements' of https://github.com/nathansamson/diveclog: Split the dive list in columns. Columns are sortable now (name = date, depth, duration) Remove the redundant frames in the notebook. Closes #9 Use a pane so the dive list can be made wider or smaller to the users wishes --- diff --git a/dive.c b/dive.c index 8c81a3d..757622f 100644 --- a/dive.c +++ b/dive.c @@ -34,9 +34,10 @@ struct dive *fixup_dive(struct dive *dive) int lasttime = 0; int start = -1, end = -1; int startpress = 0, endpress = 0; - int starttemp = 0, endtemp = 0; int maxdepth = 0, mintemp = 0; int lastdepth = 0; + int lasttemp = 0; + temperature_t *redundant_temp = NULL; for (i = 0; i < dive->samples; i++) { struct sample *sample = dive->sample + i; @@ -60,9 +61,21 @@ struct dive *fixup_dive(struct dive *dive) startpress = press; } if (temp) { - endtemp = temp; - if (!starttemp) - starttemp = temp; + /* + * If we have consecutive identical + * temperature readings, throw away + * the redundant ones. We care about + * the "edges" only. + */ + if (lasttemp == temp) { + if (redundant_temp) + redundant_temp->mkelvin = 0; + redundant_temp = &sample->temperature; + } else { + redundant_temp = NULL; + lasttemp = temp; + } + if (!mintemp || temp < mintemp) mintemp = temp; } diff --git a/dive.h b/dive.h index c6c545d..2d03ee7 100644 --- a/dive.h +++ b/dive.h @@ -75,6 +75,7 @@ typedef struct { typedef struct { volume_t size; pressure_t workingpressure; + const char *description; /* "LP85", "AL72", "AL80", "HP100+" or whatever */ } cylinder_type_t; typedef struct { diff --git a/save-xml.c b/save-xml.c index 5c05723..c33cbb0 100644 --- a/save-xml.c +++ b/save-xml.c @@ -127,7 +127,6 @@ static void save_cylinder_info(FILE *f, struct dive *dive) for (i = 0; i < MAX_CYLINDERS; i++) { cylinder_t *cylinder = dive->cylinder+i; int volume = cylinder->type.size.mliter; - int pressure = cylinder->type.workingpressure.mbar; int o2 = cylinder->gasmix.o2.permille; int he = cylinder->gasmix.he.permille; @@ -140,11 +139,8 @@ static void save_cylinder_info(FILE *f, struct dive *dive) if (he) fprintf(f, " he='%u.%u%%'", FRACTION(he, 10)); } - if (volume) { + if (volume) fprintf(f, " size='%u.%03u l'", FRACTION(volume, 1000)); - if (pressure) - fprintf(f, " workpressure='%u.%03u bar'", FRACTION(pressure, 1000)); - } fprintf(f, " />\n"); } }