view src/win32/MemoryViewerAddressSize.cpp @ 3:b05d00f19d80

fix some formatting
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:33:11 -0600
parents f9f4f1b99eed
children
line wrap: on
line source
1 // MemoryViewerAddressSize.cpp : implementation file
2 //
4 #include "stdafx.h"
5 #include "resource.h"
6 #include "MemoryViewerAddressSize.h"
8 /////////////////////////////////////////////////////////////////////////////
9 // MemoryViewerAddressSize dialog
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 }
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 }
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()
37 /////////////////////////////////////////////////////////////////////////////
38 // MemoryViewerAddressSize message handlers
40 BOOL MemoryViewerAddressSize::OnInitDialog()
41 {
42 CDialog::OnInitDialog();
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 }
57 if (size == -1 && address != 0xFFFFFFFF)
58 m_size.SetFocus();
60 m_address.LimitText(9);
61 m_size.LimitText(9);
63 return TRUE; // return TRUE unless you set the focus to a control
64 // EXCEPTION: OCX Property Pages should return FALSE
65 }
67 void MemoryViewerAddressSize::OnOk()
68 {
69 CString buffer;
71 m_address.GetWindowText(buffer);
72 if (buffer.IsEmpty())
73 {
74 m_address.SetFocus();
75 return;
76 }
77 sscanf(buffer, "%x", &address);
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 }
89 void MemoryViewerAddressSize::OnCancel()
90 {
91 EndDialog(FALSE);
92 }
94 void MemoryViewerAddressSize::setAddress(u32 a)
95 {
96 address = a;
97 }
99 void MemoryViewerAddressSize::setSize(int s)
100 {
101 size = s;
102 }
104 u32 MemoryViewerAddressSize::getAddress()
105 {
106 return address;
107 }
109 \
111 int MemoryViewerAddressSize::getSize()
112 {
113 return size;
114 }