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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [host/] [tools/] [configtool/] [standalone/] [wxwin/] [choosereposdlg.cpp] - Blame information for rev 817

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

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

powered by: WebSVN 2.1.0

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