diff options
19 files changed, 207 insertions, 20 deletions
diff --git a/plugins/StatusManager/res/notick.ico b/plugins/StatusManager/res/notick.ico Binary files differdeleted file mode 100644 index 7f93490642..0000000000 --- a/plugins/StatusManager/res/notick.ico +++ /dev/null diff --git a/plugins/StatusManager/res/notick1.ico b/plugins/StatusManager/res/notick1.ico Binary files differdeleted file mode 100644 index 609504d614..0000000000 --- a/plugins/StatusManager/res/notick1.ico +++ /dev/null diff --git a/plugins/StatusManager/res/resource.rc b/plugins/StatusManager/res/resource.rc index 5497def240..b561065f9a 100644 --- a/plugins/StatusManager/res/resource.rc +++ b/plugins/StatusManager/res/resource.rc @@ -13,6 +13,60 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// +// English resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_OPT_SUBPLUGINS DIALOGEX 0, 0, 212, 144 +STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CONTROL "Enable ""%s"" *",IDC_ENABLE_KEEPSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,24,173,10 + CONTROL "Enable ""%s"" *",IDC_ENABLE_STARTUPSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,37,173,10 + CONTROL "Enable ""%s"" *",IDC_ENABLE_ADVANCEDAUTOAWAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,50,173,10 + GROUPBOX "Subplugins control",IDC_STATIC,7,7,198,89 + LTEXT "* requires a reboot for applying changes",IDC_STATIC,19,81,173,9 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_OPT_SUBPLUGINS, DIALOG + BEGIN + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// AFX_DIALOG_LAYOUT +// + +IDD_OPT_SUBPLUGINS AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +#endif // English resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// // German (Germany) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) @@ -360,7 +414,7 @@ BEGIN END IDD_TRG_AAASTATECHANGE DIALOGEX 0, 0, 212, 144 -STYLE DS_SETFONT | DS_3DLOOK | WS_CHILD +STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN @@ -368,12 +422,12 @@ BEGIN CONTROL "Entering second auto-away status",IDC_ENTERSECOND, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,37,123,10 CONTROL "Leaving first auto-away status",IDC_LEAVEFIRST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,50,109,10 - CONTROL "Leaving second auto-away status",IDC_LEAVESECOND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,63,122,10 - CONTROL "Becoming active without status change",IDC_BECOMEACTIVE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,76,140,10 GROUPBOX "Pre-conditions",IDC_STATIC,7,7,198,89 - GROUPBOX "TriggerData",IDC_STATIC,7,97,198,40 LTEXT "Status: The status the account will change to\r\nAccount: The account changing state",IDC_STATIC,19,111,177,18 + GROUPBOX "TriggerData",IDC_STATIC,7,97,198,40 + CONTROL "Becoming active without status change",IDC_BECOMEACTIVE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,76,140,10 + CONTROL "Leaving second auto-away status",IDC_LEAVESECOND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,63,122,10 END @@ -445,6 +499,10 @@ BEGIN VERTGUIDE, 11 VERTGUIDE, 283 END + + IDD_TRG_AAASTATECHANGE, DIALOG + BEGIN + END END #endif // APSTUDIO_INVOKED @@ -479,7 +537,12 @@ BEGIN 0 END -#endif // Deutsch (Deutschland) resources +IDD_TRG_AAASTATECHANGE AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +#endif // German (Germany) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/plugins/StatusManager/res/useronli.ico b/plugins/StatusManager/res/useronli.ico Binary files differdeleted file mode 100644 index 2760c47d5c..0000000000 --- a/plugins/StatusManager/res/useronli.ico +++ /dev/null diff --git a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp index 93204a033d..63971adcdf 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp +++ b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp @@ -513,6 +513,7 @@ int AutoAwayOptInitialise(WPARAM wParam, LPARAM) OPTIONSDIALOGPAGE odp = { 0 }; odp.position = 1000000000; odp.hInstance = hInst; + odp.hLangpack = hAAALangpack; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TABS); odp.szTitle.a = LPGEN("Auto away"); odp.szGroup.a = LPGEN("Status"); diff --git a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp index d0eb48801c..b9647816f2 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp +++ b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp @@ -22,6 +22,8 @@ #include "..\stdafx.h" +int hAAALangpack = 0; + #ifdef _DEBUG #define SECS_PER_MINUTE 20 /* speedup */ #else @@ -587,6 +589,9 @@ int AAAModuleLoaded(WPARAM, LPARAM) void AdvancedAutoAwayLoad() { + MUUID muidLast = MIID_LAST; + hAAALangpack = GetPluginLangId(muidLast, 0); + hAAAModuleLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, AAAModuleLoaded); hStateChangedEvent = CreateHookableEvent(ME_AAA_STATECHANGED); } diff --git a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h index 70118e0e38..3f3a0b3c02 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h +++ b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h @@ -19,6 +19,8 @@ #ifndef __ADVANCED_AUTOAWAY_HEADER #define __ADVANCED_AUTOAWAY_HEADER +extern int hAAALangpack; + #define AAAMODULENAME "AdvancedAutoAway" #define SETTING_IGNLOCK "IgnoreLockKeys" #define SETTING_IGNSYSKEYS "IgnoreSysKeys" diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp index f975b64793..1cc209f0c7 100644 --- a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp +++ b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp @@ -19,6 +19,8 @@ #include "..\stdafx.h" +int hKSLangpack = 0; + struct TimerInfo { int timer; int timeout; @@ -1214,6 +1216,9 @@ int KSModuleLoaded(WPARAM, LPARAM) void KeepStatusLoad() { + MUUID muidLast = MIID_LAST; + hKSLangpack = GetPluginLangId(muidLast, 0); + hKSModuleLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, KSModuleLoaded); CreateHookableEvent(ME_KS_CONNECTIONEVENT); @@ -1237,9 +1242,6 @@ void KeepStatusUnload() DestroyServiceFunction(hIsProtoEnabled); DestroyServiceFunction(hAnnounceStat); - if (hMainThread) - CloseHandle(hMainThread); - DestroyHookableEvent(hConnectionEvent); UnhookEvent(hKSModuleLoadedHook); diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.h b/plugins/StatusManager/src/KeepStatus/keepstatus.h index 18e13f242c..167bb1a051 100644 --- a/plugins/StatusManager/src/KeepStatus/keepstatus.h +++ b/plugins/StatusManager/src/KeepStatus/keepstatus.h @@ -20,6 +20,7 @@ #ifndef __KEEPSTATUS_HEADER #define __KEEPSTATUS_HEADER +extern int hKSLangpack; #define KSMODULENAME "KeepStatus" #define SETTING_CHECKCONNECTION "CheckConnection" diff --git a/plugins/StatusManager/src/KeepStatus/ks_options.cpp b/plugins/StatusManager/src/KeepStatus/ks_options.cpp index 0f321dfd14..1a4d6075b8 100644 --- a/plugins/StatusManager/src/KeepStatus/ks_options.cpp +++ b/plugins/StatusManager/src/KeepStatus/ks_options.cpp @@ -567,6 +567,7 @@ int KeepStatusOptionsInit(WPARAM wparam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = hInst; + odp.hLangpack = hKSLangpack; odp.szGroup.w = LPGENW("Status"); odp.szTitle.w = LPGENW("Keep status"); odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; diff --git a/plugins/StatusManager/src/StartupStatus/ss_options.cpp b/plugins/StatusManager/src/StartupStatus/ss_options.cpp index 644be1f1e6..eaa5566820 100644 --- a/plugins/StatusManager/src/StartupStatus/ss_options.cpp +++ b/plugins/StatusManager/src/StartupStatus/ss_options.cpp @@ -905,6 +905,7 @@ int StartupStatusOptionsInit(WPARAM wparam,LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = hInst; + odp.hLangpack = hSSLangpack; odp.szGroup.a = LPGEN("Status"); odp.szTitle.a = LPGEN("Startup status"); odp.flags = ODPF_BOLDGROUPS; diff --git a/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp b/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp index 8abeeaa495..5cb311b605 100644 --- a/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp +++ b/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp @@ -57,6 +57,7 @@ static int CreateMainMenuItems(WPARAM, LPARAM) CMenuItem mi; mi.position = 2000100000; mi.flags = CMIF_UNICODE; + mi.hLangpack = hSSLangpack; mcount = 0; int count = GetProfileCount(0, 0); for (int i = 0; i < count && mcount < MAX_MMITEMS; i++) { @@ -65,7 +66,7 @@ static int CreateMainMenuItems(WPARAM, LPARAM) continue; if (db_get_b(NULL, SSMODULENAME, OptName(i, SETTING_INSUBMENU), 1) && !mi.root) { - mi.root = Menu_CreateRoot(MO_STATUS, LPGENW("Status profiles"), 2000100000); + mi.root = Menu_CreateRoot(MO_STATUS, LPGENW("Status profiles"), 2000100000, 0, hSSLangpack); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "1AB30D51-BABA-4B27-9288-1A12278BAD8D"); } diff --git a/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp b/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp index e9d153670a..db8f6aeb61 100644 --- a/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp +++ b/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp @@ -41,7 +41,7 @@ void RemoveTopToolbarButtons() int CreateTopToolbarButtons(WPARAM, LPARAM) { if (iconList[0].hIcolib == NULL) - Icon_Register(hInst, "Toolbar/StartupStatus", iconList, _countof(iconList)); + Icon_Register(hInst, "Toolbar/StartupStatus", iconList, _countof(iconList), NULL, hSSLangpack); int profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0); diff --git a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp index 2af4dc146d..b9bb67d684 100644 --- a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp +++ b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp @@ -19,6 +19,8 @@ #include "..\stdafx.h" +int hSSLangpack = 0; + static UINT_PTR setStatusTimerId = 0; static TSettingsList startupSettings(10, SSCompareSettings); @@ -488,6 +490,9 @@ HANDLE hSSModuleLoadedHook = NULL, void StartupStatusLoad() { + MUUID muidLast = MIID_LAST; + hSSLangpack = GetPluginLangId(muidLast, 0); + hSSModuleLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, SSModuleLoaded); if (db_get_b(NULL, SSMODULENAME, SETTING_SETPROFILE, 1) || @@ -513,6 +518,9 @@ void StartupStatusLoad() void StartupStatusUnload() { + KillModuleIcons(hSSLangpack); + KillModuleMenus(hSSLangpack); + DeinitProfilesModule(); UnloadProfileModule(); diff --git a/plugins/StatusManager/src/StartupStatus/startupstatus.h b/plugins/StatusManager/src/StartupStatus/startupstatus.h index 5686e03981..e1ad779103 100644 --- a/plugins/StatusManager/src/StartupStatus/startupstatus.h +++ b/plugins/StatusManager/src/StartupStatus/startupstatus.h @@ -19,6 +19,8 @@ #ifndef __STARTUPSTATUSHEADER #define __STARTUPSTATUSHEADER +extern int hSSLangpack; + #define SSMODULENAME "StartupStatus" struct TSSSetting : public PROTOCOLSETTINGEX, public MZeroedObject diff --git a/plugins/StatusManager/src/main.cpp b/plugins/StatusManager/src/main.cpp index 2264b63fb2..12ea42189b 100644 --- a/plugins/StatusManager/src/main.cpp +++ b/plugins/StatusManager/src/main.cpp @@ -59,21 +59,41 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) ///////////////////////////////////////////////////////////////////////////////////////// // interfaces -extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_AUTOAWAY, MIID_LAST }; +MUUID Interfaces[2] = {0}; + +MUUID* GetInterfaces(void) +{ + if (IsSubPluginEnabled(AAAMODULENAME)) + Interfaces[0] = MIID_AUTOAWAY; + return Interfaces; +}; + +extern "C" __declspec(dllexport) MUUID* MirandaInterfaces = GetInterfaces(); ///////////////////////////////////////////////////////////////////////////////////////// // plugin's entry point +int OnModulesLoaded(WPARAM, LPARAM) +{ + HookEvent(ME_OPT_INITIALISE, CSubPluginsOptionsDlg::OnOptionsInit); + return 0; +} + extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfoEx); pcli = Clist_GetInterface(); + HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + InitCommonStatus(); - KeepStatusLoad(); - StartupStatusLoad(); - AdvancedAutoAwayLoad(); + if (IsSubPluginEnabled(KSMODULENAME)) + KeepStatusLoad(); + if (IsSubPluginEnabled(SSMODULENAME)) + StartupStatusLoad(); + if (IsSubPluginEnabled(AAAMODULENAME)) + AdvancedAutoAwayLoad(); return 0; } diff --git a/plugins/StatusManager/src/options.cpp b/plugins/StatusManager/src/options.cpp new file mode 100644 index 0000000000..b80679a06b --- /dev/null +++ b/plugins/StatusManager/src/options.cpp @@ -0,0 +1,49 @@ +#include "stdafx.h" + +CSubPluginsOptionsDlg::CSubPluginsOptionsDlg() + : CPluginDlgBase(hInst, IDD_OPT_SUBPLUGINS, MODULENAME), + m_enableKeepStatus(this, IDC_ENABLE_KEEPSTATUS), + m_enableStartupStatus(this, IDC_ENABLE_STARTUPSTATUS), + m_enableAdvancedAutoAway(this, IDC_ENABLE_ADVANCEDAUTOAWAY) +{ +} + +void CSubPluginsOptionsDlg::OnInitDialog() +{ + CDlgBase::OnInitDialog(); + + wchar_t text[128]; + mir_snwprintf(text, L"Enable \"%s\" *", L"Keep status"); + m_enableKeepStatus.SetText(text); + m_enableKeepStatus.SetState(IsSubPluginEnabled(KSMODULENAME)); + mir_snwprintf(text, L"Enable \"%s\" *", L"Startup status"); + m_enableStartupStatus.SetText(text); + m_enableStartupStatus.SetState(IsSubPluginEnabled(SSMODULENAME)); + mir_snwprintf(text, L"Enable \"%s\" *", L"Advanced auto away"); + m_enableAdvancedAutoAway.SetText(text); + m_enableAdvancedAutoAway.SetState(IsSubPluginEnabled(AAAMODULENAME)); +} + +void CSubPluginsOptionsDlg::OnApply() +{ + char setting[128]; + mir_snprintf(setting, "%s_enabled", KSMODULENAME); + db_set_b(NULL, MODULENAME, setting, m_enableKeepStatus.GetState()); + mir_snprintf(setting, "%s_enabled", SSMODULENAME); + db_set_b(NULL, MODULENAME, setting, m_enableStartupStatus.GetState()); + mir_snprintf(setting, "%s_enabled", AAAMODULENAME); + db_set_b(NULL, MODULENAME, setting, m_enableAdvancedAutoAway.GetState()); +} + +int CSubPluginsOptionsDlg::OnOptionsInit(WPARAM wParam, LPARAM) +{ + OPTIONSDIALOGPAGE odp = { 0 }; + odp.hInstance = hInst; + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE; + odp.szTitle.w = LPGENW("Status"); + odp.szTab.w = LPGENW("Status manager"); + odp.pDialog = CSubPluginsOptionsDlg::CreateOptionsPage(); + Options_AddPage(wParam, &odp); + + return 0; +}
\ No newline at end of file diff --git a/plugins/StatusManager/src/resource.h b/plugins/StatusManager/src/resource.h index f49d2abbd5..c0e9db35e6 100644 --- a/plugins/StatusManager/src/resource.h +++ b/plugins/StatusManager/src/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by resource.rc +// Used by E:\Projects\C++\miranda-ng\plugins\StatusManager\res\resource.rc // #define IDD_OPT_KEEPSTATUS 101 #define IDD_OPT_KS_BASIC 101 @@ -11,8 +11,6 @@ #define IDD_OPT_STARTUPSTATUS 110 #define IDD_PUOPT_KEEPSTATUS 113 #define IDD_OPT_AUTOAWAYMSG 114 -#define IDI_TICK 117 -#define IDI_NOTICK 118 #define IDD_OPT_GENAUTOAWAY 119 #define IDD_OPT_KS_ACTION 120 #define IDD_SETSTSMSGDIALOG 121 @@ -22,6 +20,7 @@ #define IDD_OPT_KS_ADV 127 #define IDD_TRG_AAASTATECHANGE 128 #define IDI_TTBDOWN 129 +#define IDD_OPT_SUBPLUGINS 129 #define IDI_TTBUP 130 #define IDC_PROTOCOL 1000 #define IDC_STATUS 1001 @@ -145,6 +144,10 @@ #define IDC_LEAVEFIRST 1136 #define IDC_LEAVESECOND 1137 #define IDC_BECOMEACTIVE 1138 +#define IDC_ENABLE_KEEPSTATUS 1141 +#define IDC_ENABLE_STARTUPSTATUS 1142 +#define IDC_ENABLEADVANCEDAUTOAWAY 1143 +#define IDC_ENABLE_ADVANCEDAUTOAWAY 1143 #define IDC_SCREENSAVE 1145 #define IDC_TIMED 1146 #define IDC_AWAYTIME 1147 @@ -160,9 +163,9 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_RESOURCE_VALUE 131 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1141 +#define _APS_NEXT_CONTROL_VALUE 1144 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/plugins/StatusManager/src/stdafx.h b/plugins/StatusManager/src/stdafx.h index 0e481e36ca..fcd8d0d745 100644 --- a/plugins/StatusManager/src/stdafx.h +++ b/plugins/StatusManager/src/stdafx.h @@ -21,10 +21,13 @@ #include <m_protocols.h> #include <m_toptoolbar.h> #include <m_statusplugins.h> +#include <m_gui.h> #include "version.h" #include "resource.h" +#define MODULENAME "StatusManager" + #include "commonstatus.h" #include "KeepStatus\keepstatus.h" #include "StartupStatus\startupstatus.h" @@ -32,4 +35,29 @@ extern HINSTANCE hInst; +static BYTE IsSubPluginEnabled(const char* name) +{ + char setting[128]; + mir_snprintf(setting, "%s_enabled", name); + return db_get_b(NULL, MODULENAME, setting, 1); +} + +class CSubPluginsOptionsDlg : CPluginDlgBase +{ +private: + CCtrlCheck m_enableKeepStatus; + CCtrlCheck m_enableStartupStatus; + CCtrlCheck m_enableAdvancedAutoAway; + +protected: + void OnInitDialog(); + void OnApply(); + +public: + CSubPluginsOptionsDlg(); + + static int OnOptionsInit(WPARAM wParam, LPARAM); + static CDlgBase *CreateOptionsPage() { return new CSubPluginsOptionsDlg(); } +}; + #endif //_COMMON_H_ |