OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [tools/] [configtool/] [standalone/] [wxwin/] [platformeditordlg.cpp] - Blame information for rev 403

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 26 unneback
//####COPYRIGHTBEGIN####
2
//
3
// ----------------------------------------------------------------------------
4
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5
// Copyright (C) 2003 John Dallaway
6
//
7
// This program is part of the eCos host tools.
8
//
9
// This program is free software; you can redistribute it and/or modify it
10
// under the terms of the GNU General Public License as published by the Free
11
// Software Foundation; either version 2 of the License, or (at your option)
12
// any later version.
13
//
14
// This program is distributed in the hope that it will be useful, but WITHOUT
15
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
17
// more details.
18
//
19
// You should have received a copy of the GNU General Public License along with
20
// this program; if not, write to the Free Software Foundation, Inc.,
21
// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
//
23
// ----------------------------------------------------------------------------
24
//
25
//####COPYRIGHTEND####
26
// platformsdlg.cpp :
27
//
28
//===========================================================================
29
//#####DESCRIPTIONBEGIN####
30
//
31
// Author(s):   julians, jld
32
// Contact(s):  julians
33
// Date:        2000/09/06
34
// Version:     $Id: platformeditordlg.cpp,v 1.1.1.1 2004-02-14 13:28:45 phoenix Exp $
35
// Purpose:
36
// Description: Implementation file for the ecPlatformEditorDialog
37
// Requires:
38
// Provides:
39
// See also:
40
// Known bugs:
41
// Usage:
42
//
43
//####DESCRIPTIONEND####
44
//
45
//===========================================================================
46
 
47
// ============================================================================
48
// declarations
49
// ============================================================================
50
 
51
// ----------------------------------------------------------------------------
52
// headers
53
// ----------------------------------------------------------------------------
54
#ifdef __GNUG__
55
#pragma implementation "platformeditordlg.h"
56
#endif
57
 
58
// Includes other headers for precompiled compilation
59
#include "ecpch.h"
60
 
61
#ifdef __BORLANDC__
62
#pragma hdrstop
63
#endif
64
 
65
#include "wx/cshelp.h"
66
#include "wx/valgen.h"
67
 
68
#include "eCosTestPlatform.h"
69
#include "configtool.h"
70
#include "platformeditordlg.h"
71
 
72
#ifdef __WXMSW__
73
#include "wx/msw/winundef.h"
74
#endif
75
 
76
//#ifdef __WXMSW__
77
//static const wxChar* g_NewLineToReplace = wxT("\r\n");
78
//#else
79
static const wxChar* g_NewLineToReplace = wxT("\n");
80
//#endif
81
 
82
BEGIN_EVENT_TABLE(ecPlatformEditorDialog, ecDialog)
83
    EVT_BUTTON(wxID_OK, ecPlatformEditorDialog::OnOK)
84
    EVT_BUTTON(wxID_CANCEL, ecPlatformEditorDialog::OnCancel)
85
    EVT_COMBOBOX(ecID_MODIFY_PLATFORM_PREFIX, ecPlatformEditorDialog::OnChangeNewPlatformPrefix)
86
    EVT_TEXT(ecID_MODIFY_PLATFORM_NAME, ecPlatformEditorDialog::OnChangeNewPlatform)
87
    EVT_INIT_DIALOG(ecPlatformEditorDialog::OnInitDialog)
88
END_EVENT_TABLE()
89
 
90
// ----------------------------------------------------------------------------
91
// main frame
92
// ----------------------------------------------------------------------------
93
 
94
// Frame constructor
95
ecPlatformEditorDialog::ecPlatformEditorDialog(wxWindow* parent)
96
{
97
        m_bServerSideGdb = FALSE;
98
 
99
    SetExtraStyle(wxDIALOG_EX_CONTEXTHELP);
100
 
101
    ecDialog::Create(parent, ecID_PLATFORM_EDITOR_DIALOG, _("Platforms"),
102
        wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER);
103
 
104
    CreateControls(this);
105
 
106
    Centre(wxBOTH);
107
}
108
 
