changeset 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 3e5bff3e55ff
children c6e76b796b28
files os2/dw.c
diffstat 1 files changed, 67 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/os2/dw.c	Thu Jul 19 01:09:24 2001 +0000
+++ b/os2/dw.c	Wed Jul 25 09:34:02 2001 +0000
@@ -41,6 +41,9 @@
 
 HWND hwndBubble = NULLHANDLE, hwndBubbleLast = NULLHANDLE;
 PRECORDCORE pCore = NULL;
+ULONG aulBuffer[4];
+
+#define IS_WARP4() (aulBuffer[0] == 20 && aulBuffer[1] >= 40)
 
 #ifndef min
 #define min(a, b) (((a < b) ? a : b))
@@ -1565,6 +1568,34 @@
 			}
 		}
 		break;
+	case WM_CONTROL:
+		switch(SHORT2FROMMP(mp1))
+		{
+		case BKN_PAGESELECTEDPENDING:
+			{
+				PAGESELECTNOTIFY *psn = (PAGESELECTNOTIFY *)mp2;
+				HWND pagehwnd = (HWND)WinSendMsg(psn->hwndBook, BKM_QUERYPAGEWINDOWHWND, MPFROMLONG(psn->ulPageIdNew), 0);
+				Box *pagebox = (Box *)WinQueryWindowPtr(pagehwnd, QWP_USER);
+				unsigned long x, y, width, height;
+				RECTL rc;
+
+				if(pagebox)
+				{
+					dw_window_get_pos_size(psn->hwndBook, &x, &y, &width, &height);
+
+					rc.xLeft = x;
+					rc.yBottom = y;
+					rc.xRight = x + width;
+					rc.yTop = y + height;
+
+					WinSendMsg(psn->hwndBook, BKM_CALCPAGERECT, (MPARAM)&rc, (MPARAM)TRUE);
+
+					_do_resize(pagebox, rc.xRight - rc.xLeft, rc.yTop - rc.yBottom);
+				}
+			}
+			break;
+		}
+		break;
 	case WM_CLOSE:
 		dw_window_destroy(WinQueryWindow(hWnd, QW_PARENT));
 		return (MRESULT)TRUE;
@@ -2129,6 +2160,9 @@
 	rc = WinRegisterClass(dwhab, ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32);
 	rc = WinRegisterClass(dwhab, SplitbarClassName, _splitwndproc, 0L, 32);
 
+	/* Get the OS/2 version. */
+	DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG));
+
 #ifdef DWDEBUG
 	f = fopen("dw.log", "wt");
 #endif
@@ -2632,6 +2666,13 @@
 						  NULL,
 						  NULL);
 
+	/* Fix tab sizes on Warp 3 */
+	if(!IS_WARP4())
+	{
+		/* best sizes to be determined by trial and error */
+		WinSendMsg(tmp, BKM_SETDIMENSIONS,MPFROM2SHORT(102, 28), MPFROMSHORT( BKA_MAJORTAB));
+	}
+
 	dw_window_set_font(tmp, DefaultFont);
 	return tmp;
 }
@@ -5397,16 +5438,11 @@
  */
 void dw_environment_query(DWEnv *env)
 {
-	ULONG aulBuffer[4];
 	ULONG Build;
 
 	if(!env)
 		return;
 
-	/* Get the OS/2 version. */
-
-	DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG));
-
 	/* The default is OS/2 2.0 */
 	strcpy(env->osName,"OS/2");
 	env->MajorVersion = 2;
@@ -5528,15 +5564,40 @@
 int dw_browse(char *url)
 {
 	/* Is there a way to find the webbrowser in Unix? */
-	char *execargs[3], browser[1024];
+	char *execargs[3], browser[1024], *newurl = NULL;
+	int len;
 
 	PrfQueryProfileString(HINI_USERPROFILE, "WPURLDEFAULTSETTINGS",
 						  "DefaultBrowserExe", NULL, browser, 1024);
 
+	len = strlen(browser) - strlen("explore.exe");
+
 	execargs[0] = browser;
 	execargs[1] = url;
 	execargs[2] = NULL;
 
+	/* Special case for Web Explorer, it requires file:/// instead
+	 * of file:// so I am handling it here.
+	 */
+	if(len > 0)
+	{
+		if(stricmp(&browser[len], "explore.exe") == 0)
+		{
+			int newlen, z;
+			newurl = alloca(strlen(url) + 2);
+			sprintf(newurl, "file:///%s", &url[7]);
+			newlen = strlen(newurl);
+			for(z=8;z<(newlen-8);z++)
+			{
+				if(newurl[z] == '|')
+					newurl[z] = ':';
+				if(newurl[z] == '/')
+					newurl[z] = '\\';
+			}
+			execargs[1] = newurl;
+		}
+	}
+
 	return dw_exec(browser, DW_EXEC_GUI, execargs);
 }