[PATCH] Added a dive add/edit/delete dialog

Lubomir I. Ivanov neolit123 at gmail.com
Fri Nov 11 07:02:42 PST 2011


----- Original Message ----- 
From: "John Van Ostrand" <john at netdirect.ca>
To: <subsurface at hohndel.org>
Sent: Friday, November 11, 2011 3:06 PM
Subject: [PATCH] Added a dive add/edit/delete dialog

> Dives can now be manually entered, altered and deleted. A new edit menu
> option exists that provides three options, Add, Edit and Delete dive.
>

the new dialog looks useful,
i was working on delete functionality, but didn't go that far.

a couple of notes on the patch:
1)
"tm.tm_gmtoff" and "tm.tm_zone" aren't really part of the c99 standard and
therefore there are some issues with those. they either have different
deffinitions for different compilers and library implementations or are simply
missing - like in the case of mingw/win32 (there are some workaround which
aren't pretty).

<snip>
/* Zero out unused tm members so comparison works. */
detail->data.when.tm_gmtoff = 0;
...
</snip>
perhaps an initial "memset(...,0,sizeof(tm));" somewhere will do ?

2)
<snip>
..time_of_day_widget(.......,uint hour, uint min, uint sec)
</snip>

i don't think "uint" is part of the standard as well. "uint32_t" from "stdint.h"
should be much more portable...or simply "unsigned int" i guess.

3)
you could add some keyboard and mouse interaction in the list.
this is the "double click" / "click" action that could open the edit dialog:
https://github.com/neolit123/subsurface/blob/lubo/divelist.c#L527

dive_list_delete_selected(...) clears multiple entries from the list (not from
memory though..)
https://github.com/neolit123/subsurface/blob/lubo/divelist.c#L498
key_cb handles the delete key:
https://github.com/neolit123/subsurface/blob/lubo/divelist.c#L544
it should show the yes/no dialog as well.

lubomir



More information about the subsurface mailing list