]>
Commit | Line | Data |
---|---|---|
f6bcfd97 BP |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wxib.cpp | |
3 | // Purpose: wxInstall Builder | |
4 | // Author: Julian Smart | |
5 | // Author: Brian Smith | |
6 | // Modified by: | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | // ============================================================================ | |
11 | // declarations | |
12 | // ============================================================================ | |
13 | ||
14 | // ---------------------------------------------------------------------------- | |
15 | // headers | |
16 | // ---------------------------------------------------------------------------- | |
17 | ||
18 | // For compilers that support precompilation, includes "wx/wx.h". | |
92a19c2e | 19 | #include "wx/wxprec.h" |
f6bcfd97 BP |
20 | |
21 | #ifdef __BORLANDC__ | |
22 | #pragma hdrstop | |
23 | #endif | |
24 | ||
25 | #ifndef WX_PRECOMP | |
5aa5c1e4 | 26 | #include "wx/wx.h" |
f6bcfd97 BP |
27 | #endif |
28 | ||
5aa5c1e4 GD |
29 | #include "wx/toolbar.h" |
30 | #include "wx/log.h" | |
31 | #include "wx/image.h" | |
f6bcfd97 BP |
32 | |
33 | // define this to 1 to use wxToolBarSimple instead of the native one | |
34 | #define USE_GENERIC_TBAR 0 | |
35 | ||
36 | #if USE_GENERIC_TBAR | |
37 | #if !wxUSE_TOOLBAR_SIMPLE | |
38 | #error wxToolBarSimple is not compiled in, set wxUSE_TOOLBAR_SIMPLE \ | |
39 | to 1 in setup.h and recompile the library. | |
40 | #else | |
5aa5c1e4 | 41 | #include "wx/tbarsmpl.h" |
f6bcfd97 BP |
42 | #endif |
43 | #endif // USE_GENERIC_TBAR | |
44 | ||
45 | // ---------------------------------------------------------------------------- | |
46 | // resources | |
47 | // ---------------------------------------------------------------------------- | |
48 | ||
49 | #if defined(__WXGTK__) || defined(__WXMOTIF__) | |
50 | #include "mondrian.xpm" | |
51 | #include "bitmaps/new.xpm" | |
52 | #include "bitmaps/open.xpm" | |
53 | #include "bitmaps/save.xpm" | |
54 | #include "bitmaps/copy.xpm" | |
55 | #include "bitmaps/cut.xpm" | |
56 | #include "bitmaps/preview.xpm" // paste XPM | |
57 | #include "bitmaps/print.xpm" | |
58 | #include "bitmaps/help.xpm" | |
59 | #endif // GTK or Motif | |
60 | ||
61 | char appName[] = "wxInstall Builder"; | |
62 | ||
63 | // ---------------------------------------------------------------------------- | |
64 | // classes | |
65 | // ---------------------------------------------------------------------------- | |
66 | ||
67 | // Define a new application | |
68 | class MyApp : public wxApp | |
69 | { | |
70 | public: | |
71 | bool OnInit(); | |
72 | }; | |
73 | ||
74 | // Define a new frame | |
75 | class MyFrame: public wxFrame | |
76 | { | |
77 | public: | |
78 | MyFrame(wxFrame *parent, | |
79 | wxWindowID id = -1, | |
80 | const wxString& title = "wxInstall Builder", | |
81 | const wxPoint& pos = wxDefaultPosition, | |
82 | const wxSize& size = wxDefaultSize, | |
83 | long style = wxDEFAULT_FRAME_STYLE); | |
84 | ||
85 | void RecreateToolbar(); | |
86 | ||
87 | void OnQuit(wxCommandEvent& event); | |
88 | void OnAbout(wxCommandEvent& event); | |
89 | ||
90 | void OnNewScript(wxCommandEvent& event); | |
91 | void OnOpenScript(wxCommandEvent& event); | |
92 | void OnSaveScript(wxCommandEvent& event); | |
93 | void OnNewProject(wxCommandEvent& event); | |
94 | void OnOpenProject(wxCommandEvent& event); | |
95 | void OnSaveProject(wxCommandEvent& event); | |
96 | ||
97 | void OnCut(wxCommandEvent& event); | |
98 | void OnCopy(wxCommandEvent& event); | |
99 | void OnPaste(wxCommandEvent& event); | |
100 | ||
101 | void OnListBoxDoubleClick(wxCommandEvent& event); | |
102 | ||
103 | #if USE_GENERIC_TBAR | |
104 | virtual wxToolBar *OnCreateToolBar(long style, | |
105 | wxWindowID id, | |
106 | const wxString& name ); | |
107 | #endif // USE_GENERIC_TBAR | |
108 | ||
109 | private: | |
110 | bool m_smallToolbar, | |
111 | m_horzToolbar; | |
112 | size_t m_rows; // 1 or 2 only | |
113 | ||
114 | wxTextCtrl* m_textWindow; | |
115 | wxListBox* m_listBox; | |
116 | ||
117 | DECLARE_EVENT_TABLE() | |
118 | }; | |
119 | ||
120 | // ---------------------------------------------------------------------------- | |
121 | // constants | |
122 | // ---------------------------------------------------------------------------- | |
123 | ||
124 | const int ID_TOOLBAR = 500; | |
125 | ||
126 | enum | |
127 | { | |
128 | ID_COMBO = 1000, | |
129 | ID_LISTBOX, | |
130 | wxID_NEW_SCRIPT, | |
131 | wxID_SAVE_SCRIPT, | |
132 | wxID_OPEN_SCRIPT, | |
133 | wxID_NEW_PROJECT, | |
134 | wxID_SAVE_PROJECT, | |
135 | wxID_OPEN_PROJECT | |
136 | }; | |
137 | ||
138 | // ---------------------------------------------------------------------------- | |
139 | // event tables | |
140 | // ---------------------------------------------------------------------------- | |
141 | ||
142 | // Notice that wxID_HELP will be processed for the 'About' menu and the toolbar | |
143 | // help button. | |
144 | ||
145 | BEGIN_EVENT_TABLE(MyFrame, wxFrame) | |
146 | EVT_MENU(wxID_EXIT, MyFrame::OnQuit) | |
147 | EVT_MENU(wxID_HELP, MyFrame::OnAbout) | |
148 | ||
149 | EVT_MENU(wxID_NEW_SCRIPT, MyFrame::OnNewScript) | |
150 | EVT_MENU(wxID_OPEN_SCRIPT, MyFrame::OnOpenScript) | |
151 | EVT_MENU(wxID_SAVE_SCRIPT, MyFrame::OnSaveScript) | |
152 | EVT_MENU(wxID_NEW_PROJECT, MyFrame::OnNewProject) | |
153 | EVT_MENU(wxID_OPEN_PROJECT, MyFrame::OnOpenProject) | |
154 | EVT_MENU(wxID_SAVE_PROJECT, MyFrame::OnSaveProject) | |
155 | ||
156 | EVT_MENU(wxID_CUT, MyFrame::OnCut) | |
157 | EVT_MENU(wxID_COPY, MyFrame::OnCopy) | |
158 | EVT_MENU(wxID_PASTE, MyFrame::OnPaste) | |
159 | ||
160 | EVT_LISTBOX_DCLICK(ID_LISTBOX, MyFrame::OnListBoxDoubleClick) | |
161 | END_EVENT_TABLE() | |
162 | ||
163 | // ============================================================================ | |
164 | // implementation | |
165 | // ============================================================================ | |
166 | ||
167 | // ---------------------------------------------------------------------------- | |
168 | // MyApp | |
169 | // ---------------------------------------------------------------------------- | |
170 | ||
171 | IMPLEMENT_APP(MyApp) | |
172 | ||
173 | // The `main program' equivalent, creating the windows and returning the | |
174 | // main frame | |
175 | bool MyApp::OnInit() | |
176 | { | |
177 | // Create the main frame window | |
178 | MyFrame* frame = new MyFrame((wxFrame *) NULL, -1, | |
179 | "wxInstall Builder", | |
180 | wxPoint(100, 100), wxSize(450, 300)); | |
181 | ||
182 | frame->SetAutoLayout(TRUE); | |
183 | ||
184 | frame->Show(TRUE); | |
185 | ||
186 | frame->SetStatusText("Welcome to wxWindows Install Builder"); | |
187 | ||
188 | SetTopWindow(frame); | |
189 | ||
190 | return TRUE; | |
191 | } | |
192 | ||
193 | void MyFrame::RecreateToolbar() | |
194 | { | |
195 | // delete and recreate the toolbar | |
196 | wxToolBarBase *toolBar = GetToolBar(); | |
197 | delete toolBar; | |
198 | ||
199 | SetToolBar(NULL); | |
200 | ||
201 | long style = wxNO_BORDER | wxTB_FLAT | wxTB_DOCKABLE; | |
202 | style |= m_horzToolbar ? wxTB_HORIZONTAL : wxTB_VERTICAL; | |
203 | ||
204 | toolBar = CreateToolBar(style, ID_TOOLBAR); | |
205 | toolBar->SetMargins( 4, 4 ); | |
206 | ||
207 | // Set up toolbar | |
208 | wxBitmap toolBarBitmaps[8]; | |
209 | ||
210 | toolBarBitmaps[0] = wxBITMAP(new); | |
211 | toolBarBitmaps[1] = wxBITMAP(open); | |
212 | toolBarBitmaps[2] = wxBITMAP(save); | |
213 | toolBarBitmaps[3] = wxBITMAP(copy); | |
214 | toolBarBitmaps[4] = wxBITMAP(cut); | |
215 | toolBarBitmaps[5] = wxBITMAP(paste); | |
216 | toolBarBitmaps[6] = wxBITMAP(print); | |
217 | toolBarBitmaps[7] = wxBITMAP(help); | |
218 | ||
219 | if ( !m_smallToolbar ) | |
220 | { | |
221 | int w = 2*toolBarBitmaps[0].GetWidth(), | |
222 | h = 2*toolBarBitmaps[0].GetHeight(); | |
223 | for ( size_t n = 0; n < WXSIZEOF(toolBarBitmaps); n++ ) | |
224 | { | |
225 | toolBarBitmaps[n] = | |
226 | wxImage(toolBarBitmaps[n]).Scale(w, h).ConvertToBitmap(); | |
227 | } | |
228 | ||
229 | toolBar->SetToolBitmapSize(wxSize(w, h)); | |
230 | } | |
231 | ||
232 | #ifdef __WXMSW__ | |
233 | int width = 24; | |
234 | #else | |
235 | int width = 16; | |
236 | #endif | |
237 | ||
238 | int currentX = 5; | |
239 | ||
240 | toolBar->AddTool(wxID_NEW_SCRIPT, toolBarBitmaps[0], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "New script"); | |
241 | currentX += width + 5; | |
242 | toolBar->AddTool(wxID_OPEN_SCRIPT, toolBarBitmaps[1], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Open script"); | |
243 | ||
244 | // neither the generic nor Motif native toolbars really support this | |
245 | currentX += width + 5; | |
246 | toolBar->AddTool(wxID_SAVE_SCRIPT, toolBarBitmaps[2], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Save script"); | |
247 | currentX += width + 5; | |
248 | toolBar->AddTool(wxID_COPY, toolBarBitmaps[3], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Copy"); | |
249 | currentX += width + 5; | |
250 | toolBar->AddTool(wxID_CUT, toolBarBitmaps[4], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Cut"); | |
251 | currentX += width + 5; | |
252 | toolBar->AddTool(wxID_PASTE, toolBarBitmaps[5], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Paste"); | |
253 | currentX += width + 5; | |
254 | toolBar->AddSeparator(); | |
255 | toolBar->AddTool(wxID_HELP, toolBarBitmaps[7], wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Help button"); | |
256 | ||
257 | // after adding the buttons to the toolbar, must call Realize() to reflect | |
258 | // the changes | |
259 | toolBar->Realize(); | |
260 | ||
261 | toolBar->SetRows(m_horzToolbar ? m_rows : 10 / m_rows); | |
262 | } | |
263 | ||
264 | // ---------------------------------------------------------------------------- | |
265 | // MyFrame | |
266 | // ---------------------------------------------------------------------------- | |
267 | ||
268 | // Define my frame constructor | |
269 | MyFrame::MyFrame(wxFrame* parent, | |
270 | wxWindowID id, | |
271 | const wxString& title, | |
272 | const wxPoint& pos, | |
273 | const wxSize& size, | |
274 | long style) | |
275 | : wxFrame(parent, id, title, pos, size, style) | |
276 | { | |
277 | m_listBox = new wxListBox(this, ID_LISTBOX, wxPoint(0,0), wxSize(-1, -1)); | |
278 | ||
279 | m_listBox->Append("loadwxr"); | |
280 | m_listBox->Append("closeold"); | |
281 | m_listBox->Append("mleview"); | |
282 | m_listBox->Append("setbutton"); | |
283 | m_listBox->Append("getcheck"); | |
284 | m_listBox->Append("message"); | |
285 | m_listBox->Append("disable"); | |
286 | m_listBox->Append("settext"); | |
287 | m_listBox->Append("gettext"); | |
288 | m_listBox->Append("grabfile"); | |
289 | m_listBox->Append("remove"); | |
290 | m_listBox->Append("system"); | |
291 | m_listBox->Append("startinst"); | |
292 | ||
293 | wxLayoutConstraints *b1 = new wxLayoutConstraints; | |
294 | b1->left.SameAs (this, wxLeft, 0); | |
295 | b1->top.SameAs (this, wxTop, 0); | |
296 | b1->width.PercentOf (this, wxWidth, 20); | |
297 | b1->bottom.SameAs (this, wxBottom, 0); | |
298 | m_listBox->SetConstraints(b1); | |
299 | ||
300 | m_textWindow = new wxTextCtrl(this, -1, "", wxPoint(0,0), wxSize(-1, -1), wxTE_MULTILINE); | |
301 | ||
302 | m_textWindow->AppendText("; Script generated by wxInstall Builder\n"); | |
303 | ||
304 | wxLayoutConstraints *b2 = new wxLayoutConstraints; | |
305 | b2->top.SameAs (this, wxTop, 0); | |
306 | b2->left.SameAs (m_listBox, wxRight, 0); | |
307 | b2->width.PercentOf (this, wxWidth, 80); | |
308 | b2->bottom.SameAs (this, wxBottom, 0); | |
309 | m_textWindow->SetConstraints(b2); | |
310 | ||
311 | m_smallToolbar = TRUE; | |
312 | m_horzToolbar = TRUE; | |
313 | m_rows = 1; | |
314 | ||
315 | // Give it a status line | |
316 | CreateStatusBar(); | |
317 | ||
318 | // Give it an icon | |
319 | SetIcon(wxICON(mondrian)); | |
320 | ||
321 | wxMenu *fileMenu = new wxMenu; | |
322 | fileMenu->Append(wxID_NEW_SCRIPT, "&New Script", "New wxInstall Script" ); | |
323 | fileMenu->Append(wxID_OPEN_SCRIPT, "&Open Script", "Open wxInstall Script" ); | |
324 | fileMenu->Append(wxID_SAVE_SCRIPT, "&Save Script", "Save wxInstall Script" ); | |
325 | fileMenu->AppendSeparator(); | |
326 | /*fileMenu->Append(wxID_NEW_PROJECT, "N&ew Project", "New wxInstall Project" ); | |
327 | fileMenu->Append(wxID_OPEN_PROJECT, "O&pen Project", "Open wxInstall Project" ); | |
328 | fileMenu->Append(wxID_SAVE_PROJECT, "S&ave Project", "Save wxInstall Project" ); | |
329 | fileMenu->AppendSeparator();*/ | |
330 | fileMenu->Append(wxID_EXIT, "E&xit", "Quit wxInstall Builder" ); | |
331 | ||
332 | wxMenu *helpMenu = new wxMenu; | |
333 | helpMenu->Append(wxID_HELP, "&About", "About wxInstall Builder"); | |
334 | ||
335 | wxMenuBar* menuBar = new wxMenuBar( wxMB_DOCKABLE ); | |
336 | ||
337 | menuBar->Append(fileMenu, "&File"); | |
338 | menuBar->Append(helpMenu, "&Help"); | |
339 | ||
340 | // Associate the menu bar with the frame | |
341 | SetMenuBar(menuBar); | |
342 | ||
343 | // Create the toolbar | |
344 | RecreateToolbar(); | |
345 | } | |
346 | ||
347 | #if USE_GENERIC_TBAR | |
348 | ||
349 | wxToolBar* MyFrame::OnCreateToolBar(long style, | |
350 | wxWindowID id, | |
351 | const wxString& name) | |
352 | { | |
353 | return (wxToolBar *)new wxToolBarSimple(this, id, | |
354 | wxDefaultPosition, wxDefaultSize, | |
355 | style, name); | |
356 | } | |
357 | ||
358 | #endif // USE_GENERIC_TBAR | |
359 | ||
360 | void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) | |
361 | { | |
362 | Close(TRUE); | |
363 | } | |
364 | ||
365 | void MyFrame::OnCut(wxCommandEvent& WXUNUSED(event)) | |
366 | { | |
367 | m_textWindow->Cut(); | |
368 | } | |
369 | ||
370 | void MyFrame::OnCopy(wxCommandEvent& WXUNUSED(event)) | |
371 | { | |
372 | m_textWindow->Copy(); | |
373 | } | |
374 | ||
375 | void MyFrame::OnPaste(wxCommandEvent& WXUNUSED(event)) | |
376 | { | |
377 | m_textWindow->Paste(); | |
378 | } | |
379 | ||
380 | void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) | |
381 | { | |
382 | (void)wxMessageBox("wxInstall Builder by Brian Smith", "About wxInstall Builder"); | |
383 | } | |
384 | ||
385 | void MyFrame::OnNewScript(wxCommandEvent& event) | |
386 | { | |
387 | m_textWindow->Clear(); | |
388 | m_textWindow->AppendText("; Script generated by wxInstall Builder\n"); | |
389 | } | |
390 | ||
391 | void MyFrame::OnOpenScript(wxCommandEvent& event) | |
392 | { | |
393 | wxFileDialog dialog2(this, "Open Script", "", "", "*.ini", 0); | |
394 | ||
395 | if (dialog2.ShowModal() == wxID_OK) | |
396 | m_textWindow->LoadFile(dialog2.GetPath()); | |
397 | } | |
398 | ||
399 | void MyFrame::OnSaveScript(wxCommandEvent& event) | |
400 | { | |
401 | wxFileDialog dialog2(this, "Save Script", "", "", "*.ini", 0); | |
402 | ||
403 | if (dialog2.ShowModal() == wxID_OK) | |
404 | m_textWindow->SaveFile(dialog2.GetPath()); | |
405 | } | |
406 | ||
407 | void MyFrame::OnNewProject(wxCommandEvent& event) | |
408 | { | |
409 | } | |
410 | ||
411 | void MyFrame::OnOpenProject(wxCommandEvent& event) | |
412 | { | |
413 | } | |
414 | ||
415 | void MyFrame::OnSaveProject(wxCommandEvent& event) | |
416 | { | |
417 | } | |
418 | ||
419 | void MyFrame::OnListBoxDoubleClick( wxCommandEvent &event ) | |
420 | { | |
421 | int item; | |
422 | ||
423 | item = m_listBox->GetSelection(); | |
424 | ||
425 | switch(item) | |
426 | { | |
427 | case 0: | |
428 | { | |
429 | wxFileDialog dialog2(this, "Choose wxr filename", "", "", "*.wxr", 0); | |
430 | ||
431 | if (dialog2.ShowModal() == wxID_OK) | |
432 | { | |
433 | char tempbuf[1024] = "DialogEd "; | |
434 | wxString tmp = dialog2.GetFilename(); | |
435 | ||
436 | m_textWindow->WriteText("loadwxr,"); | |
437 | m_textWindow->WriteText(tmp); | |
438 | m_textWindow->WriteText("\n"); | |
439 | ||
440 | strcat(tempbuf, tmp); | |
441 | wxExecute(tempbuf); | |
442 | } | |
443 | } | |
444 | break; | |
445 | case 1: | |
446 | { | |
447 | m_textWindow->WriteText("closeold\n"); | |
448 | } | |
449 | break; | |
450 | case 2: | |
451 | { | |
452 | wxFileDialog dialog2(this, "Choose filename to view", "", "", "*.txt", 0); | |
453 | ||
454 | if (dialog2.ShowModal() == wxID_OK) | |
455 | { | |
456 | wxTextEntryDialog dialog3(this, | |
457 | "Please enter name of the MLE widget", | |
458 | appName, | |
459 | "", | |
460 | wxOK | wxCANCEL); | |
461 | ||
462 | if (dialog3.ShowModal() == wxID_OK) | |
463 | { | |
464 | m_textWindow->WriteText("mleview,"); | |
465 | m_textWindow->WriteText(dialog3.GetValue()); | |
466 | m_textWindow->WriteText(","); | |
467 | m_textWindow->WriteText(dialog2.GetFilename()); | |
468 | m_textWindow->WriteText("\n"); | |
469 | } | |
470 | } | |
471 | } | |
472 | break; | |
473 | case 3: | |
474 | { | |
475 | wxFileDialog dialog2(this, "Choose script to attach to button", "", "", "*.ini", 0); | |
476 | ||
477 | if (dialog2.ShowModal() == wxID_OK) | |
478 | { | |
479 | wxTextEntryDialog dialog3(this, | |
480 | "Please enter ID of the button", | |
481 | appName, | |
482 | "", | |
483 | wxOK | wxCANCEL); | |
484 | ||
485 | if (dialog3.ShowModal() == wxID_OK) | |
486 | { | |
487 | m_textWindow->WriteText("setbutton,"); | |
488 | m_textWindow->WriteText(dialog3.GetValue()); | |
489 | m_textWindow->WriteText(","); | |
490 | m_textWindow->WriteText(dialog2.GetFilename()); | |
491 | m_textWindow->WriteText("\n"); | |
492 | } | |
493 | } | |
494 | } | |
495 | break; | |
496 | case 4: | |
497 | { | |
498 | wxFileDialog dialog2(this, "Choose script to run if not checked", "", "", "*.ini", 0); | |
499 | ||
500 | if (dialog2.ShowModal() == wxID_OK) | |
501 | { | |
502 | wxTextEntryDialog dialog3(this, | |
503 | "Please enter name of the checkbox widget", | |
504 | appName, | |
505 | "", | |
506 | wxOK | wxCANCEL); | |
507 | ||
508 | if (dialog3.ShowModal() == wxID_OK) | |
509 | { | |
510 | m_textWindow->WriteText("getcheck,"); | |
511 | m_textWindow->WriteText(dialog3.GetValue()); | |
512 | m_textWindow->WriteText(","); | |
513 | m_textWindow->WriteText(dialog2.GetFilename()); | |
514 | m_textWindow->WriteText("\n"); | |
515 | } | |
516 | } | |
517 | } | |
518 | break; | |
519 | case 5: | |
520 | { | |
521 | wxTextEntryDialog dialog2(this, | |
522 | "Please enter the message to display to the user", | |
523 | appName, | |
524 | "", | |
525 | wxOK | wxCANCEL); | |
526 | ||
527 | if (dialog2.ShowModal() == wxID_OK) | |
528 | { | |
529 | m_textWindow->WriteText("message,\""); | |
530 | m_textWindow->WriteText(dialog2.GetValue()); | |
531 | m_textWindow->WriteText("\"\n"); | |
532 | } | |
533 | } | |
534 | break; | |
535 | case 6: | |
536 | { | |
537 | wxTextEntryDialog dialog2(this, | |
538 | "Please enter the widget name to disable", | |
539 | appName, | |
540 | "", | |
541 | wxOK | wxCANCEL); | |
542 | ||
543 | if (dialog2.ShowModal() == wxID_OK) | |
544 | { | |
545 | m_textWindow->WriteText("disable,"); | |
546 | m_textWindow->WriteText(dialog2.GetValue()); | |
547 | m_textWindow->WriteText("\n"); | |
548 | } | |
549 | } | |
550 | break; | |
551 | case 7: | |
552 | { | |
553 | wxTextEntryDialog dialog2(this, | |
554 | "Please enter text widget name to set from", | |
555 | appName, | |
556 | "", | |
557 | wxOK | wxCANCEL); | |
558 | ||
559 | if (dialog2.ShowModal() == wxID_OK) | |
560 | { | |
561 | m_textWindow->WriteText("settext,"); | |
562 | m_textWindow->WriteText(dialog2.GetValue()); | |
563 | m_textWindow->WriteText("\n"); | |
564 | } | |
565 | } | |
566 | break; | |
567 | case 8: | |
568 | { | |
569 | wxTextEntryDialog dialog2(this, | |
570 | "Please enter text widget name to get from", | |
571 | appName, | |
572 | "", | |
573 | wxOK | wxCANCEL); | |
574 | ||
575 | if (dialog2.ShowModal() == wxID_OK) | |
576 | { | |
577 | m_textWindow->WriteText("gettext,"); | |
578 | m_textWindow->WriteText(dialog2.GetValue()); | |
579 | m_textWindow->WriteText("\n"); | |
580 | } | |
581 | } | |
582 | break; | |
583 | case 9: | |
584 | { | |
585 | wxFileDialog dialog2(this, "Choose file to grab", "", "", "*", 0); | |
586 | ||
587 | if (dialog2.ShowModal() == wxID_OK) | |
588 | { | |
589 | m_textWindow->WriteText("grabfile,"); | |
590 | m_textWindow->WriteText(dialog2.GetFilename()); | |
591 | m_textWindow->WriteText("\n"); | |
592 | } | |
593 | } | |
594 | break; | |
595 | case 10: | |
596 | { | |
597 | wxFileDialog dialog2(this, "Choose file to remove", "", "", "*", 0); | |
598 | ||
599 | if (dialog2.ShowModal() == wxID_OK) | |
600 | { | |
601 | m_textWindow->WriteText("remove,"); | |
602 | m_textWindow->WriteText(dialog2.GetFilename()); | |
603 | m_textWindow->WriteText("\n"); | |
604 | } | |
605 | } | |
606 | break; | |
607 | case 11: | |
608 | { | |
609 | wxTextEntryDialog dialog2(this, | |
610 | "Please enter the command to execute", | |
611 | appName, | |
612 | "", | |
613 | wxOK | wxCANCEL); | |
614 | ||
615 | if (dialog2.ShowModal() == wxID_OK) | |
616 | { | |
617 | m_textWindow->WriteText("system,"); | |
618 | m_textWindow->WriteText(dialog2.GetValue()); | |
619 | m_textWindow->WriteText("\n"); | |
620 | } | |
621 | } | |
622 | break; | |
623 | case 12: | |
624 | { | |
625 | wxFileDialog dialog2(this, "Choose script to run at installation completion", "", "", "*.ini", 0); | |
626 | ||
627 | if (dialog2.ShowModal() == wxID_OK) | |
628 | { | |
629 | wxTextEntryDialog dialog3(this, | |
630 | "Please enter name of the gauge widget", | |
631 | appName, | |
632 | "", | |
633 | wxOK | wxCANCEL); | |
634 | ||
635 | if (dialog3.ShowModal() == wxID_OK) | |
636 | { | |
637 | m_textWindow->WriteText("startinst,"); | |
638 | m_textWindow->WriteText(dialog3.GetValue()); | |
639 | m_textWindow->WriteText(","); | |
640 | m_textWindow->WriteText(dialog2.GetFilename()); | |
641 | m_textWindow->WriteText("\n"); | |
642 | } | |
643 | } | |
644 | } | |
645 | break; | |
646 | } | |
647 | } |