[comp.lang.smalltalk] Switches in 3D !!

pieter@prls.UUCP (Pieter van der Meulen) (10/10/89)

'Anybody who attended the OOPSLA89 exhibits may have noticed
that the new fashion in user-interfaces is 3D (depth effects).
I have seen only some effort in Smalltalk80 with respect to 3D.
Even though (I think) that it is not very important to have these
features, users are attracted/amused by them. And, I have even
heard someone saying that Smalltalk has not the most advanced
user-interface anymore (such sacrilege :-) ).
Anyway, I thought it should be really easy to get some of you
Smalltalkers motivated to come up with some examples.
To show how simple this is, I included an example for ParcPlace
Smalltalk-80 V2.3 (but will probably also work for other versions).

The Switch3DView, a subclass of SwitchView, adds 3D effects to
Switches. If you want all SwitchViews in the environment (like the
ones in BinaryChoice) to have this behavior, you may use the methods
here as SwitchView methods. In that case, omit the definition and
replace Switch3DView with SwitchView. I do not like MODIFYING
the system classes, so you do it.
Note: the <clearInside> method is really all you need........

Try the example <Switch3DView restoreDisplayView controller open>
and have fun,
	Pieter S. van der Meulen.'!

SwitchView subclass: #Switch3DView
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Interface-Menus'!

Switch3DView comment:
'Add 3D effects to Switches.
Try <Switch3DView restoreDisplayView controller open>.
Written by Pieter S. van der Meulen.
'!

!Switch3DView methodsFor: 'displaying'!

