summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2016-10-28 16:18:50 +0300
committerGeorge Hazan <ghazan@miranda.im>2016-10-28 16:18:50 +0300
commitcf9de21af3073e29cb7b149fbd8427241de70729 (patch)
tree2a0b17f49d14d4a51bc942f15bf3747509f0c3cf /src/mir_app
parent3de431cc811a1fbf9cd0d520fe33b6163c73e919 (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/mir_app')
-rw-r--r--src/mir_app/src/FontOptions.cpp4
-rw-r--r--src/mir_app/src/contacts.cpp4
-rw-r--r--src/mir_app/src/hotkey_opts.cpp4
-rw-r--r--src/mir_app/src/ignore.cpp4
-rw-r--r--src/mir_app/src/lpopts.cpp9
-rw-r--r--src/mir_app/src/menu_options.cpp4
-rw-r--r--src/mir_app/src/meta_options.cpp4
-rw-r--r--src/mir_app/src/mir_app.def3
-rw-r--r--src/mir_app/src/mir_app64.def3
-rw-r--r--src/mir_app/src/netlibopts.cpp2
-rw-r--r--src/mir_app/src/options.cpp187
-rw-r--r--src/mir_app/src/options_ei.cpp6
-rw-r--r--src/mir_app/src/pluginopts.cpp2
-rw-r--r--src/mir_app/src/proto_opts.cpp21
-rw-r--r--src/mir_app/src/proto_order.cpp4
-rw-r--r--src/mir_app/src/skin2opts.cpp2
-rw-r--r--src/mir_app/src/sounds.cpp2
-rw-r--r--src/mir_app/src/visibility.cpp4
18 files changed, 125 insertions, 144 deletions
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);