root/trunk/StoreRegister.cpp

Revision 5, 2.2 kB (checked in by qbert, 6 years ago)

Initial ( and last :( ) commit

Line 
1 // StoreRegister.cpp : implementation file
2 //
3
4 #include "stdafx.h"
5 #include "Elephant.h"
6 #include "StoreRegister.h"
7
8 #ifdef _DEBUG
9 #define new DEBUG_NEW
10 #undef THIS_FILE
11 static char THIS_FILE[] = __FILE__;
12 #endif
13
14 /////////////////////////////////////////////////////////////////////////////
15 // CStoreRegister dialog
16
17
18 CStoreRegister::CStoreRegister(CWnd* pParent /*=NULL*/, int type)
19     : CXTResizeDialog(CStoreRegister::IDD, pParent)
20 {
21     m_registerType = "register_";
22     m_registerType += ITOA(type);
23     //{{AFX_DATA_INIT(CStoreRegister)
24     m_csText = WhiteSpace::ReplaceCodesWithWhite(Globals::settings->baseSettings->GetCache(m_registerType) ).c_str() ;
25     //}}AFX_DATA_INIT
26 }
27
28
29 void CStoreRegister::DoDataExchange(CDataExchange* pDX)
30 {
31     CXTResizeDialog::DoDataExchange(pDX);
32     //{{AFX_DATA_MAP(CStoreRegister)
33     DDX_Control(pDX, IDC_EDIT1, m_text);
34     DDX_Control(pDX, IDC_BUTTON2, m_cancel);
35     DDX_Control(pDX, IDC_BUTTON1, m_save);
36     DDX_Text(pDX, IDC_EDIT1, m_csText);
37     //}}AFX_DATA_MAP
38 }
39
40
41 BEGIN_MESSAGE_MAP(CStoreRegister, CXTResizeDialog)
42     //{{AFX_MSG_MAP(CStoreRegister)
43     ON_BN_CLICKED(IDC_BUTTON1, OnSave)
44     ON_BN_CLICKED(IDC_BUTTON2, OnCancel)
45     ON_WM_DESTROY()
46     //}}AFX_MSG_MAP
47 END_MESSAGE_MAP()
48
49 /////////////////////////////////////////////////////////////////////////////
50 // CStoreRegister message handlers
51
52 BOOL CStoreRegister::OnInitDialog()
53 {
54     CXTResizeDialog::OnInitDialog();
55    
56     SetupButton(&m_save);
57     SetupButton(&m_cancel);
58    
59    
60     SetResize(IDC_BUTTON1 ,SZ_BOTTOM_RIGHT,SZ_BOTTOM_RIGHT);
61     SetResize(IDC_BUTTON2 ,SZ_BOTTOM_LEFT,SZ_BOTTOM_LEFT);
62     SetResize(IDC_EDIT1 ,SZ_TOP_LEFT,SZ_BOTTOM_RIGHT);
63    
64     LoadPlacement("CStoreRegister");
65
66     return TRUE;  // return TRUE unless you set the focus to a control
67                   // EXCEPTION: OCX Property Pages should return FALSE
68 }
69
70 void CStoreRegister::OnCancel()
71 {
72     EndDialog(0)    ;
73 }
74
75 void CStoreRegister::OnSave()
76 {
77     UpdateData()    ;
78     Globals::settings->baseSettings->SetCache(m_registerType,WhiteSpace::ReplaceWithCodes(m_csText.GetBuffer(0)) );
79
80     EndDialog(1);
81 }
82
83 void CStoreRegister::OnDestroy()
84 {
85     CXTResizeDialog::OnDestroy();
86    
87     SavePlacement("CStoreRegister");
88    
89 }
Note: See TracBrowser for help on using the browser.