File: memoryviewbase.cpp

package info (click to toggle)
codelite 12.0+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 95,112 kB
  • sloc: cpp: 424,040; ansic: 18,284; php: 9,569; lex: 4,186; yacc: 2,820; python: 2,294; sh: 312; makefile: 51; xml: 13
file content (142 lines) | stat: -rw-r--r-- 6,810 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//////////////////////////////////////////////////////////////////////
// This file was auto-generated by codelite's wxCrafter Plugin
// wxCrafter project file: memoryviewbase.wxcp
// Do not modify this file by hand!
//////////////////////////////////////////////////////////////////////

#include "memoryviewbase.h"


// Declare the bitmap loading function
extern void wxC5C75InitBitmapResources();

static bool bBitmapLoaded = false;


MemoryViewBase::MemoryViewBase(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
    : wxPanel(parent, id, pos, size, style)
{
    if ( !bBitmapLoaded ) {
        // We need to initialise the default bitmap handler
        wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
        wxC5C75InitBitmapResources();
        bBitmapLoaded = true;
    }
    
    wxBoxSizer* bSizer1 = new wxBoxSizer(wxVERTICAL);
    this->SetSizer(bSizer1);
    
    wxFlexGridSizer* flexGridSizer6 = new wxFlexGridSizer(0, 6, 0, 0);
    flexGridSizer6->SetFlexibleDirection( wxBOTH );
    flexGridSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
    flexGridSizer6->AddGrowableCol(1);
    
    bSizer1->Add(flexGridSizer6, 0, wxALL|wxEXPAND, 5);
    
    m_staticText2 = new wxStaticText(this, wxID_ANY, _("Address:"), wxDefaultPosition, wxSize(-1, -1), 0);
    
    flexGridSizer6->Add(m_staticText2, 0, wxLEFT|wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5);
    
    m_textCtrlExpression = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1, -1), wxTE_PROCESS_ENTER);
    m_textCtrlExpression->SetToolTip(_("Address or pointer to watch"));
    #if wxVERSION_NUMBER >= 3000
    m_textCtrlExpression->SetHint(wxT(""));
    #endif
    
    flexGridSizer6->Add(m_textCtrlExpression, 1, wxALL|wxEXPAND, 5);
    
    m_staticText1 = new wxStaticText(this, wxID_ANY, _("Size:"), wxDefaultPosition, wxSize(-1, -1), 0);
    m_staticText1->SetToolTip(_("Memory size to view"));
    
    flexGridSizer6->Add(m_staticText1, 0, wxLEFT|wxTOP|wxBOTTOM|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
    
    wxArrayString m_choiceSizeArr;
    m_choiceSizeArr.Add(wxT("32"));
    m_choiceSizeArr.Add(wxT("64"));
    m_choiceSizeArr.Add(wxT("128"));
    m_choiceSizeArr.Add(wxT("256"));
    m_choiceSizeArr.Add(wxT("512"));
    m_choiceSizeArr.Add(wxT("1024"));
    m_choiceSizeArr.Add(wxT("2048"));
    m_choiceSizeArr.Add(wxT("4096"));
    m_choiceSize = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxSize(-1,-1), m_choiceSizeArr, 0);
    m_choiceSize->SetToolTip(_("Memory size to view"));
    m_choiceSize->SetSelection(0);
    
    flexGridSizer6->Add(m_choiceSize, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5);
    
    m_staticText8 = new wxStaticText(this, wxID_ANY, _("Number of columns:"), wxDefaultPosition, wxSize(-1,-1), 0);
    
    flexGridSizer6->Add(m_staticText8, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
    
    wxArrayString m_choiceColsArr;
    m_choiceColsArr.Add(wxT("4"));
    m_choiceColsArr.Add(wxT("8"));
    m_choiceColsArr.Add(wxT("16"));
    m_choiceColsArr.Add(wxT("32"));
    m_choiceCols = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxSize(-1,-1), m_choiceColsArr, 0);
    m_choiceCols->SetToolTip(_("Number of columns to use per row"));
    m_choiceCols->SetSelection(2);
    
    flexGridSizer6->Add(m_choiceCols, 0, wxALL, 5);
    
    wxBoxSizer* bSizer3 = new wxBoxSizer(wxHORIZONTAL);
    
    bSizer1->Add(bSizer3, 1, wxEXPAND, 5);
    
    m_textCtrlMemory = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1, -1), wxTE_RICH2|wxTE_MULTILINE|wxTE_DONTWRAP);
    #ifdef __WXMSW__
    // To get the newer version of the font on MSW, we use font wxSYS_DEFAULT_GUI_FONT with family set to wxFONTFAMILY_TELETYPE
    wxFont m_textCtrlMemoryFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
    m_textCtrlMemoryFont.SetFamily(wxFONTFAMILY_TELETYPE);
    #else
    wxFont m_textCtrlMemoryFont = wxSystemSettings::GetFont(wxSYS_ANSI_FIXED_FONT);
    m_textCtrlMemoryFont.SetFamily(wxFONTFAMILY_TELETYPE);
    #endif
    m_textCtrlMemory->SetFont(m_textCtrlMemoryFont);
    
    bSizer3->Add(m_textCtrlMemory, 1, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND, 5);
    
    wxBoxSizer* bSizer4 = new wxBoxSizer(wxVERTICAL);
    
    bSizer3->Add(bSizer4, 0, 0, 5);
    
    m_buttonEvaluate = new wxButton(this, wxID_ANY, _("Evaluate"), wxDefaultPosition, wxSize(-1, -1), 0);
    m_buttonEvaluate->SetDefault();
    m_buttonEvaluate->SetToolTip(_("Evaluate the expression in the \"Address\" field"));
    
    bSizer4->Add(m_buttonEvaluate, 0, wxALL|wxEXPAND, 5);
    
    m_buttonUpdate = new wxButton(this, wxID_ANY, _("Update"), wxDefaultPosition, wxSize(-1, -1), 0);
    m_buttonUpdate->SetToolTip(_("Update the memory in the main display area to apply your changes"));
    
    bSizer4->Add(m_buttonUpdate, 0, wxALL|wxEXPAND, 5);
    
    SetName(wxT("MemoryViewBase"));
    SetSizeHints(596,300);
    if ( GetSizer() ) {
         GetSizer()->Fit(this);
    }
    CentreOnParent(wxBOTH);
    // Connect events
    m_textCtrlExpression->Connect(wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler(MemoryViewBase::OnTextEntered), NULL, this);
    m_choiceSize->Connect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(MemoryViewBase::OnMemorySize), NULL, this);
    m_choiceCols->Connect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(MemoryViewBase::OnNumberOfRows), NULL, this);
    m_textCtrlMemory->Connect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(MemoryViewBase::OnTextDClick), NULL, this);
    m_buttonEvaluate->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MemoryViewBase::OnEvaluate), NULL, this);
    m_buttonEvaluate->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MemoryViewBase::OnEvaluateUI), NULL, this);
    m_buttonUpdate->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MemoryViewBase::OnUpdate), NULL, this);
    
}

MemoryViewBase::~MemoryViewBase()
{
    m_textCtrlExpression->Disconnect(wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler(MemoryViewBase::OnTextEntered), NULL, this);
    m_choiceSize->Disconnect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(MemoryViewBase::OnMemorySize), NULL, this);
    m_choiceCols->Disconnect(wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler(MemoryViewBase::OnNumberOfRows), NULL, this);
    m_textCtrlMemory->Disconnect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(MemoryViewBase::OnTextDClick), NULL, this);
    m_buttonEvaluate->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MemoryViewBase::OnEvaluate), NULL, this);
    m_buttonEvaluate->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MemoryViewBase::OnEvaluateUI), NULL, this);
    m_buttonUpdate->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(MemoryViewBase::OnUpdate), NULL, this);
    
}