Mercurial > dwindows
comparison os2/dw.c @ 20:38295c8d06d5
Added notebook, Warp 3 and WebExplorer fixes.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 25 Jul 2001 09:34:02 +0000 |
parents | f1002d51d959 |
children | c6e76b796b28 |
comparison
equal
deleted
inserted
replaced
19:3e5bff3e55ff | 20:38295c8d06d5 |
---|---|
39 DWTID _dwtid = 0; | 39 DWTID _dwtid = 0; |
40 LONG _foreground = 0xAAAAAA, _background = 0; | 40 LONG _foreground = 0xAAAAAA, _background = 0; |
41 | 41 |
42 HWND hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE; | 42 HWND hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE; |
43 PRECORDCORE pCore = NULL; | 43 PRECORDCORE pCore = NULL; |
44 ULONG aulBuffer[4]; | |
45 | |
46 #define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40) | |
44 | 47 |
45 #ifndef min | 48 #ifndef min |
46 #define min(a, b) (((a < b) ? a : b)) | 49 #define min(a, b) (((a < b) ? a : b)) |
47 #endif | 50 #endif |
48 | 51 |
1563 | 1566 |
1564 WinShowWindow(hWnd, TRUE); | 1567 WinShowWindow(hWnd, TRUE); |
1565 } | 1568 } |
1566 } | 1569 } |
1567 break; | 1570 break; |
1571 case WM_CONTROL: | |
1572 switch(SHORT2FROMMP(mp1)) | |
1573 { | |
1574 case BKN_PAGESELECTEDPENDING: | |
1575 { | |
1576 PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2; | |
1577 HWND pagehwnd = (HWND)WinSendMsg(psn->hwndBook, BKM_QUERYPAGEWINDOWHWND, MPFROMLONG(psn->ulPageIdNew), 0); | |
1578 Box *pagebox = (Box *)WinQueryWindowPtr(pagehwnd, QWP_USER); | |
1579 unsigned long x, y, width, height; | |
1580 RECTL rc; | |
1581 | |
1582 if(pagebox) | |
1583 { | |
1584 dw_window_get_pos_size(psn->hwndBook, &x, &y, &width, &height); | |
1585 | |
1586 rc.xLeft = x; | |
1587 rc.yBottom = y; | |
1588 rc.xRight = x + width; | |
1589 rc.yTop = y + height; | |
1590 | |
1591 WinSendMsg(psn->hwndBook, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE); | |
1592 | |
1593 _do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom); | |
1594 } | |
1595 } | |
1596 break; | |
1597 } | |
1598 break; | |
1568 case WM_CLOSE: | 1599 case WM_CLOSE: |
1569 dw_window_destroy(WinQueryWindow(hWnd, QW_PARENT)); | 1600 dw_window_destroy(WinQueryWindow(hWnd, QW_PARENT)); |
1570 return (MRESULT)TRUE; | 1601 return (MRESULT)TRUE; |
1571 case WM_USER: | 1602 case WM_USER: |
1572 windowfunc = (void (*)(void *))mp1; | 1603 windowfunc = (void (*)(void *))mp1; |
2127 } | 2158 } |
2128 | 2159 |
2129 rc = WinRegisterClass(dwhab, ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); | 2160 rc = WinRegisterClass(dwhab, ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); |
2130 rc = WinRegisterClass(dwhab, SplitbarClassName, _splitwndproc, 0L, 32); | 2161 rc = WinRegisterClass(dwhab, SplitbarClassName, _splitwndproc, 0L, 32); |
2131 | 2162 |
2163 /* Get the OS/2 version. */ | |
2164 DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG)); | |
2165 | |
2132 #ifdef DWDEBUG | 2166 #ifdef DWDEBUG |
2133 f = fopen("dw.log", "wt"); | 2167 f = fopen("dw.log", "wt"); |
2134 #endif | 2168 #endif |
2135 return rc; | 2169 return rc; |
2136 } | 2170 } |
2629 NULLHANDLE, | 2663 NULLHANDLE, |
2630 HWND_TOP, | 2664 HWND_TOP, |
2631 id, | 2665 id, |
2632 NULL, | 2666 NULL, |
2633 NULL); | 2667 NULL); |
2668 | |
2669 /* Fix tab sizes on Warp 3 */ | |
2670 if(!IS_WARP4()) | |
2671 { | |
2672 /* best sizes to be determined by trial and error */ | |
2673 WinSendMsg(tmp, BKM_SETDIMENSIONS,MPFROM2SHORT(102, 28), MPFROMSHORT( BKA_MAJORTAB)); | |
2674 } | |
2634 | 2675 |
2635 dw_window_set_font(tmp, DefaultFont); | 2676 dw_window_set_font(tmp, DefaultFont); |
2636 return tmp; | 2677 return tmp; |
2637 } | 2678 } |
2638 | 2679 |
5395 * Parameters: | 5436 * Parameters: |
5396 * env: Pointer to a DWEnv struct. | 5437 * env: Pointer to a DWEnv struct. |
5397 */ | 5438 */ |
5398 void dw_environment_query(DWEnv *env) | 5439 void dw_environment_query(DWEnv *env) |
5399 { | 5440 { |
5400 ULONG aulBuffer[4]; | |
5401 ULONG Build; | 5441 ULONG Build; |
5402 | 5442 |
5403 if(!env) | 5443 if(!env) |
5404 return; | 5444 return; |
5405 | |
5406 /* Get the OS/2 version. */ | |
5407 | |
5408 DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG)); | |
5409 | 5445 |
5410 /* The default is OS/2 2.0 */ | 5446 /* The default is OS/2 2.0 */ |
5411 strcpy(env->osName,"OS/2"); | 5447 strcpy(env->osName,"OS/2"); |
5412 env->MajorVersion = 2; | 5448 env->MajorVersion = 2; |
5413 env->MinorVersion = 0; | 5449 env->MinorVersion = 0; |
5526 * url: Uniform resource locator. | 5562 * url: Uniform resource locator. |
5527 */ | 5563 */ |
5528 int dw_browse(char *url) | 5564 int dw_browse(char *url) |
5529 { | 5565 { |
5530 /* Is there a way to find the webbrowser in Unix? */ | 5566 /* Is there a way to find the webbrowser in Unix? */ |
5531 char *execargs[3], browser[1024]; | 5567 char *execargs[3], browser[1024], *newurl = NULL; |
5568 int len; | |
5532 | 5569 |
5533 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", | 5570 PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS", |
5534 "DefaultBrowserExe", NULL, browser, 1024); | 5571 "DefaultBrowserExe", NULL, browser, 1024); |
5572 | |
5573 len = strlen(browser) - strlen("explore.exe"); | |
5535 | 5574 |
5536 execargs[0] = browser; | 5575 execargs[0] = browser; |
5537 execargs[1] = url; | 5576 execargs[1] = url; |
5538 execargs[2] = NULL; | 5577 execargs[2] = NULL; |
5578 | |
5579 /* Special case for Web Explorer, it requires file:/// instead | |
5580 * of file:// so I am handling it here. | |
5581 */ | |
5582 if(len > 0) | |
5583 { | |
5584 if(stricmp(&browser[len], "explore.exe") == 0) | |
5585 { | |
5586 int newlen, z; | |
5587 newurl = alloca(strlen(url) + 2); | |
5588 sprintf(newurl, "file:///%s", &url[7]); | |
5589 newlen = strlen(newurl); | |
5590 for(z=8;z<(newlen-8);z++) | |
5591 { | |
5592 if(newurl[z] == '|') | |
5593 newurl[z] = ':'; | |
5594 if(newurl[z] == '/') | |
5595 newurl[z] = '\\'; | |
5596 } | |
5597 execargs[1] = newurl; | |
5598 } | |
5599 } | |
5539 | 5600 |
5540 return dw_exec(browser, DW_EXEC_GUI, execargs); | 5601 return dw_exec(browser, DW_EXEC_GUI, execargs); |
5541 } | 5602 } |
5542 | 5603 |
5543 /* | 5604 /* |