1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the Free
10 // Software Foundation; either version 2 of the License, or (at your option)
13 // This program is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
27 //===========================================================================
28 //#####DESCRIPTIONBEGIN####
31 // Contact(s): julians
35 // Description: Implementation file for ecSettingsDialog
42 //####DESCRIPTIONEND####
44 //===========================================================================
47 #pragma implementation "settingsdlg.cpp"
56 #include "wx/spinctrl.h"
57 #include "wx/notebook.h"
58 #include "wx/cshelp.h"
59 #include "wx/valgen.h"
60 #include "wx/fontdlg.h"
61 #include "wx/mimetype.h"
63 #include "settingsdlg.h"
64 #include "configtool.h"
65 #include "configtooldoc.h"
66 #include "configtoolview.h"
68 // For now, we're not implementing the paths page on the settings dialog,
69 // but probably we should eventually for consistency and ease of use
70 #define ecUSE_PATHS_PAGE 0
72 #define ecUSE_RUN_PAGE 1
78 IMPLEMENT_CLASS(ecSettingsDialog, wxDialog)
80 BEGIN_EVENT_TABLE(ecSettingsDialog, wxDialog)
81 EVT_BUTTON(wxID_OK, ecSettingsDialog::OnOK)
82 EVT_BUTTON(wxID_HELP, ecSettingsDialog::OnHelp)
83 EVT_NOTEBOOK_PAGE_CHANGED(-1, ecSettingsDialog::OnPageChange)
86 // GTK+ widgets seem to be chunkier than WIN32's, so give 'em more elbow-room
89 #define PROPERTY_DIALOG_WIDTH 380
90 #define PROPERTY_DIALOG_HEIGHT 420
92 #define PROPERTY_DIALOG_WIDTH 550 // 460
93 #define PROPERTY_DIALOG_HEIGHT 480
96 // For 400x400 settings dialog, size your panels to about 375x325 in dialog editor
97 // (209 x 162 dialog units)
99 ecSettingsDialog::ecSettingsDialog(wxWindow* parent):
102 SetExtraStyle(wxDIALOG_EX_CONTEXTHELP);
104 wxDialog::Create(parent, ecID_SETTINGS_DIALOG, wxGetApp().GetSettings().GetAppName() + wxT(" Settings"), wxPoint(0, 0), wxSize(PROPERTY_DIALOG_WIDTH, PROPERTY_DIALOG_HEIGHT));
106 // Under MSW, we don't seem to be able to react to a click on the dialog background (no
107 // event is generated).
108 SetHelpText(_("The settings dialog provides the ability to change a variety of settings."));
111 wxSize ppi = dc.GetPPI();
113 //double scaleFactor = ((double) charH) / 13.0;
114 double scaleFactor = ((double) ppi.y) / 96.0;
115 // Fudge the scale factor to make the dialog slightly smaller,
116 // otherwise it's a bit big. (We're assuming that most displays
117 // are 96 or 120 ppi).
120 int dialogWidth = (int)(PROPERTY_DIALOG_WIDTH * scaleFactor);
121 int dialogHeight = (int)(PROPERTY_DIALOG_HEIGHT * scaleFactor);
122 SetSize(dialogWidth, dialogHeight);
124 m_displayOptions = NULL;
126 m_notebook = new wxNotebook(this, ecID_SETTINGS_NOTEBOOK,
127 wxPoint(2, 2), wxSize(PROPERTY_DIALOG_WIDTH - 4, PROPERTY_DIALOG_HEIGHT - 4));
129 m_displayOptions = new ecDisplayOptionsDialog(m_notebook);
130 m_notebook->AddPage(m_displayOptions, wxT("Display"));
131 m_displayOptions->TransferDataToWindow();
133 m_viewerOptions = new ecViewerOptionsDialog(m_notebook);
134 m_notebook->AddPage(m_viewerOptions, wxT("Viewers"));
135 m_viewerOptions->TransferDataToWindow();
138 m_pathOptions = new ecPathOptionsDialog(m_notebook);
139 m_notebook->AddPage(m_pathOptions, wxT("Paths"));
140 m_pathOptions->TransferDataToWindow();
143 m_conflictResolutionOptions = new ecConflictResolutionOptionsDialog(m_notebook);
144 m_notebook->AddPage(m_conflictResolutionOptions, wxT("Conflict Resolution"));
145 m_conflictResolutionOptions->TransferDataToWindow();
148 m_runOptions = new ecRunOptionsDialog(m_notebook);
149 m_notebook->AddPage(m_runOptions, wxT("Run Tests"));
150 m_runOptions->TransferDataToWindow();
153 wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
155 item0->Add( m_notebook, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
157 wxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );
159 wxButton *okButton = new wxButton( this, wxID_OK, "&OK", wxDefaultPosition, wxDefaultSize, 0 );
160 item1->Add( okButton, 0, wxALIGN_CENTRE|wxALL, 5 );
162 wxButton *cancelButton = new wxButton( this, wxID_CANCEL, "&Cancel", wxDefaultPosition, wxDefaultSize, 0 );
163 item1->Add( cancelButton, 0, wxALIGN_CENTRE|wxALL, 5 );
165 wxButton *helpButton = new wxButton( this, wxID_HELP, "&Help", wxDefaultPosition, wxDefaultSize, 0 );
166 item1->Add( helpButton, 0, wxALIGN_CENTRE|wxALL, 5 );
169 // Context-sensitive help button (question mark)
170 wxButton *contextButton = new wxContextHelpButton( this );
171 item1->Add( contextButton, 0, wxALIGN_CENTRE|wxALL, 5 );
174 // Necessary to add a spacer or the button highlight interferes with the notebook under wxGTK
175 item0->Add( 4, 4, 0, wxALIGN_CENTRE|wxALL, 0 );
177 item0->Add( item1, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 0 );
179 this->SetAutoLayout( TRUE );
180 this->SetSizer( item0 );
182 okButton->SetDefault();
183 okButton->SetFocus();
187 m_displayOptions->Layout();
188 m_viewerOptions->Layout();
190 m_pathOptions->Layout();
192 m_conflictResolutionOptions->Layout();
194 m_runOptions->Layout();
197 okButton->SetHelpText(_("Closes the dialog and saves any changes you may have made."));
198 cancelButton->SetHelpText(_("Closes the dialog without saving any changes you have made."));
199 helpButton->SetHelpText(_("Invokes help for the selected dialog."));
204 void ecSettingsDialog::SetSelection(int sel)
206 m_notebook->SetSelection(sel);
209 void ecSettingsDialog::OnOK(wxCommandEvent& event)
211 ecSettings oldSettings(wxGetApp().GetSettings());
213 wxDialog::OnOK(event);
215 if (wxGetApp().GetSettings().m_bHex != oldSettings.m_bHex)
217 // Refresh the values window and currently selected properties
218 ecConfigToolHint hint(NULL, ecAllSaved);
219 if (wxGetApp().GetConfigToolDoc())
220 wxGetApp().GetConfigToolDoc()->UpdateAllViews (NULL, & hint);
223 if (wxGetApp().GetSettings().m_showMacroNames != oldSettings.m_showMacroNames)
225 ecConfigToolHint hint(NULL, ecNameFormatChanged);
226 if (wxGetApp().GetConfigToolDoc())
227 wxGetApp().GetConfigToolDoc()->UpdateAllViews (NULL, & hint);
231 void ecSettingsDialog::OnHelp(wxCommandEvent& event)
233 int sel = m_notebook->GetSelection();
235 wxASSERT_MSG( (sel != -1), wxT("A notebook tab should always be selected."));
237 wxWindow* page = (wxWindow*) m_notebook->GetPage(sel);
240 if (page == m_displayOptions)
242 helpTopic = wxT("Display options dialog");
245 if (!helpTopic.IsEmpty())
247 wxGetApp().GetHelpController().KeywordSearch(helpTopic);
251 // This sets the text for the selected page, but doesn't help
252 // when trying to click on a tab: we would expect the appropriate help
253 // for that tab. We would need to look at the tabs to do this, from within OnContextHelp -
254 // probably not worth it.
255 void ecSettingsDialog::OnPageChange(wxNotebookEvent& event)
259 int sel = m_notebook->GetSelection();
263 wxWindow* page = m_notebook->GetPage(sel);
268 if (page == m_displayOptions)
269 helpText = _("The display options dialog allows you to change display-related options.");
270 else if (page == m_viewerOptions)
271 helpText = _("The viewer options dialog allows you to configure viewers.");
273 else if (page == m_pathOptions)
274 helpText = _("The path options dialog allows you to change tool paths.");
276 else if (page == m_conflictResolutionOptions)
277 helpText = _("The conflict resolution options dialog allows you to change options related to conflict resolution.");
279 else if (page == m_runOptions)
280 helpText = _("The run options dialog allows you to change options related to running tests.");
282 m_notebook->SetHelpText(helpText);
286 bool ecSettingsDialog::TransferDataToWindow()
288 m_displayOptions->TransferDataToWindow();
289 m_viewerOptions->TransferDataToWindow();
291 m_pathOptions->TransferDataToWindow();
293 m_conflictResolutionOptions->TransferDataToWindow();
295 m_runOptions->TransferDataToWindow();
300 bool ecSettingsDialog::TransferDataFromWindow()
302 m_displayOptions->TransferDataFromWindow();
303 m_viewerOptions->TransferDataFromWindow();
305 m_pathOptions->TransferDataFromWindow();
307 m_conflictResolutionOptions->TransferDataFromWindow();
309 m_runOptions->TransferDataFromWindow();
314 /* Display options dialog
317 // For now, disable some unnecessary features
318 #define ecUSE_FONT_SELECTION 1
320 IMPLEMENT_CLASS(ecDisplayOptionsDialog, wxPanel)
322 BEGIN_EVENT_TABLE(ecDisplayOptionsDialog, wxPanel)
323 EVT_BUTTON(ecID_DISPLAY_OPTIONS_CHANGE_FONT, ecDisplayOptionsDialog::OnChangeFont)
326 ecDisplayOptionsDialog::ecDisplayOptionsDialog(wxWindow* parent):
327 wxPanel(parent, ecID_SETTINGS_DISPLAY)
329 CreateControls(this);
331 SetHelpText(_("The display options dialog allows you to change display-related options"));
334 void ecDisplayOptionsDialog::CreateControls( wxPanel *parent)
336 wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
338 wxStaticBox *item2 = new wxStaticBox( parent, -1, _("Configuration Pane") );
339 wxSizer *item1 = new wxStaticBoxSizer( item2, wxHORIZONTAL );
343 _("Use ¯o names"),
344 _("Use descriptive &names")
346 wxRadioBox *item3 = new wxRadioBox( parent, ecID_DISPLAY_OPTIONS_LABELS, _("Labels"), wxDefaultPosition, wxDefaultSize, 2, strs3, 1, wxRA_SPECIFY_COLS );
347 item1->Add( item3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
349 item1->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );
356 wxRadioBox *item4 = new wxRadioBox( parent, ecID_DISPLAY_OPTIONS_INTEGER_ITEMS, _("Integer items"), wxDefaultPosition, wxDefaultSize, 2, strs4, 1, wxRA_SPECIFY_COLS );
357 item1->Add( item4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
359 item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
361 #if ecUSE_FONT_SELECTION
362 wxStaticBox *item6 = new wxStaticBox( parent, -1, _("Font") );
363 wxSizer *item5 = new wxStaticBoxSizer( item6, wxHORIZONTAL );
365 wxStaticText *item7 = new wxStaticText( parent, wxID_STATIC, _("&Window:"), wxDefaultPosition, wxDefaultSize, 0 );
366 item5->Add( item7, 0, wxALIGN_CENTRE|wxALL, 5 );
368 wxChoice *item8 = new wxChoice( parent, ecID_DISPLAY_OPTIONS_FONT_CHOICE, wxDefaultPosition, wxSize(120,-1), 0, NULL, 0 );
369 item5->Add( item8, 0, wxALIGN_CENTRE|wxALL, 5 );
371 item5->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );
373 wxButton *item9 = new wxButton( parent, ecID_DISPLAY_OPTIONS_CHANGE_FONT, _("Change &Font..."), wxDefaultPosition, wxDefaultSize, 0 );
374 item5->Add( item9, 0, wxALIGN_CENTRE|wxALL, 5 );
376 item0->Add( item5, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
379 wxStaticBox *item11 = new wxStaticBox( parent, -1, _("Miscellaneous") );
380 wxSizer *item10 = new wxStaticBoxSizer( item11, wxVERTICAL );
382 wxCheckBox *item12 = new wxCheckBox( parent, ecID_DISPLAY_OPTIONS_SHOW_SPLASH, _("Show initial &splash screen"), wxDefaultPosition, wxDefaultSize, 0 );
383 item10->Add( item12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
385 item0->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
388 FindWindow(ecID_DISPLAY_OPTIONS_SHOW_SPLASH)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_showSplashScreen));
390 // Add context-sensitive help
391 item2->SetHelpText(_("Options relating to the configuration pane."));
392 FindWindow(ecID_DISPLAY_OPTIONS_LABELS)->SetHelpText(_("Display macro or descriptive names in the configuration pane."));
393 FindWindow(ecID_DISPLAY_OPTIONS_INTEGER_ITEMS)->SetHelpText(_("View integer items in the configuration pane in either decimal or hexadecimal."));
395 #if ecUSE_FONT_SELECTION
396 FindWindow(ecID_DISPLAY_OPTIONS_FONT_CHOICE)->SetHelpText(_("Selects a window for which the font is to be changed."));
397 FindWindow(ecID_DISPLAY_OPTIONS_CHANGE_FONT)->SetHelpText(_("Changes the font of the chosen window."));
398 // Init the choice control
400 for (i = 0; i < wxGetApp().GetSettings().GetWindowSettings().GetCount(); i++)
402 ((wxChoice*) FindWindow(ecID_DISPLAY_OPTIONS_FONT_CHOICE))->Append(wxGetApp().GetSettings().GetWindowSettings().GetName(i));
405 ((wxChoice*) FindWindow(ecID_DISPLAY_OPTIONS_FONT_CHOICE))->SetSelection(0);
408 FindWindow(ecID_DISPLAY_OPTIONS_SHOW_SPLASH)->SetHelpText(_("Selects whether a splash screen will be shown as the application starts."));
410 parent->SetAutoLayout( TRUE );
411 parent->SetSizer( item0 );
414 bool ecDisplayOptionsDialog::TransferDataToWindow()
416 wxPanel::TransferDataToWindow();
418 ((wxRadioBox*) FindWindow(ecID_DISPLAY_OPTIONS_INTEGER_ITEMS))->SetSelection( wxGetApp().GetSettings().m_bHex ? 1 : 0 ) ;
419 ((wxRadioBox*) FindWindow(ecID_DISPLAY_OPTIONS_LABELS))->SetSelection( wxGetApp().GetSettings().m_showMacroNames ? 0 : 1 ) ;
423 bool ecDisplayOptionsDialog::TransferDataFromWindow()
425 wxPanel::TransferDataFromWindow();
427 wxGetApp().GetSettings().m_bHex = ((wxRadioBox*) FindWindow(ecID_DISPLAY_OPTIONS_INTEGER_ITEMS))->GetSelection() == 1;
428 wxGetApp().GetSettings().m_showMacroNames = ((wxRadioBox*) FindWindow(ecID_DISPLAY_OPTIONS_LABELS))->GetSelection() == 0 ;
430 if (!wxGetApp().GetSettings().GetWindowSettings().GetUseDefaults())
431 wxGetApp().GetSettings().GetWindowSettings().ApplyFontsToWindows();
436 void ecDisplayOptionsDialog::OnChangeFont(wxCommandEvent& event)
438 wxChoice* choice = (wxChoice*) FindWindow(ecID_DISPLAY_OPTIONS_FONT_CHOICE);
440 wxString str = choice->GetStringSelection();
444 data.SetInitialFont(wxGetApp().GetSettings().GetWindowSettings().GetFont(str));
446 wxFontDialog dlg(this, & data);
447 if (dlg.ShowModal() == wxID_OK)
449 wxGetApp().GetSettings().GetWindowSettings().SetFont(str, dlg.GetFontData().GetChosenFont()) ;
451 // Changed a font, so start using specified fonts.
452 wxGetApp().GetSettings().GetWindowSettings().SetUseDefaults(FALSE) ;
458 /* Viewer options dialog
461 IMPLEMENT_CLASS(ecViewerOptionsDialog, wxPanel)
463 BEGIN_EVENT_TABLE(ecViewerOptionsDialog, wxPanel)
464 EVT_BUTTON(ecID_VIEWER_DIALOG_BROWSE_HEADER, ecViewerOptionsDialog::OnBrowseForViewer)
465 EVT_BUTTON(ecID_VIEWER_DIALOG_BROWSE_DOC, ecViewerOptionsDialog::OnBrowseForBrowser)
466 EVT_BUTTON(ecID_VIEWER_DIALOG_ASSOC_INFO, ecViewerOptionsDialog::OnShowAssociatedViewerInfo)
468 EVT_UPDATE_UI(ecID_VIEWER_DIALOG_HEADER_TEXT, ecViewerOptionsDialog::OnUpdateViewerText)
469 EVT_UPDATE_UI(ecID_VIEWER_DIALOG_BROWSE_HEADER, ecViewerOptionsDialog::OnUpdateViewerText)
470 EVT_UPDATE_UI(ecID_VIEWER_DIALOG_DOC_TEXT, ecViewerOptionsDialog::OnUpdateBrowserText)
471 EVT_UPDATE_UI(ecID_VIEWER_DIALOG_BROWSE_DOC, ecViewerOptionsDialog::OnUpdateBrowserText)
474 ecViewerOptionsDialog::ecViewerOptionsDialog(wxWindow* parent):
475 wxPanel(parent, ecID_SETTINGS_VIEWER)
477 CreateControls(this);
479 SetHelpText(_("The viewer options dialog allows you to configure viewers."));
482 bool ecViewerOptionsDialog::TransferDataToWindow()
484 wxPanel::TransferDataToWindow();
486 ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_HEADER_ASSOCIATED))->SetValue(! wxGetApp().GetSettings().m_bUseCustomViewer);
487 ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_HEADER_THIS))->SetValue(wxGetApp().GetSettings().m_bUseCustomViewer);
489 ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_DOC_BUILTIN))->SetValue(wxGetApp().GetSettings().m_eUseCustomBrowser == ecInternal);
490 ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_DOC_THIS))->SetValue(wxGetApp().GetSettings().m_eUseCustomBrowser == ecCustomExternal);
491 ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_DOC_ASSOCIATED))->SetValue(wxGetApp().GetSettings().m_eUseCustomBrowser == ecAssociatedExternal);
496 bool ecViewerOptionsDialog::TransferDataFromWindow()
498 wxPanel::TransferDataFromWindow();
500 wxGetApp().GetSettings().m_bUseCustomViewer = ! ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_HEADER_ASSOCIATED))->GetValue();
502 if (((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_DOC_BUILTIN))->GetValue())
503 wxGetApp().GetSettings().m_eUseCustomBrowser = ecInternal;
504 else if (((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_DOC_THIS))->GetValue())
505 wxGetApp().GetSettings().m_eUseCustomBrowser = ecCustomExternal;
506 else if (((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_DOC_ASSOCIATED))->GetValue())
507 wxGetApp().GetSettings().m_eUseCustomBrowser = ecAssociatedExternal;
512 void ecViewerOptionsDialog::CreateControls( wxPanel *parent)
514 wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
516 wxStaticBox *item2 = new wxStaticBox( parent, -1, _("View header files using") );
517 wxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );
519 wxRadioButton *item3 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_HEADER_ASSOCIATED, _("Associated viewer"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
520 item1->Add( item3, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
522 wxSizer *item4 = new wxBoxSizer( wxHORIZONTAL );
524 wxRadioButton *item5 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_HEADER_THIS, _("This &viewer:"), wxDefaultPosition, wxDefaultSize, 0 );
525 item4->Add( item5, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
527 item4->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );
529 wxButton *item6 = new wxButton( parent, ecID_VIEWER_DIALOG_BROWSE_HEADER, _("&Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
530 item4->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 );
532 item1->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 0 );
534 wxTextCtrl *item7 = new wxTextCtrl( parent, ecID_VIEWER_DIALOG_HEADER_TEXT, _(""), wxDefaultPosition, wxSize(80,-1), 0 );
535 item1->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
537 item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
539 item0->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );
541 wxStaticBox *item9 = new wxStaticBox( parent, -1, _("View documentation using") );
542 wxSizer *item8 = new wxStaticBoxSizer( item9, wxVERTICAL );
544 wxRadioButton *item10 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_DOC_BUILTIN, _("&Built-in viewer"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
545 item8->Add( item10, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
547 wxSizer *item11 = new wxBoxSizer( wxHORIZONTAL );
549 wxRadioButton *item12 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_DOC_ASSOCIATED, _("Associated browser"), wxDefaultPosition, wxDefaultSize, 0 );
550 item11->Add( item12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
552 item11->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );
554 wxButton *item13 = new wxButton( parent, ecID_VIEWER_DIALOG_ASSOC_INFO, _("&About..."), wxDefaultPosition, wxDefaultSize, 0 );
555 item11->Add( item13, 0, wxALIGN_CENTRE|wxALL, 5 );
557 item8->Add( item11, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 );
559 wxSizer *item14 = new wxBoxSizer( wxHORIZONTAL );
561 wxRadioButton *item15 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_DOC_THIS, _("This &browser:"), wxDefaultPosition, wxDefaultSize, 0 );
562 item14->Add( item15, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
564 item14->Add( 20, 20, 1, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
566 wxButton *item16 = new wxButton( parent, ecID_VIEWER_DIALOG_BROWSE_DOC, _("Br&owse..."), wxDefaultPosition, wxDefaultSize, 0 );
567 item14->Add( item16, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
569 item8->Add( item14, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 );
571 wxTextCtrl *item17 = new wxTextCtrl( parent, ecID_VIEWER_DIALOG_DOC_TEXT, _(""), wxDefaultPosition, wxSize(80,-1), 0 );
572 item8->Add( item17, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
574 item0->Add( item8, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
577 wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
579 wxStaticBox *item2 = new wxStaticBox( parent, -1, _("View header files using") );
580 wxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );
582 wxRadioButton *item3 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_HEADER_ASSOCIATED, _("Associated viewer"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
583 item1->Add( item3, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
585 wxSizer *item4 = new wxBoxSizer( wxHORIZONTAL );
587 wxRadioButton *item5 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_HEADER_THIS, _("This &viewer:"), wxDefaultPosition, wxDefaultSize, 0 );
588 item4->Add( item5, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
590 item4->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );
592 wxButton *item6 = new wxButton( parent, ecID_VIEWER_DIALOG_BROWSE_HEADER, _("&Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
593 item4->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 );
595 item1->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 0 );
597 wxTextCtrl *item7 = new wxTextCtrl( parent, ecID_VIEWER_DIALOG_HEADER_TEXT, _(""), wxDefaultPosition, wxSize(80,-1), 0 );
598 item1->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
600 item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
602 // item0->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );
604 wxStaticBox *item9 = new wxStaticBox( parent, -1, _("View documentation using") );
605 wxSizer *item8 = new wxStaticBoxSizer( item9, wxVERTICAL );
607 wxRadioButton *item10 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_DOC_BUILTIN, _("&Built-in viewer"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
608 item8->Add( item10, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
610 wxRadioButton *item11 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_DOC_ASSOCIATED, _("Associated browser"), wxDefaultPosition, wxDefaultSize, 0 );
611 item8->Add( item11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
613 wxSizer *item12 = new wxBoxSizer( wxHORIZONTAL );
615 wxRadioButton *item13 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_DOC_THIS, _("This &browser:"), wxDefaultPosition, wxDefaultSize, 0 );
616 item12->Add( item13, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
618 item12->Add( 20, 20, 1, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
620 wxButton *item14 = new wxButton( parent, ecID_VIEWER_DIALOG_BROWSE_DOC, _("Br&owse..."), wxDefaultPosition, wxDefaultSize, 0 );
621 item12->Add( item14, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
623 item8->Add( item12, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 );
625 wxTextCtrl *item15 = new wxTextCtrl( parent, ecID_VIEWER_DIALOG_DOC_TEXT, _(""), wxDefaultPosition, wxSize(80,-1), 0 );
626 item8->Add( item15, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
628 item0->Add( item8, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
631 // Disable this option because we don't yet have a built-in browser
632 #if 0 // !ecUSE_EXPERIMENTAL_CODE
633 FindWindow(ecID_VIEWER_DIALOG_DOC_BUILTIN)->Enable(FALSE);
637 FindWindow(ecID_VIEWER_DIALOG_HEADER_TEXT)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_strViewer));
638 FindWindow(ecID_VIEWER_DIALOG_DOC_TEXT)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_strBrowser));
640 // Add context-sensitive help
641 item2->SetHelpText(_("Allows you to select a viewer to display header files."));
642 FindWindow(ecID_VIEWER_DIALOG_HEADER_ASSOCIATED)->SetHelpText(_("Select the default viewer to display header files."));
643 FindWindow(ecID_VIEWER_DIALOG_HEADER_THIS)->SetHelpText(_("Select a viewer of your choice to display header files."));
644 FindWindow(ecID_VIEWER_DIALOG_BROWSE_HEADER)->SetHelpText(_("Browses for a viewer to be used to display header files."));
645 FindWindow(ecID_VIEWER_DIALOG_HEADER_TEXT)->SetHelpText(_("Specify the viewer executable to be used to display header files."));
646 item9->SetHelpText(_("Allows you to select a viewer to display documentation."));
647 FindWindow(ecID_VIEWER_DIALOG_DOC_BUILTIN)->SetHelpText(_("Select the internal HTML help mechanism to display HTML-based help."));
648 FindWindow(ecID_VIEWER_DIALOG_DOC_ASSOCIATED)->SetHelpText(_("Select the default browser to display HTML-based help."));
649 FindWindow(ecID_VIEWER_DIALOG_DOC_THIS)->SetHelpText(_("Select a browser of your choice to display HTML-based help."));
650 FindWindow(ecID_VIEWER_DIALOG_BROWSE_DOC)->SetHelpText(_("Browses for a browser to be used to display HTML-based help."));
651 FindWindow(ecID_VIEWER_DIALOG_ASSOC_INFO)->SetHelpText(_("Shows information about the associated viewer."));
653 parent->SetAutoLayout( TRUE );
654 parent->SetSizer( item0 );
657 void ecViewerOptionsDialog::OnUpdateViewerText(wxUpdateUIEvent& event)
659 event.Enable( FindWindow(ecID_VIEWER_DIALOG_HEADER_THIS) &&
660 ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_HEADER_THIS))->GetValue() );
663 void ecViewerOptionsDialog::OnUpdateBrowserText(wxUpdateUIEvent& event)
665 event.Enable( FindWindow(ecID_VIEWER_DIALOG_DOC_THIS) &&
666 ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_DOC_THIS))->GetValue() );
669 void ecViewerOptionsDialog::OnBrowseForViewer(wxCommandEvent& event)
671 wxString currentViewer = ((wxTextCtrl*) FindWindow(ecID_VIEWER_DIALOG_HEADER_TEXT))->GetValue();
673 wxFileDialog dialog(this, _("Choose a viewer executable"), wxPathOnly(currentViewer),
674 wxFileNameFromPath(currentViewer), wxT("*.exe"));
676 if (dialog.ShowModal() == wxID_OK)
678 ((wxTextCtrl*) FindWindow(ecID_VIEWER_DIALOG_HEADER_TEXT))->SetValue(dialog.GetPath());
682 void ecViewerOptionsDialog::OnBrowseForBrowser(wxCommandEvent& event)
684 wxString currentViewer = ((wxTextCtrl*) FindWindow(ecID_VIEWER_DIALOG_DOC_TEXT))->GetValue();
686 wxFileDialog dialog(this, _("Choose a browser executable"), wxPathOnly(currentViewer),
687 wxFileNameFromPath(currentViewer), wxT("*.exe"));
689 if (dialog.ShowModal() == wxID_OK)
691 ((wxTextCtrl*) FindWindow(ecID_VIEWER_DIALOG_DOC_TEXT))->SetValue(dialog.GetPath());
695 void ecViewerOptionsDialog::OnShowAssociatedViewerInfo(wxCommandEvent& event)
698 wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension(wxT("html"));
701 msg += wxT("It is not possible to determine the associated browser for HTML documents.\n\n");
705 msg += wxT("The associated MIME type for HTML is:\n");
706 wxString mimeType(wxT("Unknown"));
707 ft->GetMimeType(& mimeType);
712 if (ft->GetDescription(& descr))
720 wxString url(wxT("http://example-url.html"));
721 bool ok = ft->GetOpenCommand(&cmd,
722 wxFileType::MessageParameters(url, _T("")));
726 msg += wxT("The associated command is:\n");
733 msg += wxT("If this MIME type is not defined or looks wrong, please consult your ");
734 msg += wxT("Configuration Tool documentation for how to set up an association.\n");
735 #if defined(__WXGTK__)
736 msg += wxT("On Unix, this can be done by adding an entry to your ~/.mailcap file.");
741 wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_INFORMATION|wxOK);
744 /* Path options dialog
747 IMPLEMENT_CLASS(ecPathOptionsDialog, wxPanel)
749 ecPathOptionsDialog::ecPathOptionsDialog(wxWindow* parent):
750 wxPanel(parent, ecID_SETTINGS_PATH)
752 CreateControls(this);
754 SetHelpText(_("The path options dialog allows you to change tool paths."));
757 bool ecPathOptionsDialog::TransferDataToWindow()
759 wxPanel::TransferDataToWindow();
763 bool ecPathOptionsDialog::TransferDataFromWindow()
765 wxPanel::TransferDataFromWindow();
769 void ecPathOptionsDialog::CreateControls( wxPanel *parent)
771 wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
773 wxStaticBox *item2 = new wxStaticBox( parent, -1, _("Build Tools") );
774 wxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );
776 wxStaticText *item3 = new wxStaticText( parent, ecID_PATHS_BUILD_MSG,
777 _("Enter the location of the arm-elf build tools "
778 "folder, which should contain arm-elf-gcc. You can "
779 "type in a path or use the Browse button to "
780 "navigate to a folder."),
781 wxDefaultPosition, wxSize(-1,70), 0 );
782 item1->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
784 wxSizer *item4 = new wxBoxSizer( wxHORIZONTAL );
786 wxString *strs5 = (wxString*) NULL;
787 wxComboBox *item5 = new wxComboBox( parent, ecID_PATHS_BUILD_COMBO, _(""), wxDefaultPosition, wxSize(100,-1), 0, strs5, wxCB_DROPDOWN );
788 item4->Add( item5, 20, wxALIGN_CENTRE|wxALL, 5 );
790 item1->Add( item4, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 );
792 wxButton *item6 = new wxButton( parent, ecID_PATHS_BUILD_BROWSE, _("&Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
793 item1->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 );
795 item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
797 wxStaticBox *item8 = new wxStaticBox( parent, -1, _("User Tools") );
798 wxSizer *item7 = new wxStaticBoxSizer( item8, wxVERTICAL );
800 wxStaticText *item9 = new wxStaticText( parent, ecID_PATHS_USER_MSG,
801 _("Enter the location of the user tools folder, "
802 "which should contain cat and ls. You can type in "
803 "a path or use the Browse button to navigate to a "
805 wxDefaultPosition, wxSize(-1,60), 0 );
806 item7->Add( item9, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
808 wxSizer *item10 = new wxBoxSizer( wxHORIZONTAL );
810 wxString *strs11 = (wxString*) NULL;
811 wxComboBox *item11 = new wxComboBox( parent, ecID_PATHS_USER_COMBO, _(""), wxDefaultPosition, wxSize(100,-1), 0, strs11, wxCB_DROPDOWN );
812 item10->Add( item11, 20, wxALIGN_CENTRE|wxALL, 5 );
814 item7->Add( item10, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 );
816 wxButton *item12 = new wxButton( parent, ecID_PATHS_USER_BROWSE, _("&Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
817 item7->Add( item12, 0, wxALIGN_CENTRE|wxALL, 5 );
818 item0->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
821 parent->SetAutoLayout( TRUE );
822 parent->SetSizer( item0 );
824 // Add context-sensitive help
825 FindWindow( ecID_PATHS_BUILD_COMBO )->SetHelpText(_("Select the build tools folder."));
826 FindWindow( ecID_PATHS_BUILD_BROWSE )->SetHelpText(_("Browse for the build tools folder."));
827 FindWindow( ecID_PATHS_USER_COMBO )->SetHelpText(_("Select the user tools folder."));
828 FindWindow( ecID_PATHS_USER_BROWSE )->SetHelpText(_("Browse for the user tools folder."));
831 /* Conflict resolution options dialog
834 IMPLEMENT_CLASS(ecConflictResolutionOptionsDialog, wxPanel)
836 ecConflictResolutionOptionsDialog::ecConflictResolutionOptionsDialog(wxWindow* parent):
837 wxPanel(parent, ecID_SETTINGS_CONFLICT_RESOLUTION)
839 CreateControls(this);
841 m_suggestFixes = ((wxGetApp().GetSettings().m_nRuleChecking & ecSettings::SuggestFixes) != 0);
842 m_immediate = ((wxGetApp().GetSettings().m_nRuleChecking & ecSettings::Immediate) != 0);
843 m_deferred = ((wxGetApp().GetSettings().m_nRuleChecking & ecSettings::Deferred) != 0);
845 SetHelpText(_("The conflict resolution options dialog allows you to change options related to conflict resolution."));
848 bool ecConflictResolutionOptionsDialog::TransferDataToWindow()
850 wxPanel::TransferDataToWindow();
854 bool ecConflictResolutionOptionsDialog::TransferDataFromWindow()
856 wxPanel::TransferDataFromWindow();
858 int& ruleChecking = wxGetApp().GetSettings().m_nRuleChecking;
862 ruleChecking |= ecSettings::SuggestFixes ;
864 ruleChecking |= ecSettings::Immediate ;
866 ruleChecking |= ecSettings::Deferred ;
871 void ecConflictResolutionOptionsDialog::CreateControls( wxPanel *parent)
873 wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
875 wxStaticBox *item2 = new wxStaticBox( parent, -1, _("Check for conflicts:") );
876 wxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );
878 wxCheckBox *item3 = new wxCheckBox( parent, ecID_CONFLICT_OPTIONS_AFTER_ITEM_CHANGED, _("After any item changed"), wxDefaultPosition, wxDefaultSize, 0 );
879 item1->Add( item3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
881 wxCheckBox *item4 = new wxCheckBox( parent, ecID_CONFLICT_OPTIONS_BEFORE_SAVING, _("Before &saving configuration"), wxDefaultPosition, wxDefaultSize, 0 );
882 item1->Add( item4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
884 wxCheckBox *item5 = new wxCheckBox( parent, ecID_CONFLICT_OPTIONS_AUTOSUGGEST, _("&Automatically suggest fixes"), wxDefaultPosition, wxDefaultSize, 0 );
885 item1->Add( item5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
887 item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
889 parent->SetAutoLayout( TRUE );
890 parent->SetSizer( item0 );
892 // Add context-sensitive help
893 item2->SetHelpText(_("Options related to conflict resolution."));
894 item3->SetHelpText(_("Check for configuration option conflicts after any configuration option value is changed."));
895 item4->SetHelpText(_("Check for configuration option conflicts before saving the configuration."));
896 item5->SetHelpText(_("When configuration conflicts are found, provide possible solutions."));
899 FindWindow(ecID_CONFLICT_OPTIONS_AFTER_ITEM_CHANGED)->SetValidator(wxGenericValidator(& m_immediate));
900 FindWindow(ecID_CONFLICT_OPTIONS_BEFORE_SAVING)->SetValidator(wxGenericValidator(& m_deferred));
901 FindWindow(ecID_CONFLICT_OPTIONS_AUTOSUGGEST)->SetValidator(wxGenericValidator(& m_suggestFixes));
904 /* Run options dialog
907 IMPLEMENT_CLASS(ecRunOptionsDialog, wxPanel)
909 BEGIN_EVENT_TABLE(ecRunOptionsDialog, wxPanel)
910 EVT_UPDATE_UI(ecID_RUN_PROPERTIES_DOWNLOAD_TIMEOUT, ecRunOptionsDialog::OnUpdateDownloadTimeout)
911 EVT_UPDATE_UI(ecID_RUN_PROPERTIES_RUNTIME_TIMEOUT, ecRunOptionsDialog::OnUpdateRuntimeTimeout)
912 EVT_UPDATE_UI(ecID_RUN_PROPERTIES_SERIAL_PORT_ADDR, ecRunOptionsDialog::OnUpdateSerial)
913 EVT_UPDATE_UI(ecID_RUN_PROPERTIES_SERIAL_PORT_SPEED, ecRunOptionsDialog::OnUpdateSerial)
914 EVT_UPDATE_UI(ecID_RUN_PROPERTIES_TCPIP_HOST, ecRunOptionsDialog::OnUpdateTCPIP)
915 EVT_UPDATE_UI(ecID_RUN_PROPERTIES_TCPIP_PORT, ecRunOptionsDialog::OnUpdateTCPIP)
918 ecRunOptionsDialog::ecRunOptionsDialog(wxWindow* parent):
919 wxPanel(parent, ecID_SETTINGS_RUN),
920 m_serialOn(TRUE), m_TCPIPOn(FALSE)
922 CreateControls(this);
924 SetHelpText(_("The run properties dialog allows you to change options related to running tests."));
927 bool ecRunOptionsDialog::TransferDataToWindow()
930 // m_strTarget now set in ecConfigToolDoc::RunTests()
931 ecConfigToolDoc* doc = wxGetApp().GetConfigToolDoc();
935 hardware = doc->GetCdlConfig ()->get_hardware ().c_str();
939 hardware = _("Unknown");
941 wxGetApp().GetSettings().GetRunTestsSettings().m_strTarget = hardware;
945 m_serialOn = wxGetApp().GetSettings().GetRunTestsSettings().m_bSerial;
946 m_TCPIPOn = !wxGetApp().GetSettings().GetRunTestsSettings().m_bSerial;
948 switch (wxGetApp().GetSettings().GetRunTestsSettings().m_nDownloadTimeoutType)
951 m_downloadTimeoutString = _("None");
953 case TIMEOUT_SPECIFIED:
954 m_downloadTimeoutString = _("Specified");
957 case TIMEOUT_AUTOMATIC:
958 m_downloadTimeoutString = _("Calculated from file size");
962 switch (wxGetApp().GetSettings().GetRunTestsSettings().m_nTimeoutType)
965 m_runtimeTimeoutString = _("None");
967 case TIMEOUT_SPECIFIED:
968 m_runtimeTimeoutString = _("Specified");
971 case TIMEOUT_AUTOMATIC:
972 m_runtimeTimeoutString = _("Default");
976 m_baudString.Printf("%d", wxGetApp().GetSettings().GetRunTestsSettings().m_nBaud);
978 wxPanel::TransferDataToWindow();
983 bool ecRunOptionsDialog::TransferDataFromWindow()
985 wxPanel::TransferDataFromWindow();
987 if (m_downloadTimeoutString == _("None"))
988 wxGetApp().GetSettings().GetRunTestsSettings().m_nDownloadTimeoutType = TIMEOUT_NONE;
989 else if (m_downloadTimeoutString == _("Specified"))
990 wxGetApp().GetSettings().GetRunTestsSettings().m_nDownloadTimeoutType = TIMEOUT_SPECIFIED;
992 wxGetApp().GetSettings().GetRunTestsSettings().m_nDownloadTimeoutType = TIMEOUT_AUTOMATIC;
994 if (m_runtimeTimeoutString == _("None"))
995 wxGetApp().GetSettings().GetRunTestsSettings().m_nTimeoutType = TIMEOUT_NONE;
996 else if (m_runtimeTimeoutString == _("Specified"))
997 wxGetApp().GetSettings().GetRunTestsSettings().m_nTimeoutType = TIMEOUT_SPECIFIED;
999 wxGetApp().GetSettings().GetRunTestsSettings().m_nTimeoutType = TIMEOUT_AUTOMATIC;
1001 wxGetApp().GetSettings().GetRunTestsSettings().m_nBaud = (int) wxAtol(m_baudString);
1004 wxGetApp().GetSettings().GetRunTestsSettings().m_bSerial = m_serialOn;
1009 void ecRunOptionsDialog::CreateControls( wxPanel *parent)
1011 wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
1013 wxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );
1015 wxStaticText *item2 = new wxStaticText( parent, wxID_STATIC, _("Platform:"), wxDefaultPosition, wxDefaultSize, 0 );
1016 item1->Add( item2, 0, wxALIGN_CENTRE|wxALL, 5 );
1018 wxStaticText *item3 = new wxStaticText( parent, ecID_RUN_PROPERTIES_PLATFORM, _("xxxx"), wxDefaultPosition, wxDefaultSize, 0 );
1019 item1->Add( item3, 0, wxALIGN_CENTRE|wxALL, 5 );
1021 item0->Add( item1, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxTOP, 5 );
1023 wxStaticBox *item5 = new wxStaticBox( parent, -1, _("Timeouts") );
1024 wxSizer *item4 = new wxStaticBoxSizer( item5, wxVERTICAL );
1026 wxSizer *item6 = new wxBoxSizer( wxHORIZONTAL );
1028 wxStaticText *item7 = new wxStaticText( parent, wxID_STATIC, _("Download:"), wxDefaultPosition, wxSize(60,-1), 0 );
1029 item6->Add( item7, 0, wxALIGN_CENTRE|wxALL, 5 );
1035 _("Calculated from file size")
1037 wxChoice *item8 = new wxChoice( parent, ecID_RUN_PROPERTIES_DOWNLOAD_CHOICE, wxDefaultPosition, wxSize(100,-1), 3, strs8, 0 );
1038 item6->Add( item8, 1, wxALIGN_CENTRE|wxALL, 5 );
1040 wxSpinCtrl *item9 = new wxSpinCtrl( parent, ecID_RUN_PROPERTIES_DOWNLOAD_TIMEOUT, "0", wxDefaultPosition, wxSize(50,-1), 0, 0, 10000, 0 );
1041 item6->Add( item9, 0, wxALIGN_CENTRE|wxALL, 5 );
1043 item4->Add( item6, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1045 wxSizer *item10 = new wxBoxSizer( wxHORIZONTAL );
1047 wxStaticText *item11 = new wxStaticText( parent, wxID_STATIC, _("Runtime:"), wxDefaultPosition, wxSize(60,-1), 0 );
1048 item10->Add( item11, 0, wxALIGN_CENTRE|wxALL, 5 );
1056 wxChoice *item12 = new wxChoice( parent, ecID_RUN_PROPERTIES_RUNTIME_CHOICE, wxDefaultPosition, wxSize(100,-1), 3, strs12, 0 );
1057 item10->Add( item12, 1, wxALIGN_CENTRE|wxALL, 5 );
1059 wxSpinCtrl *item13 = new wxSpinCtrl( parent, ecID_RUN_PROPERTIES_RUNTIME_TIMEOUT, "0", wxDefaultPosition, wxSize(50,-1), 0, 0, 10000, 0 );
1060 item10->Add( item13, 0, wxALIGN_CENTRE|wxALL, 5 );
1062 item4->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1064 item0->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1066 wxStaticBox *item15 = new wxStaticBox( parent, -1, _("Connection") );
1067 wxSizer *item14 = new wxStaticBoxSizer( item15, wxVERTICAL );
1069 wxSizer *item16 = new wxBoxSizer( wxHORIZONTAL );
1071 wxRadioButton *item17 = new wxRadioButton( parent, ecID_RUN_PROPERTIES_SERIAL, _("&Serial"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
1072 item16->Add( item17, 0, wxALIGN_CENTRE|wxALL, 5 );
1074 item16->Add( 2, 2, 1, wxALIGN_CENTRE|wxALL, 5 );
1076 wxStaticText *item18 = new wxStaticText( parent, wxID_STATIC, _("&Port:"), wxDefaultPosition, wxDefaultSize, 0 );
1077 item16->Add( item18, 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5 );
1090 wxChoice *item19 = new wxChoice( parent, ecID_RUN_PROPERTIES_SERIAL_PORT_ADDR, wxDefaultPosition, wxSize(70,-1), 8, strs19, 0 );
1091 item16->Add( item19, 0, wxALIGN_CENTRE|wxALL, 5 );
1093 wxStaticText *item20 = new wxStaticText( parent, wxID_STATIC, _("&Baud:"), wxDefaultPosition, wxDefaultSize, 0 );
1094 item16->Add( item20, 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5 );
1114 wxChoice *item21 = new wxChoice( parent, ecID_RUN_PROPERTIES_SERIAL_PORT_SPEED, wxDefaultPosition, wxSize(70,-1), 15, strs21, 0 );
1115 item16->Add( item21, 0, wxALIGN_CENTRE|wxALL, 5 );
1117 item14->Add( item16, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1119 wxSizer *item22 = new wxBoxSizer( wxHORIZONTAL );
1121 wxRadioButton *item23 = new wxRadioButton( parent, ecID_RUN_PROPERTIES_TCPIP, _("&TCP/IP"), wxDefaultPosition, wxDefaultSize, 0 );
1122 item22->Add( item23, 0, wxALIGN_CENTRE|wxALL, 5 );
1124 item22->Add( 2, 2, 1, wxALIGN_CENTRE|wxALL, 5 );
1126 wxStaticText *item24 = new wxStaticText( parent, wxID_STATIC, _("&Address:"), wxDefaultPosition, wxDefaultSize, 0 );
1127 item22->Add( item24, 0, wxALIGN_CENTRE|wxALL, 5 );
1129 wxTextCtrl *item25 = new wxTextCtrl( parent, ecID_RUN_PROPERTIES_TCPIP_HOST, _(""), wxDefaultPosition, wxSize(100,-1), 0 );
1130 item22->Add( item25, 0, wxALIGN_CENTRE|wxALL, 5 );
1132 wxStaticText *item26 = new wxStaticText( parent, wxID_STATIC, _(":"), wxDefaultPosition, wxDefaultSize, 0 );
1133 item22->Add( item26, 0, wxALIGN_CENTRE, 5 );
1135 wxTextCtrl *item27 = new wxTextCtrl( parent, ecID_RUN_PROPERTIES_TCPIP_PORT, _(""), wxDefaultPosition, wxSize(40,-1), 0 );
1136 item22->Add( item27, 0, wxALIGN_CENTRE|wxALL, 5 );
1138 item14->Add( item22, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1140 item0->Add( item14, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1142 parent->SetAutoLayout( TRUE );
1143 parent->SetSizer( item0 );
1145 // Add context-sensitive help
1146 FindWindow(ecID_RUN_PROPERTIES_PLATFORM)->SetHelpText(_("Shows the hardware currently selected."));
1147 FindWindow(ecID_RUN_PROPERTIES_DOWNLOAD_CHOICE)->SetHelpText(_("Specifies the kind of timeout to be applied to the download phase of test execution."));
1148 FindWindow(ecID_RUN_PROPERTIES_DOWNLOAD_TIMEOUT)->SetHelpText(_("Specifies a fixed-period timeout (in seconds) to be applied to the download phase of test execution."));
1149 FindWindow(ecID_RUN_PROPERTIES_RUNTIME_CHOICE)->SetHelpText(_("Specifies the kind of timeout to be applied to the run phase of test execution."));
1150 FindWindow(ecID_RUN_PROPERTIES_RUNTIME_TIMEOUT)->SetHelpText(_("Specifies a fixed-period timeout (in seconds) to be applied to the run phase of test execution."));
1151 FindWindow(ecID_RUN_PROPERTIES_SERIAL)->SetHelpText(_("Specifies that download is local, using a serial communications port."));
1152 FindWindow(ecID_RUN_PROPERTIES_SERIAL_PORT_ADDR)->SetHelpText(_("Specifies the communication ports to be used for local download."));
1153 FindWindow(ecID_RUN_PROPERTIES_SERIAL_PORT_SPEED)->SetHelpText(_("Specifies the baud rate at which the communications port is to operate."));
1154 FindWindow(ecID_RUN_PROPERTIES_TCPIP)->SetHelpText(_("Specifies that download is remote, using GDB remote protocol via a TCP/IP port."));
1155 FindWindow(ecID_RUN_PROPERTIES_TCPIP_HOST)->SetHelpText(_("Specifies the TCP/IP host to be used for remote download."));
1156 FindWindow(ecID_RUN_PROPERTIES_TCPIP_PORT)->SetHelpText(_("Specifies the TCP/IP port number to be used for remote download."));
1159 FindWindow(ecID_RUN_PROPERTIES_PLATFORM)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().GetRunTestsSettings().m_strTarget));
1160 FindWindow(ecID_RUN_PROPERTIES_DOWNLOAD_CHOICE)->SetValidator(wxGenericValidator(& m_downloadTimeoutString));
1161 FindWindow(ecID_RUN_PROPERTIES_DOWNLOAD_TIMEOUT)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().GetRunTestsSettings().m_nDownloadTimeout));
1162 FindWindow(ecID_RUN_PROPERTIES_RUNTIME_CHOICE)->SetValidator(wxGenericValidator(& m_runtimeTimeoutString));
1163 FindWindow(ecID_RUN_PROPERTIES_RUNTIME_TIMEOUT)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().GetRunTestsSettings().m_nTimeout));
1164 FindWindow(ecID_RUN_PROPERTIES_SERIAL)->SetValidator(wxGenericValidator(& m_serialOn));
1165 FindWindow(ecID_RUN_PROPERTIES_TCPIP)->SetValidator(wxGenericValidator(& m_TCPIPOn));
1166 FindWindow(ecID_RUN_PROPERTIES_SERIAL_PORT_ADDR)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().GetRunTestsSettings().m_strPort));
1167 FindWindow(ecID_RUN_PROPERTIES_SERIAL_PORT_SPEED)->SetValidator(wxGenericValidator(& m_baudString));
1168 FindWindow(ecID_RUN_PROPERTIES_TCPIP_HOST)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().GetRunTestsSettings().m_strLocalTCPIPHost));
1169 FindWindow(ecID_RUN_PROPERTIES_TCPIP_PORT)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().GetRunTestsSettings().m_nLocalTCPIPPort));
1173 void ecRunOptionsDialog::OnUpdateDownloadTimeout(wxUpdateUIEvent& event)
1175 wxChoice* downloadTimeoutChoice = (wxChoice*) FindWindow(ecID_RUN_PROPERTIES_DOWNLOAD_CHOICE);
1176 wxString sel = downloadTimeoutChoice->GetStringSelection();
1177 event.Enable( sel == _("Specified") );
1180 void ecRunOptionsDialog::OnUpdateRuntimeTimeout(wxUpdateUIEvent& event)
1182 wxChoice* runTimeoutChoice = (wxChoice*) FindWindow(ecID_RUN_PROPERTIES_RUNTIME_CHOICE);
1183 wxString sel = runTimeoutChoice->GetStringSelection();
1184 event.Enable( sel == _("Specified") );
1187 void ecRunOptionsDialog::OnUpdateSerial(wxUpdateUIEvent& event)
1189 wxRadioButton* radio = (wxRadioButton*) FindWindow(ecID_RUN_PROPERTIES_SERIAL);
1190 event.Enable( radio->GetValue() );
1193 void ecRunOptionsDialog::OnUpdateTCPIP(wxUpdateUIEvent& event)
1195 wxRadioButton* radio = (wxRadioButton*) FindWindow(ecID_RUN_PROPERTIES_SERIAL);
1196 event.Enable( !radio->GetValue() );