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