mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-02-05 06:32:25 +00:00
Clean up sizetip patch: remove separate header file and // comments
[originally from svn r278]
This commit is contained in:
parent
e913e99b40
commit
1f5bcfd90e
6
putty.h
6
putty.h
@ -262,6 +262,12 @@ void safefree(void *);
|
|||||||
*/
|
*/
|
||||||
extern char ver[];
|
extern char ver[];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exports from sizetip.c.
|
||||||
|
*/
|
||||||
|
void UpdateSizeTip(HWND src, int cx, int cy);
|
||||||
|
void EnableSizeTip(int bEnable);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exports from xlat.c.
|
* Exports from xlat.c.
|
||||||
*/
|
*/
|
||||||
|
39
sizetip.c
39
sizetip.c
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winreg.h>
|
#include <winreg.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
@ -16,10 +15,10 @@ LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar
|
|||||||
{
|
{
|
||||||
|
|
||||||
switch (nMsg) {
|
switch (nMsg) {
|
||||||
case WM_ERASEBKGND:
|
case WM_ERASEBKGND:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
{
|
{
|
||||||
HBRUSH hbr;
|
HBRUSH hbr;
|
||||||
HGDIOBJ holdbr;
|
HGDIOBJ holdbr;
|
||||||
@ -58,15 +57,15 @@ LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_NCHITTEST:
|
case WM_NCHITTEST:
|
||||||
return HTTRANSPARENT;
|
return HTTRANSPARENT;
|
||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
DeleteObject(tip_font);
|
DeleteObject(tip_font);
|
||||||
tip_font = NULL;
|
tip_font = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SETTEXT:
|
case WM_SETTEXT:
|
||||||
{
|
{
|
||||||
LPCTSTR str = (LPCTSTR)lParam;
|
LPCTSTR str = (LPCTSTR)lParam;
|
||||||
SIZE sz;
|
SIZE sz;
|
||||||
@ -98,7 +97,7 @@ void UpdateSizeTip(HWND src, int cx, int cy)
|
|||||||
if (!tip_wnd) {
|
if (!tip_wnd) {
|
||||||
NONCLIENTMETRICS nci;
|
NONCLIENTMETRICS nci;
|
||||||
|
|
||||||
// First make sure the window class is registered
|
/* First make sure the window class is registered */
|
||||||
|
|
||||||
if (!tip_class) {
|
if (!tip_class) {
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
@ -116,13 +115,15 @@ void UpdateSizeTip(HWND src, int cx, int cy)
|
|||||||
tip_class = RegisterClass(&wc);
|
tip_class = RegisterClass(&wc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// // Default values based on Windows Standard color scheme
|
#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);
|
|
||||||
|
|
||||||
// Prepare other GDI objects and drawing info
|
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 */
|
||||||
|
|
||||||
tip_bg = GetSysColor(COLOR_INFOBK);
|
tip_bg = GetSysColor(COLOR_INFOBK);
|
||||||
tip_text = GetSysColor(COLOR_INFOTEXT);
|
tip_text = GetSysColor(COLOR_INFOTEXT);
|
||||||
@ -133,7 +134,7 @@ void UpdateSizeTip(HWND src, int cx, int cy)
|
|||||||
tip_font = CreateFontIndirect(&nci.lfStatusFont);
|
tip_font = CreateFontIndirect(&nci.lfStatusFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate the tip text
|
/* Generate the tip text */
|
||||||
|
|
||||||
_sntprintf(str, 16, "%dx%d", cx, cy);
|
_sntprintf(str, 16, "%dx%d", cx, cy);
|
||||||
|
|
||||||
@ -144,7 +145,7 @@ void UpdateSizeTip(HWND src, int cx, int cy)
|
|||||||
RECT wr;
|
RECT wr;
|
||||||
int ix, iy;
|
int ix, iy;
|
||||||
|
|
||||||
// calculate the tip's size
|
/* calculate the tip's size */
|
||||||
|
|
||||||
hdc = CreateCompatibleDC(NULL);
|
hdc = CreateCompatibleDC(NULL);
|
||||||
GetTextExtentPoint32(hdc, str, _tcslen(str), &sz);
|
GetTextExtentPoint32(hdc, str, _tcslen(str), &sz);
|
||||||
@ -158,17 +159,17 @@ void UpdateSizeTip(HWND src, int cx, int cy)
|
|||||||
iy = wr.top - sz.cy;
|
iy = wr.top - sz.cy;
|
||||||
if (iy<16) iy = 16;
|
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,
|
tip_wnd = CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, MAKEINTRESOURCE(tip_class), str, WS_POPUP,
|
||||||
ix, iy, sz.cx, sz.cy,
|
ix, iy, sz.cx, sz.cy,
|
||||||
NULL, NULL, putty_inst, NULL);
|
NULL, NULL, putty_inst, NULL);
|
||||||
|
|
||||||
ShowWindow(tip_wnd, SW_SHOWNOACTIVATE);
|
ShowWindow(tip_wnd, SW_SHOWNOACTIVATE);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Tip already exists, just set the text
|
/* Tip already exists, just set the text */
|
||||||
|
|
||||||
SetWindowText(tip_wnd, str);
|
SetWindowText(tip_wnd, str);
|
||||||
}
|
}
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
void UpdateSizeTip(HWND src, int cx, int cy);
|
|
||||||
void EnableSizeTip(int bEnable);
|
|
1
window.c
1
window.c
@ -7,7 +7,6 @@
|
|||||||
#define PUTTY_DO_GLOBALS /* actually _define_ globals */
|
#define PUTTY_DO_GLOBALS /* actually _define_ globals */
|
||||||
#include "putty.h"
|
#include "putty.h"
|
||||||
#include "win_res.h"
|
#include "win_res.h"
|
||||||
#include "sizetip.h"
|
|
||||||
|
|
||||||
#define IDM_SHOWLOG 0x0010
|
#define IDM_SHOWLOG 0x0010
|
||||||
#define IDM_NEWSESS 0x0020
|
#define IDM_NEWSESS 0x0020
|
||||||
|
Loading…
Reference in New Issue
Block a user