[ENH] A new way to manage collapsed windows

Aaron J Reichow reic0024 at d.umn.edu
Tue Sep 25 14:47:15 UTC 2001


Hello!

This summer, I conducted a bunch of research using Squeak, and was using
Squeak 30 hours a week.  The way that Squeak manages collapsed windows
often got in my way, and I think it's pretty clumsy if you're the kind of
person that has a lot of windows open when developing, like myself.

What this CS does is change the way Squeak managed collapsed windows.  If
you file this changeset in, there will be a little button labeled
"Window" that pops out on mouse-over.  A click will reveal that it
contains the names of all the windows, seperated into hidden and open.
When you click the collapse button, the window will no longer collapse
into a titlebar on the desktop, it will hide itself completely from sight.

This changeset and some screenshots (wm-*.jpg) can be found in
<http://www.d.umn.edu/~reic0024/squeak/>.

This CS requires MenuBarMorph, which can be found at:
<http://swiki.gsug.org:8080/sqfixes/1653.html>

Another random announcement, keep your eye out for Squeak/Tk.  Right now,
it's written in STk <http://kaolin.unice.fr/STk/>, a version of Scheme
that's integrated with Tk.  A port to C or Tcl would probably be a good
idea, so that STk isn't required.

Enjoy,
Aaron

Aaron Reichow ::  Twin Ports ACM Pres ::  http://www.d.umn.edu/~reic0024/
"life, probably the biggest word i've ever said, that says a lot 'cause
there is a whole lot of words inside my head..." -- atmosphere






-------------- next part --------------
'From Squeak3.0 of 4 February 2001 [latest update: #3545] on 24 September 2001 at 1:09:04 pm'!
"Change Set:		WindowMenuButton
Date:			24 September 2001
Author:			Aaron Reichow (reic0024 at d.umn.edu)

This changeset changes the way Squeak manages collapsed windows.
When you load it, it will enable itself, and there is no option
in the preferences to enable/disable it.

To revert collapsed window management to how it used to be, expand
all collapsed windows, and revert the method SystemWindows>>#collapseOrExpand
to the last version by sw.  Provided you've not changed the method
yourself after installing my changes, this can be done by picking the
version on the line after the one labeled:
  'ajr 6/21/2001 13:14 SystemWindow collapseOrExpand'

Enjoy!
Aaron Reichow
reic0024 at d.umn.edu :: http://www.d.umn.edu/~reic0024/squeak/
"!

MenuBarItemMorph subclass: #MenuBarDynamicItemMorph
	instanceVariableNames: 'menuBlock selector target '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Menu Bar'!
MenuBarMorph subclass: #WindowMenuButton
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Menu Bar'!

!MenuBarDynamicItemMorph methodsFor: 'as yet unclassified' stamp: 'ajr 7/30/2001 17:03'!
openMenu: hand
	self menu: (target perform: selector) setColors.
	super openMenu: hand.! !

!MenuBarDynamicItemMorph methodsFor: 'as yet unclassified' stamp: 'ajr 7/30/2001 17:02'!
selector
	^ selector! !

!MenuBarDynamicItemMorph methodsFor: 'as yet unclassified' stamp: 'ajr 7/30/2001 17:02'!
selector: aSymbol
	selector := aSymbol! !

!MenuBarDynamicItemMorph methodsFor: 'as yet unclassified' stamp: 'ajr 7/30/2001 17:07'!
target
	^ target! !

!MenuBarDynamicItemMorph methodsFor: 'as yet unclassified' stamp: 'ajr 7/30/2001 17:07'!
target: anObject
	target := anObject! !


!MenuBarDynamicItemMorph class methodsFor: 'as yet unclassified' stamp: 'ajr 6/20/2001 12:45'!
forBlock: aBlock
	^ self new menuBlock: aBlock! !

!MenuBarDynamicItemMorph class methodsFor: 'as yet unclassified' stamp: 'ajr 7/30/2001 17:02'!
target: anObject selector: aSymbol
	^ self new target: anObject; selector: aSymbol! !


!SystemWindow methodsFor: 'resize/collapse' stamp: 'ajr 6/21/2001 13:14'!
collapseOrExpand
	isCollapsed
		ifTrue: 
			["Expand -- restore panes to morphics structure"
			isCollapsed _ false.
			self show; unlock; activate. "-- mainly for findWindow"]
		ifFalse: 
			["Collapse -- remove panes from morphics structure"
			isCollapsed _ true.
			self hide; lock.].
	self layoutChanged! !


!WindowMenuButton methodsFor: 'as yet unclassified' stamp: 'ajr 7/31/2001 16:17'!
initialize
	| mb mi |

	super initialize.
	mb _ MenuBarMorph new.

	mi _ MenuBarDynamicItemMorph target: self selector: #menu.
	mi title: 'Windows'.
	mb append: mi.
	
	self addMorph: mb;
		setToAdhereToEdge: #topLeft;
		extent: 64 at 22;
		on: #mouseEnter send: #mouseEnter: to: self;
		on: #mouseLeave send: #mouseLeave: to: self.! !

!WindowMenuButton methodsFor: 'as yet unclassified' stamp: 'ajr 8/2/2001 11:52'!
menu
	| aMenu expanded collapsed |
	expanded _ SystemWindow windowsIn: World satisfying: [:w | w isCollapsed not].
	collapsed _ SystemWindow windowsIn: World satisfying: [:w | w isCollapsed].
	aMenu := PulldownMenuMorph new.
	collapsed do: [ :w |  aMenu add: w label target: w selector: #collapseOrExpand ].
	aMenu addLine.
	expanded do: [ :w | aMenu add: w label target: w selector: #activate ].
	^ aMenu.
! !

!WindowMenuButton methodsFor: 'as yet unclassified' stamp: 'ajr 6/20/2001 16:38'!
mouseEnter: evt
	self bounds: (0 at 0 corner: 64 at 22).
	self comeToFront.! !

!WindowMenuButton methodsFor: 'as yet unclassified' stamp: 'ajr 6/21/2001 16:02'!
mouseLeave: evt
	self bounds: (0 at -20 corner: 64 at 2).! !

!WindowMenuButton methodsFor: 'as yet unclassified' stamp: 'ajr 6/20/2001 13:38'!
mouseUp: evt
	self inspect.! !

!WindowMenuButton methodsFor: 'as yet unclassified' stamp: 'ajr 6/20/2001 14:07'!
ownerChanged
	"do nothing!!"

	"self snapToEdgeIfAppropriate"
	"	extent: (60 @ menuBarHeight)."! !

"start up the button..."
WindowMenuButton new openInWorld.
CollapsedWindows do: [ :w | w collapse ].
Smalltalk removeKey: #CollapsedWindows. !


More information about the Squeak-dev mailing list