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

Subversion Repositories openrisc

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

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
// sectiondlg.cpp :
23
//
24
//===========================================================================
25
//#####DESCRIPTIONBEGIN####
26
//
27
// Author(s):   julians
28
// Contact(s):  julians
29
// Date:        2000/09/27
30
// Version:     $Id: sectiondlg.cpp,v 1.2 2001/03/15 17:33:45 julians Exp $
31
// Purpose:
32
// Description: Implementation file for ecSectionDialog
33
// Requires:
34
// Provides:
35
// See also:
36
// Known bugs:
37
// Usage:
38
//
39
//####DESCRIPTIONEND####
40
//
41
//===========================================================================
42
 
43
#ifdef __GNUG__
44
    #pragma implementation "sectiondlg.cpp"
45
#endif
46
 
47
#include "ecpch.h"
48
 
49
#ifdef __BORLANDC__
50
    #pragma hdrstop
51
#endif
52
 
53
#include "wx/notebook.h"
54
#include "wx/cshelp.h"
55
 
56
#include "sectiondlg.h"
57
#include "configtool.h"
58
 
59
/*
60
 * Settings dialog
61
 */
62
 
63
IMPLEMENT_CLASS(ecSectionDialog, wxDialog)
64
 
65
BEGIN_EVENT_TABLE(ecSectionDialog, wxDialog)
66
    EVT_BUTTON(wxID_OK, ecSectionDialog::OnOK)
67
    EVT_BUTTON(wxID_CANCEL, ecSectionDialog::OnCancel)
68
    EVT_BUTTON(wxID_HELP, ecSectionDialog::OnHelp)
69
    EVT_BUTTON(wxID_APPLY, ecSectionDialog::OnApply)
70
    EVT_NOTEBOOK_PAGE_CHANGED(-1, ecSectionDialog::OnPageChange)
71
END_EVENT_TABLE()
72
 
73
#define PROPERTY_DIALOG_WIDTH   400
74
#define PROPERTY_DIALOG_HEIGHT  380
75
 
76
// For 400x400 settings dialog, size your panels to about 375x325 in dialog editor
77
// (209 x 162 dialog units)
78
 
79
ecSectionDialog::ecSectionDialog(wxWindow* parent):
80
    wxDialog()
81
{
82
    SetExtraStyle(wxDIALOG_EX_CONTEXTHELP);
83
 
84
    wxDialog::Create(parent, ecID_SECTION_DIALOG, _("Section Properties"), wxPoint(0, 0), wxSize(PROPERTY_DIALOG_WIDTH, PROPERTY_DIALOG_HEIGHT));
85
 
86
    // Under MSW, we don't seem to be able to react to a click on the dialog background (no
87
    // event is generated).
88
    SetHelpText(_("TODO"));
89
 
90
    wxScreenDC dc;
91
    wxSize ppi = dc.GetPPI();
92
 
93
    //double scaleFactor = ((double) charH) / 13.0;
94
    double scaleFactor = ((double) ppi.y) / 96.0;
95
    // Fudge the scale factor to make the dialog slightly smaller,
96
    // otherwise it's a bit big. (We're assuming that most displays
97
    // are 96 or 120 ppi).
98
    if (ppi.y == 120)
99
        scaleFactor = 1.14;
100
    int dialogWidth = (int)(PROPERTY_DIALOG_WIDTH * scaleFactor);
101
    int dialogHeight = (int)(PROPERTY_DIALOG_HEIGHT * scaleFactor);
102
    SetSize(dialogWidth, dialogHeight);
103
 
104
    m_notebook = new wxNotebook(this, ecID_SETTINGS_NOTEBOOK,
105
         wxPoint(2, 2), wxSize(PROPERTY_DIALOG_WIDTH - 4, PROPERTY_DIALOG_HEIGHT - 4));
106
 
107
    m_general = new ecSectionGeneralDialog(m_notebook);
108
    m_notebook->AddPage(m_general, wxT("General"));
109
    m_general->TransferDataToWindow();
110
 
111
    m_relocation = new ecSectionRelocationDialog(m_notebook);
112
    m_notebook->AddPage(m_relocation, wxT("Relocation"));
113
    m_relocation->TransferDataToWindow();
114
 
115
    m_note = new ecSectionNoteDialog(m_notebook);
116
    m_notebook->AddPage(m_note, wxT("Note"));
117
    m_note->TransferDataToWindow();
118
 
119
    wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
120
 
121
    item0->Add( m_notebook, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );
122
 
123
    wxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );
