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 CComboBox * combo = (CComboBox*) GetDlgItem(IDC_COMPAREIMAGE_OCR_RESULT_TYPE);
81 combo->AddString(_("Text only").c_str());
82 combo->AddString(_("Line-by-line position and text").c_str());
83 combo->AddString(_("Word-by-word position and text").c_str());
84 combo->SetCurSel(m_nOcrResultType);
86 OptionsPanel::OnInitDialog();
87 return TRUE; // return TRUE unless you set the focus to a control
91 * @brief Sets options to defaults
93 void PropCompareImage::OnDefaults()
95 m_sFilePatterns = GetOptionsMgr()->GetDefault<String>(OPT_CMP_IMG_FILEPATTERNS);
100 * @brief Prepares multi-selection drop list
102 void PropCompareImage::OnDropDownPatterns()
104 String patterns = GetOptionsMgr()->GetDefault<String>(OPT_CMP_IMG_FILEPATTERNS)
106 + _T(";*.pdf;*.svg;*.wmf;*.emf");
108 + _T(";*.wmf;*.emf");
110 WildcardDropList::OnDropDown(m_comboPatterns, 6, patterns.c_str());
114 * @brief Finishes drop list multi-selection
116 void PropCompareImage::OnCloseUpPatterns()
118 WildcardDropList::OnCloseUp(m_comboPatterns);