diff options
23 files changed, 660 insertions, 921 deletions
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 4a4505c48b..dea8708184 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -51,23 +51,18 @@ void DestroyTrayMenu(HMENU hMenu); //////////////// CLUI CLASS IMPLEMENTATION /////////////////////////////////
#include "hdr/modern_clui.h"
-#define STATIC_METHOD
-
CLUI* CLUI::m_pCLUI = NULL;
BOOL CLUI::m_fMainMenuInited = FALSE;
HWND CLUI::m_hWnd = NULL;
void CLUI::cliOnCreateClc(void)
{
- STATIC_METHOD;
_ASSERT( m_pCLUI );
m_pCLUI->CreateCluiFrames();
}
int CLUI::OnEvent_ModulesLoaded(WPARAM wParam,LPARAM lParam)
{
- STATIC_METHOD;
-
g_CluiData.bMetaAvail = ServiceExists(MS_MC_GETDEFAULTCONTACT) ? TRUE : FALSE;
setlocale(LC_ALL, ""); //fix for case insensitive comparing
@@ -91,15 +86,13 @@ int CLUI::OnEvent_ModulesLoaded(WPARAM wParam,LPARAM lParam) int CLUI::OnEvent_FontReload(WPARAM wParam,LPARAM lParam)
{
- STATIC_METHOD;
-
- pcli->pfnClcBroadcast( INTM_RELOADOPTIONS, wParam, lParam );
+ pcli->pfnClcBroadcast( INTM_RELOADOPTIONS, wParam, lParam );
g_CluiData.dwKeyColor = db_get_dw(NULL,"ModernSettings","KeyColor",(DWORD)SETTING_KEYCOLOR_DEFAULT);
CLUI__cliInvalidateRect( pcli->hwndContactList, 0, 0 );
- return 0;
+ return 0;
}
int CLUI::OnEvent_ContactMenuPreBuild(WPARAM wParam, LPARAM lParam)
@@ -115,48 +108,38 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM wParam, LPARAM lParam) GetClassName(hwndClist,cls,SIZEOF(cls));
hwndClist = (!lstrcmp(CLISTCONTROL_CLASS,cls))?hwndClist:pcli->hwndContactList;
hItem = (HANDLE)SendMessage(hwndClist,CLM_GETSELECTION,0,0);
- if ( !hItem) {
+ if ( !hItem)
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
- }
+
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hRenameMenuItem, (LPARAM)&mi);
- if ( !hItem || !IsHContactContact(hItem) || !db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT))
- {
+ if ( !hItem || !IsHContactContact(hItem) || !db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT)) {
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowAvatarMenuItem, (LPARAM)&mi);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideAvatarMenuItem, (LPARAM)&mi);
}
- else
- {
+ else {
int has_avatar;
if (ServiceExists(MS_AV_GETAVATARBITMAP))
- {
has_avatar = CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hItem, 0);
- }
- else
- {
+ else {
DBVARIANT dbv = {0};
- if (DBGetContactSettingTString(hItem, "ContactPhoto", "File", &dbv))
- {
+ if ( DBGetContactSettingTString(hItem, "ContactPhoto", "File", &dbv))
has_avatar = 0;
- }
- else
- {
+ else {
has_avatar = 1;
db_free(&dbv);
}
}
- if (db_get_b(hItem, "CList", "HideContactAvatar", 0))
- {
+ if ( db_get_b(hItem, "CList", "HideContactAvatar", 0)) {
mi.flags = CMIM_FLAGS | (has_avatar ? 0 : CMIF_GRAYED);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowAvatarMenuItem, (LPARAM)&mi);
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideAvatarMenuItem, (LPARAM)&mi);
}
- else
- {
+ else {
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowAvatarMenuItem, (LPARAM)&mi);
mi.flags = CMIM_FLAGS | (has_avatar ? 0 : CMIF_GRAYED);
@@ -169,9 +152,9 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM wParam, LPARAM lParam) INT_PTR CLUI::Service_ShowMainMenu(WPARAM wParam,LPARAM lParam)
{
- HMENU hMenu;
+ HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0);
+
POINT pt;
- hMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0);
GetCursorPos(&pt);
TrackPopupMenu(hMenu,TPM_TOPALIGN|TPM_LEFTALIGN|TPM_LEFTBUTTON,pt.x,pt.y,0,pcli->hwndContactList,NULL);
return 0;
@@ -179,9 +162,9 @@ INT_PTR CLUI::Service_ShowMainMenu(WPARAM wParam,LPARAM lParam) INT_PTR CLUI::Service_ShowStatusMenu(WPARAM wParam,LPARAM lParam)
{
- HMENU hMenu;
+ HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
+
POINT pt;
- hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
GetCursorPos(&pt);
TrackPopupMenu(hMenu,TPM_TOPALIGN|TPM_LEFTALIGN|TPM_LEFTBUTTON,pt.x,pt.y,0,pcli->hwndContactList,NULL);
return 0;
@@ -233,12 +216,13 @@ HRESULT CLUI::CreateCluiFrames() HookEvent(ME_SYSTEM_MODULESLOADED,CLUI::OnEvent_ModulesLoaded);
HookEvent(ME_SKIN2_ICONSCHANGED,CLUI_IconsChanged);
- HookEvent(ME_FONT_RELOAD, CLUI::OnEvent_FontReload);
+ HookEvent(ME_FONT_RELOAD, CLUI::OnEvent_FontReload);
return S_OK;
}
+
CLUI::CLUI() :
-m_hUserDll( NULL ),
-m_hDwmapiDll( NULL )
+ m_hUserDll( NULL ),
+ m_hDwmapiDll( NULL )
{
m_pCLUI = this;
g_CluiData.bSTATE = STATE_CLUI_LOADING;
@@ -278,8 +262,7 @@ CLUI::~CLUI() HRESULT CLUI::LoadDllsRuntime()
{
m_hUserDll = LoadLibrary(_T("user32.dll"));
- if (m_hUserDll)
- {
+ if (m_hUserDll) {
g_proc_UpdateLayeredWindow = (BOOL (WINAPI *)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD))GetProcAddress(m_hUserDll, "UpdateLayeredWindow");
g_proc_SetLayeredWindowAttributesNew = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(m_hUserDll, "SetLayeredWindowAttributes");
g_proc_AnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(m_hUserDll,"AnimateWindow");
@@ -289,26 +272,19 @@ HRESULT CLUI::LoadDllsRuntime() g_CluiData.fLayered = (g_CluiData.fLayered*db_get_b(NULL, "ModernData", "EnableLayering", g_CluiData.fLayered)) && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
}
- if (IsWinVerVistaPlus())
- {
- m_hDwmapiDll = LoadLibrary(_T("dwmapi.dll"));
- if (m_hDwmapiDll)
- {
- g_proc_DWMEnableBlurBehindWindow = (HRESULT (WINAPI *)(HWND, DWM_BLURBEHIND *))GetProcAddress(m_hDwmapiDll, "DwmEnableBlurBehindWindow");
- }
- }
- g_CluiData.fAeroGlass = FALSE;
+ if ( IsWinVerVistaPlus()) {
+ m_hDwmapiDll = LoadLibrary(_T("dwmapi.dll"));
+ if (m_hDwmapiDll)
+ g_proc_DWMEnableBlurBehindWindow = (HRESULT (WINAPI *)(HWND, DWM_BLURBEHIND *))GetProcAddress(m_hDwmapiDll, "DwmEnableBlurBehindWindow");
+ }
+ g_CluiData.fAeroGlass = FALSE;
return S_OK;
}
+
HRESULT CLUI::RegisterAvatarMenu()
{
- CLISTMENUITEM mi;
-
- ZeroMemory(&mi,sizeof(mi));
- mi.cbSize = sizeof(mi);
- mi.flags = 0;
- mi.pszContactOwner = NULL; //on every contact
+ CLISTMENUITEM mi = { sizeof(mi) };
CreateServiceFunction("CList/ShowContactAvatar",CLUI::Service_Menu_ShowContactAvatar);
mi.position = 2000150000;
mi.hIcon = LoadSmallIcon(g_hInst,MAKEINTRESOURCE(IDI_SHOW_AVATAR));
@@ -353,18 +329,14 @@ HRESULT CLUI::CreateUIFrames() return S_OK;
}
-
-
HRESULT CLUI::FillAlphaChannel( HDC hDC, RECT * prcParent, BYTE bAlpha)
{
-
RECT rcWindow;
GetWindowRect( m_hWnd, &rcWindow );
HRGN hRgn = CreateRectRgn(0,0,0,0);
- if ( GetWindowRgn(m_hWnd,hRgn) == ERROR )
- {
+ if ( GetWindowRgn(m_hWnd,hRgn) == ERROR) {
DeleteObject(hRgn);
hRgn = CreateRectRgn(rcWindow.left ,rcWindow.top ,rcWindow.right,rcWindow.bottom);
}
@@ -374,17 +346,16 @@ HRESULT CLUI::FillAlphaChannel( HDC hDC, RECT * prcParent, BYTE bAlpha) RECT rcBounds;
GetRgnBox(hRgn,&rcBounds);
- if ( IsRectEmpty(&rcBounds))
- {
+ if ( IsRectEmpty(&rcBounds)) {
DeleteObject(hRgn);
return S_FALSE;
}
DWORD dwRgnSize = GetRegionData( hRgn, 0, NULL );
- RGNDATA * rgnData = (RGNDATA *)malloc(dwRgnSize);
+ RGNDATA *rgnData = (RGNDATA *)malloc(dwRgnSize);
GetRegionData(hRgn,dwRgnSize,rgnData);
- RECT * pRect = (RECT *)rgnData->Buffer;
+ RECT *pRect = (RECT *)rgnData->Buffer;
for (DWORD i=0; i < rgnData->rdh.nCount; i++)
ske_SetRectOpaque( hDC, &pRect[i] );
@@ -413,8 +384,7 @@ HRESULT CLUI::CreateCLC() pcli->pfnReloadExtraIcons();
nLastRequiredHeight = 0;
- if ( g_CluiData.current_viewmode[0] == '\0' )
- {
+ if (g_CluiData.current_viewmode[0] == '\0') {
if (bOldHideOffline != (BYTE)-1)
CallService( MS_CLIST_SETHIDEOFFLINE,(WPARAM)bOldHideOffline, 0);
else
@@ -429,24 +399,21 @@ HRESULT CLUI::CreateCLC() HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
return S_OK;
+}
-};
-HRESULT CLUI::SnappingToEdge( WINDOWPOS * lpWindowPos )
+HRESULT CLUI::SnappingToEdge( WINDOWPOS *lpWindowPos )
{
//by ZORG
if ( MyMonitorFromWindow == NULL || MyGetMonitorInfo == NULL )
return S_FALSE;
- if (db_get_b(NULL,"CLUI","SnapToEdges",SETTING_SNAPTOEDGES_DEFAULT))
- {
- RECT* dr;
- MONITORINFO monInfo;
+ if (db_get_b(NULL, "CLUI", "SnapToEdges", SETTING_SNAPTOEDGES_DEFAULT)) {
HMONITOR curMonitor = MyMonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
-
+ MONITORINFO monInfo;
monInfo.cbSize = sizeof(monInfo);
MyGetMonitorInfo(curMonitor, &monInfo);
- dr = &(monInfo.rcWork);
+ RECT* dr = &(monInfo.rcWork);
// Left side
if ( lpWindowPos->x < dr->left + SNAPTOEDGESENSIVITY && lpWindowPos->x > dr->left - SNAPTOEDGESENSIVITY && g_CluiData.bBehindEdgeSettings != 1)
@@ -486,16 +453,19 @@ void UnloadAvatarOverlayIcon() BOOL CLUI_CheckOwnedByClui(HWND hWnd)
{
- HWND hWndMid, hWndClui;
- if ( !hWnd) return FALSE;
- hWndClui = pcli->hwndContactList;
- hWndMid = fnGetAncestor(hWnd,GA_ROOTOWNER);
- if (hWndMid == hWndClui) return TRUE;
- {
- TCHAR buf[255];
- GetClassName(hWndMid,buf,254);
- if ( !mir_tstrcmpi(buf,CLUIFrameSubContainerClassName)) return TRUE;
- }
+ if ( !hWnd)
+ return FALSE;
+
+ HWND hWndClui = pcli->hwndContactList;
+ HWND hWndMid = fnGetAncestor(hWnd,GA_ROOTOWNER);
+ if (hWndMid == hWndClui)
+ return TRUE;
+
+ TCHAR buf[255];
+ GetClassName(hWndMid,buf,254);
+ if ( !mir_tstrcmpi(buf, CLUIFrameSubContainerClassName))
+ return TRUE;
+
return FALSE;
}
@@ -503,8 +473,7 @@ int CLUI_ShowWindowMod(HWND hWnd, int nCmd) {
int res = 0;
- if (hWnd == pcli->hwndContactList && (nCmd == SW_HIDE || nCmd == SW_MINIMIZE))
- {
+ if (hWnd == pcli->hwndContactList && (nCmd == SW_HIDE || nCmd == SW_MINIMIZE)) {
AniAva_InvalidateAvatarPositions(NULL);
AniAva_RemoveInvalidatedAvatars();
}
@@ -525,16 +494,11 @@ int CLUI_ShowWindowMod(HWND hWnd, int nCmd) && !g_CluiData.fLayered
&& IsWinVerXPPlus()
&& g_CluiData.fSmoothAnimation
- && !g_bTransparentFlag
- )
+ && !g_bTransparentFlag)
{
if (db_get_b(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT))
- {
CLUI_SmoothAlphaTransition(hWnd, 255, 1);
- }
- else
- {
-
+ else {
int ret = ShowWindow(hWnd,nCmd);
CLUI_SmoothAlphaTransition(hWnd, 255, 1);
return ret;
@@ -548,14 +512,13 @@ static BOOL CLUI_WaitThreadsCompletion(HWND hwnd) static BYTE bEntersCount = 0;
static const BYTE bcMAX_AWAITING_RETRY = 10; //repeat awaiting only 10 times
TRACE("CLUI_WaitThreadsCompletion Enter");
- if (bEntersCount < bcMAX_AWAITING_RETRY
- && ( g_mutex_nCalcRowHeightLock ||
- g_CluiData.mutexPaintLock ||
- g_dwAwayMsgThreadID ||
- g_dwGetTextAsyncThreadID ||
- g_dwSmoothAnimationThreadID ||
- g_dwFillFontListThreadID)
- && !Miranda_Terminated())
+ if (bEntersCount < bcMAX_AWAITING_RETRY &&
+ ( g_mutex_nCalcRowHeightLock ||
+ g_CluiData.mutexPaintLock ||
+ g_dwAwayMsgThreadID ||
+ g_dwGetTextAsyncThreadID ||
+ g_dwSmoothAnimationThreadID ||
+ g_dwFillFontListThreadID) && !Miranda_Terminated())
{
TRACE("Waiting threads");
TRACEVAR("g_mutex_nCalcRowHeightLock: %x",g_mutex_nCalcRowHeightLock);
@@ -575,29 +538,30 @@ static BOOL CLUI_WaitThreadsCompletion(HWND hwnd) void CLUI_UpdateLayeredMode()
{
g_CluiData.fDisableSkinEngine = db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
- if (IsWinVer2000Plus())
- {
+ if ( IsWinVer2000Plus()) {
BOOL tLayeredFlag = TRUE;
tLayeredFlag &= (db_get_b(NULL, "ModernData", "EnableLayering", tLayeredFlag) && !g_CluiData.fDisableSkinEngine);
- if (g_CluiData.fLayered != tLayeredFlag)
- {
- LONG exStyle;
+ if (g_CluiData.fLayered != tLayeredFlag) {
BOOL fWasVisible = IsWindowVisible(pcli->hwndContactList);
- if (fWasVisible) ShowWindow(pcli->hwndContactList,SW_HIDE);
+ if (fWasVisible)
+ ShowWindow(pcli->hwndContactList,SW_HIDE);
+
//change layered mode
- exStyle = GetWindowLongPtr(pcli->hwndContactList,GWL_EXSTYLE);
+ LONG exStyle = GetWindowLongPtr(pcli->hwndContactList,GWL_EXSTYLE);
if (tLayeredFlag)
exStyle |= WS_EX_LAYERED;
else
exStyle &= ~WS_EX_LAYERED;
+
SetWindowLongPtr(pcli->hwndContactList,GWL_EXSTYLE,exStyle&~WS_EX_LAYERED);
SetWindowLongPtr(pcli->hwndContactList,GWL_EXSTYLE,exStyle);
g_CluiData.fLayered = tLayeredFlag;
Sync(CLUIFrames_SetLayeredMode, tLayeredFlag,pcli->hwndContactList);
CLUI_ChangeWindowMode();
Sync(CLUIFrames_OnClistResize_mod, 0, 0 );
- if (fWasVisible) ShowWindow(pcli->hwndContactList,SW_SHOW);
+ if (fWasVisible)
+ ShowWindow(pcli->hwndContactList,SW_SHOW);
}
}
}
@@ -605,10 +569,8 @@ void CLUI_UpdateLayeredMode() void CLUI_UpdateAeroGlass()
{
BOOL tAeroGlass = db_get_b(NULL, "ModernData", "AeroGlass", SETTING_AEROGLASS_DEFAULT) && (g_CluiData.fLayered);
- if (g_proc_DWMEnableBlurBehindWindow && (tAeroGlass != g_CluiData.fAeroGlass))
- {
- if (g_CluiData.hAeroGlassRgn)
- {
+ if (g_proc_DWMEnableBlurBehindWindow && (tAeroGlass != g_CluiData.fAeroGlass)) {
+ if (g_CluiData.hAeroGlassRgn) {
DeleteObject(g_CluiData.hAeroGlassRgn);
g_CluiData.hAeroGlassRgn = 0;
}
@@ -617,8 +579,7 @@ void CLUI_UpdateAeroGlass() bb.dwFlags = DWM_BB_ENABLE;
bb.fEnable = tAeroGlass;
- if (tAeroGlass)
- {
+ if (tAeroGlass) {
g_CluiData.hAeroGlassRgn = ske_CreateOpaqueRgn(AEROGLASS_MINALPHA, true);
bb.hRgnBlur = g_CluiData.hAeroGlassRgn;
bb.dwFlags |= DWM_BB_BLURREGION;
@@ -647,35 +608,28 @@ void CLUI_ChangeWindowMode() if (g_bTransparentFlag == 0 && g_CluiData.bCurrentAlpha != 0)
g_CluiData.bCurrentAlpha = 255;
//2- Calculate STYLES and STYLESEX
- if ( !g_CluiData.fLayered)
- {
+ if ( !g_CluiData.fLayered) {
style = 0;
styleEx = 0;
- if (db_get_b(NULL,"CList","ThinBorder",SETTING_THINBORDER_DEFAULT) || (db_get_b(NULL,"CList","NoBorder",SETTING_NOBORDER_DEFAULT)))
- {
+ if (db_get_b(NULL,"CList","ThinBorder",SETTING_THINBORDER_DEFAULT) || (db_get_b(NULL,"CList","NoBorder",SETTING_NOBORDER_DEFAULT))) {
style = WS_CLIPCHILDREN| (db_get_b(NULL,"CList","ThinBorder",SETTING_THINBORDER_DEFAULT)?WS_BORDER:0);
styleEx = WS_EX_TOOLWINDOW;
styleMaskEx |= WS_EX_APPWINDOW;
}
- else if (db_get_b(NULL,"CLUI","ShowCaption",SETTING_SHOWCAPTION_DEFAULT) && db_get_b(NULL,"CList","ToolWindow",SETTING_TOOLWINDOW_DEFAULT))
- {
+ else if (db_get_b(NULL,"CLUI","ShowCaption",SETTING_SHOWCAPTION_DEFAULT) && db_get_b(NULL,"CList","ToolWindow",SETTING_TOOLWINDOW_DEFAULT)) {
styleEx = WS_EX_TOOLWINDOW/*|WS_EX_WINDOWEDGE*/;
style = WS_CAPTION|WS_POPUPWINDOW|WS_CLIPCHILDREN|WS_THICKFRAME;
styleMaskEx |= WS_EX_APPWINDOW;
}
else if (db_get_b(NULL,"CLUI","ShowCaption",SETTING_SHOWCAPTION_DEFAULT))
- {
style = WS_CAPTION|WS_SYSMENU|WS_POPUPWINDOW|WS_CLIPCHILDREN|WS_THICKFRAME|WS_MINIMIZEBOX;
- }
- else
- {
+ else {
style = WS_POPUPWINDOW|WS_CLIPCHILDREN|WS_THICKFRAME;
styleEx = WS_EX_TOOLWINDOW/*|WS_EX_WINDOWEDGE*/;
styleMaskEx |= WS_EX_APPWINDOW;
}
}
- else
- {
+ else {
style = WS_CLIPCHILDREN;
styleEx = WS_EX_TOOLWINDOW;
styleMaskEx |= WS_EX_APPWINDOW;
@@ -685,38 +639,34 @@ void CLUI_ChangeWindowMode() styleEx |= WS_EX_LAYERED;
//4- Set Title
- {
- TCHAR titleText[255] = {0};
- DBVARIANT dbv = {0};
- if (DBGetContactSettingTString(NULL,"CList","TitleText",&dbv))
- lstrcpyn(titleText,_T(MIRANDANAME),SIZEOF(titleText));
- else
- {
- lstrcpyn(titleText,dbv.ptszVal,SIZEOF(titleText));
- db_free(&dbv);
- }
- SetWindowText(pcli->hwndContactList,titleText);
+ TCHAR titleText[255] = {0};
+ DBVARIANT dbv;
+ if ( DBGetContactSettingTString(NULL, "CList", "TitleText", &dbv))
+ lstrcpyn(titleText,_T(MIRANDANAME),SIZEOF(titleText));
+ else {
+ lstrcpyn(titleText,dbv.ptszVal,SIZEOF(titleText));
+ db_free(&dbv);
}
+ SetWindowText(pcli->hwndContactList,titleText);
+
// < ->
//1- If visible store it and hide
- if (g_CluiData.fLayered && (db_get_b(NULL,"CList","OnDesktop", SETTING_ONDESKTOP_DEFAULT)))// && !flag_bFirstTimeCall))
- {
+ if (g_CluiData.fLayered && (db_get_b(NULL,"CList","OnDesktop", SETTING_ONDESKTOP_DEFAULT))) {
SetParent(pcli->hwndContactList,NULL);
Sync( CLUIFrames_SetParentForContainers, (HWND) NULL );
UpdateWindow(pcli->hwndContactList);
g_CluiData.fOnDesktop = 0;
}
+
//5- TODO Apply Style
oldStyleEx = curStyleEx = GetWindowLongPtr(pcli->hwndContactList,GWL_EXSTYLE);
oldStyle = curStyle = GetWindowLongPtr(pcli->hwndContactList,GWL_STYLE);
curStyleEx = (curStyleEx & ~styleMaskEx) | styleEx;
curStyle = (curStyle & ~styleMask) | style;
- if (oldStyleEx != curStyleEx || oldStyle != curStyle)
- {
- if (IsWindowVisible(pcli->hwndContactList))
- {
+ if (oldStyleEx != curStyleEx || oldStyle != curStyle) {
+ if (IsWindowVisible(pcli->hwndContactList)) {
storedVisMode = TRUE;
mutex_bShowHideCalledFromAnimation = TRUE;
ShowWindow(pcli->hwndContactList,SW_HIDE);
@@ -728,44 +678,32 @@ void CLUI_ChangeWindowMode() CLUI_UpdateAeroGlass();
- if (g_CluiData.fLayered || !db_get_b(NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT))
- {
- HMENU m = GetMenu(pcli->hwndContactList);
+ if (g_CluiData.fLayered || !db_get_b(NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT)) {
+ HMENU m = GetMenu(pcli->hwndContactList);
SetMenu(pcli->hwndContactList,NULL);
- }
- else
- SetMenu(pcli->hwndContactList,g_hMenuMain);
+ }
+ else SetMenu(pcli->hwndContactList,g_hMenuMain);
if (g_CluiData.fLayered && (db_get_b(NULL,"CList","OnDesktop", SETTING_ONDESKTOP_DEFAULT)))
ske_UpdateWindowImage();
-
//6- Pin to desktop mode
- if (db_get_b(NULL,"CList","OnDesktop", SETTING_ONDESKTOP_DEFAULT))
- {
+ if (db_get_b(NULL,"CList","OnDesktop", SETTING_ONDESKTOP_DEFAULT)) {
HWND hProgMan = FindWindow(_T("Progman"),NULL);
- if (IsWindow(hProgMan))
- {
+ if (IsWindow(hProgMan)) {
SetParent(pcli->hwndContactList,hProgMan);
Sync( CLUIFrames_SetParentForContainers, (HWND) hProgMan );
g_CluiData.fOnDesktop = 1;
}
}
- else
- {
- // HWND parent = GetParent(pcli->hwndContactList);
- // HWND progman = FindWindow(_T("Progman"),NULL);
- // if (parent == progman)
- {
- SetParent(pcli->hwndContactList,NULL);
- Sync(CLUIFrames_SetParentForContainers, (HWND) NULL);
- }
+ else {
+ SetParent(pcli->hwndContactList,NULL);
+ Sync(CLUIFrames_SetParentForContainers, (HWND) NULL);
g_CluiData.fOnDesktop = 0;
}
//7- if it was visible - show
- if (storedVisMode)
- {
+ if (storedVisMode) {
ShowWindow(pcli->hwndContactList,SW_SHOW);
Sync(CLUIFrames_OnShowHide, pcli->hwndContactList,1);
}
@@ -773,8 +711,7 @@ void CLUI_ChangeWindowMode() CLUIFrames_UpdateBorders();
- if ( !g_CluiData.fLayered)
- {
+ if ( !g_CluiData.fLayered) {
HRGN hRgn1;
RECT r;
int v,h;
@@ -786,8 +723,7 @@ void CLUI_ChangeWindowMode() hRgn1 = CreateRoundRectRgn(0,0,(r.right-r.left+1),(r.bottom-r.top+1),h,h);
if ((db_get_b(NULL,"CLC","RoundCorners",SETTING_ROUNDCORNERS_DEFAULT)) && (!CallService(MS_CLIST_DOCKINGISDOCKED,0,0)))
SetWindowRgn(pcli->hwndContactList,hRgn1,1);
- else
- {
+ else {
DeleteObject(hRgn1);
SetWindowRgn(pcli->hwndContactList,NULL,1);
}
@@ -798,6 +734,7 @@ void CLUI_ChangeWindowMode() flag_bFirstTimeCall = TRUE;
AniAva_UpdateParent();
}
+
struct _tagTimerAsync
{
HWND hwnd;
@@ -805,6 +742,7 @@ struct _tagTimerAsync int Timeout;
TIMERPROC proc;
};
+
static UINT_PTR SetTimerSync(WPARAM wParam , LPARAM lParam)
{
struct _tagTimerAsync * call = (struct _tagTimerAsync *) wParam;
@@ -819,13 +757,12 @@ UINT_PTR CLUI_SafeSetTimer(HWND hwnd, int ID, int Timeout, TIMERPROC proc) int CLUI_UpdateTimer(BYTE BringIn)
{
- if (g_CluiData.nBehindEdgeState == 0)
- {
+ if (g_CluiData.nBehindEdgeState == 0) {
KillTimer(pcli->hwndContactList,TM_BRINGOUTTIMEOUT);
CLUI_SafeSetTimer(pcli->hwndContactList,TM_BRINGOUTTIMEOUT,wBehindEdgeHideDelay*100,NULL);
}
- if (bShowEventStarted == 0 && g_CluiData.nBehindEdgeState>0 )
- {
+
+ if (bShowEventStarted == 0 && g_CluiData.nBehindEdgeState > 0) {
KillTimer(pcli->hwndContactList,TM_BRINGINTIMEOUT);
bShowEventStarted = (BOOL)CLUI_SafeSetTimer(pcli->hwndContactList,TM_BRINGINTIMEOUT,wBehindEdgeShowDelay*100,NULL);
}
@@ -835,41 +772,35 @@ int CLUI_UpdateTimer(BYTE BringIn) int CLUI_HideBehindEdge()
{
int method = g_CluiData.bBehindEdgeSettings;
- if (method)
- {
- // if (DBGetContactSettingByte(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT) == 0)
- {
- RECT rcScreen;
- RECT rcWindow;
- int bordersize = 0;
- //Need to be moved out of screen
- bShowEventStarted = 0;
- //1. get work area rectangle
- Docking_GetMonitorRectFromWindow(pcli->hwndContactList,&rcScreen);
- //SystemParametersInfo(SPI_GETWORKAREA,0,&rcScreen,FALSE);
- //2. move out
- bordersize = wBehindEdgeBorderSize;
- GetWindowRect(pcli->hwndContactList,&rcWindow);
- switch (method)
- {
- case 1: //left
- rcWindow.left = rcScreen.left-(rcWindow.right-rcWindow.left)+bordersize;
- break;
- case 2: //right
- rcWindow.left = rcScreen.right-bordersize;
- break;
- }
- g_CluiData.mutexPreventDockMoving = 0;
- SetWindowPos(pcli->hwndContactList,NULL,rcWindow.left,rcWindow.top,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE);
- Sync(CLUIFrames_OnMoving,pcli->hwndContactList,&rcWindow);
- g_CluiData.mutexPreventDockMoving = 1;
-
- //3. store setting
- db_set_b(NULL, "ModernData", "BehindEdge",method);
- g_CluiData.nBehindEdgeState = method;
- return 1;
+ if (method) {
+ RECT rcScreen;
+ RECT rcWindow;
+ int bordersize = 0;
+ //Need to be moved out of screen
+ bShowEventStarted = 0;
+ //1. get work area rectangle
+ Docking_GetMonitorRectFromWindow(pcli->hwndContactList,&rcScreen);
+ //SystemParametersInfo(SPI_GETWORKAREA,0,&rcScreen,FALSE);
+ //2. move out
+ bordersize = wBehindEdgeBorderSize;
+ GetWindowRect(pcli->hwndContactList,&rcWindow);
+ switch (method) {
+ case 1: //left
+ rcWindow.left = rcScreen.left-(rcWindow.right-rcWindow.left)+bordersize;
+ break;
+ case 2: //right
+ rcWindow.left = rcScreen.right-bordersize;
+ break;
}
- return 2;
+ g_CluiData.mutexPreventDockMoving = 0;
+ SetWindowPos(pcli->hwndContactList,NULL,rcWindow.left,rcWindow.top,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE);
+ Sync(CLUIFrames_OnMoving,pcli->hwndContactList,&rcWindow);
+ g_CluiData.mutexPreventDockMoving = 1;
+
+ //3. store setting
+ db_set_b(NULL, "ModernData", "BehindEdge",method);
+ g_CluiData.nBehindEdgeState = method;
+ return 1;
}
return 0;
}
@@ -879,13 +810,12 @@ int CLUI_ShowFromBehindEdge() {
int method = g_CluiData.bBehindEdgeSettings;
bShowEventStarted = 0;
- if (g_mutex_bOnTrayRightClick)
- {
+ if (g_mutex_bOnTrayRightClick) {
g_mutex_bOnTrayRightClick = 0;
return 0;
}
- if (method)// && (DBGetContactSettingByte(NULL, "ModernData", "BehindEdge", SETTING_BEHINDEDGE_DEFAULT) == 0))
- {
+
+ if (method) {
RECT rcScreen;
RECT rcWindow;
int bordersize = 0;
@@ -894,11 +824,11 @@ int CLUI_ShowFromBehindEdge() //1. get work area rectangle
//SystemParametersInfo(SPI_GETWORKAREA,0,&rcScreen,FALSE);
Docking_GetMonitorRectFromWindow(pcli->hwndContactList,&rcScreen);
+
//2. move out
bordersize = wBehindEdgeBorderSize;
GetWindowRect(pcli->hwndContactList,&rcWindow);
- switch (method)
- {
+ switch (method) {
case 1: //left
rcWindow.left = rcScreen.left;
break;
@@ -918,7 +848,6 @@ int CLUI_ShowFromBehindEdge() return 0;
}
-
int CLUI_IsInMainWindow(HWND hwnd)
{
if (hwnd == pcli->hwndContactList) return 1;
@@ -929,36 +858,30 @@ int CLUI_IsInMainWindow(HWND hwnd) int CLUI_OnSkinLoad(WPARAM wParam, LPARAM lParam)
{
ske_LoadSkinFromDB();
-
return 0;
}
-
-
-
static LPPROTOTICKS CLUI_GetProtoTicksByProto(char * szProto)
{
int i;
- for (i=0;i < 64;i++)
- {
+ for (i=0; i < 64; i++) {
if (CycleStartTick[i].szProto == NULL) break;
if (mir_strcmp(CycleStartTick[i].szProto,szProto)) continue;
- return(&CycleStartTick[i]);
+ return &CycleStartTick[i];
}
- for (i=0;i < 64;i++)
- {
- if (CycleStartTick[i].szProto == NULL)
- {
+
+ for (i=0; i < 64; i++) {
+ if (CycleStartTick[i].szProto == NULL) {
CycleStartTick[i].szProto = mir_strdup(szProto);
CycleStartTick[i].nCycleStartTick = 0;
CycleStartTick[i].nIndex = i;
CycleStartTick[i].bGlobal = ( szProto[0] == 0 );
CycleStartTick[i].himlIconList = NULL;
- return(&CycleStartTick[i]);
+ return &CycleStartTick[i];
}
}
- return (NULL);
+ return NULL;
}
static int CLUI_GetConnectingIconForProtoCount(char *szAccoName)
@@ -968,8 +891,7 @@ static int CLUI_GetConnectingIconForProtoCount(char *szAccoName) int count = 8;
- if ( !szFolderPath[0] )
- {
+ if ( !szFolderPath[0] ) {
char szRelativePath[MAX_PATH];
GetModuleFileNameA(GetModuleHandle(NULL), szRelativePath, MAX_PATH);
char *str = strrchr( szRelativePath, '\\' );
@@ -977,29 +899,28 @@ static int CLUI_GetConnectingIconForProtoCount(char *szAccoName) CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)szRelativePath, (LPARAM)szFolderPath);
}
- if ( szAccoName )
- {
+ if ( szAccoName ) {
// first of all try to find by account name( or empty - global )
mir_snprintf( fileFull, SIZEOF(fileFull), "%s\\Icons\\proto_conn_%s.dll", szFolderPath, szAccoName );
count = ExtractIconExA(fileFull,-1,NULL,NULL,1);
if ( count ) return count;
- if ( szAccoName[0] )
- {
+ if ( szAccoName[0] ) {
// second try to find by protocol name
- PROTOACCOUNT * acc = ProtoGetAccount( szAccoName );
- if ( acc && !acc->bOldProto )
- {
+ PROTOACCOUNT *acc = ProtoGetAccount( szAccoName );
+ if (acc && !acc->bOldProto) {
mir_snprintf( fileFull, SIZEOF(fileFull), "%s\\Icons\\proto_conn_%s.dll", szFolderPath, acc->szProtoName );
count = ExtractIconExA(fileFull,-1,NULL,NULL,1);
- if ( count ) return count;
+ if (count)
+ return count;
}
}
}
// third try global
mir_snprintf( fileFull, SIZEOF(fileFull), "%s\\Icons\\proto_conn.dll", szFolderPath );
count = ExtractIconExA(fileFull,-1,NULL,NULL,1);
- if ( count ) return count;
+ if (count)
+ return count;
return 8;
}
@@ -1018,9 +939,8 @@ static HICON CLUI_ExtractIconFromPath(const char *path, BOOL * needFree) hIcon = NULL;
ExtractIconExA(fileFull,n,NULL,&hIcon,1);
if (needFree)
- {
*needFree = (hIcon != NULL);
- }
+
return hIcon;
}
@@ -1039,18 +959,17 @@ HICON CLUI_LoadIconFromExternalFile(char *filename,int i,BOOL UseLibrary,bool re mir_snprintf(szMyPath, SIZEOF(szMyPath), "%s\\Icons\\%s", szPath, filename);
mir_snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i);
if (str != NULL) *str = '\\';
- if (UseLibrary&2)
- {
+ if (UseLibrary & 2) {
BOOL nf;
HICON hi = CLUI_ExtractIconFromPath(szFullPath,&nf);
if (hi) has_proto_icon = TRUE;
if (hi && nf) DestroyIcon(hi);
}
+
if ( !UseLibrary) {
hIcon = CLUI_ExtractIconFromPath(szFullPath,needFree);
if (hIcon) return hIcon;
- if (UseLibrary)
- {
+ if (UseLibrary) {
mir_snprintf(szFullPath, SIZEOF(szFullPath), "%s,%d", szMyPath, internalidx);
hIcon = CLUI_ExtractIconFromPath(szFullPath,needFree);
if (hIcon) return hIcon;
@@ -1083,24 +1002,22 @@ static HICON CLUI_GetConnectingIconForProto(char *szAccoName, int b) BOOL needFree;
b = b-1;
- if ( szAccoName )
- {
+ if (szAccoName) {
mir_snprintf(szFullPath, SIZEOF(szFullPath), "proto_conn_%s.dll",szAccoName);
hIcon = CLUI_LoadIconFromExternalFile(szFullPath,b+1,FALSE,FALSE,NULL,NULL,NULL,0,&needFree);
if (hIcon) return hIcon;
- if ( szAccoName[0] )
- {
+ if (szAccoName[0]) {
// second try to find by protocol name
PROTOACCOUNT * acc = ProtoGetAccount( szAccoName );
- if ( acc && !acc->bOldProto )
- {
+ if (acc && !acc->bOldProto) {
mir_snprintf( szFullPath, SIZEOF(szFullPath), "proto_conn_%s.dll", acc->szProtoName );
hIcon = CLUI_LoadIconFromExternalFile(szFullPath,b+1,FALSE,FALSE,NULL,NULL,NULL,0,&needFree);
if ( hIcon ) return hIcon;
}
}
}
+
// third try global
mir_snprintf( szFullPath, SIZEOF(szFullPath), "proto_conn.dll" );
hIcon = CLUI_LoadIconFromExternalFile(szFullPath,b+1,FALSE,FALSE,NULL,NULL,NULL,0,&needFree);
@@ -1114,73 +1031,53 @@ static HICON CLUI_GetConnectingIconForProto(char *szAccoName, int b) INT_PTR CLUI_GetConnectingIconService(WPARAM wParam,LPARAM lParam)
{
int b;
- PROTOTICKS *pt = NULL;
HICON hIcon = NULL;
char *szProto = (char *)wParam;
- if ( !szProto) return 0;
-
- pt = CLUI_GetProtoTicksByProto(szProto);
+ if ( !szProto)
+ return 0;
- if (pt != NULL)
- {
- if (pt->nCycleStartTick == 0)
- {
+ PROTOTICKS *pt = CLUI_GetProtoTicksByProto(szProto);
+ if (pt != NULL) {
+ if (pt->nCycleStartTick == 0) {
CLUI_CreateTimerForConnectingIcon(ID_STATUS_CONNECTING,wParam);
pt = CLUI_GetProtoTicksByProto(szProto);
}
}
- if (pt != NULL)
- {
- if (pt->nCycleStartTick != 0 && pt->nIconsCount != 0)
- {
+ if (pt != NULL) {
+ if (pt->nCycleStartTick != 0 && pt->nIconsCount != 0) {
b = ((GetTickCount()-pt->nCycleStartTick)/(nAnimatedIconStep))%(pt->nIconsCount);
- // if (lParam)
- // hIcon = CLUI_GetConnectingIconForProto("Global",b);
- // else
if (pt->himlIconList)
hIcon = ske_ImageList_GetIcon(pt->himlIconList,b,ILD_NORMAL);
else
hIcon = NULL;
- //hIcon = CLUI_GetConnectingIconForProto(szProto,b);
- };
+ }
}
-
return (INT_PTR)hIcon;
};
static int CLUI_CreateTimerForConnectingIcon(WPARAM wParam,LPARAM lParam)
{
-
int status = (int)wParam;
- char *szProto = (char *)lParam;
- if ( !szProto) return (0);
- if ( !status) return (0);
-
- if ((g_StatusBarData.connectingIcon == 1) && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)
- {
-
- PROTOTICKS *pt = NULL;
- int cnt;
+ char *szProto = (char*)lParam;
+ if ( !szProto || !status)
+ return 0;
- pt = CLUI_GetProtoTicksByProto(szProto);
- if (pt != NULL)
- {
- if (pt->nCycleStartTick == 0)
- {
+ if ((g_StatusBarData.connectingIcon == 1) && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) {
+ PROTOTICKS *pt = CLUI_GetProtoTicksByProto(szProto);
+ if (pt != NULL) {
+ if (pt->nCycleStartTick == 0) {
KillTimer(pcli->hwndContactList,TM_STATUSBARUPDATE+pt->nIndex);
- cnt = CLUI_GetConnectingIconForProtoCount(szProto);
- if (cnt != 0)
- {
+ int cnt = CLUI_GetConnectingIconForProtoCount(szProto);
+ if (cnt != 0) {
int i=0;
nAnimatedIconStep = 100;/*DBGetContactSettingWord(NULL,"CLUI","DefaultStepConnectingIcon",100);*/
pt->nIconsCount = cnt;
if (pt->himlIconList) ImageList_Destroy(pt->himlIconList);
pt->himlIconList = ImageList_Create(16,16,ILC_MASK|ILC_COLOR32,cnt,1);
- for (i=0; i < cnt; i++)
- {
+ for (i=0; i < cnt; i++) {
HICON ic = CLUI_GetConnectingIconForProto(szProto,i);
if (ic) ImageList_AddIcon(pt->himlIconList,ic);
DestroyIcon_protect(ic);
@@ -1189,16 +1086,15 @@ static int CLUI_CreateTimerForConnectingIcon(WPARAM wParam,LPARAM lParam) pt->bTimerCreated = 1;
pt->nCycleStartTick = GetTickCount();
}
-
- };
- };
+ }
+ }
}
return 0;
}
static BOOL CALLBACK BroadcastEnumChildProc(HWND hwndChild, LPARAM lParam)
{
- MSG * pMsg = (MSG*)lParam;
+ MSG *pMsg = (MSG*)lParam;
SendNotifyMessage( hwndChild, pMsg->message, pMsg->wParam, pMsg->lParam );
EnumChildWindows( hwndChild, BroadcastEnumChildProc, lParam );
return TRUE;
@@ -1232,7 +1128,8 @@ int CLUI_ReloadCLUIOptions() g_CluiData.RightClientMargin = 0;
g_CluiData.TopClientMargin = 0;
g_CluiData.BottomClientMargin = 0;
- } else {
+ }
+ else {
//window borders
g_CluiData.LeftClientMargin = (int)db_get_b(NULL,"CLUI","LeftClientMargin",SETTING_LEFTCLIENTMARIGN_DEFAULT);
g_CluiData.RightClientMargin = (int)db_get_b(NULL,"CLUI","RightClientMargin",SETTING_RIGHTCLIENTMARIGN_DEFAULT);
@@ -1249,42 +1146,39 @@ void CLUI_DisconnectAll() {
PROTOACCOUNT **accs;
int nProtoCount;
- int nProto;
+ ProtoEnumAccounts(&nProtoCount, &accs);
- ProtoEnumAccounts( &nProtoCount, &accs );
- for (nProto = 0; nProto < nProtoCount; nProto++)
- if ( IsAccountEnabled( accs[nProto] ))
- CallProtoService( accs[nProto]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0 );
+ for (int nProto = 0; nProto < nProtoCount; nProto++)
+ if ( IsAccountEnabled(accs[nProto]))
+ CallProtoService(accs[nProto]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
}
static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state)
{
RECT ra,r1;
- // HBRUSH hbr;
HRGN treg,treg2;
- struct ClcData * dat;
if ( !fnGetMenuBarInfo )
return 1;
- dat = (struct ClcData*)GetWindowLongPtr(pcli->hwndContactTree,0);
- if ( !dat) return 1;
- GetWindowRect(hwnd,&ra);
+ ClcData *dat = (struct ClcData*)GetWindowLongPtr(pcli->hwndContactTree,0);
+ if ( !dat)
+ return 1;
+
+ GetWindowRect(hwnd, &ra);
{
MENUBARINFO mbi = {0};
mbi.cbSize = sizeof(MENUBARINFO);
fnGetMenuBarInfo(hwnd,OBJID_MENU, 0, &mbi);
- if ( !(mbi.rcBar.right-mbi.rcBar.left>0 && mbi.rcBar.bottom-mbi.rcBar.top>0)) return 1;
+ if ( !(mbi.rcBar.right-mbi.rcBar.left > 0 && mbi.rcBar.bottom-mbi.rcBar.top > 0))
+ return 1;
+
r1 = mbi.rcBar;
r1.bottom += !db_get_b(NULL,"CLUI","LineUnderMenu",SETTING_LINEUNDERMENU_DEFAULT);
- if (item < 1)
- {
+ if (item < 1) {
treg = CreateRectRgn(mbi.rcBar.left,mbi.rcBar.top,mbi.rcBar.right,r1.bottom);
- if (item == 0) //should remove item clips
- {
- int t;
- for (t = 1; t <= 2; t++)
- {
+ if (item == 0) { //should remove item clips
+ for (int t = 1; t <= 2; t++) {
fnGetMenuBarInfo(hwnd,OBJID_MENU, t, &mbi);
treg2 = CreateRectRgn(mbi.rcBar.left,mbi.rcBar.top,mbi.rcBar.right,mbi.rcBar.bottom);
CombineRgn(treg,treg,treg2,RGN_DIFF);
@@ -1293,8 +1187,7 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) }
}
- else
- {
+ else {
fnGetMenuBarInfo(hwnd,OBJID_MENU, item, &mbi);
treg = CreateRectRgn(mbi.rcBar.left,mbi.rcBar.top,mbi.rcBar.right,mbi.rcBar.bottom+!db_get_b(NULL,"CLUI","LineUnderMenu",SETTING_LINEUNDERMENU_DEFAULT));
}
@@ -1304,7 +1197,7 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) r1.bottom -= ra.top;
r1.right -= ra.left;
}
- //SelectClipRgn(hdc,NULL);
+
SelectClipRgn(hdc,treg);
DeleteObject(treg);
{
@@ -1318,11 +1211,9 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) }
if ( !g_CluiData.fDisableSkinEngine)
SkinDrawGlyph(hdc,&r1,&r1,"Main,ID=MenuBar");
- else
- {
+ else {
HBRUSH hbr = NULL;
- if (dat->hMenuBackground)
- {
+ if (dat->hMenuBackground) {
BITMAP bmp;
HBITMAP oldbm;
HDC hdcBmp;
@@ -1331,7 +1222,6 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) int destw,desth;
RECT clRect = r1;
-
// XXX: Halftone isnt supported on 9x, however the scretch problems dont happen on 98.
SetStretchBltMode(hdc, HALFTONE);
@@ -1342,73 +1232,72 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) x = clRect.left;
maxx = dat->MenuBmpUse&CLBF_TILEH?maxx = r1.right:x+1;
maxy = dat->MenuBmpUse&CLBF_TILEV?maxy = r1.bottom:y+1;
+
switch(dat->MenuBmpUse&CLBM_TYPE) {
- case CLB_STRETCH:
- if (dat->MenuBmpUse&CLBF_PROPORTIONAL) {
- if (clRect.right-clRect.left*bmp.bmHeight < clRect.bottom-clRect.top*bmp.bmWidth)
- {
- desth = clRect.bottom-clRect.top;
- destw = desth*bmp.bmWidth/bmp.bmHeight;
- }
- else
- {
- destw = clRect.right-clRect.left;
- desth = destw*bmp.bmHeight/bmp.bmWidth;
- }
- }
- else {
- destw = clRect.right-clRect.left;
- desth = clRect.bottom-clRect.top;
- }
- break;
- case CLB_STRETCHH:
- if (dat->MenuBmpUse&CLBF_PROPORTIONAL) {
- destw = clRect.right-clRect.left;
- desth = destw*bmp.bmHeight/bmp.bmWidth;
- }
- else {
- destw = clRect.right-clRect.left;
- desth = bmp.bmHeight;
- }
- break;
- case CLB_STRETCHV:
- if (dat->MenuBmpUse&CLBF_PROPORTIONAL) {
- desth = clRect.bottom-clRect.top;
- destw = desth*bmp.bmWidth/bmp.bmHeight;
- }
- else {
- destw = bmp.bmWidth;
- desth = clRect.bottom-clRect.top;
- }
- break;
- default: //clb_topleft
- destw = bmp.bmWidth;
- desth = bmp.bmHeight;
- break;
+ case CLB_STRETCH:
+ if (dat->MenuBmpUse&CLBF_PROPORTIONAL) {
+ if (clRect.right-clRect.left*bmp.bmHeight < clRect.bottom-clRect.top*bmp.bmWidth) {
+ desth = clRect.bottom-clRect.top;
+ destw = desth*bmp.bmWidth/bmp.bmHeight;
+ }
+ else {
+ destw = clRect.right-clRect.left;
+ desth = destw*bmp.bmHeight/bmp.bmWidth;
+ }
+ }
+ else {
+ destw = clRect.right-clRect.left;
+ desth = clRect.bottom-clRect.top;
+ }
+ break;
+
+ case CLB_STRETCHH:
+ if (dat->MenuBmpUse&CLBF_PROPORTIONAL) {
+ destw = clRect.right-clRect.left;
+ desth = destw*bmp.bmHeight/bmp.bmWidth;
+ }
+ else {
+ destw = clRect.right-clRect.left;
+ desth = bmp.bmHeight;
+ }
+ break;
+
+ case CLB_STRETCHV:
+ if (dat->MenuBmpUse&CLBF_PROPORTIONAL) {
+ desth = clRect.bottom-clRect.top;
+ destw = desth*bmp.bmWidth/bmp.bmHeight;
+ }
+ else {
+ destw = bmp.bmWidth;
+ desth = clRect.bottom-clRect.top;
+ }
+ break;
+
+ default: //clb_topleft
+ destw = bmp.bmWidth;
+ desth = bmp.bmHeight;
+ break;
}
if (desth && destw)
- for (y = clRect.top;y < maxy;y += desth) {
+ for (y = clRect.top;y < maxy;y += desth)
for (x = clRect.left;x < maxx;x += destw)
StretchBlt(hdc,x,y,destw,desth,hdcBmp,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);
- }
- SelectObject(hdcBmp,oldbm);
- DeleteDC(hdcBmp);
+ SelectObject(hdcBmp,oldbm);
+ DeleteDC(hdcBmp);
}
-
- else
- {
+ else {
hbr = CreateSolidBrush(dat->MenuBkColor);
FillRect(hdc,&r1,hbr);
DeleteObject(hbr);
}
- if (item != 0 && state&(ODS_SELECTED))
- {
+ if (item != 0 && state&(ODS_SELECTED)) {
hbr = CreateSolidBrush(dat->MenuBkHiColor);
FillRect(hdc,&r1,hbr);
DeleteObject(hbr);
}
}
+
SelectClipRgn(hdc,NULL);
return 0;
}
@@ -1425,21 +1314,18 @@ int CLUI_SizingGetWindowRect(HWND hwnd,RECT * rc) int CLUI_SyncGetPDNCE(WPARAM wParam, LPARAM lParam)
{
- //log0("CLUI_SyncGetPDNCE");
return CListSettings_GetCopyFromCache((pClcCacheEntry)lParam, wParam ? (DWORD) wParam : CCI_ALL );
}
int CLUI_SyncSetPDNCE(WPARAM wParam, LPARAM lParam)
{
- //log0("CLUI_SyncSetPDNCE");
return CListSettings_SetToCache((pClcCacheEntry)lParam, wParam ? (DWORD) wParam : CCI_ALL );
}
int CLUI_SyncGetShortData(WPARAM wParam, LPARAM lParam)
{
HWND hwnd = (HWND) wParam;
- struct ClcData * dat = (struct ClcData * )GetWindowLongPtr(hwnd,0);
- //log0("CLUI_SyncGetShortData");
+ struct ClcData *dat = (struct ClcData * )GetWindowLongPtr(hwnd,0);
return ClcGetShortData(dat,(struct SHORTDATA *)lParam);
}
@@ -1448,42 +1334,29 @@ int CLUI_SyncSmoothAnimation(WPARAM wParam, LPARAM lParam) return CLUI_SmoothAlphaThreadTransition((HWND)lParam);
}
-
-
int CLUI_IconsChanged(WPARAM wParam,LPARAM lParam)
{
- if (MirandaExiting()) return 0;
+ if (MirandaExiting())
+ return 0;
+
DrawMenuBar(pcli->hwndContactList);
pcli->pfnReloadExtraIcons();
pcli->pfnSetAllExtraIcons(pcli->hwndContactTree,0);
// need to update tray cause it use combined icons
pcli->pfnTrayIconIconsChanged(); //TODO: remove as soon as core will include icolib
ske_RedrawCompleteWindow();
- // pcli->pfnClcBroadcast( INTM_INVALIDATE,0,0);
return 0;
}
-
-
-
-
-
-
-
-
void CLUI_cli_LoadCluiGlobalOpts()
{
- BOOL tLayeredFlag = FALSE;
- tLayeredFlag = IsWinVer2000Plus();
+ BOOL tLayeredFlag = IsWinVer2000Plus();
tLayeredFlag &= db_get_b(NULL, "ModernData", "EnableLayering", tLayeredFlag);
-
- if (tLayeredFlag)
- {
+ if (tLayeredFlag) {
if (db_get_b(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT) == 1)
db_set_b(NULL,"CList","WindowShadow",2);
}
- else
- {
+ else {
if (db_get_b(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT) == 2)
db_set_b(NULL,"CList","WindowShadow",1);
}
@@ -1503,8 +1376,7 @@ int CLUI_TestCursorOnBorders() HWND gf = GetForegroundWindow();
GetCursorPos(&pt);
hAux = WindowFromPoint(pt);
- if (CLUI_CheckOwnedByClui(hAux))
- {
+ if (CLUI_CheckOwnedByClui(hAux)) {
if (g_bTransparentFlag) {
if ( !bTransparentFocus && gf != hwnd) {
CLUI_SmoothAlphaTransition(hwnd, db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), 1);
@@ -2779,20 +2651,11 @@ LRESULT CLUI::OnClickNotify( NMCLISTCONTROL * pnmc ) {
DWORD hitFlags;
HANDLE hItem = (HANDLE)SendMessage(pcli->hwndContactTree,CLM_HITTEST,(WPARAM)&hitFlags,MAKELPARAM(pnmc->pt.x,pnmc->pt.y));
-
- if (hitFlags & CLCHT_ONITEMEXTRA) {
- if ( !IsHContactGroup(hItem) && !IsHContactInfo(hItem)) {
- pClcCacheEntry pdnce = (pClcCacheEntry)pcli->pfnGetCacheEntry(pnmc->hItem);
- if (pdnce)
- NotifyEventHooks(g_CluiData.hEventExtraClick, (WPARAM)pnmc->hItem, pnmc->iColumn+1);
- }
- }
-
if (hItem && !(hitFlags & CLCHT_NOWHERE))
- return DefCluiWndProc( WM_NOTIFY, 0, (LPARAM)pnmc );
+ return DefCluiWndProc(WM_NOTIFY, 0, (LPARAM)pnmc);
if ((hitFlags & (CLCHT_NOWHERE | CLCHT_INLEFTMARGIN | CLCHT_BELOWITEMS)) == 0)
- return DefCluiWndProc( WM_NOTIFY, 0, (LPARAM)pnmc );
+ return DefCluiWndProc(WM_NOTIFY, 0, (LPARAM)pnmc);
if (db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) {
POINT pt;
diff --git a/plugins/Clist_mw/src/BkgrCfg.cpp b/plugins/Clist_mw/src/BkgrCfg.cpp index 8753b852d6..dba17a1ca4 100644 --- a/plugins/Clist_mw/src/BkgrCfg.cpp +++ b/plugins/Clist_mw/src/BkgrCfg.cpp @@ -64,7 +64,7 @@ static INT_PTR CALLBACK DlgProcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP int jndx;
dat->item[indx].changed = FALSE;
- dat->item[indx].useBitmap = DBGetContactSettingByte(NULL,module, "UseBitmap", DEFAULT_USEBITMAP);
+ dat->item[indx].useBitmap = db_get_b(NULL,module, "UseBitmap", DEFAULT_USEBITMAP);
dat->item[indx].bkColor = DBGetContactSettingDword(NULL,module, "BkColour", DEFAULT_BKCOLOUR);
dat->item[indx].selColor = DBGetContactSettingDword(NULL,module, "SelBkColour", DEFAULT_SELBKCOLOUR);
{
diff --git a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp index 9e32704f03..2226988142 100644 --- a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp @@ -486,11 +486,11 @@ int DBLoadFrameSettingsAtPos(int pos,int Frameid) _itoa(pos,sadd,10);
//boolean
- Frames[Frameid].collapsed = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"Collapse",sadd),Frames[Frameid].collapsed);
+ Frames[Frameid].collapsed = db_get_b(0,CLUIFrameModule,AS(buf,"Collapse",sadd),Frames[Frameid].collapsed);
- Frames[Frameid].Locked = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"Locked",sadd),Frames[Frameid].Locked);
- Frames[Frameid].visible = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"Visible",sadd),Frames[Frameid].visible);
- Frames[Frameid].TitleBar.ShowTitleBar = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"TBVisile",sadd),Frames[Frameid].TitleBar.ShowTitleBar);
+ Frames[Frameid].Locked = db_get_b(0,CLUIFrameModule,AS(buf,"Locked",sadd),Frames[Frameid].Locked);
+ Frames[Frameid].visible = db_get_b(0,CLUIFrameModule,AS(buf,"Visible",sadd),Frames[Frameid].visible);
+ Frames[Frameid].TitleBar.ShowTitleBar = db_get_b(0,CLUIFrameModule,AS(buf,"TBVisile",sadd),Frames[Frameid].TitleBar.ShowTitleBar);
Frames[Frameid].height = DBGetContactSettingWord(0,CLUIFrameModule,AS(buf,"Height",sadd),Frames[Frameid].height);
Frames[Frameid].HeightWhenCollapsed = DBGetContactSettingWord(0,CLUIFrameModule,AS(buf,"HeightCollapsed",sadd),0);
@@ -501,10 +501,10 @@ int DBLoadFrameSettingsAtPos(int pos,int Frameid) Frames[Frameid].FloatingSize.x = DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatW",sadd),100,0,1024);
Frames[Frameid].FloatingSize.y = DBGetContactSettingRangedWord(0,CLUIFrameModule,AS(buf,"FloatH",sadd),100,0,1024);
- Frames[Frameid].floating = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"Floating",sadd),0);
+ Frames[Frameid].floating = db_get_b(0,CLUIFrameModule,AS(buf,"Floating",sadd),0);
Frames[Frameid].order = DBGetContactSettingWord(0,CLUIFrameModule,AS(buf,"Order",sadd),0);
- Frames[Frameid].UseBorder = DBGetContactSettingByte(0,CLUIFrameModule,AS(buf,"UseBorder",sadd),Frames[Frameid].UseBorder);
+ Frames[Frameid].UseBorder = db_get_b(0,CLUIFrameModule,AS(buf,"UseBorder",sadd),Frames[Frameid].UseBorder);
return 0;
}
@@ -1310,7 +1310,7 @@ INT_PTR CLUIFramesCollapseUnCollapseFrame(WPARAM wParam,LPARAM lParam) ulockfrm();
return 0;
}
- if (DBGetContactSettingByte(NULL,"CLUI","AutoSize",0)) {
+ if ( db_get_b(NULL,"CLUI","AutoSize",0)) {
ulockfrm();
return 0;
}
@@ -1567,7 +1567,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam,LPARAM lParam) //override tbbtip
//clfrm->Flags != F_SHOWTBTIP;
//
- if (DBGetContactSettingByte(0,CLUIFrameModule,"RemoveAllBorders",0) == 1)
+ if ( db_get_b(0,CLUIFrameModule,"RemoveAllBorders",0) == 1)
clfrm->Flags |= F_NOBORDER;
Frames[nFramescount].dwFlags = clfrm->Flags;
@@ -1595,7 +1595,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam,LPARAM lParam) // create frame
Frames[nFramescount].TitleBar.hwnd = CreateWindow(CLUIFrameTitleBarClassName,Frames[nFramescount].name,
- (DBGetContactSettingByte(0,CLUIFrameModule,"RemoveAllTitleBarBorders",0)?0:WS_BORDER) |WS_CHILD|WS_CLIPCHILDREN|
+ ( db_get_b(0,CLUIFrameModule,"RemoveAllTitleBarBorders",0)?0:WS_BORDER) |WS_CHILD|WS_CLIPCHILDREN|
(Frames[nFramescount].TitleBar.ShowTitleBar?WS_VISIBLE:0)| WS_CLIPCHILDREN,
0,0,0,0,pcli->hwndContactList,NULL,g_hInst,NULL);
SetWindowLongPtr(Frames[nFramescount].TitleBar.hwnd,GWLP_USERDATA,Frames[nFramescount].id);
@@ -1984,13 +1984,13 @@ int OnFrameTitleBarBackgroundChange(WPARAM wParam,LPARAM lParam) {
DBVARIANT dbv;
- AlignCOLLIconToLeft = DBGetContactSettingByte(NULL,"FrameTitleBar","AlignCOLLIconToLeft",0);
+ AlignCOLLIconToLeft = db_get_b(NULL,"FrameTitleBar","AlignCOLLIconToLeft",0);
bkColour = DBGetContactSettingDword(NULL,"FrameTitleBar","BkColour",CLCDEFAULT_BKCOLOUR);
//SelBkColour = DBGetContactSettingDword(NULL,"FrameTitleBar","SelBkColour",0);
if (hBmpBackground) {DeleteObject(hBmpBackground); hBmpBackground = NULL;}
- if (DBGetContactSettingByte(NULL,"FrameTitleBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
+ if ( db_get_b(NULL,"FrameTitleBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
if (!DBGetContactSetting(NULL,"FrameTitleBar","BkBitmap",&dbv)) {
hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
mir_free(dbv.pszVal);
@@ -2320,7 +2320,7 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA }
if (( !(wParam & MK_CONTROL)) && Frames[framepos].Locked && (!(Frames[framepos].floating))) {
- if (DBGetContactSettingByte(NULL,"CLUI","ClientAreaDrag",0)) {
+ if ( db_get_b(NULL,"CLUI","ClientAreaDrag",0)) {
POINT pt;
//pt = nm->pt;
GetCursorPos(&pt);
diff --git a/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp index ba6c8e4304..c8c62c1bd4 100644 --- a/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/statusbar.cpp @@ -29,21 +29,22 @@ int extraspace; int OnStatusBarBackgroundChange()
{
- {
+ showOpts = db_get_b(NULL,"CLUI","SBarShow",1);
+ bkColour = DBGetContactSettingDword(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR);
+ if (hBmpBackground)
+ DeleteObject(hBmpBackground), hBmpBackground = NULL;
+
+ if ( db_get_b(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
DBVARIANT dbv;
- showOpts = DBGetContactSettingByte(NULL,"CLUI","SBarShow",1);
- bkColour = DBGetContactSettingDword(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR);
- if (hBmpBackground) {DeleteObject(hBmpBackground); hBmpBackground = NULL;}
- if (DBGetContactSettingByte(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)) {
- if (!DBGetContactSettingString(NULL,"StatusBar","BkBitmap",&dbv)) {
- hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP,0,(LPARAM)dbv.pszVal);
- mir_free(dbv.pszVal);
- }
+ if ( !DBGetContactSettingTString(NULL, "StatusBar", "BkBitmap", &dbv)) {
+ hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)dbv.ptszVal);
+ db_free(&dbv);
}
- backgroundBmpUse = DBGetContactSettingWord(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE);
- extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0);
}
+ backgroundBmpUse = DBGetContactSettingWord(NULL,"StatusBar","BkBmpUse",CLCDEFAULT_BKBMPUSE);
+ extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0);
+
RecreateStatusBar(pcli->hwndContactList);
if (pcli->hwndStatus) InvalidateRect(pcli->hwndStatus,NULL,TRUE);
return 0;
@@ -52,27 +53,18 @@ int OnStatusBarBackgroundChange() void DrawDataForStatusBar(LPDRAWITEMSTRUCT dis)
{
- //LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
ProtocolData *PD = (ProtocolData *)dis->itemData;
- char *szProto = (char*)dis->itemData;
- int status,x;
SIZE textSize;
boolean NeedDestroy = FALSE;
- HICON hIcon;
- HRGN hrgn;
-
- if (PD == NULL){return;}
- if (dis->hDC == NULL) {return;}
+ if (PD == NULL || dis->hDC == NULL)
+ return;
//clip it
-
- hrgn = CreateRectRgn(dis->rcItem.left, dis->rcItem.top,
- dis->rcItem.right, dis->rcItem.bottom);
-
+ HRGN hrgn = CreateRectRgn(dis->rcItem.left, dis->rcItem.top, dis->rcItem.right, dis->rcItem.bottom);
SelectClipRgn(dis->hDC, hrgn);
- szProto = PD->RealName;
+ char *szProto = PD->RealName;
#ifdef _DEBUG
{
//char buf[512];
@@ -81,44 +73,38 @@ void DrawDataForStatusBar(LPDRAWITEMSTRUCT dis) }
#endif
- status = CallProtoService(szProto,PS_GETSTATUS,0,0);
+ int status = CallProtoService(szProto,PS_GETSTATUS,0,0);
SetBkMode(dis->hDC,TRANSPARENT);
- x = dis->rcItem.left+extraspace;
-
- if (showOpts&1)
- {
- if ((DBGetContactSettingByte(NULL,"CLUI","UseConnectingIcon",1) == 1) && status < ID_STATUS_OFFLINE)
- {
- hIcon = (HICON)GetConnectingIconService((WPARAM)szProto,0);
+ int x = dis->rcItem.left+extraspace;
+ if (showOpts & 1) {
+ HICON hIcon;
+ if ( db_get_b(NULL, "CLUI", "UseConnectingIcon", 1) == 1 && status < ID_STATUS_OFFLINE) {
+ hIcon = (HICON)GetConnectingIconService((WPARAM)szProto, 0);
if (hIcon)
- {
NeedDestroy = TRUE;
- }else
- {
+ else
hIcon = LoadSkinnedProtoIcon(szProto,status);
- }
-
- }else
- {
- hIcon = LoadSkinnedProtoIcon(szProto,status);
}
+ else hIcon = LoadSkinnedProtoIcon(szProto,status);
+
DrawIconEx(dis->hDC,x,(dis->rcItem.top+dis->rcItem.bottom-GetSystemMetrics(SM_CYSMICON))>>1,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL);
if (NeedDestroy) DestroyIcon(hIcon);
x += GetSystemMetrics(SM_CXSMICON)+2;
}
else x += 2;
- if (showOpts&2) {
- TCHAR szName[64];
+ if (showOpts & 2) {
PROTOACCOUNT* pa = ProtoGetAccount(szProto);
+ TCHAR szName[64];
mir_sntprintf(szName, SIZEOF(szName), _T("%s%s"), pa->tszAccountName, showOpts&4 ? _T(" ") : _T(""));
GetTextExtentPoint32(dis->hDC, szName, (int)_tcslen(szName), &textSize);
TextOut(dis->hDC,x,(dis->rcItem.top+dis->rcItem.bottom-textSize.cy)>>1,szName,lstrlen(szName));
x += textSize.cx;
}
- if (showOpts&4) {
+
+ if (showOpts & 4) {
TCHAR *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
if (!szStatus)
szStatus = _T("");
@@ -143,18 +129,12 @@ void DrawBackGround(HWND hwnd,HDC mhdc) HFONT oFont;
HBRUSH hBrushAlternateGrey = NULL;
- HFONT hFont;
-
- //InvalidateRect(hwnd,0,FALSE);
-
- hFont = (HFONT)SendMessage(hwnd,WM_GETFONT,0,0);
-
- if (mhdc)
- {
+ HFONT hFont = (HFONT)SendMessage(hwnd,WM_GETFONT,0,0);
+ if (mhdc) {
hdc = mhdc;
rcPaint = NULL;
- }else
- {
+ }
+ else {
hdc = BeginPaint(hwnd,&paintst);
rcPaint = &(paintst.rcPaint);
}
@@ -168,110 +148,103 @@ void DrawBackGround(HWND hwnd,HDC mhdc) holdbmp = (HBITMAP)SelectObject(hdcMem,hBmpOsb);
oFont = (HFONT)SelectObject(hdcMem,hFont);
SetBkMode(hdcMem,TRANSPARENT);
- { HBRUSH hBrush,hoBrush;
-
- hBrush = CreateSolidBrush(bkColour);
- hoBrush = (HBRUSH)SelectObject(hdcMem,hBrush);
- FillRect(hdcMem,rcPaint,hBrush);
- SelectObject(hdcMem,hoBrush);
- DeleteObject(hBrush);
- if (hBmpBackground) {
- BITMAP bmp;
- int x,y;
- int maxx,maxy;
- int destw,desth;
-
- GetObject(hBmpBackground,sizeof(bmp),&bmp);
- HDC hdcBmp = CreateCompatibleDC(hdcMem);
- HDC holdbackbmp = (HDC)SelectObject(hdcBmp,hBmpBackground);
- y = backgroundBmpUse&CLBF_SCROLL?-yScroll:0;
- maxx = backgroundBmpUse&CLBF_TILEH?clRect.right:1;
- maxy = backgroundBmpUse&CLBF_TILEV?maxy = rcPaint->bottom:y+1;
- switch(backgroundBmpUse&CLBM_TYPE) {
- case CLB_STRETCH:
- if (backgroundBmpUse&CLBF_PROPORTIONAL) {
- if (clRect.right*bmp.bmHeight<clRect.bottom*bmp.bmWidth) {
- desth = clRect.bottom;
- destw = desth*bmp.bmWidth/bmp.bmHeight;
+ {
+ HBRUSH hBrush = CreateSolidBrush(bkColour);
+ HBRUSH hoBrush = (HBRUSH)SelectObject(hdcMem,hBrush);
+ FillRect(hdcMem,rcPaint,hBrush);
+ SelectObject(hdcMem,hoBrush);
+ DeleteObject(hBrush);
+ if (hBmpBackground) {
+ BITMAP bmp;
+ int x,y;
+ int maxx,maxy;
+ int destw,desth;
+
+ GetObject(hBmpBackground,sizeof(bmp),&bmp);
+ HDC hdcBmp = CreateCompatibleDC(hdcMem);
+ HDC holdbackbmp = (HDC)SelectObject(hdcBmp,hBmpBackground);
+ y = backgroundBmpUse&CLBF_SCROLL?-yScroll:0;
+ maxx = backgroundBmpUse&CLBF_TILEH?clRect.right:1;
+ maxy = backgroundBmpUse&CLBF_TILEV?maxy = rcPaint->bottom:y+1;
+ switch(backgroundBmpUse&CLBM_TYPE) {
+ case CLB_STRETCH:
+ if (backgroundBmpUse&CLBF_PROPORTIONAL) {
+ if (clRect.right*bmp.bmHeight<clRect.bottom*bmp.bmWidth) {
+ desth = clRect.bottom;
+ destw = desth*bmp.bmWidth/bmp.bmHeight;
+ }
+ else {
+ destw = clRect.right;
+ desth = destw*bmp.bmHeight/bmp.bmWidth;
+ }
}
else {
destw = clRect.right;
+ desth = clRect.bottom;
+ }
+ break;
+
+ case CLB_STRETCHH:
+ if (backgroundBmpUse&CLBF_PROPORTIONAL) {
+ destw = clRect.right;
desth = destw*bmp.bmHeight/bmp.bmWidth;
}
- }
- else {
- destw = clRect.right;
- desth = clRect.bottom;
- }
- break;
- case CLB_STRETCHH:
- if (backgroundBmpUse&CLBF_PROPORTIONAL) {
- destw = clRect.right;
- desth = destw*bmp.bmHeight/bmp.bmWidth;
- }
- else {
- destw = clRect.right;
+ else {
+ destw = clRect.right;
+ desth = bmp.bmHeight;
+ }
+ break;
+
+ case CLB_STRETCHV:
+ if (backgroundBmpUse&CLBF_PROPORTIONAL) {
+ desth = clRect.bottom;
+ destw = desth*bmp.bmWidth/bmp.bmHeight;
+ }
+ else {
+ destw = bmp.bmWidth;
+ desth = clRect.bottom;
+ }
+ break;
+
+ default: //clb_topleft
+ destw = bmp.bmWidth;
desth = bmp.bmHeight;
+ break;
}
- break;
- case CLB_STRETCHV:
- if (backgroundBmpUse&CLBF_PROPORTIONAL) {
- desth = clRect.bottom;
- destw = desth*bmp.bmWidth/bmp.bmHeight;
- }
- else {
- destw = bmp.bmWidth;
- desth = clRect.bottom;
+ desth = clRect.bottom -clRect.top;
+ for (;y<maxy;y += desth) {
+ if (y<rcPaint->top-desth) continue;
+ for (x = 0;x<maxx;x += destw)
+ StretchBlt(hdcMem,x,y,destw,desth,hdcBmp,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);
}
- break;
- default: //clb_topleft
- destw = bmp.bmWidth;
- desth = bmp.bmHeight;
- break;
+ SelectObject(hdcBmp,holdbackbmp);
+ DeleteDC(hdcBmp);
}
- desth = clRect.bottom -clRect.top;
- for (;y<maxy;y += desth) {
- if (y<rcPaint->top-desth) continue;
- for (x = 0;x<maxx;x += destw)
- StretchBlt(hdcMem,x,y,destw,desth,hdcBmp,0,0,bmp.bmWidth,bmp.bmHeight,SRCCOPY);
- }
- SelectObject(hdcBmp,holdbackbmp);
- DeleteDC(hdcBmp);
- }
}
//call to draw icons
{
- DRAWITEMSTRUCT ds;
- int nParts,nPanel;
- ProtocolData *PD;
- RECT rc,clrc;
- int startoffset,sectwidth;
-
- memset(&ds,0,sizeof(ds));
+ DRAWITEMSTRUCT ds = { 0 };
ds.hwndItem = hwnd;
ds.hDC = hdcMem;
+ int startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0);
+ int extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0);
+ int nParts = SendMessage(hwnd,SB_GETPARTS,0,0);
- startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0);
- extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0);
-
- nParts = SendMessage(hwnd,SB_GETPARTS,0,0);
- memset(&rc,0,sizeof(RECT));
+ RECT rc = { 0 }, clrc;
GetClientRect(hwnd,&clrc);
clrc.right -= clrc.left;
clrc.right -= startoffset;
- sectwidth = clrc.right/nParts;
+ int sectwidth = clrc.right/nParts;
- for (nPanel = 0;nPanel<nParts;nPanel++)
- {
- PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,0);
- if (PD == NULL){
+ for (int nPanel = 0; nPanel < nParts; nPanel++) {
+ ProtocolData *PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,0);
+ if (PD == NULL)
continue;
- }
+
SendMessage(hwnd,SB_GETRECT,(WPARAM)nPanel,(LPARAM)&rc);
- //rc.left += startoffset;
- //if (rc.left>=rc.right) rc.left = rc.right-1;
+
rc.top = 0;
rc.left = nPanel*sectwidth+startoffset;
rc.right = rc.left+sectwidth-1;
@@ -289,183 +262,123 @@ void DrawBackGround(HWND hwnd,HDC mhdc) DeleteObject(hBmpOsb);
DeleteDC(hdcMem);
paintst.fErase = FALSE;
- //DeleteObject(hFont);
if (!mhdc)
EndPaint(hwnd,&paintst);
}
-LRESULT CALLBACK StatusBarOwnerDrawProc( HWND hwnd,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam
-)
-{
-if (UseOwnerDrawStatusBar)
+LRESULT CALLBACK StatusBarOwnerDrawProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch(uMsg)
- {
- case WM_ERASEBKGND:
- {
-
- //DrawBackGround(hwnd);
+ if (UseOwnerDrawStatusBar) {
+ switch(uMsg) {
+ case WM_ERASEBKGND:
return 0;
- }
- case WM_PRINT:
- {
+
+ case WM_PRINT:
DrawBackGround(hwnd,(HDC)wParam);
return 0;
- }
- case WM_PAINT:
- {
+
+ case WM_PAINT:
DrawBackGround(hwnd,0);
return 0;
}
}
-
-}
-return (CallWindowProc(OldWindowProc,hwnd,uMsg,wParam,lParam)
- );
+ return CallWindowProc(OldWindowProc, hwnd, uMsg, wParam, lParam);
}
LRESULT CALLBACK StatusHelperProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
- {
+ switch(msg) {
case WM_CREATE:
- {
- {
- tooltipshoing = FALSE;
- //HWND label;
- //label = CreateWindow("static","Top window",WS_VISIBLE|WS_CHILD ,2,2,120,60,hwnd,NULL,g_hInst,0);
- //SendMessage(label,WM_SETFONT,(WPARAM)TitleBarFont,0);
- }
- return(FALSE);
+ tooltipshoing = FALSE;
+ return FALSE;
- }
- case WM_GETMINMAXINFO:{
+ case WM_GETMINMAXINFO:
+ if (pcli->hwndStatus) {
RECT rct;
- if (pcli->hwndStatus == 0){break;}
GetWindowRect(pcli->hwndStatus,&rct);
- memset((LPMINMAXINFO)lParam,0,sizeof(MINMAXINFO));
+ memset((LPMINMAXINFO)lParam, 0, sizeof(MINMAXINFO));
((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 5;
((LPMINMAXINFO)lParam)->ptMinTrackSize.y = rct.bottom-rct.top;
((LPMINMAXINFO)lParam)->ptMaxTrackSize.x = 1600;
((LPMINMAXINFO)lParam)->ptMaxTrackSize.y = rct.bottom-rct.top;
return 0;
- }
+ }
+ break;
case WM_NCHITTEST:
- {
-
- }
case WM_SHOWWINDOW:
- {
- {
- int res;
- if (hFrameHelperStatusBar)
- {
- res = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS,hFrameHelperStatusBar),0);
- DBWriteContactSettingByte(0,"CLUI","ShowSBar",(BYTE)((res&F_VISIBLE)?1:0));
- }
- }
-
+ if (hFrameHelperStatusBar) {
+ int res = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS,hFrameHelperStatusBar),0);
+ DBWriteContactSettingByte(0, "CLUI", "ShowSBar", (res & F_VISIBLE) != 0);
+ }
- if (tooltipshoing){
- NotifyEventHooks(hStatusBarHideToolTipEvent,0,0);
- tooltipshoing = FALSE;
- }
- return 0;
- //
+ if (tooltipshoing){
+ NotifyEventHooks(hStatusBarHideToolTipEvent, 0, 0);
+ tooltipshoing = FALSE;
}
+ return 0;
+
case WM_TIMER:
- {
- if (wParam == TM_STATUSBARHIDE)
- {
- KillTimer(hwnd,TM_STATUSBARHIDE);
-
- if (tooltipshoing){
- NotifyEventHooks(hStatusBarHideToolTipEvent,0,0);
- tooltipshoing = FALSE;
- }
-
+ if (wParam == TM_STATUSBARHIDE) {
+ KillTimer(hwnd,TM_STATUSBARHIDE);
+ if (tooltipshoing){
+ NotifyEventHooks(hStatusBarHideToolTipEvent,0,0);
+ tooltipshoing = FALSE;
}
+ }
- if (wParam == TM_STATUSBAR)
- {
- POINT pt;
- KillTimer(hwnd,TM_STATUSBAR);
-
- GetCursorPos(&pt);
- if (pt.x == lastpnt.x&&pt.y == lastpnt.y)
- {
- {
- int i,nParts;
- ProtocolData *PD;
- RECT rc;
- ScreenToClient(pcli->hwndStatus,&pt);
- nParts = SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0);
- for (i = 0;i<nParts;i++) {
- SendMessage(pcli->hwndStatus,SB_GETRECT,i,(LPARAM)&rc);
- if (PtInRect(&rc,pt)) {
- PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,i,0);
- if (PD == NULL){return 0;}
-
- NotifyEventHooks(hStatusBarShowToolTipEvent,(WPARAM)PD->RealName,0);
- SetTimer(hwnd,TM_STATUSBARHIDE,DBGetContactSettingWord(NULL,"CLUIFrames","HideToolTipTime",5000),0);
- tooltipshoing = TRUE;
-
- break;
- }
- }
-
-
-
+ if (wParam == TM_STATUSBAR) {
+ KillTimer(hwnd,TM_STATUSBAR);
+
+ POINT pt;
+ GetCursorPos(&pt);
+ if (pt.x == lastpnt.x&&pt.y == lastpnt.y) {
+ RECT rc;
+ ScreenToClient(pcli->hwndStatus, &pt);
+ int nParts = SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0);
+ for (int i = 0;i<nParts;i++) {
+ SendMessage(pcli->hwndStatus,SB_GETRECT,i,(LPARAM)&rc);
+ if (PtInRect(&rc,pt)) {
+ ProtocolData *PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,i,0);
+ if (PD == NULL)
+ return 0;
+
+ NotifyEventHooks(hStatusBarShowToolTipEvent,(WPARAM)PD->RealName,0);
+ SetTimer(hwnd,TM_STATUSBARHIDE,DBGetContactSettingWord(NULL,"CLUIFrames","HideToolTipTime",5000),0);
+ tooltipshoing = TRUE;
+ break;
}
-
-
-
}
-
}
-
- return 0;
}
+ return 0;
case WM_SETCURSOR:
- {
+ {
+ POINT pt;
+ GetCursorPos(&pt);
+ if (pt.x == lastpnt.x&&pt.y == lastpnt.y)
+ return 0;
- {
- POINT pt;
- GetCursorPos(&pt);
- if (pt.x == lastpnt.x&&pt.y == lastpnt.y)
- {
- return 0;
- }
- lastpnt = pt;
- if (tooltipshoing){
- KillTimer(hwnd,TM_STATUSBARHIDE);
- NotifyEventHooks(hStatusBarHideToolTipEvent,0,0);
- tooltipshoing = FALSE;
- }
- KillTimer(hwnd,TM_STATUSBAR);
- SetTimer(hwnd,TM_STATUSBAR,DBGetContactSettingWord(NULL,"CLC","InfoTipHoverTime",750),0);
- return 0;
- }
+ lastpnt = pt;
+ if (tooltipshoing){
+ KillTimer(hwnd,TM_STATUSBARHIDE);
+ NotifyEventHooks(hStatusBarHideToolTipEvent,0,0);
+ tooltipshoing = FALSE;
+ }
+ KillTimer(hwnd,TM_STATUSBAR);
+ SetTimer(hwnd,TM_STATUSBAR,DBGetContactSettingWord(NULL,"CLC","InfoTipHoverTime",750),0);
+ }
+ return 0;
- }
case WM_NOTIFY:
- {
- if (lParam == 0){return 0;}
- if (((LPNMHDR)lParam)->hwndFrom == pcli->hwndStatus)
- {
-
- if (((LPNMHDR)lParam)->code == WM_NCHITTEST)
- {
- LPNMMOUSE lpnmmouse = (LPNMMOUSE) lParam;
- } ;
- }
- }
+ if (lParam == 0)
+ return 0;
+
+ if (((LPNMHDR)lParam)->hwndFrom == pcli->hwndStatus)
+ if (((LPNMHDR)lParam)->code == WM_NCHITTEST)
+ LPNMMOUSE lpnmmouse = (LPNMMOUSE) lParam;
case WM_CONTEXTMENU:
KillTimer(hwnd,TM_STATUSBARHIDE);
@@ -494,7 +407,7 @@ LRESULT CALLBACK StatusHelperProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa if (b != 0&&(rc.right-rc.left) != (OldRc.right-OldRc.left)) {
OldRc = rc;
if (canloadstatusbar)
- if (DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0)||DBGetContactSettingByte(NULL,"CLUI","EqualSections",1))
+ if ( db_get_b(NULL,"CLUI","UseOwnerDrawStatusBar",0)||db_get_b(NULL,"CLUI","EqualSections",1))
CluiProtocolStatusChanged(0,0);
}
if (msg == WM_SIZE) PostMessage(pcli->hwndStatus,WM_SIZE,wParam,lParam);
@@ -536,26 +449,21 @@ HWND CreateStatusHelper(HWND parent) HANDLE CreateStatusBarFrame()
{
- CLISTFrame Frame;
- int h;
RECT rc;
+ GetWindowRect(helperhwnd,&rc);
+ int h = rc.bottom-rc.top;
- memset(&Frame,0,sizeof(Frame));
+ CLISTFrame Frame = { 0 };
Frame.cbSize = sizeof(CLISTFrame);
Frame.hWnd = helperhwnd;
Frame.align = alBottom;
Frame.hIcon = LoadSkinnedIcon (SKINICON_OTHER_MIRANDA);
- Frame.Flags = (DBGetContactSettingByte(NULL,"CLUI","ShowSBar",1)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_TCHAR;
- GetWindowRect(helperhwnd,&rc);
- h = rc.bottom-rc.top;
- Frame.height = (h == 0)?20:h;
-
-
+ Frame.Flags = ( db_get_b(NULL,"CLUI","ShowSBar",1)?F_VISIBLE:0)|F_LOCKED|F_NOBORDER|F_TCHAR;
+ Frame.height = (h == 0) ? 20 : h;
Frame.tname = _T("Status");
Frame.TBtname = TranslateT("Status Bar");
hFrameHelperStatusBar = (HANDLE)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,0);
-
return hFrameHelperStatusBar;
}
@@ -569,22 +477,20 @@ int RecreateStatusBar(HWND parent) if (hFrameHelperStatusBar) CallService(MS_CLIST_FRAMES_REMOVEFRAME,(WPARAM)hFrameHelperStatusBar,0);
helperhwnd = CreateStatusHelper(parent);
- UseOwnerDrawStatusBar = DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0);
+ UseOwnerDrawStatusBar = db_get_b(NULL,"CLUI","UseOwnerDrawStatusBar",0);
//create the status wnd
pcli->hwndStatus = CreateStatusWindow(
- ( DBGetContactSettingByte(0,"CLUI","SBarUseSizeGrip",TRUE) && (!UseOwnerDrawStatusBar)?SBARS_SIZEGRIP:0)|
- WS_CHILD | (DBGetContactSettingByte(NULL,"CLUI","ShowSBar",1)?WS_VISIBLE:0), _T(""), helperhwnd, 0);
+ ( db_get_b(0,"CLUI","SBarUseSizeGrip",TRUE) && (!UseOwnerDrawStatusBar)?SBARS_SIZEGRIP:0)|
+ WS_CHILD | ( db_get_b(NULL,"CLUI","ShowSBar",1)?WS_VISIBLE:0), _T(""), helperhwnd, 0);
OldWindowProc = (WNDPROC)GetWindowLongPtr(pcli->hwndStatus,GWLP_WNDPROC);
SetWindowLongPtr(pcli->hwndStatus,GWLP_WNDPROC,(LONG_PTR)&StatusBarOwnerDrawProc);
CreateStatusBarFrame();
- {
- SetWindowPos(helperhwnd,NULL,1,1,1,1,SWP_NOZORDER);
- CluiProtocolStatusChanged(0,0);
- CallService(MS_CLIST_FRAMES_UPDATEFRAME,-1,0);
- }
+ SetWindowPos(helperhwnd,NULL,1,1,1,1,SWP_NOZORDER);
+ CluiProtocolStatusChanged(0,0);
+ CallService(MS_CLIST_FRAMES_UPDATEFRAME,-1,0);
return 0;
}
diff --git a/plugins/Clist_mw/src/clc.cpp b/plugins/Clist_mw/src/clc.cpp index 9a52b8b4cc..0dfd111c39 100644 --- a/plugins/Clist_mw/src/clc.cpp +++ b/plugins/Clist_mw/src/clc.cpp @@ -52,13 +52,13 @@ void StatusUpdaterThread(void*) SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_LOWEST);
while (!stopStatusUpdater) {
- curdelay = DBGetContactSettingByte(hContact,"CList","StatusMsgAutoDelay",15000);
+ curdelay = db_get_b(hContact,"CList","StatusMsgAutoDelay",15000);
if (curdelay<5000) curdelay = 5000;
if ((int)(GetTickCount()-lastcheck)>curdelay)
{
lastcheck = GetTickCount();
- if (DBGetContactSettingByte(hContact,"CList","StatusMsgAuto",0)) {
+ if ( db_get_b(hContact,"CList","StatusMsgAuto",0)) {
for (i = 0; i<5; i++) {
if (hContact != NULL) {
pClcCacheEntry pdnce = (pClcCacheEntry)pcli->pfnGetCacheEntry((HANDLE)hContact);
@@ -76,7 +76,7 @@ void StatusUpdaterThread(void*) }
}
}
- //Sleep(DBGetContactSettingByte(hContact,"CList","StatusMsgAutoDelay",100));
+ //Sleep( db_get_b(hContact,"CList","StatusMsgAutoDelay",100));
Sleep(200);
}
}
@@ -89,7 +89,7 @@ HMENU BuildGroupPopupMenu( ClcGroup* group ) void SortClcByTimer (HWND hwnd)
{
KillTimer(hwnd,TIMERID_DELAYEDRESORTCLC);
- SetTimer(hwnd,TIMERID_DELAYEDRESORTCLC,DBGetContactSettingByte(NULL,"CLUI","DELAYEDTIMER",200),NULL);
+ SetTimer(hwnd,TIMERID_DELAYEDRESORTCLC,db_get_b(NULL,"CLUI","DELAYEDTIMER",200),NULL);
}
static int ClcSettingChanged(WPARAM wParam, LPARAM lParam)
diff --git a/plugins/Clist_mw/src/clcitems.cpp b/plugins/Clist_mw/src/clcitems.cpp index 5eb8a8c9d6..40d048d601 100644 --- a/plugins/Clist_mw/src/clcitems.cpp +++ b/plugins/Clist_mw/src/clcitems.cpp @@ -45,7 +45,7 @@ void AddSubcontacts(struct ClcContact * cont) cacheEntry = GetContactFullCacheEntry(cont->hContact);
OutputDebugStringA("Proceed AddSubcontacts\r\n");
subcount = (int)CallService(MS_MC_GETNUMCONTACTS,(WPARAM)cont->hContact,0);
- cont->SubExpanded = DBGetContactSettingByte(cont->hContact,"CList","Expanded",0);
+ cont->SubExpanded = db_get_b(cont->hContact,"CList","Expanded",0);
cont->isSubcontact = 0;
cont->subcontacts = (struct ClcContact *) mir_realloc(cont->subcontacts, sizeof(struct ClcContact)*subcount);
cont->SubAllocated = subcount;
@@ -54,7 +54,7 @@ void AddSubcontacts(struct ClcContact * cont) {
hsub = (HANDLE)CallService(MS_MC_GETSUBCONTACT,(WPARAM)cont->hContact,j);
cacheEntry = GetContactFullCacheEntry(hsub);
- if (!(DBGetContactSettingByte(NULL,"CLC","MetaHideOfflineSub",1) && DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT))||
+ if (!( db_get_b(NULL,"CLC","MetaHideOfflineSub",1) && db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT))||
cacheEntry->status != ID_STATUS_OFFLINE )
{
cont->subcontacts[i].hContact = cacheEntry->hContact;
@@ -335,7 +335,7 @@ void RebuildEntireList(HWND hwnd,struct ClcData *dat) ClearClcContactCache(dat,INVALID_HANDLE_VALUE);
dat->list.expanded = 1;
- dat->list.hideOffline = DBGetContactSettingByte(NULL,"CLC","HideOfflineRoot",0);
+ dat->list.hideOffline = db_get_b(NULL,"CLC","HideOfflineRoot",0);
memset( &dat->list.cl, 0, sizeof( dat->list.cl ));
dat->list.cl.increment = 30;
dat->needsResort = 1;
diff --git a/plugins/Clist_mw/src/clcopts.cpp b/plugins/Clist_mw/src/clcopts.cpp index 4bd5d53b1b..6ef5e61634 100644 --- a/plugins/Clist_mw/src/clcopts.cpp +++ b/plugins/Clist_mw/src/clcopts.cpp @@ -176,11 +176,11 @@ static INT_PTR CALLBACK DlgProcClcMetaOpts(HWND hwndDlg, UINT msg, WPARAM wParam case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_META, DBGetContactSettingByte(NULL,"CLC","Meta",0) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
- CheckDlgButton(hwndDlg, IDC_METADBLCLK, DBGetContactSettingByte(NULL,"CLC","MetaDoubleClick",0) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
- CheckDlgButton(hwndDlg, IDC_METASUBEXTRA, DBGetContactSettingByte(NULL,"CLC","MetaHideExtra",0) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
- CheckDlgButton(hwndDlg, IDC_METASUBEXTRA_IGN, DBGetContactSettingByte(NULL,"CLC","MetaIgnoreEmptyExtra",1) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
- CheckDlgButton(hwndDlg, IDC_METASUB_HIDEOFFLINE, DBGetContactSettingByte(NULL,"CLC","MetaHideOfflineSub",1) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
+ CheckDlgButton(hwndDlg, IDC_META, db_get_b(NULL,"CLC","Meta",0) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
+ CheckDlgButton(hwndDlg, IDC_METADBLCLK, db_get_b(NULL,"CLC","MetaDoubleClick",0) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
+ CheckDlgButton(hwndDlg, IDC_METASUBEXTRA, db_get_b(NULL,"CLC","MetaHideExtra",0) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
+ CheckDlgButton(hwndDlg, IDC_METASUBEXTRA_IGN, db_get_b(NULL,"CLC","MetaIgnoreEmptyExtra",1) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
+ CheckDlgButton(hwndDlg, IDC_METASUB_HIDEOFFLINE, db_get_b(NULL,"CLC","MetaHideOfflineSub",1) ? BST_CHECKED : BST_UNCHECKED); /// by FYR
return TRUE;
case WM_COMMAND:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -225,12 +225,12 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETACCEL,SIZEOF(accel), (LPARAM)&accel );
SendDlgItemMessage(hwndDlg,IDC_SMOOTHTIMESPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CLC","ScrollTime",CLCDEFAULT_SCROLLTIME),0));
}
- CheckDlgButton(hwndDlg,IDC_IDLE,DBGetContactSettingByte(NULL,"CLC","ShowIdle",CLCDEFAULT_SHOWIDLE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg,IDC_IDLE,db_get_b(NULL,"CLC","ShowIdle",CLCDEFAULT_SHOWIDLE)?BST_CHECKED:BST_UNCHECKED);
SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_SETRANGE,0,MAKELONG(64,0));
- SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingByte(NULL,"CLC","LeftMargin",CLCDEFAULT_LEFTMARGIN),0));
+ SendDlgItemMessage(hwndDlg,IDC_LEFTMARGINSPIN,UDM_SETPOS,0,MAKELONG( db_get_b(NULL,"CLC","LeftMargin",CLCDEFAULT_LEFTMARGIN),0));
SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_SETRANGE,0,MAKELONG(50,0));
- SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingByte(NULL,"CLC","GroupIndent",CLCDEFAULT_GROUPINDENT),0));
+ SendDlgItemMessage(hwndDlg,IDC_GROUPINDENTSPIN,UDM_SETPOS,0,MAKELONG( db_get_b(NULL,"CLC","GroupIndent",CLCDEFAULT_GROUPINDENT),0));
CheckDlgButton(hwndDlg,IDC_GREYOUT,DBGetContactSettingDword(NULL,"CLC","GreyoutFlags",CLCDEFAULT_GREYOUTFLAGS)?BST_CHECKED:BST_UNCHECKED);
@@ -238,7 +238,7 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam EnableWindow(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),IsDlgButtonChecked(hwndDlg,IDC_GREYOUT));
FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),greyoutValues,SIZEOF(greyoutValues),DBGetContactSettingDword(NULL,"CLC","FullGreyoutFlags",CLCDEFAULT_FULLGREYOUTFLAGS));
FillCheckBoxTree(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),offlineValues,SIZEOF(offlineValues),DBGetContactSettingDword(NULL,"CLC","OfflineModes",CLCDEFAULT_OFFLINEMODES));
- CheckDlgButton(hwndDlg,IDC_NOSCROLLBAR,DBGetContactSettingByte(NULL,"CLC","NoVScrollBar",0)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg,IDC_NOSCROLLBAR,db_get_b(NULL,"CLC","NoVScrollBar",0)?BST_CHECKED:BST_UNCHECKED);
return TRUE;
case WM_VSCROLL:
@@ -317,7 +317,7 @@ static INT_PTR CALLBACK DlgProcStatusBarBkgOpts(HWND hwndDlg, UINT msg, WPARAM w switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg,IDC_BITMAP,DBGetContactSettingByte(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg,IDC_BITMAP,db_get_b(NULL,"StatusBar","UseBitmap",CLCDEFAULT_USEBITMAP)?BST_CHECKED:BST_UNCHECKED);
SendMessage(hwndDlg,WM_USER+10,0,0);
SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_BKCOLOUR);
SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"StatusBar","BkColour",CLCDEFAULT_BKCOLOUR));
@@ -443,7 +443,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg,IDC_BITMAP,DBGetContactSettingByte(NULL,"CLC","UseBitmap",CLCDEFAULT_USEBITMAP)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg,IDC_BITMAP,db_get_b(NULL,"CLC","UseBitmap",CLCDEFAULT_USEBITMAP)?BST_CHECKED:BST_UNCHECKED);
SendMessage(hwndDlg,WM_USER+10,0,0);
SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETDEFAULTCOLOUR,0,CLCDEFAULT_BKCOLOUR);
SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"CLC","BkColour",CLCDEFAULT_BKCOLOUR));
diff --git a/plugins/Clist_mw/src/clcpaint.cpp b/plugins/Clist_mw/src/clcpaint.cpp index ea339a5975..ae5e78ec02 100644 --- a/plugins/Clist_mw/src/clcpaint.cpp +++ b/plugins/Clist_mw/src/clcpaint.cpp @@ -534,7 +534,7 @@ void InternalPaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint) }
}
- if (!Drawing->isSubcontact || (DBGetContactSettingByte(NULL,"CLC","MetaHideExtra",0) == 0)) {
+ if (!Drawing->isSubcontact || ( db_get_b(NULL,"CLC","MetaHideExtra",0) == 0)) {
//extra icons
if ( !(style & CLS_EX_MULTICOLUMNALIGNLEFT)) {
diff --git a/plugins/Clist_mw/src/clcutils.cpp b/plugins/Clist_mw/src/clcutils.cpp index c7d467e889..21188e3ddf 100644 --- a/plugins/Clist_mw/src/clcutils.cpp +++ b/plugins/Clist_mw/src/clcutils.cpp @@ -279,7 +279,7 @@ void LoadClcOptions(HWND hwnd,struct ClcData *dat) int i;
dat->style = GetWindowLongPtr(hwnd,GWL_STYLE);
- dat->MetaIgnoreEmptyExtra = DBGetContactSettingByte(NULL,"CLC","MetaIgnoreEmptyExtra",1);
+ dat->MetaIgnoreEmptyExtra = db_get_b(NULL,"CLC","MetaIgnoreEmptyExtra",1);
saveLoadClcOptions( hwnd, dat );
for (i = 0; i <= FONTID_MAX; i++)
diff --git a/plugins/Clist_mw/src/clistmod.cpp b/plugins/Clist_mw/src/clistmod.cpp index 35653a6553..c03e073457 100644 --- a/plugins/Clist_mw/src/clistmod.cpp +++ b/plugins/Clist_mw/src/clistmod.cpp @@ -48,7 +48,7 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact) char AdvancedService[255] = {0};
int nActStatus = nStatus;
HANDLE hActContact = hContact;
- if (!DBGetContactSettingByte(NULL,"CLC","Meta",0) && !strcmp(szActProto,"MetaContacts")) {
+ if (!db_get_b(NULL,"CLC","Meta",0) && !strcmp(szActProto,"MetaContacts")) {
// substitute params by mostonline contact datas
HANDLE hMostOnlineContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hActContact,0);
if (hMostOnlineContact && hMostOnlineContact != (HANDLE)CALLSERVICE_NOTFOUND) {
@@ -78,7 +78,7 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact) ////////// By FYR/////////////
int ExtIconFromStatusMode(HANDLE hContact, const char *szProto,int status)
{
-/* if ( DBGetContactSettingByte( NULL, "CLC", "Meta", 0 ) == 1 )
+/* if ( db_get_b( NULL, "CLC", "Meta", 0 ) == 1 )
return pcli->pfnIconFromStatusMode(szProto,status,hContact);
if ( szProto != NULL ) {
@@ -108,7 +108,7 @@ static int ProtocolAck(WPARAM wParam,LPARAM lParam) }
DBFreeVariant(&dbv);
}
- if ( DBGetContactSettingByte(NULL,"CList","ShowStatusMsg",0) || DBGetContactSettingByte(ack->hContact,"CList","StatusMsgAuto",0))
+ if ( db_get_b(NULL,"CList","ShowStatusMsg",0) || db_get_b(ack->hContact,"CList","StatusMsgAuto",0))
DBWriteContactSettingTString(ack->hContact, "CList", "StatusMsg", (TCHAR *)ack->lParam);
}
diff --git a/plugins/Clist_mw/src/clistopts.cpp b/plugins/Clist_mw/src/clistopts.cpp index 91c8cc155c..0ce16ec41b 100644 --- a/plugins/Clist_mw/src/clistopts.cpp +++ b/plugins/Clist_mw/src/clistopts.cpp @@ -73,26 +73,26 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED,hwndDlg,WM_USER+1));
- CheckDlgButton(hwndDlg,IDC_GAMMACORRECT,DBGetContactSettingByte(NULL,"CLC","GammaCorrect",CLCDEFAULT_GAMMACORRECT)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg,IDC_GAMMACORRECT,db_get_b(NULL,"CLC","GammaCorrect",CLCDEFAULT_GAMMACORRECT)?BST_CHECKED:BST_UNCHECKED);
SendDlgItemMessage(hwndDlg,IDC_ROWHEIGHTSPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_ROWHEIGHT),0);
SendDlgItemMessage(hwndDlg,IDC_ROWHEIGHTSPIN,UDM_SETRANGE,0,MAKELONG(255,0));
- SendDlgItemMessage(hwndDlg,IDC_ROWHEIGHTSPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingByte(NULL,"CLC","RowHeight",CLCDEFAULT_ROWHEIGHT),0));
+ SendDlgItemMessage(hwndDlg,IDC_ROWHEIGHTSPIN,UDM_SETPOS,0,MAKELONG( db_get_b(NULL,"CLC","RowHeight",CLCDEFAULT_ROWHEIGHT),0));
- CheckDlgButton(hwndDlg, IDC_ONTOP, DBGetContactSettingByte(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, DBGetContactSettingByte(NULL,"CList","HideEmptyGroups",SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, DBGetContactSettingByte(NULL,"CList","UseGroups",SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_HIDEOFFLINE, db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_HIDEEMPTYGROUPS, db_get_b(NULL,"CList","HideEmptyGroups",SETTING_HIDEEMPTYGROUPS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, db_get_b(NULL,"CList","UseGroups",SETTING_USEGROUPS_DEFAULT) ? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton(hwndDlg, IDC_SORTBYNAME,
- !DBGetContactSettingByte(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT) &&
- !DBGetContactSettingByte(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ !db_get_b(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT) &&
+ !db_get_b(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SORTBYSTATUS, DBGetContactSettingByte(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_NOOFFLINEMOVE, DBGetContactSettingByte(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SORTBYSTATUS, db_get_b(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_NOOFFLINEMOVE, db_get_b(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SORTBYPROTO, DBGetContactSettingByte(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, DBGetContactSettingByte(NULL,"CList","ConfirmDelete",SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOHIDE, DBGetContactSettingByte(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SORTBYPROTO, db_get_b(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CONFIRMDELETE, db_get_b(NULL,"CList","ConfirmDelete",SETTING_CONFIRMDELETE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOHIDE, db_get_b(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIME),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE));
EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE));
{
@@ -109,14 +109,14 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETRANGE,0,MAKELONG(900,1));
SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),0));
- CheckDlgButton(hwndDlg, IDC_ONECLK, DBGetContactSettingByte(NULL,"CList","Tray1Click",SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, DBGetContactSettingByte(NULL,"CList","AlwaysStatus",SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !DBGetContactSettingByte(NULL,"CList","AlwaysMulti",SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DONTCYCLE, DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CYCLE, DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MULTITRAY, DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, DBGetContactSettingByte(NULL,"CList","DisableTrayFlash",0) == 1 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ICONBLINK, DBGetContactSettingByte(NULL,"CList","NoIconBlink",0) == 1 ? BST_CHECKED : BST_UNCHECKED );
+ CheckDlgButton(hwndDlg, IDC_ONECLK, db_get_b(NULL,"CList","Tray1Click",SETTING_TRAY1CLICK_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, db_get_b(NULL,"CList","AlwaysStatus",SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI, !db_get_b(NULL,"CList","AlwaysMulti",SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DONTCYCLE, db_get_b(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CYCLE, db_get_b(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MULTITRAY, db_get_b(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, db_get_b(NULL,"CList","DisableTrayFlash",0) == 1 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ICONBLINK, db_get_b(NULL,"CList","NoIconBlink",0) == 1 ? BST_CHECKED : BST_UNCHECKED );
if (IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)) {
EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIMESPIN),FALSE);
diff --git a/plugins/Clist_mw/src/clistsettings.cpp b/plugins/Clist_mw/src/clistsettings.cpp index fc843229ee..90154389a1 100644 --- a/plugins/Clist_mw/src/clistsettings.cpp +++ b/plugins/Clist_mw/src/clistsettings.cpp @@ -129,10 +129,10 @@ void CheckPDNCE(ClcCacheEntry *_pdnce) }
if (pdnce->bIsHidden == -1)
- pdnce->bIsHidden = DBGetContactSettingByte(pdnce->hContact,"CList","bIsHidden",0);
+ pdnce->bIsHidden = db_get_b(pdnce->hContact,"CList","bIsHidden",0);
if (pdnce->noHiddenOffline == -1)
- pdnce->noHiddenOffline = DBGetContactSettingByte(pdnce->hContact,"CList","noOffline",0);
+ pdnce->noHiddenOffline = db_get_b(pdnce->hContact,"CList","noOffline",0);
if ( pdnce->IdleTS == -1 )
pdnce->IdleTS = DBGetContactSettingDword(pdnce->hContact,pdnce->szProto,"IdleTS",0);
@@ -141,10 +141,10 @@ void CheckPDNCE(ClcCacheEntry *_pdnce) pdnce->ApparentMode = DBGetContactSettingWord(pdnce->hContact,pdnce->szProto,"ApparentMode",0);
if (pdnce->NotOnList == -1)
- pdnce->NotOnList = DBGetContactSettingByte(pdnce->hContact,"CList","NotOnList",0);
+ pdnce->NotOnList = db_get_b(pdnce->hContact,"CList","NotOnList",0);
if (pdnce->IsExpanded == -1)
- pdnce->IsExpanded = DBGetContactSettingByte(pdnce->hContact,"CList","Expanded",0);
+ pdnce->IsExpanded = db_get_b(pdnce->hContact,"CList","Expanded",0);
}
void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,pClcCacheEntry pdnce,int SettingType)
@@ -299,10 +299,10 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam) if (cws->value.type == DBVT_WORD&&!strcmp(cws->szSetting, "Status")) {
if (!(pdnce->bIsHidden == 1)) {
- if (DBGetContactSettingByte((HANDLE)NULL,"CList","ShowStatusMsg",0)||DBGetContactSettingByte((HANDLE)wParam,"CList","StatusMsgAuto",0))
+ if ( db_get_b((HANDLE)NULL,"CList","ShowStatusMsg",0)||db_get_b((HANDLE)wParam,"CList","StatusMsgAuto",0))
DBWriteContactSettingString((HANDLE)wParam, "CList", "StatusMsg", "");
- if (DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) {
+ if ( db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) {
// User's state is changing, and we are hideOffline-ing
if (cws->value.wVal == ID_STATUS_OFFLINE) {
diff --git a/plugins/Clist_mw/src/clui.cpp b/plugins/Clist_mw/src/clui.cpp index 8e53dedda5..08fb0b97db 100644 --- a/plugins/Clist_mw/src/clui.cpp +++ b/plugins/Clist_mw/src/clui.cpp @@ -219,7 +219,7 @@ HICON LoadIconFromExternalFile(char *filename,int i,boolean UseLibrary,boolean r void RegisterProtoIcons (char *protoname)
{
- if ( DBGetContactSettingByte(NULL,"CList","UseProtoIconFromIcoLib",1))
+ if ( db_get_b(NULL,"CList","UseProtoIconFromIcoLib",1))
{
int i;
char buf[256];
@@ -282,7 +282,7 @@ HICON GetConnectingIconForProto_DLL(char *szProto,int b) HICON GetConnectingIconForProto(char *szProto,int b)
{
- if ( DBGetContactSettingByte(NULL,"CList","UseProtoIconFromIcoLib",1)) {
+ if ( db_get_b(NULL,"CList","UseProtoIconFromIcoLib",1)) {
HICON hIcon = 0;
char buf[256];
sprintf(buf,"%s #%d",szProto,b);
@@ -324,7 +324,7 @@ int CreateTimerForConnectingIcon(WPARAM wParam,LPARAM lParam) if (!szProto) return 0;
if (!status) return 0;
- if (( DBGetContactSettingByte(NULL,"CLUI","UseConnectingIcon",1) == 1) && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) {
+ if (( db_get_b(NULL,"CLUI","UseConnectingIcon",1) == 1) && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) {
ProtoTicks *pt = NULL;
int cnt;
@@ -333,7 +333,7 @@ int CreateTimerForConnectingIcon(WPARAM wParam,LPARAM lParam) if (pt->CycleStartTick == 0) {
KillTimer(pcli->hwndContactList,TM_STATUSBARUPDATE+pt->n);
cnt = GetConnectingIconForProtoCount(szProto);
- if ( DBGetContactSettingByte(NULL,"Clist","UseProtoIconFromIcoLib",1))
+ if ( db_get_b(NULL,"Clist","UseProtoIconFromIcoLib",1))
cnt = 8;
if (cnt != 0) {
@@ -370,13 +370,13 @@ HWND PreCreateCLC(HWND parent) {
pcli->hwndContactTree = CreateWindow(CLISTCONTROL_CLASS,_T(""),
WS_CHILD|WS_CLIPCHILDREN|CLS_CONTACTLIST
- |(DBGetContactSettingByte(NULL,"CList","UseGroups",SETTING_USEGROUPS_DEFAULT)?CLS_USEGROUPS:0)
+ |( db_get_b(NULL,"CList","UseGroups",SETTING_USEGROUPS_DEFAULT)?CLS_USEGROUPS:0)
|CLS_HIDEOFFLINE
- //|(DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CLS_HIDEOFFLINE:0)
- |(DBGetContactSettingByte(NULL,"CList","HideEmptyGroups",SETTING_HIDEEMPTYGROUPS_DEFAULT)?CLS_HIDEEMPTYGROUPS:0)
- |(DBGetContactSettingByte(NULL,"CList","ShowStatusMessages",1)?CLS_SHOWSTATUSMESSAGES:0)
+ //|( db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CLS_HIDEOFFLINE:0)
+ |( db_get_b(NULL,"CList","HideEmptyGroups",SETTING_HIDEEMPTYGROUPS_DEFAULT)?CLS_HIDEEMPTYGROUPS:0)
+ |( db_get_b(NULL,"CList","ShowStatusMessages",1)?CLS_SHOWSTATUSMESSAGES:0)
|CLS_MULTICOLUMN
- //|DBGetContactSettingByte(NULL,"CLUI","ExtraIconsAlignToLeft",1)?CLS_EX_MULTICOLUMNALIGNLEFT:0
+ //|db_get_b(NULL,"CLUI","ExtraIconsAlignToLeft",1)?CLS_EX_MULTICOLUMNALIGNLEFT:0
,0,0,0,0,parent,NULL,g_hInst,NULL);
return pcli->hwndContactTree;
@@ -405,7 +405,7 @@ int CreateCLC(HWND parent) lastreqh = 0;
CallService(MS_CLIST_SETHIDEOFFLINE,(WPARAM)oldhideoffline,0);
- int state = DBGetContactSettingByte(NULL,"CList","State",SETTING_STATE_NORMAL);
+ int state = db_get_b(NULL,"CList","State",SETTING_STATE_NORMAL);
if (state == SETTING_STATE_NORMAL) ShowWindow(pcli->hwndContactList, SW_SHOW);
else if (state == SETTING_STATE_MINIMIZED) ShowWindow(pcli->hwndContactList, SW_SHOWMINIMIZED);
@@ -482,18 +482,18 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case WM_CREATE:
TranslateMenu(GetMenu(hwnd));
DrawMenuBar(hwnd);
- showOpts = DBGetContactSettingByte(NULL,"CLUI","SBarShow",1);
+ showOpts = db_get_b(NULL,"CLUI","SBarShow",1);
//create the status wnd
- //pcli->hwndStatus == CreateStatusWindow(WS_CHILD | (DBGetContactSettingByte(NULL,"CLUI","ShowSBar",1)?WS_VISIBLE:0), "", hwnd, 0);
+ //pcli->hwndStatus == CreateStatusWindow(WS_CHILD | ( db_get_b(NULL,"CLUI","ShowSBar",1)?WS_VISIBLE:0), "", hwnd, 0);
CluiProtocolStatusChanged(0,0);
hMsgGetProfile = RegisterWindowMessageA( "Miranda::GetProfile" ); // don't localise
- if ( DBGetContactSettingByte( NULL, "CList", "Transparent", 0 )) {
+ if ( db_get_b( NULL, "CList", "Transparent", 0 )) {
SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
if ( MySetLayeredWindowAttributes )
- MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA);
+ MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA);
}
transparentFocus = 1;
return FALSE;
@@ -522,7 +522,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l DBWriteContactSettingDword(NULL,"CList","Width",(DWORD)(rc.right - rc.left));
}
if ( wParam == SIZE_MINIMIZED ) {
- if ( DBGetContactSettingByte(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT )) {
+ if ( db_get_b(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT )) {
ShowWindow(hwnd, SW_HIDE);
DBWriteContactSettingByte(NULL,"CList","State",SETTING_STATE_HIDDEN);
}
@@ -607,9 +607,9 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l int maxHeight,newHeight;
int winstyle;
- if ( !disableautoupd && DBGetContactSettingByte( NULL, "CLUI", "AutoSize", 0 )) {
+ if ( !disableautoupd && db_get_b( NULL, "CLUI", "AutoSize", 0 )) {
if ( !CallService(MS_CLIST_DOCKINGISDOCKED,0,0) && hFrameContactTree != 0 ) {
- maxHeight = DBGetContactSettingByte(NULL,"CLUI","MaxSizeHeight",75);
+ maxHeight = db_get_b(NULL,"CLUI","MaxSizeHeight",75);
GetWindowRect(hwnd,&rcWindow);
GetWindowRect(pcli->hwndContactTree,&rcTree);
winstyle = GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE);
@@ -620,7 +620,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (newHeight != rcWindow.bottom - rcWindow.top ) {
if (newHeight>(rcWorkArea.bottom-rcWorkArea.top)*maxHeight/100)
newHeight = (rcWorkArea.bottom-rcWorkArea.top)*maxHeight/100;
- if (DBGetContactSettingByte(NULL,"CLUI","AutoSizeUpward",0)) {
+ if ( db_get_b(NULL,"CLUI","AutoSizeUpward",0)) {
rcWindow.top = rcWindow.bottom-newHeight;
if (rcWindow.top<rcWorkArea.top) rcWindow.top = rcWorkArea.top;
}
@@ -637,29 +637,6 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l } } } }
return TRUE;
}
- case NM_CLICK:
- {
- NMCLISTCONTROL *nm = (NMCLISTCONTROL*)lParam;
- DWORD hitFlags;
- HANDLE hItem = (HANDLE)SendMessage(pcli->hwndContactTree,CLM_HITTEST,(WPARAM)&hitFlags,MAKELPARAM(nm->pt.x,nm->pt.y));
-
- if (hitFlags & CLCHT_ONITEMEXTRA)
- if (!IsHContactGroup(hItem) && !IsHContactInfo(hItem)) {
- pClcCacheEntry pdnce = (pClcCacheEntry)pcli->pfnGetCacheEntry(nm->hItem);
-// if (pdnce)
-// NotifyEventHooks(hExtraImageClick, (WPARAM)nm->hItem, nm->iColumn+1);
- }
-
- if (hItem) break;
- if ((hitFlags&(CLCHT_NOWHERE|CLCHT_INLEFTMARGIN|CLCHT_BELOWITEMS)) == 0) break;
- if (DBGetContactSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) {
- POINT pt;
- pt = nm->pt;
- ClientToScreen(pcli->hwndContactTree,&pt);
- return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE|HTCAPTION,MAKELPARAM(pt.x,pt.y));
- }
- return TRUE;
- }
}
}
else if (((LPNMHDR)lParam)->hwndFrom == pcli->hwndStatus) {
@@ -674,7 +651,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l int menuid;
int startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0);
int extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0);
- boolean UseOwnerDrawStatusBar = DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0);
+ boolean UseOwnerDrawStatusBar = db_get_b(NULL,"CLUI","UseOwnerDrawStatusBar",0);
hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
nParts = SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0);
@@ -685,20 +662,16 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (nm->pt.x < rc.left) return FALSE;
}
else {
- if (!((startoffset) != 0&&UseOwnerDrawStatusBar))
- {
+ if ( !((startoffset) != 0 && UseOwnerDrawStatusBar)) {
nPanel = nm->dwItemSpec;
SendMessage(pcli->hwndStatus,SB_GETRECT,nPanel,(LPARAM)&rc);
}
else {
- RECT clrc;
- int sectwidth;
-
- memset(&rc,0,sizeof(RECT));
+ RECT clrc = { 0 };
GetClientRect(pcli->hwndStatus,&clrc);
clrc.right -= clrc.left;
clrc.right -= startoffset;
- sectwidth = clrc.right/nParts;
+ int sectwidth = clrc.right/nParts;
for (nPanel = 0;nPanel<nParts;nPanel++) {
PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,0);
@@ -722,10 +695,9 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (menuid<0){break;}
hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
{
- int i;
unsigned int cpnl = 0;
int mcnt = GetMenuItemCount(hMenu);
- for (i = 0; i<mcnt; ++i) {
+ for (int i = 0; i<mcnt; ++i) {
HMENU hMenus = GetSubMenu(hMenu, i);
if (hMenus && cpnl++ == menuid) {
hMenu = hMenus;
@@ -733,37 +705,31 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l }
}
}
- {
- char buf[256];
- sprintf(buf,"nPanel: %d, PD->protopos: %d,PD->RealName %s\r\n",nPanel,PD->protopos,PD->RealName);
- OutputDebugStringA(buf);
- }
if (hMenu != NULL) {
GetCursorPos(&pt);
TrackPopupMenu(hMenu,TPM_BOTTOMALIGN|TPM_LEFTALIGN,pt.x,pt.y,0,hwnd,NULL);
- } }
+ }
+ }
return TRUE;
}
break;
case WM_DESTROY:
- {
- //saving state
- int state = DBGetContactSettingByte(NULL,"CList","State",SETTING_STATE_NORMAL);
+ //saving state
+ int state = db_get_b(NULL,"CList","State",SETTING_STATE_NORMAL);
- FreeProtocolData();
- if ( state == SETTING_STATE_NORMAL )
- ShowWindow(hwnd,SW_HIDE);
+ FreeProtocolData();
+ if (state == SETTING_STATE_NORMAL)
+ ShowWindow(hwnd,SW_HIDE);
- CallService(MS_CLIST_FRAMES_REMOVEFRAME,(WPARAM)hFrameContactTree,0);
- DestroyWindow(pcli->hwndContactTree);
- pcli->hwndContactList = NULL;
+ CallService(MS_CLIST_FRAMES_REMOVEFRAME,(WPARAM)hFrameContactTree,0);
+ DestroyWindow(pcli->hwndContactTree);
+ pcli->hwndContactList = NULL;
- UnLoadCLUIFramesModule();
- DBWriteContactSettingByte(NULL,"CList","State",(BYTE)state);
- PostQuitMessage(0);
- }
+ UnLoadCLUIFramesModule();
+ DBWriteContactSettingByte(NULL, "CList", "State", (BYTE)state);
+ PostQuitMessage(0);
break;
}
@@ -774,7 +740,6 @@ int LoadCLUIModule(void) {
DBVARIANT dbv;
TCHAR titleText[256];
- int laster;
canloadstatusbar = FALSE;
hFrameContactTree = 0;
@@ -799,19 +764,18 @@ int LoadCLUIModule(void) DBFreeVariant(&dbv);
}
- oldhideoffline = DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT);
+ oldhideoffline = db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT);
- laster = GetLastError();
+ int laster = GetLastError();
PreCreateCLC(pcli->hwndContactList);
// create status bar frame
CreateStatusBarhWnd(pcli->hwndContactList);
- { //int state = DBGetContactSettingByte(NULL,"CList","State",SETTING_STATE_NORMAL);
- hMenuMain = GetMenu(pcli->hwndContactList);
- if (!DBGetContactSettingByte(NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT)) SetMenu(pcli->hwndContactList,NULL);
- SetWindowPos(pcli->hwndContactList, DBGetContactSettingByte(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
- }
+ hMenuMain = GetMenu(pcli->hwndContactList);
+ if ( !db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT))
+ SetMenu(pcli->hwndContactList, NULL);
+ SetWindowPos(pcli->hwndContactList, db_get_b(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
lastreqh = 0;
return 0;
@@ -819,9 +783,7 @@ int LoadCLUIModule(void) void UnloadCLUIModule()
{
- int i;
-
- for ( i = 0; i < SIZEOF(CycleStartTick); i++ )
- if ( CycleStartTick[i].szProto != NULL )
+ for (int i = 0; i < SIZEOF(CycleStartTick); i++)
+ if ( CycleStartTick[i].szProto != NULL)
mir_free(CycleStartTick[i].szProto);
}
\ No newline at end of file diff --git a/plugins/Clist_mw/src/cluiopts.cpp b/plugins/Clist_mw/src/cluiopts.cpp index 07b12743f7..ac5faa798b 100644 --- a/plugins/Clist_mw/src/cluiopts.cpp +++ b/plugins/Clist_mw/src/cluiopts.cpp @@ -57,27 +57,27 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, DBGetContactSettingByte(NULL,"CList","BringToFront",SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONTOP, DBGetContactSettingByte(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TOOLWND, DBGetContactSettingByte(NULL,"CList","ToolWindow",SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MIN2TRAY, DBGetContactSettingByte(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, db_get_b(NULL,"CList","BringToFront",SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TOOLWND, db_get_b(NULL,"CList","ToolWindow",SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MIN2TRAY, db_get_b(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
if (IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)) EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),FALSE);
- CheckDlgButton(hwndDlg, IDC_SHOWCAPTION, DBGetContactSettingByte(NULL,"CLUI","ShowCaption",SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, DBGetContactSettingByte(NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, DBGetContactSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWCAPTION, db_get_b(NULL,"CLUI","ShowCaption",SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, db_get_b(NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
if (!IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) {
EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),FALSE);
EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),FALSE);
EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),FALSE);
}
- CheckDlgButton(hwndDlg, IDC_FADEINOUT, DBGetContactSettingByte(NULL,"CLUI","FadeInOut",0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOSIZE, DBGetContactSettingByte(NULL,"CLUI","AutoSize",0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DROPSHADOW, DBGetContactSettingByte(NULL,"CList","WindowShadow",0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ONDESKTOP, DBGetContactSettingByte(NULL,"CList","OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_FADEINOUT, db_get_b(NULL,"CLUI","FadeInOut",0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOSIZE, db_get_b(NULL,"CLUI","AutoSize",0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DROPSHADOW, db_get_b(NULL,"CList","WindowShadow",0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ONDESKTOP, db_get_b(NULL,"CList","OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg,IDC_MAXSIZESPIN,UDM_SETRANGE,0,MAKELONG(100,0));
- SendDlgItemMessage(hwndDlg,IDC_MAXSIZESPIN,UDM_SETPOS,0,DBGetContactSettingByte(NULL,"CLUI","MaxSizeHeight",75));
- CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, DBGetContactSettingByte(NULL,"CLUI","AutoSizeUpward",0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOHIDE, DBGetContactSettingByte(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ SendDlgItemMessage(hwndDlg,IDC_MAXSIZESPIN,UDM_SETPOS,0,db_get_b(NULL,"CLUI","MaxSizeHeight",75));
+ CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, db_get_b(NULL,"CLUI","AutoSizeUpward",0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOHIDE, db_get_b(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETRANGE,0,MAKELONG(900,1));
SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_SETPOS,0,MAKELONG(DBGetContactSettingWord(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),0));
EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIME),IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE));
@@ -136,7 +136,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENT),FALSE);
EnableWindow(GetDlgItem(hwndDlg,IDC_DROPSHADOW),FALSE);
}
- else CheckDlgButton(hwndDlg,IDC_TRANSPARENT,DBGetContactSettingByte(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)?BST_CHECKED:BST_UNCHECKED);
+ else CheckDlgButton(hwndDlg,IDC_TRANSPARENT,db_get_b(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)?BST_CHECKED:BST_UNCHECKED);
if (!IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)) {
EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC11),FALSE);
EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC12),FALSE);
@@ -147,8 +147,8 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_SETRANGE,FALSE,MAKELONG(1,255));
SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_SETRANGE,FALSE,MAKELONG(1,255));
- SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_SETPOS,TRUE,DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT));
- SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_SETPOS,TRUE,DBGetContactSettingByte(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT));
+ SendDlgItemMessage(hwndDlg,IDC_TRANSACTIVE,TBM_SETPOS,TRUE,db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT));
+ SendDlgItemMessage(hwndDlg,IDC_TRANSINACTIVE,TBM_SETPOS,TRUE,db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT));
SendMessage(hwndDlg,WM_HSCROLL,0x12345678,0);
return TRUE;
@@ -266,7 +266,7 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L DBWriteContactSettingByte(NULL,"CList","OnDesktop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP));
if (IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENT)) {
SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED);
- if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(pcli->hwndContactList, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA);
+ if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(pcli->hwndContactList, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA);
}
else SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED);
@@ -283,20 +283,20 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_SHOWSBAR, DBGetContactSettingByte(NULL,"CLUI","ShowSBar",1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_USECONNECTINGICON, DBGetContactSettingByte(NULL,"CLUI","UseConnectingIcon",1) ? BST_CHECKED : BST_UNCHECKED);
- { BYTE showOpts = DBGetContactSettingByte(NULL,"CLUI","SBarShow",1);
+ CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(NULL,"CLUI","ShowSBar",1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_USECONNECTINGICON, db_get_b(NULL,"CLUI","UseConnectingIcon",1) ? BST_CHECKED : BST_UNCHECKED);
+ { BYTE showOpts = db_get_b(NULL,"CLUI","SBarShow",1);
CheckDlgButton(hwndDlg, IDC_SHOWICON, showOpts&1 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWPROTO, showOpts&2 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWSTATUS, showOpts&4 ? BST_CHECKED : BST_UNCHECKED);
}
- CheckDlgButton(hwndDlg, IDC_RIGHTSTATUS, DBGetContactSettingByte(NULL,"CLUI","SBarRightClk",0) ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_RIGHTSTATUS, db_get_b(NULL,"CLUI","SBarRightClk",0) ? BST_UNCHECKED : BST_CHECKED);
CheckDlgButton(hwndDlg, IDC_RIGHTMIRANDA, !IsDlgButtonChecked(hwndDlg,IDC_RIGHTSTATUS) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, DBGetContactSettingByte(NULL,"CLUI","EqualSections",0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SBPANELBEVEL, DBGetContactSettingByte(NULL,"CLUI","SBarBevel",1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWSIZEGRIP, DBGetContactSettingByte(NULL,"CLUI","SBarUseSizeGrip",1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, db_get_b(NULL,"CLUI","EqualSections",0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SBPANELBEVEL, db_get_b(NULL,"CLUI","SBarBevel",1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWSIZEGRIP, db_get_b(NULL,"CLUI","SBarUseSizeGrip",1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_USEOWNERDRAW, DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_USEOWNERDRAW, db_get_b(NULL,"CLUI","UseOwnerDrawStatusBar",1) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(hwndDlg,IDC_BKGCOLOUR,CPM_SETCOLOUR,0,DBGetContactSettingDword(NULL,"CLUI","SBarBKColor",CLR_DEFAULT));
@@ -352,7 +352,7 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L DBWriteContactSettingByte(NULL,"CLUI","UseConnectingIcon",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USECONNECTINGICON));
DBWriteContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_USEOWNERDRAW));
- UseOwnerDrawStatusBar = DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0);
+ UseOwnerDrawStatusBar = db_get_b(NULL,"CLUI","UseOwnerDrawStatusBar",0);
int frameopt = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLAGS,hFrameHelperStatusBar),0);
frameopt &= ~F_VISIBLE;
diff --git a/plugins/Clist_mw/src/cluiservices.cpp b/plugins/Clist_mw/src/cluiservices.cpp index 38e19ee46d..dadea72c01 100644 --- a/plugins/Clist_mw/src/cluiservices.cpp +++ b/plugins/Clist_mw/src/cluiservices.cpp @@ -68,7 +68,7 @@ void CluiProtocolStatusChanged(int parStatus, const char* szProto) SendMessage(pcli->hwndStatus,SB_SETBKCOLOR,0,DBGetContactSettingDword(0,"CLUI","SBarBKColor",CLR_DEFAULT));
partWidths = (int*)alloca((protoCount+1)*sizeof(int));
//partWidths[0] = FirstIconOffset;
- if (DBGetContactSettingByte(NULL,"CLUI","UseOwnerDrawStatusBar",0)||DBGetContactSettingByte(NULL,"CLUI","EqualSections",1))
+ if ( db_get_b(NULL,"CLUI","UseOwnerDrawStatusBar",0)||db_get_b(NULL,"CLUI","EqualSections",1))
{
RECT rc;
int toshow, part;
@@ -104,7 +104,7 @@ void CluiProtocolStatusChanged(int parStatus, const char* szProto) else {
HDC hdc;
SIZE textSize;
- BYTE showOpts = DBGetContactSettingByte(NULL,"CLUI","SBarShow",5);
+ BYTE showOpts = db_get_b(NULL,"CLUI","SBarShow",5);
DWORD extraspace = DBGetContactSettingDword(NULL,"StatusBar","BkExtraSpace",0);
DWORD startoffset = DBGetContactSettingDword(NULL,"StatusBar","FirstIconOffset",0);
int x;
@@ -153,7 +153,7 @@ void CluiProtocolStatusChanged(int parStatus, const char* szProto) SendMessage(pcli->hwndStatus,SB_SETPARTS,partCount,(LPARAM)partWidths);
flags = SBT_OWNERDRAW;
- if ( !DBGetContactSettingByte(NULL, "CLUI", "SBarBevel", 1))
+ if ( !db_get_b(NULL, "CLUI", "SBarBevel", 1))
flags |= SBT_NOBORDERS;
for (partCount = 0, i = 0; i<protoCount; i++) { //count down since built in ones tend to go at the end
diff --git a/plugins/Clist_mw/src/contact.cpp b/plugins/Clist_mw/src/contact.cpp index 2f95d98421..6899374b7b 100644 --- a/plugins/Clist_mw/src/contact.cpp +++ b/plugins/Clist_mw/src/contact.cpp @@ -88,7 +88,7 @@ void LoadContactTree(void) CallService(MS_CLUI_GROUPADDED,i,0);
}
- hideOffline = DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT);
+ hideOffline = db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT);
hContact = db_find_first();
while(hContact != NULL) {
@@ -103,9 +103,9 @@ void LoadContactTree(void) ChangeContactIcon(hContact,ExtIconFromStatusMode(hContact,(char*)cacheEntry->szProto,status),1);
hContact = db_find_next(hContact);
}
- sortByStatus = DBGetContactSettingByte(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT);
- sortByProto = DBGetContactSettingByte(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT);
- sortNoOfflineBottom = DBGetContactSettingByte(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT);
+ sortByStatus = db_get_b(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT);
+ sortByProto = db_get_b(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT);
+ sortNoOfflineBottom = db_get_b(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT);
CallService(MS_CLUI_SORTLIST,0,0);
CallService(MS_CLUI_LISTENDREBUILD,0,0);
@@ -179,8 +179,8 @@ static VOID CALLBACK SortContactsTimer(HWND hwnd,UINT message,UINT_PTR idEvent,D void SortContacts(void)
{
//avoid doing lots of resorts in quick succession
- sortByStatus = DBGetContactSettingByte(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT);
- sortByProto = DBGetContactSettingByte(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT);
+ sortByStatus = db_get_b(NULL,"CList","SortByStatus",SETTING_SORTBYSTATUS_DEFAULT);
+ sortByProto = db_get_b(NULL,"CList","SortByProto",SETTING_SORTBYPROTO_DEFAULT);
if (resortTimerId) KillTimer(NULL,resortTimerId);
resortTimerId = SetTimer(NULL,0,50,SortContactsTimer);
}
diff --git a/plugins/Clist_mw/src/groupmenu.cpp b/plugins/Clist_mw/src/groupmenu.cpp index 7053207a65..9f5f5846ae 100644 --- a/plugins/Clist_mw/src/groupmenu.cpp +++ b/plugins/Clist_mw/src/groupmenu.cpp @@ -214,7 +214,7 @@ static int OnBuildGroupMenu(WPARAM wParam,LPARAM lParam) ZeroMemory(&mi,sizeof(mi));
mi.cbSize = sizeof(mi);
- mi.flags = CMIM_FLAGS | (DBGetContactSettingByte(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CMIF_CHECKED:0);
+ mi.flags = CMIM_FLAGS | ( db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CMIF_CHECKED:0);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersMenuItem, (LPARAM)&mi);
ZeroMemory(&mi,sizeof(mi));
diff --git a/src/core/miranda.h b/src/core/miranda.h index 097a8546d0..b0369e0f08 100644 --- a/src/core/miranda.h +++ b/src/core/miranda.h @@ -140,9 +140,9 @@ int GetPluginFakeId(const MUUID &uuid, int hLangpack); __forceinline char* Utf8DecodeA(const char* src)
{
- char* tmp = mir_strdup(src);
- Utf8Decode(tmp, NULL);
- return tmp;
+ char* tmp = mir_strdup(src);
+ Utf8Decode(tmp, NULL);
+ return tmp;
}
#pragma optimize("", on)
diff --git a/src/core/modules.cpp b/src/core/modules.cpp index 3efee23a99..b6ddb33cf0 100644 --- a/src/core/modules.cpp +++ b/src/core/modules.cpp @@ -88,7 +88,7 @@ int LoadDescButtonModule(); int LoadDefaultModules(void)
{
- //load order is very important for these
+ //load order is very important for these
if ( LoadSystemModule()) return 1;
if ( LoadLangpackModule()) return 1; // langpack will be a system module in the new order so this is moved here
CheckRestart();
@@ -97,7 +97,7 @@ int LoadDefaultModules(void) if ( LoadHeaderbarModule()) return 1;
if ( LoadDbintfModule()) return 1;
if ( LoadEventsModule()) return 1;
-
+
// load database drivers & service plugins without executing their Load()
if ( LoadNewPluginsModuleInfos()) return 1;
@@ -152,7 +152,7 @@ int LoadDefaultModules(void) if ( LoadAccountsModule()) return 1;
- //order becomes less important below here
+ //order becomes less important below here
if ( LoadFindAddModule()) return 1;
if ( LoadIgnoreModule()) return 1;
if ( LoadVisibilityModule()) return 1;
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index 20f966515b..2da2c7701f 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -389,7 +389,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break;
case WM_GETFONT:
- return (LRESULT) dat->fontInfo[FONTID_CONTACTS].hFont;
+ return (LRESULT)dat->fontInfo[FONTID_CONTACTS].hFont;
case INTM_GROUPSCHANGED:
{
diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp index c27564729c..c6f7ad3157 100644 --- a/src/modules/clist/clcmsgs.cpp +++ b/src/modules/clist/clcmsgs.cpp @@ -53,12 +53,12 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR ClcGroup *group;
CLCINFOITEM *cii = (CLCINFOITEM *) lParam;
if (cii == NULL || cii->cbSize != sizeof(CLCINFOITEM))
- return (LRESULT) (HANDLE) NULL;
+ return (LRESULT)(HANDLE) NULL;
if (cii->hParentGroup == NULL)
group = &dat->list;
else {
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) ((UINT_PTR) cii->hParentGroup | HCONTACT_ISGROUP), &groupContact, NULL, NULL))
- return (LRESULT) (HANDLE) NULL;
+ return (LRESULT)(HANDLE) NULL;
group = groupContact->group;
}
if (msg == CLM_ADDINFOITEMA)
@@ -68,7 +68,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR }
else i = cli.pfnAddInfoItemToGroup(group, cii->flags, cii->pszText);
cli.pfnRecalcScrollBar(hwnd, dat);
- return (LRESULT) group->cl.items[i]->hContact | HCONTACT_ISINFO;
+ return (LRESULT)group->cl.items[i]->hContact | HCONTACT_ISINFO;
}
case CLM_AUTOREBUILD:
@@ -116,12 +116,12 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_FINDCONTACT:
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, NULL, NULL, NULL))
- return (LRESULT) (HANDLE) NULL;
+ return (LRESULT)(HANDLE) NULL;
return wParam;
case CLM_FINDGROUP:
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) (wParam | HCONTACT_ISGROUP), NULL, NULL, NULL))
- return (LRESULT) (HANDLE) NULL;
+ return (LRESULT)(HANDLE) NULL;
return wParam | HCONTACT_ISGROUP;
case CLM_GETBKCOLOR:
@@ -139,7 +139,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR return cli.pfnGetGroupContentsCount(&dat->list, 0);
case CLM_GETEDITCONTROL:
- return (LRESULT) dat->hwndRenameEdit;
+ return (LRESULT)dat->hwndRenameEdit;
case CLM_GETEXPAND:
{
@@ -168,12 +168,12 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR return EMPTY_EXTRA_ICON;
case CLM_GETEXTRAIMAGELIST:
- return (LRESULT) dat->himlExtraColumns;
+ return (LRESULT)dat->himlExtraColumns;
case CLM_GETFONT:
if (wParam < 0 || wParam > FONTID_MAX)
return 0;
- return (LRESULT) dat->fontInfo[wParam].hFont;
+ return (LRESULT)dat->fontInfo[wParam].hFont;
case CLM_GETHIDEOFFLINEROOT:
return db_get_b(NULL, "CLC", "HideOfflineRoot", 0);
@@ -209,7 +209,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR {
if (wParam == CLGN_ROOT) {
if (dat->list.cl.count)
- return (LRESULT) cli.pfnContactToHItem(dat->list.cl.items[0]);
+ return (LRESULT)cli.pfnContactToHItem(dat->list.cl.items[0]);
return NULL;
}
@@ -222,11 +222,11 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR switch (wParam) {
case CLGN_CHILD:
if (contact->type != CLCIT_GROUP)
- return (LRESULT) (HANDLE) NULL;
+ return (LRESULT)(HANDLE) NULL;
group = contact->group;
if (group->cl.count == 0)
return NULL;
- return (LRESULT) cli.pfnContactToHItem(group->cl.items[0]);
+ return (LRESULT)cli.pfnContactToHItem(group->cl.items[0]);
case CLGN_PARENT:
return group->groupId | HCONTACT_ISGROUP;
@@ -237,7 +237,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR return NULL;
}
while (group->cl.items[i]->type == CLCIT_DIVIDER);
- return (LRESULT) cli.pfnContactToHItem(group->cl.items[i]);
+ return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]);
case CLGN_PREVIOUS:
do {
@@ -245,7 +245,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR return NULL;
}
while (group->cl.items[i]->type == CLCIT_DIVIDER);
- return (LRESULT) cli.pfnContactToHItem(group->cl.items[i]);
+ return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]);
case CLGN_NEXTCONTACT:
for (i++; i < group->cl.count; i++)
@@ -253,7 +253,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break;
if (i >= group->cl.count)
return NULL;
- return (LRESULT) cli.pfnContactToHItem(group->cl.items[i]);
+ return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]);
case CLGN_PREVIOUSCONTACT:
if (i >= group->cl.count)
@@ -263,7 +263,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break;
if (i < 0)
return NULL;
- return (LRESULT) cli.pfnContactToHItem(group->cl.items[i]);
+ return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]);
case CLGN_NEXTGROUP:
for (i++; i < group->cl.count; i++)
@@ -271,7 +271,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break;
if (i >= group->cl.count)
return NULL;
- return (LRESULT) cli.pfnContactToHItem(group->cl.items[i]);
+ return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]);
case CLGN_PREVIOUSGROUP:
if (i >= group->cl.count)
@@ -281,7 +281,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break;
if (i < 0)
return NULL;
- return (LRESULT) cli.pfnContactToHItem(group->cl.items[i]);
+ return (LRESULT)cli.pfnContactToHItem(group->cl.items[i]);
}
return NULL;
}
@@ -294,25 +294,24 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR ClcContact *contact;
if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL) == -1)
return NULL;
- return (LRESULT) cli.pfnContactToHItem(contact);
+ return (LRESULT)cli.pfnContactToHItem(contact);
}
case CLM_GETTEXTCOLOR:
if (wParam < 0 || wParam > FONTID_MAX)
return 0;
- return (LRESULT) dat->fontInfo[wParam].colour;
+ return (LRESULT)dat->fontInfo[wParam].colour;
case CLM_HITTEST:
{
ClcContact *contact;
DWORD hitFlags;
- int hit;
- hit = cli.pfnHitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), &contact, NULL, &hitFlags);
+ int hit = cli.pfnHitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), &contact, NULL, &hitFlags);
if (wParam)
*(PDWORD) wParam = hitFlags;
if (hit == -1)
return NULL;
- return (LRESULT) cli.pfnContactToHItem(contact);
+ return (LRESULT)cli.pfnContactToHItem(contact);
}
case CLM_SELECTITEM:
diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index 1a29948f44..383ab66dd8 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -28,6 +28,7 @@ #define MENU_MIRANDAMENU 0xFFFF1234
extern BOOL(WINAPI * MySetProcessWorkingSetSize) (HANDLE, SIZE_T, SIZE_T);
+extern HANDLE hEventExtraClick;
static HMODULE hUserDll;
static HANDLE hContactDraggingEvent, hContactDroppedEvent, hContactDragStopEvent;
@@ -143,9 +144,10 @@ static INT_PTR CALLBACK AskForConfirmationDlgProc(HWND hWnd, UINT msg, WPARAM wP mir_sntprintf(szFinal, SIZEOF(szFinal), szFormat, cli.pfnGetContactDisplayName((HANDLE)lParam, 0));
SetDlgItemText(hWnd, IDC_TOPLINE, szFinal);
}
- SetFocus( GetDlgItem(hWnd, IDNO));
+ SetFocus( GetDlgItem(hWnd, IDNO));
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
break;
+
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDYES:
@@ -519,13 +521,13 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case M_RESTORESTATUS:
- #ifndef _DEBUG
- {
- int nStatus = DBGetContactSettingWord(NULL, "CList", "Status", ID_STATUS_OFFLINE);
- if (nStatus != ID_STATUS_OFFLINE) CallService(MS_CLIST_SETSTATUSMODE, nStatus, 0);
- }
- #endif
- break;
+ #ifndef _DEBUG
+ {
+ int nStatus = DBGetContactSettingWord(NULL, "CList", "Status", ID_STATUS_OFFLINE);
+ if (nStatus != ID_STATUS_OFFLINE) CallService(MS_CLIST_SETSTATUSMODE, nStatus, 0);
+ }
+ #endif
+ break;
// Power management
case WM_POWERBROADCAST:
@@ -581,7 +583,8 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM RECT rc;
GetWindowRect(hwnd, &rc);
- if ( !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { //if docked, dont remember pos (except for width)
+ //if docked, dont remember pos (except for width)
+ if ( !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) {
db_set_dw(NULL, "CList", "Height", (DWORD) (rc.bottom - rc.top));
db_set_dw(NULL, "CList", "x", (DWORD) rc.left);
db_set_dw(NULL, "CList", "y", (DWORD) rc.top);
@@ -805,7 +808,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_DISPLAYCHANGE:
DefWindowProc(hwnd, msg, wParam, lParam);
- SendMessage(cli.hwndContactTree, WM_SIZE, 0, 0); //forces it to send a cln_listsizechanged
+ SendMessage(cli.hwndContactTree, WM_SIZE, 0, 0); //forces it to send a cln_listsizechanged
break;
//MSG FROM CHILD CONTROL
@@ -895,15 +898,21 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case NM_CLICK:
{
DWORD hitFlags;
- if (SendMessage(cli.hwndContactTree, CLM_HITTEST, (WPARAM) & hitFlags, MAKELPARAM(nmc->pt.x, nmc->pt.y)))
+ HANDLE hItem = (HANDLE)SendMessage(cli.hwndContactTree, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nmc->pt.x, nmc->pt.y));
+ if (hItem) {
+ if (hitFlags & CLCHT_ONITEMEXTRA) {
+ if ( !IsHContactGroup(hItem) && !IsHContactInfo(hItem))
+ if ( cli.pfnGetCacheEntry(nmc->hItem))
+ NotifyEventHooks(hEventExtraClick, (WPARAM)nmc->hItem, nmc->iColumn+1);
+ }
break;
+ }
if ((hitFlags & (CLCHT_NOWHERE | CLCHT_INLEFTMARGIN | CLCHT_BELOWITEMS)) == 0)
break;
if (db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) {
- POINT pt;
- pt = nmc->pt;
+ POINT pt = nmc->pt;
ClientToScreen(cli.hwndContactTree, &pt);
return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
}
@@ -954,10 +963,8 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM int pos = LOWORD(wParam);
POINT pt;
GetCursorPos(&pt);
- if ((pos == 0 || pos == 1) && (HIWORD(wParam) & MF_POPUP) &&
- ( !(HIWORD(wParam) & MF_MOUSESELECT) || MenuItemFromPoint(hwnd, cli.hMenuMain, pt) != -1)) {
- MENUITEMINFO mii = { 0 };
- mii.cbSize = MENUITEMINFO_V4_SIZE;
+ if ((pos == 0 || pos == 1) && (HIWORD(wParam) & MF_POPUP) && ( !(HIWORD(wParam) & MF_MOUSESELECT) || MenuItemFromPoint(hwnd, cli.hMenuMain, pt) != -1)) {
+ MENUITEMINFO mii = { MENUITEMINFO_V4_SIZE };
mii.fMask = MIIM_SUBMENU;
mii.hSubMenu = (HMENU)CallService((pos == 0) ? MS_CLIST_MENUGETMAIN : MS_CLIST_MENUGETSTATUS, 0, 0);
SetMenuItemInfo(cli.hMenuMain, pos, TRUE, &mii);
@@ -1089,7 +1096,8 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM RECT rc;
GetWindowRect(hwnd, &rc);
- if ( !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { //if docked, dont remember pos (except for width)
+ //if docked, dont remember pos (except for width)
+ if ( !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) {
db_set_dw(NULL, "CList", "Height", (DWORD) (rc.bottom - rc.top));
db_set_dw(NULL, "CList", "x", (DWORD) rc.left);
db_set_dw(NULL, "CList", "y", (DWORD) rc.top);
diff --git a/src/modules/extraicons/extraicons.cpp b/src/modules/extraicons/extraicons.cpp index eef801f408..5119034c79 100644 --- a/src/modules/extraicons/extraicons.cpp +++ b/src/modules/extraicons/extraicons.cpp @@ -273,7 +273,8 @@ int ClistExtraClick(WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////
// Extra image list functions
-static HANDLE hEventExtraImageListRebuilding, hEventExtraImageApplying, hEventExtraClick;
+HANDLE hEventExtraImageListRebuilding, hEventExtraImageApplying, hEventExtraClick;
+
static bool bImageCreated = false;
static int g_mutex_bSetAllExtraIconsCycle = 0;
static HIMAGELIST hExtraImageList;
|