Mercurial > vba-linux
comparison src/win32/MemoryViewerAddressSize.cpp @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:8ced16adf2e1 | 1:f9f4f1b99eed |
---|---|
1 // MemoryViewerAddressSize.cpp : implementation file | |
2 // | |
3 | |
4 #include "stdafx.h" | |
5 #include "resource.h" | |
6 #include "MemoryViewerAddressSize.h" | |
7 | |
8 ///////////////////////////////////////////////////////////////////////////// | |
9 // MemoryViewerAddressSize dialog | |
10 | |
11 MemoryViewerAddressSize::MemoryViewerAddressSize(u32 a, int s, CWnd*pParent /*=NULL*/) | |
12 : CDialog(MemoryViewerAddressSize::IDD, pParent) | |
13 { | |
14 //{{AFX_DATA_INIT(MemoryViewerAddressSize) | |
15 // NOTE: the ClassWizard will add member initialization here | |
16 //}}AFX_DATA_INIT | |
17 address = a; | |
18 size = s; | |
19 } | |
20 | |
21 void MemoryViewerAddressSize::DoDataExchange(CDataExchange*pDX) | |
22 { | |
23 CDialog::DoDataExchange(pDX); | |
24 //{{AFX_DATA_MAP(MemoryViewerAddressSize) | |
25 DDX_Control(pDX, IDC_SIZE_CONTROL, m_size); | |
26 DDX_Control(pDX, IDC_ADDRESS, m_address); | |
27 //}}AFX_DATA_MAP | |
28 } | |
29 | |
30 BEGIN_MESSAGE_MAP(MemoryViewerAddressSize, CDialog) | |
31 //{{AFX_MSG_MAP(MemoryViewerAddressSize) | |
32 ON_BN_CLICKED(ID_OK, OnOk) | |
33 ON_BN_CLICKED(ID_CANCEL, OnCancel) | |
34 //}}AFX_MSG_MAP | |
35 END_MESSAGE_MAP() | |
36 | |
37 ///////////////////////////////////////////////////////////////////////////// | |
38 // MemoryViewerAddressSize message handlers | |
39 | |
40 BOOL MemoryViewerAddressSize::OnInitDialog() | |
41 { | |
42 CDialog::OnInitDialog(); | |
43 | |
44 CString buffer; | |
45 if (address != 0xFFFFFFFF) | |
46 { | |
47 buffer.Format("%08X", address); | |
48 m_address.SetWindowText(buffer); | |
49 } | |
50 if (size != -1) | |
51 { | |
52 buffer.Format("%08X", size); | |
53 m_size.SetWindowText(buffer); | |
54 m_size.EnableWindow(FALSE); | |
55 } | |
56 | |
57 if (size == -1 && address != 0xFFFFFFFF) | |
58 m_size.SetFocus(); | |
59 | |
60 m_address.LimitText(9); | |
61 m_size.LimitText(9); | |
62 | |
63 return TRUE; // return TRUE unless you set the focus to a control | |
64 // EXCEPTION: OCX Property Pages should return FALSE | |
65 } | |
66 | |
67 void MemoryViewerAddressSize::OnOk() | |
68 { | |
69 CString buffer; | |
70 | |
71 m_address.GetWindowText(buffer); | |
72 if (buffer.IsEmpty()) | |
73 { | |
74 m_address.SetFocus(); | |
75 return; | |
76 } | |
77 sscanf(buffer, "%x", &address); | |
78 | |
79 m_size.GetWindowText(buffer); | |
80 if (buffer.IsEmpty()) | |
81 { | |
82 m_size.SetFocus(); | |
83 return; | |
84 } | |
85 sscanf(buffer, "%x", &size); | |
86 EndDialog(TRUE); | |
87 } | |
88 | |
89 void MemoryViewerAddressSize::OnCancel() | |
90 { | |
91 EndDialog(FALSE); | |
92 } | |
93 | |
94 void MemoryViewerAddressSize::setAddress(u32 a) | |
95 { | |
96 address = a; | |
97 } | |
98 | |
99 void MemoryViewerAddressSize::setSize(int s) | |
100 { | |
101 size = s; | |
102 } | |
103 | |
104 u32 MemoryViewerAddressSize::getAddress() | |
105 { | |
106 return address; | |
107 } | |
108 | |
109 \ | |
110 | |
111 int MemoryViewerAddressSize::getSize() | |
112 { | |
113 return size; | |
114 } | |
115 |