2 * @file PropCompareImage.cpp
4 * @brief Implementation of PropCompareImage propertysheet
8 #include "PropCompareImage.h"
9 #include "WildcardDropList.h"
10 #include "OptionsDef.h"
11 #include "OptionsMgr.h"
12 #include "OptionsPanel.h"
20 * @param [in] optionsMgr Pointer to COptionsMgr.
22 PropCompareImage::PropCompareImage(COptionsMgr *optionsMgr)
23 : OptionsPanel(optionsMgr, PropCompareImage::IDD)
24 , m_bEnableImageCompare(false)
29 void PropCompareImage::DoDataExchange(CDataExchange* pDX)
31 CPropertyPage::DoDataExchange(pDX);
32 //{{AFX_DATA_MAP(PropCompareImage)
33 DDX_Control(pDX, IDC_COMPAREIMAGE_PATTERNS, m_comboPatterns);
34 DDX_Text(pDX, IDC_COMPAREIMAGE_PATTERNS, m_sFilePatterns);
35 DDX_Check(pDX, IDC_ENABLE_IMGCMP_IN_DIRCMP, m_bEnableImageCompare);
36 DDX_CBIndex(pDX, IDC_COMPAREIMAGE_OCR_RESULT_TYPE, m_nOcrResultType);
41 BEGIN_MESSAGE_MAP(PropCompareImage, OptionsPanel)
42 //{{AFX_MSG_MAP(PropCompareImage)
43 ON_BN_CLICKED(IDC_COMPARE_DEFAULTS, OnDefaults)
44 ON_CBN_DROPDOWN(IDC_COMPAREIMAGE_PATTERNS, OnDropDownPatterns)
45 ON_CBN_CLOSEUP(IDC_COMPAREIMAGE_PATTERNS, OnCloseUpPatterns)
50 * @brief Reads options values from storage to UI.
51 * Property sheet calls this before displaying GUI to load values
54 void PropCompareImage::ReadOptions()
56 m_sFilePatterns = GetOptionsMgr()->GetString(OPT_CMP_IMG_FILEPATTERNS);
57 m_bEnableImageCompare = GetOptionsMgr()->GetBool(OPT_CMP_ENABLE_IMGCMP_IN_DIRCMP);
58 m_nOcrResultType = GetOptionsMgr()->GetInt(OPT_CMP_IMG_OCR_RESULT_TYPE);
62 * @brief Writes options values from UI to storage.
63 * Property sheet calls this after dialog is closed with OK button to
64 * store values in member variables.
66 void PropCompareImage::WriteOptions()
68 WildcardRemoveDuplicatePatterns(m_sFilePatterns);
69 GetOptionsMgr()->SaveOption(OPT_CMP_IMG_FILEPATTERNS, m_sFilePatterns);
70 GetOptionsMgr()->SaveOption(OPT_CMP_ENABLE_IMGCMP_IN_DIRCMP, m_bEnableImageCompare);
71 GetOptionsMgr()->SaveOption(OPT_CMP_IMG_OCR_RESULT_TYPE, m_nOcrResultType);
75 * @brief Called before propertysheet is drawn.
77 BOOL PropCompareImage::OnInitDialog()
79 SetDlgItemComboBoxList(IDC_COMPAREIMAGE_OCR_RESULT_TYPE,
80 { _("Text only"), _("Line-by-line position and text"), _("Word-by-word position and text") });
82 OptionsPanel::OnInitDialog();
83 return TRUE; // return TRUE unless you set the focus to a control
87 * @brief Sets options to defaults
89 void PropCompareImage::OnDefaults()
91 m_sFilePatterns = GetOptionsMgr()->GetDefault<String>(OPT_CMP_IMG_FILEPATTERNS);
96 * @brief Prepares multi-selection drop list
98 void PropCompareImage::OnDropDownPatterns()
100 String patterns = GetOptionsMgr()->GetDefault<String>(OPT_CMP_IMG_FILEPATTERNS)
102 + _T(";*.pdf;*.svg;*.wmf;*.emf");
104 + _T(";*.wmf;*.emf");
106 WildcardDropList::OnDropDown(m_comboPatterns, 6, patterns.c_str());
110 * @brief Finishes drop list multi-selection
112 void PropCompareImage::OnCloseUpPatterns()
114 WildcardDropList::OnCloseUp(m_comboPatterns);