124
 
125
    wxButton *okButton = new wxButton( this, wxID_OK, "&OK", wxDefaultPosition, wxDefaultSize, 0 );
126
    item1->Add( okButton, 0, wxALIGN_CENTRE|wxALL, 5 );
127
 
128
    wxButton *cancelButton = new wxButton( this, wxID_CANCEL, "&Cancel", wxDefaultPosition, wxDefaultSize, 0 );
129
    item1->Add( cancelButton, 0, wxALIGN_CENTRE|wxALL, 5 );
130
 
131
    wxButton *applyButton = new wxButton( this, wxID_APPLY, "&Apply", wxDefaultPosition, wxDefaultSize, 0 );
132
    item1->Add( applyButton, 0, wxALIGN_CENTRE|wxALL, 5 );
133
 
134
    wxButton *helpButton = new wxButton( this, wxID_HELP, "&Help", wxDefaultPosition, wxDefaultSize, 0 );
135
    item1->Add( helpButton, 0, wxALIGN_CENTRE|wxALL, 5 );
136
 
137
#ifdef __WXGTK__
138
    // Context-sensitive help button (question mark)
139
    wxButton *contextButton = new wxContextHelpButton( this );
140
    item1->Add( contextButton, 0, wxALIGN_CENTRE|wxALL, 5 );
141
#endif
142
 
143
    // Necessary to add a spacer or the button highlight interferes with the notebook under wxGTK
144
    item0->Add( 4, 4, 0, wxALIGN_CENTRE|wxALL, 0 );
145
 
146
    item0->Add( item1, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 0 );
147
 
148
    this->SetAutoLayout( TRUE );
149
    this->SetSizer( item0 );
150
 
151
    okButton->SetDefault();
152
    okButton->SetFocus();
153
 
154
    Layout();
155
 
156
    m_general->Layout();
157
    m_relocation->Layout();
158
    m_note->Layout();
159
 
160
    okButton->SetHelpText(_("Closes the dialog and saves any changes you may have made."));
161
    cancelButton->SetHelpText(_("Closes the dialog without saving any changes you have made."));
162
    helpButton->SetHelpText(_("Invokes help for the selected dialog."));
163
    applyButton->SetHelpText(_("Immediately applies any changes you may have made."));
164
 
165
    Centre(wxBOTH);
166
}
167
 
168
void ecSectionDialog::OnOK(wxCommandEvent& event)
169
{
170
    event.Skip();
171
}
172
 
173
void ecSectionDialog::OnCancel(wxCommandEvent& event)
174
{
175
    event.Skip();
176
}
177
 
178
void ecSectionDialog::OnApply(wxCommandEvent& event)
179
{
180
}
181
 
182
void ecSectionDialog::OnHelp(wxCommandEvent& event)
183
{
184
    int sel = m_notebook->GetSelection();
185
 
186
    wxASSERT_MSG( (sel != -1), wxT("A notebook tab should always be selected."));
187
 
188
    wxWindow* page = (wxWindow*) m_notebook->GetPage(sel);
189
 
190
    wxString helpTopic;
191
    if (page == m_general)
192
    {
193
        helpTopic = wxT("General section dialog");
194
    }
195
 
196
    if (!helpTopic.IsEmpty())
197
    {
198
        wxGetApp().GetHelpController().KeywordSearch(helpTopic);
199
    }
200
}
201
 
