- merged with default experimental

Tue, 09 Sep 2014 02:44:02 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Tue, 09 Sep 2014 02:44:02 +0300
branch
experimental
changeset 895
f0d14f16ae87
parent 891
00d76b281021 (current diff)
parent 894
120cf01d8831 (diff)
child 905
ed4163b265b3
child 911
5209474e9f38

- merged with default

src/ldObject.cc file | annotate | diff | comparison | revisions
src/mainWindow.cc file | annotate | diff | comparison | revisions
--- a/src/actions.cc	Tue Sep 09 01:17:36 2014 +0300
+++ b/src/actions.cc	Tue Sep 09 02:44:02 2014 +0300
@@ -268,9 +268,6 @@
 {
 	for (LDObjectPtr obj : CurrentDocument()->objects())
 		obj->select();
-
-	ui->objectList->selectAll();
-	refresh();
 }
 
 // =============================================================================
@@ -296,9 +293,6 @@
 		if (colors.contains (obj->color()))
 			obj->select();
 	}
-
-	updateSelection();
-	refresh();
 }
 
 // =============================================================================
@@ -336,9 +330,6 @@
 
 		obj->select();
 	}
-
-	updateSelection();
-	refresh();
 }
 
 // =============================================================================
--- a/src/ldObject.cc	Tue Sep 09 01:17:36 2014 +0300
+++ b/src/ldObject.cc	Tue Sep 09 02:44:02 2014 +0300
@@ -896,10 +896,12 @@
 	document().toStrongRef()->addToSelection (self());
 
 	// If this object is inverted with INVERTNEXT, pick the INVERTNEXT as well.
+	/*
 	LDBFCPtr invertnext;
 
 	if (previousIsInvertnext (invertnext))
 		invertnext->select();
+	*/
 }
 
 // =============================================================================
--- a/src/mainWindow.cc	Tue Sep 09 01:17:36 2014 +0300
+++ b/src/mainWindow.cc	Tue Sep 09 02:44:02 2014 +0300
@@ -560,17 +560,41 @@
 void MainWindow::updateSelection()
 {
 	g_isSelectionLocked = true;
-
-	ui->objectList->clearSelection();
+	QItemSelection itemselect;
+	int top = -1;
+	int bottom = -1;
 
 	for (LDObjectPtr obj : Selection())
 	{
 		if (obj->qObjListEntry == null)
 			continue;
 
-		obj->qObjListEntry->setSelected (true);
+		int row = ui->objectList->row (obj->qObjListEntry);
+
+		if (top == -1)
+		{
+			top = bottom = row;
+		}
+		else
+		{
+			if (row != bottom + 1)
+			{
+				itemselect.select (ui->objectList->model()->index (top, 0),
+					ui->objectList->model()->index (bottom, 0));
+				top = -1;
+			}
+
+			bottom = row;
+		}
 	}
 
+	if (top != -1)
+	{
+		itemselect.select (ui->objectList->model()->index (top, 0),
+			ui->objectList->model()->index (bottom, 0));
+	}
+
+	ui->objectList->selectionModel()->select (itemselect, QItemSelectionModel::ClearAndSelect);
 	g_isSelectionLocked = false;
 }
 

mercurial