| 252 } |
252 } |
| 253 |
253 |
| 254 void ViewToolset::jumpTo() |
254 void ViewToolset::jumpTo() |
| 255 { |
255 { |
| 256 bool ok; |
256 bool ok; |
| 257 int defval = 0; |
257 int defaultValue = (length(selectedObjects()) == 1) ? selectedObjects()[0]->lineNumber() : 0; |
| 258 LDObject* obj; |
258 int index = QInputDialog::getInt (nullptr, "Go to line", "Go to line:", defaultValue, 1, currentDocument()->getObjectCount(), 1, &ok); |
| 259 |
259 |
| 260 if (selectedObjects().size() == 1) |
260 if (ok) |
| 261 defval = selectedObjects()[0]->lineNumber(); |
261 { |
| 262 |
262 LDObject *object = currentDocument()->getObject(index - 1); |
| 263 int idx = QInputDialog::getInt (nullptr, "Go to line", "Go to line:", defval, |
263 |
| 264 1, currentDocument()->getObjectCount(), 1, &ok); |
264 if (object) |
| 265 |
265 { |
| 266 if (not ok or (obj = currentDocument()->getObject (idx - 1)) == nullptr) |
266 currentDocument()->clearSelection(); |
| 267 return; |
267 object->select(); |
| 268 |
268 m_window->updateSelection(); |
| 269 currentDocument()->clearSelection(); |
269 } |
| 270 obj->select(); |
270 } |
| 271 m_window->updateSelection(); |
|
| 272 } |
271 } |
| 273 |
272 |
| 274 void ViewToolset::randomColors() |
273 void ViewToolset::randomColors() |
| 275 { |
274 { |
| 276 m_config->toggleRandomColors(); |
275 m_config->toggleRandomColors(); |