]> Shamusworld >> Repos - architektonas/blob - src/actions/actionmodifyattributes.cpp
ab8481d93e5db9c1bd8dad55f03850e53824ebbf
[architektonas] / src / actions / actionmodifyattributes.cpp
1 // actionmodifyattributes.cpp
2 //
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
9 //
10 // JLH = James L. Hammons <jlhamm@acm.org>
11 //
12 // Who  When        What
13 // ---  ----------  -----------------------------------------------------------
14 // JLH  06/04/2010  Added this text. :-)
15 //
16
17 #include "actionmodifyattributes.h"
18
19 #include "rs_dialogfactory.h"
20 #include "drawing.h"
21 #include "graphicview.h"
22 #include "rs_modification.h"
23
24 ActionModifyAttributes::ActionModifyAttributes(
25         RS_EntityContainer & container, GraphicView & graphicView):
26         ActionInterface("Change Attributes", container, graphicView)
27 {
28 }
29
30 ActionModifyAttributes::~ActionModifyAttributes()
31 {
32 }
33
34 void ActionModifyAttributes::init(int status)
35 {
36         ActionInterface::init(status);
37         trigger();
38 }
39
40 void ActionModifyAttributes::trigger()
41 {
42         RS_DEBUG->print("ActionModifyAttributes::trigger()");
43
44         RS_AttributesData data;
45         data.pen = RS_Pen();
46         data.layer = "0";
47         data.changeColor = false;
48         data.changeLineType = false;
49         data.changeWidth = false;
50         data.changeLayer = false;
51
52         if (graphic != NULL)
53                 if (RS_DIALOGFACTORY->requestAttributesDialog(data,
54                             *graphic->getLayerList()))
55                 {
56                         RS_Modification m(*container, graphicView);
57                         m.changeAttributes(data);
58                 }
59
60         finish();
61         graphicView->killSelectActions();
62
63         RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
64 }
65
66 void ActionModifyAttributes::updateMouseButtonHints()
67 {
68         switch (getStatus())
69         {
70         //case Acknowledge:
71         //RS_DIALOGFACTORY->updateMouseWidget(tr("Acknowledge"), tr("Cancel"));
72         //break;
73         default:
74                 RS_DIALOGFACTORY->updateMouseWidget("", "");
75                 break;
76         }
77 }
78
79 void ActionModifyAttributes::updateMouseCursor()
80 {
81         graphicView->setMouseCursor(RS2::DelCursor);
82 }
83
84 void ActionModifyAttributes::updateToolBar()
85 {
86         if (!isFinished())
87                 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
88         else
89                 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
90 }