src/toolsets/viewtoolset.cpp

changeset 1073
a0a0d581309b
parent 1072
9ce9496427f2
child 1083
5903cfa6b4d9
equal deleted inserted replaced
1072:9ce9496427f2 1073:a0a0d581309b
33 Toolset (parent) {} 33 Toolset (parent) {}
34 34
35 void ViewToolset::selectAll() 35 void ViewToolset::selectAll()
36 { 36 {
37 for (LDObject* obj : currentDocument()->objects()) 37 for (LDObject* obj : currentDocument()->objects())
38 obj->select(); 38 currentDocument()->addToSelection(obj);
39 } 39 }
40 40
41 void ViewToolset::selectByColor() 41 void ViewToolset::selectByColor()
42 { 42 {
43 if (selectedObjects().isEmpty()) 43 if (selectedObjects().isEmpty())
54 currentDocument()->clearSelection(); 54 currentDocument()->clearSelection();
55 55
56 for (LDObject* obj : currentDocument()->objects()) 56 for (LDObject* obj : currentDocument()->objects())
57 { 57 {
58 if (colors.contains (obj->color())) 58 if (colors.contains (obj->color()))
59 obj->select(); 59 currentDocument()->addToSelection(obj);
60 } 60 }
61 } 61 }
62 62
63 void ViewToolset::selectByType() 63 void ViewToolset::selectByType()
64 { 64 {
90 and not subfilenames.contains (static_cast<LDSubfileReference*> (obj)->fileInfo()->name())) 90 and not subfilenames.contains (static_cast<LDSubfileReference*> (obj)->fileInfo()->name()))
91 { 91 {
92 continue; 92 continue;
93 } 93 }
94 94
95 obj->select(); 95 currentDocument()->addToSelection(obj);
96 } 96 }
97 } 97 }
98 98
99 void ViewToolset::resetView() 99 void ViewToolset::resetView()
100 { 100 {
252 } 252 }
253 253
254 void ViewToolset::jumpTo() 254 void ViewToolset::jumpTo()
255 { 255 {
256 bool ok; 256 bool ok;
257 int defaultValue = (countof(selectedObjects()) == 1) ? selectedObjects()[0]->lineNumber() : 0; 257 int defaultValue = (countof(selectedObjects()) == 1) ? (*selectedObjects().begin())->lineNumber() : 0;
258 int index = QInputDialog::getInt (nullptr, "Go to line", "Go to line:", defaultValue, 1, currentDocument()->getObjectCount(), 1, &ok); 258 int index = QInputDialog::getInt (nullptr, "Go to line", "Go to line:", defaultValue, 1, currentDocument()->getObjectCount(), 1, &ok);
259 259
260 if (ok) 260 if (ok)
261 { 261 {
262 LDObject *object = currentDocument()->getObject(index - 1); 262 LDObject *object = currentDocument()->getObject(index - 1);
263 263
264 if (object) 264 if (object)
265 { 265 {
266 currentDocument()->clearSelection(); 266 currentDocument()->clearSelection();
267 object->select(); 267 currentDocument()->addToSelection(object);
268 m_window->updateSelection(); 268 m_window->updateSelection();
269 } 269 }
270 } 270 }
271 } 271 }
272 272

mercurial