202
// This sets the text for the selected page, but doesn't help
203
// when trying to click on a tab: we would expect the appropriate help
204
// for that tab. We would need to look at the tabs to do this, from within OnContextHelp -
205
// probably not worth it.
206
void ecSectionDialog::OnPageChange(wxNotebookEvent& event)
207
{
208
    event.Skip();
209
 
210
    int sel = m_notebook->GetSelection();
211
    if (sel < 0)
212
        return;
213
 
214
    wxWindow* page = m_notebook->GetPage(sel);
215
    if (page)
216
    {
217
        wxString helpText;
218
#if 0
219
        if (page == m_displayOptions)
220
            helpText = _("The display options dialog allows you to change display-related options.");
221
        else if (page == m_viewerOptions)
222
            helpText = _("The viewer options dialog allows you to configure viewers.");
223
        else if (page == m_pathOptions)
224
            helpText = _("The path options dialog allows you to change tool paths.");
225
        else if (page == m_conflictResolutionOptions)
226
            helpText = _("The conflict resolution options dialog allows you to change options related to conflict resolution.");
227
        m_notebook->SetHelpText(helpText);
228
#endif
229
    }
230
}
231
 
232
bool ecSectionDialog::TransferDataToWindow()
233
{
234
    m_general->TransferDataToWindow();
235
    m_relocation->TransferDataToWindow();
236
    m_note->TransferDataToWindow();
237
    return TRUE;
238
}
239
 
240
bool ecSectionDialog::TransferDataFromWindow()
241
{
242
    m_general->TransferDataFromWindow();
243
    m_relocation->TransferDataFromWindow();
244
    m_note->TransferDataFromWindow();
245
    return TRUE;
246
}
247
 
248
/* General page
249
 */
250
 
251
IMPLEMENT_CLASS(ecSectionGeneralDialog, wxPanel)
252
 
253
ecSectionGeneralDialog::ecSectionGeneralDialog(wxWindow* parent):
254
    wxPanel(parent, ecID_SECTION_GENERAL)
255
{
256
    CreateControls(this);
257
 
258
    SetHelpText(_("TODO"));
259
}
260
 
