OSDN Git Service

Merge with stable
[winmerge-jp/winmerge-jp.git] / Src / PropCompareImage.cpp
1 /** 
2  * @file  PropCompareImage.cpp
3  *
4  * @brief Implementation of PropCompareImage propertysheet
5  */
6 // ID line follows -- this is updated by SVN
7 // $Id$
8
9 #include "stdafx.h"
10 #include "PropCompareImage.h"
11 #include "Merge.h"
12 #include "OptionsDef.h"
13 #include "OptionsMgr.h"
14 #include "OptionsPanel.h"
15
16 #ifdef _DEBUG
17 #define new DEBUG_NEW
18 #undef THIS_FILE
19 static char THIS_FILE[] = __FILE__;
20 #endif
21
22 /** 
23  * @brief Constructor.
24  * @param [in] optionsMgr Pointer to COptionsMgr.
25  */
26 PropCompareImage::PropCompareImage(COptionsMgr *optionsMgr) 
27  : OptionsPanel(optionsMgr, PropCompareImage::IDD)
28 {
29 }
30
31 void PropCompareImage::DoDataExchange(CDataExchange* pDX)
32 {
33         CPropertyPage::DoDataExchange(pDX);
34         //{{AFX_DATA_MAP(PropCompareImage)
35         DDX_Text(pDX, IDC_COMPAREIMAGE_PATTERNS, m_sFilePatterns);
36         //}}AFX_DATA_MAP
37 }
38
39
40 BEGIN_MESSAGE_MAP(PropCompareImage, CPropertyPage)
41         //{{AFX_MSG_MAP(PropCompareImage)
42         ON_BN_CLICKED(IDC_COMPAREIMAGE_DEFAULTS, OnDefaults)
43         //}}AFX_MSG_MAP
44 END_MESSAGE_MAP()
45
46 /** 
47  * @brief Reads options values from storage to UI.
48  * Property sheet calls this before displaying GUI to load values
49  * into members.
50  */
51 void PropCompareImage::ReadOptions()
52 {
53         m_sFilePatterns = GetOptionsMgr()->GetString(OPT_CMP_IMG_FILEPATTERNS).c_str();
54 }
55
56 /** 
57  * @brief Writes options values from UI to storage.
58  * Property sheet calls this after dialog is closed with OK button to
59  * store values in member variables.
60  */
61 void PropCompareImage::WriteOptions()
62 {
63         GetOptionsMgr()->SaveOption(OPT_CMP_IMG_FILEPATTERNS, m_sFilePatterns);
64 }
65
66 /** 
67  * @brief Called before propertysheet is drawn.
68  */
69 BOOL PropCompareImage::OnInitDialog() 
70 {
71         theApp.TranslateDialog(m_hWnd);
72         CPropertyPage::OnInitDialog();
73
74         return TRUE;  // return TRUE unless you set the focus to a control
75                       // EXCEPTION: OCX Property Pages should return FALSE
76 }
77
78 /** 
79  * @brief Sets options to defaults
80  */
81 void PropCompareImage::OnDefaults()
82 {
83         String tmp;
84         GetOptionsMgr()->GetDefault(OPT_CMP_IMG_FILEPATTERNS, tmp);
85         m_sFilePatterns = tmp.c_str();
86         UpdateData(FALSE);
87 }