From ac5db5836f7fa25c8d5dca21ab2948ebfc66de87 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 21 Sep 2013 11:02:19 +0000 Subject: using Uxtheme in scriver git-svn-id: http://svn.miranda-ng.org/main/trunk@6148 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Scriver/scriver_10.vcxproj | 8 +-- plugins/Scriver/scriver_11.vcxproj | 8 +-- plugins/Scriver/src/chat/services.cpp | 2 +- plugins/Scriver/src/globals.cpp | 10 +-- plugins/Scriver/src/msglog.cpp | 2 +- plugins/Scriver/src/msgwindow.cpp | 119 +++++++++++++++++----------------- plugins/Scriver/src/richutil.cpp | 57 ++++------------ plugins/Scriver/src/richutil.h | 13 ---- 8 files changed, 87 insertions(+), 132 deletions(-) (limited to 'plugins') diff --git a/plugins/Scriver/scriver_10.vcxproj b/plugins/Scriver/scriver_10.vcxproj index 1dba1e2c96..cab93a63bd 100644 --- a/plugins/Scriver/scriver_10.vcxproj +++ b/plugins/Scriver/scriver_10.vcxproj @@ -90,7 +90,7 @@ ..\..\include\msapi - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;shlwapi.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true true @@ -123,7 +123,7 @@ ..\..\include\msapi - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;shlwapi.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true true @@ -155,7 +155,7 @@ ..\..\include\msapi - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;shlwapi.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true false @@ -183,7 +183,7 @@ ..\..\include\msapi - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;shlwapi.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true false diff --git a/plugins/Scriver/scriver_11.vcxproj b/plugins/Scriver/scriver_11.vcxproj index cba3b6dd0d..e30c09d19d 100644 --- a/plugins/Scriver/scriver_11.vcxproj +++ b/plugins/Scriver/scriver_11.vcxproj @@ -94,7 +94,7 @@ ..\..\include\msapi - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;shlwapi.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true true @@ -126,7 +126,7 @@ ..\..\include\msapi - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;shlwapi.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true true @@ -157,7 +157,7 @@ ..\..\include\msapi - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;shlwapi.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true false @@ -186,7 +186,7 @@ ..\..\include\msapi - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + comctl32.lib;shlwapi.lib;UxTheme.lib;%(AdditionalDependencies) type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27*%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies) true false diff --git a/plugins/Scriver/src/chat/services.cpp b/plugins/Scriver/src/chat/services.cpp index bfdc56b867..aa1b4c5891 100644 --- a/plugins/Scriver/src/chat/services.cpp +++ b/plugins/Scriver/src/chat/services.cpp @@ -116,7 +116,7 @@ static INT_PTR Service_GetInfo(WPARAM wParam,LPARAM lParam) void LoadModuleIcons(MODULEINFO *mi) { - HIMAGELIST hList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0); + HIMAGELIST hList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0); int overlayIcon = ImageList_AddIcon(hList, GetCachedIcon("chat_overlay")); ImageList_SetOverlayImage(hList, overlayIcon, 1); diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 8222eadb46..1afbfd9c24 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -260,11 +260,11 @@ void InitGlobals() g_dat.hTabIconList = NULL; g_dat.tabIconListUsage = NULL; g_dat.tabIconListUsageSize = 0; - g_dat.hButtonIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0); - g_dat.hChatButtonIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0); - g_dat.hTabIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0); - g_dat.hHelperIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0); - g_dat.hSearchEngineIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0); + g_dat.hButtonIconList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0); + g_dat.hChatButtonIconList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0); + g_dat.hTabIconList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0); + g_dat.hHelperIconList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0); + g_dat.hSearchEngineIconList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0); g_dat.draftList = NULL; g_dat.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); g_dat.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index d3b1a92aa9..2aebe789e0 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -965,7 +965,7 @@ void LoadMsgLogIcons(void) HICON hIcon = NULL; RECT rc; - g_hImageList = ImageList_Create(10, 10, IsWinVerXPPlus()? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, sizeof(pLogIconBmpBits) / sizeof(pLogIconBmpBits[0]), 0); + g_hImageList = ImageList_Create(10, 10, ILC_COLOR32 | ILC_MASK, SIZEOF(pLogIconBmpBits), 0); HBRUSH hBkgBrush = CreateSolidBrush(db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); HBRUSH hInBkgBrush = CreateSolidBrush(db_get_dw(NULL, SRMMMOD, SRMSGSET_INCOMINGBKGCOLOUR, SRMSGDEFSET_INCOMINGBKGCOLOUR)); HBRUSH hOutBkgBrush = CreateSolidBrush(db_get_dw(NULL, SRMMMOD, SRMSGSET_OUTGOINGBKGCOLOUR, SRMSGDEFSET_OUTGOINGBKGCOLOUR)); diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index a7d4cf726e..99029f9758 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -35,12 +35,14 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); extern TCHAR *GetNickname(HANDLE hContact, const char* szProto); -void SubclassTabCtrl(HWND hwnd) { +void SubclassTabCtrl(HWND hwnd) +{ mir_subclassWindow(hwnd, TabCtrlProc); SendMessage(hwnd, EM_SUBCLASSED, 0, 0); } -void UnsubclassTabCtrl(HWND hwnd) { +void UnsubclassTabCtrl(HWND hwnd) +{ SendMessage(hwnd, EM_UNSUBCLASSED, 0, 0); } @@ -205,7 +207,6 @@ static int GetTabFromHWND(ParentWindowData *dat, HWND child) } } return -1; - } static MessageWindowTabData * GetChildFromTab(HWND hwndTabs, int tabId) @@ -274,37 +275,37 @@ static void SetupStatusBar(ParentWindowData *dat) SendMessage(dat->hwndStatus, SB_SETTEXT, (WPARAM)(SBT_NOBORDERS) | 3, 0); } -static int AddOrReplaceIcon(HIMAGELIST hList, int prevIndex, HICON hIcon) { - int usageIdx = -1; - int i; - for (i = 0; i < g_dat.tabIconListUsageSize; i++) { +static int AddOrReplaceIcon(HIMAGELIST hList, int prevIndex, HICON hIcon) +{ + int usageIdx = -1; + for (int i = 0; i < g_dat.tabIconListUsageSize; i++) { if (!g_dat.tabIconListUsage[i].used && usageIdx == -1) { - usageIdx = i; + usageIdx = i; + } + if (g_dat.tabIconListUsage[i].index == prevIndex) { + usageIdx = i; + break; } - if (g_dat.tabIconListUsage[i].index == prevIndex) { - usageIdx = i; - break; - } - } - if (usageIdx == -1) { - usageIdx = g_dat.tabIconListUsageSize; - g_dat.tabIconListUsage = (ImageListUsageEntry*) mir_realloc(g_dat.tabIconListUsage, sizeof(ImageListUsageEntry) * (g_dat.tabIconListUsageSize + 1)); - g_dat.tabIconListUsageSize++; - } else { - prevIndex = g_dat.tabIconListUsage[usageIdx].index; - } - g_dat.tabIconListUsage[usageIdx].used = 1; - g_dat.tabIconListUsage[usageIdx].index = (int) ImageList_ReplaceIcon(hList, prevIndex, hIcon); - return g_dat.tabIconListUsage[usageIdx].index; + } + if (usageIdx == -1) { + usageIdx = g_dat.tabIconListUsageSize; + g_dat.tabIconListUsage = (ImageListUsageEntry*) mir_realloc(g_dat.tabIconListUsage, sizeof(ImageListUsageEntry) * (g_dat.tabIconListUsageSize + 1)); + g_dat.tabIconListUsageSize++; + } else { + prevIndex = g_dat.tabIconListUsage[usageIdx].index; + } + g_dat.tabIconListUsage[usageIdx].used = 1; + g_dat.tabIconListUsage[usageIdx].index = (int) ImageList_ReplaceIcon(hList, prevIndex, hIcon); + return g_dat.tabIconListUsage[usageIdx].index; } -static void ReleaseIcon(int index) { - int i; - for (i = 0; i < g_dat.tabIconListUsageSize; i++) { - if (g_dat.tabIconListUsage[i].index == index) { - g_dat.tabIconListUsage[i].used = 0; - } - } +static void ReleaseIcon(int index) +{ + for (int i = 0; i < g_dat.tabIconListUsageSize; i++) { + if (g_dat.tabIconListUsage[i].index == index) { + g_dat.tabIconListUsage[i].used = 0; + } + } } static void ActivateChild(ParentWindowData *dat, HWND child) { @@ -312,8 +313,8 @@ static void ActivateChild(ParentWindowData *dat, HWND child) { RECT rcChild; GetChildWindowRect(dat, &rcChild); SetWindowPos(child, HWND_TOP, rcChild.left, rcChild.top, rcChild.right-rcChild.left, rcChild.bottom - rcChild.top, SWP_NOSIZE); - - i = GetTabFromHWND(dat, child); + + i = GetTabFromHWND(dat, child); if ( i == -1 ) return; else { @@ -359,8 +360,7 @@ static void AddChild(ParentWindowData *dat, HWND hwnd, HANDLE hContact) SetWindowPos(mwtd->hwnd, HWND_TOP, dat->childRect.left, dat->childRect.top, dat->childRect.right-dat->childRect.left, dat->childRect.bottom - dat->childRect.top, SWP_HIDEWINDOW); SendMessage(dat->hwnd, WM_SIZE, 0, 0); - if (MyEnableThemeDialogTexture) - MyEnableThemeDialogTexture(hwnd, ETDT_ENABLETAB); + EnableThemeDialogTexture(hwnd, ETDT_ENABLETAB); } static void RemoveChild(ParentWindowData *dat, HWND child) @@ -1153,7 +1153,7 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar int bSelected = lpDIS->itemState & ODS_SELECTED; int atTop = (GetWindowLongPtr(hwnd, GWL_STYLE) & TCS_BOTTOM) == 0; UINT dwFormat; - if (!MyIsAppThemed || !MyIsAppThemed()) { + if (!IsAppThemed()) { FillRect(lpDIS->hDC, &rect, GetSysColorBrush(COLOR_BTNFACE)); } else @@ -1170,10 +1170,10 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar if (!bSelected) InflateRect(&rectTab, 1, 1); - hTheme = MyOpenThemeData(hwnd, L"TAB"); - if (MyIsThemeBackgroundPartiallyTransparent(hTheme, TABP_TABITEM, tstate)) - MyDrawThemeParentBackground(hwnd, lpDIS->hDC, &rectTab); - MyDrawThemeBackground(hTheme, lpDIS->hDC, TABP_TABITEM, tstate, &rectTab, NULL); + hTheme = OpenThemeData(hwnd, L"TAB"); + if (IsThemeBackgroundPartiallyTransparent(hTheme, TABP_TABITEM, tstate)) + DrawThemeParentBackground(hwnd, lpDIS->hDC, &rectTab); + DrawThemeBackground(hTheme, lpDIS->hDC, TABP_TABITEM, tstate, &rectTab, NULL); } if (atTop) { dwFormat = DT_SINGLELINE|DT_TOP|DT_CENTER|DT_NOPREFIX|DT_NOCLIP; @@ -1185,10 +1185,10 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar rect.left = rIcon.left + (info.rcImage.right - info.rcImage.left); } if (dat->flags2 & SMF2_TABCLOSEBUTTON) { - ImageList_GetImageInfo(g_dat.hButtonIconList, 0, &info); - rIcon.left = rect.right - GetSystemMetrics(SM_CXEDGE) - (bSelected ? 6 : 2) - (info.rcImage.right - info.rcImage.left); - ImageList_DrawEx(g_dat.hButtonIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL); - rect.right = rIcon.left - 1; + ImageList_GetImageInfo(g_dat.hButtonIconList, 0, &info); + rIcon.left = rect.right - GetSystemMetrics(SM_CXEDGE) - (bSelected ? 6 : 2) - (info.rcImage.right - info.rcImage.left); + ImageList_DrawEx(g_dat.hButtonIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL); + rect.right = rIcon.left - 1; } rect.top += GetSystemMetrics(SM_CYEDGE) + 2; } else { @@ -1201,17 +1201,17 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar rect.left = rIcon.left + (info.rcImage.right - info.rcImage.left); } if (dat->flags2 & SMF2_TABCLOSEBUTTON) { - ImageList_GetImageInfo(g_dat.hButtonIconList, 0, &info); - rIcon.top = rect.bottom - (info.rcImage.bottom - info.rcImage.top) - 2; - rIcon.left = rect.right - GetSystemMetrics(SM_CXEDGE) - (bSelected ? 6 : 2) - (info.rcImage.right - info.rcImage.left); - ImageList_DrawEx(g_dat.hButtonIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL); - rect.right = rIcon.left - 1; + ImageList_GetImageInfo(g_dat.hButtonIconList, 0, &info); + rIcon.top = rect.bottom - (info.rcImage.bottom - info.rcImage.top) - 2; + rIcon.left = rect.right - GetSystemMetrics(SM_CXEDGE) - (bSelected ? 6 : 2) - (info.rcImage.right - info.rcImage.left); + ImageList_DrawEx(g_dat.hButtonIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL); + rect.right = rIcon.left - 1; } rect.bottom -= GetSystemMetrics(SM_CYEDGE) + 2; } if (hTheme) { - MyDrawThemeText(hTheme, lpDIS->hDC, TABP_TABITEM, tstate, szLabel, -1, dwFormat, 0, &rect); + DrawThemeText(hTheme, lpDIS->hDC, TABP_TABITEM, tstate, szLabel, -1, dwFormat, 0, &rect); } else @@ -1239,7 +1239,8 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar hlRect.bottom--; FrameRect(lpDIS->hDC, &hlRect, GetSysColorBrush(COLOR_HIGHLIGHT)); } - if (hTheme) MyCloseThemeData(hTheme); + if (hTheme) + CloseThemeData(hTheme); } } } @@ -1248,16 +1249,16 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { TabCtrlData *dat; dat = (TabCtrlData *) GetWindowLongPtr(hwnd, GWLP_USERDATA); - switch(msg) { - case EM_SUBCLASSED: + switch(msg) { + case EM_SUBCLASSED: dat = (TabCtrlData *) mir_alloc(sizeof(TabCtrlData)); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) dat); dat->bDragging = FALSE; dat->bDragged = FALSE; dat->srcTab = -1; dat->destTab = -1; - return 0; - case WM_MBUTTONDOWN: + return 0; + case WM_MBUTTONDOWN: { TCITEM tci; int tabId; @@ -1273,10 +1274,10 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (mwtd != NULL) { SendMessage(mwtd->hwnd, WM_CLOSE, 0, 0); dat->srcTab = -1; - } + } } - return 0; - } + return 0; + } case WM_LBUTTONDBLCLK: { TCHITTESTINFO thinfo; @@ -1408,7 +1409,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) NotifyLocalWinEvent(hContact, hChild, MSG_WINDOW_EVT_OPENING); NotifyLocalWinEvent(hContact, hChild, MSG_WINDOW_EVT_OPEN); ShowWindow(hParent, SW_SHOWNA); - EnableWindow(hParent, TRUE); + EnableWindow(hParent, TRUE); } } } else { @@ -1532,7 +1533,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } } break; - case EM_UNSUBCLASSED: + case EM_UNSUBCLASSED: mir_free(dat); return 0; } diff --git a/plugins/Scriver/src/richutil.cpp b/plugins/Scriver/src/richutil.cpp index baf0e5c2dc..8cd9eb4abc 100644 --- a/plugins/Scriver/src/richutil.cpp +++ b/plugins/Scriver/src/richutil.cpp @@ -45,20 +45,6 @@ static int RichUtil_CmpVal(void *p1, void *p2) return (int)((INT_PTR)tp1->hwnd - (INT_PTR)tp2->hwnd); } -// UxTheme Stuff -HMODULE mTheme; - -HANDLE (WINAPI *MyOpenThemeData)(HWND, LPCWSTR); -HRESULT (WINAPI *MyCloseThemeData)(HANDLE); -BOOL (WINAPI *MyIsThemeActive)(VOID); -HRESULT (WINAPI *MyDrawThemeBackground)(HANDLE, HDC, int, int, LPCRECT, LPCRECT); -HRESULT (WINAPI *MyGetThemeBackgroundContentRect)(HANDLE, HDC, int, int, LPCRECT, LPRECT); -HRESULT (WINAPI *MyDrawThemeParentBackground)(HWND, HDC, LPRECT); -BOOL (WINAPI *MyIsThemeBackgroundPartiallyTransparent)(HANDLE, int, int); -HRESULT (WINAPI *MyDrawThemeText)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, LPCRECT); -HRESULT (WINAPI *MyEnableThemeDialogTexture)(HWND, DWORD); -BOOL (WINAPI *MyIsAppThemed)(VOID); - static CRITICAL_SECTION csRich; static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); @@ -70,31 +56,12 @@ void RichUtil_Load(void) sListInt.sortFunc = RichUtil_CmpVal; InitializeCriticalSection(&csRich); - - mTheme = IsWinVerXPPlus() ? GetModuleHandleA("uxtheme") : 0; - if (!mTheme) - return; - - MyOpenThemeData = (HANDLE (WINAPI *)(HWND, LPCWSTR))GetProcAddress(mTheme, "OpenThemeData"); - MyCloseThemeData = (HRESULT (WINAPI *)(HANDLE))GetProcAddress(mTheme, "CloseThemeData"); - MyIsThemeActive = (BOOL (WINAPI *)())GetProcAddress(mTheme, "IsThemeActive"); - MyIsAppThemed = (BOOL (WINAPI *)(VOID))GetProcAddress(mTheme, "IsAppThemed"); - MyDrawThemeBackground = (HRESULT (WINAPI *)(HANDLE, HDC, int, int, const RECT*, const RECT *))GetProcAddress(mTheme, "DrawThemeBackground"); - MyGetThemeBackgroundContentRect = (HRESULT (WINAPI *)(HANDLE, HDC, int, int, const RECT *, RECT *))GetProcAddress(mTheme, "GetThemeBackgroundContentRect"); - MyDrawThemeParentBackground = (HRESULT (WINAPI *)(HWND, HDC, RECT*))GetProcAddress(mTheme, "DrawThemeParentBackground"); - MyIsThemeBackgroundPartiallyTransparent = (BOOL (WINAPI *)(HANDLE, int, int))GetProcAddress(mTheme, "IsThemeBackgroundPartiallyTransparent"); - MyDrawThemeText = (HRESULT (WINAPI *)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, const RECT *))GetProcAddress(mTheme, "DrawThemeText"); - MyEnableThemeDialogTexture = (HRESULT (WINAPI *)(HWND, DWORD))GetProcAddress(mTheme, "EnableThemeDialogTexture"); - if (!MyOpenThemeData || !MyCloseThemeData || !MyIsThemeActive || !MyDrawThemeBackground || - !MyGetThemeBackgroundContentRect || !MyDrawThemeParentBackground || !MyIsThemeBackgroundPartiallyTransparent) - mTheme = NULL; } void RichUtil_Unload(void) { List_Destroy(&sListInt); DeleteCriticalSection(&csRich); - mTheme = NULL; } int RichUtil_SubClass(HWND hwndEdit) @@ -140,9 +107,9 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_NCPAINT: ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam); - if (ru->hasUglyBorder && MyIsThemeActive()) + if (ru->hasUglyBorder && IsThemeActive()) { - HANDLE hTheme = MyOpenThemeData(ru->hwnd, L"EDIT"); + HANDLE hTheme = OpenThemeData(ru->hwnd, L"EDIT"); if (hTheme) { @@ -161,8 +128,8 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM rcClient.bottom -= ru->rect.bottom; ExcludeClipRect(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); - if (MyIsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL)) - MyDrawThemeParentBackground(hwnd, hdc, &rcBorder); + if (IsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL)) + DrawThemeParentBackground(hwnd, hdc, &rcBorder); if (!IsWindowEnabled(hwnd)) nState = ETS_DISABLED; @@ -170,8 +137,8 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM nState = ETS_READONLY; else nState = ETS_NORMAL; - MyDrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL); - MyCloseThemeData(hTheme); + DrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL); + CloseThemeData(hTheme); ReleaseDC(hwnd, hdc); return 0; } @@ -183,25 +150,25 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam); NCCALCSIZE_PARAMS *ncsParam = (NCCALCSIZE_PARAMS*)lParam; - if (ru->hasUglyBorder && MyIsThemeActive()) { - HANDLE hTheme = MyOpenThemeData(hwnd, L"EDIT"); + if (ru->hasUglyBorder && IsThemeActive()) { + HANDLE hTheme = OpenThemeData(hwnd, L"EDIT"); if (hTheme) { RECT rcClient ={0}; HDC hdc = GetDC(GetParent(hwnd)); - if (MyGetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) { + if (GetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) { ru->rect.left = rcClient.left-ncsParam->rgrc[0].left; ru->rect.top = rcClient.top-ncsParam->rgrc[0].top; ru->rect.right = ncsParam->rgrc[0].right-rcClient.right; ru->rect.bottom = ncsParam->rgrc[0].bottom-rcClient.bottom; ncsParam->rgrc[0] = rcClient; - MyCloseThemeData(hTheme); + CloseThemeData(hTheme); ReleaseDC(GetParent(hwnd), hdc); return WVR_REDRAW; } ReleaseDC(GetParent(hwnd), hdc); - MyCloseThemeData(hTheme); + CloseThemeData(hTheme); } } } @@ -229,7 +196,7 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM static void RichUtil_ClearUglyBorder(TRichUtil *ru) { - if (mTheme && MyIsThemeActive() && GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE) & WS_EX_STATICEDGE) { + if (IsThemeActive() && GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE) & WS_EX_STATICEDGE) { ru->hasUglyBorder = 1; SetWindowLongPtr(ru->hwnd, GWL_EXSTYLE, GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE) ^ WS_EX_STATICEDGE); } diff --git a/plugins/Scriver/src/richutil.h b/plugins/Scriver/src/richutil.h index 07d8e06329..f256085b69 100644 --- a/plugins/Scriver/src/richutil.h +++ b/plugins/Scriver/src/richutil.h @@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SRMM_RICHUTIL_H #define RWinVerMajor() LOBYTE(LOWORD(GetVersion())) -#define RIsWinVerXPPlus() (RWinVerMajor()>=5 && LOWORD(GetVersion())!=5) typedef struct { HWND hwnd; @@ -36,16 +35,4 @@ void RichUtil_Load(); void RichUtil_Unload(); int RichUtil_SubClass(HWND hwndEdit); -extern HMODULE mTheme; -extern BOOL (WINAPI *MyIsAppThemed)(VOID); -extern BOOL (WINAPI *MyIsThemeActive)(); -extern BOOL (WINAPI *MyIsThemeBackgroundPartiallyTransparent)(HANDLE,int,int); -extern HANDLE (WINAPI *MyOpenThemeData)(HWND,LPCWSTR); -extern HRESULT (WINAPI *MyCloseThemeData)(HANDLE); -extern HRESULT (WINAPI *MyDrawThemeBackground)(HANDLE,HDC,int,int,const RECT*,const RECT *); -extern HRESULT (WINAPI *MyGetThemeBackgroundContentRect)(HANDLE,HDC,int,int,const RECT *,RECT *); -extern HRESULT (WINAPI *MyDrawThemeParentBackground)(HWND,HDC,RECT*); -extern HRESULT (WINAPI *MyDrawThemeText)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, const RECT *); -extern HRESULT (WINAPI *MyEnableThemeDialogTexture)(HWND, DWORD); - #endif -- cgit v1.2.3