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