gui_actions.cpp

changeset 168
96691a009dff
parent 163
46955613626d
child 170
2247a32e63a8
equal deleted inserted replaced
167:df78c894ae24 168:96691a009dff
117 117
118 // ============================================================================= 118 // =============================================================================
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
120 // ============================================================================= 120 // =============================================================================
121 MAKE_ACTION (newSubfile, "New Subfile", "add-subfile", "Creates a new subfile reference.", 0) { 121 MAKE_ACTION (newSubfile, "New Subfile", "add-subfile", "Creates a new subfile reference.", 0) {
122 AddObjectDialog::staticDialog (OBJ_Subfile, null); 122 AddObjectDialog::staticDialog (LDObject::Subfile, null);
123 } 123 }
124 124
125 MAKE_ACTION (newLine, "New Line", "add-line", "Creates a new line.", 0) { 125 MAKE_ACTION (newLine, "New Line", "add-line", "Creates a new line.", 0) {
126 AddObjectDialog::staticDialog (OBJ_Line, null); 126 AddObjectDialog::staticDialog (LDObject::Line, null);
127 } 127 }
128 128
129 MAKE_ACTION (newTriangle, "New Triangle", "add-triangle", "Creates a new triangle.", 0) { 129 MAKE_ACTION (newTriangle, "New Triangle", "add-triangle", "Creates a new triangle.", 0) {
130 AddObjectDialog::staticDialog (OBJ_Triangle, null); 130 AddObjectDialog::staticDialog (LDObject::Triangle, null);
131 } 131 }
132 132
133 MAKE_ACTION (newQuad, "New Quadrilateral", "add-quad", "Creates a new quadrilateral.", 0) { 133 MAKE_ACTION (newQuad, "New Quadrilateral", "add-quad", "Creates a new quadrilateral.", 0) {
134 AddObjectDialog::staticDialog (OBJ_Quad, null); 134 AddObjectDialog::staticDialog (LDObject::Quad, null);
135 } 135 }
136 136
137 MAKE_ACTION (newCondLine, "New Conditional Line", "add-condline", "Creates a new conditional line.", 0) { 137 MAKE_ACTION (newCondLine, "New Conditional Line", "add-condline", "Creates a new conditional line.", 0) {
138 AddObjectDialog::staticDialog (OBJ_CondLine, null); 138 AddObjectDialog::staticDialog (LDObject::CondLine, null);
139 } 139 }
140 140
141 MAKE_ACTION (newComment, "New Comment", "add-comment", "Creates a new comment.", 0) { 141 MAKE_ACTION (newComment, "New Comment", "add-comment", "Creates a new comment.", 0) {
142 AddObjectDialog::staticDialog (OBJ_Comment, null); 142 AddObjectDialog::staticDialog (LDObject::Comment, null);
143 } 143 }
144 144
145 MAKE_ACTION (newBFC, "New BFC Statement", "add-bfc", "Creates a new BFC statement.", 0) { 145 MAKE_ACTION (newBFC, "New BFC Statement", "add-bfc", "Creates a new BFC statement.", 0) {
146 AddObjectDialog::staticDialog (OBJ_BFC, null); 146 AddObjectDialog::staticDialog (LDObject::BFC, null);
147 } 147 }
148 148
149 MAKE_ACTION (newVertex, "New Vertex", "add-vertex", "Creates a new vertex.", 0) { 149 MAKE_ACTION (newVertex, "New Vertex", "add-vertex", "Creates a new vertex.", 0) {
150 AddObjectDialog::staticDialog (OBJ_Vertex, null); 150 AddObjectDialog::staticDialog (LDObject::Vertex, null);
151 } 151 }
152 152
153 MAKE_ACTION (newRadial, "New Radial", "add-radial", "Creates a new radial.", 0) { 153 MAKE_ACTION (newRadial, "New Radial", "add-radial", "Creates a new radial.", 0) {
154 AddObjectDialog::staticDialog (OBJ_Radial, null); 154 AddObjectDialog::staticDialog (LDObject::Radial, null);
155 } 155 }
156 156
157 MAKE_ACTION (editObject, "Edit Object", "edit-object", "Edits this object.", 0) { 157 MAKE_ACTION (editObject, "Edit Object", "edit-object", "Edits this object.", 0) {
158 if (g_win->sel ().size () != 1) 158 if (g_win->sel ().size () != 1)
159 return; 159 return;
214 "Select all objects by the given type.", (0)) 214 "Select all objects by the given type.", (0))
215 { 215 {
216 if (g_win->sel ().size () == 0) 216 if (g_win->sel ().size () == 0)
217 return; 217 return;
218 218
219 LDObjectType_e eType = g_win->uniformSelectedType (); 219 LDObject::Type eType = g_win->uniformSelectedType ();
220 220
221 if (eType == OBJ_Unidentified) 221 if (eType == LDObject::Unidentified)
222 return; 222 return;
223 223
224 // If we're selecting subfile references, the reference filename must also 224 // If we're selecting subfile references, the reference filename must also
225 // be uniform. 225 // be uniform.
226 str zRefName; 226 str zRefName;
227 227
228 if (eType == OBJ_Subfile) { 228 if (eType == LDObject::Subfile) {
229 zRefName = static_cast<LDSubfile*> (g_win->sel ()[0])->zFileName; 229 zRefName = static_cast<LDSubfile*> (g_win->sel ()[0])->zFileName;
230 230
231 for (LDObject* pObj : g_win->sel ()) 231 for (LDObject* pObj : g_win->sel ())
232 if (static_cast<LDSubfile*> (pObj)->zFileName != zRefName) 232 if (static_cast<LDSubfile*> (pObj)->zFileName != zRefName)
233 return; 233 return;
236 g_win->sel ().clear (); 236 g_win->sel ().clear ();
237 for (LDObject* obj : g_curfile->m_objs) { 237 for (LDObject* obj : g_curfile->m_objs) {
238 if (obj->getType() != eType) 238 if (obj->getType() != eType)
239 continue; 239 continue;
240 240
241 if (eType == OBJ_Subfile && static_cast<LDSubfile*> (obj)->zFileName != zRefName) 241 if (eType == LDObject::Subfile && static_cast<LDSubfile*> (obj)->zFileName != zRefName)
242 continue; 242 continue;
243 243
244 g_win->sel ().push_back (obj); 244 g_win->sel ().push_back (obj);
245 } 245 }
246 246

mercurial