7fd59977 |
1 | using System; |
2 | using System.Drawing; |
3 | using System.Collections; |
4 | using System.ComponentModel; |
5 | using System.Windows.Forms; |
6 | using System.Data; |
7 | |
8 | namespace IE |
9 | { |
10 | /// <summary> |
11 | /// Summary description for Form1. |
12 | /// </summary> |
13 | public class Form1 : System.Windows.Forms.Form |
14 | { |
15 | private System.Windows.Forms.MainMenu mainMenu1; |
16 | private System.Windows.Forms.MenuItem FileNew; |
17 | private System.Windows.Forms.MenuItem FileClose; |
18 | private System.Windows.Forms.MenuItem FileExport; |
19 | private System.Windows.Forms.MenuItem FileImport; |
20 | private System.Windows.Forms.MenuItem ImportBRep; |
21 | private System.Windows.Forms.MenuItem ExportImage; |
22 | private System.Windows.Forms.MenuItem File; |
23 | private System.Windows.Forms.MenuItem Window; |
24 | private System.Windows.Forms.ToolBarButton New; |
25 | private System.Windows.Forms.ImageList imageList1; |
26 | private System.Windows.Forms.ToolBarButton About; |
27 | private System.Windows.Forms.StatusBar myStatusBar; |
28 | private System.Windows.Forms.MenuItem ImportIges; |
29 | private System.Windows.Forms.MenuItem ImportStep; |
30 | private System.Windows.Forms.MenuItem ExportBRep; |
31 | private System.Windows.Forms.MenuItem ExportIges; |
32 | private System.Windows.Forms.MenuItem ExportStep; |
33 | private System.Windows.Forms.MenuItem ExportStl; |
34 | private System.Windows.Forms.MenuItem ExportVrml; |
35 | private System.ComponentModel.IContainer components; |
36 | private System.Windows.Forms.MenuItem menuItem1; |
37 | private System.Windows.Forms.MenuItem menuItem2; |
38 | private System.Windows.Forms.MenuItem menuItem3; |
39 | private System.Windows.Forms.MenuItem View; |
40 | private System.Windows.Forms.MenuItem Help; |
41 | private System.Windows.Forms.MenuItem HelpAbout; |
42 | private System.Windows.Forms.MenuItem ViewToolbar; |
43 | private System.Windows.Forms.MenuItem ViewStatusBar; |
44 | private System.Windows.Forms.MenuItem menuItem4; |
45 | private System.Windows.Forms.MenuItem WindowCascade; |
46 | private System.Windows.Forms.MenuItem WindowTile; |
47 | |
48 | protected IE.ModelFormat myModelFormat; |
49 | private System.Windows.Forms.ToolBarButton wireframe; |
50 | private System.Windows.Forms.ToolBarButton shading; |
51 | private System.Windows.Forms.ToolBarButton toolBarButton1; |
52 | private System.Windows.Forms.ToolBarButton color; |
53 | private System.Windows.Forms.ToolBarButton transparency; |
54 | private System.Windows.Forms.ToolBarButton delete; |
55 | private System.Windows.Forms.ToolBarButton material; |
56 | private System.Windows.Forms.ToolBarButton ZoomAll; |
57 | private System.Windows.Forms.ToolBarButton ZoomWin; |
58 | private System.Windows.Forms.ToolBarButton ZoomProg; |
59 | private System.Windows.Forms.ToolBarButton Pan; |
60 | private System.Windows.Forms.ToolBarButton PanGlo; |
61 | private System.Windows.Forms.ToolBarButton Front; |
62 | private System.Windows.Forms.ToolBarButton Back; |
63 | private System.Windows.Forms.ToolBarButton TOP; |
64 | private System.Windows.Forms.ToolBarButton BOTTOM; |
65 | private System.Windows.Forms.ToolBarButton RIGHT; |
66 | private System.Windows.Forms.ToolBarButton LEFT; |
67 | private System.Windows.Forms.ToolBarButton Axo; |
68 | private System.Windows.Forms.ToolBarButton Rot; |
69 | private System.Windows.Forms.ToolBarButton Reset; |
70 | private System.Windows.Forms.ToolBarButton HlrOn; |
71 | private System.Windows.Forms.ToolBarButton HlrOff; |
72 | private System.Windows.Forms.ToolBar toolBarTool; |
73 | private System.Windows.Forms.ToolBar toolBarView; |
74 | protected static int myNbOfChildren; |
75 | |
76 | public Form1() |
77 | { |
78 | // |
79 | // Required for Windows Form Designer support |
80 | // |
81 | InitializeComponent(); |
82 | |
83 | // |
84 | // TODO: Add any constructor code after InitializeComponent call |
85 | // |
86 | IE.Form1.myNbOfChildren=0; |
87 | } |
88 | |
89 | /// <summary> |
90 | /// Clean up any resources being used. |
91 | /// </summary> |
92 | protected override void Dispose( bool disposing ) |
93 | { |
94 | if( disposing ) |
95 | { |
96 | if (components != null) |
97 | { |
98 | components.Dispose(); |
99 | } |
100 | } |
101 | base.Dispose( disposing ); |
102 | } |
103 | |
104 | #region Windows Form Designer generated code |
105 | /// <summary> |
106 | /// Required method for Designer support - do not modify |
107 | /// the contents of this method with the code editor. |
108 | /// </summary> |
109 | private void InitializeComponent() |
110 | { |
111 | this.components = new System.ComponentModel.Container(); |
112 | System.Configuration.AppSettingsReader configurationAppSettings = new System.Configuration.AppSettingsReader(); |
113 | System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); |
114 | this.mainMenu1 = new System.Windows.Forms.MainMenu(); |
115 | this.File = new System.Windows.Forms.MenuItem(); |
116 | this.FileNew = new System.Windows.Forms.MenuItem(); |
117 | this.FileExport = new System.Windows.Forms.MenuItem(); |
118 | this.ImportBRep = new System.Windows.Forms.MenuItem(); |
119 | this.ImportIges = new System.Windows.Forms.MenuItem(); |
120 | this.ImportStep = new System.Windows.Forms.MenuItem(); |
121 | this.FileImport = new System.Windows.Forms.MenuItem(); |
122 | this.ExportBRep = new System.Windows.Forms.MenuItem(); |
123 | this.ExportIges = new System.Windows.Forms.MenuItem(); |
124 | this.ExportStep = new System.Windows.Forms.MenuItem(); |
125 | this.ExportStl = new System.Windows.Forms.MenuItem(); |
126 | this.ExportVrml = new System.Windows.Forms.MenuItem(); |
127 | this.menuItem3 = new System.Windows.Forms.MenuItem(); |
128 | this.ExportImage = new System.Windows.Forms.MenuItem(); |
129 | this.FileClose = new System.Windows.Forms.MenuItem(); |
130 | this.menuItem2 = new System.Windows.Forms.MenuItem(); |
131 | this.menuItem1 = new System.Windows.Forms.MenuItem(); |
132 | this.View = new System.Windows.Forms.MenuItem(); |
133 | this.ViewToolbar = new System.Windows.Forms.MenuItem(); |
134 | this.ViewStatusBar = new System.Windows.Forms.MenuItem(); |
135 | this.Window = new System.Windows.Forms.MenuItem(); |
136 | this.menuItem4 = new System.Windows.Forms.MenuItem(); |
137 | this.WindowCascade = new System.Windows.Forms.MenuItem(); |
138 | this.WindowTile = new System.Windows.Forms.MenuItem(); |
139 | this.Help = new System.Windows.Forms.MenuItem(); |
140 | this.HelpAbout = new System.Windows.Forms.MenuItem(); |
141 | this.toolBarTool = new System.Windows.Forms.ToolBar(); |
142 | this.New = new System.Windows.Forms.ToolBarButton(); |
143 | this.About = new System.Windows.Forms.ToolBarButton(); |
144 | this.toolBarButton1 = new System.Windows.Forms.ToolBarButton(); |
145 | this.wireframe = new System.Windows.Forms.ToolBarButton(); |
146 | this.shading = new System.Windows.Forms.ToolBarButton(); |
147 | this.color = new System.Windows.Forms.ToolBarButton(); |
148 | this.material = new System.Windows.Forms.ToolBarButton(); |
149 | this.transparency = new System.Windows.Forms.ToolBarButton(); |
150 | this.delete = new System.Windows.Forms.ToolBarButton(); |
151 | this.imageList1 = new System.Windows.Forms.ImageList(this.components); |
152 | this.myStatusBar = new System.Windows.Forms.StatusBar(); |
153 | this.toolBarView = new System.Windows.Forms.ToolBar(); |
154 | this.ZoomAll = new System.Windows.Forms.ToolBarButton(); |
155 | this.ZoomWin = new System.Windows.Forms.ToolBarButton(); |
156 | this.ZoomProg = new System.Windows.Forms.ToolBarButton(); |
157 | this.Pan = new System.Windows.Forms.ToolBarButton(); |
158 | this.PanGlo = new System.Windows.Forms.ToolBarButton(); |
159 | this.Front = new System.Windows.Forms.ToolBarButton(); |
160 | this.Back = new System.Windows.Forms.ToolBarButton(); |
161 | this.TOP = new System.Windows.Forms.ToolBarButton(); |
162 | this.BOTTOM = new System.Windows.Forms.ToolBarButton(); |
163 | this.LEFT = new System.Windows.Forms.ToolBarButton(); |
164 | this.RIGHT = new System.Windows.Forms.ToolBarButton(); |
165 | this.Axo = new System.Windows.Forms.ToolBarButton(); |
166 | this.Rot = new System.Windows.Forms.ToolBarButton(); |
167 | this.Reset = new System.Windows.Forms.ToolBarButton(); |
168 | this.HlrOn = new System.Windows.Forms.ToolBarButton(); |
169 | this.HlrOff = new System.Windows.Forms.ToolBarButton(); |
170 | this.SuspendLayout(); |
171 | // |
172 | // mainMenu1 |
173 | // |
174 | this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { |
175 | this.File, |
176 | this.View, |
177 | this.Window, |
178 | this.Help}); |
179 | // |
180 | // File |
181 | // |
182 | this.File.Index = 0; |
183 | this.File.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { |
184 | this.FileNew, |
185 | this.FileExport, |
186 | this.FileImport, |
187 | this.FileClose, |
188 | this.menuItem2, |
189 | this.menuItem1}); |
190 | this.File.Text = "&File"; |
191 | this.File.Popup += new System.EventHandler(this.File_Popup); |
192 | // |
193 | // FileNew |
194 | // |
195 | this.FileNew.Index = 0; |
196 | this.FileNew.Text = "&New"; |
197 | this.FileNew.Click += new System.EventHandler(this.menuItem2_Click); |
198 | // |
199 | // FileExport |
200 | // |
201 | this.FileExport.Index = 1; |
202 | this.FileExport.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { |
203 | this.ImportBRep, |
204 | this.ImportIges, |
205 | this.ImportStep}); |
206 | this.FileExport.Text = "&Import"; |
207 | this.FileExport.Visible = false; |
208 | // |
209 | // ImportBRep |
210 | // |
211 | this.ImportBRep.Index = 0; |
212 | this.ImportBRep.Text = "&BRep ..."; |
213 | this.ImportBRep.Click += new System.EventHandler(this.ImportBRep_Click); |
214 | // |
215 | // ImportIges |
216 | // |
217 | this.ImportIges.Index = 1; |
218 | this.ImportIges.Text = "&Iges ..."; |
219 | this.ImportIges.Click += new System.EventHandler(this.ImportIges_Click); |
220 | // |
221 | // ImportStep |
222 | // |
223 | this.ImportStep.Index = 2; |
224 | this.ImportStep.Text = "&Step ..."; |
225 | this.ImportStep.Click += new System.EventHandler(this.ImportStep_Click); |
226 | // |
227 | // FileImport |
228 | // |
229 | this.FileImport.Index = 2; |
230 | this.FileImport.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { |
231 | this.ExportBRep, |
232 | this.ExportIges, |
233 | this.ExportStep, |
234 | this.ExportStl, |
235 | this.ExportVrml, |
236 | this.menuItem3, |
237 | this.ExportImage}); |
238 | this.FileImport.Text = "&Export"; |
239 | this.FileImport.Visible = false; |
240 | this.FileImport.Popup += new System.EventHandler(this.FileImport_Popup); |
241 | // |
242 | // ExportBRep |
243 | // |
244 | this.ExportBRep.Enabled = false; |
245 | this.ExportBRep.Index = 0; |
246 | this.ExportBRep.Text = "&BRep ..."; |
247 | this.ExportBRep.Click += new System.EventHandler(this.ExportBRep_Click); |
248 | // |
249 | // ExportIges |
250 | // |
251 | this.ExportIges.Enabled = false; |
252 | this.ExportIges.Index = 1; |
253 | this.ExportIges.Text = "&Iges ..."; |
254 | this.ExportIges.Click += new System.EventHandler(this.ExportIges_Click); |
255 | // |
256 | // ExportStep |
257 | // |
258 | this.ExportStep.Enabled = false; |
259 | this.ExportStep.Index = 2; |
260 | this.ExportStep.Text = "&Step ..."; |
261 | this.ExportStep.Click += new System.EventHandler(this.ExportStep_Click); |
262 | // |
263 | // ExportStl |
264 | // |
265 | this.ExportStl.Enabled = false; |
266 | this.ExportStl.Index = 3; |
267 | this.ExportStl.Text = "&Stl ..."; |
268 | this.ExportStl.Click += new System.EventHandler(this.ExportStl_Click); |
269 | // |
270 | // ExportVrml |
271 | // |
272 | this.ExportVrml.Enabled = false; |
273 | this.ExportVrml.Index = 4; |
274 | this.ExportVrml.Text = "&Vrml ..."; |
275 | this.ExportVrml.Click += new System.EventHandler(this.ExportVrml_Click); |
276 | // |
277 | // menuItem3 |
278 | // |
279 | this.menuItem3.Index = 5; |
280 | this.menuItem3.Text = "-"; |
281 | // |
282 | // ExportImage |
283 | // |
284 | this.ExportImage.Index = 6; |
285 | this.ExportImage.Text = "Image ..."; |
286 | this.ExportImage.Click += new System.EventHandler(this.ExportImage_Click); |
287 | // |
288 | // FileClose |
289 | // |
290 | this.FileClose.Enabled = false; |
291 | this.FileClose.Index = 3; |
292 | this.FileClose.Text = "&Close"; |
293 | this.FileClose.Click += new System.EventHandler(this.menuItem3_Click); |
294 | // |
295 | // menuItem2 |
296 | // |
297 | this.menuItem2.Index = 4; |
298 | this.menuItem2.Text = "-"; |
299 | // |
300 | // menuItem1 |
301 | // |
302 | this.menuItem1.Index = 5; |
303 | this.menuItem1.Text = "&Quit"; |
304 | this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click); |
305 | // |
306 | // View |
307 | // |
308 | this.View.Index = 1; |
309 | this.View.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { |
310 | this.ViewToolbar, |
311 | this.ViewStatusBar}); |
312 | this.View.Text = "&View"; |
313 | // |
314 | // ViewToolbar |
315 | // |
316 | this.ViewToolbar.Checked = true; |
317 | this.ViewToolbar.Index = 0; |
318 | this.ViewToolbar.Text = "&Toolbar"; |
319 | this.ViewToolbar.Click += new System.EventHandler(this.ViewToolbar_Click); |
320 | // |
321 | // ViewStatusBar |
322 | // |
323 | this.ViewStatusBar.Checked = true; |
324 | this.ViewStatusBar.Index = 1; |
325 | this.ViewStatusBar.Text = "&Statusbar"; |
326 | this.ViewStatusBar.Click += new System.EventHandler(this.ViewStatusBar_Click); |
327 | // |
328 | // Window |
329 | // |
330 | this.Window.Index = 2; |
331 | this.Window.MdiList = true; |
332 | this.Window.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { |
333 | this.menuItem4, |
334 | this.WindowCascade, |
335 | this.WindowTile}); |
336 | this.Window.Text = "&Window"; |
337 | this.Window.Visible = false; |
338 | // |
339 | // menuItem4 |
340 | // |
341 | this.menuItem4.Index = 0; |
342 | this.menuItem4.Text = "&New 3d View"; |
343 | this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click); |
344 | // |
345 | // WindowCascade |
346 | // |
347 | this.WindowCascade.Index = 1; |
348 | this.WindowCascade.Text = "&Cascade"; |
349 | this.WindowCascade.Click += new System.EventHandler(this.WindowCascade_Click); |
350 | // |
351 | // WindowTile |
352 | // |
353 | this.WindowTile.Index = 2; |
354 | this.WindowTile.Text = "&Tile"; |
355 | this.WindowTile.Click += new System.EventHandler(this.WindowTile_Click); |
356 | // |
357 | // Help |
358 | // |
359 | this.Help.Index = 3; |
360 | this.Help.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { |
361 | this.HelpAbout}); |
362 | this.Help.Text = "&Help"; |
363 | // |
364 | // HelpAbout |
365 | // |
366 | this.HelpAbout.Index = 0; |
367 | this.HelpAbout.Shortcut = System.Windows.Forms.Shortcut.F1; |
368 | this.HelpAbout.Text = "&About"; |
369 | this.HelpAbout.Click += new System.EventHandler(this.HelpAbout_Click); |
370 | // |
371 | // toolBarTool |
372 | // |
373 | this.toolBarTool.AccessibleRole = System.Windows.Forms.AccessibleRole.ToolBar; |
374 | this.toolBarTool.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { |
375 | this.New, |
376 | this.About, |
377 | this.toolBarButton1, |
378 | this.wireframe, |
379 | this.shading, |
380 | this.color, |
381 | this.material, |
382 | this.transparency, |
383 | this.delete}); |
384 | this.toolBarTool.DropDownArrows = true; |
385 | this.toolBarTool.ImageList = this.imageList1; |
386 | this.toolBarTool.Location = new System.Drawing.Point(0, 0); |
387 | this.toolBarTool.Name = "toolBarTool"; |
388 | this.toolBarTool.ShowToolTips = true; |
389 | this.toolBarTool.Size = new System.Drawing.Size(560, 28); |
390 | this.toolBarTool.TabIndex = 1; |
391 | this.toolBarTool.Enter += new System.EventHandler(this.menuItem3_Click); |
392 | this.toolBarTool.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick); |
393 | this.toolBarTool.MouseHover += new System.EventHandler(this.toolBar1_MouseHover); |
394 | this.toolBarTool.MouseLeave += new System.EventHandler(this.toolBar1_MouseLeave); |
395 | // |
396 | // New |
397 | // |
398 | this.New.ImageIndex = 0; |
399 | this.New.ToolTipText = "New"; |
400 | this.New.Visible = ((bool)(configurationAppSettings.GetValue("New.Visible", typeof(bool)))); |
401 | // |
402 | // About |
403 | // |
404 | this.About.ImageIndex = 1; |
405 | this.About.ToolTipText = "About(F1)"; |
406 | this.About.Visible = ((bool)(configurationAppSettings.GetValue("About.Visible", typeof(bool)))); |
407 | // |
408 | // toolBarButton1 |
409 | // |
410 | this.toolBarButton1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; |
411 | // |
412 | // wireframe |
413 | // |
414 | this.wireframe.Enabled = ((bool)(configurationAppSettings.GetValue("wireframe.Enabled", typeof(bool)))); |
415 | this.wireframe.ImageIndex = 2; |
416 | this.wireframe.Pushed = ((bool)(configurationAppSettings.GetValue("wireframe.Pushed", typeof(bool)))); |
417 | this.wireframe.ToolTipText = "Wireframe"; |
418 | this.wireframe.Visible = ((bool)(configurationAppSettings.GetValue("wireframe.Visible", typeof(bool)))); |
419 | // |
420 | // shading |
421 | // |
422 | this.shading.Enabled = ((bool)(configurationAppSettings.GetValue("shading.Enabled", typeof(bool)))); |
423 | this.shading.ImageIndex = 3; |
424 | this.shading.Pushed = ((bool)(configurationAppSettings.GetValue("shading.Pushed", typeof(bool)))); |
425 | this.shading.ToolTipText = "Shading"; |
426 | this.shading.Visible = ((bool)(configurationAppSettings.GetValue("shading.Visible", typeof(bool)))); |
427 | // |
428 | // color |
429 | // |
430 | this.color.Enabled = ((bool)(configurationAppSettings.GetValue("color.Enabled", typeof(bool)))); |
431 | this.color.ImageIndex = 4; |
432 | this.color.ToolTipText = "Color"; |
433 | this.color.Visible = ((bool)(configurationAppSettings.GetValue("color.Visible", typeof(bool)))); |
434 | // |
435 | // material |
436 | // |
437 | this.material.Enabled = ((bool)(configurationAppSettings.GetValue("material.Enabled", typeof(bool)))); |
438 | this.material.ImageIndex = 5; |
439 | this.material.ToolTipText = "Material"; |
440 | this.material.Visible = ((bool)(configurationAppSettings.GetValue("material.Visible", typeof(bool)))); |
441 | // |
442 | // transparency |
443 | // |
444 | this.transparency.Enabled = ((bool)(configurationAppSettings.GetValue("transparency.Enabled", typeof(bool)))); |
445 | this.transparency.ImageIndex = 6; |
446 | this.transparency.ToolTipText = "Transparency"; |
447 | this.transparency.Visible = ((bool)(configurationAppSettings.GetValue("transparency.Visible", typeof(bool)))); |
448 | // |
449 | // delete |
450 | // |
451 | this.delete.Enabled = ((bool)(configurationAppSettings.GetValue("delete.Enabled", typeof(bool)))); |
452 | this.delete.ImageIndex = 7; |
453 | this.delete.ToolTipText = "Delete"; |
454 | this.delete.Visible = ((bool)(configurationAppSettings.GetValue("delete.Visible", typeof(bool)))); |
455 | // |
456 | // imageList1 |
457 | // |
458 | this.imageList1.ImageSize = new System.Drawing.Size(16, 16); |
459 | this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); |
460 | this.imageList1.TransparentColor = System.Drawing.Color.Transparent; |
461 | // |
462 | // myStatusBar |
463 | // |
464 | this.myStatusBar.AccessibleRole = System.Windows.Forms.AccessibleRole.StatusBar; |
465 | this.myStatusBar.Location = new System.Drawing.Point(0, 363); |
466 | this.myStatusBar.Name = "myStatusBar"; |
467 | this.myStatusBar.Size = new System.Drawing.Size(560, 22); |
468 | this.myStatusBar.TabIndex = 3; |
469 | // |
470 | // toolBarView |
471 | // |
472 | this.toolBarView.AccessibleRole = System.Windows.Forms.AccessibleRole.ToolBar; |
473 | this.toolBarView.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { |
474 | this.ZoomAll, |
475 | this.ZoomWin, |
476 | this.ZoomProg, |
477 | this.Pan, |
478 | this.PanGlo, |
479 | this.Front, |
480 | this.Back, |
481 | this.TOP, |
482 | this.BOTTOM, |
483 | this.LEFT, |
484 | this.RIGHT, |
485 | this.Axo, |
486 | this.Rot, |
487 | this.Reset, |
488 | this.HlrOn, |
489 | this.HlrOff}); |
490 | this.toolBarView.DropDownArrows = true; |
491 | this.toolBarView.ImageList = this.imageList1; |
492 | this.toolBarView.Location = new System.Drawing.Point(0, 28); |
493 | this.toolBarView.Name = "toolBarView"; |
494 | this.toolBarView.ShowToolTips = true; |
495 | this.toolBarView.Size = new System.Drawing.Size(560, 28); |
496 | this.toolBarView.TabIndex = 5; |
497 | this.toolBarView.Visible = false; |
498 | this.toolBarView.Wrappable = false; |
499 | this.toolBarView.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBarView_ButtonClick); |
500 | this.toolBarView.MouseHover += new System.EventHandler(this.toolBarView_MouseHover); |
501 | this.toolBarView.MouseLeave += new System.EventHandler(this.toolBarView_MouseLeave); |
502 | // |
503 | // ZoomAll |
504 | // |
505 | this.ZoomAll.ImageIndex = 8; |
506 | this.ZoomAll.ToolTipText = "FitAll"; |
507 | // |
508 | // ZoomWin |
509 | // |
510 | this.ZoomWin.ImageIndex = 9; |
511 | this.ZoomWin.ToolTipText = "Zoom Window"; |
512 | // |
513 | // ZoomProg |
514 | // |
515 | this.ZoomProg.ImageIndex = 10; |
516 | this.ZoomProg.ToolTipText = "Dynamic Zooming"; |
517 | // |
518 | // Pan |
519 | // |
520 | this.Pan.ImageIndex = 11; |
521 | this.Pan.ToolTipText = "Dynamic Panning"; |
522 | // |
523 | // PanGlo |
524 | // |
525 | this.PanGlo.ImageIndex = 12; |
526 | this.PanGlo.ToolTipText = "GlobalPanning"; |
527 | // |
528 | // Front |
529 | // |
530 | this.Front.ImageIndex = 13; |
531 | this.Front.ToolTipText = "Front"; |
532 | // |
533 | // Back |
534 | // |
535 | this.Back.ImageIndex = 14; |
536 | this.Back.ToolTipText = "Back"; |
537 | // |
538 | // TOP |
539 | // |
540 | this.TOP.ImageIndex = 15; |
541 | this.TOP.ToolTipText = "Top"; |
542 | // |
543 | // BOTTOM |
544 | // |
545 | this.BOTTOM.ImageIndex = 16; |
546 | this.BOTTOM.ToolTipText = "Bottom"; |
547 | // |
548 | // LEFT |
549 | // |
550 | this.LEFT.ImageIndex = 17; |
551 | this.LEFT.ToolTipText = "Left"; |
552 | // |
553 | // RIGHT |
554 | // |
555 | this.RIGHT.ImageIndex = 18; |
556 | this.RIGHT.ToolTipText = "Right"; |
557 | // |
558 | // Axo |
559 | // |
560 | this.Axo.ImageIndex = 19; |
561 | this.Axo.ToolTipText = "Axo"; |
562 | // |
563 | // Rot |
564 | // |
565 | this.Rot.ImageIndex = 20; |
566 | this.Rot.ToolTipText = "Dynamic Rotation"; |
567 | // |
568 | // Reset |
569 | // |
570 | this.Reset.ImageIndex = 21; |
571 | this.Reset.ToolTipText = "Reset"; |
572 | // |
573 | // HlrOn |
574 | // |
575 | this.HlrOn.ImageIndex = 22; |
576 | this.HlrOn.Pushed = true; |
577 | this.HlrOn.ToolTipText = "Hidden On"; |
578 | // |
579 | // HlrOff |
580 | // |
581 | this.HlrOff.ImageIndex = 23; |
582 | this.HlrOff.ToolTipText = "Hidden Off"; |
583 | // |
584 | // Form1 |
585 | // |
586 | this.AccessibleRole = System.Windows.Forms.AccessibleRole.Application; |
587 | this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); |
588 | this.ClientSize = new System.Drawing.Size(560, 385); |
589 | this.Controls.Add(this.toolBarView); |
590 | this.Controls.Add(this.myStatusBar); |
591 | this.Controls.Add(this.toolBarTool); |
592 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); |
593 | this.IsMdiContainer = true; |
594 | this.Menu = this.mainMenu1; |
595 | this.Name = "Form1"; |
596 | this.Text = "Sample Import / Export"; |
597 | this.Activated += new System.EventHandler(this.Form1_Activated); |
598 | this.ResumeLayout(false); |
599 | |
600 | } |
601 | #endregion |
602 | |
603 | /// <summary> |
604 | /// The main entry point for the application. |
605 | /// </summary> |
606 | [STAThread] |
607 | static void Main() |
608 | { |
609 | Application.Run(new Form1()); |
610 | } |
611 | |
612 | private void menuItem2_Click(object sender, System.EventArgs e) |
613 | { |
614 | |
615 | this.Cursor=System.Windows.Forms.Cursors.WaitCursor; |
616 | this.OnNewFile(); |
617 | } |
618 | |
619 | private void menuItem3_Click(object sender, System.EventArgs e) |
620 | { |
621 | if ( this.MdiChildren.Length > 0 ) |
622 | this.ActiveMdiChild.Close(); |
623 | |
624 | } |
625 | |
626 | private void ImportBRep_Click(object sender, System.EventArgs e) |
627 | { |
628 | |
629 | Form2 curForm = (Form2) this.ActiveMdiChild; |
630 | if (curForm == null) |
631 | return; |
632 | this.myModelFormat=ModelFormat.BREP; |
633 | curForm.ImportModel(this.myModelFormat); |
634 | |
635 | } |
636 | |
637 | private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) |
638 | { |
639 | |
640 | Form2 curForm = (Form2) this.ActiveMdiChild; |
641 | switch(toolBarTool.Buttons.IndexOf(e.Button)) |
642 | { |
643 | case 0: |
644 | this.Cursor=System.Windows.Forms.Cursors.WaitCursor; |
645 | this.OnNewFile(); |
646 | break; |
647 | case 1: |
648 | AboutDialog myDlg = new AboutDialog(); |
649 | myDlg.ShowDialog(this); |
650 | break; |
651 | |
652 | case 2: //just separator |
653 | break; |
654 | case 3: |
655 | if (curForm == null) |
656 | return; |
657 | curForm.SetDisplayMode(0); //wireframe |
658 | this.wireframe.Enabled=false; |
659 | this.shading.Enabled=true; |
660 | this.transparency.Enabled=false; |
661 | break; |
662 | case 4: |
663 | if (curForm == null) |
664 | return; |
665 | curForm.SetDisplayMode(1); //shading |
666 | this.shading.Enabled=false; |
667 | this.wireframe.Enabled=true; |
668 | this.transparency.Enabled=true; |
669 | break; |
670 | case 5: |
671 | if (curForm == null) |
672 | return; |
673 | curForm.ChangeColor(true); |
674 | break; |
675 | case 6: |
676 | if (curForm == null) |
677 | return; |
678 | MaterialDialog m = new MaterialDialog(); |
679 | m.View=curForm.View; |
680 | m.ShowDialog(curForm); |
681 | break; |
682 | case 7: |
683 | if (curForm == null) |
684 | return; |
685 | IE.TransparencyDialog t = new TransparencyDialog(); |
686 | t.View=curForm.View; |
687 | t.ShowDialog(curForm); |
688 | break; |
689 | case 8: |
690 | if (curForm == null) |
691 | return; |
692 | curForm.DeleteObjects(); |
693 | break; |
694 | default: |
695 | break; |
696 | } |
697 | } |
698 | |
699 | private void toolBar1_MouseHover(object sender, System.EventArgs e) |
700 | { |
701 | this.myStatusBar.Text="Document toolbar"; |
702 | } |
703 | |
704 | private void toolBar1_MouseLeave(object sender, System.EventArgs e) |
705 | { |
706 | this.myStatusBar.Text=""; |
707 | } |
708 | |
709 | private void ImportCsfdb_Click(object sender, System.EventArgs e) |
710 | { |
711 | Form2 curForm = (Form2) this.ActiveMdiChild; |
712 | if (curForm == null) |
713 | return; |
714 | this.myModelFormat=IE.ModelFormat.CSFDB; |
715 | curForm.ImportModel(this.myModelFormat); |
716 | } |
717 | |
718 | private void ImportIges_Click(object sender, System.EventArgs e) |
719 | { |
720 | Form2 curForm = (Form2) this.ActiveMdiChild; |
721 | if (curForm == null) |
722 | return; |
723 | this.myModelFormat=IE.ModelFormat.IGES; |
724 | curForm.ImportModel(this.myModelFormat); |
725 | } |
726 | |
727 | private void ImportStep_Click(object sender, System.EventArgs e) |
728 | { |
729 | Form2 curForm = (Form2) this.ActiveMdiChild; |
730 | if (curForm == null) |
731 | return; |
732 | this.myModelFormat=IE.ModelFormat.STEP; |
733 | curForm.ImportModel(this.myModelFormat); |
734 | } |
735 | |
736 | private void ExportBRep_Click(object sender, System.EventArgs e) |
737 | { |
738 | Form2 curForm = (Form2) this.ActiveMdiChild; |
739 | if (curForm == null) |
740 | return; |
741 | this.myModelFormat=IE.ModelFormat.BREP; |
742 | curForm.ExportModel(this.myModelFormat); |
743 | } |
744 | |
745 | private void ExportCsfdb_Click(object sender, System.EventArgs e) |
746 | { |
747 | Form2 curForm = (Form2) this.ActiveMdiChild; |
748 | if (curForm == null) |
749 | return; |
750 | this.myModelFormat=IE.ModelFormat.CSFDB; |
751 | curForm.ExportModel(this.myModelFormat); |
752 | } |
753 | |
754 | private void ExportIges_Click(object sender, System.EventArgs e) |
755 | { |
756 | Form2 curForm = (Form2) this.ActiveMdiChild; |
757 | if (curForm == null) |
758 | return; |
759 | this.myModelFormat=IE.ModelFormat.IGES; |
760 | curForm.ExportModel(this.myModelFormat); |
761 | } |
762 | |
763 | private void ExportStep_Click(object sender, System.EventArgs e) |
764 | { |
765 | Form2 curForm = (Form2) this.ActiveMdiChild; |
766 | if (curForm == null) |
767 | return; |
768 | this.myModelFormat=IE.ModelFormat.STEP; |
769 | curForm.ExportModel(this.myModelFormat); |
770 | } |
771 | |
772 | private void ExportStl_Click(object sender, System.EventArgs e) |
773 | { |
774 | Form2 curForm = (Form2) this.ActiveMdiChild; |
775 | if (curForm == null) |
776 | return; |
777 | this.myModelFormat=IE.ModelFormat.STL; |
778 | curForm.ExportModel(this.myModelFormat); |
779 | } |
780 | |
781 | private void ExportVrml_Click(object sender, System.EventArgs e) |
782 | { |
783 | Form2 curForm = (Form2) this.ActiveMdiChild; |
784 | if (curForm == null) |
785 | return; |
786 | this.myModelFormat=IE.ModelFormat.VRML; |
787 | curForm.ExportModel(this.myModelFormat); |
788 | } |
789 | |
790 | private void ExportImage_Click(object sender, System.EventArgs e) |
791 | { |
792 | Form2 curForm = (Form2) this.ActiveMdiChild; |
793 | if (curForm == null) |
794 | return; |
795 | this.myModelFormat=IE.ModelFormat.IMAGE; |
796 | curForm.ExportModel(this.myModelFormat); |
797 | } |
798 | |
799 | private void HelpAbout_Click(object sender, System.EventArgs e) |
800 | { |
801 | AboutDialog myDlg = new AboutDialog(); |
802 | myDlg.ShowDialog(this); |
803 | } |
804 | |
805 | private void ViewToolbar_Click(object sender, System.EventArgs e) |
806 | { |
807 | |
808 | if (this.ViewToolbar.Checked) |
809 | { |
810 | if (this.MdiChildren.Length > 0) |
811 | { |
812 | this.New.Visible=false; |
813 | this.About.Visible=false; |
814 | } |
815 | else |
816 | this.toolBarTool.Hide(); |
817 | this.ViewToolbar.Checked=false; |
818 | } |
819 | else |
820 | { |
821 | if (this.MdiChildren.Length > 0) |
822 | { |
823 | this.New.Visible=true; |
824 | this.About.Visible=true; |
825 | } |
826 | else |
827 | this.toolBarTool.Show(); |
828 | this.ViewToolbar.Checked=true; |
829 | } |
830 | |
831 | } |
832 | |
833 | private void ViewStatusBar_Click(object sender, System.EventArgs e) |
834 | { |
835 | if (this.ViewStatusBar.Checked) |
836 | { |
837 | this.myStatusBar.Hide(); |
838 | this.ViewStatusBar.Checked=false; |
839 | } |
840 | else |
841 | { |
842 | this.myStatusBar.Show(); |
843 | this.ViewStatusBar.Checked=true; |
844 | } |
845 | } |
846 | |
847 | public void OnNewFile() |
848 | { |
849 | Form2 newForm = new Form2(); |
850 | newForm.MdiParent=this; |
851 | IE.Form1.myNbOfChildren=IE.Form1.myNbOfChildren+1; |
852 | string str = System.String.Format(newForm.Text+" {0}:{1}", IE.Form1.myNbOfChildren, 1); |
853 | newForm.Text=str;; |
854 | newForm.Show(); |
855 | newForm.InitView(); |
856 | newForm.InitV3D(); |
857 | this.FileExport.Visible=true; |
858 | this.FileImport.Visible=true; |
859 | this.Window.Visible=true; |
860 | this.wireframe.Visible=true; |
861 | this.shading.Visible=true; |
862 | this.color.Visible=true; |
863 | this.material.Visible=true; |
864 | this.transparency.Visible=true; |
865 | this.delete.Visible=true; |
866 | this.Cursor=System.Windows.Forms.Cursors.Default; |
867 | this.toolBarView.Visible=true; |
868 | } |
869 | |
870 | private void FileImport_Popup(object sender, System.EventArgs e) |
871 | { |
872 | IE.Form2 curForm = (IE.Form2) this.ActiveMdiChild; |
873 | if (curForm==null) |
874 | return; |
875 | if ( curForm.View.IsObjectSelected()) |
876 | { |
877 | this.ExportBRep.Enabled=true; |
878 | this.ExportIges.Enabled=true; |
879 | this.ExportStep.Enabled=true; |
880 | this.ExportVrml.Enabled=true; |
881 | this.ExportStl.Enabled=true; |
882 | } |
883 | |
884 | } |
885 | |
886 | private void menuItem1_Click(object sender, System.EventArgs e) |
887 | { |
888 | this.Close(); |
889 | } |
890 | |
891 | private void File_Popup(object sender, System.EventArgs e) |
892 | { |
893 | if (this.MdiChildren.Length > 0 ) |
894 | this.FileClose.Enabled=true; |
895 | else |
896 | { |
897 | this.FileClose.Enabled=false; |
898 | this.FileExport.Visible=false; |
899 | this.FileImport.Visible=false; |
900 | } |
901 | } |
902 | |
903 | private void menuItem4_Click(object sender, System.EventArgs e) |
904 | { |
905 | IE.Form2 curForm = (IE.Form2) this.ActiveMdiChild; |
906 | IE.Form2 newView = new Form2(); |
907 | newView.MdiParent=this; |
908 | newView.Show(); |
909 | newView.InitView(); |
910 | newView.SetContext(curForm.View); |
911 | newView.View.CreateNewView(newView.Handle); |
912 | string title = curForm.Text; |
913 | System.Text.StringBuilder bld= new System.Text.StringBuilder(title); |
914 | char c = bld[title.Length-1]; |
915 | string s=c.ToString(); |
916 | int NbOfView = newView.View.CharToInt(s); |
917 | NbOfView++; |
918 | bld.Remove(title.Length-1, 1); |
919 | bld.Append(NbOfView); |
920 | newView.Text=bld.ToString(); |
921 | } |
922 | |
923 | private void WindowCascade_Click(object sender, System.EventArgs e) |
924 | { |
925 | this.LayoutMdi(System.Windows.Forms.MdiLayout.Cascade); |
926 | } |
927 | |
928 | private void WindowTile_Click(object sender, System.EventArgs e) |
929 | { |
930 | this.LayoutMdi(System.Windows.Forms.MdiLayout.TileVertical); |
931 | } |
932 | |
933 | public void SelectionChanged() |
934 | { |
935 | if (this.MdiChildren.Length == 0 ) |
936 | return; |
937 | IE.Form2 curForm = (IE.Form2) this.ActiveMdiChild; |
938 | if ( curForm == null ) |
939 | return; |
940 | switch (curForm.View.DisplayMode()) |
941 | { |
942 | case -1: |
943 | this.shading.Enabled=false; |
944 | this.wireframe.Enabled=false; |
945 | break; |
946 | case 0: |
947 | this.wireframe.Enabled=false; |
948 | this.shading.Enabled=true; |
949 | this.transparency.Enabled=false; |
950 | break; |
951 | case 1: |
952 | this.wireframe.Enabled=true; |
953 | this.shading.Enabled=false; |
954 | this.transparency.Enabled=true; |
955 | break; |
956 | case 10: |
957 | this.wireframe.Enabled=true; |
958 | this.shading.Enabled=true; |
959 | this.transparency.Enabled=true; |
960 | break; |
961 | default: |
962 | break; |
963 | } |
964 | bool IsSelected = curForm.View.IsObjectSelected(); |
965 | if (IsSelected) |
966 | { |
967 | this.color.Enabled=true; |
968 | this.material.Enabled=true; |
969 | this.delete.Enabled=true; |
970 | } |
971 | else |
972 | { |
973 | this.color.Enabled=false; |
974 | this.material.Enabled=false; |
975 | this.transparency.Enabled=false; |
976 | this.delete.Enabled=false; |
977 | } |
978 | if (curForm.DegenerateMode) |
979 | { |
980 | this.HlrOff.Pushed=false; |
981 | this.HlrOn.Pushed=true; |
982 | } |
983 | else |
984 | { |
985 | this.HlrOff.Pushed=true; |
986 | this.HlrOn.Pushed=false; |
987 | } |
988 | if (curForm.Mode == IE.CurrentAction3d.CurAction3d_WindowZooming) |
989 | this.ZoomWin.Pushed=false; |
990 | |
991 | } |
992 | |
993 | public StatusBar StatusBar |
994 | { |
995 | get |
996 | { |
997 | return this.myStatusBar; |
998 | } |
999 | } |
1000 | |
1001 | public void OnFileClose() |
1002 | { |
1003 | if ( this.MdiChildren.Length <= 1) |
1004 | { |
1005 | this.FileClose.Enabled=false; |
1006 | this.Window.Visible=false; |
1007 | this.wireframe.Visible=false; |
1008 | this.shading.Visible=false; |
1009 | this.color.Visible=false; |
1010 | this.material.Visible=false; |
1011 | this.transparency.Visible=false; |
1012 | this.delete.Visible=false; |
1013 | this.toolBarView.Visible=false; |
1014 | } |
1015 | } |
1016 | |
1017 | private void toolBarView_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) |
1018 | { |
1019 | IE.Form2 curForm = (IE.Form2) this.ActiveMdiChild; |
1020 | if ( curForm == null ) |
1021 | return; |
1022 | switch(toolBarView.Buttons.IndexOf(e.Button)) |
1023 | { |
1024 | case 0: |
1025 | curForm.View.ZoomAllView(); |
1026 | break; |
1027 | case 1: |
1028 | curForm.Mode=CurrentAction3d.CurAction3d_WindowZooming; |
1029 | this.ZoomWin.Pushed=true; |
1030 | break; |
1031 | case 2: |
1032 | curForm.Mode=CurrentAction3d.CurAction3d_DynamicZooming; |
1033 | break; |
1034 | case 3: |
1035 | curForm.Mode=CurrentAction3d.CurAction3d_DynamicPanning; |
1036 | break; |
1037 | case 4: |
1038 | curForm.Zoom=curForm.View.Scale(); |
1039 | curForm.Mode=CurrentAction3d.CurAction3d_GlobalPanning; |
1040 | break; |
1041 | case 5: |
1042 | curForm.View.FrontView(); |
1043 | break; |
1044 | case 6: |
1045 | curForm.View.TopView(); |
1046 | break; |
1047 | case 7: |
1048 | curForm.View.LeftView(); |
1049 | break; |
1050 | case 8: |
1051 | curForm.View.BackView(); |
1052 | break; |
1053 | case 9: |
1054 | curForm.View.RightView(); |
1055 | break; |
1056 | case 10: |
1057 | curForm.View.BottomView(); |
1058 | break; |
1059 | case 11: |
1060 | curForm.View.AxoView(); |
1061 | break; |
1062 | case 12: |
1063 | curForm.Mode=CurrentAction3d.CurAction3d_DynamicRotation; |
1064 | break; |
1065 | case 13: |
1066 | curForm.View.Reset(); |
1067 | break; |
1068 | case 14: |
1069 | curForm.View.SetDegenerateModeOn(); |
1070 | curForm.DegenerateMode=true; |
1071 | this.HlrOff.Pushed=false; |
1072 | this.HlrOn.Pushed=true; |
1073 | break; |
1074 | case 15: |
1075 | curForm.View.SetDegenerateModeOff(); |
1076 | curForm.DegenerateMode=false; |
1077 | this.HlrOn.Pushed=false; |
1078 | this.HlrOff.Pushed=true; |
1079 | break; |
1080 | default: |
1081 | break; |
1082 | } |
1083 | } |
1084 | |
1085 | private void Form1_Activated(object sender, System.EventArgs e) |
1086 | { |
1087 | if (this.toolBarView.Visible) |
1088 | this.SelectionChanged(); |
1089 | } |
1090 | |
1091 | private void toolBarView_MouseHover(object sender, System.EventArgs e) |
1092 | { |
1093 | this.myStatusBar.Text="View toolbar"; |
1094 | } |
1095 | |
1096 | private void toolBarView_MouseLeave(object sender, System.EventArgs e) |
1097 | { |
1098 | this.myStatusBar.Text=""; |
1099 | } |
1100 | |
1101 | } |
1102 | |
1103 | } |