OpenASIP  2.0
InputOperandDialog.hh
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 InputOperandDialog.hh
26  *
27  * Declaration of InputOperandDialog class.
28  *
29  * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_INPUT_OPERAND_DIALOG_HH
34 #define TTA_INPUT_OPERAND_DIALOG_HH
35 
36 #include <wx/wx.h>
37 #include <wx/listctrl.h>
38 #include <wx/spinctrl.h>
39 #include <set>
40 
41 class Operand;
42 #include "Operand.hh"
43 
44 /**
45  * Dialog for adding or modifying input operands.
46  */
47 class InputOperandDialog : public wxDialog {
48 public:
50  wxWindow* parent,
51  Operand* operand,
52  int numberOfOperands,
53  int operandIndex);
54 
55  virtual ~InputOperandDialog();
56 
57 private:
58  /// Copying not allowed.
60  /// Assignment not allowed.
62 
63  wxSizer* createContents(wxWindow* parent, bool call_fit, bool set_sizer);
64  virtual bool TransferDataToWindow();
65  void updateList();
66  void onAddSwap(wxCommandEvent& event);
67  void onDeleteSwap(wxCommandEvent& event);
68  void onSelection(wxListEvent& event);
69  void onOk(wxCommandEvent& event);
70  void updateOperand();
71  void onType(wxCommandEvent& event);
72  void onElementWidth(wxSpinEvent& event);
73  void onElementCount(wxCommandEvent& event);
74 
75  void updateTypes();
76  void updateElementWidths();
77  void updateElementCounts();
78  void setTexts();
79 
80  /**
81  * Component ids.
82  */
83  enum {
88  ID_OPERATION_INPUT_TYPES, // Input Type ComboBox
95  };
96 
97  /// List of can swap operands.
98  wxListCtrl* swapList_;
99  /// Choice list for can swap operands.
100  wxChoice* swapChoice_;
101  /// Pointer to can swap sizer.
102  wxStaticBoxSizer* swapSizer_;
103  /// Operand to be created or modified.
105  /// Flag indicating if operand is memory address.
107  /// Flag indicating if operand is memory data.
108  bool memData_;
109  /// Choice box for operation input types
111  /// Spin ctrl for operand element width.
113  /// Choice box for operand element count.
115  /// Operands that can be swapped with this operand.
116  std::set<int> canSwap_;
117  /// Numberof input operands.
119  /// Index of the input operand currently modified.
120  int index_;
121  /// Current operand type in choice box.
122  int type_;
123  /// Current element width in choice box.
125  /// Current element count in choice box.
127 
128  /// Input types
129  std::vector<std::string> inputTypes_;
130 
132 
133  DECLARE_EVENT_TABLE()
134 };
135 
136 #endif
InputOperandDialog::onElementCount
void onElementCount(wxCommandEvent &event)
Definition: InputOperandDialog.cc:224
Operand
Definition: Operand.hh:52
InputOperandDialog::memData_
bool memData_
Flag indicating if operand is memory data.
Definition: InputOperandDialog.hh:108
InputOperandDialog::ID_OPERATION_INPUT_TYPES
@ ID_OPERATION_INPUT_TYPES
Definition: InputOperandDialog.hh:88
InputOperandDialog::elemWidth_
int elemWidth_
Current element width in choice box.
Definition: InputOperandDialog.hh:124
InputOperandDialog::ID_ADD_BUTTON
@ ID_ADD_BUTTON
Definition: InputOperandDialog.hh:89
InputOperandDialog::canSwap_
std::set< int > canSwap_
Operands that can be swapped with this operand.
Definition: InputOperandDialog.hh:116
InputOperandDialog::swapSizer_
wxStaticBoxSizer * swapSizer_
Pointer to can swap sizer.
Definition: InputOperandDialog.hh:102
InputOperandDialog::numberOfOperands_
int numberOfOperands_
Numberof input operands.
Definition: InputOperandDialog.hh:118
Operand::OperandType
OperandType
Definition: Operand.hh:58
InputOperandDialog::ID_DELETE_BUTTON
@ ID_DELETE_BUTTON
Definition: InputOperandDialog.hh:90
InputOperandDialog::inputTypesComboBox_
wxChoice * inputTypesComboBox_
Choice box for operation input types.
Definition: InputOperandDialog.hh:110
InputOperandDialog::~InputOperandDialog
virtual ~InputOperandDialog()
Definition: InputOperandDialog.cc:142
InputOperandDialog::updateOperand
void updateOperand()
Definition: InputOperandDialog.cc:423
InputOperandDialog::onSelection
void onSelection(wxListEvent &event)
Definition: InputOperandDialog.cc:494
InputOperandDialog::type_
int type_
Current operand type in choice box.
Definition: InputOperandDialog.hh:122
InputOperandDialog::ID_MEM_ADDRESS
@ ID_MEM_ADDRESS
Definition: InputOperandDialog.hh:84
InputOperandDialog::operand_
Operand * operand_
Operand to be created or modified.
Definition: InputOperandDialog.hh:104
InputOperandDialog::onDeleteSwap
void onDeleteSwap(wxCommandEvent &event)
Definition: InputOperandDialog.cc:375
InputOperandDialog::ID_TEXT_COUNT
@ ID_TEXT_COUNT
Definition: InputOperandDialog.hh:94
InputOperandDialog::updateElementWidths
void updateElementWidths()
Definition: InputOperandDialog.cc:260
InputOperandDialog::ID_ELEMENT_COUNT
@ ID_ELEMENT_COUNT
Definition: InputOperandDialog.hh:92
InputOperandDialog::swapList_
wxListCtrl * swapList_
List of can swap operands.
Definition: InputOperandDialog.hh:98
InputOperandDialog::elementCountChoice_
wxChoice * elementCountChoice_
Choice box for operand element count.
Definition: InputOperandDialog.hh:114
InputOperandDialog::ID_OPERAND_CHOICE
@ ID_OPERAND_CHOICE
Definition: InputOperandDialog.hh:87
InputOperandDialog
Definition: InputOperandDialog.hh:47
InputOperandDialog::onElementWidth
void onElementWidth(wxSpinEvent &event)
Definition: InputOperandDialog.cc:214
InputOperandDialog::onType
void onType(wxCommandEvent &event)
Definition: InputOperandDialog.cc:199
InputOperandDialog::TransferDataToWindow
virtual bool TransferDataToWindow()
Definition: InputOperandDialog.cc:318
InputOperandDialog::ID_SWAP_LIST
@ ID_SWAP_LIST
Definition: InputOperandDialog.hh:86
InputOperandDialog::updateList
void updateList()
Definition: InputOperandDialog.cc:327
InputOperandDialog::inputTypes_
std::vector< std::string > inputTypes_
Input types.
Definition: InputOperandDialog.hh:129
InputOperandDialog::ID_MEM_DATA
@ ID_MEM_DATA
Definition: InputOperandDialog.hh:85
InputOperandDialog::updateElementCounts
void updateElementCounts()
Definition: InputOperandDialog.cc:294
Operand.hh
InputOperandDialog::InputOperandDialog
InputOperandDialog(wxWindow *parent, Operand *operand, int numberOfOperands, int operandIndex)
Definition: InputOperandDialog.cc:76
InputOperandDialog::operator=
InputOperandDialog & operator=(const InputOperandDialog &)
Assignment not allowed.
InputOperandDialog::operandTypes_
Operand::OperandType operandTypes_[9]
Definition: InputOperandDialog.hh:131
InputOperandDialog::ID_ELEMENT_WIDTH
@ ID_ELEMENT_WIDTH
Definition: InputOperandDialog.hh:91
InputOperandDialog::onOk
void onOk(wxCommandEvent &event)
Definition: InputOperandDialog.cc:413
InputOperandDialog::memAddress_
bool memAddress_
Flag indicating if operand is memory address.
Definition: InputOperandDialog.hh:106
InputOperandDialog::setTexts
void setTexts()
Definition: InputOperandDialog.cc:153
InputOperandDialog::updateTypes
void updateTypes()
Definition: InputOperandDialog.cc:244
InputOperandDialog::onAddSwap
void onAddSwap(wxCommandEvent &event)
Definition: InputOperandDialog.cc:362
InputOperandDialog::elementWidthSpinCtrl_
wxSpinCtrl * elementWidthSpinCtrl_
Spin ctrl for operand element width.
Definition: InputOperandDialog.hh:112
InputOperandDialog::elemCount_
int elemCount_
Current element count in choice box.
Definition: InputOperandDialog.hh:126
InputOperandDialog::swapChoice_
wxChoice * swapChoice_
Choice list for can swap operands.
Definition: InputOperandDialog.hh:100
InputOperandDialog::ID_TEXT_WIDTH
@ ID_TEXT_WIDTH
Definition: InputOperandDialog.hh:93
InputOperandDialog::index_
int index_
Index of the input operand currently modified.
Definition: InputOperandDialog.hh:120
InputOperandDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: InputOperandDialog.cc:513