261
void ecSectionGeneralDialog::CreateControls( wxPanel *parent)
262
{
263
    wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
264
 
265
    wxStaticBox *item2 = new wxStaticBox( parent, -1, "Name" );
266
    wxSizer *item1 = new wxStaticBoxSizer( item2, wxHORIZONTAL );
267
 
268
    wxSizer *item3 = new wxBoxSizer( wxVERTICAL );
269
 
270
    wxRadioButton *item4 = new wxRadioButton( parent, ecID_SECTION_GENERAL_LINKER, "&Linker-defined:", wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
271
    item3->Add( item4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
272
 
273
    wxRadioButton *item5 = new wxRadioButton( parent, ecID_SECTION_GENERAL_USER, "&User-defined:", wxDefaultPosition, wxDefaultSize, 0 );
274
    item3->Add( item5, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
275
 
276
    item1->Add( item3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
277
 
278
    item1->Add( 5, 5, 1, wxALIGN_CENTRE|wxALL, 5 );
279
 
280
    wxSizer *item6 = new wxBoxSizer( wxVERTICAL );
281
 
282
    wxTextCtrl *item7 = new wxTextCtrl( parent, ecID_SECTION_GENERAL_LINKER_TEXT, "", wxDefaultPosition, wxSize(200,-1), 0 );
283
    item6->Add( item7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
284
 
285
    wxString strs8[] =
286
    {
287
        "ChoiceItem"
288
    };
289
    wxChoice *item8 = new wxChoice( parent, ecID_SECTION_GENERAL_USER_TEXT, wxDefaultPosition, wxSize(100,-1), 1, strs8, 0 );
290
    item6->Add( item8, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
291
 
292
    wxSizer *item9 = new wxBoxSizer( wxHORIZONTAL );
293
 
294
    wxCheckBox *item10 = new wxCheckBox( parent, ecID_SECTION_GENERAL_KNOWN_SIZE, "&Known size:", wxDefaultPosition, wxDefaultSize, 0 );
295
    item9->Add( item10, 0, wxALIGN_CENTRE|wxALL, 5 );
296
 
297
    wxString strs11[] =
298
    {
299
        "ChoiceItem"
300
    };
301
    wxChoice *item11 = new wxChoice( parent, ecID_SECTION_GENERAL_KNOWN_SIZE_CHOICE, wxDefaultPosition, wxSize(100,-1), 1, strs11, 0 );
302
    item9->Add( item11, 0, wxALIGN_CENTRE|wxALL, 5 );
303
 
304
    item6->Add( item9, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 0 );
305
 
306
    item1->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 );
307
 
308
    item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
309
 
310
    //item0->Add( 20, 20, 0, wxALIGN_CENTRE|wxALL, 5 );
311
    item0->Add( 1, 1, 20, wxALIGN_CENTRE|wxALL, 0 );
312
 
313
    wxStaticBox *item13 = new wxStaticBox( parent, -1, "Find Location (VMA)" );
314
    wxSizer *item12 = new wxStaticBoxSizer( item13, wxHORIZONTAL );
315
 
316
    wxSizer *item14 = new wxBoxSizer( wxVERTICAL );
317
 
318
    wxRadioButton *item15 = new wxRadioButton( parent, ecID_SECTION_GENERAL_ABSOLUTE, "A&bsolute:", wxDefaultPosition, wxDefaultSize, 0 );
319
    item14->Add( item15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
320
 
321
    wxRadioButton *item16 = new wxRadioButton( parent, ecID_SECTION_GENERAL_FOLLOWING, "&Following:", wxDefaultPosition, wxDefaultSize, 0 );
322
    item14->Add( item16, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
323
 
324
    item12->Add( item14, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
325
 
326
    item12->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );
327
 
328
    wxSizer *item17 = new wxBoxSizer( wxVERTICAL );
329
 
330
    wxTextCtrl *item18 = new wxTextCtrl( parent, ecID_SECTION_GENERAL_ABSOLUTE_TEXT, "", wxDefaultPosition, wxSize(200,-1), 0 );
331
    item17->Add( item18, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
332
 
333
    wxString strs19[] =
334
    {
335
        "ChoiceItem"
336
    };
337
    wxChoice *item19 = new wxChoice( parent, ecID_SECTION_GENERAL_FOLLOWING_TEXT, wxDefaultPosition, wxSize(100,-1), 1, strs19, 0 );
338
    item17->Add( item19, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5 );
339
 
340
    wxSizer *item20 = new wxBoxSizer( wxHORIZONTAL );
341
 
342
    wxStaticText *item21 = new wxStaticText( parent, wxID_STATIC, "&Alignment:", wxDefaultPosition, wxDefaultSize, 0 );
343
    item20->Add( item21, 0, wxALIGN_CENTRE|wxALL, 5 );
344
 
345
    wxString strs22[] =
346
    {
347
        "ChoiceItem"
348
    };
349
    wxChoice *item22 = new wxChoice( parent, ecID_SECTION_GENERAL_ALIGNMENT, wxDefaultPosition, wxSize(100,-1), 1, strs22, 0 );
350
    item20->Add( item22, 0, wxALIGN_CENTRE|wxALL, 5 );
351
 
352
    item17->Add( item20, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 0 );
353
 
354
    item12->Add( item17, 0, wxGROW|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
355
 
356
    item0->Add( item12, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
357
 
358
 
359
    // Add context-sensitive help
360
    //item2->SetHelpText(_(""));
361
 
362
    parent->SetAutoLayout( TRUE );
363
    parent->SetSizer( item0 );
364
}
365
 
366
bool ecSectionGeneralDialog::TransferDataToWindow()
367
{
368
    wxPanel::TransferDataToWindow();
369
    return TRUE;
370
}
371
 
372
bool ecSectionGeneralDialog::TransferDataFromWindow()
373
{
374
    wxPanel::TransferDataFromWindow();
375
    return TRUE;
376
}
377
 
378
/* Relocation page
379
 */
380
 
381
IMPLEMENT_CLASS(ecSectionRelocationDialog, wxPanel)
382
 
383
ecSectionRelocationDialog::ecSectionRelocationDialog(wxWindow* parent):
384
    wxPanel(parent, ecID_SECTION_RELOCATION)
385
{
386
    CreateControls(this);
387
 
388
    SetHelpText(_("TODO"));
389
}
390
 
391
void ecSectionRelocationDialog::CreateControls( wxPanel *parent)
392
{
393
    wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
394
 
395
    item0->Add( 20, 20, 5, wxALIGN_CENTRE|wxALL, 5 );
396
 
397
    wxCheckBox *item1 = new wxCheckBox( parent, ecID_SECTION_RELOCATION_RELOCATE, "&Relocate section", wxDefaultPosition, wxDefaultSize, 0 );
398
    item0->Add( item1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 10 );
399
 
400
    item0->Add( 20, 20, 20, wxALIGN_CENTRE|wxALL, 0 );
401
 
402
    wxStaticBox *item3 = new wxStaticBox( parent, -1, "Initial Location (LMA)" );
403
    wxSizer *item2 = new wxStaticBoxSizer( item3, wxVERTICAL );
404
 
405
    wxSizer *item4 = new wxBoxSizer( wxHORIZONTAL );
406
 
407
    wxRadioButton *item5 = new wxRadioButton( parent, ecID_SECTION_RELOCATION_ABSOLUTE, "A&bsolute:", wxDefaultPosition, wxDefaultSize, 0 );
408
    item4->Add( item5, 0, wxALIGN_CENTRE|wxALL, 5 );
409
 
410
    item4->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );
411
 
412
    wxTextCtrl *item6 = new wxTextCtrl( parent, ecID_SECTION_RELOCATION_ABSOLUTE_TEXT, "", wxDefaultPosition, wxSize(80,-1), 0 );
413
    item4->Add( item6, 20, wxGROW|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
414
 
415
    item2->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
416
 
417
    wxSizer *item7 = new wxBoxSizer( wxHORIZONTAL );
418
 
419
    wxRadioButton *item8 = new wxRadioButton( parent, ecID_SECTION_RELOCATION_FOLLOWING, "&Following:", wxDefaultPosition, wxDefaultSize, 0 );
420
    item7->Add( item8, 0, wxALIGN_CENTRE|wxALL, 5 );
421
 
422
    item7->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );
423
 
424
    wxString strs9[] =
425
    {
426
        "ChoiceItem"
427
    };
428
    wxChoice *item9 = new wxChoice( parent, ecID_SECTION_RELOCATION_FOLLOWING_CHOICE, wxDefaultPosition, wxSize(100,-1), 1, strs9, 0 );
429
    item7->Add( item9, 20, wxGROW|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
430
 
431
    item2->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
432
 
433
    item0->Add( item2, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
434
 
435
    item0->Add( 20, 20, 20, wxALIGN_CENTRE|wxALL, 5 );
436
 
437
    // Add context-sensitive help
438
    //item2->SetHelpText(_(""));
439
 
440
    parent->SetAutoLayout( TRUE );
441
    parent->SetSizer( item0 );
442
}
443
 
444
bool ecSectionRelocationDialog::TransferDataToWindow()
445
{
446
    wxPanel::TransferDataToWindow();
447
    return TRUE;
448
}
449
 
450
bool ecSectionRelocationDialog::TransferDataFromWindow()
451
{
452
    wxPanel::TransferDataFromWindow();
453
    return TRUE;
454
}
455
 
456
/* Note page
457
 */
458
 
459
IMPLEMENT_CLASS(ecSectionNoteDialog, wxPanel)
460
 
461
ecSectionNoteDialog::ecSectionNoteDialog(wxWindow* parent):
462
    wxPanel(parent, ecID_SECTION_NOTE)
463
{
464
    CreateControls(this);
465
 
466
    SetHelpText(_("TODO"));
467
}
468
 
469
void ecSectionNoteDialog::CreateControls( wxPanel *parent)
470
{
471
    wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
472
 
473
    wxTextCtrl *item1 = new wxTextCtrl( parent, ecID_SECTION_NOTE_TEXT, "", wxDefaultPosition, wxSize(80,40), wxTE_MULTILINE );
474
    item0->Add( item1, 20, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
475
 
476
 
477
    // Add context-sensitive help
478
    //item2->SetHelpText(_(""));
479
 
480
    parent->SetAutoLayout( TRUE );
481
    parent->SetSizer( item0 );
482
}
483
 
484
bool ecSectionNoteDialog::TransferDataToWindow()
485
{
486
    wxPanel::TransferDataToWindow();
487
    return TRUE;
488
}
489
 
490
bool ecSectionNoteDialog::TransferDataFromWindow()
491
{
492
    wxPanel::TransferDataFromWindow();
493
    return TRUE;
494
}

powered by: WebSVN 2.1.0

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