Changeset 1c153a9d in OpenModelica


Ignore:
Timestamp:
2020-11-11T16:05:46+01:00 (4 years ago)
Author:
Adeel Asghar <adeel.asghar@…>
Branches:
Added-citation-metadata, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
Children:
060e22d0, 86acb37, d58083b8, ddd9636, f10cce6
Parents:
94032733
git-author:
Adeel Asghar <adeel.asghar@…> (11/11/20 15:40:18)
git-committer:
Adeel Asghar <adeel.asghar@…> (11/11/20 16:05:46)
Message:

Call update when shapes are resized

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OMEdit/OMEditLIB/Annotations/ShapeAnnotation.cpp

    rf62cc7f r1c153a9d  
    15441544void ShapeAnnotation::cornerItemReleased(const bool changed)
    15451545{
    1546   Q_ASSERT(!mOldAnnotation.isEmpty());
     1546  assert(!mOldAnnotation.isEmpty());
    15471547
    15481548  if (changed) {
     
    15501550    LineAnnotation *pLineAnnotation = dynamic_cast<LineAnnotation*>(this);
    15511551
    1552     if (pLineAnnotation) {
    1553       if (pModelWidget->getLibraryTreeItem()->getLibraryType() == LibraryTreeItem::OMS) {
     1552    if (pModelWidget->getLibraryTreeItem()->getLibraryType() == LibraryTreeItem::OMS) {
     1553      if (pLineAnnotation) {
    15541554        pLineAnnotation->updateOMSConnection();
    15551555        pModelWidget->createOMSimulatorUndoCommand(QString("Update OMS Connection connect(%1, %2)").arg(pLineAnnotation->getStartComponentName(), pLineAnnotation->getEndComponentName()));
    15561556        pModelWidget->updateModelText();
     1557      }
     1558    } else {
     1559      if (pLineAnnotation && pLineAnnotation->getLineType() == LineAnnotation::ConnectionType) {
     1560        manhattanizeShape(false);
     1561        removeRedundantPointsGeometriesAndCornerItems();
     1562        // Call getOMCShapeAnnotation() after manhattanizeShape() and removeRedundantPointsGeometriesAndCornerItems() to get a correct new annotation
     1563        QString newAnnotation = getOMCShapeAnnotation();
     1564        pModelWidget->getUndoStack()->push(new UpdateConnectionCommand(pLineAnnotation, mOldAnnotation, newAnnotation));
     1565      } else if (pLineAnnotation && pLineAnnotation->getLineType() == LineAnnotation::TransitionType) {
     1566        manhattanizeShape(false);
     1567        removeRedundantPointsGeometriesAndCornerItems();
     1568        QString newAnnotation = getOMCShapeAnnotation();
     1569        pModelWidget->getUndoStack()->push(new UpdateTransitionCommand(pLineAnnotation, pLineAnnotation->getCondition(), pLineAnnotation->getImmediate(),
     1570                                                                       pLineAnnotation->getReset(), pLineAnnotation->getSynchronize(), pLineAnnotation->getPriority(),
     1571                                                                       mOldAnnotation, pLineAnnotation->getCondition(), pLineAnnotation->getImmediate(),
     1572                                                                       pLineAnnotation->getReset(), pLineAnnotation->getSynchronize(), pLineAnnotation->getPriority(), newAnnotation));
    15571573      } else {
    1558         if (pLineAnnotation->getLineType() == LineAnnotation::ConnectionType) {
    1559           manhattanizeShape(false);
    1560           removeRedundantPointsGeometriesAndCornerItems();
    1561           // Call getOMCShapeAnnotation() after manhattanizeShape() and removeRedundantPointsGeometriesAndCornerItems() to get a correct new annotation
    1562           QString newAnnotation = getOMCShapeAnnotation();
    1563           pModelWidget->getUndoStack()->push(new UpdateConnectionCommand(pLineAnnotation, mOldAnnotation, newAnnotation));
    1564         } else if (pLineAnnotation && pLineAnnotation->getLineType() == LineAnnotation::TransitionType) {
    1565           manhattanizeShape(false);
    1566           removeRedundantPointsGeometriesAndCornerItems();
    1567           QString newAnnotation = getOMCShapeAnnotation();
    1568           pModelWidget->getUndoStack()->push(new UpdateTransitionCommand(pLineAnnotation, pLineAnnotation->getCondition(), pLineAnnotation->getImmediate(),
    1569                                                                          pLineAnnotation->getReset(), pLineAnnotation->getSynchronize(), pLineAnnotation->getPriority(),
    1570                                                                          mOldAnnotation, pLineAnnotation->getCondition(), pLineAnnotation->getImmediate(),
    1571                                                                          pLineAnnotation->getReset(), pLineAnnotation->getSynchronize(), pLineAnnotation->getPriority(), newAnnotation));
    1572         } else {
    1573           QString newAnnotation = getOMCShapeAnnotation();
    1574           pModelWidget->getUndoStack()->push(new UpdateShapeCommand(this, mOldAnnotation, newAnnotation));
    1575           pModelWidget->updateClassAnnotationIfNeeded();
    1576         }
    1577         pModelWidget->updateModelText();
     1574        QString newAnnotation = getOMCShapeAnnotation();
     1575        pModelWidget->getUndoStack()->push(new UpdateShapeCommand(this, mOldAnnotation, newAnnotation));
     1576        pModelWidget->updateClassAnnotationIfNeeded();
    15781577      }
     1578      pModelWidget->updateModelText();
    15791579    }
    15801580  } else {
Note: See TracChangeset for help on using the changeset viewer.