src/toolsets/movetoolset.cpp

changeset 1217
314e12e23c3a
parent 1215
77a0270352a3
child 1222
34def2630300
equal deleted inserted replaced
1216:12f9ea615cbc 1217:314e12e23c3a
20 #include "../ldObjectMath.h" 20 #include "../ldObjectMath.h"
21 #include "../miscallenous.h" 21 #include "../miscallenous.h"
22 #include "../mainwindow.h" 22 #include "../mainwindow.h"
23 #include "movetoolset.h" 23 #include "movetoolset.h"
24 24
25 MoveToolset::MoveToolset (MainWindow* parent) : 25 MoveToolset::MoveToolset(MainWindow* parent) :
26 Toolset (parent) {} 26 Toolset(parent) {}
27 27
28 void MoveToolset::moveSelection (bool up) 28 void MoveToolset::moveSelection(bool up)
29 { 29 {
30 LDObjectList objs = selectedObjects(); 30 LDObjectList objs = selectedObjects();
31 LDObject::moveObjects (objs, up); 31 LDObject::moveObjects(objs, up);
32 m_window->buildObjectList(); 32 m_window->buildObjectList();
33 } 33 }
34 34
35 void MoveToolset::moveUp() 35 void MoveToolset::moveUp()
36 { 36 {
37 moveSelection (true); 37 moveSelection(true);
38 } 38 }
39 39
40 void MoveToolset::moveDown() 40 void MoveToolset::moveDown()
41 { 41 {
42 moveSelection (false); 42 moveSelection(false);
43 } 43 }
44 44
45 void MoveToolset::gridCoarse() 45 void MoveToolset::gridCoarse()
46 { 46 {
47 config.setGrid (Grid::Coarse); 47 config.setGrid(Grid::Coarse);
48 m_window->updateGridToolBar(); 48 m_window->updateGridToolBar();
49 } 49 }
50 50
51 void MoveToolset::gridMedium() 51 void MoveToolset::gridMedium()
52 { 52 {
53 config.setGrid (Grid::Medium); 53 config.setGrid(Grid::Medium);
54 m_window->updateGridToolBar(); 54 m_window->updateGridToolBar();
55 } 55 }
56 56
57 void MoveToolset::gridFine() 57 void MoveToolset::gridFine()
58 { 58 {
59 config.setGrid (Grid::Fine); 59 config.setGrid(Grid::Fine);
60 m_window->updateGridToolBar(); 60 m_window->updateGridToolBar();
61 } 61 }
62 62
63 void MoveToolset::moveObjects (Vertex vect) 63 void MoveToolset::moveObjects(Vertex vect)
64 { 64 {
65 // Apply the grid values 65 // Apply the grid values
66 vect *= gridCoordinateSnap(); 66 vect *= gridCoordinateSnap();
67 67
68 for (LDObject* obj : selectedObjects()) 68 for (LDObject* obj : selectedObjects())
69 obj->move (vect); 69 obj->move(vect);
70 } 70 }
71 71
72 void MoveToolset::moveXNeg() 72 void MoveToolset::moveXNeg()
73 { 73 {
74 moveObjects ({-1, 0, 0}); 74 moveObjects({-1, 0, 0});
75 } 75 }
76 76
77 void MoveToolset::moveYNeg() 77 void MoveToolset::moveYNeg()
78 { 78 {
79 moveObjects ({0, -1, 0}); 79 moveObjects({0, -1, 0});
80 } 80 }
81 81
82 void MoveToolset::moveZNeg() 82 void MoveToolset::moveZNeg()
83 { 83 {
84 moveObjects ({0, 0, -1}); 84 moveObjects({0, 0, -1});
85 } 85 }
86 86
87 void MoveToolset::moveXPos() 87 void MoveToolset::moveXPos()
88 { 88 {
89 moveObjects ({1, 0, 0}); 89 moveObjects({1, 0, 0});
90 } 90 }
91 91
92 void MoveToolset::moveYPos() 92 void MoveToolset::moveYPos()
93 { 93 {
94 moveObjects ({0, 1, 0}); 94 moveObjects({0, 1, 0});
95 } 95 }
96 96
97 void MoveToolset::moveZPos() 97 void MoveToolset::moveZPos()
98 { 98 {
99 moveObjects ({0, 0, 1}); 99 moveObjects({0, 0, 1});
100 } 100 }
101 101
102 double MoveToolset::getRotateActionAngle() 102 double MoveToolset::getRotateActionAngle()
103 { 103 {
104 return (Pi * gridAngleSnap()) / 180; 104 return (Pi * gridAngleSnap()) / 180;
105 } 105 }
106 106
107 void MoveToolset::rotateXPos() 107 void MoveToolset::rotateXPos()
108 { 108 {
109 RotateObjects (1, 0, 0, getRotateActionAngle(), selectedObjects()); 109 RotateObjects(1, 0, 0, getRotateActionAngle(), selectedObjects());
110 } 110 }
111 111
112 void MoveToolset::rotateYPos() 112 void MoveToolset::rotateYPos()
113 { 113 {
114 RotateObjects (0, 1, 0, getRotateActionAngle(), selectedObjects()); 114 RotateObjects(0, 1, 0, getRotateActionAngle(), selectedObjects());
115 } 115 }
116 116
117 void MoveToolset::rotateZPos() 117 void MoveToolset::rotateZPos()
118 { 118 {
119 RotateObjects (0, 0, 1, getRotateActionAngle(), selectedObjects()); 119 RotateObjects(0, 0, 1, getRotateActionAngle(), selectedObjects());
120 } 120 }
121 121
122 void MoveToolset::rotateXNeg() 122 void MoveToolset::rotateXNeg()
123 { 123 {
124 RotateObjects (-1, 0, 0, getRotateActionAngle(), selectedObjects()); 124 RotateObjects(-1, 0, 0, getRotateActionAngle(), selectedObjects());
125 } 125 }
126 126
127 void MoveToolset::rotateYNeg() 127 void MoveToolset::rotateYNeg()
128 { 128 {
129 RotateObjects (0, -1, 0, getRotateActionAngle(), selectedObjects()); 129 RotateObjects(0, -1, 0, getRotateActionAngle(), selectedObjects());
130 } 130 }
131 131
132 void MoveToolset::rotateZNeg() 132 void MoveToolset::rotateZNeg()
133 { 133 {
134 RotateObjects (0, 0, -1, getRotateActionAngle(), selectedObjects()); 134 RotateObjects(0, 0, -1, getRotateActionAngle(), selectedObjects());
135 } 135 }
136 136
137 void MoveToolset::configureRotationPoint() 137 void MoveToolset::configureRotationPoint()
138 { 138 {
139 ConfigureRotationPoint(); 139 ConfigureRotationPoint();

mercurial