2 * @file PropCompareBinary.cpp
4 * @brief Implementation of PropCompareBinary propertysheet
8 #include "PropCompareBinary.h"
9 #include "WildcardDropList.h"
10 #include "OptionsDef.h"
11 #include "OptionsMgr.h"
12 #include "OptionsPanel.h"
22 explicit Heksedit(CWnd *pwndParent)
24 HMODULE pv = GetModuleHandle(_T("hekseditU.dll"));
26 pv = LoadLibrary(_T("Frhed\\hekseditU.dll"));
29 LangMessageBox(IDS_FRHED_NOTINSTALLED, MB_OK);
32 wnd.Create(_T("heksedit"), nullptr, 0, CRect(), pwndParent, 1);
33 get_interface()->read_ini_data();
34 get_interface()->get_settings()->bSaveIni = true;
42 Heksedit(const Heksedit&) = delete;
44 IHexEditorWindow *get_interface()
46 return reinterpret_cast<IHexEditorWindow *>(::GetWindowLongPtr(wnd.m_hWnd, GWLP_USERDATA));
55 * @param [in] optionsMgr Pointer to COptionsMgr.
57 PropCompareBinary::PropCompareBinary(COptionsMgr *optionsMgr)
58 : OptionsPanel(optionsMgr, PropCompareBinary::IDD)
62 void PropCompareBinary::DoDataExchange(CDataExchange* pDX)
64 CPropertyPage::DoDataExchange(pDX);
65 //{{AFX_DATA_MAP(PropCompareBinary)
66 DDX_Control(pDX, IDC_COMPAREBINARY_PATTERNS, m_comboPatterns);
67 DDX_Text(pDX, IDC_COMPAREBINARY_PATTERNS, m_sFilePatterns);
72 BEGIN_MESSAGE_MAP(PropCompareBinary, OptionsPanel)
73 //{{AFX_MSG_MAP(PropCompareBinary)
74 ON_BN_CLICKED(IDC_COMPAREBINARY_VIEWSETTINGS, OnViewSettings)
75 ON_BN_CLICKED(IDC_COMPAREBINARY_BINARYMODE, OnBinaryMode)
76 ON_BN_CLICKED(IDC_COMPAREBINARY_CHARACTERSET, OnCharacterSet)
77 ON_BN_CLICKED(IDC_COMPARE_DEFAULTS, OnDefaults)
78 ON_CBN_DROPDOWN(IDC_COMPAREBINARY_PATTERNS, OnDropDownPatterns)
79 ON_CBN_CLOSEUP(IDC_COMPAREBINARY_PATTERNS, OnCloseUpPatterns)
84 * @brief Reads options values from storage to UI.
85 * Property sheet calls this before displaying GUI to load values
88 void PropCompareBinary::ReadOptions()
90 m_sFilePatterns = GetOptionsMgr()->GetString(OPT_CMP_BIN_FILEPATTERNS);
94 * @brief Writes options values from UI to storage.
95 * Property sheet calls this after dialog is closed with OK button to
96 * store values in member variables.
98 void PropCompareBinary::WriteOptions()
100 WildcardRemoveDuplicatePatterns(m_sFilePatterns);
101 GetOptionsMgr()->SaveOption(OPT_CMP_BIN_FILEPATTERNS, m_sFilePatterns);
105 * @brief Show Frhed view settings dialog
107 void PropCompareBinary::OnViewSettings()
109 Heksedit heksedit(this);
110 if (heksedit.get_interface())
111 heksedit.get_interface()->CMD_view_settings();
115 * @brief Show Frhed binary mode dialog
117 void PropCompareBinary::OnBinaryMode()
119 Heksedit heksedit(this);
120 if (heksedit.get_interface())
121 heksedit.get_interface()->CMD_binarymode();
125 * @brief Show Frhed characterset dialog
127 void PropCompareBinary::OnCharacterSet()
129 Heksedit heksedit(this);
130 if (heksedit.get_interface())
131 heksedit.get_interface()->CMD_character_set();
135 * @brief Sets options to defaults
137 void PropCompareBinary::OnDefaults()
139 m_sFilePatterns = GetOptionsMgr()->GetDefault<String>(OPT_CMP_BIN_FILEPATTERNS);
144 * @brief Prepares multi-selection drop list
146 void PropCompareBinary::OnDropDownPatterns()
148 String patterns = GetOptionsMgr()->GetDefault<String>(OPT_CMP_BIN_FILEPATTERNS);
149 WildcardDropList::OnDropDown(m_comboPatterns, 6, patterns.c_str());
153 * @brief Finishes drop list multi-selection
155 void PropCompareBinary::OnCloseUpPatterns()
157 WildcardDropList::OnCloseUp(m_comboPatterns);