2 * @file PropCompareTable.cpp
4 * @brief Implementation of PropCompareTable propertysheet
8 #include "PropCompareTable.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 PropCompareTable::PropCompareTable(COptionsMgr *optionsMgr)
23 : OptionsPanel(optionsMgr, PropCompareTable::IDD)
24 , m_bAllowNewlinesInQuotes(true)
25 , m_sDSVDelimiterChar(_T(";"))
26 , m_sQuoteChar(_T("\""))
30 void PropCompareTable::DoDataExchange(CDataExchange* pDX)
32 CPropertyPage::DoDataExchange(pDX);
33 //{{AFX_DATA_MAP(PropCompareTable)
34 DDX_Control(pDX, IDC_COMPARETABLE_CSV_PATTERNS, m_comboCSVPatterns);
35 DDX_Text(pDX, IDC_COMPARETABLE_CSV_PATTERNS, m_sCSVFilePatterns);
36 DDX_Control(pDX, IDC_COMPARETABLE_TSV_PATTERNS, m_comboTSVPatterns);
37 DDX_Text(pDX, IDC_COMPARETABLE_TSV_PATTERNS, m_sTSVFilePatterns);
38 DDX_Control(pDX, IDC_COMPARETABLE_DSV_PATTERNS, m_comboDSVPatterns);
39 DDX_Text(pDX, IDC_COMPARETABLE_DSV_PATTERNS, m_sDSVFilePatterns);
40 DDX_Text(pDX, IDC_COMPARETABLE_DSV_DELIM_CHAR, m_sDSVDelimiterChar);
41 DDX_Check(pDX, IDC_COMPARETABLE_ALLOWNEWLINE, m_bAllowNewlinesInQuotes);
42 DDX_Text(pDX, IDC_COMPARETABLE_QUOTE_CHAR, m_sQuoteChar);
47 BEGIN_MESSAGE_MAP(PropCompareTable, OptionsPanel)
48 //{{AFX_MSG_MAP(PropCompareTable)
49 ON_BN_CLICKED(IDC_COMPARE_DEFAULTS, OnDefaults)
50 ON_CBN_DROPDOWN(IDC_COMPARETABLE_CSV_PATTERNS, OnDropDownCSVPatterns)
51 ON_CBN_CLOSEUP(IDC_COMPARETABLE_CSV_PATTERNS, OnCloseUpCSVPatterns)
52 ON_CBN_DROPDOWN(IDC_COMPARETABLE_TSV_PATTERNS, OnDropDownTSVPatterns)
53 ON_CBN_CLOSEUP(IDC_COMPARETABLE_TSV_PATTERNS, OnCloseUpTSVPatterns)
54 ON_CBN_DROPDOWN(IDC_COMPARETABLE_DSV_PATTERNS, OnDropDownDSVPatterns)
55 ON_CBN_CLOSEUP(IDC_COMPARETABLE_DSV_PATTERNS, OnCloseUpDSVPatterns)
60 * @brief Reads options values from storage to UI.
61 * Property sheet calls this before displaying GUI to load values
64 void PropCompareTable::ReadOptions()
66 m_sCSVFilePatterns = GetOptionsMgr()->GetString(OPT_CMP_CSV_FILEPATTERNS);
67 m_sTSVFilePatterns = GetOptionsMgr()->GetString(OPT_CMP_TSV_FILEPATTERNS);
68 m_sDSVFilePatterns = GetOptionsMgr()->GetString(OPT_CMP_DSV_FILEPATTERNS);
69 m_sDSVDelimiterChar = GetOptionsMgr()->GetString(OPT_CMP_DSV_DELIM_CHAR).substr(0, 1);
70 m_bAllowNewlinesInQuotes = GetOptionsMgr()->GetBool(OPT_CMP_TBL_ALLOW_NEWLINES_IN_QUOTES);
71 m_sQuoteChar = GetOptionsMgr()->GetString(OPT_CMP_TBL_QUOTE_CHAR).substr(0, 1);
75 * @brief Writes options values from UI to storage.
76 * Property sheet calls this after dialog is closed with OK button to
77 * store values in member variables.
79 void PropCompareTable::WriteOptions()
81 WildcardRemoveDuplicatePatterns(m_sCSVFilePatterns);
82 GetOptionsMgr()->SaveOption(OPT_CMP_CSV_FILEPATTERNS, m_sCSVFilePatterns);
83 WildcardRemoveDuplicatePatterns(m_sTSVFilePatterns);
84 GetOptionsMgr()->SaveOption(OPT_CMP_TSV_FILEPATTERNS, m_sTSVFilePatterns);
85 WildcardRemoveDuplicatePatterns(m_sDSVFilePatterns);
86 GetOptionsMgr()->SaveOption(OPT_CMP_DSV_FILEPATTERNS, m_sDSVFilePatterns);
87 GetOptionsMgr()->SaveOption(OPT_CMP_DSV_DELIM_CHAR, m_sDSVDelimiterChar.substr(0, 1));
88 GetOptionsMgr()->SaveOption(OPT_CMP_TBL_ALLOW_NEWLINES_IN_QUOTES, m_bAllowNewlinesInQuotes);
89 GetOptionsMgr()->SaveOption(OPT_CMP_TBL_QUOTE_CHAR, m_sQuoteChar.substr(0, 1));
93 * @brief Sets options to defaults
95 void PropCompareTable::OnDefaults()
97 m_sCSVFilePatterns = GetOptionsMgr()->GetDefault<String>(OPT_CMP_CSV_FILEPATTERNS);
98 m_sTSVFilePatterns = GetOptionsMgr()->GetDefault<String>(OPT_CMP_TSV_FILEPATTERNS);
99 m_sDSVFilePatterns = GetOptionsMgr()->GetDefault<String>(OPT_CMP_DSV_FILEPATTERNS);
100 m_sDSVDelimiterChar = GetOptionsMgr()->GetDefault<String>(OPT_CMP_DSV_DELIM_CHAR);
101 m_bAllowNewlinesInQuotes = GetOptionsMgr()->GetDefault<bool>(OPT_CMP_TBL_ALLOW_NEWLINES_IN_QUOTES);
102 m_sQuoteChar = GetOptionsMgr()->GetDefault<String>(OPT_CMP_TBL_QUOTE_CHAR);
107 * @brief Prepares multi-selection drop list
109 void PropCompareTable::OnDropDownCSVPatterns()
111 String patterns = GetOptionsMgr()->GetDefault<String>(OPT_CMP_CSV_FILEPATTERNS);
112 WildcardDropList::OnDropDown(m_comboCSVPatterns, 6, patterns.c_str());
116 * @brief Finishes drop list multi-selection
118 void PropCompareTable::OnCloseUpCSVPatterns()
120 WildcardDropList::OnCloseUp(m_comboCSVPatterns);
124 * @brief Prepares multi-selection drop list
126 void PropCompareTable::OnDropDownTSVPatterns()
128 String patterns = GetOptionsMgr()->GetDefault<String>(OPT_CMP_TSV_FILEPATTERNS);
129 WildcardDropList::OnDropDown(m_comboTSVPatterns, 6, patterns.c_str());
133 * @brief Finishes drop list multi-selection
135 void PropCompareTable::OnCloseUpTSVPatterns()
137 WildcardDropList::OnCloseUp(m_comboTSVPatterns);
141 * @brief Prepares multi-selection drop list
143 void PropCompareTable::OnDropDownDSVPatterns()
145 String patterns = GetOptionsMgr()->GetDefault<String>(OPT_CMP_DSV_FILEPATTERNS);
146 WildcardDropList::OnDropDown(m_comboDSVPatterns, 6, patterns.c_str());
150 * @brief Finishes drop list multi-selection
152 void PropCompareTable::OnCloseUpDSVPatterns()
154 WildcardDropList::OnCloseUp(m_comboDSVPatterns);