diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-02 15:32:39 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-02 15:32:39 +0000 |
commit | 468976464c267ab9f7aa5964d1479c7d909a54a4 (patch) | |
tree | 6e4006a5c4d54dfb5a2487eeddca57b5058a175f /plugins/UserInfoEx/src/Flags/svc_flags.cpp | |
parent | c5392f2ac487b9c2bd525bc13a33fcf13f66ee5d (diff) |
unused code removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@7457 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/UserInfoEx/src/Flags/svc_flags.cpp')
-rw-r--r-- | plugins/UserInfoEx/src/Flags/svc_flags.cpp | 153 |
1 files changed, 13 insertions, 140 deletions
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index a8589c9255..a0b350f1a9 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -26,119 +26,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define M_ENABLE_SUBCTLS (WM_APP+1)
-bool g_bShowExtraImgFlag = false, g_bUseUnknownFlag = false, g_bShowStatusIconFlag = false;
+bool g_bUseUnknownFlag = false, g_bShowStatusIconFlag = false;
/* Misc */
int nCountriesCount;
struct CountryListEntry *countries;
-static HANDLE hExtraIconSvc = INVALID_HANDLE_VALUE;
-/* hook */
-static HANDLE hApplyIconHook = NULL;
-static HANDLE hSettingChangedHook = NULL;
+static HANDLE hExtraIconSvc;
static int OnContactSettingChanged(WPARAM wParam,LPARAM lParam);
static LIST<MsgWndData> gMsgWndList(10, HandleKeySortT);
/***********************************************************************************************************
- * Buffered functions
- ***********************************************************************************************************/
-
-struct BufferedCallData
-{
- DWORD startTick;
- UINT uElapse;
- BUFFEREDPROC pfnBuffProc;
- LPARAM lParam;
-};
-
-static UINT_PTR idBufferedTimer;
-static LIST<BufferedCallData> arCalls(10);
-static CRITICAL_SECTION csCalls;
-
-// always gets called in main message loop
-static void CALLBACK BufferedProcTimer(HWND hwnd, UINT /*msg*/, UINT idTimer, DWORD currentTick)
-{
- UINT uElapseNext = USER_TIMER_MAXIMUM;
-
- for (int i = 0; i < arCalls.getCount(); ++i) {
- BufferedCallData *p = arCalls[i];
-
- /* find elapsed procs */
- UINT uElapsed = currentTick - p->startTick; /* wraparound works */
- if ((uElapsed + USER_TIMER_MINIMUM) >= p->uElapse) {
- CallFunctionAsync((void (CALLBACK *)(void*))p->pfnBuffProc, (void*)p->lParam);
-
- mir_cslock lck(csCalls);
- arCalls.remove(i--);
- delete p;
- }
- /* find next timer delay */
- else if (p->uElapse - uElapsed < uElapseNext)
- uElapseNext = p->uElapse - uElapsed;
- }
-
- /* set next timer */
- if (arCalls.getCount())
- idBufferedTimer = SetTimer(hwnd, idBufferedTimer, uElapseNext, (TIMERPROC)BufferedProcTimer); /* will be reset */
- else {
- KillTimer(hwnd, idTimer);
- idBufferedTimer = 0;
- }
-}
-
-// assumes to be called in context of main thread
-void CallFunctionBuffered(BUFFEREDPROC pfnBuffProc, LPARAM lParam, BOOL fAccumulateSameParam, UINT uElapse)
-{
- struct BufferedCallData *data = NULL;
-
- /* find existing */
- for (int i = 0; i < arCalls.getCount(); ++i) {
- BufferedCallData *p = arCalls[i];
- if (p->pfnBuffProc == pfnBuffProc && (!fAccumulateSameParam || p->lParam == lParam)) {
- data = p;
- break;
- }
- }
-
- /* append new */
- if (data == NULL) {
- mir_cslock lck(csCalls);
- arCalls.insert(data = new BufferedCallData());
- }
-
- /* set delay */
- data->startTick = GetTickCount();
- data->uElapse = uElapse;
- data->lParam = lParam;
- data->pfnBuffProc = pfnBuffProc;
-
- /* set next timer */
- if (idBufferedTimer)
- uElapse = USER_TIMER_MINIMUM; /* will get recalculated */
- idBufferedTimer = SetTimer(NULL, idBufferedTimer, uElapse, (TIMERPROC)BufferedProcTimer);
-}
-
-// assumes to be called in context of main thread
-void PrepareBufferedFunctions()
-{
- idBufferedTimer = 0;
- InitializeCriticalSection(&csCalls);
-}
-
-// assumes to be called in context of main thread
-void KillBufferedFunctions()
-{
- if (idBufferedTimer)
- KillTimer(NULL,idBufferedTimer);
-
- for (int i=0; i < arCalls.getCount(); i++)
- delete arCalls[i];
- arCalls.destroy();
- DeleteCriticalSection(&csCalls);
-}
-
-/***********************************************************************************************************
* service functions
***********************************************************************************************************/
@@ -179,36 +78,6 @@ static int OnCListApplyIcons(WPARAM wParam, LPARAM) return 0;
}
-void SvcFlagsEnableExtraIcons(bool bEnable, bool bUpdateDB)
-{
- g_bShowExtraImgFlag = bEnable;
-
- if (bUpdateDB)
- db_set_b(NULL, MODNAMEFLAGS, "ShowExtraImgFlag", bEnable);
-
- // Flags is on
- if (g_bShowExtraImgFlag) {
- if (hExtraIconSvc == INVALID_HANDLE_VALUE) {
- // get local langID for descIcon (try to use user local Flag as icon)
- DWORD langid = 0;
- int r = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ICOUNTRY | LOCALE_RETURN_NUMBER, (LPTSTR)&langid, sizeof(langid)/sizeof(TCHAR));
- if (!CallService(MS_UTILS_GETCOUNTRYBYNUMBER, langid, 0))
- langid = 1;
-
- char szId[20];
- mir_snprintf(szId, SIZEOF(szId), (langid == 0xFFFF) ? "%s_0x%X" : "%s_%i", "flags", langid); /* buffer safe */
- hExtraIconSvc = ExtraIcon_Register("Flags", LPGEN("Flags (uinfoex)"), szId);
- }
-
- // init hooks
- if (!hApplyIconHook)
- hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnCListApplyIcons);
-
- if (!hSettingChangedHook)
- hSettingChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged);
- }
-}
-
/***********************************************************************************************************
* message winsow status icon functions
***********************************************************************************************************/
@@ -332,7 +201,6 @@ static int OnContactSettingChanged(WPARAM wParam, LPARAM lParam) void SvcFlagsLoadModule()
{
- PrepareBufferedFunctions();
if (CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&nCountriesCount, (LPARAM)&countries))
nCountriesCount = 0;
InitIcons(); /* load in iconlib */
@@ -341,7 +209,6 @@ void SvcFlagsLoadModule() // init settings
g_bUseUnknownFlag = db_get_b(NULL, MODNAMEFLAGS, "UseUnknownFlag", SETTING_USEUNKNOWNFLAG_DEFAULT) != 0;
- g_bShowExtraImgFlag = db_get_b(NULL, MODNAMEFLAGS, "ShowExtraImgFlag", SETTING_SHOWEXTRAIMGFLAG_DEFAULT) != 0;
g_bShowStatusIconFlag = db_get_b(NULL, MODNAMEFLAGS, "ShowStatusIconFlag", SETTING_SHOWSTATUSICONFLAG_DEFAULT) != 0;
HookEvent(ME_SKIN2_ICONSCHANGED, OnStatusIconsChanged);
@@ -357,7 +224,15 @@ void SvcFlagsLoadModule() void SvcFlagsOnModulesLoaded()
{
- SvcFlagsEnableExtraIcons(true, false);
+ // get local langID for descIcon (try to use user local Flag as icon)
+ DWORD langid = 0;
+ int r = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ICOUNTRY | LOCALE_RETURN_NUMBER, (LPTSTR)&langid, sizeof(langid) / sizeof(TCHAR));
+ if (!CallService(MS_UTILS_GETCOUNTRYBYNUMBER, langid, 0))
+ langid = 1;
+
+ char szId[20];
+ mir_snprintf(szId, SIZEOF(szId), (langid == 0xFFFF) ? "%s_0x%X" : "%s_%i", "flags", langid); /* buffer safe */
+ hExtraIconSvc = ExtraIcon_Register("Flags", LPGEN("Flags (uinfoex)"), szId);
/* Status Icon */
StatusIconData sid = { sizeof(sid) };
@@ -366,6 +241,8 @@ void SvcFlagsOnModulesLoaded() sid.flags = MBF_HIDDEN;
Srmm_AddIcon(&sid);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged);
+ HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnCListApplyIcons);
HookEvent(ME_MSG_WINDOWEVENT, OnMsgWndEvent);
}
@@ -379,8 +256,6 @@ void SvcFlagsOnModulesLoaded() void SvcFlagsUnloadModule()
{
- KillBufferedFunctions();
-
//Uninit message winsow
for (int i = 0; i < gMsgWndList.getCount(); i++) {
//this should not happen
@@ -390,7 +265,5 @@ void SvcFlagsUnloadModule() gMsgWndList.destroy();
// Uninit misc
- UnhookEvent(hApplyIconHook);
- UnhookEvent(hSettingChangedHook);
UninitIcons();
}
|