Mantis - Squeak
Viewing Issue Advanced Details
3528 Morphic minor always 05-04-06 00:13 04-09-07 02:58
new 3.9  
0003528: TrashCan Icon has never indicated whether or not it contains trash.
This is a long term misbehavior.

for this one
in any squeak image (upto current one 7027)
set preferences to retain thrown out items in trash.
get an object. (say and ellipse)
get a trash can.
pick up the object..
bring it over the trash can. (trash icon will look different at least momentarily.)
drop it. (trash can will go back to its original appearance..)

On a mac. The static trash icon will have two different appearences.
One for when it is empty and one for when it is full.

In Squeak the static trash Icon looks empty regardless of full/empty status.

The only change is when something is "dragged" over it.

Technically it is constructed From a 3-phase button. So it should be possible to have and empty and full state as well as a roll-over pressed state.

First there needs to be one more icon definition. The full icon is IMO actually being used for the pressed state so what's needed really is the pressed state image or the open-for-disposals image.

Second a way to sense the full or empty state is needed.
And third a way to connect up all the trash can morph instances as dependents on the Utility that empties the can. (so they can note the change of state.)

There is another thing that would be nice which is to have a menu item for the trash can that would allow the trash to be emptied w/o having to double click to show the saved trash items first. The menu item seems to be available under the authoring tools menu. A way to do it from any trash can would be nice.
 FixTrashCan-dm.2.cs [^] (1,804 bytes) 05-13-06 03:47
 TrashCanEnh-wiz.2.cs [^] (3,750 bytes) 05-14-06 06:27
 TrashCanEnh-wiz.4.cs [^] (4,878 bytes) 05-14-06 07:47
 OpennedTrash.gif [^] (2,325 bytes) 05-30-06 02:08
 InitTrashPix-wiz.1.cs [^] (128,447 bytes) 06-05-06 04:47 [^] (855 bytes) 04-07-07 09:12

05-13-06 03:46   
Here's a patch.

It fixes the problem with the TrashCan icon not being updated properly.

It also adds a right click menu with an 'Empty Trash?' item.

I see that many strings are now marked for translation; I don't know how that works and that's not included in this patch.

This is my first patch to Squeak, please to gentle ;-)
05-14-06 06:27   
Hi Duncan,

Thanks for your attention to this issue.

I looked at your patch. I'd been stumpt by how one would get all the trash cans to update at the same time. Once I saw how you did it, it was obvious. And that was the missing piece.