clearInside
	"Create a view with depth effects. Cash a BitBlt for speed.
	Appropriate for most Smalltalk80 versions."

	| aRect aBitBlt |
	aRect _ self insetDisplayBox copy.
	aBitBlt _ BitBlt 
		destForm: Display
		sourceForm: nil
		halftoneForm: nil
		combinationRule: Form over
		destOrigin: aRect origin
		sourceOrigin: Display boundingBox origin
		extent: aRect extent
		clipRect: Display boundingBox.
	(label isNil
		ifTrue: [6]
		ifFalse: [((aRect height - label height min:
			 (aRect width - label width)) // 2 - 1) min: 10])
			timesRepeat:
				[aBitBlt destRect: aRect; mask: Form darkGray; copyBits.
				aRect corner: aRect corner - (1@1).
				aBitBlt destRect: aRect; mask: Form lightGray; copyBits.
				aRect origin: aRect origin + (1@1)].
	aBitBlt destRect: aRect; mask: self insideColor; copyBits!

highlight
	"Keep the switches de-emphasized appearance close to its
	emphasized appearance. Only appropriate for ParcPlace Smalltalk."

	highlightForm == nil ifFalse: [^highlightForm
			displayOn: Display
			at: self displayBox topLeft
			clippingBox: self insetDisplayBox
			rule: Form reverse
			mask: nil].
	emphasisOn
		ifTrue: [Display reverse: (self insetDisplayBox insetBy: 1)]
		ifFalse: 
			["Display reverse: (self insetDisplayBox insetBy: 1)."
			Display reverse: (self insetDisplayBox insetBy: 2)]! !

!Switch3DView class methodsFor: 'examples'!

restoreDisplayView
	"To create a Switch which allows you to restore the display,
	execute : "
		"Switch3DView restoreDisplayView controller open"

	| topView aSwitch aView |
	topView _ StandardSystemView new.
	topView minimumSize: 128@40.
	topView maximumSize: 128@40.
	aSwitch _ Switch newOn.	
	aSwitch onAction: [ScheduledControllers restore].			
	"aSwitch offAction: [ScheduledControllers restore]."			
	aView _ SwitchView new model: aSwitch.
	aView borderWidth: 1; label: 'Restore display' asDisplayText.
	topView addSubView: aView.
	^topView! !

-- 
---------------------------------------------
P.S. van der Meulen, MS 02        prls!pieter
PRLS, Signetics div. of NAPC      -----------
811 E.Arques Avenue, Sunnyvale, CA 94088-3409

baumeist@exunido.uucp (Hubert Baumeister) (10/10/89)

In article <26675@prls.UUCP> pieter@prls.UUCP (Pieter van der Meulen) writes:
>
> ...
>The Switch3DView, a subclass of SwitchView, adds 3D effects to
>Switches. 
> ...

Did you think no one would use the code that is posted here? :-)
Your example creates an old SwitchView instead of a new Switch3DView.
In 
>!Switch3DView class methodsFor: 'examples'!
>
>restoreDisplayView
the line
>	aView _ SwitchView new model: aSwitch.
should read:
	aView _ Switch3DView new model: aSwitch.
and even better (because this will work for subclasses of Switch3DView too):
	aView _ self new model: aSwitch.

Hubert Baumeister
(baumeist@exunido.uucp
     huba@unidoi5.uucp)
Newsgroups: comp.lang.smalltalk
Subject: Re: Switches in 3D !!
Summary: 
Expires: 
References: <26675@prls.UUCP>
Sender: 
Reply-To: baumeist@exunido.UUCP (Hubert Baumeister)
Followup-To: 
Distribution: 
Organization: University of Dortmund, W-Germany
Keywords: SwichView 3D

Newsgroups: comp.lang.smalltalk
Subject: Re: Switches in 3D !!
Summary: bug in example
Expires: 
References: <26675@prls.UUCP>
Sender: 
Reply-To: baumeist@exunido.UUCP (Hubert Baumeister)
Followup-To: 
Distribution: 
Organization: University of Dortmund, W-Germany
Keywords: SwichView 3D bug

In article <26675@prls.UUCP> pieter@prls.UUCP (Pieter van der Meulen) writes:
>
> ...
>To show how simple this is, I included an example for ParcPlace
>Smalltalk-80 V2.3 (but will probably also work for other versions).
>
>The Switch3DView, a subclass of SwitchView, adds 3D effects to
>Switches. 
> ...

Did you think no one would use the code that is posted here? :-)
Your example creates an old SwitchView instead of a new Switch3DView.
In 
>!Switch3DView class methodsFor: 'examples'!
>
>restoreDisplayView
the line
>	aView _ SwitchView new model: aSwitch.
should read:
	aView _ Switch3DView new model: aSwitch.
and even better (because this will work for subclasses of Switch3DView too):
	aView _ self new model: aSwitch.

>---------------------------------------------
>P.S. van der Meulen, MS 02        prls!pieter
>PRLS, Signetics div. of NAPC      -----------
>811 E.Arques Avenue, Sunnyvale, CA 94088-3409

Hubert Baumeister
(baumeist@exunido.uucp
     huba@unidoi5.uucp)

lee@puffin.uucp (Lee Moore) (10/10/89)

In article <26675@prls.UUCP> pieter@prls.UUCP (Pieter van der Meulen) writes:
>
>.. And, I have even heard someone saying that Smalltalk has not the
> most advanced user-interface anymore (such sacrilege :-) ).

I would agree that in terms of *graphic design* the Smalltalk interface
leaves alot to be desired.  It seems to be frozen in the seventies mind-set
that never thought twice about letting programmers do graphic design. 
Before you flame, read the above sentence again.  I am not saying that
no programmer can do graphic design.  I am saying that one should think
carefully about who does the design and that graphic design is not part
of the typical training for computer programmers.  Fortunately, most
people now realize that programmers aren't typically trained to font design,
either.

This is not to say that the look of Smalltalk has to be maintained in all
Smalltalk applications.  From the videos I have seen, the Alternative Reality
Kit from PARC looks pretty good.  Although I don't know for sure, it would
seem to the NeXT design was influenced by it.

