OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

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

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
//
6
// This program is part of the eCos host tools.
7
//
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)
11
// any later version.
12
//
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
16
// more details.
17
//
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.
21
//
22
// ----------------------------------------------------------------------------
23
//
24
//####COPYRIGHTEND####
25
// choosereposdlg.cpp :
26
//
27
//===========================================================================
28
//#####DESCRIPTIONBEGIN####
29
//
30
// Author(s):   julians
31
// Contact(s):  julians
32
// Date:        2000/10/02
33
// Version:     $Id: choosereposdlg.cpp,v 1.1.1.1 2004-02-14 13:28:48 phoenix Exp $
34
// Purpose:
35
// Description: Implementation file for ecChooseRepositoryDialog
36
// Requires:
37
// Provides:
38
// See also:
39
// Known bugs:
40
// Usage:
41
//
42
//####DESCRIPTIONEND####
43
//
44
//===========================================================================
45
 
46
// ============================================================================
47
// declarations
48
// ============================================================================
49
 
50
// ----------------------------------------------------------------------------
51
// headers
52
// ----------------------------------------------------------------------------
53
#ifdef __GNUG__
54
#pragma implementation "choosereposdlg.h"
55
#endif
56
 
57
// Includes other headers for precompiled compilation
58
#include "ecpch.h"
59
 
60
#ifdef __BORLANDC__
61
#pragma hdrstop
62
#endif
63
 
64
#include "wx/cshelp.h"
65
#include "wx/dirdlg.h"
66
#include "wx/valgen.h"
67
 
68
#include "configtool.h"
69
#include "configtooldoc.h"
70
#include "choosereposdlg.h"
71
 
72
BEGIN_EVENT_TABLE(ecChooseRepositoryDialog, ecDialog)
73
    EVT_BUTTON(ecID_CHOOSE_REPOSITORY_BROWSE, ecChooseRepositoryDialog::OnBrowse)
74
    EVT_BUTTON(wxID_OK, ecChooseRepositoryDialog::OnOK)
75
    EVT_BUTTON(wxID_CANCEL, ecChooseRepositoryDialog::OnCancel)
76
END_EVENT_TABLE()
77
 
78
// ----------------------------------------------------------------------------
79
// main frame
80
// ----------------------------------------------------------------------------
81
 
82
// Frame constructor
83
ecChooseRepositoryDialog::ecChooseRepositoryDialog(wxWindow* parent)
84
{
85
    SetExtraStyle(wxDIALOG_EX_CONTEXTHELP);
86
 
87
    ecDialog::Create(parent, ecID_CHOOSE_REPOSITORY_DIALOG, _("Choose folder for eCos repository"),
88
        wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER);
89
 
90
    CreateControls(this);
91
 
92
    Centre(wxBOTH);
93
}
94
 
