don't offer to edit the coordinates if >1 dive is selected.

On Thu, May 1, 2014 at 1:51 PM, Tomaz Canabrava <tcanabr...@kde.org> wrote:

> mj feelings,
> ok, patches to deal with marble.
>
>
>
From 60fe23d44277ffb2c07a9bef5023ff220189cbd8 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Thu, 1 May 2014 14:44:27 -0300
Subject: [PATCH 3/3] Dont set coordinates when >= 2 dives are selected.

If you selected a trip, this would mess the whole
selection, so only change the coordinates on the
globe if only one dive is selected.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 divelist.c      | 10 ++++++++++
 divelist.h      |  1 +
 qt-ui/globe.cpp | 10 ++++++++--
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/divelist.c b/divelist.c
index f0a66b4..6692085 100644
--- a/divelist.c
+++ b/divelist.c
@@ -1004,3 +1004,13 @@ void process_dives(bool is_imported, bool prefer_imported)
 			mark_divelist_changed(true);
 	}
 }
+
+int get_selected_dive_count()
+{
+	int nrSelectedDives = 0, i = 0;
+	struct dive *d = NULL;
+	for_each_dive(i, d){
+		if (d->selected) nrSelectedDives++;
+	}
+	return nrSelectedDives;
+}
diff --git a/divelist.h b/divelist.h
index ade4ce9..5f91cfb 100644
--- a/divelist.h
+++ b/divelist.h
@@ -30,6 +30,7 @@ extern struct dive *merge_two_dives(struct dive *a, struct dive *b);
 extern bool consecutive_selected();
 extern void select_dive(int idx);
 extern void deselect_dive(int idx);
+extern int get_selected_dive_count();
 void find_new_trip_start_time(dive_trip_t *trip);
 
 #ifdef DEBUG_TRIP
diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp
index e2b37bb..155ee9d 100644
--- a/qt-ui/globe.cpp
+++ b/qt-ui/globe.cpp
@@ -202,14 +202,20 @@ void GlobeGPS::reload()
 void GlobeGPS::centerOn(dive *dive)
 {
 	// dive has changed, if we had the 'editingDive', hide it.
-	if (messageWidget->isVisible() && (!dive || dive_has_gps_location(dive)))
+	int selected_dives = get_selected_dive_count();
+	if (messageWidget->isVisible()
+	  && (!dive || dive_has_gps_location(dive) || selected_dives != 1 ))
 		messageWidget->hide();
+
+	editingDiveLocation = false;
 	if (!dive)
 		return;
+
 	qreal longitude = dive->longitude.udeg / 1000000.0;
 	qreal latitude = dive->latitude.udeg / 1000000.0;
 
-	if (!longitude || !latitude || MainWindow::instance()->information()->isEditing()) {
+	if ((!longitude || !latitude || MainWindow::instance()->information()->isEditing())
+	  && selected_dives == 1) {
 		prepareForGetDiveCoordinates();
 		return;
 	}
-- 
1.9.2

_______________________________________________
subsurface mailing list
subsurface@hohndel.org
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to