]> Shamusworld >> Repos - architektonas/blobdiff - src/actions/rs_actionblocksremove.cpp
Major refactoring of actions: Moved implementation from header files
[architektonas] / src / actions / rs_actionblocksremove.cpp
index d51e5b0eb7ce21bc302548e0e22c7ee8d046eaf5..0fae7c73e801b43138fed581c92e8e2bf996fd4d 100644 (file)
@@ -1,57 +1,39 @@
-/****************************************************************************
-** $Id: rs_actionblocksremove.cpp 2372 2005-04-29 11:44:54Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_actionblocksremove.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who  When        What
+// ---  ----------  -----------------------------------------------------------
+// JLH  06/03/2010  Added this text. :-)
+//
 
 #include "rs_actionblocksremove.h"
 
 #include "rs_block.h"
+#include "rs_dialogfactory.h"
 #include "drawing.h"
+#include "rs_graphicview.h"
 #include "rs_insert.h"
-#include "rs_dialogfactory.h"
 
-RS_ActionBlocksRemove::RS_ActionBlocksRemove(RS_EntityContainer & container,
-       RS_GraphicView & graphicView):
+RS_ActionBlocksRemove::RS_ActionBlocksRemove(RS_EntityContainer & container, RS_GraphicView & graphicView):
        RS_ActionInterface("Remove Block", container, graphicView)
 {
 }
 
-QAction * RS_ActionBlocksRemove::createGUIAction(RS2::ActionType /*type*/, QObject * /*parent*/)
+RS_ActionBlocksRemove::~RS_ActionBlocksRemove()
 {
-       QAction * action = new QAction(tr("&Remove Block"), 0);
-//        QAction* action = new QAction(tr("Remove Block"), tr("&Remove Block"),
-//                             QKeySequence(), NULL);
-               action->setStatusTip(tr("Remove Block"));
-
-               return action;
 }
 
 void RS_ActionBlocksRemove::trigger()
 {
        RS_DEBUG->print("RS_ActionBlocksRemove::trigger");
 
-       if (graphic!=NULL)
+       if (graphic != NULL)
        {
                RS_Block * block = RS_DIALOGFACTORY->requestBlockRemovalDialog(graphic->getBlockList());
 
@@ -61,14 +43,14 @@ void RS_ActionBlocksRemove::trigger()
                containerList.append(graphic);
                RS_BlockList * blkLst = graphic->getBlockList();
 
-               for(uint bi=0; bi<blkLst->count(); bi++)
+               for (uint bi = 0; bi < blkLst->count(); bi++)
                        containerList.append(blkLst->at(bi));
 
                if (block != NULL)
                {
 //                     for (RS_EntityContainer * cont=containerList.first(); cont!=NULL;
 //                             cont=containerList.next())
-                       for(int i=0; i<containerList.size(); i++)
+                       for (int i = 0; i < containerList.size(); i++)
                        {
                                RS_EntityContainer * cont = containerList[i];
                                // remove all inserts from the graphic:
@@ -78,9 +60,8 @@ void RS_ActionBlocksRemove::trigger()
                                {
                                        done = true;
 
-                                       for (RS_Entity* e=cont->firstEntity(RS2::ResolveNone); e!=NULL;
-                                               e=cont->nextEntity(RS2::ResolveNone))
-                                       {
+                                       for (RS_Entity * e = cont->firstEntity(RS2::ResolveNone); e != NULL;
+                                            e = cont->nextEntity(RS2::ResolveNone))
                                                if (e->rtti() == RS2::EntityInsert)
                                                {
                                                        RS_Insert * ins = (RS_Insert *)e;
@@ -92,7 +73,6 @@ void RS_ActionBlocksRemove::trigger()
                                                                break;
                                                        }
                                                }
-                                       }
                                }
                                while (!done);
                        }
@@ -117,3 +97,4 @@ void RS_ActionBlocksRemove::init(int status)
        RS_ActionInterface::init(status);
        trigger();
 }
+