[comp.lang.smalltalk] How do I make ST80 reverse-video all text views?

segall@styx.rutgers.edu (Ed Segall) (03/23/88)

I am running Parc Place Smalltalk-80 VI 2.2 VM 1.1 on a Sun 3/110 with
a 14-inch color display.  This is a bad combination - there is so
little sharpness and  contrast that my eyes hurt after a few minutes.
I would like to change most of the text displays so they default to
reverse-video, since this gives my eyes quite a bit of relief.  I did
this for Suntools, and it's much better (though still not very nice).


Is there a clean way to get the text views in workspaces, browsers,
and other useful objects to default to reverse video all the time?  I
thougt I had found the answer in TextConstants associationAt:
DefaultRule, since it looked to me like this specified the default
rule for displaying text on Forms.  Unfortunately, it didn't seem to
work.  Any recommendations?


Thanks,

Ed
-- 

uucp:   ...{harvard, ut-sally, sri-iu, ihnp4!packard}!topaz!caip!segall
arpa:   segall@CAIP.RUTGERS.EDU

segall@styx.rutgers.edu (Ed Segall) (03/24/88)

>Is there a clean way to get the text views in workspaces, browsers,
>and other useful objects to default to reverse video all the time?  I
>thougt I had found the answer in TextConstants associationAt:
>DefaultRule, since it looked to me like this specified the default
>rule for displaying text on Forms.  Unfortunately, it didn't seem to
>work.  Any recommendations?


I spoke prematurely. I have found that if I change DefaultRule to 12
(destination = source inverted) text windows do write text in
reverse-video.  The background stays white, though.  To change this, I
looked around and found that the color of the inside of a view is
at least partially determined by the View instance variable
insideColor.  In order to make all new View (and subclass) instances
come up with an inside color of black, I changed the View|new code
from

^super new initialize

to

^super new initialize insideColor: Form black.

This almost works - when a new view opens, it's inside color is black,
and text is white.  Unfortunately, something about the process of
editing text changes the background color to white again, causing the
letters and words to be surrounded by little black rectangles on a
white background - very distracting.  I haven't yet puzzled out what
is changing the background back to white.  If anyone knows a clean way
to prevent this, I would appreciate finding out.

Also, the borders should probably be changed to white, to make it
possible to see where one window starts and the next one ends.  More
importantly, I should change the cursor to xor or white so I can see
where it is on the black backgrounds.  You can see why I am asking for
advice - there are a number of details to be taken care of, and I can
imagine getting screwy results if it is not done "right".


Thanks, 

Ed
-- 

uucp:   ...{harvard, ut-sally, sri-iu, ihnp4!packard}!topaz!caip!segall
arpa:   segall@CAIP.RUTGERS.EDU

ken@pdn.UUCP (Ken Auer) (03/29/88)

In article <Mar.23.17.46.13.1988.8225@styx.rutgers.edu> segall@styx.rutgers.edu (Ed Segall) writes:
>
>>Is there a clean way to get the text views in workspaces, browsers,
>>and other useful objects to default to reverse video all the time?  I
>>thougt I had found the answer in TextConstants associationAt:
>>DefaultRule, since it looked to me like this specified the default
>>rule for displaying text on Forms.  Unfortunately, it didn't seem to
>>work.  Any recommendations?

OK, here's the scoop.  First of all the concept of color in Smalltalk
was implemented in a very short-sighted manner.  We're currently trying
to write our own "primitives" to allow us to make real use of color in
Smalltalk-80.  We previously had spent time developing using Softsmarts
color code and have we run into some interesting stuff!

Lots of Smalltalk code was written to assume that the background would
always be 'Form white', which was always going to mean a 0 (1 bit
pixel), which would always mean white.  This is what you're seeing in your 
text-editing stuff.  Some code uses the DefaultRule and DefaultMask, and
some code doesn't.

>I spoke prematurely. I have found that if I change DefaultRule to 12
>(destination = source inverted) text windows do write text in
>reverse-video.  The background stays white, though.  To change this, I
>looked around and found that the color of the inside of a view is
>at least partially determined by the View instance variable
>insideColor.  In order to make all new View (and subclass) instances
>come up with an inside color of black, I changed the View|new code
>from
>
>^super new initialize
>
>to
>
>^super new initialize insideColor: Form black.
>
>This almost works - when a new view opens, it's inside color is black,
>and text is white.  Unfortunately, something about the process of
>editing text changes the background color to white again, causing the
>letters and words to be surrounded by little black rectangles on a
>white background - very distracting.  I haven't yet puzzled out what
>is changing the background back to white.  If anyone knows a clean way
>to prevent this, I would appreciate finding out.

The problem is that all text views actually are displaying Paragraphs
(or TextCompositors in VI 2.2 and later) which decide on their own what
the foreground and background color should be.  Almost all of the
displaying and clearing of the view is actually passed on to the
paragraph via the controller.  (Interesting design isn't it?)

>Also, the borders should probably be changed to white, to make it
>possible to see where one window starts and the next one ends.  More
>importantly, I should change the cursor to xor or white so I can see
>where it is on the black backgrounds.  You can see why I am asking for
>advice - there are a number of details to be taken care of, and I can
>imagine getting screwy results if it is not done "right".

Well, the quickest way that I know of is to tell the machine to map its
colors in such a way that white is black and black is white.  This is
extremely simple to do with PPS VI2.2 or better which has primitives for
setting the color palette.  Simply set logical color 0 to black (0 if
your using RGB like on the SUN 3/60) and logical color 2**N - 1 (where N
is the number of bit planes on your machine) to white (65535, I think,
on the SUN 3/60).  It will get a little confusing when you look at code
that says Form white (and really means black) using this method, but it
works without a hitch.  

If you don't have a way to tell the machine your running on to remap its 
colors, have fun rewriting all of the code in all of the Views (especially 
the TextViews/Controllers, etc.), Paragraphs, TextCompositors, etc.  
(And please post the code when your done sometime next year :-)


From what I understand, Tektronix has done a fine job putting color into
their version of Smalltalk.  If anyone else out there would like a more
useful version of color in ParcPlace's Smalltalk-80, please let them
know... we don't seem to pull enough weight on our own. :-(

--------------------------------------------------------------------------
Ken Auer					Paradyne Corporation
{gatech,rutgers,attmail}!codas!pdn!ken		Mail stop LF-207
Phone: (813) 530-8307				P.O. Box 2826
						Largo, FL  34649-9981

"The views expressed above do not necessarily reflect the views of my
employer, which by no means makes them incorrect."