From cf9de21af3073e29cb7b149fbd8427241de70729 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 28 Oct 2016 16:18:50 +0300 Subject: - old useless helpers removed from the Options module; - mir_app functions introduced instead of them; - OPENOPTIONSDIALOG structure removed from m_options.h --- include/delphi/m_helpers.inc | 25 ++++------------ include/delphi/m_options.inc | 38 +++++++------------------ include/m_options.h | 68 +++++++++++++------------------------------- 3 files changed, 35 insertions(+), 96 deletions(-) (limited to 'include') diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc index f923dcc8d9..88feb436ff 100644 --- a/include/delphi/m_helpers.inc +++ b/include/delphi/m_helpers.inc @@ -52,7 +52,6 @@ function Menu_AddTrayMenuItem (mi:PMO_MenuItem):HGENMENU; procedure SET_UID(pmi:PMO_MenuItem; strguid:PAnsiChar); -function UserInfo_AddPage(wParam:WPARAM; odp:POPTIONSDIALOGPAGE):int_ptr; function Options_AddPage (wParam:WPARAM; odp:POPTIONSDIALOGPAGE):int_ptr; function Hotkey_Register(hk:PHOTKEYDESC):int_ptr; @@ -65,8 +64,7 @@ procedure ColourRegister(pColorID:pColourID); function TopToolbar_AddButton(pButton:PTTBButton):THANDLE; -function Options_Open (ood:POPENOPTIONSDIALOG):int_ptr; -function Options_OpenPage(ood:POPENOPTIONSDIALOG):HWND; +function Options_Open(group,page,tab:PWideChar):int_ptr; procedure MIcoTab_AddItem (hwnd:HWND; lptzName:PAnsiChar; hIcon:HICON; data:LPARAM; bSharedIcon:bool); procedure MIcoTab_AddItemW(hwnd:HWND; lptzName:PWideChar; hIcon:HICON; data:LPARAM; bSharedIcon:bool); @@ -380,19 +378,6 @@ begin result:=_AddTrayMenuItem(mi); end; - -function UserInfo_AddPage(wParam:WPARAM; odp:POPTIONSDIALOGPAGE):int_ptr; -begin - odp^.hLangpack:=hLangpack; - result:=CallService(MS_USERINFO_ADDPAGE, wParam, LPARAM(odp)); -end; - -function Options_AddPage(wParam:WPARAM; odp:POPTIONSDIALOGPAGE):int_ptr; -begin - odp^.hLangpack:=hLangpack; - result:=CallService(MS_OPT_ADDPAGE, wParam, LPARAM(odp)); -end; - function Hotkey_Register(hk:PHOTKEYDESC):int_ptr; begin result:=CallService(MS_HOTKEY_REGISTER, hLangpack, LPARAM(hk)); @@ -428,14 +413,14 @@ begin result:=CallService(MS_TTB_ADDBUTTON, WPARAM(pButton), hLangpack); end; -function Options_Open(ood:POPENOPTIONSDIALOG):int_ptr; +function Options_AddPage(wParam:WPARAM; odp:POPTIONSDIALOGPAGE):int_ptr; begin - result:=CallService(MS_OPT_OPENOPTIONS, hLangpack, LPARAM(ood)); + result:=_Options_AddPage(wParam, odp, hLangpack); end; -function Options_OpenPage(ood:POPENOPTIONSDIALOG):HWND; +function Options_Open(group,page,tab:PWideChar):int_ptr; begin - result:=CallService(MS_OPT_OPENOPTIONSPAGE, hLangpack, LPARAM(ood)); + result:=_Options_Open(group,page,tab,hLangpack); end; procedure MIcoTab_AddItem(hwnd:HWND; lptzName:PAnsiChar; hIcon:HICON; data:LPARAM; bSharedIcon:bool); diff --git a/include/delphi/m_options.inc b/include/delphi/m_options.inc index 2643237a05..96b643b40b 100644 --- a/include/delphi/m_options.inc +++ b/include/delphi/m_options.inc @@ -54,17 +54,17 @@ type TOPTIONSDIALOGPAGE = record position :int; // a position number, lower numbers are topmost szTitle :TChar; // [TRANSLATED-BY-CORE] + szGroup :TChar; // [TRANSLATED-BY-CORE] + szTab :TChar; // [TRANSLATED-BY-CORE] pfnDlgProc :pointer; pszTemplate :PAnsiChar; hInstance :THANDLE; - hIcon :HICON; // v0.1.0.1+ - szGroup :TChar; // v0.1.0.1+ [TRANSLATED-BY-CORE] - groupPosition :int; // v0.1.0.1+ - hGroupIcon :HICON; // v0.1.0.1+ - flags :dword; // v0.1.2.1+ - szTab :TChar; // v0.6.0.0+ [TRANSLATED-BY-CORE] - dwInitParam :LPARAM; // v0.8.0.0+ a value to pass to lParam of WM_INITDIALOG message + hIcon :HICON; // + groupPosition :int; // hLangpack :int; + hGroupIcon :HICON; // + flags :dword; // + dwInitParam :LPARAM; // a value to pass to lParam of WM_INITDIALOG message end; const @@ -76,27 +76,9 @@ const const PSM_GETBOLDFONT = WM_USER+102; //returns HFONT used for group box titles - MS_OPT_ADDPAGE:PAnsiChar = 'Opt/AddPage'; +function _Options_AddPage(param:WPARAM; opts:POPTIONSDIALOGPAGE; lang:int) : int; stdcall; external AppDll name 'Options_AddPage'; - { Opens the options dialog, optionally at the specified page v0.1.2.1+ - wParam=0 - lParam=(LPARAM)(OPENOPTIONSDIALOG*)&ood; - Returns 0 on success, nonzero on failure - The behaviour if the options dialog is already open is that it will just be - activated, the page won't be changed. This may change in the future. } -type - POPENOPTIONSDIALOG = ^TOPENOPTIONSDIALOG; - TOPENOPTIONSDIALOG = record - cbSize :int; - pszGroup:PAnsiChar; // set to NULL if it's a root item - pszPage :PAnsiChar; // set to NULL to just open the options at no specific page - pszTab :PAnsiChar; // set to NULL to just open the options at no specific tab - end; - -const - MS_OPT_OPENOPTIONS:PAnsiChar = 'Opt/OpenOptions'; - -//Opens the options dialog, with only specified page v0.8.0.x+ - MS_OPT_OPENOPTIONSPAGE = 'Opt/OpenOptionsPage'; +function _Options_Open(group,page,tab:PWideChar; lang:int):int_ptr; stdcall; external AppDll name 'Options_Open'; +function _Options_OpenPage(group,page,tab:PWideChar; lang:int):HWND; stdcall; external AppDll name 'Options_OpenPage'; {$ENDIF} diff --git a/include/m_options.h b/include/m_options.h index 5223ab88f4..dabcdf7375 100644 --- a/include/m_options.h +++ b/include/m_options.h @@ -56,36 +56,25 @@ DLUs. // WARNING: do not use Translate(TS) for pszTitle, pszGroup or pszTab as they // are translated by the core, which may lead to double translation. // Use LPGEN instead which are just dummy wrappers/markers for "lpgen.pl". -typedef struct { - int position; //a position number, lower numbers are topmost - union { - char *pszTitle; // [TRANSLATED-BY-CORE] - wchar_t *pwszTitle; - }; + +struct OPTIONSDIALOGPAGE +{ + int position; // a position number, lower numbers are topmost + MAllStrings szTitle, szGroup, szTab; // [TRANSLATED-BY-CORE] DLGPROC pfnDlgProc; char *pszTemplate; HINSTANCE hInstance; HICON hIcon; - union { - char *pszGroup; - wchar_t *pwszGroup; - }; int groupPosition; + int hLangpack; HICON hGroupIcon; DWORD flags; - union { - char *pszTab; - wchar_t *pwszTab; - }; - union { LPARAM dwInitParam; // a value to pass to lParam of WM_INITDIALOG message class CDlgBase *pDialog; }; - int hLangpack; -} - OPTIONSDIALOGPAGE; +}; #define ODPF_BOLDGROUPS 4 // give group box titles a bold font #define ODPF_UNICODE 8 // string fields in OPTIONSDIALOGPAGE are wchar_t* @@ -94,37 +83,20 @@ typedef struct { #define PSM_GETBOLDFONT (WM_USER+102) //returns HFONT used for group box titles -__forceinline INT_PTR Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE* odp) -{ odp->hLangpack = hLangpack; - return CallService("Opt/AddPage", wParam, (LPARAM)odp); -} - -//Opens the options dialog, optionally at the specified page v0.1.2.1+ -//wParam = 0 -//lParam = (LPARAM)(OPENOPTIONSDIALOG*)&ood; -//Returns 0 on success, nonzero on failure -//The behaviour if the options dialog is already open is that it will just be -//activated, the page won't be changed. This may change in the future. -typedef struct { - int cbSize; - const char *pszGroup; //set to NULL if it's a root item - const char *pszPage; //set to NULL to just open the options at no - //specific page - const char *pszTab; //set to NULL to just open the options at no - //specific tab -} - OPENOPTIONSDIALOG; - -__forceinline INT_PTR Options_Open(OPENOPTIONSDIALOG *ood) -{ - return CallService("Opt/OpenOptions", hLangpack, (LPARAM)ood); -} +EXTERN_C MIR_APP_DLL(int) Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp, int = hLangpack); -//Opens the options dialog, with only specified page v0.8.0.x+ +// The behaviour if the options dialog is already open is that it will just be +// activated, the page won't be changed. This may change in the future. -__forceinline HWND Options_OpenPage(OPENOPTIONSDIALOG *ood) -{ - return (HWND)CallService("Opt/OpenOptionsPage", hLangpack, (LPARAM)ood); -} +// set pszGroup to NULL if it's a root item +// set pszPage to NULL to just open the options at no specific page +// set pszTab to NULL to just open the options at no specific tab + +// Opens the options dialog, optionally at the specified page +// Returns 0 on success, nonzero on failure +EXTERN_C MIR_APP_DLL(int) Options_Open(const wchar_t *pszGroup, const wchar_t *pszPage = NULL, const wchar_t *pszTab = NULL, int = hLangpack); + +// Opens the options dialog, with only specified page +EXTERN_C MIR_APP_DLL(HWND) Options_OpenPage(const wchar_t *pszGroup, const wchar_t *pszPage = NULL, const wchar_t *pszTab = NULL, int = hLangpack); #endif //M_OPTIONS_H__ -- cgit v1.2.3