95
void ecChooseRepositoryDialog::CreateControls(wxWindow* parent)
96
{
97
    wxSizer *item0 = new wxBoxSizer( wxHORIZONTAL );
98
 
99
    wxSizer *item1 = new wxBoxSizer( wxVERTICAL );
100
 
101
    wxStaticText *item2 = new wxStaticText( parent, wxID_STATIC, _("Please specify the root of the eCos repository tree."), wxDefaultPosition, wxDefaultSize, 0 );
102
    item1->Add( item2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
103
 
104
    item1->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );
105
 
106
    wxTextCtrl *item3 = new wxTextCtrl( parent, ecID_CHOOSE_REPOSITORY_TEXT, _(""), wxDefaultPosition, wxSize(320,-1), 0 );
107
    item1->Add( item3, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
108
 
109
    item0->Add( item1, 1, wxALIGN_CENTRE|wxALL, 5 );
110
 
111
    wxSizer *item4 = new wxBoxSizer( wxVERTICAL );
112
 
113
    wxButton *item5 = new wxButton( parent, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
114
    item4->Add( item5, 0, wxALIGN_CENTRE|wxALL, 5 );
115
 
116
    wxButton *item6 = new wxButton( parent, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
117
    item4->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 );
118
 
119
    wxButton *item7 = new wxButton( parent, ecID_CHOOSE_REPOSITORY_BROWSE, _("&Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
120
    item4->Add( item7, 0, wxALIGN_CENTRE|wxALL, 5 );
121
 
122
    item0->Add( item4, 0, wxALIGN_CENTRE|wxALL, 5 );
123
 
124
#if 0
125
    wxSizer *item0 = new wxBoxSizer( wxHORIZONTAL );
126
 
127
    wxSizer *item1 = new wxBoxSizer( wxVERTICAL );
128
 
129
    wxStaticText *item2 = new wxStaticText( parent, wxID_STATIC, "Please specify the root of the eCos repository tree.", wxDefaultPosition, wxDefaultSize, 0 );
130
    item1->Add( item2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
131
 
132
    item1->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );
133
 
134
    wxTextCtrl *item3 = new wxTextCtrl( parent, ecID_CHOOSE_REPOSITORY_TEXT, "", wxDefaultPosition, wxSize(320,-1), 0 );
135
    item1->Add( item3, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
136
 
137
    item0->Add( item1, 0, wxALIGN_CENTRE|wxALL, 5 );
138
 
139
    wxSizer *item4 = new wxBoxSizer( wxVERTICAL );
140
 
141
    wxButton *item5 = new wxButton( parent, wxID_OK, "&OK", wxDefaultPosition, wxDefaultSize, 0 );
142
    item4->Add( item5, 0, wxALIGN_CENTRE|wxALL, 5 );
143
    item5->SetDefault();
144
 
145
    wxButton *item6 = new wxButton( parent, wxID_CANCEL, "&Cancel", wxDefaultPosition, wxDefaultSize, 0 );
146
    item4->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 );
147
 
148
    wxButton *item7 = new wxButton( parent, ecID_CHOOSE_REPOSITORY_BROWSE, "&Browse...", wxDefaultPosition, wxDefaultSize, 0 );
149
    item4->Add( item7, 0, wxALIGN_CENTRE|wxALL, 5 );
150
 
151
#ifdef __WXGTK__
152
    wxButton *contextButton = new wxContextHelpButton( parent );
153
    item4->Add( contextButton, 0, wxALIGN_CENTRE|wxALL, 5 );
154
#endif
155
 
156
    item0->Add( item4, 0, wxALIGN_CENTRE|wxALL, 5 );
157
#endif
158
 
159
#ifdef __WXGTK__
160
    wxButton *contextButton = new wxContextHelpButton( parent );
161
    item4->Add( contextButton, 0, wxALIGN_CENTRE|wxALL, 5 );
162
#endif
163
 
164
    parent->SetAutoLayout( TRUE );
165
    parent->SetSizer( item0 );
166
    parent->Layout();
167
    item0->Fit( parent );
168
    item0->SetSizeHints( parent );
169
 
170
    parent->FindWindow( ecID_CHOOSE_REPOSITORY_TEXT)->SetFocus();
171
 
172
    // Add context-sensitive help text
173
    parent->FindWindow( ecID_CHOOSE_REPOSITORY_TEXT)->SetHelpText(_("Selects the repository folder."));
174
    parent->FindWindow( ecID_CHOOSE_REPOSITORY_BROWSE)->SetHelpText(_("Browse for the folder."));
175
    parent->FindWindow( wxID_OK )->SetHelpText(_("Closes the dialog and loads the selected repository."));
176
    parent->FindWindow( wxID_CANCEL )->SetHelpText(_("Closes the dialog without loading a repository."));
177
 
178
    // Add validators
179
    parent->FindWindow( ecID_CHOOSE_REPOSITORY_TEXT)->SetValidator(wxGenericValidator(& wxGetApp().GetConfigToolDoc()->m_strRepository));
180
 
181
#if __WXGTK__
182
    parent->FindWindow( wxID_CONTEXT_HELP )->SetHelpText(_("Invokes context-sensitive help for the clicked-on window."));
183
#endif
184
}
185
 
186
void ecChooseRepositoryDialog::OnBrowse(wxCommandEvent& event)
187
{
188
    wxDirDialog dialog(this, wxT("Repository path"));
189
    if (wxID_OK == dialog.ShowModal())
190
    {
191
        wxString path = dialog.GetPath();
192
        ((wxTextCtrl*) FindWindow( ecID_CHOOSE_REPOSITORY_TEXT))->SetValue(path);
193
    }
194
}
195
 
196
void ecChooseRepositoryDialog::OnCancel(wxCommandEvent& event)
197
{
198
    event.Skip();
199
}
200
 
201
void ecChooseRepositoryDialog::OnOK(wxCommandEvent& event)
202
{
203
    wxString folder(GetFolder());
204
    if (!wxDirExists(folder))
205
    {
206
        wxMessageBox(_("This is not a valid folder."));
207
        return; // Don't Skip so we don't dismiss the dialog
208
    }
209
    if (FALSE)
210
    {
211
        wxMessageBox(_("This does not like a valid eCos repository."));
212
        return; // Don't Skip so we don't dismiss the dialog
213
    }
214
    event.Skip();
215
}
216
 
217
wxString ecChooseRepositoryDialog::GetFolder()
218
{
219
    return ((wxTextCtrl*) FindWindow( ecID_CHOOSE_REPOSITORY_TEXT))->GetValue();
220
}

powered by: WebSVN 2.1.0

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