OpenASIP 2.2
Loading...
Searching...
No Matches
MemoryDialog.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 MemoryTools.cc
26 *
27 * Definition of MemoryTools class.
28 *
29 * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include <boost/format.hpp>
34#include <string>
35
36#include "MemoryDialog.hh"
37#include "OSEdTextGenerator.hh"
38#include "WxConversion.hh"
39#include "WidgetTools.hh"
40#include "DialogPosition.hh"
41#include "OperationContainer.hh"
42#include "Conversion.hh"
43#include "MemoryControl.hh"
44#include "OSEd.hh"
45
46using boost::format;
47using std::string;
48
49BEGIN_EVENT_TABLE(MemoryDialog, wxDialog)
50 EVT_BUTTON(ID_BUTTON_CLOSE, MemoryDialog::onClose)
52
53/**
54 * Constructor.
55 *
56 * @param window Parent window.
57 */
58MemoryDialog::MemoryDialog(wxWindow* window) :
59 wxDialog(window, -1, _T(""),
60 DialogPosition::getPosition(DialogPosition::DIALOG_MEMORY),
61 wxDefaultSize, wxRESIZE_BORDER) {
62
63 createContents(this, true, true);
64 setTexts();
65
66 OSEdInformer* informer = wxGetApp().mainFrame()->informer();
68}
69
70/**
71 * Destructor.
72 */
74 int x, y;
75 GetPosition(&x, &y);
76 wxPoint point(x, y);
78}
79
80/**
81 * Set texts to widgets.
82 */
83void
96
97/**
98 * Handles the event when dialog is closed.
99 */
100void
101MemoryDialog::onClose(wxCommandEvent&) {
102 OSEdInformer* informer = wxGetApp().mainFrame()->informer();
104 Close();
105}
106
107/**
108 * Handles event when the contents of the memory might have changed.
109 */
110void
112 switch(event) {
115 break;
116 default:
117 break;
118 }
119}
120
121/**
122 * Creates the contents of the MemoryDialog.
123 *
124 * @param parent Parent window.
125 * @param call_fit If true, fits the contents inside the dialog.
126 * @param set_sizer If true, sets the the main sizer as dialog contents.
127 * @return The created sizer.
128 */
129wxSizer*
131 wxWindow* parent,
132 bool call_fit,
133 bool set_sizer) {
134
135 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
136
139
140 item0->Add(memoryWindow_, 1, wxGROW|wxALL, 5);
141
142 wxButton *item1 = new wxButton( parent, ID_BUTTON_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0 );
143
144 item0->Add( item1, 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
155}
END_EVENT_TABLE() using namespace IDF
EVT_BUTTON(ID_EDIT_ARCH_PORT, FUImplementationDialog::onEditArchitecturePort) EVT_BUTTON(ID_ADD_EXTERNAL_PORT
static void setPosition(Dialogs dialog, wxPoint point)
@ DIALOG_MEMORY
Memory dialog.
virtual void handleEvent(OSEdInformer::EventId event)
MemoryControl * memoryWindow_
Memory control of the dialog.
virtual ~MemoryDialog()
wxSizer * createContents(wxWindow *window, bool call_fit, bool set_sizer)
void onClose(wxCommandEvent &)
@ EVENT_MEMORY
Event when memory may be changed.
void registerListener(EventId event, OSEdListener *listener)
void unregisterListener(EventId event, OSEdListener *listener)
static OSEdTextGenerator & instance()
@ TXT_MEMORY_DIALOG_TITLE
Memory dialog title.
@ TXT_BUTTON_CLOSE
Close button label.
static Memory & memory()
virtual boost::format text(int textId)
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)
static wxString toWxString(const std::string &source)