-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfiguration_dialog.h
More file actions
275 lines (210 loc) · 10.7 KB
/
Copy pathconfiguration_dialog.h
File metadata and controls
275 lines (210 loc) · 10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
#pragma once
#include "resource.h"
#include "libPPUI/CDialogResizeHelper.h"
#include "helpers/DarkMode.h"
#include "header_static.h"
#include "guids_discogger.h"
#include "foo_discogs.h"
#include "my_tabentry.h"
#define NUM_TABS 8
#define CONF_FIND_RELEASE_TAB 0
#define CONF_FIND_ADV_RELEASE_TAB 1
#define CONF_MATCHING_TAB 2
#define CONF_TAGGING_TAB 3
#define CONF_CACHING_TAB 4
#define CONF_ART_TAB 5
#define CONF_UI_TAB 6
#define CONF_OATH_TAB 7
//snapLeft, snapTop, snapRight, snapBottom
const CDialogResizeHelper::Param rz_params[] = {
{IDC_GRP_STATIC_TRK_MATCHING, 0,0,1,0},
{IDC_GRP_STATIC_AUTO_TRK_MATCHING, 0,0,1,0},
{IDC_GRP_STATIC_CFG_WRITE_TAGS, 0,0,1,0},
{IDC_GRP_STATIC_CFG_ARTIST_NAMES, 0,0,1,0},
{IDC_GRP_STATIC_CFG_MULTIVALUES, 0,0,1,0},
{IDC_GRP_STATIC_CFG_CACHE_PARSE, 0,0,1,0},
{IDC_GRP_STATIC_CFG_CACHE_MEM, 0,0,1,0},
{IDC_GRP_STATIC_CFG_CACHE_DISK, 0,0,1,0},
{IDC_GRP_STATIC_CFG_ART_ALBUM, 0,0,1,0},
{IDC_GRP_STATIC_CFG_ART_ARTIST, 0,0,1,0},
{IDC_GRP_STATIC_HISTORY, 0,0,1,0},
{IDC_GRP_STATIC_CFG_OTHER, 0,0,1,0},
{IDC_GRP_STATIC_CFG_OATH_STEP_1, 0,0,1,0},
{IDC_GRP_STATIC_CFG_OATH_STEP_2, 0,0,1,0},
{IDC_GRP_STATIC_CFG_OATH_STEP_3, 0,0,1,0},
};
class NOVTABLE my_threaded_process : public threaded_process {
public:
bool run_modal(service_ptr_t<threaded_process_callback> p_callback, unsigned p_flags, HWND p_parent, const char* p_title, t_size p_title_len) override;
bool run_modeless(service_ptr_t<threaded_process_callback> p_callback, unsigned p_flags, HWND p_parent, const char* p_title, t_size p_title_len) override;
//! Decrements reference count; deletes the object if reference count reaches zero. This is normally not called directly but managed by service_ptr_t<> template. \n
//! Implemented by service_impl_* classes.
//! @returns New reference count. For debug purposes only, in certain conditions return values may be unreliable.
int service_release() throw() override;
//! Increments reference count. This is normally not called directly but managed by service_ptr_t<> template. \n
//! Implemented by service_impl_* classes.
//! @returns New reference count. For debug purposes only, in certain conditions return values may be unreliable.
int service_add_ref() throw() override;
//! Queries whether the object supports specific interface and retrieves a pointer to that interface. This is normally not called directly but managed by service_query_t<> function template. \n
//! Checks the parameter against GUIDs of interfaces supported by this object, if the GUID is one of supported interfaces, p_out is set to service_base pointer that can be static_cast<>'ed to queried interface and the method returns true; otherwise the method returns false. \n
//! Implemented by service_impl_* classes. \n
//! Note that service_query() implementation semantics (but not usage semantics) changed in SDK for foobar2000 1.4; they used to be auto-implemented by each service interface (via FB2K_MAKE_SERVICE_INTERFACE macro); they're now implemented in service_impl_* instead. See SDK readme for more details. \n
bool service_query(service_ptr& p_out, const GUID& p_guid) override;
};
class CConfigurationDialog : public MyCDialogImpl<CConfigurationDialog>, public CMessageFilter, public preferences_page_instance
{
private:
static INT_PTR WINAPI searching_dialog_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR WINAPI on_searching_dialog_message(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR WINAPI searching_adv_dialog_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR WINAPI on_searching_adv_dialog_message(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR WINAPI matching_dialog_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR WINAPI on_matching_dialog_message(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR WINAPI tagging_dialog_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR WINAPI on_tagging_dialog_message(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR WINAPI caching_dialog_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR WINAPI on_caching_dialog_message(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR WINAPI art_dialog_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR WINAPI on_art_dialog_message(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR WINAPI ui_dialog_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR WINAPI on_ui_dialog_message(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static INT_PTR WINAPI oauth_dialog_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR WINAPI on_oauth_dialog_message(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
void init_searching_dialog(HWND wnd, bool subclass);
void init_searching_adv_dialog(HWND wnd, bool subclass);
void init_matching_dialog(HWND wnd, bool subclass);
void init_tagging_dialog(HWND wnd, bool subclass);
void init_memory_cache_buttons(HWND wnd);
void init_caching_dialog(HWND wnd, bool subclass);
void init_art_dialog(HWND wnd, bool subclass);
void init_ui_dialog(HWND wnd, bool subclass);
void init_oauth_dialog(HWND wnd, bool subclass);
void init_current_tab();
bool build_current_cfg(bool reset);
void pushcfg(bool reset);
void save_searching_dialog(HWND wnd, bool dlgbind);
void save_searching_adv_dialog(HWND wnd, bool dlgbind);
void save_matching_dialog(HWND wnd, bool dlgbind);
void save_tagging_dialog(HWND wnd, bool dlgbind/*, bool apply_multivalues*/);
void save_caching_dialog(HWND wnd, bool dlgbind);
void save_art_dialog(HWND wnd, bool dlgbind);
void save_ui_dialog(HWND wnd, bool dlgbind);
void save_oauth_dialog(HWND wnd, bool dlgbind);
bool cfg_searching_has_changed();
bool cfg_searching_adv_has_changed();
bool cfg_matching_has_changed();
bool cfg_tagging_has_changed();
bool cfg_caching_has_changed();
bool cfg_art_has_changed();
bool cfg_ui_has_changed();
bool cfg_oauth_has_changed();
void on_load_search_formatting(HWND wnd);
void on_load_search_adv_formatting(HWND wnd);
void on_load_match_formatting(HWND wnd);
void on_delete_history(HWND wnd, size_t max, bool zap);
void on_test_oauth(HWND wnd);
void on_authorize_oauth(HWND wnd);
void on_generate_oauth(HWND wnd);
bool HasChanged();
void OnChanged();
void OnEditChange(UINT, int, CWindow) { OnChanged(); }
const preferences_page_callback::ptr m_callback;
public:
enum { IDD = IDD_DIALOG_CONF };
t_uint32 get_state();
void apply();
void reset();
virtual BOOL PreTranslateMessage(MSG* pMsg) override {
return ::IsDialogMessage(m_hWnd, pMsg);
}
#pragma warning( push )
#pragma warning( disable : 26454 )
MY_BEGIN_MSG_MAP(CConfigurationDialog)
CHAIN_MSG_MAP_MEMBER(m_resize_helper)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
NOTIFY_HANDLER(IDC_TAB_CFG, TCN_SELCHANGING, OnChangingTab)
NOTIFY_HANDLER(IDC_TAB_CFG, TCN_SELCHANGE, OnChangeTab)
COMMAND_ID_HANDLER(IDC_BTN_CONF_DEFAULTS, OnDefaults)
MESSAGE_HANDLER(WM_CUSTOM_ANV_CHANGED, OnCustomAnvChanged)
#ifdef SIM_VA_MA_BETA
MESSAGE_HANDLER(WM_CUSTOM_VA_AS_MA_RESET, OnCustomMsg_VA_as_MA_Reset)
#endif
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
MY_END_MSG_MAP()
#pragma warning( pop )
// constructor
CConfigurationDialog(preferences_page_callback::ptr callback) : m_callback(callback), m_resize_helper(rz_params) {
m_hwndTokenEdit = nullptr;
m_hwndSecretEdit = nullptr;
m_hwndOAuthMsg = nullptr;
if (g_discogs) {
g_discogs->configuration_dialog = this;
conf = CConf(CONF);
conf_edit = CConf(CONF);
}
}
~CConfigurationDialog();
void InitTabs();
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnChangingTab(WORD /*wNotifyCode*/, LPNMHDR /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnChangeTab(WORD /*wNotifyCode*/, LPNMHDR /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnDefaults(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnCustomAnvChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
#ifdef SIM_VA_MA_BETA
LRESULT OnCustomMsg_VA_as_MA_Reset(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
#endif
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
HWND m_hwndTokenEdit;
HWND m_hwndSecretEdit;
HWND m_hwndOAuthMsg;
void show_tab(unsigned int itab);
void show_oauth_msg(pfc::string8 msg, bool iserror);
void enable(bool v) override {}
private:
my_threaded_process m_tp;
pfc::array_t<tab_entry> tab_table;
foo_conf conf;
foo_conf conf_edit;
bool ori_parsing_merge_titles = false;
bool ori_parsing_merge_subtracks = false;
bool ori_parsing_tracks_dotted_to_header = false;
bool ori_parsing = false;
bool ori_skip_video = false;
bool setting_dlg = false;
bool cancel_dlg = true;
//todo:
CHyperLink m_help_link_search;
CHyperLink m_help_link_search_adv;
CHyperLink m_help_link_matching;
CHyperLink m_help_link_artwork;
fb2k::CDarkModeHooks m_dark;
CDialogResizeHelper m_resize_helper;
HeaderStatic m_staticPrefHeader_Search1; //IDC_GRP_STATIC_SEARCH_1
HeaderStatic m_staticPrefHeader_Search2;
HeaderStatic m_staticPrefHeader_Search3;
HeaderStatic m_staticPrefHeader_SearchAdv1; //IDC_GRP_STATIC_SEARCH_ADV_1
HeaderStatic m_staticPrefHeader_SearchAdv2;
HeaderStatic m_staticPrefHeader_SearchAdv3;
HeaderStatic m_staticPrefHeader_History; //IDC_GRP_STATIC_HISTORY
HeaderStatic m_staticPrefHeader_Other;
HeaderStatic m_staticPrefHeader_Art_Album; //IDC_GRP_STATIC_CFG_ART_ALBUM
HeaderStatic m_staticPrefHeader_Art_Artist;
HeaderStatic m_staticPrefHeader_Oath_S1; //IDC_GRP_STATIC_CFG_OATH_STEP_1
HeaderStatic m_staticPrefHeader_Oath_S2;
HeaderStatic m_staticPrefHeader_Oath_S3;
HeaderStatic m_staticPrefHeader_Cache_Parse; //IDC_GRP_STATIC_CFG_CACHE_PARSE
HeaderStatic m_staticPrefHeader_Cache_Mem; //IDC_GRP_STATIC_CFG_CACHE_MEM
HeaderStatic m_staticPrefHeader_Cache_Disk; //IDC_GRP_STATIC_CFG_CACHE_DISK
HeaderStatic m_staticPrefHeader_Write_Tags; //IDC_GRP_STATIC_CFG_WRITE_TAGS
HeaderStatic m_staticPrefHeader_Artist_Names; //IDC_GRP_STATIC_CFG_ARTIST_NAMES
HeaderStatic m_staticPrefHeader_Multi_Values; //IDC_GRP_STATIC_CFG_MULTIVALUES
HeaderStatic m_staticPrefHeader_Trk_Matching; //IDC_GRP_STATIC_TRK_MATCHING
HeaderStatic m_staticPrefHeader_Trk_Auto_Matching;//IDC_GRP_STATIC_AUTO_TRK_MATCHING
HeaderStatic m_staticPrefHeader_Trk_SB_Matching; //IDC_GRP_STATIC_STATBAR_INFO_TRK_MATCHING
};
class preferences_page_myimpl : public preferences_page_impl<CConfigurationDialog> {
public:
const char* get_name() { return COMPONENT_NAME_HC; }
GUID get_guid() { return guid_pref_page; }
GUID get_parent_guid() { return guid_tagging; }
};