diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-01 16:00:47 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-01 16:00:47 +0000 |
commit | f2dde06b1c6af73e4586f83ba602f0830498e52a (patch) | |
tree | 3d91758f9c01a6c2997a9c32924577a20105766e /plugins/UserInfoEx | |
parent | 631e566f0728b637664f2a42a6d4031f8d5ac5dd (diff) |
end of SRMM status icons zoo in ГШтащУч
git-svn-id: http://svn.miranda-ng.org/main/trunk@7442 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/UserInfoEx')
-rw-r--r-- | plugins/UserInfoEx/src/Flags/svc_flags.cpp | 115 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/Flags/svc_flags.h | 21 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/psp_options.cpp | 2 |
3 files changed, 31 insertions, 107 deletions
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index ed8772fdac..a8589c9255 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -38,6 +38,8 @@ static HANDLE hSettingChangedHook = NULL; static int OnContactSettingChanged(WPARAM wParam,LPARAM lParam);
+static LIST<MsgWndData> gMsgWndList(10, HandleKeySortT);
+
/***********************************************************************************************************
* Buffered functions
***********************************************************************************************************/
@@ -217,106 +219,39 @@ MsgWndData::MsgWndData(HWND hwnd, HANDLE hContact) m_hContact = hContact;
m_countryID = (int)ServiceDetectContactOriginCountry((WPARAM)m_hContact, 0);
- StatusIconData sid = { sizeof(sid) };
- sid.szModule = MODNAMEFLAGS;
- sid.flags = MBF_HIDDEN;
- Srmm_AddIcon(&sid);
-
- FlagsIconUpdate();
+ FlagsIconSet();
}
MsgWndData::~MsgWndData()
{
- FlagsIconUnset(); //check if realy need
}
void MsgWndData::FlagsIconSet()
{
- /* ensure status icon is registered */
+ StatusIconData sid = { sizeof(sid) };
+ sid.szModule = MODNAMEFLAGS;
+ if (!g_bShowStatusIconFlag)
+ sid.flags = MBF_HIDDEN;
if (m_countryID != 0xFFFF || g_bUseUnknownFlag) {
- StatusIconData sid = { sizeof(sid) };
- sid.szModule = MODNAMEFLAGS;
- sid.hIconDisabled = sid.hIcon = LoadFlagIcon(m_countryID);
+ sid.hIcon = LoadFlagIcon(m_countryID);
sid.szTooltip = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, m_countryID, 0));
- Srmm_ModifyIcon(m_hContact, &sid);
}
-}
-
-void MsgWndData::FlagsIconUnset()
-{
- StatusIconData sid = { sizeof(sid) };
- sid.szModule = MODNAMEFLAGS;
- sid.flags = MBF_HIDDEN;
+ else sid.flags = MBF_HIDDEN;
+
Srmm_ModifyIcon(m_hContact, &sid);
}
-static int CompareMsgWndData(const MsgWndData* p1, const MsgWndData* p2)
-{
- return (int)((INT_PTR)p1->m_hContact - (INT_PTR)p2->m_hContact);
-}
-static LIST<MsgWndData> gMsgWndList(10, CompareMsgWndData);
-
-static int CompareIconListData(const IconList* p1, const IconList* p2)
-{
- return (int)((INT_PTR)p1->m_ID - (INT_PTR)p2->m_ID);
-}
-static OBJLIST<IconList> gIListMW(10, CompareIconListData);
-
-IconList::IconList(StatusIconData *sid)
+void UpdateStatusIcons()
{
- m_StatusIconData.cbSize = sid->cbSize;
- m_StatusIconData.szModule = mir_strdup(sid->szModule);
- m_StatusIconData.dwId = sid->dwId;
- m_StatusIconData.hIcon = CopyIcon(sid->hIcon);
- m_StatusIconData.hIconDisabled = sid->hIconDisabled;
- m_StatusIconData.flags = sid->flags;
- m_StatusIconData.szTooltip = mir_strdup(sid->szTooltip);
-
- m_ID = sid->dwId;
- Srmm_AddIcon(sid);
-
-}
-IconList::~IconList()
-{
- mir_free(m_StatusIconData.szModule);
- mir_free(m_StatusIconData.szTooltip);
-}
-
-// const char *pszName; // [Optional] Name of an icon registered with icolib to be used in GUI.
-static __inline int MessageAPI_AddIcon(const char* pszName, const char* szModul/*StatusIconData *sid*/, int ID, int flags, const char* szTooltip)
-{
- HICON hIcon = Skin_GetIcon(pszName);
-
StatusIconData sid = { sizeof(sid) };
- sid.szModule = (char*)szModul;
- sid.dwId = (DWORD)ID;
- sid.hIcon = (hIcon != NULL) ? CopyIcon(hIcon) : NULL;
- sid.szTooltip = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, ID, 0));
- Skin_ReleaseIcon(hIcon); /* does NULL check */
-
- int res = -1;
- IconList* p = new IconList(&sid);
- if (!p->m_ID)
- delete p;
- else
- res = gIListMW.insert(p);
- if (res == -1)
- delete p;
- return res;
-}
+ sid.szModule = MODNAMEFLAGS;
+ if (!g_bShowStatusIconFlag)
+ sid.flags = MBF_HIDDEN;
+ Srmm_ModifyIcon(NULL, &sid);
-void CALLBACK UpdateStatusIcons(LPARAM lParam)
-{
- if (!lParam) {
- /* enum all opened message windows */
- for (int i = 0; i < gMsgWndList.getCount(); i++)
- gMsgWndList[i]->FlagsIconUpdate();
- }
- else {
- int i = gMsgWndList.getIndex((MsgWndData*)&lParam);
- if (i != -1)
- gMsgWndList[i]->FlagsIconUpdate();
- }
+ /* enum all opened message windows */
+ for (int i = 0; i < gMsgWndList.getCount(); i++)
+ gMsgWndList[i]->FlagsIconSet();
}
//hookProc ME_MSG_WINDOWEVENT
@@ -348,11 +283,10 @@ static int OnMsgWndEvent(WPARAM wParam, LPARAM lParam) return 0;
}
-//hookProc ME_SKIN2_ICONSCHANGED
+// hookProc ME_SKIN2_ICONSCHANGED
static int OnStatusIconsChanged(WPARAM wParam, LPARAM lParam)
{
- if (g_bShowStatusIconFlag)
- CallFunctionBuffered(UpdateStatusIcons, 0, FALSE, STATUSICON_REFRESHDELAY);
+ UpdateStatusIcons();
return 0;
}
@@ -378,7 +312,7 @@ static int OnContactSettingChanged(WPARAM wParam, LPARAM lParam) int i = gMsgWndList.getIndex((MsgWndData*)&wParam);
if (i != -1) {
gMsgWndList[i]->ContryIDchange((int)ServiceDetectContactOriginCountry(wParam, 0));
- gMsgWndList[i]->FlagsIconUpdate();
+ gMsgWndList[i]->FlagsIconSet();
}
}
return 0;
@@ -426,6 +360,12 @@ void SvcFlagsOnModulesLoaded() SvcFlagsEnableExtraIcons(true, false);
/* Status Icon */
+ StatusIconData sid = { sizeof(sid) };
+ sid.szModule = MODNAMEFLAGS;
+ if (!g_bShowStatusIconFlag)
+ sid.flags = MBF_HIDDEN;
+ Srmm_AddIcon(&sid);
+
HookEvent(ME_MSG_WINDOWEVENT, OnMsgWndEvent);
}
@@ -448,7 +388,6 @@ void SvcFlagsUnloadModule() gMsgWndList.remove(i);
}
gMsgWndList.destroy();
- gIListMW.destroy();
// Uninit misc
UnhookEvent(hApplyIconHook);
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.h b/plugins/UserInfoEx/src/Flags/svc_flags.h index 3776096479..61b3696466 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.h +++ b/plugins/UserInfoEx/src/Flags/svc_flags.h @@ -41,33 +41,18 @@ struct MsgWndData ~MsgWndData();
void FlagsIconSet();
- void FlagsIconUnset();
- void FlagsIconUpdate()
- {
- g_bShowStatusIconFlag ? FlagsIconSet() : FlagsIconUnset();
- }
+
void ContryIDchange(int ID)
{
- m_countryID = ID; FlagsIconUpdate();
+ m_countryID = ID; FlagsIconSet();
}
};
-struct IconList
-{
- int m_ID;
- BYTE m_TypeFlag;
- HANDLE m_hIcon;
- StatusIconData m_StatusIconData;
-
- IconList(StatusIconData *sid);
- ~IconList();
-};
-
typedef void (CALLBACK *BUFFEREDPROC)(LPARAM lParam);
void CallFunctionBuffered(BUFFEREDPROC pfnBuffProc, LPARAM lParam, BOOL fAccumulateSameParam, UINT uElapse);
void SvcFlagsEnableExtraIcons(bool bEnable, bool bUpdateDB);
-void CALLBACK UpdateStatusIcons(LPARAM lParam);
+void UpdateStatusIcons();
void SvcFlagsLoadModule();
void SvcFlagsOnModulesLoaded();
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index 92eb77a5c6..300eaf9d27 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -366,7 +366,7 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, FlagsClistChange |= SvcGenderEnableExtraIcons(0 != IsDlgButtonChecked(hDlg, CHECK_OPT_GENDER), true);
if (FlagsClistChange) pcli->pfnSetAllExtraIcons(NULL);
- if (FlagsMsgWndChange) UpdateStatusIcons(NULL);
+ if (FlagsMsgWndChange) UpdateStatusIcons();
// misc
BYTE bEnabled = IsDlgButtonChecked(hDlg, CHECK_OPT_ZODIACAVATAR);
|