From ef4bb4cd3063b4088a46b48104b43e03a7ef38ea Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 5 Jan 2021 12:31:28 +0300 Subject: code cleaning + duplicate code removed --- plugins/Clist_modern/src/modern_commonprototypes.h | 2 +- plugins/Clist_modern/src/modern_skinengine.cpp | 20 +- plugins/ExternalAPI/m_skin_eng.h | 338 +++++++++------------ plugins/TabSRMM/src/chat_options.cpp | 2 +- src/mir_app/src/FontOptions.cpp | 99 ++---- src/mir_app/src/stdafx.h | 1 + 6 files changed, 191 insertions(+), 271 deletions(-) diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h index a20f71a837..b53f30731f 100644 --- a/plugins/Clist_modern/src/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/modern_commonprototypes.h @@ -107,7 +107,7 @@ int ske_DrawImageAt(HDC hdc, RECT *rc); BOOL ske_DrawIconEx(HDC hdc, int xLeft, int yTop, HICON hIcon, int cxWidth, int cyWidth, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags); int ske_DrawNonFramedObjects(BOOL Erase, RECT *r); BOOL ske_DrawText(HDC hdc, LPCTSTR lpString, int nCount, RECT *lpRect, UINT format); -LPSKINOBJECTDESCRIPTOR ske_FindObjectByName(const char *szName, BYTE objType, SKINOBJECTSLIST *Skin); +SKINOBJECTDESCRIPTOR* ske_FindObjectByName(const char *szName, BYTE objType, SKINOBJECTSLIST *Skin); HBITMAP ske_GetCurrentWindowImage(); int ske_GetFullFilename(wchar_t *buf, const wchar_t *file, wchar_t *skinfolder, BOOL madeAbsolute); BOOL ske_ImageList_DrawEx(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, int dx, int dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle); diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 162fa12e9d..d3268de955 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -102,7 +102,7 @@ static int ske_AlphaTextOut(HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect static void ske_AddParseTextGlyphObject(char * szGlyphTextID, char * szDefineString, SKINOBJECTSLIST *Skin); static void ske_AddParseSkinFont(char * szFontID, char * szDefineString); static int ske_GetSkinFromDB(char * szSection, SKINOBJECTSLIST * Skin); -static LPSKINOBJECTDESCRIPTOR ske_FindObject(const char *szName, SKINOBJECTSLIST *Skin); +static SKINOBJECTDESCRIPTOR* ske_FindObject(const char *szName, SKINOBJECTSLIST *Skin); static int ske_LoadSkinFromResource(BOOL bOnlyObjects); static void ske_PreMultiplyChannels(HBITMAP hbmp, BYTE Mult); static int ske_ValidateSingleFrameImage(FRAMEWND * Frame, BOOL SkipBkgBlitting); @@ -1313,7 +1313,7 @@ static int ske_DrawSkinObject(SKINDRAWREQUEST *preq, GLYPHOBJECT *pobj) -int ske_AddDescriptorToSkinObjectList(LPSKINOBJECTDESCRIPTOR lpDescr, SKINOBJECTSLIST *Skin) +int ske_AddDescriptorToSkinObjectList(SKINOBJECTDESCRIPTOR *lpDescr, SKINOBJECTSLIST *Skin) { SKINOBJECTSLIST *sk = (Skin ? Skin : &g_SkinObjectList); if (!mir_strcmpi(lpDescr->szObjectID, "_HEADER_")) @@ -1357,19 +1357,19 @@ int ske_AddDescriptorToSkinObjectList(LPSKINOBJECTDESCRIPTOR lpDescr, SKINOBJECT return 1; } -static LPSKINOBJECTDESCRIPTOR ske_FindObject(const char *szName, SKINOBJECTSLIST *Skin) +static SKINOBJECTDESCRIPTOR* ske_FindObject(const char *szName, SKINOBJECTSLIST *Skin) { SKINOBJECTSLIST *sk = (Skin == nullptr) ? (&g_SkinObjectList) : Skin; return skin_FindObjectByRequest((char *)szName, sk->pMaskList); } -static LPSKINOBJECTDESCRIPTOR ske_FindObjectByMask(MODERNMASK *pModernMask, SKINOBJECTSLIST *Skin) +static SKINOBJECTDESCRIPTOR* ske_FindObjectByMask(MODERNMASK *pModernMask, SKINOBJECTSLIST *Skin) { SKINOBJECTSLIST *sk = (Skin == nullptr) ? (&g_SkinObjectList) : Skin; return sk->pMaskList ? skin_FindObjectByMask(pModernMask, sk->pMaskList) : nullptr; } -LPSKINOBJECTDESCRIPTOR ske_FindObjectByName(const char *szName, BYTE objType, SKINOBJECTSLIST *Skin) +SKINOBJECTDESCRIPTOR* ske_FindObjectByName(const char *szName, BYTE objType, SKINOBJECTSLIST *Skin) { SKINOBJECTSLIST *sk = (Skin == nullptr) ? (&g_SkinObjectList) : Skin; for (DWORD i = 0; i < sk->dwObjLPAlocated; i++) { @@ -1389,17 +1389,17 @@ LPSKINOBJECTDESCRIPTOR ske_FindObjectByName(const char *szName, BYTE objType, SK INT_PTR ske_Service_DrawGlyph(WPARAM wParam, LPARAM lParam) { - LPSKINDRAWREQUEST preq = (LPSKINDRAWREQUEST)wParam; + auto *preq = (SKINDRAWREQUEST *)wParam; if (preq == nullptr) return -1; mir_cslock lck(cs_SkinChanging); - LPSKINOBJECTDESCRIPTOR pgl = (lParam ? ske_FindObjectByMask((MODERNMASK*)lParam, nullptr) : ske_FindObject(preq->szObjectID, nullptr)); + SKINOBJECTDESCRIPTOR *pgl = (lParam ? ske_FindObjectByMask((MODERNMASK*)lParam, nullptr) : ske_FindObject(preq->szObjectID, nullptr)); if (pgl == nullptr) return -1; if (pgl->Data == nullptr) return -1; - LPGLYPHOBJECT gl = (LPGLYPHOBJECT)pgl->Data; + GLYPHOBJECT *gl = (GLYPHOBJECT*)pgl->Data; int iStyle = gl->Style & 7; if (iStyle == ST_SKIP) return ST_SKIP; @@ -2411,7 +2411,7 @@ static int ske_AlphaTextOut(HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect, return 0; } -static int ske_DrawTextWithEffectWorker(HDC hdc, LPCTSTR lpString, int nCount, RECT *lpRect, UINT format, MODERNFONTEFFECT *effect) +static int ske_DrawTextWithEffectWorker(HDC hdc, LPCTSTR lpString, int nCount, RECT *lpRect, UINT format, FONTEFFECT *effect) { if (format & DT_CALCRECT) return DrawText(hdc, lpString, nCount, lpRect, format); @@ -2437,8 +2437,6 @@ static int ske_DrawTextWithEffectWorker(HDC hdc, LPCTSTR lpString, int nCount, R INT_PTR ske_Service_DrawTextWithEffect(WPARAM wParam, LPARAM) { DrawTextWithEffectParam *p = (DrawTextWithEffectParam *)wParam; - if (p->cbSize != sizeof(DrawTextWithEffectParam)) - return FALSE; return ske_DrawTextWithEffectWorker(p->hdc, p->lpchText, p->cchText, p->lprc, p->dwDTFormat, p->pEffect); } diff --git a/plugins/ExternalAPI/m_skin_eng.h b/plugins/ExternalAPI/m_skin_eng.h index 692ce3b9a1..8cb70e2e1f 100644 --- a/plugins/ExternalAPI/m_skin_eng.h +++ b/plugins/ExternalAPI/m_skin_eng.h @@ -26,12 +26,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define M_ske_H_INC #include +#include /*defaults*/ #define DEFAULT_FIT_MODE FM_STRETCH #define DEFAULT_STYLE ST_BRUSH #define DEFAULT_BKCOLOUR GetSysColor(COLOR_3DFACE) -#define DEFAULT_SELBKCOLOUR GetSysColor(COLOR_HIGHLIGHT) +#define DEFAULT_SELBKCOLOUR GetSysColor(COLOR_HIGHLIGHT) #define SIZING_MARGIN 3 /* Fit mode */ @@ -63,7 +64,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define ADT_BOTTOM 0x00000008 //#define ADT_ECLIPSE 64 - /*SERVICES*/ //toggle the 'hide offline contacts' flag and call CLUI @@ -81,82 +81,78 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // lParam = 0 ( used for internal purposes: pointer to skin object list) #define MS_SKIN_REGISTERDEFOBJECT "ModernList/RegisterDefObject" -typedef struct s_DEF_SKIN_OBJECT_PARAMS +struct DEF_SKIN_OBJECT_PARAMS { - char * szObjectID; - BYTE defStyle; - DWORD defColor; - // SKINOBJECTSLIST * Skin; -} DEF_SKIN_OBJECT_PARAMS; - + char *szObjectID; + BYTE defStyle; + DWORD defColor; +}; // Request painting glyph object // wParam = pointer to SKINDRAWREQUEST structure // lParam = 0 #define MS_SKIN_DRAWGLYPH "ModernList/DrawGlyph" - - /* EVENTS */ #define ME_SKIN_SERVICESCREATED "ModernList/ServicesCreated" /* DRAWGLYPH Request structure */ -typedef struct s_SKINDRAWREQUEST +struct SKINDRAWREQUEST { - char szObjectID[255]; // Unic Object ID (path) to paint - RECT rcDestRect; // Rectangle to fit - RECT rcClipRect; // Rectangle to paint in. - HDC hDC; // Handler to device context to paint in. -} SKINDRAWREQUEST,*LPSKINDRAWREQUEST; + char szObjectID[255]; // Unic Object ID (path) to paint + RECT rcDestRect; // Rectangle to fit + RECT rcClipRect; // Rectangle to paint in. + HDC hDC; // Handler to device context to paint in. +}; /* SKINOBJECTDESCRIPTOR opbject descriptor structure */ -typedef struct tagSKINOBJECTDESCRIPTOR +struct SKINOBJECTDESCRIPTOR { - BYTE bType; // One of OT_* values. - char* szObjectID; // Unic Object ID (path) [255] max - LPVOID Data; // Pointer to GLYPHOBJECT strycture if bType==OT_GLYPHOBJECT -} SKINOBJECTDESCRIPTOR, *LPSKINOBJECTDESCRIPTOR; + BYTE bType; // One of OT_* values. + char *szObjectID; // Unic Object ID (path) [255] max + void *Data; // Pointer to GLYPHOBJECT strycture if bType==OT_GLYPHOBJECT +}; /* SKINOBJECTDESCRIPTOR opbject descriptor structure */ -typedef struct s_GLYPHOBJECT +struct GLYPHOBJECT { - BYTE Style; // One of ST_* values - HBITMAP hGlyph; // Bitmap handler (for internal use only) - DWORD dwTop, dwLeft, dwBottom, dwRight; // Margins - char* szFileName; // FileName of image - DWORD dwColor; // Fill color - BYTE dwAlpha; // Constant alpha-transparency level - BYTE FitMode; // One of FM_* values - POINT clipArea; // Object image rect on full image - SIZE szclipArea; // Object image rect on full image - SortedList * plTextList; // List of GLYPHTEXT - LONG bmWidth; - LONG bmHeight; - BYTE bmBitsPixel; -} GLYPHOBJECT,*LPGLYPHOBJECT; + BYTE Style; // One of ST_* values + HBITMAP hGlyph; // Bitmap handler (for internal use only) + DWORD dwTop, dwLeft, dwBottom, dwRight; // Margins + char *szFileName; // FileName of image + DWORD dwColor; // Fill color + BYTE dwAlpha; // Constant alpha-transparency level + BYTE FitMode; // One of FM_* values + POINT clipArea; // Object image rect on full image + SIZE szclipArea; // Object image rect on full image + SortedList *plTextList; // List of GLYPHTEXT + LONG bmWidth; + LONG bmHeight; + BYTE bmBitsPixel; +}; /* SKINTEXTDESCRIPTOR opbject descriptor structure */ -typedef struct s_GLYPHTEXT +struct GLYPHTEXT { - char * szGlyphTextID; - TCHAR * stText; - TCHAR * stValueText; - DWORD dwFlags; - DWORD dwColor; // Color (InvAA)(RR)(GG)(BB) - DWORD dwShadow; //ToDo: Color2/Shaddow - int iLeft,iTop,iRight,iBottom; - BYTE RelativeFlags; - char * szFontID; - HFONT hFont; - char * szObjectName; -}GLYPHTEXT,*LPGLYPHTEXT; + char *szGlyphTextID; + TCHAR *stText; + TCHAR *stValueText; + DWORD dwFlags; + DWORD dwColor; // Color (InvAA)(RR)(GG)(BB) + DWORD dwShadow; //ToDo: Color2/Shaddow + int iLeft, iTop, iRight, iBottom; + BYTE RelativeFlags; + char *szFontID; + HFONT hFont; + char *szObjectName; +}; /* SKINTEXTDESCRIPTOR opbject descriptor structure */ -typedef struct s_SKINFONT +struct SKINFONT { - char * szFontID; - HFONT hFont; -}SKINFONT, *LPSKINFONT; + char *szFontID; + HFONT hFont; +}; /* HELPER FUNCTIONS */ @@ -164,7 +160,7 @@ typedef struct s_SKINFONT int __inline SkinDrawWindowBack(HWND hwndIn, HDC hdc, RECT * rcClip, char * objectID) { SKINDRAWREQUEST rq; - POINT pt={0}; + POINT pt={}; RECT rc,r1; if (!objectID) return 0; @@ -224,23 +220,6 @@ static BOOL __inline ScreenToClientRect(HWND hWnd, LPRECT lpRect) return ret; } -//int __inline CreateGlyphedObjectDefStyle(char * ObjID,BYTE defStyle) -//{ -// DEF_SKIN_OBJECT_PARAMS prm={0}; -// prm.defColor=DEFAULT_BKCOLOUR; -// prm.defStyle=defStyle; -// prm.szObjectID=ObjID; -// return CallService(MS_SKIN_REGISTERDEFOBJECT,(WPARAM)&prm,0); -//} -//int __inline CreateGlyphedObjectDefColor(char * ObjID,DWORD defColor) -//{ -// DEF_SKIN_OBJECT_PARAMS prm={0}; -// prm.defColor=defColor; -// prm.defStyle=ST_BRUSH; -// prm.szObjectID=ObjID; -// return CallService(MS_SKIN_REGISTERDEFOBJECT,(WPARAM)&prm,0); -//} - //Paint ObjectID static int __inline SkinDrawGlyph(HDC hdc, RECT * rcSize, RECT * rcClip, char * objectID) { @@ -260,16 +239,16 @@ static int __inline SkinDrawGlyph(HDC hdc, RECT * rcSize, RECT * rcClip, char * // // ////////////////////////////////////////////// -typedef struct sPAINT_REQUEST +struct sPaintRequest { - DWORD dStructSize; //size of structure - HWND hWnd; //called by window - HDC hDC; //context to draw on - RECT rcUpdate; //rectangle to be painted in (relative to Top-Left corner of Main window) - DWORD dwFlags; //drawing flags - void * CallbackData; //Data for passing to callback procedure - char Reserved[16]; //reserved for farther usage; -} sPaintRequest; + DWORD dStructSize; // size of structure + HWND hWnd; // called by window + HDC hDC; // context to draw on + RECT rcUpdate; // rectangle to be painted in (relative to Top-Left corner of Main window) + DWORD dwFlags; // drawing flags + void *CallbackData; // Data for passing to callback procedure + char Reserved[16]; // reserved for farther usage; +}; // Request to register sub for callback painting frame area // wParam = hWnd of called frame @@ -289,60 +268,58 @@ typedef struct sPAINT_REQUEST #define MS_SKINENG_INVALIDATEFRAMEIMAGE "SkinEngine/ske_Service_InvalidateFrameImage" // Callback proc type -typedef int (/*__stdcall*/ *tPaintCallbackProc)(HWND hWnd, HDC hDC, RECT * rcPaint, HRGN rgnUpdate, DWORD dFlags, void * CallBackData); -//tPaintCallbackProc PaintCallbackProc; +typedef int (*tPaintCallbackProc)(HWND hWnd, HDC hDC, RECT * rcPaint, HRGN rgnUpdate, DWORD dFlags, void * CallBackData); // HELPER TO UPDATEIMAGEFRAME - __inline BOOL isSkinEngineEnabled() { return ServiceExists(MS_SKINENG_REGISTERPAINTSUB) && !db_get_b(NULL, "ModernData", "DisableEngine", FALSE); } - __inline BOOL isLayeredEnabled() { return isSkinEngineEnabled() && db_get_b(NULL, "ModernData", "EnableLayering", TRUE); } -int __inline SkinEngUpdateImageFrame(HWND hwnd, RECT * rcUpdate, DWORD dwFlags, void * CallBackData) +int __inline SkinEngUpdateImageFrame(HWND hwnd, RECT *rcUpdate, DWORD dwFlags, void *CallBackData) { - sPaintRequest sr={0}; - sr.dStructSize=sizeof(sPaintRequest); - sr.hWnd=hwnd; - if (rcUpdate) - sr.rcUpdate=*rcUpdate; - sr.dwFlags=dwFlags; - sr.CallbackData=CallBackData; - return CallService(MS_SKINENG_UPTATEFRAMEIMAGE,(WPARAM)hwnd,(LPARAM)&sr); + sPaintRequest sr = { 0 }; + sr.dStructSize = sizeof(sPaintRequest); + sr.hWnd = hwnd; + if (rcUpdate) + sr.rcUpdate = *rcUpdate; + sr.dwFlags = dwFlags; + sr.CallbackData = CallBackData; + return CallService(MS_SKINENG_UPTATEFRAMEIMAGE, (WPARAM)hwnd, (LPARAM)&sr); } -int __inline SkinEngInvalidateImageFrame(HWND hwnd, CONST RECT * rcUpdate, DWORD dwFlags, void * CallBackData) +int __inline SkinEngInvalidateImageFrame(HWND hwnd, CONST RECT *rcUpdate, DWORD dwFlags, void *CallBackData) { - sPaintRequest sr={0}; - if (hwnd && !isLayeredEnabled()) return InvalidateRect(hwnd,rcUpdate,dwFlags); - sr.dStructSize=sizeof(sPaintRequest); - sr.hWnd=hwnd; - if (rcUpdate) - sr.rcUpdate=*rcUpdate; - sr.dwFlags=dwFlags; - sr.CallbackData=CallBackData; - return CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE,(WPARAM)hwnd,(LPARAM)&sr); + sPaintRequest sr = { 0 }; + if (hwnd && !isLayeredEnabled()) return InvalidateRect(hwnd, rcUpdate, dwFlags); + sr.dStructSize = sizeof(sPaintRequest); + sr.hWnd = hwnd; + if (rcUpdate) + sr.rcUpdate = *rcUpdate; + sr.dwFlags = dwFlags; + sr.CallbackData = CallBackData; + return CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE, (WPARAM)hwnd, (LPARAM)&sr); } - -int __inline SkinInvalidateFrame(HWND hWnd, CONST RECT* lpRect) +int __inline SkinInvalidateFrame(HWND hWnd, CONST RECT *lpRect) { return SkinEngInvalidateImageFrame(hWnd, lpRect, 0, nullptr); } -// Alpha channel GDI replacements/helpers +//////////////////////////////////////////////////////////////////////////////// +// Alpha channel GDI replacements/helpers // // Paints text with correct alpha channel // wParam - pointer to AlphaTextOutParams #define MS_SKINENG_ALPHATEXTOUT "SkinEngine/ske_AlphaTextOut" -typedef struct _AlphaTextOutParams + +struct AlphaTextOutParams { HDC hDC; LPCTSTR lpString; @@ -351,111 +328,94 @@ typedef struct _AlphaTextOutParams UINT format; DWORD ARGBcolor; char reserv[16]; -}AlphaTextOutParams; +}; -int __inline AlphaText(HDC hDC, LPCTSTR lpString, int nCount, RECT * lpRect, UINT format, DWORD ARGBcolor) +int __inline AlphaText(HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect, UINT format, DWORD ARGBcolor) { - AlphaTextOutParams ap={0}; - ap.hDC=hDC; - ap.lpString=lpString; - ap.nCount=nCount; - ap.lpRect=lpRect; - ap.format=format; - ap.ARGBcolor=ARGBcolor; - return CallService(MS_SKINENG_ALPHATEXTOUT,(WPARAM)&ap,0); + AlphaTextOutParams ap = {}; + ap.hDC = hDC; + ap.lpString = lpString; + ap.nCount = nCount; + ap.lpRect = lpRect; + ap.format = format; + ap.ARGBcolor = ARGBcolor; + return CallService(MS_SKINENG_ALPHATEXTOUT, (WPARAM)&ap, 0); } //////////////////////////////////////////////////////////////////////////////// // Paints text with correct alpha channel and effect, alternative to DrawText // wParam - pointer to DrawTextWithEffectParam -typedef struct MODERNFONTEFFECT_tag -{ - BYTE effectIndex; - DWORD baseColour; // ARGB - DWORD secondaryColour; // ARGB -} -MODERNFONTEFFECT; - -typedef struct DrawTextWithEffectParam_tag +struct DrawTextWithEffectParam { - int cbSize; - HDC hdc; // handle to DC - LPCTSTR lpchText; // text to draw - int cchText; // length of text to draw - LPRECT lprc; // rectangle coordinates - UINT dwDTFormat; // formatting options - MODERNFONTEFFECT * pEffect; // effect to be drawn on -} DrawTextWithEffectParam; + HDC hdc; // handle to DC + LPCTSTR lpchText; // text to draw + int cchText; // length of text to draw + LPRECT lprc; // rectangle coordinates + UINT dwDTFormat; // formatting options + FONTEFFECT *pEffect; // effect to be drawn on +}; #define MS_DRAW_TEXT_WITH_EFFECTA "Modern/SkinEngine/DrawTextWithEffectA" #define MS_DRAW_TEXT_WITH_EFFECTW "Modern/SkinEngine/DrawTextWithEffectW" -#ifdef UNICODE - #define MS_DRAW_TEXT_WITH_EFFECT MS_DRAW_TEXT_WITH_EFFECTW -#else - #define MS_DRAW_TEXT_WITH_EFFECT MS_DRAW_TEXT_WITH_EFFECTA -#endif +#define MS_DRAW_TEXT_WITH_EFFECT MS_DRAW_TEXT_WITH_EFFECTW // Helper -int __inline DrawTextWithEffect( HDC hdc, LPCTSTR lpchText, int cchText, RECT * lprc, UINT dwDTFormat, MODERNFONTEFFECT * pEffect ) +int __inline DrawTextWithEffect(HDC hdc, LPCTSTR lpchText, int cchText, RECT *lprc, UINT dwDTFormat, FONTEFFECT *pEffect) { - DrawTextWithEffectParam params; - static BYTE bIfServiceExists = ServiceExists( MS_DRAW_TEXT_WITH_EFFECT ) ? 1 : 0; - if ( bIfServiceExists == 0 ) return DrawText ( hdc, lpchText, cchText, lprc, dwDTFormat ); - - // else - params.cbSize = sizeof( DrawTextWithEffectParam ); - params.hdc = hdc; - params.lpchText = lpchText; - params.cchText = cchText; - params.lprc = lprc; - params.dwDTFormat = dwDTFormat; - params.pEffect = pEffect; - return CallService( MS_DRAW_TEXT_WITH_EFFECT, (WPARAM)¶ms, 0 ); + if (!ServiceExists(MS_DRAW_TEXT_WITH_EFFECT) || pEffect == nullptr || pEffect->effectIndex == 0) + return DrawText(hdc, lpchText, cchText, lprc, dwDTFormat); + + DrawTextWithEffectParam params; + params.hdc = hdc; + params.lpchText = lpchText; + params.cchText = cchText; + params.lprc = lprc; + params.dwDTFormat = dwDTFormat; + params.pEffect = pEffect; + return CallService(MS_DRAW_TEXT_WITH_EFFECT, (WPARAM)¶ms, 0); } - -typedef struct _ImageListFixParam +struct ImageListFixParam { - HIMAGELIST himl; - int index; - HICON hicon; -}ImageListFixParam; + HIMAGELIST himl; + int index; + HICON hicon; +}; -typedef struct _DrawIconFixParam +struct DrawIconFixParam { - HDC hdc; - int xLeft; - int yTop; - HICON hIcon; - int cxWidth; - int cyWidth; - UINT istepIfAniCur; - HBRUSH hbrFlickerFreeDraw; - UINT diFlags; -} DrawIconFixParam; + HDC hdc; + int xLeft; + int yTop; + HICON hIcon; + int cxWidth; + int cyWidth; + UINT istepIfAniCur; + HBRUSH hbrFlickerFreeDraw; + UINT diFlags; +}; + //wParam - pointer to DrawIconFixParam #define MS_SKINENG_DRAWICONEXFIX "SkinEngine/DrawIconEx_Fix" -int __inline mod_DrawIconEx_helper(HDC hdc,int xLeft,int yTop,HICON hIcon,int cxWidth,int cyWidth, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags) +int __inline mod_DrawIconEx_helper(HDC hdc, int xLeft, int yTop, HICON hIcon, int cxWidth, int cyWidth, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags) { - DrawIconFixParam p={0}; - p.hdc=hdc; - p.xLeft=xLeft; - p.yTop=yTop; - p.hIcon=hIcon; - p.cxWidth=cxWidth; - p.cyWidth=cyWidth; - p.istepIfAniCur=istepIfAniCur; - p.hbrFlickerFreeDraw=hbrFlickerFreeDraw; - p.diFlags=diFlags; - return CallService(MS_SKINENG_DRAWICONEXFIX,(WPARAM)&p,0); + DrawIconFixParam p = { 0 }; + p.hdc = hdc; + p.xLeft = xLeft; + p.yTop = yTop; + p.hIcon = hIcon; + p.cxWidth = cxWidth; + p.cyWidth = cyWidth; + p.istepIfAniCur = istepIfAniCur; + p.hbrFlickerFreeDraw = hbrFlickerFreeDraw; + p.diFlags = diFlags; + return CallService(MS_SKINENG_DRAWICONEXFIX, (WPARAM)&p, 0); } - - - +//////////////////////////////////////////////////////////////////////////////// // Register of plugin's user // // wParam = (WPARAM)szSetting - string that describes a user @@ -464,14 +424,14 @@ int __inline mod_DrawIconEx_helper(HDC hdc,int xLeft,int yTop,HICON hIcon,int cx // "Status bar background/StatusBar" // lParam = (LPARAM)dwFlags // + #define MS_BACKGROUNDCONFIG_REGISTER "ModernBkgrCfg/Register" -// +//////////////////////////////////////////////////////////////////////////////// // Notification about changed background // wParam = ModuleName // lParam = 0 -#define ME_BACKGROUNDCONFIG_CHANGED "ModernBkgrCfg/Changed" - +#define ME_BACKGROUNDCONFIG_CHANGED "ModernBkgrCfg/Changed" #endif diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index 6ae63a592d..40e7dee727 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -257,7 +257,7 @@ void RegisterFontServiceFonts() fid.deffontsettings.size = (char)lf.lfHeight; fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0); fid.deffontsettings.charset = lf.lfCharSet; - fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL); + fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style & FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL); wcsncpy_s(fid.deffontsettings.szFace, lf.lfFaceName, _TRUNCATE); wcsncpy_s(fid.backgroundGroup, LPGENW("Message sessions") L"/" LPGENW("Single Messaging"), _TRUNCATE); wcsncpy_s(fid.group, LPGENW("Message sessions") L"/" LPGENW("Single Messaging"), _TRUNCATE); diff --git a/src/mir_app/src/FontOptions.cpp b/src/mir_app/src/FontOptions.cpp index b818058378..5e7f323e25 100644 --- a/src/mir_app/src/FontOptions.cpp +++ b/src/mir_app/src/FontOptions.cpp @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HWND hwndFontOptions = nullptr; -static int sttCompareFont(const FontInternal* p1, const FontInternal* p2) +static int sttCompareFont(const FontInternal *p1, const FontInternal *p2) { int result = mir_wstrcmp(p1->group, p2->group); if (result != 0) @@ -45,7 +45,7 @@ static int sttCompareFont(const FontInternal* p1, const FontInternal* p2) OBJLIST font_id_list(20, sttCompareFont), font_id_list_w2(20, sttCompareFont), font_id_list_w3(20, sttCompareFont); -static int sttCompareColour(const ColourInternal* p1, const ColourInternal* p2) +static int sttCompareColour(const ColourInternal *p1, const ColourInternal *p2) { int result = mir_wstrcmp(p1->group, p2->group); if (result != 0) @@ -60,7 +60,7 @@ static int sttCompareColour(const ColourInternal* p1, const ColourInternal* p2) OBJLIST colour_id_list(10, sttCompareColour), colour_id_list_w2(10, sttCompareColour), colour_id_list_w3(10, sttCompareColour); -static int sttCompareEffect(const EffectInternal* p1, const EffectInternal* p2) +static int sttCompareEffect(const EffectInternal *p1, const EffectInternal *p2) { int result = mir_wstrcmp(p1->group, p2->group); if (result != 0) @@ -136,45 +136,6 @@ MIR_APP_DLL(void) KillModuleEffects(HPLUGIN pPlugin) ///////////////////////////////////////////////////////////////////////////////////////// -struct DrawTextWithEffectParam -{ - int cbSize; - HDC hdc; // handle to DC - LPCTSTR lpchText; // text to draw - int cchText; // length of text to draw - LPRECT lprc; // rectangle coordinates - UINT dwDTFormat; // formatting options - FONTEFFECT * pEffect; // effect to be drawn on -}; - -#define MS_DRAW_TEXT_WITH_EFFECTA "Modern/SkinEngine/DrawTextWithEffectA" -#define MS_DRAW_TEXT_WITH_EFFECTW "Modern/SkinEngine/DrawTextWithEffectW" - -#define MS_DRAW_TEXT_WITH_EFFECT MS_DRAW_TEXT_WITH_EFFECTW - -// Helper -int __inline DrawTextWithEffect(HDC hdc, LPCTSTR lpchText, int cchText, RECT * lprc, UINT dwDTFormat, FONTEFFECT * pEffect) -{ - DrawTextWithEffectParam params; - BYTE bIfServiceExists = ServiceExists(MS_DRAW_TEXT_WITH_EFFECT) ? 1 : 0; - - if (pEffect == nullptr || pEffect->effectIndex == 0) - return DrawText(hdc, lpchText, cchText, lprc, dwDTFormat); // If no effect specified draw by GDI it just more careful with ClearType - - if (bIfServiceExists == 0) - return DrawText(hdc, lpchText, cchText, lprc, dwDTFormat); - - // else - params.cbSize = sizeof(DrawTextWithEffectParam); - params.hdc = hdc; - params.lpchText = lpchText; - params.cchText = cchText; - params.lprc = lprc; - params.dwDTFormat = dwDTFormat; - params.pEffect = pEffect; - return CallService(MS_DRAW_TEXT_WITH_EFFECT, (WPARAM)¶ms, 0); -} - #define UM_SETFONTGROUP (WM_USER + 101) #define FSUI_COLORBOXWIDTH 50 @@ -185,7 +146,7 @@ int __inline DrawTextWithEffect(HDC hdc, LPCTSTR lpchText, int cchText, RECT * l void UpdateFontSettings(FontIDW *font_id, FontSettingsW *fontsettings); void UpdateColourSettings(ColourIDW *colour_id, COLORREF *colour); -void UpdateEffectSettings(EffectIDW *effect_id, FONTEFFECT* effectsettings); +void UpdateEffectSettings(EffectIDW *effect_id, FONTEFFECT *effectsettings); static int CompareObj(const MBaseFontObjectW *p1, const MBaseFontObjectW *p2) { @@ -286,7 +247,7 @@ void OptionsChanged() UINT_PTR CALLBACK CFHookProc(HWND hdlg, UINT uiMsg, WPARAM, LPARAM lParam) { if (uiMsg == WM_INITDIALOG) { - CHOOSEFONT* cf = (CHOOSEFONT *)lParam; + CHOOSEFONT *cf = (CHOOSEFONT *)lParam; if (cf != nullptr) { if (cf->lCustData & FIDF_DISABLESTYLES) { EnableWindow(GetDlgItem(hdlg, 1137), FALSE); @@ -317,7 +278,7 @@ static BOOL sttFsuiBindColourIdToFonts(HWND hwndList, const wchar_t *name, const for (int i = SendMessage(hwndList, LB_GETCOUNT, 0, 0); i--;) { FSUIListItemData *itemData = (FSUIListItemData *)SendMessage(hwndList, LB_GETITEMDATA, i, 0); if (itemData && itemData->font_id >= 0) { - FontInternal& F = font_id_list_w2[itemData->font_id]; + FontInternal &F = font_id_list_w2[itemData->font_id]; if (name && !mir_wstrcmp(F.name, name)) { itemData->colour_id = colourId; @@ -339,7 +300,7 @@ static bool sttFsuiBindEffectIdToFonts(HWND hwndList, const wchar_t *name, int e for (int i = SendMessage(hwndList, LB_GETCOUNT, 0, 0); i--;) { FSUIListItemData *itemData = (FSUIListItemData *)SendMessage(hwndList, LB_GETITEMDATA, i, 0); if (itemData && itemData->font_id >= 0) { - FontInternal& F = font_id_list_w2[itemData->font_id]; + FontInternal &F = font_id_list_w2[itemData->font_id]; if (name && !mir_wstrcmp(F.name, name)) { itemData->effect_id = effectId; @@ -382,7 +343,7 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wc static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const wchar_t *groupName, HPLUGIN pPlugin) { wchar_t itemName[1024]; - wchar_t* sectionName; + wchar_t *sectionName; int sectionLevel = 0; HTREEITEM hSection = nullptr; @@ -391,7 +352,7 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const wchar_t *groupNam while (sectionName) { // allow multi-level tree - wchar_t* pItemName = sectionName; + wchar_t *pItemName = sectionName; HTREEITEM hItem; // one level deeper @@ -494,11 +455,11 @@ static void ShowEffectButton(HWND hwndDlg, BOOL bShow) ShowWindow(GetDlgItem(hwndDlg, IDC_EFFECT_STATIC), bShow ? SW_SHOW : SW_HIDE); } -wchar_t* ModernEffectNames[] = { LPGENW(""), LPGENW("Shadow at left"), LPGENW("Shadow at right"), LPGENW("Outline"), LPGENW("Outline smooth"), LPGENW("Smooth bump"), LPGENW("Contour thin"), LPGENW("Contour heavy") }; +wchar_t *ModernEffectNames[] = { LPGENW(""), LPGENW("Shadow at left"), LPGENW("Shadow at right"), LPGENW("Outline"), LPGENW("Outline smooth"), LPGENW("Smooth bump"), LPGENW("Contour thin"), LPGENW("Contour heavy") }; static INT_PTR CALLBACK ChooseEffectDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - static FONTEFFECT * pEffect = nullptr; + static FONTEFFECT *pEffect = nullptr; switch (uMsg) { case WM_INITDIALOG: @@ -648,7 +609,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, RebuildTree(hwndDlg); - SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETDEFAULTCOLOUR, 0, (LPARAM)GetSysColor(COLOR_WINDOW)); + SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETDEFAULTCOLOUR, 0, GetSysColor(COLOR_WINDOW)); return TRUE; case UM_SETFONTGROUP: @@ -677,7 +638,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, itemData->colour_id = -1; itemData->effect_id = -1; itemData->font_id = font_id_list_w2.indexOf(&it); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_ADDSTRING, (WPARAM)-1, (LPARAM)itemData); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_ADDSTRING, -1, (LPARAM)itemData); need_restart |= (it->flags & FIDF_NEEDRESTART); } @@ -697,7 +658,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, itemData->font_id = -1; itemData->effect_id = -1; - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_ADDSTRING, (WPARAM)-1, (LPARAM)itemData); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_ADDSTRING, -1, (LPARAM)itemData); } if (mir_wstrcmp(it->name, L"Background") == 0) @@ -718,7 +679,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, itemData->font_id = -1; itemData->colour_id = -1; - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_ADDSTRING, (WPARAM)-1, (LPARAM)itemData); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_ADDSTRING, -1, (LPARAM)itemData); } } @@ -792,7 +753,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, wchar_t *itemName = nullptr; FSUIListItemData *itemData = (FSUIListItemData *)dis->itemData; - FONTEFFECT * pEffect = nullptr; + FONTEFFECT *pEffect = nullptr; if (dis->CtlID != IDC_FONTLIST) break; @@ -936,7 +897,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { int *selItems = (int *)mir_alloc(font_id_list_w2.getCount() * sizeof(int)); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, selCount, (LPARAM)selItems); for (int i = 0; i < selCount; i++) { FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (IsBadReadPtr(itemData, sizeof(FSUIListItemData))) continue; // prevent possible problems with corrupted itemData @@ -949,7 +910,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, bEnableFont = 0; if (!bEnableFont || bEnableClText && (itemData->font_id < 0)) bEnableClText = 0; - if (bEnableReset && (itemData->font_id >= 0) && !(font_id_list_w2[itemData->font_id].flags&FIDF_DEFAULTVALID)) + if (bEnableReset && (itemData->font_id >= 0) && !(font_id_list_w2[itemData->font_id].flags & FIDF_DEFAULTVALID)) bEnableReset = 0; if (bEnableClBack && (itemData->colour_id >= 0) && (clBack == 0xffffffff)) @@ -981,7 +942,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_CHOOSEFONT: if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { int *selItems = (int *)mir_alloc(selCount * sizeof(int)); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, selCount, (LPARAM)selItems); FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[0], 0); if (itemData->font_id < 0) { @@ -991,7 +952,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, return TRUE; } - FontInternal& F = font_id_list_w2[itemData->font_id]; + FontInternal &F = font_id_list_w2[itemData->font_id]; CreateFromFontSettings(&F.value, &lf); CHOOSEFONT cf = { 0 }; @@ -1010,13 +971,13 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, lf.lfItalic = lf.lfUnderline = lf.lfStrikeOut = FALSE; } - if (ChooseFont(&cf)) { + if (ChooseFontW(&cf)) { for (int i = 0; i < selCount; i++) { FSUIListItemData *pItem = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (pItem->font_id < 0) continue; - FontInternal& F1 = font_id_list_w2[pItem->font_id]; + FontInternal &F1 = font_id_list_w2[pItem->font_id]; F1.value.size = (char)lf.lfHeight; F1.value.style = (lf.lfWeight >= FW_BOLD ? DBFONTF_BOLD : 0) | (lf.lfItalic ? DBFONTF_ITALIC : 0) | (lf.lfUnderline ? DBFONTF_UNDERLINE : 0) | (lf.lfStrikeOut ? DBFONTF_STRIKEOUT : 0); F1.value.charset = lf.lfCharSet; @@ -1026,7 +987,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, mis.CtlID = IDC_FONTLIST; mis.itemID = selItems[i]; mis.itemData = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); - SendMessage(hwndDlg, WM_MEASUREITEM, 0, (LPARAM)& mis); + SendMessage(hwndDlg, WM_MEASUREITEM, 0, (LPARAM)&mis); SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_SETITEMHEIGHT, selItems[i], mis.itemHeight); } InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), nullptr, TRUE); @@ -1041,9 +1002,9 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_EFFECT: if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { int *selItems = (int *)mir_alloc(selCount * sizeof(int)); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, selCount, (LPARAM)selItems); FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[0], 0); - EffectInternal& E = effect_id_list_w2[itemData->effect_id]; + EffectInternal &E = effect_id_list_w2[itemData->effect_id]; FONTEFFECT es = E.value; if (IDOK == DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHOOSE_FONT_EFFECT), hwndDlg, ChooseEffectDlgProc, (LPARAM)&es)) { @@ -1052,7 +1013,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (itemData->effect_id < 0) continue; - EffectInternal& E1 = effect_id_list_w2[itemData->effect_id]; + EffectInternal &E1 = effect_id_list_w2[itemData->effect_id]; E1.value = es; } InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), nullptr, TRUE); @@ -1067,7 +1028,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_FONTCOLOUR: if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { int *selItems = (int *)mir_alloc(selCount * sizeof(int)); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, selCount, (LPARAM)selItems); for (int i = 0; i < selCount; i++) { FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (itemData->font_id < 0) continue; @@ -1082,7 +1043,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_BKGCOLOUR: if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { int *selItems = (int *)mir_alloc(selCount * sizeof(int)); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, selCount, (LPARAM)selItems); for (int i = 0; i < selCount; i++) { FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (itemData->colour_id < 0) continue; @@ -1102,7 +1063,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_BTN_RESET: if (font_id_list_w2.getCount() && (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0))) { int *selItems = (int *)mir_alloc(font_id_list_w2.getCount() * sizeof(int)); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, selCount, (LPARAM)selItems); for (int i = 0; i < selCount; i++) { FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); if (IsBadReadPtr(itemData, sizeof(FSUIListItemData))) continue; // prevent possible problems with corrupted itemData @@ -1114,7 +1075,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, mis.CtlID = IDC_FONTLIST; mis.itemID = selItems[i]; mis.itemData = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); - SendMessage(hwndDlg, WM_MEASUREITEM, 0, (LPARAM)& mis); + SendMessage(hwndDlg, WM_MEASUREITEM, 0, (LPARAM)&mis); SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_SETITEMHEIGHT, selItems[i], mis.itemHeight); } diff --git a/src/mir_app/src/stdafx.h b/src/mir_app/src/stdafx.h index aa757d702f..7f2369cea5 100644 --- a/src/mir_app/src/stdafx.h +++ b/src/mir_app/src/stdafx.h @@ -92,6 +92,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include #include #include -- cgit v1.2.3