diff options
author | George Hazan <ghazan@miranda.im> | 2016-10-28 16:18:50 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2016-10-28 16:18:50 +0300 |
commit | cf9de21af3073e29cb7b149fbd8427241de70729 (patch) | |
tree | 2a0b17f49d14d4a51bc942f15bf3747509f0c3cf /src | |
parent | 3de431cc811a1fbf9cd0d520fe33b6163c73e919 (diff) |
- old useless helpers removed from the Options module;
- mir_app functions introduced instead of them;
- OPENOPTIONSDIALOG structure removed from m_options.h
Diffstat (limited to 'src')
28 files changed, 165 insertions, 184 deletions
diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp index 982820b259..e5a2742d6c 100644 --- a/src/core/stdaway/src/sendmsg.cpp +++ b/src/core/stdaway/src/sendmsg.cpp @@ -526,8 +526,8 @@ static int AwayMsgOptInitialise(WPARAM wParam, LPARAM) odp.position = 870000000;
odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AWAYMSG);
- odp.pszTitle = LPGEN("Status messages");
- odp.pszGroup = LPGEN("Status");
+ odp.szTitle.a = LPGEN("Status messages");
+ odp.szGroup.a = LPGEN("Status");
odp.pfnDlgProc = DlgProcAwayMsgOpts;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index 0635bd0b54..331602ee95 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -735,25 +735,25 @@ int OptionsInitialize(WPARAM wParam, LPARAM) odp.position = 910000000;
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS1);
- odp.pszGroup = LPGEN("Message sessions");
- odp.pszTitle = LPGEN("Group chats");
- odp.pszTab = LPGEN("General");
+ odp.szGroup.a = LPGEN("Message sessions");
+ odp.szTitle.a = LPGEN("Group chats");
+ odp.szTab.a = LPGEN("General");
odp.pfnDlgProc = DlgProcOptions1;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
odp.position = 910000001;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS2);
- odp.pszTab = LPGEN("Chat log");
+ odp.szTab.a = LPGEN("Chat log");
odp.pfnDlgProc = DlgProcOptions2;
Options_AddPage(wParam, &odp);
if (PopupInstalled) {
odp.position = 910000002;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSPOPUP);
- odp.pszTitle = LPGEN(CHAT_MODULE);
- odp.pszGroup = LPGEN("Popups");
- odp.pszTab = NULL;
+ odp.szTitle.a = LPGEN(CHAT_MODULE);
+ odp.szGroup.a = LPGEN("Popups");
+ odp.szTab.a = NULL;
odp.pfnDlgProc = DlgProcOptionsPopup;
Options_AddPage(wParam, &odp);
}
diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp index d0c625c2c7..aa1186d684 100644 --- a/src/core/stdclist/src/clcopts.cpp +++ b/src/core/stdclist/src/clcopts.cpp @@ -429,15 +429,15 @@ int ClcOptInit(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = g_hInst;
- odp.pszGroup = LPGEN("Contact list");
+ odp.szGroup.a = LPGEN("Contact list");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLC);
- odp.pszTitle = LPGEN("List");
+ odp.szTitle.a = LPGEN("List");
odp.pfnDlgProc = DlgProcClcMainOpts;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLCBKG);
- odp.pszTitle = LPGEN("List background");
+ odp.szTitle.a = LPGEN("List background");
odp.pfnDlgProc = DlgProcClcBkgOpts;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
diff --git a/src/core/stdclist/src/clistopts.cpp b/src/core/stdclist/src/clistopts.cpp index c0cd03b652..3cb99c8a2b 100644 --- a/src/core/stdclist/src/clistopts.cpp +++ b/src/core/stdclist/src/clistopts.cpp @@ -202,7 +202,7 @@ int CListOptInit(WPARAM wParam, LPARAM) odp.position = -1000000000;
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLIST);
- odp.pszTitle = LPGEN("Contact list");
+ odp.szTitle.a = LPGEN("Contact list");
odp.pfnDlgProc = DlgProcGenOpts;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
diff --git a/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp index d911261f71..0c27835461 100644 --- a/src/core/stdclist/src/cluiopts.cpp +++ b/src/core/stdclist/src/cluiopts.cpp @@ -318,14 +318,14 @@ int CluiOptInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLUI);
- odp.pszTitle = LPGEN("Window");
- odp.pszGroup = LPGEN("Contact list");
+ odp.szTitle.a = LPGEN("Window");
+ odp.szGroup.a = LPGEN("Contact list");
odp.pfnDlgProc = DlgProcCluiOpts;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SBAR);
- odp.pszTitle = LPGEN("Status bar");
+ odp.szTitle.a = LPGEN("Status bar");
odp.pfnDlgProc = DlgProcSBarOpts;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp index 0a021853a4..8f7effdd2c 100644 --- a/src/core/stdfile/src/fileopts.cpp +++ b/src/core/stdfile/src/fileopts.cpp @@ -228,8 +228,8 @@ int FileOptInitialise(WPARAM wParam, LPARAM) odp.position = 900000000;
odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FILETRANSFER);
- odp.pszTitle = LPGEN("File transfers");
- odp.pszGroup = LPGEN("Events");
+ odp.szTitle.a = LPGEN("File transfers");
+ odp.szGroup.a = LPGEN("Events");
odp.pfnDlgProc = DlgProcFileOpts;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
diff --git a/src/core/stdidle/src/idle.cpp b/src/core/stdidle/src/idle.cpp index f2a62e0d1a..7221c0d9a0 100644 --- a/src/core/stdidle/src/idle.cpp +++ b/src/core/stdidle/src/idle.cpp @@ -346,8 +346,8 @@ static int IdleOptInit(WPARAM wParam, LPARAM) odp.position = 100000000;
odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_IDLE);
- odp.pszGroup = LPGEN("Status");
- odp.pszTitle = LPGEN("Idle");
+ odp.szGroup.a = LPGEN("Status");
+ odp.szTitle.a = LPGEN("Idle");
odp.pfnDlgProc = IdleOptsDlgProc;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 0c59ddabaa..d82cdb6b76 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -546,19 +546,19 @@ static int OptInitialise(WPARAM wParam, LPARAM) odp.position = 910000000;
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGDLG);
- odp.pszTab = LPGEN("Messaging");
- odp.pszTitle = LPGEN("Message sessions");
+ odp.szTab.a = LPGEN("Messaging");
+ odp.szTitle.a = LPGEN("Message sessions");
odp.pfnDlgProc = DlgProcOptions;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGLOG);
- odp.pszTab = LPGEN("Messaging log");
+ odp.szTab.a = LPGEN("Messaging log");
odp.pfnDlgProc = DlgProcLogOptions;
Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGTYPE);
- odp.pszTab = LPGEN("Typing notify");
+ odp.szTab.a = LPGEN("Typing notify");
odp.pfnDlgProc = DlgProcTypeOptions;
Options_AddPage(wParam, &odp);
return 0;
diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp index fd3ae677bc..ca21c9d3ee 100644 --- a/src/core/stduserinfo/src/stdinfo.cpp +++ b/src/core/stduserinfo/src/stdinfo.cpp @@ -610,37 +610,37 @@ int DetailsInit(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = SummaryDlgProc;
odp.position = -2100000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_SUMMARY);
- odp.pszTitle = LPGEN("Summary");
+ odp.szTitle.a = LPGEN("Summary");
UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = ContactDlgProc;
odp.position = -1800000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_CONTACT);
- odp.pszTitle = LPGEN("Contact");
+ odp.szTitle.a = LPGEN("Contact");
UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = LocationDlgProc;
odp.position = -1500000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_LOCATION);
- odp.pszTitle = LPGEN("Location");
+ odp.szTitle.a = LPGEN("Location");
UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = WorkDlgProc;
odp.position = -1200000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_WORK);
- odp.pszTitle = LPGEN("Work");
+ odp.szTitle.a = LPGEN("Work");
UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = BackgroundDlgProc;
odp.position = -900000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_BACKGROUND);
- odp.pszTitle = LPGEN("Background info");
+ odp.szTitle.a = LPGEN("Background info");
UserInfo_AddPage(wParam, &odp);
odp.pfnDlgProc = NotesDlgProc;
odp.position = 0;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_NOTES);
- odp.pszTitle = LPGEN("Notes");
+ odp.szTitle.a = LPGEN("Notes");
UserInfo_AddPage(wParam, &odp);
return 0;
}
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 82ce214f67..04bd08fba3 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -66,12 +66,12 @@ struct DetailsData wchar_t* getTitle(OPTIONSDIALOGPAGE *p)
{
- return (p->flags & ODPF_DONTTRANSLATE) ? p->pwszTitle : TranslateW_LP(p->pwszTitle, p->hLangpack);
+ return (p->flags & ODPF_DONTTRANSLATE) ? p->szTitle.w : TranslateW_LP(p->szTitle.w, p->hLangpack);
}
wchar_t* getTab(OPTIONSDIALOGPAGE *p)
{
- return (p->flags & ODPF_DONTTRANSLATE) ? p->pwszTab : TranslateW_LP(p->pwszTab, p->hLangpack);
+ return (p->flags & ODPF_DONTTRANSLATE) ? p->szTab.w : TranslateW_LP(p->szTab.w, p->hLangpack);
}
static int PageSortProc(OPTIONSDIALOGPAGE *item1, OPTIONSDIALOGPAGE *item2)
@@ -121,8 +121,8 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam, LPARAM) CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DETAILS), NULL, DlgProcDetails, (LPARAM)&psh);
for (int i = 0; i < opi.pageCount; i++) {
//cleanup moved to WM_DESTROY
- if (opi.odp[i].pszGroup != NULL)
- mir_free(opi.odp[i].pszGroup);
+ if (opi.odp[i].szGroup.w != NULL)
+ mir_free(opi.odp[i].szGroup.a);
if ((DWORD_PTR)opi.odp[i].pszTemplate & 0xFFFF0000)
mir_free((char*)opi.odp[i].pszTemplate);
}
@@ -147,12 +147,12 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam) dst->pszTemplate = ((DWORD_PTR)odp->pszTemplate & 0xFFFF0000) ? mir_strdup(odp->pszTemplate) : odp->pszTemplate;
if (odp->flags & ODPF_UNICODE) {
- dst->pwszTitle = (odp->pwszTitle == 0) ? NULL : mir_wstrdup(odp->pwszTitle);
- dst->pwszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->pwszTab) ? NULL : mir_wstrdup(odp->pwszTab);
+ dst->szTitle.w = (odp->szTitle.w == 0) ? NULL : mir_wstrdup(odp->szTitle.w);
+ dst->szTab.w = (odp->flags & ODPF_USERINFOTAB) ? mir_wstrdup(odp->szTab.w) : NULL;
}
else {
- dst->pwszTitle = mir_a2u(odp->pszTitle);
- dst->pwszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->pszTab) ? NULL : mir_a2u(odp->pszTab);
+ dst->szTitle.w = mir_a2u(odp->szTitle.a);
+ dst->szTab.w = (odp->flags & ODPF_USERINFOTAB) ? mir_a2u(odp->szTab.a) : NULL;
}
dst->hLangpack = odp->hLangpack;
@@ -289,8 +289,8 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP p.dlgParam = odp[i].dwInitParam;
p.hInst = odp[i].hInstance;
- p.ptszTitle = odp[i].pwszTitle;
- p.ptszTab = odp[i].pwszTab;
+ p.ptszTitle = odp[i].szTitle.w;
+ p.ptszTab = odp[i].szTab.w;
p.hLangpack = odp[i].hLangpack;
if (i && p.ptszTab && !mir_wstrcmp(dat->opd[i - 1].ptszTitle, p.ptszTitle)) {
diff --git a/src/mir_app/src/FontOptions.cpp b/src/mir_app/src/FontOptions.cpp index b415cc284b..5abaf1fb21 100644 --- a/src/mir_app/src/FontOptions.cpp +++ b/src/mir_app/src/FontOptions.cpp @@ -1190,8 +1190,8 @@ int OptInit(WPARAM wParam, LPARAM) odp.position = -790000000;
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FONTS);
- odp.pszTitle = LPGEN("Fonts and colors");
- odp.pszGroup = LPGEN("Customize");
+ odp.szTitle.a = LPGEN("Fonts and colors");
+ odp.szGroup.a = LPGEN("Customize");
odp.flags = ODPF_BOLDGROUPS;
odp.pfnDlgProc = DlgProcLogOptions;
Options_AddPage(wParam, &odp);
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp index ced2f8ab5a..60200591ea 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/contacts.cpp @@ -341,8 +341,8 @@ static int ContactOptInit(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -1000000000;
- odp.pszGroup = LPGEN("Contact list");
- odp.pszTitle = LPGEN("Contact names");
+ odp.szGroup.a = LPGEN("Contact list");
+ odp.szTitle.a = LPGEN("Contact names");
odp.pDialog = new CContactOptsDlg();
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
diff --git a/src/mir_app/src/hotkey_opts.cpp b/src/mir_app/src/hotkey_opts.cpp index d85da9566e..4fa0855bc9 100644 --- a/src/mir_app/src/hotkey_opts.cpp +++ b/src/mir_app/src/hotkey_opts.cpp @@ -1037,8 +1037,8 @@ int HotkeyOptionsInit(WPARAM wParam, LPARAM) odp.flags = ODPF_BOLDGROUPS; odp.position = -180000000; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_HOTKEYS); - odp.pszTitle = LPGEN("Hotkeys"); - odp.pszGroup = LPGEN("Customize"); + odp.szTitle.a = LPGEN("Hotkeys"); + odp.szGroup.a = LPGEN("Customize"); odp.pfnDlgProc = sttOptionsDlgProc; Options_AddPage(wParam, &odp); return 0; diff --git a/src/mir_app/src/ignore.cpp b/src/mir_app/src/ignore.cpp index 3a5baf7905..186d5303e4 100644 --- a/src/mir_app/src/ignore.cpp +++ b/src/mir_app/src/ignore.cpp @@ -329,8 +329,8 @@ static int IgnoreOptInitialise(WPARAM wParam, LPARAM) odp.position = 900000000;
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_IGNORE);
- odp.pszTitle = LPGEN("Ignore");
- odp.pszGroup = LPGEN("Contacts");
+ odp.szTitle.a = LPGEN("Ignore");
+ odp.szGroup.a = LPGEN("Contacts");
odp.pfnDlgProc = DlgProcIgnoreOpts;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp index 0e1efe5794..8dc230808b 100644 --- a/src/mir_app/src/lpopts.cpp +++ b/src/mir_app/src/lpopts.cpp @@ -27,10 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static void CALLBACK OpenOptions(void*)
{
- OPENOPTIONSDIALOG ood = { sizeof(ood) };
- ood.pszGroup = "Customize";
- ood.pszPage = "Languages";
- Options_Open(&ood);
+ Options_Open(L"Customize", L"Languages");
}
static void ReloadOptions(void *hWnd)
@@ -276,8 +273,8 @@ int LangpackOptionsInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = g_hInst;
odp.position = -1300000000;
- odp.pszTitle = LPGEN("Languages");
- odp.pszGroup = LPGEN("Customize");
+ odp.szTitle.a = LPGEN("Languages");
+ odp.szGroup.a = LPGEN("Customize");
odp.flags = ODPF_BOLDGROUPS;
odp.pDialog = new CLangpackDlg();
Options_AddPage(wParam, &odp);
diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp index 7863b338c0..8605a4026a 100644 --- a/src/mir_app/src/menu_options.cpp +++ b/src/mir_app/src/menu_options.cpp @@ -531,8 +531,8 @@ int GenMenuOptInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.position = -1000000000; - odp.pszTitle = LPGEN("Menus"); - odp.pszGroup = LPGEN("Customize"); + odp.szTitle.a = LPGEN("Menus"); + odp.szGroup.a = LPGEN("Customize"); odp.flags = ODPF_BOLDGROUPS; odp.pDialog = new CGenMenuOptionsPage(); Options_AddPage(wParam, &odp); diff --git a/src/mir_app/src/meta_options.cpp b/src/mir_app/src/meta_options.cpp index 2588c7d8c9..6776ff16e2 100644 --- a/src/mir_app/src/meta_options.cpp +++ b/src/mir_app/src/meta_options.cpp @@ -121,8 +121,8 @@ int Meta_OptInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -790000000;
odp.flags = ODPF_BOLDGROUPS;
- odp.pszTitle = LPGEN("Metacontacts");
- odp.pszGroup = LPGEN("Contacts");
+ odp.szTitle.a = LPGEN("Metacontacts");
+ odp.szGroup.a = LPGEN("Contacts");
odp.pDialog = new CMetaOptionsDlg();
Options_AddPage(wParam, &odp);
return 0;
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index fb947113ec..ba2397c37b 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -323,3 +323,6 @@ Font_Get @323 Font_GetW @324
Font_Register @325
Font_RegisterW @326
+Options_AddPage @327
+Options_Open @328
+Options_OpenPage @329
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index e8f7a4bc37..a1084ad408 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -323,3 +323,6 @@ Font_Get @323 Font_GetW @324
Font_Register @325
Font_RegisterW @326
+Options_AddPage @327
+Options_Open @328
+Options_OpenPage @329
diff --git a/src/mir_app/src/netlibopts.cpp b/src/mir_app/src/netlibopts.cpp index aaa22b5887..aa10980a8c 100644 --- a/src/mir_app/src/netlibopts.cpp +++ b/src/mir_app/src/netlibopts.cpp @@ -522,7 +522,7 @@ int NetlibOptInitialise(WPARAM wParam, LPARAM) odp.position = 900000000;
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NETLIB);
- odp.pszTitle = LPGEN("Network");
+ odp.szTitle.a = LPGEN("Network");
odp.pfnDlgProc = DlgProcNetlibOpts;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index 31e4abc14f..18d0d70c63 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -43,10 +43,23 @@ static int FilterPage = 0; static int FilterLoadProgress = 100;
static int FilterTimerId = 0;
-struct OptionsPageInit
+struct OptionsPage : public OPTIONSDIALOGPAGE
{
- int pageCount;
- OPTIONSDIALOGPAGE *odp;
+ ~OptionsPage()
+ {
+ mir_free(szTitle.a);
+ mir_free(szGroup.a);
+ mir_free(szTab.a);
+ if ((DWORD_PTR)pszTemplate & 0xFFFF0000)
+ mir_free((char*)pszTemplate);
+ }
+};
+
+typedef OBJLIST<OptionsPage> OptionsPageList;
+
+struct OPENOPTIONSDIALOG
+{
+ const wchar_t *pszGroup, *pszPage, *pszTab;
};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -92,19 +105,19 @@ struct OptionsPageData : public MZeroedObject hLangpack = src->hLangpack;
if (src->flags & ODPF_UNICODE)
- ptszTitle = mir_wstrdup(src->pwszTitle);
+ ptszTitle = mir_wstrdup(src->szTitle.w);
else
- ptszTitle = mir_a2u(src->pszTitle);
+ ptszTitle = mir_a2u(src->szTitle.a);
if (src->flags & ODPF_UNICODE)
- ptszGroup = mir_wstrdup(src->pwszGroup);
+ ptszGroup = mir_wstrdup(src->szGroup.w);
else
- ptszGroup = mir_a2u(src->pszGroup);
+ ptszGroup = mir_a2u(src->szGroup.a);
if (src->flags & ODPF_UNICODE)
- ptszTab = mir_wstrdup(src->pwszTab);
+ ptszTab = mir_wstrdup(src->szTab.w);
else
- ptszTab = mir_a2u(src->pszTab);
+ ptszTab = mir_a2u(src->szTab.a);
}
~OptionsPageData()
@@ -362,18 +375,6 @@ static BOOL IsAeroMode() return dwmIsCompositionEnabled && (dwmIsCompositionEnabled(&result) == S_OK) && result;
}
-static void FreeOptionsData(OptionsPageInit* popi)
-{
- for (int i = 0; i < popi->pageCount; i++) {
- mir_free((char*)popi->odp[i].pszTitle);
- mir_free(popi->odp[i].pszGroup);
- mir_free(popi->odp[i].pszTab);
- if ((DWORD_PTR)popi->odp[i].pszTemplate & 0xFFFF0000)
- mir_free((char*)popi->odp[i].pszTemplate);
- }
- mir_free(popi->odp);
-}
-
static LRESULT CALLBACK AeroPaintSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static void AeroPaintControl(HWND hwnd, HDC hdc, UINT msg, LPARAM lpFlags)
@@ -705,20 +706,19 @@ static BOOL IsInsideTab(HWND hdlg, OptionsDlgData *dat, int i) static void LoadOptionsModule(HWND hdlg, OptionsDlgData *dat, HINSTANCE hInst)
{
- OptionsPageInit opi = { 0 };
- CallPluginEventHook(hInst, hOptionsInitEvent, (WPARAM)&opi, 0);
- if (opi.pageCount == 0)
+ OptionsPageList arPages(1);
+ CallPluginEventHook(hInst, hOptionsInitEvent, (WPARAM)&arPages, 0);
+ if (arPages.getCount() == 0)
return;
- for (int i = 0; i < opi.pageCount; i++) {
- OptionsPageData *opd = new OptionsPageData(&opi.odp[i]);
+ for (int i = 0; i < arPages.getCount(); i++) {
+ OptionsPageData *opd = new OptionsPageData(&arPages[i]);
if (opd->pDialog == NULL) // smth went wrong
delete opd;
else
dat->arOpd.insert(opd);
}
- FreeOptionsData(&opi);
PostMessage(hdlg, DM_REBUILDPAGETREE, 0, 0);
}
@@ -804,28 +804,28 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L if (ood->pszGroup == NULL)
lastGroup = db_get_wsa(NULL, "Options", "LastGroup");
else
- lastGroup = mir_a2u(ood->pszGroup);
+ lastGroup = mir_wstrdup(ood->pszGroup);
}
else {
- lastPage = mir_a2u(ood->pszPage);
- lastGroup = mir_a2u(ood->pszGroup);
+ lastPage = mir_wstrdup(ood->pszPage);
+ lastGroup = mir_wstrdup(ood->pszGroup);
}
if (ood->pszTab == NULL)
lastTab = db_get_wsa(NULL, "Options", "LastTab");
else
- lastTab = mir_a2u(ood->pszTab);
+ lastTab = mir_wstrdup(ood->pszTab);
- OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE*)psh->ppsp;
- for (UINT i = 0; i < psh->nPages; i++, odp++) {
- opd = new OptionsPageData(odp);
+ OPTIONSDIALOGPAGE **odp = (OPTIONSDIALOGPAGE**)psh->ppsp;
+ for (UINT i = 0; i < psh->nPages; i++) {
+ opd = new OptionsPageData(odp[i]);
if (opd->pDialog == NULL) // smth went wrong
delete opd;
else
dat->arOpd.insert(opd);
- if (!mir_wstrcmp(lastPage, odp->pwszTitle) && !mir_wstrcmp(lastGroup, odp->pwszGroup))
- if ((ood->pszTab == NULL && dat->currentPage == -1) || !mir_wstrcmp(lastTab, odp->pwszTab))
+ if (!mir_wstrcmp(lastPage, odp[i]->szTitle.w) && !mir_wstrcmp(lastGroup, odp[i]->szGroup.w))
+ if ((ood->pszTab == NULL && dat->currentPage == -1) || !mir_wstrcmp(lastTab, odp[i]->szTab.w))
dat->currentPage = (int)i;
}
@@ -1138,58 +1138,55 @@ void OpenAccountOptions(PROTOACCOUNT *pa) if (pa->ppro == NULL)
return;
- OptionsPageInit opi = { 0 };
- pa->ppro->OnEvent(EV_PROTO_ONOPTIONS, (WPARAM)&opi, 0);
- if (opi.pageCount == 0)
+ OptionsPageList arPages(1);
+ pa->ppro->OnEvent(EV_PROTO_ONOPTIONS, (WPARAM)&arPages, 0);
+ if (arPages.getCount() == 0)
return;
wchar_t tszTitle[100];
mir_snwprintf(tszTitle, TranslateT("%s options"), pa->tszAccountName);
- OPENOPTIONSDIALOG ood = { sizeof(ood) };
- ood.pszGroup = LPGEN("Network");
- ood.pszPage = mir_u2a(pa->tszAccountName);
+ OPENOPTIONSDIALOG ood;
+ ood.pszGroup = LPGENW("Network");
+ ood.pszPage = pa->tszAccountName;
+ ood.pszTab = NULL;
PROPSHEETHEADER psh = { sizeof(psh) };
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
psh.hwndParent = NULL;
- psh.nPages = opi.pageCount;
+ psh.nPages = arPages.getCount();
psh.pStartPage = (LPCTSTR)&ood;
psh.pszCaption = tszTitle;
- psh.ppsp = (PROPSHEETPAGE*)opi.odp;
+ psh.ppsp = (PROPSHEETPAGE*)arPages.getArray();
hwndOptions = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_OPTIONSPAGE), NULL, OptionsDlgProc, (LPARAM)&psh);
mir_free((void*)ood.pszPage);
- FreeOptionsData(&opi);
}
-static void OpenOptionsNow(int _hLang, const char *pszGroup, const char *pszPage, const char *pszTab, bool bSinglePage = false)
+static void OpenOptionsNow(int _hLang, const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab, bool bSinglePage)
{
if (IsWindow(hwndOptions)) {
ShowWindow(hwndOptions, SW_RESTORE);
SetForegroundWindow(hwndOptions);
if (pszPage != NULL) {
- ptrW ptszPage(mir_a2u(pszPage));
HTREEITEM hItem = NULL;
if (pszGroup != NULL) {
- ptrW ptszGroup(mir_a2u(pszGroup));
- hItem = FindNamedTreeItemAtRoot(GetDlgItem(hwndOptions, IDC_PAGETREE), TranslateW_LP(ptszGroup, _hLang));
+ hItem = FindNamedTreeItemAtRoot(GetDlgItem(hwndOptions, IDC_PAGETREE), TranslateW_LP(pszGroup, _hLang));
if (hItem != NULL)
- hItem = FindNamedTreeItemAtChildren(GetDlgItem(hwndOptions, IDC_PAGETREE), hItem, TranslateW_LP(ptszPage, _hLang));
+ hItem = FindNamedTreeItemAtChildren(GetDlgItem(hwndOptions, IDC_PAGETREE), hItem, TranslateW_LP(pszPage, _hLang));
}
- else hItem = FindNamedTreeItemAtRoot(GetDlgItem(hwndOptions, IDC_PAGETREE), TranslateW_LP(ptszPage, _hLang));
+ else hItem = FindNamedTreeItemAtRoot(GetDlgItem(hwndOptions, IDC_PAGETREE), TranslateW_LP(pszPage, _hLang));
if (hItem != NULL)
TreeView_SelectItem(GetDlgItem(hwndOptions, IDC_PAGETREE), hItem);
}
}
else {
- OptionsPageInit opi = { 0 };
- NotifyEventHooks(hOptionsInitEvent, (WPARAM)&opi, 0);
- if (opi.pageCount == 0)
+ OptionsPageList arPages(1);
+ NotifyEventHooks(hOptionsInitEvent, (WPARAM)&arPages, 0);
+ if (arPages.getCount() == 0)
return;
OPENOPTIONSDIALOG ood = { 0 };
- ood.cbSize = sizeof(ood);
ood.pszGroup = pszGroup;
ood.pszPage = pszPage;
ood.pszTab = pszTab;
@@ -1197,82 +1194,64 @@ static void OpenOptionsNow(int _hLang, const char *pszGroup, const char *pszPage PROPSHEETHEADER psh = { 0 };
psh.dwSize = sizeof(psh);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
- psh.nPages = opi.pageCount;
+ psh.nPages = arPages.getCount();
psh.pStartPage = (LPCTSTR)&ood; // more structure misuse
psh.pszCaption = TranslateT("Miranda NG options");
- psh.ppsp = (PROPSHEETPAGE*)opi.odp; // blatent misuse of the structure, but what the hell
+ psh.ppsp = (PROPSHEETPAGE*)arPages.getArray(); // blatent misuse of the structure, but what the hell
hwndOptions = CreateDialogParam(g_hInst,
MAKEINTRESOURCE(bSinglePage ? IDD_OPTIONSPAGE : IDD_OPTIONS),
NULL, OptionsDlgProc, (LPARAM)&psh);
-
- FreeOptionsData(&opi);
}
}
-static INT_PTR OpenOptions(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(int) Options_Open(const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab, int _hLangpack)
{
- OPENOPTIONSDIALOG *ood = (OPENOPTIONSDIALOG*)lParam;
- if (ood == NULL || ood->cbSize != sizeof(OPENOPTIONSDIALOG))
- return 1;
-
- OpenOptionsNow((int)wParam, ood->pszGroup, ood->pszPage, ood->pszTab);
+ OpenOptionsNow(_hLangpack, pszGroup, pszPage, pszTab, false);
return 0;
}
-static INT_PTR OpenOptionsPage(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(HWND) Options_OpenPage(const wchar_t *pszGroup, const wchar_t *pszPage, const wchar_t *pszTab, int _hLangpack)
{
- OPENOPTIONSDIALOG *ood = (OPENOPTIONSDIALOG*)lParam;
- if (ood == NULL || ood->cbSize != sizeof(OPENOPTIONSDIALOG))
- return 1;
-
- OpenOptionsNow((int)wParam, ood->pszGroup, ood->pszPage, ood->pszTab, true);
- return (INT_PTR)hwndOptions;
+ OpenOptionsNow(_hLangpack, pszGroup, pszPage, pszTab, true);
+ return hwndOptions;
}
-static INT_PTR OpenOptionsDialog(WPARAM, LPARAM)
-{
- if (hwndOptions || !ServiceExists(MS_MODERNOPT_SHOW))
- OpenOptionsNow(NULL, NULL, NULL, NULL);
- else
- CallService(MS_MODERNOPT_SHOW, 0, 0);
- return 0;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR AddOptionsPage(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(int) Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp, int _hLangpack)
{
- OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE*)lParam, *dst;
- OptionsPageInit *opi = (OptionsPageInit*)wParam;
- if (odp == NULL || opi == NULL)
+ OptionsPageList *pList = (OptionsPageList*)wParam;
+ if (odp == NULL || pList == NULL)
return 1;
- opi->odp = (OPTIONSDIALOGPAGE*)mir_realloc(opi->odp, sizeof(OPTIONSDIALOGPAGE)*(opi->pageCount + 1));
- dst = opi->odp + opi->pageCount;
+ OptionsPage *dst = new OptionsPage();
memcpy(dst, odp, sizeof(OPTIONSDIALOGPAGE));
+ dst->hLangpack = _hLangpack;
- if (odp->pwszTitle != NULL) {
+ if (odp->szTitle.w != NULL) {
if (odp->flags & ODPF_UNICODE)
- dst->pwszTitle = mir_wstrdup(odp->pwszTitle);
+ dst->szTitle.w = mir_wstrdup(odp->szTitle.w);
else {
- dst->pwszTitle = mir_a2u(odp->pszTitle);
+ dst->szTitle.w = mir_a2u(odp->szTitle.a);
dst->flags |= ODPF_UNICODE;
}
}
- if (odp->pwszGroup != NULL) {
+ if (odp->szGroup.w != NULL) {
if (odp->flags & ODPF_UNICODE)
- dst->pwszGroup = mir_wstrdup(odp->pwszGroup);
+ dst->szGroup.w = mir_wstrdup(odp->szGroup.w);
else {
- dst->pwszGroup = mir_a2u(odp->pszGroup);
+ dst->szGroup.w = mir_a2u(odp->szGroup.a);
dst->flags |= ODPF_UNICODE;
}
}
- if (odp->pwszTab != NULL) {
+ if (odp->szTab.w != NULL) {
if (odp->flags & ODPF_UNICODE)
- dst->pwszTab = mir_wstrdup(odp->pwszTab);
+ dst->szTab.w = mir_wstrdup(odp->szTab.w);
else {
- dst->pwszTab = mir_a2u(odp->pszTab);
+ dst->szTab.w = mir_a2u(odp->szTab.a);
dst->flags |= ODPF_UNICODE;
}
}
@@ -1280,7 +1259,18 @@ static INT_PTR AddOptionsPage(WPARAM wParam, LPARAM lParam) if ((DWORD_PTR)odp->pszTemplate & 0xFFFF0000)
dst->pszTemplate = mir_strdup(odp->pszTemplate);
- opi->pageCount++;
+ pList->insert(dst);
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static INT_PTR OpenOptionsDialog(WPARAM, LPARAM)
+{
+ if (hwndOptions || !ServiceExists(MS_MODERNOPT_SHOW))
+ OpenOptionsNow(NULL, NULL, NULL, NULL, false);
+ else
+ CallService(MS_MODERNOPT_SHOW, 0, 0);
return 0;
}
@@ -1293,6 +1283,7 @@ static int OptModulesLoaded(WPARAM, LPARAM) mi.name.a = LPGEN("&Options...");
mi.pszService = "Options/OptionsCommand";
Menu_AddMainMenuItem(&mi);
+ CreateServiceFunction(mi.pszService, OpenOptionsDialog);
return 0;
}
@@ -1311,10 +1302,6 @@ int LoadOptionsModule(void) hOptionsInitEvent = CreateHookableEvent(ME_OPT_INITIALISE);
HookEvent(ME_OPT_INITIALISE, LangpackOptionsInit);
- CreateServiceFunction("Opt/AddPage", AddOptionsPage);
- CreateServiceFunction("Opt/OpenOptions", OpenOptions);
- CreateServiceFunction("Opt/OpenOptionsPage", OpenOptionsPage);
- CreateServiceFunction("Options/OptionsCommand", OpenOptionsDialog);
HookEvent(ME_SYSTEM_MODULESLOADED, OptModulesLoaded);
HookEvent(ME_SYSTEM_PRESHUTDOWN, ShutdownOptionsModule);
return 0;
diff --git a/src/mir_app/src/options_ei.cpp b/src/mir_app/src/options_ei.cpp index f9e11d7268..98334a8d72 100644 --- a/src/mir_app/src/options_ei.cpp +++ b/src/mir_app/src/options_ei.cpp @@ -462,9 +462,9 @@ int InitOptionsCallback(WPARAM wParam, LPARAM) return 0;
OPTIONSDIALOGPAGE odp = { 0 };
- odp.pszGroup = LPGEN("Contact list");
- odp.pszTitle = LPGEN("Extra icons");
- odp.pszTab = LPGEN("General");
+ odp.szGroup.a = LPGEN("Contact list");
+ odp.szTitle.a = LPGEN("Extra icons");
+ odp.szTab.a = LPGEN("General");
odp.flags = ODPF_BOLDGROUPS;
odp.pDialog = new CExtraIconOptsDlg();
Options_AddPage(wParam, &odp);
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp index 42c20aabe3..b67193dbe9 100644 --- a/src/mir_app/src/pluginopts.cpp +++ b/src/mir_app/src/pluginopts.cpp @@ -553,7 +553,7 @@ int PluginOptionsInit(WPARAM wParam, LPARAM) odp.pfnDlgProc = DlgPluginOpt;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PLUGINS);
odp.position = 1300000000;
- odp.pszTitle = LPGEN("Plugins");
+ odp.szTitle.a = LPGEN("Plugins");
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
return 0;
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index f056270390..4cc607130e 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -865,15 +865,10 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM idx = ListBox_GetCurSel(hwndList);
if (idx != -1) {
pa = (PROTOACCOUNT*)ListBox_GetItemData(hwndList, idx);
- if (pa->bOldProto) {
- OPENOPTIONSDIALOG ood;
- ood.cbSize = sizeof(ood);
- ood.pszGroup = "Network";
- ood.pszPage = pa->szModuleName;
- ood.pszTab = NULL;
- Options_Open(&ood);
- }
- else OpenAccountOptions(pa);
+ if (pa->bOldProto)
+ Options_Open(L"Network", _A2T(pa->szModuleName));
+ else
+ OpenAccountOptions(pa);
}
break;
@@ -890,12 +885,8 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM pshn.hdr.code = PSN_APPLY;
pshn.hdr.hwndFrom = hwndDlg;
SendMessage(hwndDlg, WM_NOTIFY, 0, (LPARAM)&pshn);
- {
- OPENOPTIONSDIALOG ood = { 0 };
- ood.cbSize = sizeof(ood);
- ood.pszPage = "Network";
- Options_Open(&ood);
- }
+
+ Options_Open(L"Network");
break;
case IDC_LNK_ADDONS:
diff --git a/src/mir_app/src/proto_order.cpp b/src/mir_app/src/proto_order.cpp index 292ac235fb..5a480ccbcf 100644 --- a/src/mir_app/src/proto_order.cpp +++ b/src/mir_app/src/proto_order.cpp @@ -222,8 +222,8 @@ int ProtocolOrderOptInit(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -10000000;
odp.groupPosition = 1000000;
- odp.pszTitle = LPGEN("Accounts");
- odp.pszGroup = LPGEN("Contact list");
+ odp.szTitle.a = LPGEN("Accounts");
+ odp.szGroup.a = LPGEN("Contact list");
odp.pDialog = new CProtocolOrderOpts();
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp index 7c240f1a6d..ec8aa6600e 100644 --- a/src/mir_app/src/skin2opts.cpp +++ b/src/mir_app/src/skin2opts.cpp @@ -1000,7 +1000,7 @@ int SkinOptionsInit(WPARAM wParam, LPARAM) odp.flags = ODPF_BOLDGROUPS;
odp.position = -180000000;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ICOLIB);
- odp.pszTitle = LPGEN("Icons");
+ odp.szTitle.a = LPGEN("Icons");
odp.pfnDlgProc = DlgProcIcoLibOpts;
Options_AddPage(wParam, &odp);
return 0;
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp index ebc1ea7cc6..0aec43e34c 100644 --- a/src/mir_app/src/sounds.cpp +++ b/src/mir_app/src/sounds.cpp @@ -440,7 +440,7 @@ static int SkinOptionsInit(WPARAM wParam, LPARAM) odp.position = -200000000;
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SOUND);
- odp.pszTitle = LPGEN("Sounds");
+ odp.szTitle.a = LPGEN("Sounds");
odp.pfnDlgProc = DlgProcSoundOpts;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
diff --git a/src/mir_app/src/visibility.cpp b/src/mir_app/src/visibility.cpp index 6f2e540a84..4a8fb9b3ef 100644 --- a/src/mir_app/src/visibility.cpp +++ b/src/mir_app/src/visibility.cpp @@ -274,8 +274,8 @@ static int VisibilityOptInitialise(WPARAM wParam, LPARAM) odp.position = 850000000;
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_VISIBILITY);
- odp.pszTitle = LPGEN("Visibility");
- odp.pszGroup = LPGEN("Contacts");
+ odp.szTitle.a = LPGEN("Visibility");
+ odp.szGroup.a = LPGEN("Contacts");
odp.pfnDlgProc = DlgProcVisibilityOpts;
odp.flags = ODPF_BOLDGROUPS;
Options_AddPage(wParam, &odp);
|