1143 // Clear the selection if we do not wish to add to it. |
1143 // Clear the selection if we do not wish to add to it. |
1144 if (!m_addpick) |
1144 if (!m_addpick) |
1145 { List<LDObject*> oldsel = g_win->sel(); |
1145 { List<LDObject*> oldsel = g_win->sel(); |
1146 g_win->sel().clear(); |
1146 g_win->sel().clear(); |
1147 |
1147 |
1148 for (LDObject * obj : oldsel) |
1148 for (LDObject* obj : oldsel) |
1149 { obj->setSelected (false); |
1149 { obj->setSelected (false); |
1150 compileObject (obj); |
1150 compileObject (obj); |
1151 } |
1151 } |
1152 } |
1152 } |
1153 |
1153 |
1218 LDObject* obj = LDObject::fromID (idx); |
1218 LDObject* obj = LDObject::fromID (idx); |
1219 |
1219 |
1220 // If this is an additive single pick and the object is currently selected, |
1220 // If this is an additive single pick and the object is currently selected, |
1221 // we remove it from selection instead. |
1221 // we remove it from selection instead. |
1222 if (!m_rangepick && m_addpick) |
1222 if (!m_rangepick && m_addpick) |
1223 { bool removed = false; |
1223 { int pos = g_win->sel().indexOf (obj); |
1224 |
1224 |
1225 for (int i = 0; i < g_win->sel().size(); ++i) |
1225 if (pos != -1) |
1226 { if (g_win->sel() [i] == obj) |
1226 { g_win->sel().removeAt (i); |
1227 { g_win->sel().erase (i); |
1227 obj->setSelected (false); |
1228 obj->setSelected (false); |
1228 removedObj = obj; |
1229 removed = true; |
1229 break; |
1230 removedObj = obj; |
|
1231 } |
|
1232 } |
1230 } |
1233 |
|
1234 if (removed) |
|
1235 break; |
|
1236 } |
1231 } |
1237 |
1232 |
1238 g_win->sel() << obj; |
1233 g_win->sel() << obj; |
1239 } |
1234 } |
1240 |
1235 |
1241 delete[] pixeldata; |
1236 delete[] pixeldata; |
1242 |
1237 |
1243 // Remove duplicated entries |
1238 // Remove duplicated entries |
1244 g_win->sel().makeUnique(); |
1239 removeDuplicates (g_win->sel()); |
1245 |
1240 |
1246 // Update everything now. |
1241 // Update everything now. |
1247 g_win->updateSelection(); |
1242 g_win->updateSelection(); |
1248 |
1243 |
1249 // Recompile the objects now to update their color |
1244 // Recompile the objects now to update their color |
1250 for (LDObject * obj : g_win->sel()) |
1245 for (LDObject* obj : g_win->sel()) |
1251 compileObject (obj); |
1246 compileObject (obj); |
1252 |
1247 |
1253 if (removedObj) |
1248 if (removedObj) |
1254 compileObject (removedObj); |
1249 compileObject (removedObj); |
1255 |
1250 |
1536 } |
1531 } |
1537 |
1532 |
1538 // Mark in known vertices of this object |
1533 // Mark in known vertices of this object |
1539 List<vertex> verts = getVertices (obj); |
1534 List<vertex> verts = getVertices (obj); |
1540 m_knownVerts << verts; |
1535 m_knownVerts << verts; |
1541 m_knownVerts.makeUnique(); |
1536 removeDuplicates (m_knownVerts); |
1542 |
1537 |
1543 obj->m_glinit = true; |
1538 obj->m_glinit = true; |
1544 } |
1539 } |
1545 |
1540 |
1546 // ============================================================================= |
1541 // ============================================================================= |