Smalltalk carries with it a culture.  Part of this culture believes that
we are all creative humans and that computers can be a medium of expression.
I believe that public works of art should be judged more critically than
personal works of art.  Another part of this culture is that bitblt is
still state-of-the-art.  Since bitblt doesn't extend well to color or
to devices of varying resolutions, the expressive power of Smalltalk is
stunted.

Let's be civil!

Lee
Lee Moore -- Xerox Webster Research Center
UUCP:		{allegra, decvax, cmcl2, rutgers}!rochester!rocksanne!lee
Arpa Internet:	Moore.Wbst128@Xerox.Com
DDN:		+1 716 422 2496

pieter@prls.UUCP (Pieter van der Meulen) (10/11/89)

In article <1664@laura.UUCP> baumeist@exunido.UUCP (Hubert Baumeister) writes:
>>The Switch3DView, a subclass of SwitchView, adds 3D effects to Switches. 
>Did you think no one would use the code that is posted here? :-)
>Your example creates an old SwitchView instead of a new Switch3DView.

Hmmm, yes, right, so you actually had to examine what you were filing in...
I guess this is one of those lucky bugs: I never got much response on earlier
source code postings, and now I am sure that some of you are indeed trying it!

>>!Switch3DView class methodsFor: 'examples'!
>and even better (because this will work for subclasses of Switch3DView too):
>	aView _ self new model: aSwitch.
Yes, that is the way to do it... 

>Hubert Baumeister
Are you the ones that have VT100 and VT220 teminal emulators implemented
in Smalltalk80?

Pieter.
-- 
---------------------------------------------
P.S. van der Meulen, MS 02        prls!pieter
PRLS, Signetics div. of NAPC      -----------
811 E.Arques Avenue, Sunnyvale, CA 94088-3409

khaw@parcplace.com (Mike Khaw) (10/11/89)

pieter@prls.UUCP (Pieter van der Meulen) writes:


>'Anybody who attended the OOPSLA89 exhibits may have noticed
>that the new fashion in user-interfaces is 3D (depth effects).
>I have seen only some effort in Smalltalk80 with respect to 3D.

While I didn't see all the Smalltalk demos at OOPSLA, the OO
Systems Analysis application (OSA) that Knowledge Systems Corp
did for HP definitely did have a NeXT-ish 3d+gray look to it,
and yes, it was pretty slick.

Mike Khaw
-- 
ParcPlace Systems, 1550 Plymouth St., Mountain View, CA 94043	415/691-6749
Domain=khaw@parcplace.com, UUCP={uunet,sun,decwrl}!parcplace!khaw

warner@s3dawn.ARPA (Ken Warner) (10/12/89)

>...the Alternative Reality Kit from PARC looks pretty good. 
What's that?
Ken Warner
warner@scubed.scubed.com

pieter@prls.UUCP (Pieter van der Meulen) (10/12/89)

In article <241@spot.wbst128.xerox.com> lee@rocksanne.uucp (Lee Moore) writes:
>>... has not the most advanced user-interface anymore (such sacrilege :-) ).
>I would agree that in terms of *graphic design* the Smalltalk interface
>leaves alot to be desired.  It seems to be frozen in the seventies mind-set

I fully agree (notice the smily face); we have had our share of fighting
with the environment because of its limited graphics support.

>still state-of-the-art.  Since bitblt doesn't extend well to color or to
>devices of varying resolutions, the expressive power of Smalltalk is stunted.

The color version of Smalltalk, done by Tektronix, solves this problem
partially. It is a pitty that it seems to become a lost effort.
I guess that the "not invented here syndrom" applies in this case to ....

>Let's be civil!

'Message understood: civil'   (part of the Smalltalk culture?  :-)
-- 
---------------------------------------------
P.S. van der Meulen, MS 02        prls!pieter
PRLS, Signetics div. of NAPC      -----------
811 E.Arques Avenue, Sunnyvale, CA 94088-3409