src/toolsets/filetoolset.cpp

changeset 1019
a2e4286adb0d
parent 1018
49358df9495b
child 1039
f68ebbae4efb
equal deleted inserted replaced
1018:49358df9495b 1019:a2e4286adb0d
25 #include "../partdownloader.h" 25 #include "../partdownloader.h"
26 #include "../primitives.h" 26 #include "../primitives.h"
27 #include "../dialogs/configdialog.h" 27 #include "../dialogs/configdialog.h"
28 #include "../dialogs/ldrawpathdialog.h" 28 #include "../dialogs/ldrawpathdialog.h"
29 #include "../dialogs/newpartdialog.h" 29 #include "../dialogs/newpartdialog.h"
30 #include "../dialogs/generateprimitivedialog.h"
30 #include "../documentmanager.h" 31 #include "../documentmanager.h"
31 #include "filetoolset.h" 32 #include "filetoolset.h"
32 #include "ui_makeprim.h" 33 #include "ui_makeprim.h"
33 34
34 FileToolset::FileToolset (MainWindow* parent) : 35 FileToolset::FileToolset (MainWindow* parent) :
198 dialog->exec(); 199 dialog->exec();
199 } 200 }
200 201
201 void FileToolset::makePrimitive() 202 void FileToolset::makePrimitive()
202 { 203 {
203 PrimitivePrompt* dialog = new PrimitivePrompt (m_window); 204 GeneratePrimitiveDialog* dialog = new GeneratePrimitiveDialog(m_window);
204 205
205 if (not dialog->exec()) 206 if (not dialog->exec())
206 return; 207 return;
207 208
208 int segs = dialog->ui->sb_segs->value(); 209 LDDocument* primitive = primitives()->generatePrimitive(dialog->spec());
209 int divs = dialog->ui->cb_hires->isChecked() ? HighResolution : LowResolution;
210 int num = dialog->ui->sb_ringnum->value();
211
212 PrimitiveType type =
213 dialog->ui->rb_circle->isChecked() ? Circle :
214 dialog->ui->rb_cylinder->isChecked() ? Cylinder :
215 dialog->ui->rb_disc->isChecked() ? Disc :
216 dialog->ui->rb_ndisc->isChecked() ? DiscNegative :
217 dialog->ui->rb_ring->isChecked() ? Ring : Cone;
218
219 LDDocument* primitive = primitives()->generatePrimitive(type, segs, divs, num);
220 primitive->openForEditing(); 210 primitive->openForEditing();
221 m_window->save(primitive, false); 211 m_window->save(primitive, false);
222 } 212 }
223 213
224 // These are not exactly file tools but I don't want to make another toolset just for 3 very small actions 214 // These are not exactly file tools but I don't want to make another toolset just for 3 very small actions

mercurial