4646 */
4747/* !
4848 * \brief ComponentInfo::ComponentInfo
49- * \param value
5049 * \param pParent
5150 */
52- ComponentInfo::ComponentInfo (QString value, QObject *pParent)
51+ ComponentInfo::ComponentInfo (QObject *pParent)
5352 : QObject(pParent)
5453{
5554 mClassName = " " ;
@@ -63,17 +62,52 @@ ComponentInfo::ComponentInfo(QString value, QObject *pParent)
6362 mVariabilityMap .insert (" constant" , " constant" );
6463 mVariabilityMap .insert (" discrete" , " discrete" );
6564 mVariabilityMap .insert (" parameter" , " parameter" );
66- mVariabilityMap .insert (" unspecified" , " default " );
65+ mVariabilityMap .insert (" unspecified" , " " );
6766 mVariability = " " ;
6867 mIsInner = false ;
6968 mIsOuter = false ;
7069 mCasualityMap .insert (" input" , " input" );
7170 mCasualityMap .insert (" output" , " output" );
72- mCasualityMap .insert (" unspecified" , " none " );
71+ mCasualityMap .insert (" unspecified" , " " );
7372 mCasuality = " " ;
7473 mArrayIndex = " " ;
7574 mIsArray = false ;
76- parseComponentInfoString (value);
75+ }
76+
77+ /* !
78+ * \brief ComponentInfo::ComponentInfo
79+ * \param pComponentInfo
80+ * \param pParent
81+ */
82+ ComponentInfo::ComponentInfo (ComponentInfo *pComponentInfo, QObject *pParent)
83+ : QObject(pParent)
84+ {
85+ updateComponentInfo (pComponentInfo);
86+ }
87+
88+ void ComponentInfo::updateComponentInfo (const ComponentInfo *pComponentInfo)
89+ {
90+ mClassName = pComponentInfo->getClassName ();
91+ mName = pComponentInfo->getName ();
92+ mComment = pComponentInfo->getComment ();
93+ mIsProtected = pComponentInfo->getProtected ();
94+ mIsFinal = pComponentInfo->getFinal ();
95+ mIsFlow = pComponentInfo->getFlow ();
96+ mIsStream = pComponentInfo->getStream ();
97+ mIsReplaceable = pComponentInfo->getReplaceable ();
98+ mVariabilityMap .insert (" constant" , " constant" );
99+ mVariabilityMap .insert (" discrete" , " discrete" );
100+ mVariabilityMap .insert (" parameter" , " parameter" );
101+ mVariabilityMap .insert (" unspecified" , " " );
102+ mVariability = pComponentInfo->getVariablity ();
103+ mIsInner = pComponentInfo->getInner ();
104+ mIsOuter = pComponentInfo->getOuter ();
105+ mCasualityMap .insert (" input" , " input" );
106+ mCasualityMap .insert (" output" , " output" );
107+ mCasualityMap .insert (" unspecified" , " " );
108+ mCasuality = pComponentInfo->getCausality ();
109+ mArrayIndex = pComponentInfo->getArrayIndex ();
110+ mIsArray = pComponentInfo->isArray ();
77111}
78112
79113/* !
@@ -733,7 +767,7 @@ void Component::applyRotation(qreal angle)
733767 angle = 0 ;
734768 }
735769 mTransformation .setRotateAngle (angle);
736- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentCommand (this , oldTransformation, mTransformation , mpGraphicsView ));
770+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentTransformationsCommand (this , oldTransformation, mTransformation ));
737771}
738772
739773void Component::addConnectionDetails (LineAnnotation *pConnectorLineAnnotation)
@@ -979,8 +1013,6 @@ void Component::updatePlacementAnnotation()
9791013 pOMCProxy->updateComponent (mpComponentInfo->getName (), mpComponentInfo->getClassName (),
9801014 mpGraphicsView->getModelWidget ()->getLibraryTreeItem ()->getNameStructure (), getPlacementAnnotation ());
9811015 }
982- // set the model modified
983- mpGraphicsView->getModelWidget ()->setModelModified ();
9841016 /* When something is changed in the icon layer then update the LibraryTreeItem in the Library Browser */
9851017 if (mpGraphicsView->getViewType () == StringHandler::Icon) {
9861018 mpGraphicsView->getModelWidget ()->getLibraryTreeItem ()->handleIconUpdated ();
@@ -1218,7 +1250,8 @@ void Component::finishResizeComponent()
12181250 */
12191251void Component::resizedComponent ()
12201252{
1221- UpdateComponentCommand *pUpdateComponentCommand = new UpdateComponentCommand (this , mOldTransformation , mTransformation , mpGraphicsView);
1253+ UpdateComponentTransformationsCommand *pUpdateComponentCommand = new UpdateComponentTransformationsCommand (this , mOldTransformation ,
1254+ mTransformation );
12221255 mpGraphicsView->getModelWidget ()->getUndoStack ()->push (pUpdateComponentCommand);
12231256 mpGraphicsView->getModelWidget ()->updateModelicaText ();
12241257}
@@ -1297,7 +1330,7 @@ void Component::flipHorizontal()
12971330 mTransformation .setExtent1 (QPointF (extent1.x (), extent2.y ()));
12981331 mTransformation .setExtent2 (QPointF (extent2.x (), extent1.y ()));
12991332 }
1300- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentCommand (this , oldTransformation, mTransformation , mpGraphicsView ));
1333+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentTransformationsCommand (this , oldTransformation, mTransformation ));
13011334 showResizerItems ();
13021335}
13031336
@@ -1320,7 +1353,7 @@ void Component::flipVertical()
13201353 mTransformation .setExtent1 (QPointF (extent2.x (), extent1.y ()));
13211354 mTransformation .setExtent2 (QPointF (extent1.x (), extent2.y ()));
13221355 }
1323- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentCommand (this , oldTransformation, mTransformation , mpGraphicsView ));
1356+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentTransformationsCommand (this , oldTransformation, mTransformation ));
13241357 showResizerItems ();
13251358}
13261359
@@ -1334,7 +1367,7 @@ void Component::moveUp()
13341367{
13351368 Transformation oldTransformation = mTransformation ;
13361369 mTransformation .adjustPosition (0 , mpGraphicsView->getCoOrdinateSystem ()->getVerticalGridStep ());
1337- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentCommand (this , oldTransformation, mTransformation , mpGraphicsView ));
1370+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentTransformationsCommand (this , oldTransformation, mTransformation ));
13381371}
13391372
13401373/* !
@@ -1347,7 +1380,7 @@ void Component::moveShiftUp()
13471380{
13481381 Transformation oldTransformation = mTransformation ;
13491382 mTransformation .adjustPosition (0 , mpGraphicsView->getCoOrdinateSystem ()->getVerticalGridStep () * 5 );
1350- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentCommand (this , oldTransformation, mTransformation , mpGraphicsView ));
1383+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentTransformationsCommand (this , oldTransformation, mTransformation ));
13511384}
13521385
13531386/* !
@@ -1360,7 +1393,7 @@ void Component::moveCtrlUp()
13601393{
13611394 Transformation oldTransformation = mTransformation ;
13621395 mTransformation .adjustPosition (0 , 1 );
1363- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentCommand (this , oldTransformation, mTransformation , mpGraphicsView ));
1396+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentTransformationsCommand (this , oldTransformation, mTransformation ));
13641397}
13651398
13661399/* !
@@ -1373,7 +1406,7 @@ void Component::moveDown()
13731406{
13741407 Transformation oldTransformation = mTransformation ;
13751408 mTransformation .adjustPosition (0 , -mpGraphicsView->getCoOrdinateSystem ()->getVerticalGridStep ());
1376- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentCommand (this , oldTransformation, mTransformation , mpGraphicsView ));
1409+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentTransformationsCommand (this , oldTransformation, mTransformation ));
13771410}
13781411
13791412/* !
@@ -1386,7 +1419,7 @@ void Component::moveShiftDown()
13861419{
13871420 Transformation oldTransformation = mTransformation ;
13881421 mTransformation .adjustPosition (0 , -(mpGraphicsView->getCoOrdinateSystem ()->getVerticalGridStep () * 5 ));
1389- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentCommand (this , oldTransformation, mTransformation , mpGraphicsView ));
1422+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentTransformationsCommand (this , oldTransformation, mTransformation ));
13901423}
13911424
13921425/* !
@@ -1399,7 +1432,7 @@ void Component::moveCtrlDown()
13991432{
14001433 Transformation oldTransformation = mTransformation ;
14011434 mTransformation .adjustPosition (0 , -1 );
1402- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentCommand (this , oldTransformation, mTransformation , mpGraphicsView ));
1435+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentTransformationsCommand (this , oldTransformation, mTransformation ));
14031436}
14041437
14051438/* !
@@ -1412,7 +1445,7 @@ void Component::moveLeft()
14121445{
14131446 Transformation oldTransformation = mTransformation ;
14141447 mTransformation .adjustPosition (-mpGraphicsView->getCoOrdinateSystem ()->getHorizontalGridStep (), 0 );
1415- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentCommand (this , oldTransformation, mTransformation , mpGraphicsView ));
1448+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentTransformationsCommand (this , oldTransformation, mTransformation ));
14161449}
14171450
14181451/* !
@@ -1425,7 +1458,7 @@ void Component::moveShiftLeft()
14251458{
14261459 Transformation oldTransformation = mTransformation ;
14271460 mTransformation .adjustPosition (-(mpGraphicsView->getCoOrdinateSystem ()->getHorizontalGridStep () * 5 ), 0 );
1428- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentCommand (this , oldTransformation, mTransformation , mpGraphicsView ));
1461+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentTransformationsCommand (this , oldTransformation, mTransformation ));
14291462}
14301463
14311464/* !
@@ -1438,7 +1471,7 @@ void Component::moveCtrlLeft()
14381471{
14391472 Transformation oldTransformation = mTransformation ;
14401473 mTransformation .adjustPosition (-1 , 0 );
1441- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentCommand (this , oldTransformation, mTransformation , mpGraphicsView ));
1474+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentTransformationsCommand (this , oldTransformation, mTransformation ));
14421475}
14431476
14441477/* !
@@ -1451,7 +1484,7 @@ void Component::moveRight()
14511484{
14521485 Transformation oldTransformation = mTransformation ;
14531486 mTransformation .adjustPosition (mpGraphicsView->getCoOrdinateSystem ()->getHorizontalGridStep (), 0 );
1454- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentCommand (this , oldTransformation, mTransformation , mpGraphicsView ));
1487+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentTransformationsCommand (this , oldTransformation, mTransformation ));
14551488}
14561489
14571490/* !
@@ -1464,7 +1497,7 @@ void Component::moveShiftRight()
14641497{
14651498 Transformation oldTransformation = mTransformation ;
14661499 mTransformation .adjustPosition (mpGraphicsView->getCoOrdinateSystem ()->getHorizontalGridStep () * 5 , 0 );
1467- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentCommand (this , oldTransformation, mTransformation , mpGraphicsView ));
1500+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentTransformationsCommand (this , oldTransformation, mTransformation ));
14681501}
14691502
14701503/* !
@@ -1477,7 +1510,7 @@ void Component::moveCtrlRight()
14771510{
14781511 Transformation oldTransformation = mTransformation ;
14791512 mTransformation .adjustPosition (1 , 0 );
1480- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentCommand (this , oldTransformation, mTransformation , mpGraphicsView ));
1513+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateComponentTransformationsCommand (this , oldTransformation, mTransformation ));
14811514}
14821515
14831516// ! Slot that opens up the component parameters dialog.
0 commit comments