109
void ecPlatformEditorDialog::OnInitDialog(wxInitDialogEvent& event)
110
{
111
    m_strGDB.Replace(wxT(";"), g_NewLineToReplace);
112
 
113
    wxComboBox* comboBox = (wxComboBox*) FindWindow(ecID_MODIFY_PLATFORM_PREFIX);
114
 
115
    unsigned int i;
116
    for ( i=0 ; i < CeCosTestPlatform::Count() ; i++ )
117
    {
118
        if (wxNOT_FOUND == comboBox->FindString(CeCosTestPlatform::Get(i)->Prefix()))
119
            comboBox->Append(CeCosTestPlatform::Get(i)->Prefix());
120
    }
121
 
122
    wxDialog::OnInitDialog(event);
123
 
124
    SetTitle(m_strCaption);
125
    if( ! m_strPlatform.IsEmpty() )
126
    {
127
        ((wxTextCtrl*)FindWindow(ecID_MODIFY_PLATFORM_NAME))->SetValue(m_strPlatform);
128
 
129
        FindWindow(ecID_MODIFY_PLATFORM_NAME)->Enable(FALSE);
130
    }
131
 
132
    FindWindow(wxID_OK)->Enable(!m_strPlatform.IsEmpty() && !m_strPrefix.IsEmpty());
133
}
134
 
