1 // actioninfototallength.cpp
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
10 // JLH = James L. Hammons <jlhamm@acm.org>
13 // --- ---------- -----------------------------------------------------------
14 // JLH 06/04/2010 Added this text. :-)
17 #include "actioninfototallength.h"
19 #include "rs_dialogfactory.h"
21 ActionInfoTotalLength::ActionInfoTotalLength(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Total Length",
22 container, graphicView)
26 ActionInfoTotalLength::~ActionInfoTotalLength()
30 void ActionInfoTotalLength::init(int status)
32 ActionInterface::init(status);
36 void ActionInfoTotalLength::trigger()
38 RS_DEBUG->print("ActionInfoTotalLength::trigger()");
42 for(RS_Entity * e=container->firstEntity(RS2::ResolveNone); e!=NULL;
43 e=container->nextEntity(RS2::ResolveNone))
45 if (e->isVisible() && e->isSelected())
47 double l = e->getLength();
60 RS_DIALOGFACTORY->commandMessage(
61 tr("Total Length of selected entities: %1").arg(len));
63 RS_DIALOGFACTORY->commandMessage(tr("At least one of the selected "
64 "entities cannot be measured."));
69 void ActionInfoTotalLength::updateToolBar()
71 if (RS_DIALOGFACTORY != NULL)
74 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo);
76 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);