35 #include <wx/clipbrd.h>
37 #include "tce_config.h"
98 const wxString& name) :
99 wxPanel(parent,
id, pos, size, wxTAB_TRAVERSAL, name),
100 memory_(memory), MAUSize_(memory->MAUSize()),
101 start_(memory->start()), end_(memory->end()),
103 goToAddress_(_T("0")),
117 dataMode_->SetSelection(1);
120 if (MAUSize_ <= 32) {
123 if (MAUSize_ <= 16) {
130 sizeMode_->SetSelection(0);
132 widthMode_->Append(WIDTH_8);
133 widthMode_->Append(WIDTH_16);
134 widthMode_->Append(WIDTH_32);
136 widthMode_->SetSelection(0);
138 wxTextValidator hexValidator(wxFILTER_INCLUDE_CHAR_LIST, &goToAddress_);
140 #if wxCHECK_VERSION(2, 5, 4)
141 wxArrayString includes;
142 includes.Add(_T(
"0"));
143 includes.Add(_T(
"1"));
144 includes.Add(_T(
"2"));
145 includes.Add(_T(
"3"));
146 includes.Add(_T(
"4"));
147 includes.Add(_T(
"5"));
148 includes.Add(_T(
"6"));
149 includes.Add(_T(
"7"));
150 includes.Add(_T(
"8"));
151 includes.Add(_T(
"9"));
152 includes.Add(_T(
"a"));
153 includes.Add(_T(
"b"));
154 includes.Add(_T(
"c"));
155 includes.Add(_T(
"d"));
156 includes.Add(_T(
"e"));
157 includes.Add(_T(
"f"));
158 includes.Add(_T(
"A"));
159 includes.Add(_T(
"B"));
160 includes.Add(_T(
"C"));
161 includes.Add(_T(
"D"));
162 includes.Add(_T(
"E"));
163 includes.Add(_T(
"F"));
164 hexValidator.SetIncludes(includes);
166 hexValidator.SetIncludeList(
168 _T(
"0"), _T(
"1"), _T(
"2"), _T(
"3"), _T(
"4"), _T(
"5"), _T(
"6"),
169 _T(
"7"), _T(
"8"), _T(
"9"), _T(
"a"), _T(
"b"), _T(
"c"), _T(
"d"),
170 _T(
"e"), _T(
"f"), _T(
"A"), _T(
"B"), _T(
"C"), _T(
"D"), _T(
"E"),
174 FindWindow(ID_ADDRESS_GO_TO)->SetValidator(hexValidator);
192 sizer_ =
new wxBoxSizer(wxVERTICAL);
195 grid_ =
new wxGrid(
this,
ID_GRID, wxDefaultPosition, wxDefaultSize);
198 grid_->SetDefaultCellAlignment(wxALIGN_RIGHT, wxALIGN_BOTTOM);
199 grid_->SetRowLabelSize(100);
200 grid_->SetDefaultCellFont(
201 wxFont(12, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL,
202 wxFONTWEIGHT_NORMAL));
204 grid_->EnableEditing(
false);
205 grid_->DisableDragGridSize();
206 grid_->DisableDragRowSize();
211 this,
ID_CHOICE_DATA, wxDefaultPosition, wxDefaultSize, 0, NULL, 0);
213 this,
ID_CHOICE_MODE, wxDefaultPosition, wxDefaultSize, 0, NULL, 0);
217 wxTextCtrl* addressCtrl =
new wxTextCtrl(
222 wxSizer* sizer1 =
new wxBoxSizer(wxHORIZONTAL);
224 wxStaticText* columnsLabel =
new wxStaticText(
this, -1, _T(
"Columns:"));
225 wxStaticText* asLabel =
new wxStaticText(
this, -1, _T(
"as"));
227 sizer1->Add(
sizeMode_, 0, wxALIGN_CENTER|wxALL, 5);
228 sizer1->Add(asLabel, 0, wxALIGN_CENTER|wxALL, 5);
229 sizer1->Add(
dataMode_, 0, wxALIGN_CENTER|wxALL, 5);
230 sizer1->Add(addressCtrl, 0, wxALIGN_CENTER|wxALL, 5);
231 sizer1->Add(goTo, 0, wxALIGN_CENTER|wxALL, 5);
232 sizer1->Add(columnsLabel, 0, wxALIGN_CENTER|wxALL, 5);
233 sizer1->Add(
widthMode_, 0, wxALIGN_CENTER|wxALL, 5);
235 sizer_->Add(sizer1, 0, wxALIGN_CENTER|wxALL, 5);
250 TransferDataFromWindow();
259 string msg =
"Invalid number: " +
268 " out of memory bounds.";
278 grid_->MakeCellVisible(row, col);
279 grid_->SetGridCursor(row, col);
297 digits = (digits / 4) + 3;
301 digits = (digits / 3) + 1;
308 grid_->SetDefaultColSize(digits * 12,
true);
309 grid_->ForceRefresh();
381 int column =
event.GetCol();
382 int row =
event.GetRow();
389 dialog.CenterOnParent();
399 if(dialog.ShowModal() == wxID_OK) {
423 if (event.GetKeyCode() == WXK_DELETE) {
424 if (
grid_->IsSelection()) {
427 }
else if (event.m_controlDown &&
428 (event.GetKeyCode() ==
'c' ||
429 event.GetKeyCode() ==
'C' ||
430 event.GetKeyCode() == WXK_INSERT)) {
433 if (
grid_->IsSelection()) {
447 wxGridCellCoordsArray topLeft =
grid_->GetSelectionBlockTopLeft();
448 wxGridCellCoordsArray botRight =
grid_->GetSelectionBlockBottomRight();
450 int currentRow = topLeft[0].GetRow();
451 int currentCol = topLeft[0].GetCol();
453 int endRow = botRight[0].GetRow();
454 int endCol = botRight[0].GetCol();
456 while (currentRow <= endRow) {
457 currentCol = topLeft[0].GetCol();
458 while (currentCol <= endCol) {
498 wxString width =
widthMode_->GetStringSelection();
517 if (
grid_ == NULL || !(
grid_->IsSelection())) {
521 if (wxTheClipboard->Open()) {
523 wxTextDataObject* data =
new wxTextDataObject();
526 wxGridCellCoordsArray topLs =
grid_->GetSelectionBlockTopLeft();
527 wxGridCellCoordsArray bottomRs =
grid_->GetSelectionBlockBottomRight();
529 for (
unsigned i = 0; i < topLs.Count(); i++) {
531 contents.Append(_T(
"\n"));
533 int row = topLs.Item(i).GetRow();
534 for (; row <= bottomRs.Item(i).GetRow(); row++) {
535 int col = topLs.Item(i).GetCol();
536 for (; col <= bottomRs.Item(i).GetCol(); col++) {
537 contents.Append(
grid_->GetCellValue(row, col));
538 contents.Append(_T(
" "));
540 contents.Append(_T(
"\n"));
544 data->SetText(contents);
546 wxTheClipboard->SetData(data);
547 wxTheClipboard->Close();
558 grid_->SetCellBackgroundColour(row, col, *wxWHITE);
565 if (count < 1 || address < start_ || address + count >
end_) {
570 for (
unsigned i = 0; i < count; i++) {
572 int row = cell / cols;
573 int col = cell % cols;
575 grid_->SetCellBackgroundColour(row, col, colour);