]> Shamusworld >> Repos - architektonas/blobdiff - src/actions/rs_actionblocksattributes.cpp
Major refactoring of actions: Moved implementation from header files
[architektonas] / src / actions / rs_actionblocksattributes.cpp
index 9c363e31ebe05ecbd36d0fca53fae260b8a71796..67ef48b36a2b97800c6db3f2c7dc1c3fad39571c 100644 (file)
@@ -10,7 +10,7 @@
 ** Foundation and appearing in the file LICENSE.GPL included in the
 ** packaging of this file.
 **
-** Licensees holding valid qcadlib Professional Edition licenses may use 
+** Licensees holding valid qcadlib Professional Edition licenses may use
 ** this file in accordance with the qcadlib Commercial License
 ** Agreement provided with the Software.
 **
 #include "drawing.h"
 #include "rs_dialogfactory.h"
 
-
-
 RS_ActionBlocksAttributes::RS_ActionBlocksAttributes(
-    RS_EntityContainer& container,
-    RS_GraphicView& graphicView)
-        :RS_ActionInterface("Edit Block Attributes", container, graphicView)
+       RS_EntityContainer & container, RS_GraphicView & graphicView):
+       RS_ActionInterface("Edit Block Attributes", container, graphicView)
 {
 }
 
-
-
-QAction* RS_ActionBlocksAttributes::createGUIAction(RS2::ActionType /*type*/, QObject* /*parent*/)
+QAction * RS_ActionBlocksAttributes::createGUIAction(RS2::ActionType /*type*/, QObject * /*parent*/)
 {
-
-    QAction * action = new QAction(tr("&Rename Block"), 0);
+       QAction * action = new QAction(tr("&Rename Block"), 0);
 //    QAction* action = new QAction(tr("Rename Block"),
 //                                  tr("&Rename Block"),
 //                                  QKeySequence(), NULL);
-    action->setStatusTip(tr("Rename Block and all Inserts"));
-    return action;
+       action->setStatusTip(tr("Rename Block and all Inserts"));
+       return action;
 }
 
-
-
 void RS_ActionBlocksAttributes::trigger()
 {
-    RS_DEBUG->print("editing block attributes");
-
-    if (graphic!=NULL && RS_DIALOGFACTORY!=NULL) {
-        RS_Block* block = graphic->getActiveBlock();
-        RS_BlockList* blockList = graphic->getBlockList();
-        if (blockList!=NULL && block!=NULL) {
-            QString oldName = block->getName();
-
-            RS_BlockData d;
-            d = RS_DIALOGFACTORY->requestBlockAttributesDialog(
-                    blockList);
-
-            if (d.isValid()) {
-
-                QString newName = d.name;
-                blockList->rename(block, newName);
-
-                // update the name of all inserts:
-                graphic->renameInserts(oldName, newName);
-
-                graphic->addBlockNotification();
-            }
-        }
-
-    }
-    finish();
+       RS_DEBUG->print("editing block attributes");
+
+       if (graphic != NULL && RS_DIALOGFACTORY != NULL)
+       {
+               RS_Block * block = graphic->getActiveBlock();
+               RS_BlockList * blockList = graphic->getBlockList();
+
+               if (blockList != NULL && block != NULL)
+               {
+                       QString oldName = block->getName();
+
+                       RS_BlockData d;
+                       d = RS_DIALOGFACTORY->requestBlockAttributesDialog(
+                                       blockList);
+
+                       if (d.isValid())
+                       {
+                               QString newName = d.name;
+                               blockList->rename(block, newName);
+
+                               // update the name of all inserts:
+                               graphic->renameInserts(oldName, newName);
+
+                               graphic->addBlockNotification();
+                       }
+               }
+       }
+       finish();
 }
 
-
-
 void RS_ActionBlocksAttributes::init(int status)
 {
-    RS_ActionInterface::init(status);
-    trigger();
+       RS_ActionInterface::init(status);
+       trigger();
 }
 
 // EOF