To test your fix ( and see what's not quite working) try this

get two trash cans on the screen at the same time and try throwing things at them.

The predicate you used to test whether there was trash in scraps doesn't quite do the trick. See the uploaded routines in TrashCanEnh-wiz.2.cs

I added your ideas to stuff I had done earlier and got something that works close to how I envisioned it.

Now all we have to do is get Diego to come up with the right three icons.
05-14-06 06:55   
Ah, very nice.

When trying to browse the ChangeSet, I came across a weird bug:

Everytime I try to read the mouseLeave method, I'd get a pink window with an Array out of bounds error. It seems to stem from some replacement call inside CompiledMethod. I tried debugging it, but at that point, the image is practically not responsive at all.
05-14-06 07:55   
Uploaded TrashCanEnh-wiz.4.cs which adds a custom menu item to the red handle menu.

I tried a general yellow button menu but decided Duncan's simple pop up item was more elegant than the grand list of irrelevant items that come with a general menu approach.

So this is pretty much resolved as far as it needs to be.

There will be a visual improvement when there are appropriate forms for each of the three phases. That can be a separate fix. The important thing here is that the trash can behavior is now sensitive to whether or not the trash can is full.

Thanks Duncan. Part of the importance of your fix was your interest. These fixes are a lot less fun to work on if no one else cares about them.

Cheers and joy -- Jer.
05-14-06 08:06   
Hi Duncan
 I didn't expect you to read my comments so quickly. I just saw your reply.

I don't know how you are trying to read the mouseLeave method. After I have installed the cs everything is behaving normally for me including browsing that method. If you can find a reproducible way to get the bug your seeing its probably worth its own report.

Cheers -- Jer
05-14-06 14:35   
It looks like I screwed up my image. I tried viewing the changeset from a stock image, and it worked just fine.

I have one little suggestion: let's make 'showPopupMenu' check the state of the trashcan before popping up the menu. There's no reason for it to popup if it's empty.

Does that sound good?
05-15-06 09:20   
Hi Duncan,

About your suggestion. I would suggest leaving well enough alone.

The scraps window lets you "Empty itself" even it you have nothing to empty. So having a popup menu that made the distinction (I.e not coming up when there is nothing to do.) would be inconsistent with that.

Also, for learning purposes its good to have consistent behaviors. How is a new user likely to come across this feature? Of course he can read our copious documentation. If he can find where we've put it. (Assuming of course we make an effort to write it and then put it where he will come across it.)

More likely he will stumble accross it when he is mucking around in the image. The same pop-up being there all the time is a learning aid IMHO.

I have always found it hard to make mental models of menus that do diffent things at different times.

I'd rather concentrate my energies on other features and bugs.

Yours in service, -- Jerome Peace

P.S if it pleases you, have a look at some of the other mantis issues. Bug hiking is a good way to increase your squeak mastery. And you have a good enthusiam and some useful energy.

Alternately, get a current squeak 3.9 . Break something and write up useful bug reports. (useful reports start with simple formulas for recreating the bug.)

This is getting a little off topic for this bug issue so I'll stop there. Its been a pleasure working with you though. Cheers -- Jer

05-30-06 02:19   
Uploaded OpennedTrash.gif which is just a qnd modification of dgd's closed trash. If loaded into squeak and used to set the TrashCan's pressed state it will give a way to distinguish between the empty (=off), pressed, and full (=on) state.

I think someone w/ artistic ability could come up with a better version of this icon. But this will give a start.

The code to install this is not included. The trash can class has class variables for the On and Off states but no variable for the pressed state.

At this time the installation code is left as an exercise for the reader.

Yours in service, --Jerome Peace
06-05-06 04:58   
The fix is now complete. Both TrashCanEnh-wiz.4.cs and InitTrashPix-wiz.1.cs need to be loaded. Each can stand on their own. Together they give a complete enhancement of the look and feel of TrashCanMorph.

Uploaded InitTrashPix-wiz.1.cs

From the preamble
Change Set: InitTrashPix-wiz
Date: 4 June 2006
Author: (wiz) Jerome Peace

wiz 6/4/2006 22:21

To add a trash pressed picture, I rewrote some of the TrashCanMorph class side initialzation.

TrashPic is now a collection of the three forms. TrashPicOn is vestigial. The class side initialization still initializes it to its old value but nothing would be harmed if this was removed. I have not done it this pass because I didn't want to invite trouble by reshaping the class variables.

I've renamed initializeTrash... to reflect the fact they actually just return the picture forms. The clarity should help future maintainers (including me.).

Warning: TrashCanMorph initialize needs to be performed after these changes are made else there will be an error when the instance trys to index TrashPic (which in the last version was a form not a collection of forms).
The postscript here will ask for the initialization. I don't know how this works when you integrate it into morphic.

<< I meant the morphic MC package -- wiz>>

I don't think this breaks backward compatibility. I have not checked. "
07-13-06 08:48   
Reminder sent to: MarcusDenker

Hi Marcus, glad to see you are helping get 3.9 to final.

This is a done and tested bug fix.

I'd like to see it get in. It would impress and please Duncan.
He's new and like most would like to see his efforts leveraged quickly.

Load both TrashCanEnh-wiz.4.cs and InitTrashPix-wiz.1.cs need to be loaded.

This makes the trash can work like one should.

Yours in service, -- Jerome Peace
04-07-07 09:09   
Jerome, old trash have a different picture for full trash.
Only shows this when you put a new morph into.
I always use a derived class SmartTrashCan what lets you erase all Morphs of the same class and found useful for games like Rompecabezas.
I add here the elemental code , just in case you thik worths also have this option in Trash
04-08-07 11:51   
Hi edgar,

Thanks for taking the time to give this your consideration.

>Jerome, old trash have a different picture for full trash.
>Only shows this when you put a new morph into.

I don't understand. What old trash do you mean?

What do you wish me to do to make this fix acceptable to 3dot10?

The three trash images can be set to anything compatible with a three phase morph (I.e. 3 pictures all the same extent.).

The essence of the fix was to get the code logic right so that the trash-can looks different if there is something in the trash than if there isn't.

And add a simple menu item so the trash can be emptied without having to examine the scraps.

If that gets into the image then the option of what to make the trash cans look like is a problem a newbie with graphic taste and talent could resolve.

However the proof of the pudding is in the eating. So when I get the inspiration I will try it again in a recent image.

On your second point.

>I always use a derived class SmartTrashCan what lets you erase all Morphs of the same class and found useful for games like Rompecabezas.
>I add here the elemental code , just in case you thik worths also have this option in Trash

I would look at this as a further iteration on the trash. And would wish it to be taken up in a separate issue. I am frustrated enough trying to get this simple improvement into the image. I don't want to invest the time to meld two improvements into one. My experience is that that makes the code harder to debug. And generally harder to sell to people having to make decisions about including it in the image. One thing at a time.

The smart trash enhancement should have its own report. While it is related to this one; It is not the same problem; and so should be handled separately on its own merits.

I am tired as I write this and I fear I have not got the tone right. Forgive me that for now.

Yours in friendship and service, --Jeorme Peace
04-09-07 02:50   
Hi Edgar,

I have tried this fix up in 7073.

It works as I intended. Though I was worried until I realized that only newly created trash cans would show the "pressed" picture.

the interactive visual test was:
In a fresh 7073.
from the objects>basic flap get two trash cans.

From preferences find preserveTrash and enable it.

from objects get an object an throw it away.

Then using file list I installed the two change sets.
TrashCanEnh-wiz.4.cs then

Now clicking on the old trash cans shows the "messy state" because something is in the trash.

From objects get a third trash can. This one will properly show the "pressed" state when something is dragged over it. The old trash cans will not (because their pictures were initialized when they were created and are the old pictures where pressed and on look the same.)

Using the yellow button get a menu for the trash it will offer to empty the trash. When pressed it will ask if you really want to do so. Then it will empty scraps and the appearance of all the trash cans will be returned to the "unmessy" state.

The empty button on the scraps page will also update the state of all the trash cans.

This is the way I thought it should work.

Yours in service, --Jerome Peace
04-09-07 02:58   
Reminder sent to: edgardec

Hi Edgar,

AFAIK this works as intended. See the latest note.

Did that answer your concern?

Cheers -Jer