diff options
author | George Hazan <george.hazan@gmail.com> | 2014-07-17 12:24:04 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-07-17 12:24:04 +0000 |
commit | 800d1885d036ef2f7f1bc6f52f8855c03fb64705 (patch) | |
tree | 8803cfad08bad536c2a2eb21bd6a423e7a00e114 /plugins/Clist_modern/src | |
parent | ebcd54e2b17388d93eb7ec9949f6571f002af259 (diff) |
- manual critical section control replaced with mir_cslock;
- unused variables removed;
git-svn-id: http://svn.miranda-ng.org/main/trunk@9838 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/src')
-rw-r--r-- | plugins/Clist_modern/src/hdr/modern_commonprototypes.h | 1 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.cpp | 200 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_tbbutton.cpp | 11 |
3 files changed, 100 insertions, 112 deletions
diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index aadbddc498..b0dc2bc203 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -61,7 +61,6 @@ extern BOOL g_mutex_bChangingMode; extern UINT g_dwMainThreadID;
extern HANDLE g_hAwayMsgThread, g_hGetTextAsyncThread, g_hSmoothAnimationThread;
extern HWND g_hwndViewModeFrame;
-extern HANDLE hSmileyAddOptionsChangedHook,hAvatarChanged,hIconChangedHook;
extern BYTE gl_TrimText;
/************************************************************************/
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 27d53a83cf..7416691b35 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -48,8 +48,6 @@ static BOOL fMouseUpped; static BYTE IsDragToScrollMode = 0;
static int StartDragPos = 0;
static int StartScrollPos = 0;
-HANDLE hSmileyAddOptionsChangedHook = NULL;
-HANDLE hIconChangedHook = NULL;
HANDLE hAckHook = NULL;
HANDLE hAvatarChanged = NULL;
static BOOL g_bSortTimerIsSet = FALSE;
@@ -115,19 +113,18 @@ static int clcHookModulesLoaded(WPARAM wParam, LPARAM lParam) clcHookIconsChanged(0, 0);
- hIconChangedHook = HookEvent(ME_SKIN2_ICONSCHANGED, clcHookIconsChanged);
+ HookEvent(ME_SKIN2_ICONSCHANGED, clcHookIconsChanged);
// Register smiley category
if (ServiceExists(MS_SMILEYADD_REGISTERCATEGORY)) {
SMADD_REGCAT rc;
-
rc.cbSize = sizeof(rc);
rc.name = "clist";
rc.dispname = Translate("Contact list smileys");
CallService(MS_SMILEYADD_REGISTERCATEGORY, 0, (LPARAM)&rc);
- hSmileyAddOptionsChangedHook = HookEvent(ME_SMILEYADD_OPTIONSCHANGED, clcHookSmileyAddOptionsChanged);
+ HookEvent(ME_SMILEYADD_OPTIONSCHANGED, clcHookSmileyAddOptionsChanged);
}
CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("List background")"/CLC"), 0);
@@ -425,7 +422,7 @@ static LRESULT clcOnCommand(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP ClcContact *contact;
int hit = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, NULL);
if (hit == -1) return 0;
- if (contact->type == CLCIT_CONTACT && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)contact->hContact)) return 0;
+ if (contact->type == CLCIT_CONTACT && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), contact->hContact)) return 0;
switch (LOWORD(wParam)) {
case POPUP_NEWSUBGROUP:
@@ -1212,7 +1209,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, CLUI_SafeSetTimer(hwnd, TIMERID_RENAME, GetDoubleClickTime(), NULL);
else if ((dat->dragStage & DRAGSTAGEM_STAGE) == DRAGSTAGE_ACTIVE) {
TCHAR Wording[500];
- int res = 0;
+ ClcContact *contDest, *contSour;
POINT pt = UNPACK_POINT(lParam);
int target = GetDropTargetInformation(hwnd, dat, pt);
switch (target) {
@@ -1220,40 +1217,36 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break;
case DROPTARGET_ONCONTACT:
- if (ServiceExists(MS_MC_ADDTOMETA)) {
- ClcContact *contDest, *contSour;
- int res;
- MCONTACT handle, hcontact;
+ cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL);
+ cliGetRowByIndex(dat, dat->selection, &contDest, NULL);
+ if (contSour->type == CLCIT_CONTACT) {
+ MCONTACT hcontact = contSour->hContact;
+ if (mir_strcmp(contSour->proto, META_PROTO)) {
+ if (!contSour->isSubcontact) {
+ MCONTACT hDest = contDest->hContact;
+ mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be converted to metacontact and '%s' be added to it?"), contDest->szText, contSour->szText);
+ int res = MessageBox(hwnd, Wording, TranslateT("Converting to metacontact"), MB_OKCANCEL | MB_ICONQUESTION);
+ if (res == 1) {
+ MCONTACT handle = CallService(MS_MC_CONVERTTOMETA, hDest, 0);
+ if (!handle)
+ return 0;
- cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL);
- cliGetRowByIndex(dat, dat->selection, &contDest, NULL);
- hcontact = contSour->hContact;
- if (contSour->type == CLCIT_CONTACT) {
- if (mir_strcmp(contSour->proto, META_PROTO)) {
- if (!contSour->isSubcontact) {
- MCONTACT hDest = contDest->hContact;
- mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be converted to metacontact and '%s' be added to it?"), contDest->szText, contSour->szText);
- res = MessageBox(hwnd, Wording, TranslateT("Converting to metacontact"), MB_OKCANCEL | MB_ICONQUESTION);
- if (res == 1) {
- handle = (MCONTACT)CallService(MS_MC_CONVERTTOMETA, (WPARAM)hDest, 0);
- if (!handle) return 0;
- CallService(MS_MC_ADDTOMETA, (WPARAM)hcontact, (LPARAM)handle);
- }
+ CallService(MS_MC_ADDTOMETA, hcontact, handle);
}
- else {
- hcontact = contSour->hContact;
- MCONTACT hfrom = contSour->subcontacts->hContact;
- MCONTACT hdest = contDest->hContact;
- mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be converted to metacontact and '%s' be added to it (remove it from '%s')?"), contDest->szText, contSour->szText, contSour->subcontacts->szText);
- res = MessageBox(hwnd, Wording, TranslateT("Converting to metacontact (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
- if (res == 1) {
- MCONTACT handle = (MCONTACT)CallService(MS_MC_CONVERTTOMETA, (WPARAM)hdest, 0);
- if (!handle)
- return 0;
-
- CallService(MS_MC_REMOVEFROMMETA, 0, (LPARAM)hcontact);
- CallService(MS_MC_ADDTOMETA, (WPARAM)hcontact, (LPARAM)handle);
- }
+ }
+ else {
+ hcontact = contSour->hContact;
+ MCONTACT hfrom = contSour->subcontacts->hContact;
+ MCONTACT hdest = contDest->hContact;
+ mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be converted to metacontact and '%s' be added to it (remove it from '%s')?"), contDest->szText, contSour->szText, contSour->subcontacts->szText);
+ int res = MessageBox(hwnd, Wording, TranslateT("Converting to metacontact (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
+ if (res == 1) {
+ MCONTACT handle = (MCONTACT)CallService(MS_MC_CONVERTTOMETA, (WPARAM)hdest, 0);
+ if (!handle)
+ return 0;
+
+ CallService(MS_MC_REMOVEFROMMETA, 0, hcontact);
+ CallService(MS_MC_ADDTOMETA, hcontact, handle);
}
}
}
@@ -1261,79 +1254,76 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break;
case DROPTARGET_ONMETACONTACT:
- {
- ClcContact *contDest, *contSour;
- cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL);
- cliGetRowByIndex(dat, dat->selection, &contDest, NULL);
- if (contSour->type == CLCIT_CONTACT) {
- if (!strcmp(contSour->proto, META_PROTO))
- break;
- if (!contSour->isSubcontact) {
- MCONTACT hcontact = contSour->hContact;
- MCONTACT handle = contDest->hContact;
- mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->szText);
- int res = MessageBox(hwnd, Wording, TranslateT("Adding contact to metacontact"), MB_OKCANCEL | MB_ICONQUESTION);
- if (res == 1) {
- if (!handle) return 0;
- CallService(MS_MC_ADDTOMETA, (WPARAM)hcontact, (LPARAM)handle);
- }
+ cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL);
+ cliGetRowByIndex(dat, dat->selection, &contDest, NULL);
+ if (contSour->type == CLCIT_CONTACT) {
+ if (!strcmp(contSour->proto, META_PROTO))
+ break;
+ if (!contSour->isSubcontact) {
+ MCONTACT hcontact = contSour->hContact;
+ MCONTACT handle = contDest->hContact;
+ mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->szText);
+ int res = MessageBox(hwnd, Wording, TranslateT("Adding contact to metacontact"), MB_OKCANCEL | MB_ICONQUESTION);
+ if (res == 1) {
+ if (!handle)
+ return 0;
+ CallService(MS_MC_ADDTOMETA, hcontact, handle);
}
- else {
- if (contSour->subcontacts == contDest) {
- MCONTACT hsour = contSour->hContact;
- mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be default?"), contSour->szText);
- int res = MessageBox(hwnd, Wording, TranslateT("Set default contact"), MB_OKCANCEL | MB_ICONQUESTION);
- if (res == 1)
- db_mc_setDefault(contDest->hContact, hsour, true);
- }
- else {
- MCONTACT hcontact = contSour->hContact;
- MCONTACT hfrom = contSour->subcontacts->hContact;
- MCONTACT handle = contDest->hContact;
- mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be removed from metacontact '%s' and added to '%s'?"), contSour->szText, contSour->subcontacts->szText, contDest->szText);
- int res = MessageBox(hwnd, Wording, TranslateT("Changing metacontacts (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
- if (res == 1) {
- if (!handle) return 0;
-
- CallService(MS_MC_REMOVEFROMMETA, 0, (LPARAM)hcontact);
- CallService(MS_MC_ADDTOMETA, (WPARAM)hcontact, (LPARAM)handle);
- }
- }
+ }
+ else if (contSour->subcontacts == contDest) {
+ MCONTACT hsour = contSour->hContact;
+ mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be default?"), contSour->szText);
+ int res = MessageBox(hwnd, Wording, TranslateT("Set default contact"), MB_OKCANCEL | MB_ICONQUESTION);
+ if (res == 1)
+ db_mc_setDefault(contDest->hContact, hsour, true);
+ }
+ else {
+ MCONTACT hcontact = contSour->hContact;
+ MCONTACT hfrom = contSour->subcontacts->hContact;
+ MCONTACT handle = contDest->hContact;
+ mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be removed from metacontact '%s' and added to '%s'?"), contSour->szText, contSour->subcontacts->szText, contDest->szText);
+ int res = MessageBox(hwnd, Wording, TranslateT("Changing metacontacts (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
+ if (res == 1) {
+ if (!handle)
+ return 0;
+
+ CallService(MS_MC_REMOVEFROMMETA, 0, hcontact);
+ CallService(MS_MC_ADDTOMETA, hcontact, handle);
}
}
}
break;
case DROPTARGET_ONSUBCONTACT:
- {
- ClcContact *contDest, *contSour;
- cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL);
- cliGetRowByIndex(dat, dat->selection, &contDest, NULL);
- if (contSour->type == CLCIT_CONTACT) {
- if (!strcmp(contSour->proto, META_PROTO))
- break;
- if (!contSour->isSubcontact) {
- MCONTACT hcontact = contSour->hContact;
- MCONTACT handle = contDest->subcontacts->hContact;
- mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->subcontacts->szText);
- int res = MessageBox(hwnd, Wording, TranslateT("Changing metacontacts (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
- if (res == 1) {
- if (!handle) return 0;
- CallService(MS_MC_ADDTOMETA, (WPARAM)hcontact, (LPARAM)handle);
- }
+ cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL);
+ cliGetRowByIndex(dat, dat->selection, &contDest, NULL);
+ if (contSour->type == CLCIT_CONTACT) {
+ if (!strcmp(contSour->proto, META_PROTO))
+ break;
+ if (!contSour->isSubcontact) {
+ MCONTACT hcontact = contSour->hContact;
+ MCONTACT handle = contDest->subcontacts->hContact;
+ mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->subcontacts->szText);
+ int res = MessageBox(hwnd, Wording, TranslateT("Changing metacontacts (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
+ if (res == 1) {
+ if (!handle)
+ return 0;
+
+ CallService(MS_MC_ADDTOMETA, hcontact, handle);
}
- else if (contSour->subcontacts != contDest->subcontacts) {
- MCONTACT hcontact = contSour->hContact;
- MCONTACT hfrom = contSour->subcontacts->hContact;
- MCONTACT handle = contDest->subcontacts->hContact;
- mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be removed from metacontact '%s' and added to '%s'?"), contSour->szText, contSour->subcontacts->szText, contDest->subcontacts->szText);
- int res = MessageBox(hwnd, Wording, TranslateT("Changing metacontacts (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
- if (res == 1) {
- if (!handle) return 0;
-
- CallService(MS_MC_REMOVEFROMMETA, 0, (LPARAM)hcontact);
- CallService(MS_MC_ADDTOMETA, (WPARAM)hcontact, (LPARAM)handle);
- }
+ }
+ else if (contSour->subcontacts != contDest->subcontacts) {
+ MCONTACT hcontact = contSour->hContact;
+ MCONTACT hfrom = contSour->subcontacts->hContact;
+ MCONTACT handle = contDest->subcontacts->hContact;
+ mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be removed from metacontact '%s' and added to '%s'?"), contSour->szText, contSour->subcontacts->szText, contDest->subcontacts->szText);
+ int res = MessageBox(hwnd, Wording, TranslateT("Changing metacontacts (moving)"), MB_OKCANCEL | MB_ICONQUESTION);
+ if (res == 1) {
+ if (!handle)
+ return 0;
+
+ CallService(MS_MC_REMOVEFROMMETA, 0, hcontact);
+ CallService(MS_MC_ADDTOMETA, hcontact, handle);
}
}
}
@@ -1455,7 +1445,7 @@ static LRESULT clcOnIntmGroupChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM w nm.hdr.idFrom = GetDlgCtrlID(hwnd);
nm.flags = 0;
nm.hItem = (HANDLE)wParam;
- SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm);
+ SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm);
dat->needsResort = 1;
}
SetTimer(hwnd, TIMERID_REBUILDAFTER, 1, NULL);
diff --git a/plugins/Clist_modern/src/modern_tbbutton.cpp b/plugins/Clist_modern/src/modern_tbbutton.cpp index 4274347583..ee5d5c521d 100644 --- a/plugins/Clist_modern/src/modern_tbbutton.cpp +++ b/plugins/Clist_modern/src/modern_tbbutton.cpp @@ -35,7 +35,6 @@ static HWND hwndToolTips = NULL; static BOOL bThemed = FALSE;
static HANDLE hButtonWindowList = NULL;
-static HANDLE hBkgChangedHook = NULL;
static int OnIconLibIconChanged(WPARAM wParam, LPARAM lParam)
{
@@ -250,11 +249,11 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam break;
case BUTTONSETMARGINS:
- if (lParam) bct->rcMargins = *(RECT*)lParam;
- else {
- RECT nillRect = {0};
+ if (!lParam) {
+ RECT nillRect = { 0 };
bct->rcMargins = nillRect;
}
+ else bct->rcMargins = *(RECT*)lParam;
break;
case BUTTONSETID:
@@ -495,8 +494,8 @@ int Buttons_OnSkinModeSettingsChanged(WPARAM wParam, LPARAM lParam) HRESULT ToolbarButtonLoadModule()
{
hButtonWindowList = WindowList_Create();
- hIconChangedHook = HookEvent(ME_SKIN2_ICONSCHANGED,OnIconLibIconChanged);
- hBkgChangedHook = HookEvent(ME_BACKGROUNDCONFIG_CHANGED,Buttons_OnSkinModeSettingsChanged);
+ HookEvent(ME_SKIN2_ICONSCHANGED, OnIconLibIconChanged);
+ HookEvent(ME_BACKGROUNDCONFIG_CHANGED, Buttons_OnSkinModeSettingsChanged);
return S_OK;
}
|