135
void ecPlatformEditorDialog::CreateControls(wxWindow* parent)
136
{
137
    wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
138
 
139
    wxSizer *item1 = new wxFlexGridSizer( 2, 0, 0 );
140
 
141
    wxStaticText *item2 = new wxStaticText( parent, wxID_STATIC, _("Platform &name:"), wxDefaultPosition, wxDefaultSize, 0 );
142
    item1->Add( item2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
143
 
144
    wxTextCtrl *item3 = new wxTextCtrl( parent, ecID_MODIFY_PLATFORM_NAME, _(""), wxDefaultPosition, wxSize(240,-1), 0 );
145
    item1->Add( item3, 0, wxGROW|wxALL, 5 );
146
 
147
    wxStaticText *item4 = new wxStaticText( parent, wxID_STATIC, _("Command &prefix:"), wxDefaultPosition, wxDefaultSize, 0 );
148
    item1->Add( item4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
149
 
150
    wxString *strs5 = (wxString*) NULL;
151
    wxComboBox *item5 = new wxComboBox( parent, ecID_MODIFY_PLATFORM_PREFIX, "", wxDefaultPosition, wxDefaultSize, 0, strs5, wxCB_DROPDOWN );
152
    item1->Add( item5, 0, wxGROW|wxALL, 5 );
153
 
154
    wxStaticText *item6 = new wxStaticText( parent, wxID_STATIC, _("Arguments for &GDB:"), wxDefaultPosition, wxDefaultSize, 0 );
155
    item1->Add( item6, 0, wxALL, 5 );
156
 
157
    wxTextCtrl *item7 = new wxTextCtrl( parent, ecID_MODIFY_PLATFORM_ARGS, _(""), wxDefaultPosition, wxSize(-1,140), wxTE_MULTILINE );
158
    item1->Add( item7, 0, wxGROW|wxALL, 5 );
159
 
160
    wxStaticText *item8 = new wxStaticText( parent, wxID_STATIC, _("Inferior:"), wxDefaultPosition, wxDefaultSize, 0 );
161
    item1->Add( item8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
162
 
163
    wxTextCtrl *item9 = new wxTextCtrl( parent, ecID_MODIFY_PLATFORM_INFERIOR, _(""), wxDefaultPosition, wxDefaultSize, 0 );
164
    item1->Add( item9, 0, wxGROW|wxALL, 5 );
165
 
166
    wxStaticText *item10 = new wxStaticText( parent, wxID_STATIC, _("Prompt:"), wxDefaultPosition, wxDefaultSize, 0 );
167
    item1->Add( item10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
168
 
169
    wxTextCtrl *item11 = new wxTextCtrl( parent, ecID_MODIFY_PLATFORM_PROMPT, _(""), wxDefaultPosition, wxDefaultSize, 0 );
170
    item1->Add( item11, 0, wxGROW|wxALL, 5 );
171
 
172
#if USE_SS_GDB_CONTROL
173
    item1->Add( 20, 20, 0, wxALIGN_CENTRE|wxALL, 5 );
174
 
175
    wxCheckBox *item12 = new wxCheckBox( parent, ecID_MODIFY_PLATFORM_SS_GDB, _("Server-side GDB"), wxDefaultPosition, wxDefaultSize, 0 );
176
    item1->Add( item12, 0, wxGROW|wxALL, 5 );
177
#endif
178
    item0->Add( item1, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
179
 
180
    wxSizer *item13 = new wxBoxSizer( wxHORIZONTAL );
181
 
182
    wxButton *item14 = new wxButton( parent, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
183
    item14->SetDefault();
184
    item13->Add( item14, 0, wxALIGN_CENTRE|wxALL, 5 );
185
 
186
    wxButton *item15 = new wxButton( parent, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
187
    item13->Add( item15, 0, wxALIGN_CENTRE|wxALL, 5 );
188
 
189
#ifdef __WXGTK__
190
    wxButton *contextButton = new wxContextHelpButton( parent );
191
    item13->Add( contextButton, 0, wxALIGN_CENTRE|wxALL, 5 );
192
#endif
193
 
194
    item0->Add( item13, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
195
 
196
    // Can't do this from wxDesigner :-(
197
    ((wxFlexGridSizer*)item1)->AddGrowableCol(1);
198
    ((wxFlexGridSizer*)item1)->AddGrowableRow(2);
199
 
200
    parent->SetAutoLayout( TRUE );
201
    parent->SetSizer( item0 );
202
    parent->Layout();
203
    item0->Fit( parent );
204
    item0->SetSizeHints( parent );
205
 
206
    item3->SetFocus();
207
    item14->SetDefault();
208
 
209
    // Add context-sensitive help text
210
    parent->FindWindow( ecID_MODIFY_PLATFORM_NAME )->SetHelpText(_("Specifies the name of the platform. Platform names are arbitrary strings, but must be unique for a given user."));
211
    parent->FindWindow( ecID_MODIFY_PLATFORM_PREFIX )->SetHelpText(_("Specifies the prefix to be used when invoking tools (for example, 'arm-elf' is the correct prefix if the appropriate gdb executable is arm-elf-gdb)."));
212
    parent->FindWindow( ecID_MODIFY_PLATFORM_ARGS )->SetHelpText(_("Specifies any additional arguments to be used when invoking gdb."));
213
    parent->FindWindow( ecID_MODIFY_PLATFORM_INFERIOR )->SetHelpText(_("The gdb command to run."));
214
    parent->FindWindow( ecID_MODIFY_PLATFORM_PROMPT )->SetHelpText(_("The gdb prompt."));
215
#if USE_SS_GDB_CONTROL
216
    parent->FindWindow( ecID_MODIFY_PLATFORM_SS_GDB )->SetHelpText(_("TODO"));
217
#endif
218
    parent->FindWindow( wxID_OK )->SetHelpText(_("Closes the dialog and saves any changes you have made."));
219
    parent->FindWindow( wxID_CANCEL )->SetHelpText(_("Closes the dialog without saving any changes you have made."));
220
 
221
#if __WXGTK__
222
    parent->FindWindow( wxID_CONTEXT_HELP )->SetHelpText(_("Invokes context-sensitive help for the clicked-on window."));
223
#endif
224
 
225
    // Add validators
226
    parent->FindWindow( ecID_MODIFY_PLATFORM_NAME )->SetValidator(wxGenericValidator(& m_strPlatform));
227
    parent->FindWindow( ecID_MODIFY_PLATFORM_PREFIX )->SetValidator(wxGenericValidator(& m_strPrefix));
228
    parent->FindWindow( ecID_MODIFY_PLATFORM_ARGS )->SetValidator(wxGenericValidator(& m_strGDB));
229
    parent->FindWindow( ecID_MODIFY_PLATFORM_INFERIOR )->SetValidator(wxGenericValidator(& m_strInferior));
230
    parent->FindWindow( ecID_MODIFY_PLATFORM_PROMPT )->SetValidator(wxGenericValidator(& m_strPrompt));
231
#if USE_SS_GDB_CONTROL
232
    parent->FindWindow( ecID_MODIFY_PLATFORM_SS_GDB )->SetValidator(wxGenericValidator(& m_bServerSideGdb));
233
#endif
234
}
235
 
236
void ecPlatformEditorDialog::OnChangeNewPlatformPrefix(wxCommandEvent& event)
237
{
238
    FindWindow(wxID_OK)->Enable(!((wxTextCtrl*)FindWindow(ecID_MODIFY_PLATFORM_NAME))->GetValue().IsEmpty() &&
239
        !((wxComboBox*)FindWindow(ecID_MODIFY_PLATFORM_PREFIX))->GetValue().IsEmpty());
240
}
241
 
242
void ecPlatformEditorDialog::OnChangeNewPlatform(wxCommandEvent& event)
243
{
244
    FindWindow(wxID_OK)->Enable(!((wxTextCtrl*)FindWindow(ecID_MODIFY_PLATFORM_NAME))->GetValue().IsEmpty() &&
245
        !((wxComboBox*)FindWindow(ecID_MODIFY_PLATFORM_PREFIX))->GetValue().IsEmpty());
246
}
247
 
248
void ecPlatformEditorDialog::OnCancel(wxCommandEvent& event)
249
{
250
    event.Skip();
251
}
252
 
253
void ecPlatformEditorDialog::OnOK(wxCommandEvent& event)
254
{
255
    TransferDataFromWindow();
256
 
257
    m_strGDB.Replace(g_NewLineToReplace, wxT(";"));
258
 
259
    EndModal(wxID_OK);
260
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.