diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-09-21 17:37:33 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-09-21 17:37:33 +0000 |
commit | fdbc3639a50f40879f390f17ce7aafd5a579a7ab (patch) | |
tree | f2dc612f9d188cfb955b4393e207e5363bcd4e4e /src/core/stdchat | |
parent | 96325150479b8c93a5e48ac2591f3c7da5f0f9d4 (diff) |
Core cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@6165 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core/stdchat')
-rw-r--r-- | src/core/stdchat/src/chat.h | 8 | ||||
-rw-r--r-- | src/core/stdchat/src/main.cpp | 5 | ||||
-rw-r--r-- | src/core/stdchat/src/richutil.cpp | 71 | ||||
-rw-r--r-- | src/core/stdchat/src/richutil.h | 1 | ||||
-rw-r--r-- | src/core/stdchat/stdchat_10.vcxproj | 8 | ||||
-rw-r--r-- | src/core/stdchat/stdchat_11.vcxproj | 8 |
6 files changed, 35 insertions, 66 deletions
diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h index 72e3ecd5cf..e15a85e06e 100644 --- a/src/core/stdchat/src/chat.h +++ b/src/core/stdchat/src/chat.h @@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <shellapi.h>
#include <Initguid.h>
#include <Oleacc.h>
+#include <Uxtheme.h>
#include <malloc.h>
#include <time.h>
@@ -57,12 +58,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_icolib.h>
#include <m_popup.h>
#include <m_chat.h>
+#include <m_core.h>
-#include "resource.h"
-#include "version.h"
#include "m_ieview.h"
#include "m_smileyadd.h"
+#include "resource.h"
+#include "version.h"
+#include "richutil.h"
+
#ifndef NDEBUG
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index 75435f57db..0a5c4bbf2f 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -113,7 +113,6 @@ extern "C" __declspec(dllexport) int Unload(void) DestroyHookableEvents();
FreeIcons();
OptionsUnInit();
- FreeLibrary(GetModuleHandle(_T("riched20.dll")));
UnhookEvents();
return 0;
}
@@ -179,8 +178,8 @@ void LoadIcons(void) LoadLogIcons();
LoadMsgLogBitmaps();
- hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),IsWinVerXPPlus()? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK,0,3);
- hIconsList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),IsWinVerXPPlus()? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK,0,100);
+ hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 3);
+ hIconsList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 100);
ImageList_AddIcon(hIconsList,LoadSkinnedIcon( SKINICON_EVENT_MESSAGE));
ImageList_AddIcon(hIconsList,LoadIconEx( "overlay", FALSE ));
ImageList_SetOverlayImage(hIconsList, 1, 1);
diff --git a/src/core/stdchat/src/richutil.cpp b/src/core/stdchat/src/richutil.cpp index 46c9e5c28e..8bcc79b509 100644 --- a/src/core/stdchat/src/richutil.cpp +++ b/src/core/stdchat/src/richutil.cpp @@ -19,12 +19,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <windows.h>
-#include <stdio.h>
-#include <richedit.h>
-#include <m_core.h>
-#include "richutil.h"
+#include "chat.h"
/*
To initialize this library, call:
@@ -121,50 +117,20 @@ void rlist_free(RList *list) { }
}
-// UxTheme Stuff
-static HMODULE mTheme = 0;
-static HANDLE (WINAPI *MyOpenThemeData)(HWND,LPCWSTR) = 0;
-static HRESULT (WINAPI *MyCloseThemeData)(HANDLE) = 0;
-static BOOL (WINAPI *MyIsThemeActive)() = 0;
-static HRESULT (WINAPI *MyDrawThemeBackground)(HANDLE,HDC,int,int,const RECT*,const RECT *) = 0;
-static HRESULT (WINAPI *MyGetThemeBackgroundContentRect)(HANDLE,HDC,int,int,const RECT *,RECT *) = 0;
-static HRESULT (WINAPI *MyDrawThemeParentBackground)(HWND,HDC,RECT*) = 0;
-static BOOL (WINAPI *MyIsThemeBackgroundPartiallyTransparent)(HANDLE,int,int) = 0;
-
static RList *slist = NULL;
static CRITICAL_SECTION csRich;
static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
static VOID RichUtil_ClearUglyBorder(TRichUtil *ru);
-void RichUtil_Load() {
- mTheme = RIsWinVerXPPlus()?LoadLibraryA("uxtheme.dll"):0;
+void RichUtil_Load()
+{
InitializeCriticalSection(&csRich);
- if (!mTheme) return;
- MyOpenThemeData = (HANDLE (WINAPI *)(HWND, LPCWSTR))GetProcAddress(mTheme, "OpenThemeData");
- MyCloseThemeData = (HRESULT (WINAPI *)(HANDLE))GetProcAddress(mTheme, "CloseThemeData");
- MyIsThemeActive = (BOOL (WINAPI *)())GetProcAddress(mTheme, "IsThemeActive");
- 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");
- if (!MyOpenThemeData||
- !MyCloseThemeData||
- !MyIsThemeActive||
- !MyDrawThemeBackground||
- !MyGetThemeBackgroundContentRect||
- !MyDrawThemeParentBackground||
- !MyIsThemeBackgroundPartiallyTransparent) {
- FreeLibrary(mTheme);
- mTheme=NULL;
- }
}
-void RichUtil_Unload() {
+void RichUtil_Unload()
+{
DeleteCriticalSection(&csRich);
- if (mTheme) {
- FreeLibrary(mTheme);
- }
}
int RichUtil_SubClass(HWND hwndEdit) {
@@ -201,8 +167,8 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_NCPAINT:
{
LRESULT ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
- if (ru->hasUglyBorder&&MyIsThemeActive()) {
- HANDLE hTheme = MyOpenThemeData(ru->hwnd, L"EDIT");
+ if (ru->hasUglyBorder && IsThemeActive()) {
+ HANDLE hTheme = OpenThemeData(ru->hwnd, L"EDIT");
if (hTheme) {
RECT rcBorder;
@@ -219,15 +185,15 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM rcClient.right -= ru->rect.right;
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;
else if(SendMessage(hwnd, EM_GETOPTIONS, 0, 0) & ECO_READONLY)
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;
}
@@ -239,26 +205,26 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM LRESULT 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;
HDC hdc = GetDC(GetParent(hwnd));
ZeroMemory(&rcClient, sizeof(RECT));
- 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;
CopyRect(&ncsParam->rgrc[0], &rcClient);
- MyCloseThemeData(hTheme);
+ CloseThemeData(hTheme);
ReleaseDC(GetParent(hwnd), hdc);
return WVR_REDRAW;
}
ReleaseDC(GetParent(hwnd), hdc);
- MyCloseThemeData(hTheme);
+ CloseThemeData(hTheme);
}
}
return ret;
@@ -281,8 +247,9 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
}
-static VOID RichUtil_ClearUglyBorder(TRichUtil *ru) {
- if (mTheme&&MyIsThemeActive()&&GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE)&WS_EX_CLIENTEDGE) {
+static VOID RichUtil_ClearUglyBorder(TRichUtil *ru)
+{
+ if (IsThemeActive() && GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE)&WS_EX_CLIENTEDGE) {
ru->hasUglyBorder = 1;
SetWindowLongPtr(ru->hwnd, GWL_EXSTYLE, GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE)^WS_EX_CLIENTEDGE);
}
diff --git a/src/core/stdchat/src/richutil.h b/src/core/stdchat/src/richutil.h index 97d85aeddf..c1b14bd280 100644 --- a/src/core/stdchat/src/richutil.h +++ b/src/core/stdchat/src/richutil.h @@ -23,7 +23,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)
#ifndef WM_THEMECHANGED
#define WM_THEMECHANGED 0x031A
diff --git a/src/core/stdchat/stdchat_10.vcxproj b/src/core/stdchat/stdchat_10.vcxproj index 4400a4a665..857c2f9094 100644 --- a/src/core/stdchat/stdchat_10.vcxproj +++ b/src/core/stdchat/stdchat_10.vcxproj @@ -91,7 +91,7 @@ </ResourceCompile>
<Link>
<AdditionalOptions>/DLL %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>Version.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalManifestDependencies>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>
<GenerateDebugInformation>true</GenerateDebugInformation>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
@@ -121,7 +121,7 @@ </ResourceCompile>
<Link>
<AdditionalOptions>/DLL %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>Version.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalManifestDependencies>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)</AdditionalManifestDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
@@ -154,7 +154,7 @@ </ResourceCompile>
<Link>
<AdditionalOptions>/PDBALTPATH:%_PDB%</AdditionalOptions>
- <AdditionalDependencies>Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>Version.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalManifestDependencies>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>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OptimizeReferences>true</OptimizeReferences>
@@ -189,7 +189,7 @@ </ResourceCompile>
<Link>
<AdditionalOptions>/PDBALTPATH:%_PDB%</AdditionalOptions>
- <AdditionalDependencies>Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>Version.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalManifestDependencies>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)</AdditionalManifestDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OptimizeReferences>true</OptimizeReferences>
diff --git a/src/core/stdchat/stdchat_11.vcxproj b/src/core/stdchat/stdchat_11.vcxproj index b227bd45cc..f4dc3202e8 100644 --- a/src/core/stdchat/stdchat_11.vcxproj +++ b/src/core/stdchat/stdchat_11.vcxproj @@ -95,7 +95,7 @@ </ResourceCompile>
<Link>
<AdditionalOptions>/DLL %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>Version.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalManifestDependencies>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>
<GenerateDebugInformation>true</GenerateDebugInformation>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
@@ -126,7 +126,7 @@ </ResourceCompile>
<Link>
<AdditionalOptions>/DLL %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>Version.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalManifestDependencies>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)</AdditionalManifestDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
@@ -158,7 +158,7 @@ <AdditionalIncludeDirectories>..\..\..\include;..\..\..\include\msapi</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
- <AdditionalDependencies>Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>Version.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalManifestDependencies>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>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OptimizeReferences>true</OptimizeReferences>
@@ -192,7 +192,7 @@ <AdditionalIncludeDirectories>..\..\..\include;..\..\..\include\msapi</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
- <AdditionalDependencies>Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>Version.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalManifestDependencies>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)</AdditionalManifestDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OptimizeReferences>true</OptimizeReferences>
|