mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-20 06:45:27 +00:00
Change EDIT_SELECTED_DIVES macro
The way this is implemented is broken in several ways. This fixes the first issue. For the invocations where we are in the 'WHAT' checking to see if the value we are changing in the selected dive was previously the same as in the current dive (which is the one shown to the user for editing), then we need to make sure we change the current dive last, otherwise the comparison will fail. Of course, right now we only do this check for gps location, which is a massive bug as far as I am concerned. Fixes #515 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
223d99f79f
commit
217c82f6c4
1 changed files with 11 additions and 4 deletions
|
@ -836,20 +836,27 @@ void MainTab::rejectChanges()
|
|||
}
|
||||
#undef EDIT_TEXT2
|
||||
|
||||
// tricky little macro to edit all the selected dives
|
||||
// loop over all dives, for each selected dive do WHAT, but do it
|
||||
// last for the current dive; this is required in case the invocation
|
||||
// wants to compare things to the original value in current_dive like it should
|
||||
#define EDIT_SELECTED_DIVES(WHAT) \
|
||||
do { \
|
||||
struct dive *mydive = NULL; \
|
||||
if (editMode == NONE) \
|
||||
return; \
|
||||
\
|
||||
\
|
||||
for (int _i = 0; _i < dive_table.nr; _i++) { \
|
||||
struct dive *mydive = get_dive(_i); \
|
||||
if (!mydive) \
|
||||
mydive = get_dive(_i); \
|
||||
if (!mydive || mydive == current_dive)\
|
||||
continue; \
|
||||
if (!mydive->selected) \
|
||||
continue; \
|
||||
\
|
||||
\
|
||||
WHAT; \
|
||||
} \
|
||||
mydive = current_dive; \
|
||||
WHAT; \
|
||||
} while (0)
|
||||
|
||||
void markChangedWidget(QWidget *w)
|
||||
|
|
Loading…
Add table
Reference in a new issue