aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/PlatWin.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r--win32/PlatWin.cxx64
1 files changed, 36 insertions, 28 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index c1d1f7cd1..4d31e5af5 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -57,23 +57,10 @@
#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
#endif
-static void *PointerFromWindow(HWND hWnd) {
- return reinterpret_cast<void *>(::GetWindowLongPtr(hWnd, 0));
-}
-
-static void SetWindowPointer(HWND hWnd, void *ptr) {
- ::SetWindowLongPtr(hWnd, 0, reinterpret_cast<LONG_PTR>(ptr));
-}
-
-extern UINT CodePageFromCharSet(DWORD characterSet, UINT documentCodePage);
-
-static CRITICAL_SECTION crPlatformLock;
-static HINSTANCE hinstPlatformRes = 0;
-
-static HCURSOR reverseArrowCursor = NULL;
-
namespace Scintilla {
+UINT CodePageFromCharSet(DWORD characterSet, UINT documentCodePage);
+
static RECT RectFromPRectangle(PRectangle prc) {
RECT rc = {static_cast<LONG>(prc.left), static_cast<LONG>(prc.top),
static_cast<LONG>(prc.right), static_cast<LONG>(prc.bottom)};
@@ -240,6 +227,19 @@ HFONT FormatAndMetrics::HFont() {
namespace {
+void *PointerFromWindow(HWND hWnd) {
+ return reinterpret_cast<void *>(::GetWindowLongPtr(hWnd, 0));
+}
+
+void SetWindowPointer(HWND hWnd, void *ptr) {
+ ::SetWindowLongPtr(hWnd, 0, reinterpret_cast<LONG_PTR>(ptr));
+}
+
+CRITICAL_SECTION crPlatformLock;
+HINSTANCE hinstPlatformRes = 0;
+
+HCURSOR reverseArrowCursor = NULL;
+
FormatAndMetrics *FamFromFontID(void *fid) {
return static_cast<FormatAndMetrics *>(fid);
}
@@ -280,9 +280,7 @@ D2D1_TEXT_ANTIALIAS_MODE DWriteMapFontQuality(int extraFontFlag) {
}
#endif
-}
-
-static void SetLogFont(LOGFONTW &lf, const char *faceName, int characterSet, float size, int weight, bool italic, int extraFontFlag) {
+void SetLogFont(LOGFONTW &lf, const char *faceName, int characterSet, float size, int weight, bool italic, int extraFontFlag) {
lf = LOGFONTW();
// The negative is to allow for leading
lf.lfHeight = -(abs(lround(size)));
@@ -298,7 +296,7 @@ static void SetLogFont(LOGFONTW &lf, const char *faceName, int characterSet, flo
* If one font is the same as another, its hash will be the same, but if the hash is the
* same then they may still be different.
*/
-static int HashFont(const FontParameters &fp) noexcept {
+int HashFont(const FontParameters &fp) noexcept {
return
static_cast<int>(fp.size) ^
(fp.characterSet << 10) ^
@@ -309,6 +307,8 @@ static int HashFont(const FontParameters &fp) noexcept {
fp.faceName[0];
}
+}
+
class FontCached : Font {
FontCached *next;
int usage;
@@ -1284,7 +1284,7 @@ void SurfaceD2D::SetFont(Font &font_) {
yInternalLeading = pfm->yInternalLeading;
codePageText = codePage;
if (pfm->characterSet) {
- codePageText = CodePageFromCharSet(pfm->characterSet, codePage);
+ codePageText = Scintilla::CodePageFromCharSet(pfm->characterSet, codePage);
}
if (pRenderTarget) {
D2D1_TEXT_ANTIALIAS_MODE aaMode;
@@ -1806,6 +1806,8 @@ void Window::SetPosition(PRectangle rc) {
static_cast<int>(rc.Width()), static_cast<int>(rc.Height()), SWP_NOZORDER | SWP_NOACTIVATE);
}
+namespace {
+
static RECT RectFromMonitor(HMONITOR hMonitor) {
MONITORINFO mi = {};
mi.cbSize = sizeof(mi);
@@ -1822,6 +1824,8 @@ static RECT RectFromMonitor(HMONITOR hMonitor) {
return rc;
}
+}
+
void Window::SetPositionRelative(PRectangle rc, Window relativeTo) {
const LONG style = ::GetWindowLong(static_cast<HWND>(wid), GWL_STYLE);
if (style & WS_POPUP) {
@@ -1876,16 +1880,14 @@ void Window::InvalidateRectangle(PRectangle rc) {
::InvalidateRect(static_cast<HWND>(wid), &rcw, FALSE);
}
-static LRESULT Window_SendMessage(const Window *w, UINT msg, WPARAM wParam=0, LPARAM lParam=0) {
- return ::SendMessage(static_cast<HWND>(w->GetID()), msg, wParam, lParam);
-}
-
void Window::SetFont(Font &font) {
- Window_SendMessage(this, WM_SETFONT,
+ ::SendMessage(static_cast<HWND>(wid), WM_SETFONT,
reinterpret_cast<WPARAM>(font.GetID()), 0);
}
-static void FlipBitmap(HBITMAP bitmap, int width, int height) {
+namespace {
+
+void FlipBitmap(HBITMAP bitmap, int width, int height) {
HDC hdc = ::CreateCompatibleDC(NULL);
if (hdc != NULL) {
HGDIOBJ prevBmp = ::SelectObject(hdc, bitmap);
@@ -1895,7 +1897,7 @@ static void FlipBitmap(HBITMAP bitmap, int width, int height) {
}
}
-static HCURSOR GetReverseArrowCursor() {
+HCURSOR GetReverseArrowCursor() {
if (reverseArrowCursor != NULL)
return reverseArrowCursor;
@@ -1926,6 +1928,8 @@ static HCURSOR GetReverseArrowCursor() {
return cursor;
}
+}
+
void Window::SetCursor(Cursor curs) {
switch (curs) {
case cursorText:
@@ -2853,7 +2857,9 @@ LRESULT PASCAL ListBoxX::StaticWndProc(
}
}
-static bool ListBoxX_Register() {
+namespace {
+
+bool ListBoxX_Register() {
WNDCLASSEX wndclassc;
wndclassc.cbSize = sizeof(wndclassc);
// We need CS_HREDRAW and CS_VREDRAW because of the ellipsis that might be drawn for
@@ -2878,6 +2884,8 @@ bool ListBoxX_Unregister() {
return ::UnregisterClass(ListBoxX_ClassName, hinstPlatformRes) != 0;
}
+}
+
Menu::Menu() : mid(0) {
}