Re: [MacPerl-Porters] MacPerl 5.6.1r1 soon

[email protected] (Thomas Wegner) Mon, 18 Feb 2002 20:06:02 +0100
Newsgroups perl.macperl.porters
Message-ID <p04320400b8969d03af16@[149.225.10.211]>
At 17:48 Uhr -0500 17.02.2002, Chris Nandor wrote:
>I plan on releasing MacPerl 5.6.1r1, after years of wait, in the next week
>or so.  If you have any comments/questions/problems/bugs that have not yet
>been addressed, please address them now.
>

Yes, I have :).

(1) MacPerl app: MPPreferences.c

The Format and Preferences dialogs have some subtle (display) bugs:

(a) Scrolling doesn't work in the lib path list and the environment variable list.
(b) After deleting a list item in the lib path list or the environment variable list, the list doesn't get redrawn correctly, when the list has to be scrolled due to that deletion. To reproduce, try a list that contains one item more than can be displayed, scroll the last item into view (when (a) is fixed :-) and then delete the last item.
(c) Open the Format dialog when there's no other window open. Notice that the font names are vertically centered in the selection rectangle when highlighted. Now, open a window and open the Format dialog again. You'll notice, that the selected font name is no longer vertically centered, it's either displayed at the top of the selection rectangle or at the bottom. The same holds true for the other lists in the Format and Preferences dialogs. This happens, because the current port isn't set to the dialog ports.


diff -ru MPPreferences.c.orig MPPreferences.c
--- MPPreferences.c.orig	Sun Feb 17 14:21:21 2002
+++ MPPreferences.c	Mon Feb 18 19:37:27 2002
@@ -421,6 +421,9 @@
 		cell = ev->where;
 		GlobalToLocal(&cell);
 		GetDialogItem(dlg, pld_List, &kind, &h, &r);
+		// add scroll bar width to list rectangle
+		r.right = r.right + 15;
+		
 		if (PtInRect(cell, &r)) {
 			if (LClick(cell, ev->modifiers, PathList))
 				for (SetPt(&cell, 0, 0); LGetSelect(true, &cell, PathList); ++cell.v) {
@@ -531,13 +534,15 @@
 		case pld_Remove:
 			SetPt(&cell, 0, 0);
 			
-			if (LGetSelect(true, &cell, PathList) && AppAlert(PrefLibDelID) == 1)
+			if (LGetSelect(true, &cell, PathList) && AppAlert(PrefLibDelID) == 1) {
+				// make sure the list gets redrawn correctly
+				InvalRect(&((**PathList).rView));
 				do {
 					LDelRow(1, cell.v, PathList);
 						
 					--PathCount;
 				} while (LGetSelect(true, &cell, PathList));
-				
+			}	
 			break;
 		case pld_Add:
 			GetIndString(msg, PrefDialog, pd_AddPath);
@@ -616,8 +621,12 @@
 	Str255		contents;
 	Str63			msg;
 	char 			data[256];
+	GrafPtr		savePort;
+	
+	GetPort(&savePort);
 	
 	envEdit = GetNewAppDialog(PrefEnvAddID);
+	SetPort(envEdit);
 	
 	equals = PLstrchr(env, '=');
 	*equals= *env - (equals - (Ptr) env);
@@ -693,7 +702,8 @@
 	}
 		
 	DisposeDialog(envEdit);
-	
+	SetPort(savePort);
+
 	return result;
 }
 
@@ -736,6 +746,9 @@
 		cell = ev->where;
 		GlobalToLocal(&cell);
 		GetDialogItem(dlg, pld_List, &kind, &h, &r);
+		// add scroll bar width to list rectangle
+		r.right = r.right + 15;
+		
 		if (PtInRect(cell, &r)) {
 			if (LClick(cell, ev->modifiers, PathList))
 				for (SetPt(&cell, 0, 0); LGetSelect(true, &cell, PathList); ++cell.v) {
@@ -827,13 +840,15 @@
 		case ped_Remove:
 			SetPt(&cell, 0, 0);
 			
-			if (LGetSelect(true, &cell, PathList) && AppAlert(PrefEnvDelID) == 1)
+			if (LGetSelect(true, &cell, PathList) && AppAlert(PrefEnvDelID) == 1) {
+				// make sure the list gets redrawn correctly
+				InvalRect(&((**PathList).rView));
 				do {
 					LDelRow(1, cell.v, PathList);
 						
 					--PathCount;
 				} while (LGetSelect(true, &cell, PathList));
-				
+			}	
 			break;
 		case ped_Add:
 			PLstrcpy(contents, "\p=");
@@ -1044,12 +1059,16 @@
 	Handle		h;
 	DialogPtr	prefs;
 	Rect			bounds;
+	GrafPtr		savePort;
+	
+	GetPort(&savePort);
 	
 	resFile		= CurResFile();
 	
 	OpenPreferences();
 
 	prefs = GetNewAppDialog(PrefDialog);
+	SetPort(prefs);
 
 	GetDialogItem(prefs, pd_LibIcon, &kind, &h, &bounds);
 	SetDialogItem(prefs, pd_LibIcon, kind, (Handle) &uDrawPrefIcon, &bounds);
@@ -1111,6 +1130,8 @@
 		DisposeHandle(gCachedLibraries);
 		gCachedLibraries = nil;
 	}
+	
+	SetPort(savePort);
 }
 
 static ListHandle FontList;
@@ -1306,8 +1327,12 @@
 	Rect			dbounds;
 	Str255		contents;
 	MenuHandle	fonts;
+	GrafPtr			savePort;
+	
+	GetPort(&savePort);
 	
 	format = GetNewAppDialog(FormatDialog);
+	SetPort(format);
 
 	GetDialogItem(format, fd_Separator, &kind, &h, &bounds);
 	SetDialogItem(format, fd_Separator, kind, (Handle) &uSeparator, &bounds);
@@ -1432,6 +1457,8 @@
 	LDispose(SizeList);
 	DisposeDialog(format);
 	DisposeMenu(fonts);
+	
+	SetPort(savePort);
 	
 	return (item == fd_OK);
 }



(2) MacPerl app: MPAppleEvents.c

I'm pretty sure the second HLock() was meant to be a HUnlock(), otherwise scrap never gets unlocked.

diff -ru  MPAppleEvents.c.orig MPAppleEvents.c
--- MPAppleEvents.c.orig	Sat Feb 16 21:16:35 2002
+++ MPAppleEvents.c	Mon Feb 18 19:48:20 2002
@@ -1790,7 +1790,7 @@
 		scrap = TEScrapHandle();
 		HLock(scrap);
 		theErr = AEStream_WriteDesc(&aes, typeChar, *scrap, GetHandleSize(scrap));
-		HLock(scrap);
+		HUnlock(scrap);
 		if (theErr || (theErr = AEStream_CloseList(&aes)))
 			goto abortClipboard;
 		theErr = AEStream_Close(&aes, dataDesc);




Best regards,

--Thomas



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com