]> Shamusworld >> Repos - architektonas/blob - src/actions/actionmodifyattributes.cpp
Initial removal of unnecessary rs_ prefixes from files.
[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 "dialogfactory.h"
20 #include "drawing.h"
21 #include "graphicview.h"
22 #include "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)
53         {
54                 if (RS_DIALOGFACTORY->requestAttributesDialog(data,
55                     *graphic->getLayerList()))
56                 {
57                         RS_Modification m(*container, graphicView);
58                         m.changeAttributes(data);
59                 }
60         }
61
62         finish();
63         graphicView->killSelectActions();
64
65         RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
66 }
67
68 void ActionModifyAttributes::updateMouseButtonHints()
69 {
70         switch (getStatus())
71         {
72         //case Acknowledge:
73         //RS_DIALOGFACTORY->updateMouseWidget(tr("Acknowledge"), tr("Cancel"));
74         //break;
75         default:
76                 RS_DIALOGFACTORY->updateMouseWidget("", "");
77                 break;
78         }
79 }
80
81 void ActionModifyAttributes::updateMouseCursor()
82 {
83         graphicView->setMouseCursor(RS2::DelCursor);
84 }
85
86 void ActionModifyAttributes::updateToolBar()
87 {
88         if (!isFinished())
89                 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);
90         else
91                 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
92 }