From ec2f679e8dc798142e3545a96f82a8485104a7ac Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 10 Jul 2011 09:20:51 +0000 Subject: [PATCH] SetWindowLongPtr() and SetClassLongPtr() for 64bit compatibility --- ChangeLog | 6 +++++- src/frontend/wdisp/windisp.c | 18 +++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78c6f70d4..6ca624b12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ +2011-07-10 Robert Larice + * src/frontend/wdisp/windisp.c : + SetWindowLongPtr() and SetClassLongPtr() for 64bit compatibility + 2011-07-09 Holger Vogt * input.c: definition of _read only for Windows console - + 2011-07-09 Robert Larice * src/frontend/gens.c , * src/frontend/subckt.c , diff --git a/src/frontend/wdisp/windisp.c b/src/frontend/wdisp/windisp.c index 882e4adeb..85d9e886a 100644 --- a/src/frontend/wdisp/windisp.c +++ b/src/frontend/wdisp/windisp.c @@ -79,12 +79,12 @@ static COLORREF ColorTable[NumWinColors]; /* color memory */ static char * WindowName = "Spice Plot"; /* window name */ static WNDCLASS TheWndClass; /* Plot-window class */ static HFONT PlotFont; /* which font */ -#define ID_DRUCKEN 0xEFF0 /* System Menue: print */ +#define ID_DRUCKEN 0xEFF0 /* System Menue: print */ #define ID_DRUCKEINR 0xEFE0 /* System Menue: printer setup */ #define ID_HARDCOPY 0xEFD0 /* System Menue: hardcopy color*/ -#define ID_HARDCOPY_BW 0xEFB0 /* System Menue: hardcopy b&w*/ +#define ID_HARDCOPY_BW 0xEFB0 /* System Menue: hardcopy b&w*/ +#define ID_MASK 0xFFF0; /* System-Menue: mask */ -static const int ID_MASK = 0xFFF0; /* System-Menue: mask */ static char * STR_DRUCKEN = "Printer..."; /* System menue strings */ static char * STR_DRUCKEINR = "Printer setup..."; static char * STR_HARDCOPY = "Postscript file, color"; @@ -220,7 +220,7 @@ int WIN_Init(void) /* (attach to window) */ static GRAPH * pGraph( HWND hwnd) { - return (GRAPH *) GetWindowLong( hwnd, 0); + return (GRAPH *) GetWindowLongPtr( hwnd, 0); } /* return line style for plotting */ @@ -328,7 +328,7 @@ LRESULT CALLBACK PlotWindowProc( HWND hwnd, case WM_SYSCOMMAND: { /* test command */ - int cmd = wParam & ID_MASK; + WPARAM cmd = wParam & ID_MASK; switch(cmd) { case ID_DRUCKEN: return PrintPlot( hwnd); case ID_DRUCKEINR: return PrintInit( hwnd); @@ -604,13 +604,13 @@ int WIN_NewViewport( GRAPH * graph) /* change the background color of all windows (both new and already plotted) by assessing the registered window class */ if (isblack) - SetClassLong(window, GCLP_HBRBACKGROUND, (long)GetStockObject( BLACK_BRUSH)); + SetClassLongPtr(window, GCLP_HBRBACKGROUND, (LONG_PTR)GetStockObject(BLACK_BRUSH)); else - SetClassLong(window, GCLP_HBRBACKGROUND, (long)GetStockObject( WHITE_BRUSH)); + SetClassLongPtr(window, GCLP_HBRBACKGROUND, (LONG_PTR)GetStockObject(WHITE_BRUSH)); wd->wnd = window; - SetWindowLong( window, 0, (long)graph); + SetWindowLongPtr(window, 0, (LONG_PTR)graph); /* show window */ ShowWindow( window, SW_SHOWNORMAL); @@ -837,7 +837,7 @@ int WIN_Text( char * text, int x, int y) SelectObject(wd->hDC, hfont); SetTextColor( wd->hDC, ColorTable[wd->ColorIndex]); - TextOut( wd->hDC, x, wd->Area.bottom - y - currentgraph->fontheight, text, strlen(text)); + TextOut( wd->hDC, x, wd->Area.bottom - y - currentgraph->fontheight, text, (int)strlen(text)); DeleteObject(SelectObject(wd->hDC, GetStockObject(SYSTEM_FONT)));