From b73fd1b14f758cc52b47b1cec9c68ba52fee70ac Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 8 Nov 1999 11:13:53 +0000 Subject: [PATCH] Clean up sizetip patch: remove separate header file and // comments git-svn-id: svn://svn.tartarus.org/sgt/putty@278 cda61777-01e9-0310-a592-d414129be87e --- putty.h | 6 ++++++ sizetip.c | 43 ++++++++++++++++++++++--------------------- sizetip.h | 2 -- window.c | 1 - 4 files changed, 28 insertions(+), 24 deletions(-) delete mode 100644 sizetip.h diff --git a/putty.h b/putty.h index 42c85926..0636c4a1 100644 --- a/putty.h +++ b/putty.h @@ -263,6 +263,12 @@ void safefree(void *); extern char ver[]; /* + * Exports from sizetip.c. + */ +void UpdateSizeTip(HWND src, int cx, int cy); +void EnableSizeTip(int bEnable); + +/* * Exports from xlat.c. */ unsigned char xlat_kbd2tty(unsigned char c); diff --git a/sizetip.c b/sizetip.c index 20ab423c..90c05732 100644 --- a/sizetip.c +++ b/sizetip.c @@ -1,4 +1,3 @@ - #include #include #include @@ -16,10 +15,10 @@ LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar { switch (nMsg) { - case WM_ERASEBKGND: + case WM_ERASEBKGND: return TRUE; - case WM_PAINT: + case WM_PAINT: { HBRUSH hbr; HGDIOBJ holdbr; @@ -58,15 +57,15 @@ LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar } return 0; - case WM_NCHITTEST: + case WM_NCHITTEST: return HTTRANSPARENT; - case WM_DESTROY: + case WM_DESTROY: DeleteObject(tip_font); tip_font = NULL; break; - case WM_SETTEXT: + case WM_SETTEXT: { LPCTSTR str = (LPCTSTR)lParam; SIZE sz; @@ -98,7 +97,7 @@ void UpdateSizeTip(HWND src, int cx, int cy) if (!tip_wnd) { NONCLIENTMETRICS nci; - // First make sure the window class is registered + /* First make sure the window class is registered */ if (!tip_class) { WNDCLASS wc; @@ -116,24 +115,26 @@ void UpdateSizeTip(HWND src, int cx, int cy) tip_class = RegisterClass(&wc); } -// // Default values based on Windows Standard color scheme -// -// tip_font = GetStockObject(SYSTEM_FONT); -// tip_bg = RGB(255, 255, 225); -// tip_text = RGB(0, 0, 0); +#if 0 + /* Default values based on Windows Standard color scheme */ + + tip_font = GetStockObject(SYSTEM_FONT); + tip_bg = RGB(255, 255, 225); + tip_text = RGB(0, 0, 0); +#endif - // Prepare other GDI objects and drawing info + /* Prepare other GDI objects and drawing info */ tip_bg = GetSysColor(COLOR_INFOBK); tip_text = GetSysColor(COLOR_INFOTEXT); - + memset(&nci, 0, sizeof(NONCLIENTMETRICS)); nci.cbSize = sizeof(NONCLIENTMETRICS); SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &nci, 0); tip_font = CreateFontIndirect(&nci.lfStatusFont); } - // Generate the tip text + /* Generate the tip text */ _sntprintf(str, 16, "%dx%d", cx, cy); @@ -144,7 +145,7 @@ void UpdateSizeTip(HWND src, int cx, int cy) RECT wr; int ix, iy; - // calculate the tip's size + /* calculate the tip's size */ hdc = CreateCompatibleDC(NULL); GetTextExtentPoint32(hdc, str, _tcslen(str), &sz); @@ -158,17 +159,17 @@ void UpdateSizeTip(HWND src, int cx, int cy) iy = wr.top - sz.cy; if (iy<16) iy = 16; - // Create the tip window + /* Create the tip window */ tip_wnd = CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, MAKEINTRESOURCE(tip_class), str, WS_POPUP, - ix, iy, sz.cx, sz.cy, - NULL, NULL, putty_inst, NULL); + ix, iy, sz.cx, sz.cy, + NULL, NULL, putty_inst, NULL); ShowWindow(tip_wnd, SW_SHOWNOACTIVATE); } else { - // Tip already exists, just set the text + /* Tip already exists, just set the text */ SetWindowText(tip_wnd, str); } @@ -180,6 +181,6 @@ void EnableSizeTip(int bEnable) DestroyWindow(tip_wnd); tip_wnd = NULL; } - + tip_enabled = bEnable; } diff --git a/sizetip.h b/sizetip.h deleted file mode 100644 index cc4cf462..00000000 --- a/sizetip.h +++ /dev/null @@ -1,2 +0,0 @@ -void UpdateSizeTip(HWND src, int cx, int cy); -void EnableSizeTip(int bEnable); diff --git a/window.c b/window.c index e2301d6b..2581623f 100644 --- a/window.c +++ b/window.c @@ -7,7 +7,6 @@ #define PUTTY_DO_GLOBALS /* actually _define_ globals */ #include "putty.h" #include "win_res.h" -#include "sizetip.h" #define IDM_SHOWLOG 0x0010 #define IDM_NEWSESS 0x0020 -- 2.11.0