Mercurial > install
changeset 8:d399eef87cc5
Updated DW and copy the build binary to sfx.exe in the root after building.
author | Brian Smith <brian@dbsoft.org> |
---|---|
date | Sun, 20 Nov 2011 11:11:10 -0600 |
parents | 60042a92863e |
children | bd8f2c281cae |
files | os2/dw.c sfxace/makefile.vac win/dw.c |
diffstat | 3 files changed, 636 insertions(+), 243 deletions(-) [+] |
line wrap: on
line diff
--- a/os2/dw.c Sun Nov 13 15:03:53 2011 -0600 +++ b/os2/dw.c Sun Nov 20 11:11:10 2011 -0600 @@ -34,6 +34,9 @@ #endif #include <sys/time.h> #include <sys/stat.h> +#ifdef __WATCOMC__ +#include <alloca.h> +#endif #include "dw.h" #define QWP_USER 0 @@ -50,6 +53,7 @@ void _dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname); void _dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname); void _free_menu_data(HWND menu); +ULONG (* _System _PmPrintfString)(char *String) = 0; char ClassName[] = "dynamicwindows"; char SplitbarClassName[] = "dwsplitbar"; @@ -67,7 +71,7 @@ PRECORDCORE pCoreEmph = NULL; ULONG aulBuffer[4]; HWND lasthcnr = 0, lastitem = 0, popup = 0, desktop; -HMOD wpconfig = 0; +HMOD wpconfig = 0, pmprintf = 0; unsigned long _colors[] = { CLR_BLACK, @@ -293,7 +297,7 @@ { char tmpbuf[100]; - WinQueryClassName(child, 99, tmpbuf); + WinQueryClassName(child, 99, (PCH)tmpbuf); if(strncmp(tmpbuf, "#6", 3)==0) /* Entryfield */ { @@ -318,7 +322,7 @@ { char tmpbuf[100]; - WinQueryClassName(child, 99, tmpbuf); + WinQueryClassName(child, 99, (PCH)tmpbuf); if(strncmp(tmpbuf, "#3", 3)==0 && dw) /* Button */ WinSetOwner(child, dw); @@ -397,7 +401,7 @@ WindowData *wd = (WindowData *)ptr; char tmpbuf[100]; - WinQueryClassName(handle, 99, tmpbuf); + WinQueryClassName(handle, 99, (PCH)tmpbuf); if(strncmp(tmpbuf, "ColorSelectClass", 17)!=0) { @@ -456,7 +460,7 @@ for(i=0;i<count;i++) { - SHORT menuid = (SHORT)WinSendMsg(menu, MM_ITEMIDFROMPOSITION, MPFROMSHORT(i), 0); + SHORT menuid = (SHORT)(LONG)WinSendMsg(menu, MM_ITEMIDFROMPOSITION, MPFROMSHORT(i), 0); MENUITEM mi; /* Free the data associated with the ID */ @@ -464,13 +468,13 @@ { char buffer[31] = {0}; - sprintf(buffer, "_dw_id%ld", menuid); + sprintf(buffer, "_dw_id%d", menuid); dw_window_set_data( hwndApp, buffer, NULL ); - sprintf(buffer, "_dw_checkable%ld", menuid); + sprintf(buffer, "_dw_checkable%d", menuid); dw_window_set_data( hwndApp, buffer, NULL ); - sprintf(buffer, "_dw_ischecked%ld", menuid); + sprintf(buffer, "_dw_ischecked%d", menuid); dw_window_set_data( hwndApp, buffer, NULL ); - sprintf(buffer, "_dw_isdisabled%ld", menuid); + sprintf(buffer, "_dw_isdisabled%d", menuid); dw_window_set_data( hwndApp, buffer, NULL ); } @@ -491,7 +495,7 @@ if(!handle) return 0; - WinQueryClassName(handle, 99, tmpbuf); + WinQueryClassName(handle, 99, (PCH)tmpbuf); if(!WinIsWindowEnabled(handle) || (strncmp(tmpbuf, "ColorSelectClass", 17) && dw_window_get_data(handle, "_dw_disabled"))) @@ -516,7 +520,7 @@ { int z; static HWND lasthwnd, firsthwnd; - static int finish_searching; + static int finish_searching; /* Start is 2 when we have cycled completely and * need to set the focus to the last widget we found @@ -589,7 +593,7 @@ { char tmpbuf[100] = ""; - WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); + WinQueryClassName(box->items[z].hwnd, 99, (PCH)tmpbuf); if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) { /* Then try the bottom or right box */ @@ -724,7 +728,7 @@ { char tmpbuf[100] = ""; - WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); + WinQueryClassName(box->items[z].hwnd, 99, (PCH)tmpbuf); if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) { /* Try the top or left box */ @@ -969,7 +973,7 @@ { char tmpbuf[100]; - WinQueryClassName(hwnd, 99, tmpbuf); + WinQueryClassName(hwnd, 99, (PCH)tmpbuf); /* If we have a notebook we resize the page again. */ if(strncmp(tmpbuf, "#40", 4)==0) @@ -1366,7 +1370,7 @@ if(thisbox->items[z].hsize != SIZEEXPAND) vectorx = 0; - WinQueryClassName(handle, 99, tmpbuf); + WinQueryClassName(handle, 99, (PCH)tmpbuf); if(strncmp(tmpbuf, "#2", 3)==0) { @@ -1604,6 +1608,278 @@ GpiLine(hpsPaint, &ptl2); } + +#define CALENDAR_BORDER 3 +#define CALENDAR_ARROW 8 + +/* Returns a rectangle for a single day on the calendar */ +RECTL _CalendarDayRect(int position, RECTL rclPaint) +{ + int height = rclPaint.yTop - rclPaint.yBottom - (CALENDAR_BORDER*2); + int width = rclPaint.xRight - rclPaint.xLeft - (CALENDAR_BORDER*2); + /* There are 7 rows... 5 for the day numbers... + * 1 for the Month/Year and 1 for the day names. + */ + int row = position / 7; + int col = position % 7; + int cellwidth = width / 7; + int cellheight = height / 8; + + /* Create a new box */ + rclPaint.xLeft = (cellwidth * col) + CALENDAR_BORDER; + rclPaint.xRight = rclPaint.xLeft + cellwidth; + /* We only handle 6 of the 7 rows */ + rclPaint.yBottom = (cellheight * (6-row)) + CALENDAR_BORDER; + rclPaint.yTop = rclPaint.yBottom + cellheight; + return rclPaint; +} + +/* This procedure handles drawing of a status border */ +MRESULT EXPENTRY _calendarproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) +{ + /* How many days are in each month usually (not including leap years) */ + static int days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + static char *months[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; + static char *daysofweek[] = { "Sunday", "Monday", "Tuesday","Wednesday", "Thursday", "Friday", "Saturday" }; + WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); + PFNWP oldproc = 0; + + if(blah) + { + oldproc = blah->oldproc; + + switch(msg) + { + case WM_BUTTON1DOWN: + case WM_BUTTON2DOWN: + case WM_BUTTON3DOWN: + { + POINTS pts = (*((POINTS*)&mp1)); + int day = DW_POINTER_TO_INT(dw_window_get_data(hWnd, "_dw_day")); + int month = DW_POINTER_TO_INT(dw_window_get_data(hWnd, "_dw_month")); + int year = DW_POINTER_TO_INT(dw_window_get_data(hWnd, "_dw_year")); + int dayofweek = 1, x, height, isleapyear = ((year+1) % 4 == 0); + int daysthismonth = days[month] + (isleapyear && month == 1); + RECTL rclArea; + + /* Figure out what day of the week the first day of the month falls on */ + for(x=0;x<month;x++) + dayofweek += days[x] + (isleapyear && x == 1); + dayofweek += (year/4) + year - 1; + dayofweek = dayofweek % 7; + + WinQueryWindowRect(hWnd, &rclArea); + height = ((rclArea.yTop - (CALENDAR_BORDER*2))/7); + + /* Check for the left arrow */ + if(pts.x > rclArea.xLeft + CALENDAR_BORDER && pts.x < rclArea.xLeft + CALENDAR_BORDER + CALENDAR_ARROW && + pts.y > rclArea.yTop - (CALENDAR_BORDER + height) && pts.y < rclArea.yTop - CALENDAR_BORDER) + { + int daysthismonth; + + if(month == 0) + { + month = 11; + year--; + dw_window_set_data(hWnd, "_dw_year", DW_INT_TO_POINTER(year)); + } + else if(month > 0) + { + month--; + } + dw_window_set_data(hWnd, "_dw_month", DW_INT_TO_POINTER(month)); + /* Make sure we aren't higher than the number of days + * in our new month... keeping track of leap years. + */ + daysthismonth = days[month] + (isleapyear && month == 1); + if(day >= daysthismonth) + { + day = daysthismonth - 1; + dw_window_set_data(hWnd, "_dw_day", DW_INT_TO_POINTER(day)); + } + WinInvalidateRect(hWnd, &rclArea, FALSE); + WinPostMsg(hWnd, WM_PAINT, 0, 0); + return (MRESULT)TRUE; + } + + /* Check for the right arrow */ + if(pts.x < rclArea.xRight - CALENDAR_BORDER && pts.x > rclArea.xRight - CALENDAR_BORDER - CALENDAR_ARROW && + pts.y > rclArea.yTop - (CALENDAR_BORDER + height) && pts.y < rclArea.yTop - CALENDAR_BORDER) + { + int daysthismonth; + + if(month == 11) + { + month = 0; + year++; + dw_window_set_data(hWnd, "_dw_year", DW_INT_TO_POINTER(year)); + } + else if(month < 11) + { + month++; + } + dw_window_set_data(hWnd, "_dw_month", DW_INT_TO_POINTER(month)); + /* Make sure we aren't higher than the number of days + * in our new month... keeping track of leap years. + */ + daysthismonth = days[month] + (isleapyear && month == 1); + if(day >= daysthismonth) + { + day = daysthismonth - 1; + dw_window_set_data(hWnd, "_dw_day", DW_INT_TO_POINTER(day)); + } + WinInvalidateRect(hWnd, &rclArea, FALSE); + WinPostMsg(hWnd, WM_PAINT, 0, 0); + return (MRESULT)TRUE; + } + + /* Check all the valid days of the month */ + for(x=dayofweek+7;x<(daysthismonth+dayofweek+7);x++) + { + RECTL rclThis = _CalendarDayRect(x, rclArea); + if(pts.x < rclThis.xRight && pts.x > rclThis.xLeft && pts.y < rclThis.yTop && pts.y > rclThis.yBottom) + { + dw_window_set_data(hWnd, "_dw_day", DW_INT_TO_POINTER((x-(dayofweek+7)))); + WinInvalidateRect(hWnd, &rclArea, FALSE); + WinPostMsg(hWnd, WM_PAINT, 0, 0); + return (MRESULT)TRUE; + } + } + } + break; + case WM_PAINT: + { + HPS hpsPaint; + RECTL rclPaint, rclDraw; + char buf[100]; + int day = DW_POINTER_TO_INT(dw_window_get_data(hWnd, "_dw_day")); + int month = DW_POINTER_TO_INT(dw_window_get_data(hWnd, "_dw_month")); + int year = DW_POINTER_TO_INT(dw_window_get_data(hWnd, "_dw_year")); + int dayofweek = 1, x, lastmonth = 11, height, isleapyear = ((year+1) % 4 == 0); + POINTL pptl[3]; + + /* Figure out the previous month for later use */ + if(month > 0) + lastmonth = month - 1; + + /* Make the title */ + sprintf(buf, "%s, %d", months[month], year + 1); + + /* Figure out what day of the week the first day of the month falls on */ + for(x=0;x<month;x++) + dayofweek += days[x] + (isleapyear && x == 1); + dayofweek += (year/4) + year - 1; + dayofweek = dayofweek % 7; + + /* Actually draw the control */ + hpsPaint = WinBeginPaint(hWnd, 0, 0); + WinQueryWindowRect(hWnd, &rclPaint); + WinFillRect(hpsPaint, &rclPaint, CLR_PALEGRAY); + height = ((rclPaint.yTop - (CALENDAR_BORDER*2))/7); + + /* Draw the Month and Year at the top */ + GpiSetColor(hpsPaint, CLR_BLACK); + rclDraw = rclPaint; + rclDraw.yBottom = height * 6; + WinDrawText(hpsPaint, -1, (PCH)buf, &rclDraw, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_CENTER | DT_TEXTATTRS); + + /* Draw the left arrow */ + GpiSetColor(hpsPaint, CLR_DARKGRAY); + GpiBeginArea(hpsPaint, 0); + pptl[2].x = rclDraw.xLeft + CALENDAR_BORDER + CALENDAR_ARROW; + pptl[2].y = rclDraw.yTop - CALENDAR_BORDER; + GpiMove(hpsPaint, &pptl[2]); + pptl[0].x = rclDraw.xLeft + CALENDAR_BORDER; + pptl[0].y = rclDraw.yTop - (CALENDAR_BORDER+ (height/2)); + pptl[1].x = rclDraw.xLeft + CALENDAR_BORDER + CALENDAR_ARROW; + pptl[1].y = rclDraw.yTop - CALENDAR_BORDER - height; + GpiPolyLine(hpsPaint, 3, pptl); + GpiEndArea(hpsPaint); + + /* Draw the left arrow */ + GpiBeginArea(hpsPaint, 0); + pptl[2].x = rclDraw.xRight - CALENDAR_BORDER - CALENDAR_ARROW; + pptl[2].y = rclDraw.yTop - CALENDAR_BORDER; + GpiMove(hpsPaint, &pptl[2]); + pptl[0].x = rclDraw.xRight - CALENDAR_BORDER; + pptl[0].y = rclDraw.yTop - (CALENDAR_BORDER + (height/2)); + pptl[1].x = rclDraw.xRight - CALENDAR_BORDER - CALENDAR_ARROW; + pptl[1].y = rclDraw.yTop - CALENDAR_BORDER - height; + GpiPolyLine(hpsPaint, 3, pptl); + GpiEndArea(hpsPaint); + + /* Draw a border around control */ + _Top(hpsPaint, rclPaint); + _Left(hpsPaint, rclPaint); + /* With shadow */ + GpiSetColor(hpsPaint, CLR_WHITE); + _Right(hpsPaint, rclPaint); + _Bottom(hpsPaint, rclPaint); + + /* Draw the days of the week */ + GpiSetColor(hpsPaint, CLR_BLACK); + for(x=0;x<7;x++) + { + char *title = daysofweek[x]; + + rclDraw = _CalendarDayRect(x, rclPaint); + + if(rclDraw.xRight - rclDraw.xLeft < 60) + { + buf[0] = daysofweek[x][0]; buf[1] = daysofweek[x][1]; buf[2] = 0; + title = buf; + } + WinDrawText(hpsPaint, -1, (PCH)title, &rclDraw, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_CENTER | DT_TEXTATTRS); + } + + /* Go through all the days */ + for(x=0;x<42;x++) + { + int daysthismonth = days[month] + (isleapyear && month == 1); + int dayslastmonth = days[lastmonth] + (isleapyear && lastmonth == 1); + + rclDraw = _CalendarDayRect(x+7, rclPaint); + if(x < dayofweek) + { + GpiSetColor(hpsPaint, CLR_DARKGRAY); + sprintf(buf, "%d", dayslastmonth - (dayofweek - x - 1)); + } + else if(x - dayofweek + 1 > daysthismonth) + { + GpiSetColor(hpsPaint, CLR_DARKGRAY); + sprintf(buf, "%d", x - dayofweek - daysthismonth + 1); + } + else + { + GpiSetColor(hpsPaint, CLR_DARKBLUE); + sprintf(buf, "%d", x - dayofweek + 1); + } + WinDrawText(hpsPaint, -1, (PCH)buf, &rclDraw, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_CENTER | DT_TEXTATTRS); + } + + /* Draw a border around selected day */ + rclPaint = _CalendarDayRect(day + dayofweek + 7, rclPaint); + GpiSetColor(hpsPaint, CLR_DARKGRAY); + _Top(hpsPaint, rclPaint); + _Left(hpsPaint, rclPaint); + /* With shadow */ + GpiSetColor(hpsPaint, CLR_WHITE); + _Right(hpsPaint, rclPaint); + _Bottom(hpsPaint, rclPaint); + + WinEndPaint(hpsPaint); + + return (MRESULT)TRUE; + } + } + if(oldproc) + return oldproc(hWnd, msg, mp1, mp2); + } + + return WinDefWindowProc(hWnd, msg, mp1, mp2); +} + + /* This procedure handles drawing of a status border */ MRESULT EXPENTRY _statusproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) { @@ -1636,14 +1912,14 @@ _Right(hpsPaint, rclPaint); _Bottom(hpsPaint, rclPaint); - WinQueryWindowText(hWnd, 1024, buf); + WinQueryWindowText(hWnd, 1024, (PSZ)buf); rclPaint.xLeft += 3; rclPaint.xRight--; rclPaint.yTop--; rclPaint.yBottom++; GpiSetColor(hpsPaint, CLR_BLACK); - WinDrawText(hpsPaint, -1, buf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); + WinDrawText(hpsPaint, -1, (PCH)buf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); WinEndPaint(hpsPaint); return (MRESULT)TRUE; @@ -1762,7 +2038,7 @@ { char tmpbuf[100]; - WinQueryClassName(handle, 99, tmpbuf); + WinQueryClassName(handle, 99, (PCH)tmpbuf); /* These are the window classes which can * obtain input focus. @@ -1812,7 +2088,7 @@ if(blah) oldproc = blah->oldproc; - WinQueryClassName(hWnd, 99, tmpbuf); + WinQueryClassName(hWnd, 99, (PCH)tmpbuf); /* These are the window classes which should get a menu */ if(strncmp(tmpbuf, "#2", 3)==0 || /* Combobox */ @@ -2485,7 +2761,7 @@ if(menuowner == hWnd || menuowner == NULLHANDLE) { - result = clickfunc(tmp->window, tmp->data); + result = clickfunc((HWND)tmp->id, tmp->data); tmp = NULL; } } @@ -2520,7 +2796,7 @@ pre = ((PNOTIFYRECORDENTER)mp2)->pRecord; if(pre) - text = pre->pszIcon; + text = (char *)pre->pszIcon; } if(tmp->window == notifyhwnd) @@ -2554,7 +2830,7 @@ pci = (PCNRITEM)mp2; - text = pci->rc.pszIcon; + text = (char *)pci->rc.pszIcon; user = pci->user; } @@ -2611,7 +2887,7 @@ int (* API treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = (int (* API)(HWND, HTREEITEM, char *, void *, void *))tmp->signalfunction; if(dw_window_get_data(tmp->window, "_dw_container")) - result = treeselectfunc(tmp->window, 0, pci->rc.pszIcon, tmp->data, 0); + result = treeselectfunc(tmp->window, 0, (char *)pci->rc.pszIcon, tmp->data, 0); else { if(lasthcnr == tmp->window && lastitem == (HWND)pci) @@ -2623,7 +2899,7 @@ { lasthcnr = tmp->window; lastitem = (HWND)pci; - result = treeselectfunc(tmp->window, (HTREEITEM)pci, pci->rc.pszIcon, tmp->data, pci->user); + result = treeselectfunc(tmp->window, (HTREEITEM)pci, (char *)pci->rc.pszIcon, tmp->data, pci->user); } } tmp = NULL; @@ -2638,7 +2914,7 @@ { char classbuf[100]; - WinQueryClassName(tmp->window, 99, classbuf); + WinQueryClassName(tmp->window, 99, (PCH)classbuf); if(strncmp(classbuf, "#38", 4) == 0) { @@ -2863,7 +3139,10 @@ /* Make sure we don't end up in infinite recursion */ command_active = 1; - result = (int)_run_event(hWnd, msg, mp1, mp2); + if(msg == WM_ACTIVATE) + result = (int)_run_event((HWND)mp2, WM_SETFOCUS, 0, mp1); + else + result = (int)_run_event(hWnd, msg, mp1, mp2); command_active = 0; } @@ -3409,7 +3688,17 @@ if(mp2) _run_event(hwnd, msg, mp1, mp2); else - WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0); + WinSendMsg(hwnd, BM_SETDEFAULT, 0, 0); + /* FIX: Borderless buttons not displaying properly after gaining focus */ + if((WinQueryWindowULong(hwnd, QWL_STYLE) & BS_NOBORDER)) + { + RECTL rcl; + + WinQueryWindowRect(hwnd, &rcl); + + WinInvalidateRect(hwnd, &rcl, FALSE); + WinPostMsg(hwnd, WM_PAINT, 0, 0); + } break; case WM_BUTTON1DOWN: case WM_BUTTON2DOWN: @@ -3541,7 +3830,7 @@ hwndBubbleLast = hwnd; hwndBubble = WinCreateWindow(HWND_DESKTOP, WC_STATIC, - "", + NULL, SS_TEXT | DT_CENTER | DT_VCENTER, @@ -3564,14 +3853,14 @@ &ulColor); WinSetWindowText(hwndBubble, - bubble->bubbletext); + (PSZ)bubble->bubbletext); WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1); hpsTemp = WinGetPS(hwndBubble); GpiQueryTextBox(hpsTemp, strlen(bubble->bubbletext), - bubble->bubbletext, + (PCH)bubble->bubbletext, TXTBOX_COUNT, txtPointl); WinReleasePS(hpsTemp); @@ -3704,9 +3993,9 @@ dwhmq = WinCreateMsgQueue(dwhab, 0); } - rc = WinRegisterClass(dwhab, ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); - rc = WinRegisterClass(dwhab, SplitbarClassName, _splitwndproc, 0L, 32); - rc = WinRegisterClass(dwhab, ScrollClassName, _scrollwndproc, 0L, 32); + rc = WinRegisterClass(dwhab, (PSZ)ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); + rc = WinRegisterClass(dwhab, (PSZ)SplitbarClassName, _splitwndproc, 0L, 32); + rc = WinRegisterClass(dwhab, (PSZ)ScrollClassName, _scrollwndproc, 0L, 32); /* Get the OS/2 version. */ DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG)); @@ -3723,10 +4012,12 @@ */ hwndApp = dw_window_new(HWND_OBJECT, "", 0); /* Attempt to locate a tray server */ - WinDdeInitiate(hwndApp, "SystrayServer", "TRAY", NULL); - - DosLoadModule(objnamebuf, sizeof(objnamebuf), "WPCONFIG", &wpconfig); - + WinDdeInitiate(hwndApp, (PSZ)"SystrayServer", (PSZ)"TRAY", NULL); + + /* Load DLLs for providing extra functionality if available */ + DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"WPCONFIG", &wpconfig); + if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"PMPRINTF", &pmprintf)) + DosQueryProcAddr(pmprintf, 0, (PSZ)"PmPrintfString", (PFN*)&_PmPrintfString); return rc; } @@ -3895,8 +4186,11 @@ va_start(args, format); vsprintf(outbuf, format, args); va_end(args); - - fprintf(stderr, "%s", outbuf); + + if(_PmPrintfString) + _PmPrintfString(outbuf); + else + fprintf(stderr, "%s", outbuf); } /* @@ -3917,7 +4211,7 @@ vsprintf(outbuf, format, args); va_end(args); - rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, outbuf, title, 0, flags | MB_MOVEABLE); + rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, (PSZ)outbuf, (PSZ)title, 0, flags | MB_MOVEABLE); if(rc == MBID_OK) return DW_MB_RETURN_OK; else if(rc == MBID_YES) @@ -4182,10 +4476,10 @@ /* Fill in the font dialog struct */ fd.cbSize = sizeof(fd); fd.hpsScreen = WinGetScreenPS(HWND_DESKTOP); - fd.pszTitle = "Choose Font"; + fd.pszTitle = (PSZ)"Choose Font"; fd.clrFore = CLR_BLACK; fd.clrBack = CLR_WHITE; - fd.pszFamilyname = buf; + fd.pszFamilyname = (PSZ)buf; fd.usFamilyBufLen = 100; fd.fxPointSize = MAKEFIXED(size,0); fd.fl = FNTS_INITFROMFATTRS; @@ -4402,7 +4696,7 @@ flStyle &= ~WS_MINIMIZED; } - hwndframe = WinCreateStdWindow(hwndOwner, winStyle, &flStyle, ClassName, title, 0L, NULLHANDLE, 0L, &newbox->hwnd); + hwndframe = WinCreateStdWindow(hwndOwner, winStyle, &flStyle, (PSZ)ClassName, (PSZ)title, 0L, NULLHANDLE, 0L, &newbox->hwnd); newbox->hwndtitle = WinWindowFromID(hwndframe, FID_TITLEBAR); if(!newbox->titlebar && newbox->hwndtitle) WinSetParent(newbox->hwndtitle, HWND_OBJECT, FALSE); @@ -4458,13 +4752,13 @@ HWND client, tmpbox = dw_box_new(DW_VERT, 0); Box *blah = calloc(sizeof(Box), 1); dw_box_pack_start(tmpbox, box, 1, 1, TRUE, TRUE, 0); - hwndframe = WinCreateWindow(HWND_OBJECT, ScrollClassName, "", WS_VISIBLE | WS_CLIPCHILDREN, + hwndframe = WinCreateWindow(HWND_OBJECT, (PSZ)ScrollClassName, NULL, WS_VISIBLE | WS_CLIPCHILDREN, 0, 0, 2000, 1000, NULLHANDLE, HWND_TOP, 0, NULL, NULL); - WinCreateWindow(hwndframe, WC_SCROLLBAR, "", WS_VISIBLE | SBS_AUTOTRACK | SBS_VERT, + WinCreateWindow(hwndframe, WC_SCROLLBAR, NULL, WS_VISIBLE | SBS_AUTOTRACK | SBS_VERT, 0,0,2000,1000, hwndframe, HWND_TOP, FID_VERTSCROLL, NULL, NULL); - WinCreateWindow(hwndframe, WC_SCROLLBAR, "", WS_VISIBLE | SBS_AUTOTRACK | SBS_HORZ, + WinCreateWindow(hwndframe, WC_SCROLLBAR, NULL, WS_VISIBLE | SBS_AUTOTRACK | SBS_HORZ, 0,0,2000,1000, hwndframe, HWND_TOP, FID_HORZSCROLL, NULL, NULL); - client = WinCreateWindow(hwndframe, WC_FRAME, "", WS_VISIBLE | WS_CLIPCHILDREN, + client = WinCreateWindow(hwndframe, WC_FRAME, NULL, WS_VISIBLE | WS_CLIPCHILDREN, 0,0,2000,1000, NULLHANDLE, HWND_TOP, FID_CLIENT, NULL, NULL); WinSetParent(tmpbox, client, FALSE); WinSetWindowPtr(client, QWP_USER, blah); @@ -4545,7 +4839,7 @@ newbox->grouphwnd = WinCreateWindow(newbox->hwnd, WC_STATIC, - title, + (PSZ)title, WS_VISIBLE | SS_GROUPBOX | WS_GROUP, 0,0,2000,1000, @@ -5027,7 +5321,7 @@ WindowData *blah = calloc(sizeof(WindowData), 1); HWND tmp = WinCreateWindow(HWND_OBJECT, WC_STATIC, - text, + (PSZ)text, WS_VISIBLE | SS_TEXT, 0,0,2000,1000, NULLHANDLE, @@ -5053,7 +5347,7 @@ WindowData *blah = calloc(sizeof(WindowData), 1); HWND tmp = WinCreateWindow(HWND_OBJECT, WC_STATIC, - text, + (PSZ)text, WS_VISIBLE | SS_TEXT, 0,0,2000,1000, NULLHANDLE, @@ -5082,7 +5376,7 @@ WindowData *blah = calloc(1, sizeof(WindowData)); HWND tmp = WinCreateWindow(HWND_OBJECT, WC_MLE, - "", + NULL, WS_VISIBLE | MLS_BORDER | MLS_IGNORETAB | MLS_VSCROLL | @@ -5112,7 +5406,7 @@ WindowData *blah = calloc(1, sizeof(WindowData)); HWND tmp = WinCreateWindow(HWND_OBJECT, WC_ENTRYFIELD, - text, + (PSZ)text, WS_VISIBLE | ES_MARGIN | ES_AUTOSCROLL | WS_TABSTOP, 0,0,2000,1000, @@ -5139,7 +5433,7 @@ WindowData *blah = calloc(1, sizeof(WindowData)); HWND tmp = WinCreateWindow(HWND_OBJECT, WC_ENTRYFIELD, - text, + (PSZ)text, WS_VISIBLE | ES_MARGIN | ES_UNREADABLE | ES_AUTOSCROLL | WS_TABSTOP, 0,0,2000,1000, @@ -5167,7 +5461,7 @@ HWND frame = dw_box_new(DW_HORZ, 0); HWND tmp = WinCreateWindow(frame, WC_COMBOBOX, - text, + (PSZ)text, WS_VISIBLE | CBS_DROPDOWN | WS_GROUP, 0,0,2000,1000, NULLHANDLE, @@ -5209,7 +5503,7 @@ HWND tmp = WinCreateWindow(HWND_OBJECT, WC_BUTTON, - text, + (PSZ)text, WS_VISIBLE, 0,0,2000,1000, NULLHANDLE, @@ -5282,7 +5576,7 @@ tmp = WinCreateWindow(HWND_OBJECT, WC_BUTTON, - name, + (PSZ)name, WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS | BS_AUTOSIZE | (icon ? 0 : BS_BITMAP), @@ -5320,7 +5614,7 @@ BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); HWND tmp = WinCreateWindow(HWND_OBJECT, WC_BUTTON, - "", + NULL, WS_VISIBLE | BS_PUSHBUTTON | BS_AUTOSIZE | BS_NOPOINTERFOCUS, 0,0,2000,1000, @@ -5347,7 +5641,7 @@ if(len > 4) { if(stricmp(file + len - 4, ".ico") == 0) - icon = WinLoadFileIcon(file, FALSE); + icon = WinLoadFileIcon((PSZ)file, FALSE); else _load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height); } @@ -5357,7 +5651,7 @@ /* Try with .ico extension first...*/ strcat(file, ".ico"); if(access(file, 04) == 0) - icon = WinLoadFileIcon(file, FALSE); + icon = WinLoadFileIcon((PSZ)file, FALSE); else { strcpy(file, filename); @@ -5425,7 +5719,7 @@ BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); HWND tmp = WinCreateWindow(HWND_OBJECT, WC_BUTTON, - "", + NULL, WS_VISIBLE | BS_PUSHBUTTON | BS_AUTOSIZE | BS_NOPOINTERFOCUS, 0,0,2000,1000, @@ -5456,7 +5750,7 @@ } else /* otherwise its assumed to be an ico */ { - icon = WinLoadFileIcon(file, FALSE); + icon = WinLoadFileIcon((PSZ)file, FALSE); } } else @@ -5521,7 +5815,7 @@ WindowData *blah = calloc(sizeof(WindowData), 1); HWND tmp = WinCreateWindow(HWND_OBJECT, WC_SPINBUTTON, - text, + (PSZ)text, WS_VISIBLE | SPBS_MASTER, 0,0,2000,1000, NULLHANDLE, @@ -5554,7 +5848,7 @@ WindowData *blah = calloc(sizeof(WindowData), 1); HWND tmp = WinCreateWindow(HWND_OBJECT, WC_BUTTON, - text, + (PSZ)text, WS_VISIBLE | BS_AUTORADIOBUTTON, 0,0,2000,1000, @@ -5589,7 +5883,7 @@ tmp = WinCreateWindow(HWND_OBJECT, WC_SLIDER, - "", + NULL, WS_VISIBLE | SLS_SNAPTOINCREMENT | (vertical ? SLS_VERTICAL : SLS_HORIZONTAL), 0,0,2000,1000, @@ -5615,7 +5909,7 @@ { return WinCreateWindow(HWND_OBJECT, WC_SCROLLBAR, - "", + NULL, WS_VISIBLE | SBS_AUTOTRACK | (vertical ? SBS_VERT : SBS_HORZ), 0,0,2000,1000, @@ -5636,7 +5930,7 @@ WindowData *blah = calloc(1, sizeof(WindowData)); HWND tmp = WinCreateWindow(HWND_OBJECT, WC_SLIDER, - "", + NULL, WS_VISIBLE | SLS_READONLY | SLS_RIBBONSTRIP, 0,0,2000,1000, @@ -5662,7 +5956,7 @@ BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); HWND tmp = WinCreateWindow(HWND_OBJECT, WC_BUTTON, - text, + (PSZ)text, WS_VISIBLE | BS_AUTOCHECKBOX, 0,0,2000,1000, NULLHANDLE, @@ -5736,7 +6030,7 @@ SIZEL sizl = { 0, 0 }; /* open bitmap file */ - DosOpen(file, &BitmapFileHandle, &OpenAction, 0L, + DosOpen((PSZ)file, &BitmapFileHandle, &OpenAction, 0L, FILE_ARCHIVED | FILE_NORMAL | FILE_READONLY, OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY | @@ -5800,7 +6094,7 @@ hdc1 = GpiQueryDevice(hps1); ulFlags = GpiQueryPS(hps1, &sizl); - *hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc1); + *hdc = DevOpenDC(dwhab, OD_MEMORY, (PSZ)"*", 0L, NULL, hdc1); *hps = GpiCreatePS (dwhab, *hdc, &sizl, ulFlags | GPIA_ASSOC); /* create bitmap now using the parameters from the info block */ @@ -5964,7 +6258,7 @@ void API dw_window_set_text(HWND handle, char *text) { HWND entryfield = (HWND)dw_window_get_data(handle, "_dw_buddy"); - WinSetWindowText(entryfield ? entryfield : handle, text); + WinSetWindowText(entryfield ? entryfield : handle, (PSZ)text); } /* @@ -5980,7 +6274,7 @@ int len = WinQueryWindowTextLength(entryfield ? entryfield : handle); char *tempbuf = calloc(1, len + 2); - WinQueryWindowText(entryfield ? entryfield : handle, len + 1, tempbuf); + WinQueryWindowText(entryfield ? entryfield : handle, len + 1, (PSZ)tempbuf); return tempbuf; } @@ -6010,7 +6304,7 @@ if(dw_window_get_data(handle, "_dw_disabled")) return; - WinQueryClassName(handle, 99, tmpbuf); + WinQueryClassName(handle, 99, (PCH)tmpbuf); dw_window_set_data(handle, "_dw_disabled", (void *)1); if(tmpbuf[0] == '#') @@ -6101,7 +6395,7 @@ int windowid = WinQueryWindowUShort(child, QWS_ID); HWND found; - WinQueryClassName(child, 99, tmpbuf); + WinQueryClassName(child, 99, (PCH)tmpbuf); /* If the child is a box (frame) then recurse into it */ if(strncmp(tmpbuf, "#1", 3)==0) @@ -6173,7 +6467,7 @@ } - WinQueryClassName(item, 99, tmpbuf); + WinQueryClassName(item, 99, (PCH)tmpbuf); if(vsize && !height) height = 1; @@ -6213,7 +6507,7 @@ thisbox->count++; - WinQueryClassName(item, 99, tmpbuf); + WinQueryClassName(item, 99, (PCH)tmpbuf); /* Don't set the ownership if it's an entryfield or spinbutton */ if(strncmp(tmpbuf, "#6", 3)!=0 && strncmp(tmpbuf, "#32", 4)!=0 && strncmp(tmpbuf, "#2", 3)!=0) WinSetOwner(item, box); @@ -6637,7 +6931,7 @@ WinSendMsg(handle, LM_SELECTITEM, MPFROMSHORT(index), (MPARAM)state); - WinQueryClassName(handle, 99, tmpbuf); + WinQueryClassName(handle, 99, (PCH)tmpbuf); /* If we are setting a combobox call the event handler manually */ if(strncmp(tmpbuf, "#6", 3)==0) @@ -7109,7 +7403,7 @@ /* Fill in the parent record data */ pci->rc.cb = sizeof(MINIRECORDCORE); - pci->rc.pszIcon = strdup(title); + pci->rc.pszIcon = (PSZ)strdup(title); pci->rc.hptrIcon = icon; pci->hptrIcon = icon; @@ -7167,7 +7461,7 @@ if(pci->rc.pszIcon) free(pci->rc.pszIcon); - pci->rc.pszIcon = strdup(title); + pci->rc.pszIcon = (PSZ)strdup(title); pci->rc.hptrIcon = icon; pci->hptrIcon = icon; @@ -7187,7 +7481,7 @@ handle = handle; /* keep compiler happy */ if(pci) - return pci->rc.pszIcon; + return (char *)pci->rc.pszIcon; return NULL; } @@ -7490,7 +7784,7 @@ if(access(file, 04) != 0) return 0; } - return WinLoadFileIcon(file, FALSE); + return WinLoadFileIcon((PSZ)file, FALSE); } /* @@ -7516,7 +7810,7 @@ { fwrite( data, 1, len, fp ); fclose( fp ); - icon = WinLoadFileIcon( file, FALSE ); + icon = WinLoadFileIcon( (PSZ)file, FALSE ); } else { @@ -7901,9 +8195,9 @@ for(z=0;z<(row-currentcount);z++) temp = temp->preccNextRecord; - temp->pszIcon = title; - temp->pszName = title; - temp->pszText = title; + temp->pszIcon = (PSZ)title; + temp->pszName = (PSZ)title; + temp->pszText = (PSZ)title; } /* @@ -7922,9 +8216,9 @@ { if(count == row) { - pCore->pszIcon = title; - pCore->pszName = title; - pCore->pszText = title; + pCore->pszIcon = (PSZ)title; + pCore->pszName = (PSZ)title; + pCore->pszText = (PSZ)title; WinSendMsg(handle, CM_INVALIDATERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_NOREPOSITION | CMA_TEXTCHANGED)); return; @@ -8094,7 +8388,7 @@ if(pCore->flRecordAttr & flags) { dw_window_set_data(handle, "_dw_pcore", (void *)pCore); - return pCore->pszIcon; + return (char *)pCore->pszIcon; } pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); } @@ -8102,7 +8396,7 @@ else { dw_window_set_data(handle, "_dw_pcore", (void *)pCore); - return pCore->pszIcon; + return (char *)pCore->pszIcon; } } return NULL; @@ -8131,7 +8425,7 @@ if(pCore->flRecordAttr & flags) { dw_window_set_data(handle, "_dw_pcore", (void *)pCore); - return pCore->pszIcon; + return (char *)pCore->pszIcon; } pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); @@ -8140,7 +8434,7 @@ else { dw_window_set_data(handle, "_dw_pcore", (void *)pCore); - return pCore->pszIcon; + return (char *)pCore->pszIcon; } } return NULL; @@ -8160,7 +8454,7 @@ while(pCore) { - if((textcomp && pCore->pszIcon && strcmp(pCore->pszIcon, text) == 0) || (!textcomp && (char *)pCore->pszIcon == text)) + if((textcomp && pCore->pszIcon && strcmp((char *)pCore->pszIcon, text) == 0) || (!textcomp && (char *)pCore->pszIcon == text)) { QUERYRECORDRECT qrr; int scrollpixels = 0, midway; @@ -8198,7 +8492,7 @@ while(pCore) { - if((textcomp && pCore->pszIcon && strcmp(pCore->pszIcon, text) == 0) || (!textcomp && (char *)pCore->pszIcon == text)) + if((textcomp && pCore->pszIcon && strcmp((char *)pCore->pszIcon, text) == 0) || (!textcomp && (char *)pCore->pszIcon == text)) { WinSendMsg(handle, CM_REMOVERECORD, (MPARAM)&pCore, MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE)); return; @@ -8389,7 +8683,7 @@ dw_box_pack_start(vbox, hbox, 0, 0, FALSE, FALSE, 0); dw_window_set_style(hbox, 0, WS_CLIPCHILDREN); - col = WinCreateWindow(vbox, "ColorSelectClass", "", WS_VISIBLE | WS_GROUP, 0, 0, 390, 300, vbox, HWND_TOP, 266, NULL,NULL); + col = WinCreateWindow(vbox, (PSZ)"ColorSelectClass", NULL, WS_VISIBLE | WS_GROUP, 0, 0, 390, 300, vbox, HWND_TOP, 266, NULL,NULL); dw_box_pack_start(hbox, col, 390, 300, FALSE, FALSE, 0); dw_window_set_data(hbox, "_dw_window", (void *)window); @@ -8630,7 +8924,7 @@ break; } - GpiQueryTextBox(hps, strlen(text), text, TXTBOX_COUNT, aptl); + GpiQueryTextBox(hps, strlen(text), (PCH)text, TXTBOX_COUNT, aptl); rcl.xLeft = x; rcl.yTop = height - y; @@ -8638,9 +8932,9 @@ rcl.xRight = rcl.xLeft + (aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x); if(_background == DW_CLR_DEFAULT) - WinDrawText(hps, -1, text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); + WinDrawText(hps, -1, (PCH)text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); else - WinDrawText(hps, -1, text, &rcl, _internal_color(_foreground), _internal_color(_background), DT_VCENTER | DT_LEFT | DT_ERASERECT); + WinDrawText(hps, -1, (PCH)text, &rcl, _internal_color(_foreground), _internal_color(_background), DT_VCENTER | DT_LEFT | DT_ERASERECT); if(!pixmap) WinReleasePS(hps); @@ -8674,7 +8968,7 @@ else return; - GpiQueryTextBox(hps, strlen(text), text, TXTBOX_COUNT, aptl); + GpiQueryTextBox(hps, strlen(text), (PCH)text, TXTBOX_COUNT, aptl); if(width) *width = aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x; @@ -8915,7 +9209,7 @@ ulFlags = GpiQueryPS(hps, &sizl); pixmap->handle = handle; - pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc); + pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, (PSZ)"*", 0L, NULL, hdc); pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC); DevQueryCaps(hdc, CAPS_COLOR_PLANES , 1L, &cPlanes); @@ -9087,7 +9381,7 @@ hdc = GpiQueryDevice(hps); ulFlags = GpiQueryPS(hps, &sizl); - pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, "*", 0L, NULL, hdc); + pixmap->hdc = DevOpenDC(dwhab, OD_MEMORY, (PSZ)"*", 0L, NULL, hdc); pixmap->hps = GpiCreatePS (dwhab, pixmap->hdc, &sizl, ulFlags | GPIA_ASSOC); pixmap->hbm = GpiLoadBitmap(pixmap->hps, NULLHANDLE, id, 0, 0); @@ -9303,7 +9597,7 @@ { char objnamebuf[300] = ""; - return DosLoadModule(objnamebuf, sizeof(objnamebuf), name, handle); + return DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)name, handle); } /* Queries the address of a symbol within open handle. @@ -9315,7 +9609,7 @@ */ int API dw_module_symbol(HMOD handle, char *name, void**func) { - return DosQueryProcAddr(handle, 0, name, (PFN*)func); + return DosQueryProcAddr(handle, 0, (PSZ)name, (PFN*)func); } /* Frees the shared library previously opened. @@ -9483,7 +9777,7 @@ strcpy(semname, "\\sem32\\"); strcat(semname, name); - DosCreateEventSem(semname, &ev, 0L, FALSE); + DosCreateEventSem((PSZ)semname, &ev, 0L, FALSE); free(semname); return ev; @@ -9506,7 +9800,7 @@ strcpy(semname, "\\sem32\\"); strcat(semname, name); - DosOpenEventSem(semname, &ev); + DosOpenEventSem((PSZ)semname, &ev); free(semname); return ev; @@ -9608,7 +9902,7 @@ sprintf(namebuf, "\\sharemem\\%s", name); - if(DosAllocSharedMem((void *)dest, namebuf, size, PAG_COMMIT | PAG_WRITE | PAG_READ) != NO_ERROR) + if(DosAllocSharedMem((void *)dest, (PSZ)namebuf, size, PAG_COMMIT | PAG_WRITE | PAG_READ) != NO_ERROR) return 0; return 1; @@ -9628,7 +9922,7 @@ size = size; sprintf(namebuf, "\\sharemem\\%s", name); - if(DosGetNamedSharedMem((void *)dest, namebuf, PAG_READ | PAG_WRITE) != NO_ERROR) + if(DosGetNamedSharedMem((void *)dest, (PSZ)namebuf, PAG_READ | PAG_WRITE) != NO_ERROR) return 0; return 1; @@ -9733,7 +10027,7 @@ HWND API dw_splitbar_new(int type, HWND topleft, HWND bottomright, unsigned long id) { HWND tmp = WinCreateWindow(HWND_OBJECT, - SplitbarClassName, + (PSZ)SplitbarClassName, NULL, WS_VISIBLE | WS_CLIPCHILDREN, 0,0,2000,1000, @@ -9848,7 +10142,7 @@ achFileName[0] = (char)('A'+ulBootDrive-1); - if (DosOpen (achFileName, &hfile, &ulResult, 0, 0, OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_SEQUENTIAL | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, NULL) == NO_ERROR) + if (DosOpen ((PSZ)achFileName, &hfile, &ulResult, 0, 0, OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_SEQUENTIAL | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, NULL) == NO_ERROR) { ULONG ulFileSize = 0; if (DosSetFilePtr (hfile, 0, FILE_END, &ulFileSize) == NO_ERROR) @@ -9934,7 +10228,7 @@ if (rc) /* Text data in clipboard */ { PSZ pszClipText = (PSZ)WinQueryClipbrdData(dwhab, CF_TEXT); /* Query data handle */ - retbuf = strdup(pszClipText); + retbuf = strdup((char *)pszClipText); } WinCloseClipbrd(dwhab); return retbuf; @@ -10021,7 +10315,7 @@ ULONG count = 1; HDIR hdir = HDIR_CREATE; - if(DosFindFirst(path, &hdir, FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_ARCHIVED | MUST_HAVE_DIRECTORY, + if(DosFindFirst((PSZ)path, &hdir, FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_ARCHIVED | MUST_HAVE_DIRECTORY, &ffbuf, sizeof(FILEFINDBUF3), &count, FIL_STANDARD) == NO_ERROR) { while(DosFindNext(hdir, &ffbuf, sizeof(FILEFINDBUF3), &count) == NO_ERROR) @@ -10035,7 +10329,7 @@ strcpy(folder, path); strcpy(&folder[len-1], ffbuf.achName); - item = dw_tree_insert(tree, ffbuf.achName, WinLoadFileIcon(folder, TRUE), parent, (void *)parent); + item = dw_tree_insert(tree, ffbuf.achName, WinLoadFileIcon((PSZ)folder, TRUE), parent, (void *)parent); tempitem = dw_tree_insert(tree, "", 0, item, 0); dw_tree_item_set_data(tree, item, (void *)tempitem); } @@ -10064,7 +10358,7 @@ folder[0] = name[6] = 'A' + drive; - items[drive] = dw_tree_insert(tree, name, WinLoadFileIcon(folder, TRUE), NULL, 0); + items[drive] = dw_tree_insert(tree, name, WinLoadFileIcon((PSZ)folder, TRUE), NULL, 0); tempitem = dw_tree_insert(tree, "", 0, items[drive], 0); dw_tree_item_set_data(tree, items[drive], (void *)tempitem); } @@ -10239,7 +10533,7 @@ if(defpath) { - if(DosQueryPathInfo(defpath, FIL_QUERYFULLNAME, fild.szFullFile, sizeof(fild.szFullFile))) + if(DosQueryPathInfo((PSZ)defpath, FIL_QUERYFULLNAME, fild.szFullFile, sizeof(fild.szFullFile))) strcpy(fild.szFullFile, defpath); }; @@ -10280,8 +10574,8 @@ /* Setup the structure */ fild.cbSize = sizeof(FILEDLG); fild.fl = FDS_CENTER | FDS_OPEN_DIALOG; - fild.pszTitle = title; - fild.pszOKButton = ((flags & DW_FILE_SAVE) ? "Save" : "Open"); + fild.pszTitle = (PSZ)title; + fild.pszOKButton = (PSZ)((flags & DW_FILE_SAVE) ? "Save" : "Open"); fild.pfnDlgProc = (PFNWP)WinDefFileDlgProc; hwndFile = WinFileDlg(HWND_DESKTOP, HWND_DESKTOP, &fild); @@ -10327,7 +10621,7 @@ int API dw_exec(char *program, int type, char **params) { type = type; /* keep compiler happy */ - return spawnvp(P_NOWAIT, program, params); + return spawnvp(P_NOWAIT, program, (char * const *)params); } /* @@ -10342,14 +10636,14 @@ olddir = _getcwd(NULL, 1024); - PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", - "DefaultWorkingDir", NULL, browser, 1024); + PrfQueryProfileString(HINI_USERPROFILE, (PSZ)"WPURLDEFAULTSETTINGS", + (PSZ)"DefaultWorkingDir", NULL, (PSZ)browser, 1024); if(browser[0]) _SetPath(browser); - PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", - "DefaultBrowserExe", NULL, browser, 1024); + PrfQueryProfileString(HINI_USERPROFILE, (PSZ)"WPURLDEFAULTSETTINGS", + (PSZ)"DefaultBrowserExe", NULL, (PSZ)browser, 1024); len = strlen(browser) - strlen("explore.exe"); @@ -10445,7 +10739,8 @@ HWND API dw_html_new(unsigned long id) { id = id; - return dw_box_new(DW_HORZ, 0); + dw_debug("HTML widget not available; OS/2 currently does not support it.\n"); + return 0; } typedef struct _dwprint @@ -10564,7 +10859,7 @@ ULONG cbBuf, cRes, cTotal, cbNeeded; SPLERR splerr = 0 ; PPRINTERINFO pRes ; /* Check the default printer for now... want a printer list in the future */ - int cb = PrfQueryProfileString(HINI_PROFILE, "PM_SPOOLER", "PRINTER", "", printername, 32); + int cb = PrfQueryProfileString(HINI_PROFILE, (PSZ)"PM_SPOOLER", (PSZ)"PRINTER", (PSZ)"", printername, 32); if(!drawfunc || !(print = calloc(1, sizeof(DWPrint)))) return NULL; @@ -10624,9 +10919,9 @@ pRes = (PPRINTERINFO)pBuf ; while(cRes--) { - dw_listbox_append(printerlist, pRes[cRes].pszPrintDestinationName); + dw_listbox_append(printerlist, (char *)pRes[cRes].pszPrintDestinationName); /* If this is the default printer... select it by default */ - if(strcmp(pRes[cRes].pszPrintDestinationName, printername) == 0) + if(strcmp((char *)pRes[cRes].pszPrintDestinationName, printername) == 0) dw_listbox_select(printerlist, count, TRUE); count++; } @@ -10709,15 +11004,15 @@ DEVOPENSTRUC dop; /* Get the printer information string */ - cb = PrfQueryProfileString(HINI_PROFILE, "PM_SPOOLER_PRINTER", print->printername, "", PrintDetails, 256); + cb = PrfQueryProfileString(HINI_PROFILE, (PSZ)"PM_SPOOLER_PRINTER", (PSZ)print->printername, (PSZ)"", PrintDetails, 256); _ExtractLogAddress(LogAddress, PrintDetails); _ExtractDriverName(DriverName, PrintDetails); - dop.pszDriverName = DriverName; - dop.pszLogAddress = LogAddress; + dop.pszDriverName = (PSZ)DriverName; + dop.pszLogAddress = (PSZ)LogAddress; dop.pdriv = NULL; - dop.pszDataType = "PM_Q_STD"; + dop.pszDataType = (PSZ)"PM_Q_STD"; /* Attempt to open a device context and return a handle to it */ - print->hdc = DevOpenDC(dwhab, OD_QUEUED, "*", 4L, (PDEVOPENDATA) &dop, (HDC)NULL); + print->hdc = DevOpenDC(dwhab, OD_QUEUED, (PSZ)"*", 4L, (PDEVOPENDATA) &dop, (HDC)NULL); if(print->hdc) return print; } @@ -10750,7 +11045,7 @@ return result; /* Start the job */ - DevEscape(p->hdc, DEVESC_STARTDOC, strlen(p->jobname), p->jobname, NULL, NULL); + DevEscape(p->hdc, DEVESC_STARTDOC, strlen(p->jobname), (PBYTE)p->jobname, NULL, NULL); pixmap->font = WinCreateWindow(HWND_OBJECT, WC_FRAME, NULL, 0,0,0,1,1, NULLHANDLE, HWND_TOP,0, NULL, NULL); pixmap->hdc = p->hdc; @@ -10767,11 +11062,15 @@ /* Next page */ DevEscape(p->hdc, DEVESC_NEWFRAME, 0, NULL, NULL, NULL); } - /* Signal that we are done */ - DevEscape(p->hdc, DEVESC_ENDDOC, 0, NULL, NULL, NULL); /* Determine the completion code */ if(p->drawfunc) + { result = DW_ERROR_NONE; + /* Signal that we are done */ + DevEscape(p->hdc, DEVESC_ENDDOC, 0, NULL, NULL, NULL); + } + else + DevEscape(p->hdc, DEVESC_ABORTDOC, 0, NULL, NULL, NULL); /* Free memory */ dw_pixmap_destroy(pixmap); if(p->printername) @@ -11179,22 +11478,20 @@ } } - - -/* - * Create a new static text window (widget) to be packed. - * Not available under OS/2, eCS - * Parameters: - * text: The text to be display by the static text widget. +/* + * Create a new calendar window (widget) to be packed. + * Parameters: * id: An ID to be used with dw_window_from_id() or 0L. + * Returns: + * Handle to the created calendar or NULL on error. */ HWND API dw_calendar_new(ULONG id) { - char *text = "dummy calendar"; WindowData *blah = calloc(sizeof(WindowData), 1); + DATETIME dt; HWND tmp = WinCreateWindow(HWND_OBJECT, WC_STATIC, - text, + NULL, WS_VISIBLE | SS_TEXT, 0,0,2000,1000, NULLHANDLE, @@ -11202,26 +11499,51 @@ id, NULL, NULL); - blah->oldproc = WinSubclassWindow(tmp, _textproc); + blah->oldproc = WinSubclassWindow(tmp, _calendarproc); WinSetWindowPtr(tmp, QWP_USER, blah); dw_window_set_font(tmp, DefaultFont); - dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); - WinSetWindowText(tmp, text); + if(!DosGetDateTime(&dt)) + dw_calendar_set_date(tmp, dt.year, dt.month, dt.day); return tmp; } /* - * The following are stubs + * Sets the current date of a calendar. + * Parameters: + * handle: The handle to the calendar returned by dw_calendar_new(). + * year, month, day: To set the calendar to display. */ void API dw_calendar_set_date( HWND window, unsigned int year, unsigned int month, unsigned int day ) { - char tmp[30]; - sprintf( tmp, "%4.4d-%2.2d-%2.2d", year, month, day); - WinSetWindowText(window, tmp); -} - + /* Need to be 0 based */ + if(year > 0) + year--; + if(month > 0) + month--; + if(day > 0) + day--; + + dw_window_set_data(window, "_dw_year", DW_INT_TO_POINTER(year)); + dw_window_set_data(window, "_dw_month", DW_INT_TO_POINTER(month)); + dw_window_set_data(window, "_dw_day", DW_INT_TO_POINTER(day)); + /* Make it redraw */ + WinPostMsg(window, WM_PAINT, 0, 0); +} + +/* + * Gets the year, month and day set in the calendar widget. + * Parameters: + * handle: The handle to the calendar returned by dw_calendar_new(). + * year: Variable to store the year or NULL. + * month: Variable to store the month or NULL. + * day: Variable to store the day or NULL. + */ void API dw_calendar_get_date( HWND window, unsigned int *year, unsigned int *month, unsigned int *day ) { - window = window; - *year = *month = *day = 0; -} + if(year) + *year = DW_POINTER_TO_UINT(dw_window_get_data(window, "_dw_year")) + 1; + if(month) + *month = DW_POINTER_TO_UINT(dw_window_get_data(window, "_dw_month")) + 1; + if(day) + *day = DW_POINTER_TO_UINT(dw_window_get_data(window, "_dw_day")) + 1; +}
--- a/sfxace/makefile.vac Sun Nov 13 15:03:53 2011 -0600 +++ b/sfxace/makefile.vac Sun Nov 20 11:11:10 2011 -0600 @@ -48,7 +48,8 @@ ..\install.def << rc -x2 ..\sfxos2.res sfxos2.exe -# lxlite sfxos2.exe + lxlite sfxos2.exe + copy sfxos2.exe ..\sfx.exe clean: rm -f $(OBJECTS) *.obj install.exe ..\sfxos2.res sfxos2.exe
--- a/win/dw.c Sun Nov 13 15:03:53 2011 -0600 +++ b/win/dw.c Sun Nov 20 11:11:10 2011 -0600 @@ -3,7 +3,7 @@ * A GTK like implementation of the Win32 GUI * * (C) 2000-2011 Brian Smith <brian@dbsoft.org> - * (C) 2003-2005 Mark Hessling <m.hessling@qut.edu.au> + * (C) 2003-2011 Mark Hessling <m.hessling@qut.edu.au> * */ #define _WIN32_IE 0x0500 @@ -18,6 +18,8 @@ #include <string.h> #include <stdio.h> #include <process.h> +#include <malloc.h> +#include <io.h> #include <time.h> #include <math.h> #include "dw.h" @@ -100,13 +102,22 @@ #endif /* - * MinGW (as at 3.2.3) doesn't have MIM_MENUDATA - * so #define it here + * MinGW Is missing a bunch of definitions + * so #define them here... */ #if !defined( MIM_MENUDATA ) # define MIM_MENUDATA 0x00000008 #endif +#if !defined(PBS_MARQUEE) +# define PBS_MARQUEE 0x08 +#endif +#if !defined(PBM_SETMARQUEE) +# define PBM_SETMARQUEE (WM_USER+10) +#endif +#if !defined(LVS_EX_DOUBLEBUFFER) +# define LVS_EX_DOUBLEBUFFER 0x10000 +#endif HWND popup = (HWND)NULL, DW_HWND_OBJECT = (HWND)NULL; @@ -160,7 +171,7 @@ static int screenx, screeny; HFONT _DefaultFont = NULL; -#ifdef BUILD_DLL +#if (defined(BUILD_DLL) || defined(BUILD_HTML)) && !defined(__MINGW32__) LRESULT CALLBACK _browserWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); #endif void _resize_notebook_page(HWND handle, int pageid); @@ -391,7 +402,7 @@ { strcpy( file, filename ); strcat( file, image_exts[i] ); - if ( access( file, 04 ) == 0 ) + if ( _access( file, 04 ) == 0 ) { /* Convert to wide format */ MultiByteToWideChar(CP_ACP, 0, file, strlen(file)+1, wfile, wclen); @@ -1596,6 +1607,14 @@ rect.right - rect.left, rect.bottom-rect.top, FALSE); } } + /* So does the List View... handle delayed cursoring */ + if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)==0 && width + vectorx > 10 && height + vectory > 10) + { + int index = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_cursor")); + + if(index > 0) + ListView_EnsureVisible(handle, index, TRUE); + } if(thisbox->type == DW_HORZ) currentx += width + vectorx + (pad * 2); @@ -1707,12 +1726,12 @@ { char buffer[40]; int checkable; - sprintf( buffer, "_dw_checkable%ld", id ); + sprintf( buffer, "_dw_checkable%d", id ); checkable = (int)dw_window_get_data(DW_HWND_OBJECT, buffer); if ( checkable ) { int is_checked; - sprintf( buffer, "_dw_ischecked%ld", id ); + sprintf( buffer, "_dw_ischecked%d", id ); is_checked = (int)dw_window_get_data(DW_HWND_OBJECT, buffer); is_checked = (is_checked) ? 0 : 1; dw_menu_item_set_check( window, id, is_checked ); @@ -2102,7 +2121,7 @@ /* * Call the user supplied callback */ - result = clickfunc(tmp->window, tmp->data); + result = clickfunc((HWND)tmp->id, tmp->data); tmp = NULL; } } /* this fires for checkable menu items */ @@ -2256,7 +2275,7 @@ GetClassName( hWnd, tmpbuf, 99 ); if ( strnicmp(tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1 ) == 0 ) { - int value = _HandleScroller(hWnd, bar, (int)HIWORD(mp1), (int)LOWORD(mp1)); + _HandleScroller(hWnd, bar, (int)HIWORD(mp1), (int)LOWORD(mp1)); } } } @@ -2876,9 +2895,7 @@ /* Window procedure for container/listview */ BOOL CALLBACK _containerwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) { - ContainerInfo *cinfo; - - cinfo = (ContainerInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); + ContainerInfo *continfo = (ContainerInfo *)GetWindowLongPtr(hWnd, GWLP_USERDATA); switch( msg ) { @@ -2888,18 +2905,18 @@ _wndproc(hWnd, msg, mp1, mp2); break; case WM_PAINT: - if(cinfo->cinfo.pOldProc && (cinfo->even != DW_RGB_TRANSPARENT || cinfo->odd != DW_RGB_TRANSPARENT)) + if(continfo->cinfo.pOldProc && (continfo->even != DW_RGB_TRANSPARENT || continfo->odd != DW_RGB_TRANSPARENT)) { RECT rectUpd, rectDestin, rect; int iItems, iTop, i; COLORREF c; /* Load the default background color for the first pass */ - ListView_SetTextBkColor(hWnd, cinfo->cinfo.back != -1 ? cinfo->cinfo.back : ListView_GetBkColor(hWnd)); + ListView_SetTextBkColor(hWnd, continfo->cinfo.back != -1 ? continfo->cinfo.back : ListView_GetBkColor(hWnd)); /* get the rectangle to be updated */ GetUpdateRect(hWnd, &rectUpd, FALSE); /* allow default processing first */ - CallWindowProc(cinfo->cinfo.pOldProc, hWnd, msg, 0, 0); + CallWindowProc(continfo->cinfo.pOldProc, hWnd, msg, 0, 0); /* number of displayed rows */ iItems = ListView_GetCountPerPage(hWnd); /* first visible row */ @@ -2911,7 +2928,7 @@ if(ListView_GetItemRect(hWnd, i, &rect, LVIR_BOUNDS) && IntersectRect(&rectDestin, &rectUpd, &rect)) { /* change text background colour accordingly */ - c = (i % 2) ? cinfo->odd : cinfo->even; + c = (i % 2) ? continfo->odd : continfo->even; if(c != DW_RGB_TRANSPARENT) { @@ -2919,7 +2936,7 @@ /* invalidate the row rectangle then... */ InvalidateRect(hWnd, &rectDestin, FALSE); /* ...force default processing */ - CallWindowProc(cinfo->cinfo.pOldProc, hWnd, msg, 0, 0); + CallWindowProc(continfo->cinfo.pOldProc, hWnd, msg, 0, 0); } } } @@ -3025,9 +3042,9 @@ break; } - if(!cinfo || !cinfo->cinfo.pOldProc) + if(!continfo || !continfo->cinfo.pOldProc) return DefWindowProc(hWnd, msg, mp1, mp2); - return CallWindowProc(cinfo->cinfo.pOldProc, hWnd, msg, mp1, mp2); + return CallWindowProc(continfo->cinfo.pOldProc, hWnd, msg, mp1, mp2); } BOOL CALLBACK _treewndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) @@ -3375,8 +3392,6 @@ BOOL CALLBACK _BtProc(HWND hwnd, ULONG msg, WPARAM mp1, LPARAM mp2) { BubbleButton *bubble; - POINT point; - RECT rect; WNDPROC pOldProc; bubble = (BubbleButton *)GetWindowLongPtr(hwnd, GWLP_USERDATA); @@ -3629,8 +3644,7 @@ WNDCLASS wc; int z; INITCOMMONCONTROLSEX icc; - char *fname, *alttmpdir; - HFONT oldfont; + char *alttmpdir; #ifdef GDIPLUS struct GdiplusStartupInput si; #endif @@ -3698,7 +3712,7 @@ RegisterClass(&wc); -#ifdef BUILD_DLL +#if (defined(BUILD_DLL) || defined(BUILD_HTML)) && !defined(__MINGW32__) /* Register HTML renderer class */ memset(&wc, 0, sizeof(WNDCLASS)); wc.lpfnWndProc = (WNDPROC)_browserWindowProc; @@ -4558,7 +4572,7 @@ hwndframe = CreateWindow(FRAMECLASSNAME, "", WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, NULL, DWInstance, @@ -4589,7 +4603,7 @@ hwndframe = CreateWindow(ScrollClassName, "", WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, NULL, DWInstance, @@ -4675,7 +4689,7 @@ hwndframe = CreateWindow(FRAMECLASSNAME, "", WS_VISIBLE | WS_CHILD, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, NULL, DWInstance, @@ -4685,7 +4699,7 @@ title, WS_CHILD | BS_GROUPBOX | WS_VISIBLE | WS_CLIPCHILDREN, - 0,0,2000,1000, + 0,0,0,0, hwndframe, NULL, DWInstance, @@ -4712,7 +4726,7 @@ hwndframe = CreateWindow("MDICLIENT", "", WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -4727,20 +4741,76 @@ */ HWND API dw_html_new(unsigned long id) { -#if defined(BUILD_DLL) || defined(BUILD_HTML) +#if (defined(BUILD_DLL) || defined(BUILD_HTML)) && !defined(__MINGW32__) return CreateWindow(BrowserClassName, "", WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, NULL); #else + dw_debug("HTML widget not available; Support not enabled in this build.\n"); return 0; #endif } +#if (defined(BUILD_DLL) || defined(BUILD_HTML)) && !defined(__MINGW32__) +void _dw_html_action(HWND hwnd, int action); +int _dw_html_raw(HWND hwnd, char *string); +int _dw_html_url(HWND hwnd, char *url); +#endif + +/* + * Causes the embedded HTML widget to take action. + * Parameters: + * handle: Handle to the window. + * action: One of the DW_HTML_* constants. + */ +void API dw_html_action(HWND handle, int action) +{ +#if (defined(BUILD_DLL) || defined(BUILD_HTML)) && !defined(__MINGW32__) + _dw_html_action(handle, action); +#endif +} + +/* + * Render raw HTML code in the embedded HTML widget.. + * Parameters: + * handle: Handle to the window. + * string: String buffer containt HTML code to + * be rendered. + * Returns: + * DW_ERROR_NONE (0) on success. + */ +int API dw_html_raw(HWND handle, char *string) +{ +#if (defined(BUILD_DLL) || defined(BUILD_HTML)) && !defined(__MINGW32__) + return _dw_html_raw(handle, string); +#else + return DW_ERROR_GENERAL; +#endif +} + +/* + * Render file or web page in the embedded HTML widget.. + * Parameters: + * handle: Handle to the window. + * url: Universal Resource Locator of the web or + * file object to be rendered. + * Returns: + * DW_ERROR_NONE (0) on success. + */ +int API dw_html_url(HWND handle, char *url) +{ +#if (defined(BUILD_DLL) || defined(BUILD_HTML)) && !defined(__MINGW32__) + return _dw_html_url(handle, url); +#else + return DW_ERROR_GENERAL; +#endif +} + /* * Create a bitmap object to be packed. * Parameters: @@ -4752,7 +4822,7 @@ "", SS_BITMAP | SS_CENTERIMAGE | WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -4777,7 +4847,7 @@ tmp = CreateWindow(WC_TABCONTROL, "", WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | flags, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -4871,6 +4941,7 @@ HMENU mymenu = (HMENU)menux; char buffer[31] = {0}; int is_checked, is_disabled; + char *menutitle = title; /* * Check if this is a menubar; if so get the menu object @@ -4886,7 +4957,9 @@ /* Convert from OS/2 style accellerators to Win32 style */ if (title) { - char *tmp = title; + char *tmp = menutitle = _alloca(strlen(title)+1); + + strcpy(tmp, title); while(*tmp) { @@ -4896,7 +4969,7 @@ } } - if (title && *title) + if (menutitle && *menutitle) { /* Code to autogenerate a menu ID if not specified or invalid * First pool is smaller for transient popup menus @@ -4949,8 +5022,8 @@ mii.hSubMenu = (HMENU)submenu; else mii.hSubMenu = 0; - mii.dwTypeData = title; - mii.cch = strlen(title); + mii.dwTypeData = menutitle; + mii.cch = strlen(menutitle); InsertMenuItem(mymenu, 65535, TRUE, &mii); @@ -5171,7 +5244,7 @@ LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | WS_BORDER | WS_CLIPCHILDREN, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5213,7 +5286,7 @@ TVS_HASLINES | TVS_SHOWSELALWAYS | TVS_HASBUTTONS | TVS_LINESATROOT | WS_BORDER | WS_CLIPCHILDREN, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5278,7 +5351,7 @@ SS_NOPREFIX | BS_TEXT | WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5299,7 +5372,7 @@ text, BS_TEXT | WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5324,7 +5397,7 @@ WS_VSCROLL | ES_MULTILINE | ES_WANTRETURN | WS_CHILD | WS_CLIPCHILDREN, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5360,7 +5433,7 @@ ES_WANTRETURN | WS_CHILD | WS_BORDER | ES_AUTOHSCROLL | WS_VISIBLE | WS_CLIPCHILDREN, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5389,7 +5462,7 @@ ES_WANTRETURN | WS_CHILD | ES_PASSWORD | WS_BORDER | WS_VISIBLE | ES_AUTOHSCROLL | WS_CLIPCHILDREN, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5429,7 +5502,7 @@ text, WS_CHILD | CBS_DROPDOWN | WS_VSCROLL | WS_CLIPCHILDREN | CBS_AUTOHSCROLL | WS_VISIBLE, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5472,7 +5545,7 @@ text, WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | WS_CLIPCHILDREN, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5503,7 +5576,7 @@ WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | WS_CLIPCHILDREN | (icon ? BS_ICON : BS_BITMAP), - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5542,7 +5615,7 @@ BubbleButton *bubble; HBITMAP hbitmap = 0; HANDLE hicon = 0; - int windowtype = 0, len; + int windowtype = 0; if (!(bubble = calloc(1, sizeof(BubbleButton)))) return 0; @@ -5562,7 +5635,7 @@ tmp = CreateWindow( BUTTONCLASSNAME, "", windowtype | WS_CHILD | BS_PUSHBUTTON | WS_CLIPCHILDREN | WS_VISIBLE, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5603,7 +5676,7 @@ HANDLE hicon = 0; char *file; FILE *fp; - int windowtype; + int windowtype = BS_BITMAP; if ( !(bubble = calloc(1, sizeof(BubbleButton))) ) return 0; @@ -5619,16 +5692,10 @@ if((hicon = _dw_load_icon(file))) windowtype = BS_ICON; else - { hbitmap = _dw_load_bitmap(file, NULL); - windowtype = BS_BITMAP; - } #else if ( len > 1 && data[0] == 'B' && data[1] == 'M' ) /* first 2 chars of data is BM, then its a BMP */ - { hbitmap = (HBITMAP)LoadImage( NULL, file, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); - windowtype = BS_BITMAP; - } else /* otherwise its assumed to be an ico */ { hicon = LoadImage( NULL, file, IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); @@ -5651,7 +5718,7 @@ WS_CHILD | BS_PUSHBUTTON | windowtype | WS_CLIPCHILDREN | WS_VISIBLE, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5688,7 +5755,7 @@ text, WS_CHILD | WS_BORDER | WS_VISIBLE | ES_NUMBER | WS_CLIPCHILDREN, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, NULL, DWInstance, @@ -5699,7 +5766,7 @@ WS_CHILD | UDS_ALIGNRIGHT | WS_BORDER | UDS_ARROWKEYS | UDS_SETBUDDYINT | UDS_WRAP | UDS_NOTHOUSANDS | WS_VISIBLE, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5742,7 +5809,7 @@ text, WS_CHILD | BS_AUTORADIOBUTTON | WS_CLIPCHILDREN | WS_VISIBLE, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5769,7 +5836,7 @@ "", WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | (vertical ? TBS_VERT : TBS_HORZ), - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5797,7 +5864,7 @@ "", WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | (vertical ? SBS_VERT : SBS_HORZ), - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5822,7 +5889,7 @@ return CreateWindow(PROGRESS_CLASS, "", WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5842,7 +5909,7 @@ text, WS_CHILD | BS_AUTOCHECKBOX | BS_TEXT | WS_CLIPCHILDREN | WS_VISIBLE, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5870,7 +5937,7 @@ WS_CHILD | LBS_HASSTRINGS | LBS_NOTIFY | WS_BORDER | WS_CLIPCHILDREN | WS_VSCROLL | (multi ? LBS_MULTIPLESEL : 0) , - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -5920,10 +5987,10 @@ */ void API dw_window_set_bitmap(HWND handle, unsigned long id, char *filename) { - HBITMAP hbitmap; + HBITMAP hbitmap = 0; HBITMAP oldbitmap = (HBITMAP)SendMessage(handle, STM_GETIMAGE, IMAGE_BITMAP, 0); - HICON icon = 0; - HICON oldicon = (HICON)SendMessage(handle, STM_GETIMAGE, IMAGE_ICON, 0); + HANDLE icon = 0; + HANDLE oldicon = (HICON)SendMessage(handle, STM_GETIMAGE, IMAGE_ICON, 0); if(id) { @@ -6592,8 +6659,6 @@ { if(!array[z]) { - int oldpage = TabCtrl_GetCurSel(handle); - array[z] = calloc(1, sizeof(NotebookPage)); array[z]->realid = refid; array[z]->item.mask = TCIF_TEXT; @@ -7941,7 +8006,7 @@ */ HICN API dw_icon_load_from_data(char *data, int len) { - HANDLE icon; + HANDLE icon = 0; char *file; FILE *fp; @@ -8528,8 +8593,12 @@ if ( (textcomp && lvi.lParam && strcmp( (char *)lvi.lParam, text ) == 0) || (!textcomp && (char *)lvi.lParam == text) ) { - + unsigned long width, height; + ListView_SetItemState( handle, index, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED ); + dw_window_get_pos_size( handle, NULL, NULL, &width, &height); + if(width < 10 || height < 10) + dw_window_set_data( handle, "_dw_cursor", DW_INT_TO_POINTER(index) ); ListView_EnsureVisible( handle, index, TRUE ); return; } @@ -8865,7 +8934,7 @@ HDC hdcPaint; HBRUSH oldBrush; HPEN oldPen; - POINT *points; + POINT *points = NULL; int i; if ( handle ) @@ -8900,6 +8969,8 @@ npoints++; } } + else + return; oldBrush = SelectObject( hdcPaint, TlsGetValue(_hBrush) ); oldPen = SelectObject( hdcPaint, TlsGetValue(_hPen) ); @@ -9125,8 +9196,6 @@ { HPIXMAP pixmap; HDC hdc; - COLORREF bkcolor; - ULONG cx, cy; if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) return NULL; @@ -9213,8 +9282,6 @@ HPIXMAP pixmap; BITMAP bm; HDC hdc; - ULONG cx, cy; - BITMAPINFO *info; #ifndef GDIPLUS char *file; #endif @@ -9282,7 +9349,6 @@ HDC hdc; char *file; FILE *fp; - ULONG cx, cy; if ( !(pixmap = calloc(1,sizeof(struct _hpixmap))) ) { @@ -9979,7 +10045,7 @@ HWND tmp = CreateWindow(SplitbarClassName, "", WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN, - 0,0,2000,1000, + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -10056,7 +10122,7 @@ MONTHCAL_CLASS, "", WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | MCS_DAYSTATE, - 0,0,2000,1000, // resize it later + 0,0,0,0, DW_HWND_OBJECT, (HMENU)id, DWInstance, @@ -10163,7 +10229,7 @@ * Pointer to an allocated string of text or NULL if clipboard empty or contents could not * be converted to text. */ -char *dw_clipboard_get_text() +char * API dw_clipboard_get_text(void) { HANDLE handle; char *tmp, *ret = NULL; @@ -10191,7 +10257,7 @@ * Parameters: * Text. */ -void dw_clipboard_set_text( char *str, int len ) +void API dw_clipboard_set_text( char *str, int len ) { HGLOBAL ptr1; LPTSTR ptr2; @@ -10304,15 +10370,15 @@ char filterbuf[1001] = {0}; int rc; - BROWSEINFO bi; - TCHAR szDir[MAX_PATH]; - LPITEMIDLIST pidl; - LPMALLOC pMalloc; - if ( flags == DW_DIRECTORY_OPEN ) { /* If we aren't building a DLL, use the more simple browser */ #ifndef BUILD_DLL + BROWSEINFO bi; + TCHAR szDir[MAX_PATH]; + LPITEMIDLIST pidl; + LPMALLOC pMalloc; + if (SUCCEEDED(SHGetMalloc(&pMalloc))) { ZeroMemory(&bi,sizeof(bi)); @@ -10437,7 +10503,7 @@ } newparams[count] = NULL; - retcode = spawnvp(P_NOWAIT, program, newparams); + retcode = _spawnvp(P_NOWAIT, program, (const char * const *)newparams); for(z=0;z<count;z++) { @@ -10568,9 +10634,13 @@ p->drawfunc(print, pixmap, x, p->drawdata); EndPage(p->pd.hDC); } - EndDoc(p->pd.hDC); if(p->drawfunc) + { result = DW_ERROR_NONE; + EndDoc(p->pd.hDC); + } + else + AbortDoc(p->pd.hDC); /* Free memory */ dw_pixmap_destroy(pixmap); free(p);