251 if (getCurrentDocument()) |
251 if (getCurrentDocument()) |
252 { |
252 { |
253 title += ": "; |
253 title += ": "; |
254 title += getCurrentDocument()->getDisplayName(); |
254 title += getCurrentDocument()->getDisplayName(); |
255 |
255 |
256 if (getCurrentDocument()->getObjectCount() > 0 && |
256 if (getCurrentDocument()->getObjectCount() > 0 and |
257 getCurrentDocument()->getObject (0)->type() == OBJ_Comment) |
257 getCurrentDocument()->getObject (0)->type() == OBJ_Comment) |
258 { |
258 { |
259 // Append title |
259 // Append title |
260 LDCommentPtr comm = getCurrentDocument()->getObject (0).staticCast<LDComment>(); |
260 LDCommentPtr comm = getCurrentDocument()->getObject (0).staticCast<LDComment>(); |
261 title += format (": %1", comm->text()); |
261 title += format (": %1", comm->text()); |
408 if (obj->type() == OBJ_Error) |
408 if (obj->type() == OBJ_Error) |
409 { |
409 { |
410 item->setBackground (QColor ("#AA0000")); |
410 item->setBackground (QColor ("#AA0000")); |
411 item->setForeground (QColor ("#FFAA00")); |
411 item->setForeground (QColor ("#FFAA00")); |
412 } |
412 } |
413 elif (cfg::colorizeObjectsList && obj->isColored() && |
413 elif (cfg::colorizeObjectsList and obj->isColored() and |
414 obj->color() != null && obj->color() != maincolor() && obj->color() != edgecolor()) |
414 obj->color() != null and obj->color() != maincolor() and obj->color() != edgecolor()) |
415 { |
415 { |
416 // If the object isn't in the main or edge color, draw this |
416 // If the object isn't in the main or edge color, draw this |
417 // list entry in said color. |
417 // list entry in said color. |
418 item->setForeground (obj->color().faceColor()); |
418 item->setForeground (obj->color().faceColor()); |
419 } |
419 } |
440 |
440 |
441 // ============================================================================= |
441 // ============================================================================= |
442 // |
442 // |
443 void MainWindow::slot_selectionChanged() |
443 void MainWindow::slot_selectionChanged() |
444 { |
444 { |
445 if (g_isSelectionLocked == true || getCurrentDocument() == null) |
445 if (g_isSelectionLocked == true or getCurrentDocument() == null) |
446 return; |
446 return; |
447 |
447 |
448 LDObjectList priorSelection = selection(); |
448 LDObjectList priorSelection = selection(); |
449 |
449 |
450 // Get the objects from the object list selection |
450 // Get the objects from the object list selection |
573 for (LDObjectPtr obj : selection()) |
573 for (LDObjectPtr obj : selection()) |
574 { |
574 { |
575 if (not obj->isColored()) |
575 if (not obj->isColored()) |
576 continue; // doesn't use color |
576 continue; // doesn't use color |
577 |
577 |
578 if (result != null && obj->color() != result) |
578 if (result != null and obj->color() != result) |
579 return null; // No consensus in object color |
579 return null; // No consensus in object color |
580 |
580 |
581 if (result == null) |
581 if (result == null) |
582 result = obj->color(); |
582 result = obj->color(); |
583 } |
583 } |
717 bool MainWindow::save (LDDocumentPtr doc, bool saveAs) |
717 bool MainWindow::save (LDDocumentPtr doc, bool saveAs) |
718 { |
718 { |
719 QString path = doc->fullPath(); |
719 QString path = doc->fullPath(); |
720 int64 savesize; |
720 int64 savesize; |
721 |
721 |
722 if (saveAs || path.isEmpty()) |
722 if (saveAs or path.isEmpty()) |
723 { |
723 { |
724 QString name = doc->defaultName(); |
724 QString name = doc->defaultName(); |
725 |
725 |
726 if (not doc->fullPath().isEmpty()) |
726 if (not doc->fullPath().isEmpty()) |
727 name = doc->fullPath(); |
727 name = doc->fullPath(); |
843 { |
843 { |
844 std::map<LDColor, int> counts; |
844 std::map<LDColor, int> counts; |
845 |
845 |
846 for (LDObjectPtr obj : getCurrentDocument()->objects()) |
846 for (LDObjectPtr obj : getCurrentDocument()->objects()) |
847 { |
847 { |
848 if (not obj->isColored() || obj->color() == null) |
848 if (not obj->isColored() or obj->color() == null) |
849 continue; |
849 continue; |
850 |
850 |
851 if (counts.find (obj->color()) == counts.end()) |
851 if (counts.find (obj->color()) == counts.end()) |
852 counts[obj->color()] = 1; |
852 counts[obj->color()] = 1; |
853 else |
853 else |
965 |
965 |
966 // ============================================================================= |
966 // ============================================================================= |
967 // |
967 // |
968 void MainWindow::updateActions() |
968 void MainWindow::updateActions() |
969 { |
969 { |
970 if (getCurrentDocument() != null && getCurrentDocument()->history() != null) |
970 if (getCurrentDocument() != null and getCurrentDocument()->history() != null) |
971 { |
971 { |
972 History* his = getCurrentDocument()->history(); |
972 History* his = getCurrentDocument()->history(); |
973 int pos = his->position(); |
973 int pos = his->position(); |
974 ui->actionUndo->setEnabled (pos != -1); |
974 ui->actionUndo->setEnabled (pos != -1); |
975 ui->actionRedo->setEnabled (pos < (long) his->getSize() - 1); |
975 ui->actionRedo->setEnabled (pos < (long) his->getSize() - 1); |