Mercurial > vba-clojure
diff 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 |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/win32/MemoryViewerAddressSize.cpp Sat Mar 03 10:31:27 2012 -0600 1.3 @@ -0,0 +1,115 @@ 1.4 +// MemoryViewerAddressSize.cpp : implementation file 1.5 +// 1.6 + 1.7 +#include "stdafx.h" 1.8 +#include "resource.h" 1.9 +#include "MemoryViewerAddressSize.h" 1.10 + 1.11 +///////////////////////////////////////////////////////////////////////////// 1.12 +// MemoryViewerAddressSize dialog 1.13 + 1.14 +MemoryViewerAddressSize::MemoryViewerAddressSize(u32 a, int s, CWnd*pParent /*=NULL*/) 1.15 + : CDialog(MemoryViewerAddressSize::IDD, pParent) 1.16 +{ 1.17 + //{{AFX_DATA_INIT(MemoryViewerAddressSize) 1.18 + // NOTE: the ClassWizard will add member initialization here 1.19 + //}}AFX_DATA_INIT 1.20 + address = a; 1.21 + size = s; 1.22 +} 1.23 + 1.24 +void MemoryViewerAddressSize::DoDataExchange(CDataExchange*pDX) 1.25 +{ 1.26 + CDialog::DoDataExchange(pDX); 1.27 + //{{AFX_DATA_MAP(MemoryViewerAddressSize) 1.28 + DDX_Control(pDX, IDC_SIZE_CONTROL, m_size); 1.29 + DDX_Control(pDX, IDC_ADDRESS, m_address); 1.30 + //}}AFX_DATA_MAP 1.31 +} 1.32 + 1.33 +BEGIN_MESSAGE_MAP(MemoryViewerAddressSize, CDialog) 1.34 +//{{AFX_MSG_MAP(MemoryViewerAddressSize) 1.35 +ON_BN_CLICKED(ID_OK, OnOk) 1.36 +ON_BN_CLICKED(ID_CANCEL, OnCancel) 1.37 +//}}AFX_MSG_MAP 1.38 +END_MESSAGE_MAP() 1.39 + 1.40 +///////////////////////////////////////////////////////////////////////////// 1.41 +// MemoryViewerAddressSize message handlers 1.42 + 1.43 +BOOL MemoryViewerAddressSize::OnInitDialog() 1.44 +{ 1.45 + CDialog::OnInitDialog(); 1.46 + 1.47 + CString buffer; 1.48 + if (address != 0xFFFFFFFF) 1.49 + { 1.50 + buffer.Format("%08X", address); 1.51 + m_address.SetWindowText(buffer); 1.52 + } 1.53 + if (size != -1) 1.54 + { 1.55 + buffer.Format("%08X", size); 1.56 + m_size.SetWindowText(buffer); 1.57 + m_size.EnableWindow(FALSE); 1.58 + } 1.59 + 1.60 + if (size == -1 && address != 0xFFFFFFFF) 1.61 + m_size.SetFocus(); 1.62 + 1.63 + m_address.LimitText(9); 1.64 + m_size.LimitText(9); 1.65 + 1.66 + return TRUE; // return TRUE unless you set the focus to a control 1.67 + // EXCEPTION: OCX Property Pages should return FALSE 1.68 +} 1.69 + 1.70 +void MemoryViewerAddressSize::OnOk() 1.71 +{ 1.72 + CString buffer; 1.73 + 1.74 + m_address.GetWindowText(buffer); 1.75 + if (buffer.IsEmpty()) 1.76 + { 1.77 + m_address.SetFocus(); 1.78 + return; 1.79 + } 1.80 + sscanf(buffer, "%x", &address); 1.81 + 1.82 + m_size.GetWindowText(buffer); 1.83 + if (buffer.IsEmpty()) 1.84 + { 1.85 + m_size.SetFocus(); 1.86 + return; 1.87 + } 1.88 + sscanf(buffer, "%x", &size); 1.89 + EndDialog(TRUE); 1.90 +} 1.91 + 1.92 +void MemoryViewerAddressSize::OnCancel() 1.93 +{ 1.94 + EndDialog(FALSE); 1.95 +} 1.96 + 1.97 +void MemoryViewerAddressSize::setAddress(u32 a) 1.98 +{ 1.99 + address = a; 1.100 +} 1.101 + 1.102 +void MemoryViewerAddressSize::setSize(int s) 1.103 +{ 1.104 + size = s; 1.105 +} 1.106 + 1.107 +u32 MemoryViewerAddressSize::getAddress() 1.108 +{ 1.109 + return address; 1.110 +} 1.111 + 1.112 +\ 1.113 + 1.114 +int MemoryViewerAddressSize::getSize() 1.115 +{ 1.116 + return size; 1.117 +} 1.118 +