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

powered by: WebSVN 2.1.0

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