# HG changeset patch # User Teemu Piippo # Date 1410219741 -10800 # Node ID 120cf01d8831e655e7163a272ab857cf3a5d95f0 # Parent 7ad8fb667084e454ff465445562c982c6e14142a# Parent ee0631d7f5d4c3c8f41dc0340063aec2dd7f4ca5 - merged selection optimization from experimental into default diff -r 7ad8fb667084 -r 120cf01d8831 src/actions.cc --- a/src/actions.cc Sun Sep 07 22:55:44 2014 +0300 +++ b/src/actions.cc Tue Sep 09 02:42:21 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(); } // ============================================================================= diff -r 7ad8fb667084 -r 120cf01d8831 src/basics.h diff -r 7ad8fb667084 -r 120cf01d8831 src/glCompiler.cc diff -r 7ad8fb667084 -r 120cf01d8831 src/glShared.h diff -r 7ad8fb667084 -r 120cf01d8831 src/ldDocument.cc diff -r 7ad8fb667084 -r 120cf01d8831 src/ldDocument.h diff -r 7ad8fb667084 -r 120cf01d8831 src/ldObject.cc --- a/src/ldObject.cc Sun Sep 07 22:55:44 2014 +0300 +++ b/src/ldObject.cc Tue Sep 09 02:42:21 2014 +0300 @@ -880,10 +880,12 @@ document().toStrongRef()->addToSelection (self()); // If this object is inverted with INVERTNEXT, pick the INVERTNEXT as well. + /* LDBFCPtr invertnext; if (previousIsInvertnext (invertnext)) invertnext->select(); + */ } // ============================================================================= diff -r 7ad8fb667084 -r 120cf01d8831 src/ldObject.h diff -r 7ad8fb667084 -r 120cf01d8831 src/mainWindow.cc --- a/src/mainWindow.cc Sun Sep 07 22:55:44 2014 +0300 +++ b/src/mainWindow.cc Tue Sep 09 02:42:21 2014 +0300 @@ -562,17 +562,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; }