Mercurial > dwindows
comparison os2/dw.c @ 2626:401a3b9f21ba
Massive continuation of code style standardization.
Only tested on Mac and iOS, may require follow up commits to get things
building again as I test on various platforms.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 01 Aug 2021 12:17:07 +0000 |
parents | 42cacc1a1783 |
children | 814c81cae51d |
comparison
equal
deleted
inserted
replaced
2625:2e804b4db81e | 2626:401a3b9f21ba |
---|---|
90 const char * (API_FUNC _gbm_err)(int rc) = 0; | 90 const char * (API_FUNC _gbm_err)(int rc) = 0; |
91 /* | 91 /* |
92 * GBM List of supported formats: BMP, PNG, JPEG, Targa, TIFF and XPM. | 92 * GBM List of supported formats: BMP, PNG, JPEG, Targa, TIFF and XPM. |
93 */ | 93 */ |
94 #define NUM_EXTS 8 | 94 #define NUM_EXTS 8 |
95 char *image_exts[NUM_EXTS] = | 95 char *_dw_image_exts[NUM_EXTS] = |
96 { | 96 { |
97 ".bmp", | 97 ".bmp", |
98 ".png", | 98 ".png", |
99 ".jpg", | 99 ".jpg", |
100 ".jpeg", | 100 ".jpeg", |
112 char *DefaultFont = "9.WarpSans"; | 112 char *DefaultFont = "9.WarpSans"; |
113 | 113 |
114 HAB dwhab = 0; | 114 HAB dwhab = 0; |
115 HMQ dwhmq = 0; | 115 HMQ dwhmq = 0; |
116 DWTID _dwtid = 0; | 116 DWTID _dwtid = 0; |
117 LONG _foreground = 0xAAAAAA, _background = DW_CLR_DEFAULT; | 117 LONG _dw_foreground = 0xAAAAAA, _dw_background = DW_CLR_DEFAULT; |
118 | 118 |
119 HWND hwndApp = NULLHANDLE, hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE, hwndEmph = NULLHANDLE; | 119 HWND _dw_app = NULLHANDLE, _dw_bubble = NULLHANDLE, _dw_bubble_last = NULLHANDLE, _dw_emph = NULLHANDLE; |
120 HWND hwndTrayServer = NULLHANDLE, hwndTaskBar = NULLHANDLE; | 120 HWND _dw_tray = NULLHANDLE, _dw_task_bar = NULLHANDLE; |
121 | 121 |
122 PRECORDCORE pCoreEmph = NULL; | 122 PRECORDCORE _dw_core_emph = NULL; |
123 ULONG aulBuffer[4]; | 123 ULONG _dw_ver_buf[4]; |
124 HWND lasthcnr = 0, lastitem = 0, popup = 0, desktop; | 124 HWND _dw_lasthcnr = 0, _dw_lastitem = 0, _dw_popup = 0, _dw_desktop; |
125 HMOD wpconfig = 0, pmprintf = 0, pmmerge = 0, gbm = 0; | 125 HMOD _dw_wpconfig = 0, _dw_pmprintf = 0, _dw_pmmerge = 0, _dw_gbm = 0; |
126 static char _dw_exec_dir[MAX_PATH+1] = {0}; | 126 static char _dw_exec_dir[MAX_PATH+1] = {0}; |
127 | 127 |
128 #ifdef UNICODE | 128 #ifdef UNICODE |
129 /* Atom for "text/unicode" clipboard format */ | 129 /* Atom for "text/unicode" clipboard format */ |
130 ATOM Unicode; | 130 ATOM Unicode; |
131 KHAND Keyboard; | 131 KHAND Keyboard; |
132 UconvObject Uconv; /* conversion object */ | 132 UconvObject Uconv; /* conversion object */ |
133 #endif | 133 #endif |
134 | 134 |
135 unsigned long _colors[] = { | 135 unsigned long _dw_colors[] = { |
136 CLR_BLACK, | 136 CLR_BLACK, |
137 CLR_DARKRED, | 137 CLR_DARKRED, |
138 CLR_DARKGREEN, | 138 CLR_DARKGREEN, |
139 CLR_BROWN, | 139 CLR_BROWN, |
140 CLR_DARKBLUE, | 140 CLR_DARKBLUE, |
151 CLR_WHITE | 151 CLR_WHITE |
152 }; | 152 }; |
153 | 153 |
154 #define DW_OS2_NEW_WINDOW 1 | 154 #define DW_OS2_NEW_WINDOW 1 |
155 | 155 |
156 #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40) | 156 #define IS_WARP4() (_dw_ver_buf[0] == 20 && _dw_ver_buf[1] >= 40) |
157 | 157 |
158 #ifndef min | 158 #ifndef min |
159 #define min(a, b) (((a < b) ? a : b)) | 159 #define min(a, b) (((a < b) ? a : b)) |
160 #endif | 160 #endif |
161 | 161 |
162 typedef struct _sighandler | 162 typedef struct _dwsighandler |
163 { | 163 { |
164 struct _sighandler *next; | 164 struct _dwsighandler *next; |
165 ULONG message; | 165 ULONG message; |
166 HWND window; | 166 HWND window; |
167 int id; | 167 int id; |
168 void *signalfunction; | 168 void *signalfunction; |
169 void *discfunction; | 169 void *discfunction; |
170 void *data; | 170 void *data; |
171 | 171 |
172 } SignalHandler; | 172 } DWSignalHandler; |
173 | 173 |
174 SignalHandler *Root = NULL; | 174 DWSignalHandler *Root = NULL; |
175 | 175 |
176 typedef struct | 176 typedef struct |
177 { | 177 { |
178 ULONG message; | 178 ULONG message; |
179 char name[30]; | 179 char name[30]; |
217 | 217 |
218 /* This function adds a signal handler callback into the linked list. | 218 /* This function adds a signal handler callback into the linked list. |
219 */ | 219 */ |
220 void _dw_new_signal(ULONG message, HWND window, int id, void *signalfunction, void *discfunc, void *data) | 220 void _dw_new_signal(ULONG message, HWND window, int id, void *signalfunction, void *discfunc, void *data) |
221 { | 221 { |
222 SignalHandler *new = malloc(sizeof(SignalHandler)); | 222 DWSignalHandler *new = malloc(sizeof(DWSignalHandler)); |
223 | 223 |
224 new->message = message; | 224 new->message = message; |
225 new->window = window; | 225 new->window = window; |
226 new->id = id; | 226 new->id = id; |
227 new->signalfunction = signalfunction; | 227 new->signalfunction = signalfunction; |
231 | 231 |
232 if (!Root) | 232 if (!Root) |
233 Root = new; | 233 Root = new; |
234 else | 234 else |
235 { | 235 { |
236 SignalHandler *prev = NULL, *tmp = Root; | 236 DWSignalHandler *prev = NULL, *tmp = Root; |
237 while(tmp) | 237 while(tmp) |
238 { | 238 { |
239 if(tmp->message == message && | 239 if(tmp->message == message && |
240 tmp->window == window && | 240 tmp->window == window && |
241 tmp->id == id && | 241 tmp->id == id && |
302 /* Find the desktop window handle */ | 302 /* Find the desktop window handle */ |
303 HWND _dw_toplevel_window(HWND handle) | 303 HWND _dw_toplevel_window(HWND handle) |
304 { | 304 { |
305 HWND box, lastbox = WinQueryWindow(handle, QW_PARENT); | 305 HWND box, lastbox = WinQueryWindow(handle, QW_PARENT); |
306 | 306 |
307 if(lastbox == desktop) | 307 if(lastbox == _dw_desktop) |
308 return handle; | 308 return handle; |
309 | 309 |
310 /* Find the toplevel window */ | 310 /* Find the toplevel window */ |
311 while((box = WinQueryWindow(lastbox, QW_PARENT)) != desktop && box) | 311 while((box = WinQueryWindow(lastbox, QW_PARENT)) != _dw_desktop && box) |
312 { | 312 { |
313 lastbox = box; | 313 lastbox = box; |
314 } | 314 } |
315 if(box) | 315 if(box) |
316 { | 316 { |
571 if(menuid >= 30000) | 571 if(menuid >= 30000) |
572 { | 572 { |
573 char buffer[31] = {0}; | 573 char buffer[31] = {0}; |
574 | 574 |
575 sprintf(buffer, "_dw_id%d", menuid); | 575 sprintf(buffer, "_dw_id%d", menuid); |
576 dw_window_set_data( hwndApp, buffer, NULL ); | 576 dw_window_set_data( _dw_app, buffer, NULL ); |
577 sprintf(buffer, "_dw_checkable%d", menuid); | 577 sprintf(buffer, "_dw_checkable%d", menuid); |
578 dw_window_set_data( hwndApp, buffer, NULL ); | 578 dw_window_set_data( _dw_app, buffer, NULL ); |
579 sprintf(buffer, "_dw_ischecked%d", menuid); | 579 sprintf(buffer, "_dw_ischecked%d", menuid); |
580 dw_window_set_data( hwndApp, buffer, NULL ); | 580 dw_window_set_data( _dw_app, buffer, NULL ); |
581 sprintf(buffer, "_dw_isdisabled%d", menuid); | 581 sprintf(buffer, "_dw_isdisabled%d", menuid); |
582 dw_window_set_data( hwndApp, buffer, NULL ); | 582 dw_window_set_data( _dw_app, buffer, NULL ); |
583 } | 583 } |
584 | 584 |
585 /* Check any submenus */ | 585 /* Check any submenus */ |
586 if(WinSendMsg(menu, MM_QUERYITEM, MPFROMSHORT(menuid), MPFROMP(&mi)) | 586 if(WinSendMsg(menu, MM_QUERYITEM, MPFROMSHORT(menuid), MPFROMP(&mi)) |
587 && mi.hwndSubMenu) | 587 && mi.hwndSubMenu) |
983 | 983 |
984 /* Return the OS/2 color from the DW color */ | 984 /* Return the OS/2 color from the DW color */ |
985 unsigned long _dw_internal_color(unsigned long color) | 985 unsigned long _dw_internal_color(unsigned long color) |
986 { | 986 { |
987 if(color < 16) | 987 if(color < 16) |
988 return _colors[color]; | 988 return _dw_colors[color]; |
989 return color; | 989 return color; |
990 } | 990 } |
991 | 991 |
992 unsigned long _dw_os2_color(unsigned long color) | 992 unsigned long _dw_os2_color(unsigned long color) |
993 { | 993 { |
1626 | 1626 |
1627 switch(msg) | 1627 switch(msg) |
1628 { | 1628 { |
1629 case 0x041f: | 1629 case 0x041f: |
1630 /* Mouse has left the area.. remove tooltip and stop timer */ | 1630 /* Mouse has left the area.. remove tooltip and stop timer */ |
1631 if(hwndBubble) | 1631 if(_dw_bubble) |
1632 { | 1632 { |
1633 WinDestroyWindow(hwndBubble); | 1633 WinDestroyWindow(_dw_bubble); |
1634 hwndBubble = 0; | 1634 _dw_bubble = 0; |
1635 } | 1635 } |
1636 if(hstart) | 1636 if(hstart) |
1637 WinStopTimer(dwhab, hstart, 1); | 1637 WinStopTimer(dwhab, hstart, 1); |
1638 if(hend) | 1638 if(hend) |
1639 WinStopTimer(dwhab, hend, 2); | 1639 WinStopTimer(dwhab, hend, 2); |
1651 hstart = hwnd; | 1651 hstart = hwnd; |
1652 break; | 1652 break; |
1653 case WM_TIMER: | 1653 case WM_TIMER: |
1654 if((int)mp1 == 1 || (int)mp1 == 2) | 1654 if((int)mp1 == 1 || (int)mp1 == 2) |
1655 { | 1655 { |
1656 if(hwndBubble) | 1656 if(_dw_bubble) |
1657 { | 1657 { |
1658 WinDestroyWindow(hwndBubble); | 1658 WinDestroyWindow(_dw_bubble); |
1659 hwndBubble = 0; | 1659 _dw_bubble = 0; |
1660 } | 1660 } |
1661 /* Either starting or ending... remove tooltip and timers */ | 1661 /* Either starting or ending... remove tooltip and timers */ |
1662 if(hstart) | 1662 if(hstart) |
1663 WinStopTimer(dwhab, hstart, 1); | 1663 WinStopTimer(dwhab, hstart, 1); |
1664 if(hend) | 1664 if(hend) |
1673 POINTL txtPointl[TXTBOX_COUNT]; | 1673 POINTL txtPointl[TXTBOX_COUNT]; |
1674 POINTL ptlWork = {0,0}; | 1674 POINTL ptlWork = {0,0}; |
1675 ULONG ulColor = CLR_YELLOW; | 1675 ULONG ulColor = CLR_YELLOW; |
1676 void *bubbleproc; | 1676 void *bubbleproc; |
1677 | 1677 |
1678 hwndBubbleLast = hwnd; | 1678 _dw_bubble_last = hwnd; |
1679 hwndBubble = WinCreateWindow(HWND_DESKTOP, | 1679 _dw_bubble = WinCreateWindow(HWND_DESKTOP, |
1680 WC_STATIC, | 1680 WC_STATIC, |
1681 NULL, | 1681 NULL, |
1682 SS_TEXT | | 1682 SS_TEXT | |
1683 DT_CENTER | | 1683 DT_CENTER | |
1684 DT_VCENTER, | 1684 DT_VCENTER, |
1687 HWND_TOP, | 1687 HWND_TOP, |
1688 0, | 1688 0, |
1689 NULL, | 1689 NULL, |
1690 NULL); | 1690 NULL); |
1691 | 1691 |
1692 WinSetPresParam(hwndBubble, | 1692 WinSetPresParam(_dw_bubble, |
1693 PP_FONTNAMESIZE, | 1693 PP_FONTNAMESIZE, |
1694 strlen(DefaultFont)+1, | 1694 strlen(DefaultFont)+1, |
1695 DefaultFont); | 1695 DefaultFont); |
1696 | 1696 |
1697 | 1697 |
1698 WinSetPresParam(hwndBubble, | 1698 WinSetPresParam(_dw_bubble, |
1699 PP_BACKGROUNDCOLORINDEX, | 1699 PP_BACKGROUNDCOLORINDEX, |
1700 sizeof(ulColor), | 1700 sizeof(ulColor), |
1701 &ulColor); | 1701 &ulColor); |
1702 | 1702 |
1703 WinSetWindowText(hwndBubble, | 1703 WinSetWindowText(_dw_bubble, |
1704 (PSZ)blah->bubbletext); | 1704 (PSZ)blah->bubbletext); |
1705 | 1705 |
1706 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1); | 1706 WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1); |
1707 | 1707 |
1708 hpsTemp = WinGetPS(hwndBubble); | 1708 hpsTemp = WinGetPS(_dw_bubble); |
1709 GpiQueryTextBox(hpsTemp, | 1709 GpiQueryTextBox(hpsTemp, |
1710 strlen(blah->bubbletext), | 1710 strlen(blah->bubbletext), |
1711 (PCH)blah->bubbletext, | 1711 (PCH)blah->bubbletext, |
1712 TXTBOX_COUNT, | 1712 TXTBOX_COUNT, |
1713 txtPointl); | 1713 txtPointl); |
1727 ptlWork.x = dw_screen_width() - lWidth; | 1727 ptlWork.x = dw_screen_width() - lWidth; |
1728 if(ptlWork.x < 0) | 1728 if(ptlWork.x < 0) |
1729 ptlWork.x = 0; | 1729 ptlWork.x = 0; |
1730 } | 1730 } |
1731 | 1731 |
1732 bubbleproc = (void *)WinSubclassWindow(hwndBubble, _dw_bubbleproc); | 1732 bubbleproc = (void *)WinSubclassWindow(_dw_bubble, _dw_bubbleproc); |
1733 | 1733 |
1734 if(bubbleproc) | 1734 if(bubbleproc) |
1735 WinSetWindowPtr(hwndBubble, QWP_USER, bubbleproc); | 1735 WinSetWindowPtr(_dw_bubble, QWP_USER, bubbleproc); |
1736 | 1736 |
1737 WinSetWindowPos(hwndBubble, | 1737 WinSetWindowPos(_dw_bubble, |
1738 HWND_TOP, | 1738 HWND_TOP, |
1739 ptlWork.x, | 1739 ptlWork.x, |
1740 ptlWork.y, | 1740 ptlWork.y, |
1741 lWidth, | 1741 lWidth, |
1742 lHight, | 1742 lHight, |
2214 * obtain input focus. | 2214 * obtain input focus. |
2215 */ | 2215 */ |
2216 if(strncmp(tmpbuf, "#3", 3)==0) | 2216 if(strncmp(tmpbuf, "#3", 3)==0) |
2217 { | 2217 { |
2218 /* Generate click on default item */ | 2218 /* Generate click on default item */ |
2219 SignalHandler *tmp = Root; | 2219 DWSignalHandler *tmp = Root; |
2220 | 2220 |
2221 /* Find any callbacks for this function */ | 2221 /* Find any callbacks for this function */ |
2222 while(tmp) | 2222 while(tmp) |
2223 { | 2223 { |
2224 if(tmp->message == WM_COMMAND) | 2224 if(tmp->message == WM_COMMAND) |
2896 return -1; | 2896 return -1; |
2897 } | 2897 } |
2898 | 2898 |
2899 void _dw_clear_emphasis(void) | 2899 void _dw_clear_emphasis(void) |
2900 { | 2900 { |
2901 if(hwndEmph && WinIsWindow(dwhab, hwndEmph) && pCoreEmph) | 2901 if(_dw_emph && WinIsWindow(dwhab, _dw_emph) && _dw_core_emph) |
2902 WinSendMsg(hwndEmph, CM_SETRECORDEMPHASIS, pCoreEmph, MPFROM2SHORT(FALSE, CRA_SOURCE)); | 2902 WinSendMsg(_dw_emph, CM_SETRECORDEMPHASIS, _dw_core_emph, MPFROM2SHORT(FALSE, CRA_SOURCE)); |
2903 hwndEmph = NULLHANDLE; | 2903 _dw_emph = NULLHANDLE; |
2904 pCoreEmph = NULL; | 2904 _dw_core_emph = NULL; |
2905 } | 2905 } |
2906 | 2906 |
2907 /* Find the desktop window handle */ | 2907 /* Find the desktop window handle */ |
2908 HWND _dw_menu_owner(HWND handle) | 2908 HWND _dw_menu_owner(HWND handle) |
2909 { | 2909 { |
2926 } | 2926 } |
2927 | 2927 |
2928 MRESULT EXPENTRY _dw_run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 2928 MRESULT EXPENTRY _dw_run_event(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
2929 { | 2929 { |
2930 int result = -1; | 2930 int result = -1; |
2931 SignalHandler *tmp = Root; | 2931 DWSignalHandler *tmp = Root; |
2932 ULONG origmsg = msg; | 2932 ULONG origmsg = msg; |
2933 | 2933 |
2934 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN) | 2934 if(msg == WM_BUTTON2DOWN || msg == WM_BUTTON3DOWN) |
2935 msg = WM_BUTTON1DOWN; | 2935 msg = WM_BUTTON1DOWN; |
2936 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP) | 2936 if(msg == WM_BUTTON2UP || msg == WM_BUTTON3UP) |
3148 tmp = NULL; | 3148 tmp = NULL; |
3149 } | 3149 } |
3150 } | 3150 } |
3151 else if(tmp->window < 65536 && command == tmp->window) | 3151 else if(tmp->window < 65536 && command == tmp->window) |
3152 { | 3152 { |
3153 result = clickfunc(popup ? popup : tmp->window, tmp->data); | 3153 result = clickfunc(_dw_popup ? _dw_popup : tmp->window, tmp->data); |
3154 tmp = NULL; | 3154 tmp = NULL; |
3155 } | 3155 } |
3156 } | 3156 } |
3157 break; | 3157 break; |
3158 case WM_CONTROL: | 3158 case WM_CONTROL: |
3241 } | 3241 } |
3242 else | 3242 else |
3243 { | 3243 { |
3244 PRECORDCORE rc = (PRECORDCORE)mp2; | 3244 PRECORDCORE rc = (PRECORDCORE)mp2; |
3245 | 3245 |
3246 if(pCoreEmph) | 3246 if(_dw_core_emph) |
3247 _dw_clear_emphasis(); | 3247 _dw_clear_emphasis(); |
3248 hwndEmph = tmp->window; | 3248 _dw_emph = tmp->window; |
3249 pCoreEmph = mp2; | 3249 _dw_core_emph = mp2; |
3250 WinSendMsg(tmp->window, CM_SETRECORDEMPHASIS, mp2, MPFROM2SHORT(TRUE, CRA_SOURCE)); | 3250 WinSendMsg(tmp->window, CM_SETRECORDEMPHASIS, mp2, MPFROM2SHORT(TRUE, CRA_SOURCE)); |
3251 user = rc->pszText; | 3251 user = rc->pszText; |
3252 } | 3252 } |
3253 } | 3253 } |
3254 result = containercontextfunc(tmp->window, text, x, y, tmp->data, user); | 3254 result = containercontextfunc(tmp->window, text, x, y, tmp->data, user); |
3279 | 3279 |
3280 if(dw_window_get_data(tmp->window, "_dw_container")) | 3280 if(dw_window_get_data(tmp->window, "_dw_container")) |
3281 result = treeselectfunc(tmp->window, 0, (char *)prc->pszIcon, tmp->data, (void *)prc->pszText); | 3281 result = treeselectfunc(tmp->window, 0, (char *)prc->pszIcon, tmp->data, (void *)prc->pszText); |
3282 else | 3282 else |
3283 { | 3283 { |
3284 if(lasthcnr == tmp->window && lastitem == (HWND)pci) | 3284 if(_dw_lasthcnr == tmp->window && _dw_lastitem == (HWND)pci) |
3285 { | 3285 { |
3286 lasthcnr = 0; | 3286 _dw_lasthcnr = 0; |
3287 lastitem = 0; | 3287 _dw_lastitem = 0; |
3288 } | 3288 } |
3289 else | 3289 else |
3290 { | 3290 { |
3291 lasthcnr = tmp->window; | 3291 _dw_lasthcnr = tmp->window; |
3292 lastitem = (HWND)pci; | 3292 _dw_lastitem = (HWND)pci; |
3293 result = treeselectfunc(tmp->window, (HTREEITEM)pci, (char *)pci->rc.pszIcon, tmp->data, pci->user); | 3293 result = treeselectfunc(tmp->window, (HTREEITEM)pci, (char *)pci->rc.pszIcon, tmp->data, pci->user); |
3294 } | 3294 } |
3295 } | 3295 } |
3296 tmp = NULL; | 3296 tmp = NULL; |
3297 } | 3297 } |
3744 */ | 3744 */ |
3745 WinPostMsg(hWnd, WM_USER+2, mp1, mp2); | 3745 WinPostMsg(hWnd, WM_USER+2, mp1, mp2); |
3746 break; | 3746 break; |
3747 case WM_DDE_INITIATEACK: | 3747 case WM_DDE_INITIATEACK: |
3748 /* aswer dde server */ | 3748 /* aswer dde server */ |
3749 hwndTrayServer = (HWND)mp1; | 3749 _dw_tray = (HWND)mp1; |
3750 break; | 3750 break; |
3751 case WM_BUTTON1DOWN | 0x2000: | 3751 case WM_BUTTON1DOWN | 0x2000: |
3752 case WM_BUTTON2DOWN | 0x2000: | 3752 case WM_BUTTON2DOWN | 0x2000: |
3753 case WM_BUTTON3DOWN | 0x2000: | 3753 case WM_BUTTON3DOWN | 0x2000: |
3754 case WM_BUTTON1UP | 0x2000: | 3754 case WM_BUTTON1UP | 0x2000: |
3755 case WM_BUTTON2UP | 0x2000: | 3755 case WM_BUTTON2UP | 0x2000: |
3756 case WM_BUTTON3UP | 0x2000: | 3756 case WM_BUTTON3UP | 0x2000: |
3757 if(hwndTaskBar) | 3757 if(_dw_task_bar) |
3758 result = (int)_dw_run_event(hwndTaskBar, msg & ~0x2000, mp1, mp2); | 3758 result = (int)_dw_run_event(_dw_task_bar, msg & ~0x2000, mp1, mp2); |
3759 break; | 3759 break; |
3760 case WM_USER+2: | 3760 case WM_USER+2: |
3761 _dw_clear_emphasis(); | 3761 _dw_clear_emphasis(); |
3762 if(dw_window_get_data((HWND)mp2, "_dw_popup")) | 3762 if(dw_window_get_data((HWND)mp2, "_dw_popup")) |
3763 _dw_free_menu_data((HWND)mp2); | 3763 _dw_free_menu_data((HWND)mp2); |
4117 if(dw_window_get_data(hwnd, "_dw_disabled")) | 4117 if(dw_window_get_data(hwnd, "_dw_disabled")) |
4118 return (MRESULT)FALSE; | 4118 return (MRESULT)FALSE; |
4119 break; | 4119 break; |
4120 case WM_BUTTON1UP: | 4120 case WM_BUTTON1UP: |
4121 { | 4121 { |
4122 SignalHandler *tmp = Root; | 4122 DWSignalHandler *tmp = Root; |
4123 | 4123 |
4124 if(WinIsWindowEnabled(hwnd) && !dw_window_get_data(hwnd, "_dw_disabled")) | 4124 if(WinIsWindowEnabled(hwnd) && !dw_window_get_data(hwnd, "_dw_disabled")) |
4125 { | 4125 { |
4126 /* Find any callbacks for this function */ | 4126 /* Find any callbacks for this function */ |
4127 while(tmp) | 4127 while(tmp) |
4147 } | 4147 } |
4148 } | 4148 } |
4149 break; | 4149 break; |
4150 case WM_USER: | 4150 case WM_USER: |
4151 { | 4151 { |
4152 SignalHandler *tmp = (SignalHandler *)mp1; | 4152 DWSignalHandler *tmp = (DWSignalHandler *)mp1; |
4153 int (API_FUNC clickfunc)(HWND, void *) = NULL; | 4153 int (API_FUNC clickfunc)(HWND, void *) = NULL; |
4154 | 4154 |
4155 if(tmp) | 4155 if(tmp) |
4156 { | 4156 { |
4157 clickfunc = (int (API_FUNC)(HWND, void *))tmp->signalfunction; | 4157 clickfunc = (int (API_FUNC)(HWND, void *))tmp->signalfunction; |
4165 /* A button press should also occur for an ENTER or SPACE press | 4165 /* A button press should also occur for an ENTER or SPACE press |
4166 * while the button has the active input focus. | 4166 * while the button has the active input focus. |
4167 */ | 4167 */ |
4168 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ') | 4168 if(SHORT1FROMMP(mp2) == '\r' || SHORT1FROMMP(mp2) == ' ') |
4169 { | 4169 { |
4170 SignalHandler *tmp = Root; | 4170 DWSignalHandler *tmp = Root; |
4171 | 4171 |
4172 /* Find any callbacks for this function */ | 4172 /* Find any callbacks for this function */ |
4173 while(tmp) | 4173 while(tmp) |
4174 { | 4174 { |
4175 if(tmp->message == WM_COMMAND) | 4175 if(tmp->message == WM_COMMAND) |
4450 thistm.tm_mon = x; | 4450 thistm.tm_mon = x; |
4451 strftime(months[x], 19, "%B", &thistm); | 4451 strftime(months[x], 19, "%B", &thistm); |
4452 } | 4452 } |
4453 | 4453 |
4454 /* Get the OS/2 version. */ | 4454 /* Get the OS/2 version. */ |
4455 DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG)); | 4455 DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)_dw_ver_buf, 4*sizeof(ULONG)); |
4456 | 4456 |
4457 desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE); | 4457 _dw_desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE); |
4458 | 4458 |
4459 if(!IS_WARP4()) | 4459 if(!IS_WARP4()) |
4460 DefaultFont = strdup("8.Helv"); | 4460 DefaultFont = strdup("8.Helv"); |
4461 else | 4461 else |
4462 DefaultFont = strdup(DefaultFont); | 4462 DefaultFont = strdup(DefaultFont); |
4463 | 4463 |
4464 /* This is a window that hangs around as long as the | 4464 /* This is a window that hangs around as long as the |
4465 * application does and handles menu messages. | 4465 * application does and handles menu messages. |
4466 */ | 4466 */ |
4467 hwndApp = dw_window_new(HWND_OBJECT, "", 0); | 4467 _dw_app = dw_window_new(HWND_OBJECT, "", 0); |
4468 /* Attempt to locate a tray server */ | 4468 /* Attempt to locate a tray server */ |
4469 WinDdeInitiate(hwndApp, (PSZ)"SystrayServer", (PSZ)"TRAY", NULL); | 4469 WinDdeInitiate(_dw_app, (PSZ)"SystrayServer", (PSZ)"TRAY", NULL); |
4470 | 4470 |
4471 /* Load DLLs for providing extra functionality if available */ | 4471 /* Load DLLs for providing extra functionality if available */ |
4472 DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"WPCONFIG", &wpconfig); | 4472 DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"WPCONFIG", &_dw_wpconfig); |
4473 if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"PMPRINTF", &pmprintf)) | 4473 if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"PMPRINTF", &_dw_pmprintf)) |
4474 DosQueryProcAddr(pmprintf, 0, (PSZ)"PmPrintfString", (PFN*)&_PmPrintfString); | 4474 DosQueryProcAddr(_dw_pmprintf, 0, (PSZ)"PmPrintfString", (PFN*)&_PmPrintfString); |
4475 if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"PMMERGE", &pmmerge)) | 4475 if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"PMMERGE", &_dw_pmmerge)) |
4476 DosQueryProcAddr(pmmerge, 5469, NULL, (PFN*)&_WinQueryDesktopWorkArea); | 4476 DosQueryProcAddr(_dw_pmmerge, 5469, NULL, (PFN*)&_WinQueryDesktopWorkArea); |
4477 if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"GBM", &gbm)) | 4477 if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"GBM", &_dw_gbm)) |
4478 { | 4478 { |
4479 /* Load the _System versions of the functions from the library */ | 4479 /* Load the _System versions of the functions from the library */ |
4480 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_err", (PFN*)&_gbm_err); | 4480 DosQueryProcAddr(_dw_gbm, 0, (PSZ)"Gbm_err", (PFN*)&_gbm_err); |
4481 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_init", (PFN*)&_gbm_init); | 4481 DosQueryProcAddr(_dw_gbm, 0, (PSZ)"Gbm_init", (PFN*)&_gbm_init); |
4482 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_deinit", (PFN*)&_gbm_deinit); | 4482 DosQueryProcAddr(_dw_gbm, 0, (PSZ)"Gbm_deinit", (PFN*)&_gbm_deinit); |
4483 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_io_open", (PFN*)&_gbm_io_open); | 4483 DosQueryProcAddr(_dw_gbm, 0, (PSZ)"Gbm_io_open", (PFN*)&_gbm_io_open); |
4484 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_io_close", (PFN*)&_gbm_io_close); | 4484 DosQueryProcAddr(_dw_gbm, 0, (PSZ)"Gbm_io_close", (PFN*)&_gbm_io_close); |
4485 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_read_data", (PFN*)&_gbm_read_data); | 4485 DosQueryProcAddr(_dw_gbm, 0, (PSZ)"Gbm_read_data", (PFN*)&_gbm_read_data); |
4486 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_read_header", (PFN*)&_gbm_read_header); | 4486 DosQueryProcAddr(_dw_gbm, 0, (PSZ)"Gbm_read_header", (PFN*)&_gbm_read_header); |
4487 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_read_palette", (PFN*)&_gbm_read_palette); | 4487 DosQueryProcAddr(_dw_gbm, 0, (PSZ)"Gbm_read_palette", (PFN*)&_gbm_read_palette); |
4488 DosQueryProcAddr(gbm, 0, (PSZ)"Gbm_query_n_filetypes", (PFN*)&_gbm_query_n_filetypes); | 4488 DosQueryProcAddr(_dw_gbm, 0, (PSZ)"Gbm_query_n_filetypes", (PFN*)&_gbm_query_n_filetypes); |
4489 /* If we got the functions, try to initialize the library */ | 4489 /* If we got the functions, try to initialize the library */ |
4490 if(!_gbm_init || _gbm_init()) | 4490 if(!_gbm_init || _gbm_init()) |
4491 { | 4491 { |
4492 /* Otherwise clear out the function pointers */ | 4492 /* Otherwise clear out the function pointers */ |
4493 _gbm_init=0;_gbm_deinit=0;_gbm_io_open=0;_gbm_io_close=0;_gbm_query_n_filetypes=0; | 4493 _gbm_init=0;_gbm_deinit=0;_gbm_io_open=0;_gbm_io_close=0;_gbm_query_n_filetypes=0; |
4786 SWP swp; | 4786 SWP swp; |
4787 | 4787 |
4788 /* If it is an MDI window... | 4788 /* If it is an MDI window... |
4789 * find the MDI area. | 4789 * find the MDI area. |
4790 */ | 4790 */ |
4791 if(parent && parent != desktop) | 4791 if(parent && parent != _dw_desktop) |
4792 { | 4792 { |
4793 WinQueryWindowPos(parent, &swp); | 4793 WinQueryWindowPos(parent, &swp); |
4794 cx = swp.cx; | 4794 cx = swp.cx; |
4795 cy = swp.cy; | 4795 cy = swp.cy; |
4796 /* If the MDI parent isn't visible... | 4796 /* If the MDI parent isn't visible... |
4922 if(handle < 65536) | 4922 if(handle < 65536) |
4923 { | 4923 { |
4924 char buffer[30]; | 4924 char buffer[30]; |
4925 | 4925 |
4926 sprintf(buffer, "_dw_id%ld", handle); | 4926 sprintf(buffer, "_dw_id%ld", handle); |
4927 menu = (HWND)dw_window_get_data(hwndApp, buffer); | 4927 menu = (HWND)dw_window_get_data(_dw_app, buffer); |
4928 | 4928 |
4929 if(menu && WinIsWindow(dwhab, menu)) | 4929 if(menu && WinIsWindow(dwhab, menu)) |
4930 return dw_menu_delete_item((HMENUI)menu, handle); | 4930 return dw_menu_delete_item((HMENUI)menu, handle); |
4931 return DW_ERROR_UNKNOWN; | 4931 return DW_ERROR_UNKNOWN; |
4932 } | 4932 } |
4936 | 4936 |
4937 if((menu = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE) | 4937 if((menu = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE) |
4938 _dw_free_menu_data(menu); | 4938 _dw_free_menu_data(menu); |
4939 | 4939 |
4940 /* If it is a desktop window let WM_DESTROY handle it */ | 4940 /* If it is a desktop window let WM_DESTROY handle it */ |
4941 if(parent != desktop) | 4941 if(parent != _dw_desktop) |
4942 { | 4942 { |
4943 dw_box_unpack(handle); | 4943 dw_box_unpack(handle); |
4944 _dw_free_window_memory(frame ? frame : handle); | 4944 _dw_free_window_memory(frame ? frame : handle); |
4945 } | 4945 } |
4946 return WinDestroyWindow(frame ? frame : handle); | 4946 return WinDestroyWindow(frame ? frame : handle); |
6062 } | 6062 } |
6063 | 6063 |
6064 /* Internal function to make sure menu ID isn't in use */ | 6064 /* Internal function to make sure menu ID isn't in use */ |
6065 int _dw_menuid_allocated(int id) | 6065 int _dw_menuid_allocated(int id) |
6066 { | 6066 { |
6067 SignalHandler *tmp = Root; | 6067 DWSignalHandler *tmp = Root; |
6068 | 6068 |
6069 while(tmp) | 6069 while(tmp) |
6070 { | 6070 { |
6071 if(tmp->id == id) | 6071 if(tmp->id == id) |
6072 return TRUE; | 6072 return TRUE; |
6154 miSubMenu.hItem=NULLHANDLE; | 6154 miSubMenu.hItem=NULLHANDLE; |
6155 | 6155 |
6156 WinSendMsg(menux, MM_INSERTITEM, MPFROMP(&miSubMenu), MPFROMP(title)); | 6156 WinSendMsg(menux, MM_INSERTITEM, MPFROMP(&miSubMenu), MPFROMP(title)); |
6157 | 6157 |
6158 sprintf(buffer, "_dw_id%d", (int)id); | 6158 sprintf(buffer, "_dw_id%d", (int)id); |
6159 dw_window_set_data(hwndApp, buffer, (void *)menux); | 6159 dw_window_set_data(_dw_app, buffer, (void *)menux); |
6160 sprintf(buffer, "_dw_checkable%ld", id); | 6160 sprintf(buffer, "_dw_checkable%ld", id); |
6161 dw_window_set_data( hwndApp, buffer, (void *)check ); | 6161 dw_window_set_data( _dw_app, buffer, (void *)check ); |
6162 sprintf(buffer, "_dw_ischecked%ld", id); | 6162 sprintf(buffer, "_dw_ischecked%ld", id); |
6163 dw_window_set_data( hwndApp, buffer, (void *)is_checked ); | 6163 dw_window_set_data( _dw_app, buffer, (void *)is_checked ); |
6164 sprintf(buffer, "_dw_isdisabled%ld", id); | 6164 sprintf(buffer, "_dw_isdisabled%ld", id); |
6165 dw_window_set_data( hwndApp, buffer, (void *)is_disabled ); | 6165 dw_window_set_data( _dw_app, buffer, (void *)is_disabled ); |
6166 | 6166 |
6167 if ( submenu ) | 6167 if ( submenu ) |
6168 dw_window_set_data(submenu, "_dw_owner", (void *)menux); | 6168 dw_window_set_data(submenu, "_dw_owner", (void *)menux); |
6169 return (HWND)id; | 6169 return (HWND)id; |
6170 } | 6170 } |
6199 int check; | 6199 int check; |
6200 int disabled; | 6200 int disabled; |
6201 USHORT fAttribute=0; | 6201 USHORT fAttribute=0; |
6202 | 6202 |
6203 sprintf( buffer1, "_dw_ischecked%ld", id ); | 6203 sprintf( buffer1, "_dw_ischecked%ld", id ); |
6204 check = (int)dw_window_get_data( hwndApp, buffer1 ); | 6204 check = (int)dw_window_get_data( _dw_app, buffer1 ); |
6205 sprintf( buffer2, "_dw_isdisabled%ld", id ); | 6205 sprintf( buffer2, "_dw_isdisabled%ld", id ); |
6206 disabled = (int)dw_window_get_data( hwndApp, buffer2 ); | 6206 disabled = (int)dw_window_get_data( _dw_app, buffer2 ); |
6207 | 6207 |
6208 if ( (state & DW_MIS_CHECKED) || (state & DW_MIS_UNCHECKED) ) | 6208 if ( (state & DW_MIS_CHECKED) || (state & DW_MIS_UNCHECKED) ) |
6209 { | 6209 { |
6210 /* | 6210 /* |
6211 * If we are changing state of "checked" base our setting on the passed flag... | 6211 * If we are changing state of "checked" base our setting on the passed flag... |
6254 } | 6254 } |
6255 WinSendMsg( menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE), MPFROM2SHORT( MIA_CHECKED|MIA_DISABLED, fAttribute ) ); | 6255 WinSendMsg( menux, MM_SETITEMATTR, MPFROM2SHORT(id, TRUE), MPFROM2SHORT( MIA_CHECKED|MIA_DISABLED, fAttribute ) ); |
6256 /* | 6256 /* |
6257 * Keep our internal checked state consistent | 6257 * Keep our internal checked state consistent |
6258 */ | 6258 */ |
6259 dw_window_set_data( hwndApp, buffer1, (void *)check ); | 6259 dw_window_set_data( _dw_app, buffer1, (void *)check ); |
6260 dw_window_set_data( hwndApp, buffer2, (void *)disabled ); | 6260 dw_window_set_data( _dw_app, buffer2, (void *)disabled ); |
6261 } | 6261 } |
6262 | 6262 |
6263 /* | 6263 /* |
6264 * Deletes the menu item specified | 6264 * Deletes the menu item specified |
6265 * Parameters: | 6265 * Parameters: |
6715 /* Internal function to create a disabled version of a pixmap */ | 6715 /* Internal function to create a disabled version of a pixmap */ |
6716 HPIXMAP _dw_create_disabled(HWND handle, HPIXMAP pixmap) | 6716 HPIXMAP _dw_create_disabled(HWND handle, HPIXMAP pixmap) |
6717 { | 6717 { |
6718 /* Create a disabled style pixmap */ | 6718 /* Create a disabled style pixmap */ |
6719 HPIXMAP disabled = dw_pixmap_new(handle, pixmap->width, pixmap->height, dw_color_depth_get()); | 6719 HPIXMAP disabled = dw_pixmap_new(handle, pixmap->width, pixmap->height, dw_color_depth_get()); |
6720 LONG fore = _foreground; | 6720 LONG fore = _dw_foreground; |
6721 int z, j, lim; | 6721 int z, j, lim; |
6722 | 6722 |
6723 dw_pixmap_bitblt(0, disabled, 0, 0, pixmap->width, pixmap->height, 0, pixmap, 0, 0); | 6723 dw_pixmap_bitblt(0, disabled, 0, 0, pixmap->width, pixmap->height, 0, pixmap, 0, 0); |
6724 | 6724 |
6725 dw_color_foreground_set(DW_CLR_PALEGRAY); | 6725 dw_color_dw_foreground_set(DW_CLR_PALEGRAY); |
6726 lim = pixmap->width/2; | 6726 lim = pixmap->width/2; |
6727 for(j=0;j<pixmap->height;j++) | 6727 for(j=0;j<pixmap->height;j++) |
6728 { | 6728 { |
6729 int mod = j%2; | 6729 int mod = j%2; |
6730 | 6730 |
6731 for(z=0;z<lim;z++) | 6731 for(z=0;z<lim;z++) |
6732 dw_draw_point(0, disabled, (z*2)+mod, j); | 6732 dw_draw_point(0, disabled, (z*2)+mod, j); |
6733 } | 6733 } |
6734 _foreground = fore; | 6734 _dw_foreground = fore; |
6735 return disabled; | 6735 return disabled; |
6736 } | 6736 } |
6737 | 6737 |
6738 /* | 6738 /* |
6739 * Create a new bitmap button window (widget) to be packed from a file. | 6739 * Create a new bitmap button window (widget) to be packed from a file. |
6789 else | 6789 else |
6790 { | 6790 { |
6791 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) | 6791 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) |
6792 { | 6792 { |
6793 strcpy(file, filename); | 6793 strcpy(file, filename); |
6794 strcat(file, image_exts[z]); | 6794 strcat(file, _dw_image_exts[z]); |
6795 if(access(file, 04) == 0 && | 6795 if(access(file, 04) == 0 && |
6796 _dw_load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) | 6796 _dw_load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) |
6797 break; | 6797 break; |
6798 } | 6798 } |
6799 } | 6799 } |
7111 HPOINTER hptr = icon < 65536 ? WinLoadPointer(HWND_DESKTOP,NULLHANDLE,icon) : (HPOINTER)icon; | 7111 HPOINTER hptr = icon < 65536 ? WinLoadPointer(HWND_DESKTOP,NULLHANDLE,icon) : (HPOINTER)icon; |
7112 WinSendMsg(handle, WM_SETICON, (MPARAM)hptr, 0); | 7112 WinSendMsg(handle, WM_SETICON, (MPARAM)hptr, 0); |
7113 } | 7113 } |
7114 | 7114 |
7115 /* Code from GBM to convert to 24bpp if it isn't currently */ | 7115 /* Code from GBM to convert to 24bpp if it isn't currently */ |
7116 static int _To24Bit(GBM *gbm, GBMRGB *gbmrgb, BYTE **ppbData) | 7116 static int _dw_to_24_bit(GBM *gbm, GBMRGB *gbmrgb, BYTE **ppbData) |
7117 { | 7117 { |
7118 unsigned long stride = (((unsigned long)gbm -> w * gbm -> bpp + 31)/32) * 4; | 7118 unsigned long stride = (((unsigned long)gbm -> w * gbm -> bpp + 31)/32) * 4; |
7119 unsigned long new_stride = (((unsigned long)gbm -> w * 3 + 3) & ~3); | 7119 unsigned long new_stride = (((unsigned long)gbm -> w * 3 + 3) & ~3); |
7120 unsigned long bytes; | 7120 unsigned long bytes; |
7121 int y; | 7121 int y; |
7314 | 7314 |
7315 /* Close the file */ | 7315 /* Close the file */ |
7316 _gbm_io_close(fd); | 7316 _gbm_io_close(fd); |
7317 | 7317 |
7318 /* Convert to 24bpp for use in the application */ | 7318 /* Convert to 24bpp for use in the application */ |
7319 if(_To24Bit(&gbm, gbmrgb, &BitmapFileBegin)) | 7319 if(_dw_to_24_bit(&gbm, gbmrgb, &BitmapFileBegin)) |
7320 *depth = 24; | 7320 *depth = 24; |
7321 else | 7321 else |
7322 { | 7322 { |
7323 #ifdef DEBUG | 7323 #ifdef DEBUG |
7324 dw_debug("GBM: Failed 24bpp conversion \"%s\"\n", file); | 7324 dw_debug("GBM: Failed 24bpp conversion \"%s\"\n", file); |
7552 | 7552 |
7553 /* Try with supported extensions */ | 7553 /* Try with supported extensions */ |
7554 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) | 7554 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) |
7555 { | 7555 { |
7556 strcpy(file, filename); | 7556 strcpy(file, filename); |
7557 strcat(file, image_exts[z]); | 7557 strcat(file, _dw_image_exts[z]); |
7558 if(access(file, 04) == 0 && | 7558 if(access(file, 04) == 0 && |
7559 _dw_load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height, &depth, DW_CLR_DEFAULT)) | 7559 _dw_load_bitmap_file(file, handle, &hbm, &hdc, &hps, &width, &height, &depth, DW_CLR_DEFAULT)) |
7560 break; | 7560 break; |
7561 } | 7561 } |
7562 } | 7562 } |
7744 { | 7744 { |
7745 char buffer[30]; | 7745 char buffer[30]; |
7746 HMENUI mymenu; | 7746 HMENUI mymenu; |
7747 | 7747 |
7748 sprintf(buffer, "_dw_id%ld", handle); | 7748 sprintf(buffer, "_dw_id%ld", handle); |
7749 mymenu = (HMENUI)dw_window_get_data(hwndApp, buffer); | 7749 mymenu = (HMENUI)dw_window_get_data(_dw_app, buffer); |
7750 | 7750 |
7751 if(mymenu && WinIsWindow(dwhab, mymenu)) | 7751 if(mymenu && WinIsWindow(dwhab, mymenu)) |
7752 dw_menu_item_set_state(mymenu, handle, DW_MIS_DISABLED); | 7752 dw_menu_item_set_state(mymenu, handle, DW_MIS_DISABLED); |
7753 return; | 7753 return; |
7754 } | 7754 } |
7809 { | 7809 { |
7810 char buffer[30]; | 7810 char buffer[30]; |
7811 HMENUI mymenu; | 7811 HMENUI mymenu; |
7812 | 7812 |
7813 sprintf(buffer, "_dw_id%ld", handle); | 7813 sprintf(buffer, "_dw_id%ld", handle); |
7814 mymenu = (HMENUI)dw_window_get_data(hwndApp, buffer); | 7814 mymenu = (HMENUI)dw_window_get_data(_dw_app, buffer); |
7815 | 7815 |
7816 if(mymenu && WinIsWindow(dwhab, mymenu)) | 7816 if(mymenu && WinIsWindow(dwhab, mymenu)) |
7817 dw_menu_item_set_state(mymenu, handle, DW_MIS_ENABLED); | 7817 dw_menu_item_set_state(mymenu, handle, DW_MIS_ENABLED); |
7818 return; | 7818 return; |
7819 } | 7819 } |
7979 */ | 7979 */ |
7980 int API dw_box_unpack(HWND handle) | 7980 int API dw_box_unpack(HWND handle) |
7981 { | 7981 { |
7982 HWND parent = WinQueryWindow(handle, QW_PARENT); | 7982 HWND parent = WinQueryWindow(handle, QW_PARENT); |
7983 | 7983 |
7984 if(parent != desktop) | 7984 if(parent != _dw_desktop) |
7985 { | 7985 { |
7986 Box *thisbox = WinQueryWindowPtr(parent, QWP_USER); | 7986 Box *thisbox = WinQueryWindowPtr(parent, QWP_USER); |
7987 | 7987 |
7988 /* If the parent box has items... | 7988 /* If the parent box has items... |
7989 * try to remove it from the layout | 7989 * try to remove it from the layout |
8407 { | 8407 { |
8408 char buffer[30]; | 8408 char buffer[30]; |
8409 HMENUI mymenu; | 8409 HMENUI mymenu; |
8410 | 8410 |
8411 sprintf(buffer, "_dw_id%ld", handle); | 8411 sprintf(buffer, "_dw_id%ld", handle); |
8412 mymenu = (HMENUI)dw_window_get_data(hwndApp, buffer); | 8412 mymenu = (HMENUI)dw_window_get_data(_dw_app, buffer); |
8413 | 8413 |
8414 if(mymenu && WinIsWindow(dwhab, mymenu)) | 8414 if(mymenu && WinIsWindow(dwhab, mymenu)) |
8415 dw_menu_item_set_state(mymenu, handle, style & mask); | 8415 dw_menu_item_set_state(mymenu, handle, style & mask); |
8416 } | 8416 } |
8417 else | 8417 else |
9299 if(pCore->flRecordAttr & CRA_SELECTED) | 9299 if(pCore->flRecordAttr & CRA_SELECTED) |
9300 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)pCore, MPFROM2SHORT(FALSE, CRA_SELECTED | CRA_CURSORED)); | 9300 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)pCore, MPFROM2SHORT(FALSE, CRA_SELECTED | CRA_CURSORED)); |
9301 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); | 9301 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)pCore, MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); |
9302 } | 9302 } |
9303 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)item, MPFROM2SHORT(TRUE, CRA_SELECTED | CRA_CURSORED)); | 9303 WinSendMsg(handle, CM_SETRECORDEMPHASIS, (MPARAM)item, MPFROM2SHORT(TRUE, CRA_SELECTED | CRA_CURSORED)); |
9304 lastitem = 0; | 9304 _dw_lastitem = 0; |
9305 lasthcnr = 0; | 9305 _dw_lasthcnr = 0; |
9306 } | 9306 } |
9307 | 9307 |
9308 /* | 9308 /* |
9309 * Removes all nodes from a tree. | 9309 * Removes all nodes from a tree. |
9310 * Parameters: | 9310 * Parameters: |
9551 #endif | 9551 #endif |
9552 | 9552 |
9553 /* Internal function to create an icon from an existing pixmap */ | 9553 /* Internal function to create an icon from an existing pixmap */ |
9554 HICN _dw_create_icon(HPIXMAP src, unsigned long backrgb) | 9554 HICN _dw_create_icon(HPIXMAP src, unsigned long backrgb) |
9555 { | 9555 { |
9556 HPIXMAP pntr = dw_pixmap_new(hwndApp, WinQuerySysValue(HWND_DESKTOP, SV_CXICON), WinQuerySysValue(HWND_DESKTOP, SV_CYICON), src->depth); | 9556 HPIXMAP pntr = dw_pixmap_new(_dw_app, WinQuerySysValue(HWND_DESKTOP, SV_CXICON), WinQuerySysValue(HWND_DESKTOP, SV_CYICON), src->depth); |
9557 HPIXMAP mask = dw_pixmap_new(hwndApp, pntr->width, pntr->height*2, 1); | 9557 HPIXMAP mask = dw_pixmap_new(_dw_app, pntr->width, pntr->height*2, 1); |
9558 HPIXMAP minipntr = dw_pixmap_new(hwndApp, pntr->width/2, pntr->height/2, src->depth); | 9558 HPIXMAP minipntr = dw_pixmap_new(_dw_app, pntr->width/2, pntr->height/2, src->depth); |
9559 HPIXMAP minimask = dw_pixmap_new(hwndApp, minipntr->width, minipntr->height*2, 1); | 9559 HPIXMAP minimask = dw_pixmap_new(_dw_app, minipntr->width, minipntr->height*2, 1); |
9560 ULONG oldcol = _foreground; | 9560 ULONG oldcol = _dw_foreground; |
9561 POINTERINFO pi = {0}; | 9561 POINTERINFO pi = {0}; |
9562 | 9562 |
9563 /* Create the color pointers, stretching it to the necessary size */ | 9563 /* Create the color pointers, stretching it to the necessary size */ |
9564 dw_pixmap_stretch_bitblt(0, pntr, 0, 0, pntr->width, pntr->height, 0, src, 0, 0, src->width, src->height); | 9564 dw_pixmap_stretch_bitblt(0, pntr, 0, 0, pntr->width, pntr->height, 0, src, 0, 0, src->width, src->height); |
9565 dw_pixmap_stretch_bitblt(0, minipntr, 0, 0, minipntr->width, minipntr->height, 0, src, 0, 0, src->width, src->height); | 9565 dw_pixmap_stretch_bitblt(0, minipntr, 0, 0, minipntr->width, minipntr->height, 0, src, 0, 0, src->width, src->height); |
9566 | 9566 |
9567 /* Create the masks, all in black */ | 9567 /* Create the masks, all in black */ |
9568 dw_color_foreground_set(DW_CLR_BLACK); | 9568 dw_color_dw_foreground_set(DW_CLR_BLACK); |
9569 dw_draw_rect(0, mask, DW_DRAW_FILL, 0, 0, mask->width, mask->height); | 9569 dw_draw_rect(0, mask, DW_DRAW_FILL, 0, 0, mask->width, mask->height); |
9570 dw_draw_rect(0, minimask, DW_DRAW_FILL, 0, 0, minimask->width, minimask->height); | 9570 dw_draw_rect(0, minimask, DW_DRAW_FILL, 0, 0, minimask->width, minimask->height); |
9571 #if 0 | 9571 #if 0 |
9572 /* If we have a background color... create masks */ | 9572 /* If we have a background color... create masks */ |
9573 if(backrgb & DW_RGB_COLOR) | 9573 if(backrgb & DW_RGB_COLOR) |
9574 { | 9574 { |
9575 _dw_create_mask(pntr, mask, backrgb); | 9575 _dw_create_mask(pntr, mask, backrgb); |
9576 _dw_create_mask(minipntr, minimask, backrgb); | 9576 _dw_create_mask(minipntr, minimask, backrgb); |
9577 } | 9577 } |
9578 #endif | 9578 #endif |
9579 _foreground = oldcol; | 9579 _dw_foreground = oldcol; |
9580 | 9580 |
9581 /* Assemble the Pointer Info structure */ | 9581 /* Assemble the Pointer Info structure */ |
9582 pi.hbmPointer = mask->hbm; | 9582 pi.hbmPointer = mask->hbm; |
9583 pi.hbmColor = pntr->hbm; | 9583 pi.hbmColor = pntr->hbm; |
9584 pi.hbmMiniPointer = minimask->hbm; | 9584 pi.hbmMiniPointer = minimask->hbm; |
9626 | 9626 |
9627 /* Try with supported extensions */ | 9627 /* Try with supported extensions */ |
9628 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) | 9628 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) |
9629 { | 9629 { |
9630 strcpy(file, filename); | 9630 strcpy(file, filename); |
9631 strcat(file, image_exts[z]); | 9631 strcat(file, _dw_image_exts[z]); |
9632 if(access(file, 04) == 0 && | 9632 if(access(file, 04) == 0 && |
9633 _dw_load_bitmap_file(file, hwndApp, &src->hbm, &src->hdc, &src->hps, &src->width, &src->height, &src->depth, defcol)) | 9633 _dw_load_bitmap_file(file, _dw_app, &src->hbm, &src->hdc, &src->hps, &src->width, &src->height, &src->depth, defcol)) |
9634 { | 9634 { |
9635 icon = _dw_create_icon(src, defcol); | 9635 icon = _dw_create_icon(src, defcol); |
9636 break; | 9636 break; |
9637 } | 9637 } |
9638 } | 9638 } |
9639 } | 9639 } |
9640 else if(_dw_load_bitmap_file(file, hwndApp, &src->hbm, &src->hdc, &src->hps, &src->width, &src->height, &src->depth, defcol)) | 9640 else if(_dw_load_bitmap_file(file, _dw_app, &src->hbm, &src->hdc, &src->hps, &src->width, &src->height, &src->depth, defcol)) |
9641 icon = _dw_create_icon(src, defcol); | 9641 icon = _dw_create_icon(src, defcol); |
9642 /* Free temporary resources if in use */ | 9642 /* Free temporary resources if in use */ |
9643 if(icon) | 9643 if(icon) |
9644 { | 9644 { |
9645 GpiSetBitmap(src->hps, NULLHANDLE); | 9645 GpiSetBitmap(src->hps, NULLHANDLE); |
10239 void API dw_container_clear(HWND handle, int redraw) | 10239 void API dw_container_clear(HWND handle, int redraw) |
10240 { | 10240 { |
10241 PCNRITEM pCore; | 10241 PCNRITEM pCore; |
10242 int container = (int)dw_window_get_data(handle, "_dw_container"); | 10242 int container = (int)dw_window_get_data(handle, "_dw_container"); |
10243 | 10243 |
10244 if(hwndEmph == handle) | 10244 if(_dw_emph == handle) |
10245 _dw_clear_emphasis(); | 10245 _dw_clear_emphasis(); |
10246 | 10246 |
10247 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); | 10247 pCore = WinSendMsg(handle, CM_QUERYRECORD, (MPARAM)0L, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); |
10248 | 10248 |
10249 while(pCore) | 10249 while(pCore) |
10564 * bubbletext: Text to show when the mouse is above the icon. | 10564 * bubbletext: Text to show when the mouse is above the icon. |
10565 */ | 10565 */ |
10566 void API dw_taskbar_insert(HWND handle, HICN icon, const char *bubbletext) | 10566 void API dw_taskbar_insert(HWND handle, HICN icon, const char *bubbletext) |
10567 { | 10567 { |
10568 /* Make sure we have our server */ | 10568 /* Make sure we have our server */ |
10569 if(!hwndTrayServer) | 10569 if(!_dw_tray) |
10570 return; | 10570 return; |
10571 | 10571 |
10572 WinSendMsg(hwndApp, WM_SETICON, (MPARAM)icon, 0); | 10572 WinSendMsg(_dw_app, WM_SETICON, (MPARAM)icon, 0); |
10573 hwndTaskBar = handle; | 10573 _dw_task_bar = handle; |
10574 WinPostMsg(hwndTrayServer, WM_USER+1, (MPARAM)hwndApp, (MPARAM)icon); | 10574 WinPostMsg(_dw_tray, WM_USER+1, (MPARAM)_dw_app, (MPARAM)icon); |
10575 } | 10575 } |
10576 | 10576 |
10577 /* | 10577 /* |
10578 * Deletes an icon from the taskbar. | 10578 * Deletes an icon from the taskbar. |
10579 * Parameters: | 10579 * Parameters: |
10581 * icon: Icon handle that was used with dw_taskbar_insert(). | 10581 * icon: Icon handle that was used with dw_taskbar_insert(). |
10582 */ | 10582 */ |
10583 void API dw_taskbar_delete(HWND handle, HICN icon) | 10583 void API dw_taskbar_delete(HWND handle, HICN icon) |
10584 { | 10584 { |
10585 /* Make sure we have our server */ | 10585 /* Make sure we have our server */ |
10586 if(!hwndTrayServer) | 10586 if(!_dw_tray) |
10587 return; | 10587 return; |
10588 | 10588 |
10589 WinPostMsg(hwndTrayServer, WM_USER+2, (MPARAM)hwndApp, (MPARAM)0); | 10589 WinPostMsg(_dw_tray, WM_USER+2, (MPARAM)_dw_app, (MPARAM)0); |
10590 hwndTaskBar = NULLHANDLE; | 10590 _dw_task_bar = NULLHANDLE; |
10591 } | 10591 } |
10592 | 10592 |
10593 /* | 10593 /* |
10594 * Creates a rendering context widget (window) to be packed. | 10594 * Creates a rendering context widget (window) to be packed. |
10595 * Parameters: | 10595 * Parameters: |
10619 * Parameters: | 10619 * Parameters: |
10620 * red: red value. | 10620 * red: red value. |
10621 * green: green value. | 10621 * green: green value. |
10622 * blue: blue value. | 10622 * blue: blue value. |
10623 */ | 10623 */ |
10624 void API dw_color_foreground_set(unsigned long value) | 10624 void API dw_color_dw_foreground_set(unsigned long value) |
10625 { | 10625 { |
10626 _foreground = value; | 10626 _dw_foreground = value; |
10627 } | 10627 } |
10628 | 10628 |
10629 /* Sets the current background drawing color. | 10629 /* Sets the current background drawing color. |
10630 * Parameters: | 10630 * Parameters: |
10631 * red: red value. | 10631 * red: red value. |
10632 * green: green value. | 10632 * green: green value. |
10633 * blue: blue value. | 10633 * blue: blue value. |
10634 */ | 10634 */ |
10635 void API dw_color_background_set(unsigned long value) | 10635 void API dw_color_dw_background_set(unsigned long value) |
10636 { | 10636 { |
10637 _background = value; | 10637 _dw_background = value; |
10638 } | 10638 } |
10639 | 10639 |
10640 int DWSIGNAL _dw_color_cancel_func(HWND window, void *data) | 10640 int DWSIGNAL _dw_color_cancel_func(HWND window, void *data) |
10641 { | 10641 { |
10642 DWDialog *dwwait = (DWDialog *)data; | 10642 DWDialog *dwwait = (DWDialog *)data; |
10765 | 10765 |
10766 HPS _dw_set_hps(HPS hps) | 10766 HPS _dw_set_hps(HPS hps) |
10767 { | 10767 { |
10768 LONG alTable[2]; | 10768 LONG alTable[2]; |
10769 | 10769 |
10770 alTable[0] = DW_RED_VALUE(_foreground) << 16 | DW_GREEN_VALUE(_foreground) << 8 | DW_BLUE_VALUE(_foreground); | 10770 alTable[0] = DW_RED_VALUE(_dw_foreground) << 16 | DW_GREEN_VALUE(_dw_foreground) << 8 | DW_BLUE_VALUE(_dw_foreground); |
10771 alTable[1] = DW_RED_VALUE(_background) << 16 | DW_GREEN_VALUE(_background) << 8 | DW_BLUE_VALUE(_background); | 10771 alTable[1] = DW_RED_VALUE(_dw_background) << 16 | DW_GREEN_VALUE(_dw_background) << 8 | DW_BLUE_VALUE(_dw_background); |
10772 | 10772 |
10773 GpiCreateLogColorTable(hps, | 10773 GpiCreateLogColorTable(hps, |
10774 LCOL_RESET, | 10774 LCOL_RESET, |
10775 LCOLF_CONSECRGB, | 10775 LCOLF_CONSECRGB, |
10776 16, | 10776 16, |
10777 2, | 10777 2, |
10778 alTable); | 10778 alTable); |
10779 if(_foreground & DW_RGB_COLOR) | 10779 if(_dw_foreground & DW_RGB_COLOR) |
10780 GpiSetColor(hps, 16); | 10780 GpiSetColor(hps, 16); |
10781 else | 10781 else |
10782 GpiSetColor(hps, _dw_internal_color(_foreground)); | 10782 GpiSetColor(hps, _dw_internal_color(_dw_foreground)); |
10783 if(_background & DW_RGB_COLOR) | 10783 if(_dw_background & DW_RGB_COLOR) |
10784 GpiSetBackColor(hps, 17); | 10784 GpiSetBackColor(hps, 17); |
10785 else | 10785 else |
10786 GpiSetBackColor(hps, _dw_internal_color(_background)); | 10786 GpiSetBackColor(hps, _dw_internal_color(_dw_background)); |
10787 return hps; | 10787 return hps; |
10788 } | 10788 } |
10789 | 10789 |
10790 HPS _set_colors(HWND handle) | 10790 HPS _dw_set_colors(HWND handle) |
10791 { | 10791 { |
10792 HPS hps = WinGetPS(handle); | 10792 HPS hps = WinGetPS(handle); |
10793 | 10793 |
10794 _dw_set_hps(hps); | 10794 _dw_set_hps(hps); |
10795 return hps; | 10795 return hps; |
10808 int height; | 10808 int height; |
10809 POINTL ptl; | 10809 POINTL ptl; |
10810 | 10810 |
10811 if(handle) | 10811 if(handle) |
10812 { | 10812 { |
10813 hps = _set_colors(handle); | 10813 hps = _dw_set_colors(handle); |
10814 height = _dw_get_height(handle); | 10814 height = _dw_get_height(handle); |
10815 } | 10815 } |
10816 else if(pixmap) | 10816 else if(pixmap) |
10817 { | 10817 { |
10818 hps = _dw_set_hps(pixmap->hps); | 10818 hps = _dw_set_hps(pixmap->hps); |
10844 int height; | 10844 int height; |
10845 POINTL ptl[2]; | 10845 POINTL ptl[2]; |
10846 | 10846 |
10847 if(handle) | 10847 if(handle) |
10848 { | 10848 { |
10849 hps = _set_colors(handle); | 10849 hps = _dw_set_colors(handle); |
10850 height = _dw_get_height(handle); | 10850 height = _dw_get_height(handle); |
10851 } | 10851 } |
10852 else if(pixmap) | 10852 else if(pixmap) |
10853 { | 10853 { |
10854 hps = _dw_set_hps(pixmap->hps); | 10854 hps = _dw_set_hps(pixmap->hps); |
10911 char fontname[128]; | 10911 char fontname[128]; |
10912 POINTL aptl[TXTBOX_COUNT]; | 10912 POINTL aptl[TXTBOX_COUNT]; |
10913 | 10913 |
10914 if(handle) | 10914 if(handle) |
10915 { | 10915 { |
10916 hps = _set_colors(handle); | 10916 hps = _dw_set_colors(handle); |
10917 height = _dw_get_height(handle); | 10917 height = _dw_get_height(handle); |
10918 _dw_get_pp_font(handle, fontname); | 10918 _dw_get_pp_font(handle, fontname); |
10919 } | 10919 } |
10920 else if(pixmap) | 10920 else if(pixmap) |
10921 { | 10921 { |
10941 rcl.xLeft = x; | 10941 rcl.xLeft = x; |
10942 rcl.yTop = height - y; | 10942 rcl.yTop = height - y; |
10943 rcl.yBottom = rcl.yTop - (aptl[TXTBOX_TOPLEFT].y - aptl[TXTBOX_BOTTOMLEFT].y); | 10943 rcl.yBottom = rcl.yTop - (aptl[TXTBOX_TOPLEFT].y - aptl[TXTBOX_BOTTOMLEFT].y); |
10944 rcl.xRight = rcl.xLeft + (aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x); | 10944 rcl.xRight = rcl.xLeft + (aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x); |
10945 | 10945 |
10946 if(_background == DW_CLR_DEFAULT) | 10946 if(_dw_background == DW_CLR_DEFAULT) |
10947 WinDrawText(hps, -1, (PCH)text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); | 10947 WinDrawText(hps, -1, (PCH)text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); |
10948 else | 10948 else |
10949 WinDrawText(hps, -1, (PCH)text, &rcl, _dw_internal_color(_foreground), _dw_internal_color(_background), DT_VCENTER | DT_LEFT | DT_ERASERECT); | 10949 WinDrawText(hps, -1, (PCH)text, &rcl, _dw_internal_color(_dw_foreground), _dw_internal_color(_dw_background), DT_VCENTER | DT_LEFT | DT_ERASERECT); |
10950 | 10950 |
10951 if(handle) | 10951 if(handle) |
10952 WinReleasePS(hps); | 10952 WinReleasePS(hps); |
10953 } | 10953 } |
10954 | 10954 |
10965 HPS hps; | 10965 HPS hps; |
10966 POINTL aptl[TXTBOX_COUNT]; | 10966 POINTL aptl[TXTBOX_COUNT]; |
10967 | 10967 |
10968 if(handle) | 10968 if(handle) |
10969 { | 10969 { |
10970 hps = _set_colors(handle); | 10970 hps = _dw_set_colors(handle); |
10971 } | 10971 } |
10972 else if(pixmap) | 10972 else if(pixmap) |
10973 { | 10973 { |
10974 HPS pixmaphps = WinGetPS(pixmap->font ? pixmap->font : pixmap->handle); | 10974 HPS pixmaphps = WinGetPS(pixmap->font ? pixmap->font : pixmap->handle); |
10975 | 10975 |
11010 POINTL start; | 11010 POINTL start; |
11011 int i; | 11011 int i; |
11012 | 11012 |
11013 if(handle) | 11013 if(handle) |
11014 { | 11014 { |
11015 hps = _set_colors(handle); | 11015 hps = _dw_set_colors(handle); |
11016 thisheight = _dw_get_height(handle); | 11016 thisheight = _dw_get_height(handle); |
11017 } | 11017 } |
11018 else if(pixmap) | 11018 else if(pixmap) |
11019 { | 11019 { |
11020 hps = _dw_set_hps(pixmap->hps); | 11020 hps = _dw_set_hps(pixmap->hps); |
11074 int thisheight; | 11074 int thisheight; |
11075 POINTL ptl[2]; | 11075 POINTL ptl[2]; |
11076 | 11076 |
11077 if(handle) | 11077 if(handle) |
11078 { | 11078 { |
11079 hps = _set_colors(handle); | 11079 hps = _dw_set_colors(handle); |
11080 thisheight = _dw_get_height(handle); | 11080 thisheight = _dw_get_height(handle); |
11081 } | 11081 } |
11082 else if(pixmap) | 11082 else if(pixmap) |
11083 { | 11083 { |
11084 hps = _dw_set_hps(pixmap->hps); | 11084 hps = _dw_set_hps(pixmap->hps); |
11125 POINTL pts[2]; | 11125 POINTL pts[2]; |
11126 double r, a1, a2, a; | 11126 double r, a1, a2, a; |
11127 | 11127 |
11128 if(handle) | 11128 if(handle) |
11129 { | 11129 { |
11130 hps = _set_colors(handle); | 11130 hps = _dw_set_colors(handle); |
11131 thisheight = _dw_get_height(handle); | 11131 thisheight = _dw_get_height(handle); |
11132 } | 11132 } |
11133 else if(pixmap) | 11133 else if(pixmap) |
11134 { | 11134 { |
11135 hps = _dw_set_hps(pixmap->hps); | 11135 hps = _dw_set_hps(pixmap->hps); |
11281 | 11281 |
11282 /* Try with supported extensions */ | 11282 /* Try with supported extensions */ |
11283 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) | 11283 for(z=0;z<(_gbm_init?NUM_EXTS:1);z++) |
11284 { | 11284 { |
11285 strcpy(file, filename); | 11285 strcpy(file, filename); |
11286 strcat(file, image_exts[z]); | 11286 strcat(file, _dw_image_exts[z]); |
11287 if(access(file, 04) == 0 && | 11287 if(access(file, 04) == 0 && |
11288 _dw_load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) | 11288 _dw_load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) |
11289 break; | 11289 break; |
11290 } | 11290 } |
11291 } | 11291 } |
12073 * Cleanly terminates a DW session, should be signal handler safe. | 12073 * Cleanly terminates a DW session, should be signal handler safe. |
12074 */ | 12074 */ |
12075 void API dw_shutdown(void) | 12075 void API dw_shutdown(void) |
12076 { | 12076 { |
12077 /* Destroy the menu message window */ | 12077 /* Destroy the menu message window */ |
12078 dw_window_destroy(hwndApp); | 12078 dw_window_destroy(_dw_app); |
12079 | 12079 |
12080 /* In case we are in a signal handler, don't | 12080 /* In case we are in a signal handler, don't |
12081 * try to free memory that could possibly be | 12081 * try to free memory that could possibly be |
12082 * free()'d by the runtime already. | 12082 * free()'d by the runtime already. |
12083 */ | 12083 */ |
12100 /* Destroy the main message queue and anchor block */ | 12100 /* Destroy the main message queue and anchor block */ |
12101 WinDestroyMsgQueue(dwhmq); | 12101 WinDestroyMsgQueue(dwhmq); |
12102 WinTerminate(dwhab); | 12102 WinTerminate(dwhab); |
12103 | 12103 |
12104 /* Free any in use modules */ | 12104 /* Free any in use modules */ |
12105 DosFreeModule(wpconfig); | 12105 DosFreeModule(_dw_wpconfig); |
12106 DosFreeModule(pmprintf); | 12106 DosFreeModule(_dw_pmprintf); |
12107 DosFreeModule(pmmerge); | 12107 DosFreeModule(_dw_pmmerge); |
12108 DosFreeModule(gbm); | 12108 DosFreeModule(_dw_gbm); |
12109 } | 12109 } |
12110 | 12110 |
12111 /* | 12111 /* |
12112 * Cleanly terminates a DW session, should be signal handler safe. | 12112 * Cleanly terminates a DW session, should be signal handler safe. |
12113 * Parameters: | 12113 * Parameters: |
12472 | 12472 |
12473 Build = _dw_get_system_build_level(); | 12473 Build = _dw_get_system_build_level(); |
12474 env->MinorBuild = Build & 0xFFFF; | 12474 env->MinorBuild = Build & 0xFFFF; |
12475 env->MajorBuild = Build >> 16; | 12475 env->MajorBuild = Build >> 16; |
12476 | 12476 |
12477 if (aulBuffer[0] == 20) | 12477 if (_dw_ver_buf[0] == 20) |
12478 { | 12478 { |
12479 int i = (unsigned int)aulBuffer[1]; | 12479 int i = (unsigned int)_dw_ver_buf[1]; |
12480 if (i > 20) | 12480 if (i > 20) |
12481 { | 12481 { |
12482 strcpy(env->osName,"Warp"); | 12482 strcpy(env->osName,"Warp"); |
12483 env->MajorVersion = (int)i/10; | 12483 env->MajorVersion = (int)i/10; |
12484 env->MinorVersion = i-(((int)i/10)*10); | 12484 env->MinorVersion = i-(((int)i/10)*10); |
13549 * Parameters: | 13549 * Parameters: |
13550 * id: Timer ID returned by dw_timer_connect(). | 13550 * id: Timer ID returned by dw_timer_connect(). |
13551 */ | 13551 */ |
13552 void API dw_timer_disconnect(HTIMER id) | 13552 void API dw_timer_disconnect(HTIMER id) |
13553 { | 13553 { |
13554 SignalHandler *prev = NULL, *tmp = Root; | 13554 DWSignalHandler *prev = NULL, *tmp = Root; |
13555 | 13555 |
13556 /* 0 is an invalid timer ID */ | 13556 /* 0 is an invalid timer ID */ |
13557 if(!id) | 13557 if(!id) |
13558 return; | 13558 return; |
13559 | 13559 |
13619 { | 13619 { |
13620 char buffer[15]; | 13620 char buffer[15]; |
13621 HWND owner; | 13621 HWND owner; |
13622 | 13622 |
13623 sprintf(buffer, "_dw_id%d", (int)window); | 13623 sprintf(buffer, "_dw_id%d", (int)window); |
13624 owner = (HWND)dw_window_get_data(hwndApp, buffer); | 13624 owner = (HWND)dw_window_get_data(_dw_app, buffer); |
13625 | 13625 |
13626 /* Make sure there are no dupes from popups */ | 13626 /* Make sure there are no dupes from popups */ |
13627 dw_signal_disconnect_by_window(window); | 13627 dw_signal_disconnect_by_window(window); |
13628 | 13628 |
13629 if(owner) | 13629 if(owner) |
13642 * Parameters: | 13642 * Parameters: |
13643 * window: Window handle of callback to be removed. | 13643 * window: Window handle of callback to be removed. |
13644 */ | 13644 */ |
13645 void API dw_signal_disconnect_by_name(HWND window, const char *signame) | 13645 void API dw_signal_disconnect_by_name(HWND window, const char *signame) |
13646 { | 13646 { |
13647 SignalHandler *prev = NULL, *tmp = Root; | 13647 DWSignalHandler *prev = NULL, *tmp = Root; |
13648 ULONG message; | 13648 ULONG message; |
13649 | 13649 |
13650 if(!window || !signame || (message = _dw_findsigmessage(signame)) == 0) | 13650 if(!window || !signame || (message = _dw_findsigmessage(signame)) == 0) |
13651 return; | 13651 return; |
13652 | 13652 |
13687 * Parameters: | 13687 * Parameters: |
13688 * window: Window handle of callback to be removed. | 13688 * window: Window handle of callback to be removed. |
13689 */ | 13689 */ |
13690 void API dw_signal_disconnect_by_window(HWND window) | 13690 void API dw_signal_disconnect_by_window(HWND window) |
13691 { | 13691 { |
13692 SignalHandler *prev = NULL, *tmp = Root; | 13692 DWSignalHandler *prev = NULL, *tmp = Root; |
13693 | 13693 |
13694 while(tmp) | 13694 while(tmp) |
13695 { | 13695 { |
13696 if((window < 65536 && tmp->id == window) || tmp->window == window) | 13696 if((window < 65536 && tmp->id == window) || tmp->window == window) |
13697 { | 13697 { |
13729 * window: Window handle of callback to be removed. | 13729 * window: Window handle of callback to be removed. |
13730 * data: Pointer to the data to be compared against. | 13730 * data: Pointer to the data to be compared against. |
13731 */ | 13731 */ |
13732 void API dw_signal_disconnect_by_data(HWND window, void *data) | 13732 void API dw_signal_disconnect_by_data(HWND window, void *data) |
13733 { | 13733 { |
13734 SignalHandler *prev = NULL, *tmp = Root; | 13734 DWSignalHandler *prev = NULL, *tmp = Root; |
13735 | 13735 |
13736 while(tmp) | 13736 while(tmp) |
13737 { | 13737 { |
13738 if(((window < 65536 && tmp->id == window) || tmp->window == window) && tmp->data == data) | 13738 if(((window < 65536 && tmp->id == window) || tmp->window == window) && tmp->data == data) |
13739 { | 13739 { |
13892 case DW_FEATURE_TREE: | 13892 case DW_FEATURE_TREE: |
13893 case DW_FEATURE_WINDOW_PLACEMENT: | 13893 case DW_FEATURE_WINDOW_PLACEMENT: |
13894 return DW_FEATURE_ENABLED; | 13894 return DW_FEATURE_ENABLED; |
13895 case DW_FEATURE_TASK_BAR: | 13895 case DW_FEATURE_TASK_BAR: |
13896 { | 13896 { |
13897 if(hwndTrayServer) | 13897 if(_dw_tray) |
13898 return DW_FEATURE_ENABLED; | 13898 return DW_FEATURE_ENABLED; |
13899 return DW_FEATURE_UNSUPPORTED; | 13899 return DW_FEATURE_UNSUPPORTED; |
13900 } | 13900 } |
13901 default: | 13901 default: |
13902 return DW_FEATURE_UNSUPPORTED; | 13902 return DW_FEATURE_UNSUPPORTED; |
13931 case DW_FEATURE_TREE: | 13931 case DW_FEATURE_TREE: |
13932 case DW_FEATURE_WINDOW_PLACEMENT: | 13932 case DW_FEATURE_WINDOW_PLACEMENT: |
13933 return DW_ERROR_GENERAL; | 13933 return DW_ERROR_GENERAL; |
13934 case DW_FEATURE_TASK_BAR: | 13934 case DW_FEATURE_TASK_BAR: |
13935 { | 13935 { |
13936 if(hwndTrayServer) | 13936 if(_dw_tray) |
13937 return DW_ERROR_GENERAL; | 13937 return DW_ERROR_GENERAL; |
13938 return DW_FEATURE_UNSUPPORTED; | 13938 return DW_FEATURE_UNSUPPORTED; |
13939 } | 13939 } |
13940 /* These features are supported and configurable */ | 13940 /* These features are supported and configurable */ |
13941 default: | 13941 default: |