OpenASIP 2.2
Loading...
Searching...
No Matches
ProDeOptionsDialog.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file ProDeOptionsDialog.cc
26 *
27 * Implementation of ProDeOptionsDialog class.
28 *
29 * @author Veli-Pekka Jääskeläinen (vjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include <boost/format.hpp>
34#include <wx/notebook.h>
35#include "ProDeOptionsDialog.hh"
36#include "ProDeOptions.hh"
37#include "WxConversion.hh"
38#include "ProDe.hh"
39#include "Conversion.hh"
40#include "UserManualCmd.hh"
41#include "WidgetTools.hh"
42#include "GUITextGenerator.hh"
43#include "ProDeTextGenerator.hh"
44#include "ProDeConstants.hh"
45
46using boost::format;
47using std::string;
48using std::vector;
49
50
51BEGIN_EVENT_TABLE(ProDeOptionsDialog, OptionsDialog)
54
55
56/**
57 * The Constructor.
58 *
59 * @param parent Parent window of the dialog.
60 * @param options Options to be modified.
61 */
63 wxWindow* parent, ProDeOptions& options, CommandRegistry& registry):
64 OptionsDialog(parent, options, registry),
65 parent_(parent), options_(options) {
66
67 wxPanel* generalPage = new wxPanel(notebook_, -1);
68 createGeneralPage(generalPage, true, true);
69 addPage(generalPage, _T("General"));
70
71 undoStackSize_ = dynamic_cast<wxSpinCtrl*>(FindWindow(ID_UNDO_LEVELS));
72
73 readProDeOptions();
74
75}
76
77
78/**
79 * The Destructor.
80 */
83
84/**
85 * Reads the options in options_ to dialog attributes.
86 */
87void
91
92
93/**
94 * Writes the options from dialog attributes to the current options object.
95 */
96void
100
101
102/**
103 * Validates input in the controls, and updates the options.
104 */
105void
106ProDeOptionsDialog::onOK(wxCommandEvent&) {
107
108 if (!Validate()) {
109 return;
110 }
111
112 if (!TransferDataFromWindow()) {
113 return;
114 }
115
116 writeOptions();
118
119 EndModal(wxID_OK);
120}
121
122
123/**
124 * Creates the 'General' page for the dialog.
125 *
126 * This function was initially generated by wxDesigner.
127 * @return Main sizer of the created contents.
128 * @param parent The dialog window.
129 * @param call_fit If true, fits the contents inside the dialog.
130 * @param set_sizer If true, sets the main sizer as dialog contents.
131 */
132wxSizer*
134 wxWindow *parent, bool call_fit, bool set_sizer ) {
135
136 wxBoxSizer *item0 = new wxBoxSizer( wxHORIZONTAL );
137
138 item0->Add( 50, 20, 0, wxALIGN_CENTER|wxALL, 5 );
139
140 wxStaticText *item1 = new wxStaticText( parent, ID_LABEL_UNDO_LEVELS, wxT("Undo levels:"), wxDefaultPosition, wxDefaultSize, 0 );
141 item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
142
143 wxSpinCtrl *item2 = new wxSpinCtrl( parent, ID_UNDO_LEVELS, wxT("1"), wxDefaultPosition, wxSize(-1,-1), 0, 1, 100, 0 );
144 item0->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );
145
146 if (set_sizer)
147 {
148 parent->SetSizer( item0 );
149 if (call_fit)
150 item0->SetSizeHints( parent );
151 }
152
153 return item0;
154}
END_EVENT_TABLE() using namespace IDF
EVT_BUTTON(ID_EDIT_ARCH_PORT, FUImplementationDialog::onEditArchitecturePort) EVT_BUTTON(ID_ADD_EXTERNAL_PORT
static MachInfoCmdLineOptions options
Definition MachInfo.cc:46
virtual void writeOptions()
wxSpinCtrl * undoStackSize_
Undo levels.
void onOK(wxCommandEvent &event)
wxSizer * createGeneralPage(wxWindow *parent, bool callFit, bool set_sizer)
ProDeOptions & options_
current editor options
int undoStackSize() const
void setUndoStackSize(int size)