src/toolsets/algorithmtoolset.cpp

changeset 1259
0384b1d49786
parent 1258
f5921a474d57
child 1263
0256edecda54
equal deleted inserted replaced
1258:f5921a474d57 1259:0384b1d49786
304 } 304 }
305 305
306 return false; 306 return false;
307 } 307 }
308 308
309 LDObject* AlgorithmToolset::next(LDObject* object)
310 {
311 QModelIndex index = currentDocument()->indexOf(object);
312
313 if (index.isValid())
314 return currentDocument()->getObject(index.row() + 1);
315 else
316 return nullptr;
317 }
318
309 void AlgorithmToolset::autocolor() 319 void AlgorithmToolset::autocolor()
310 { 320 {
311 LDColor color; 321 LDColor color;
312 322
313 for (color = 0; color.isLDConfigColor(); ++color) 323 for (color = 0; color.isLDConfigColor(); ++color)
349 if (not dialog.exec()) 359 if (not dialog.exec())
350 return; 360 return;
351 361
352 // Find a spot to place the new comment 362 // Find a spot to place the new comment
353 for (obj = currentDocument()->getObject (0); 363 for (obj = currentDocument()->getObject (0);
354 obj and obj->next() and not obj->next()->isScemantic(); 364 obj and next(obj) and not next(obj)->isScemantic();
355 obj = obj->next()) 365 obj = next(obj))
356 { 366 {
357 LDComment* comment = dynamic_cast<LDComment*> (obj); 367 LDComment* comment = dynamic_cast<LDComment*> (obj);
358 368
359 if (comment and comment->text().startsWith ("!HISTORY ")) 369 if (comment and comment->text().startsWith ("!HISTORY "))
360 ishistory = true; 370 ishistory = true;
373 ui.m_username->text(), 383 ui.m_username->text(),
374 ui.m_comment->text())); 384 ui.m_comment->text()));
375 385
376 // If we're adding a history line right before a scemantic object, pad it 386 // If we're adding a history line right before a scemantic object, pad it
377 // an empty line 387 // an empty line
378 if (obj and obj->next() and obj->next()->isScemantic()) 388 if (obj and next(obj) and next(obj)->isScemantic())
379 currentDocument()->emplaceAt<LDEmpty>(idx); 389 currentDocument()->emplaceAt<LDEmpty>(idx);
380 } 390 }
381 391
382 void AlgorithmToolset::splitLines() 392 void AlgorithmToolset::splitLines()
383 { 393 {

mercurial