[comp.soft-sys.andrew] setting default colors

dgross@rchland.iinus1.ibm.com (Dave Gross) (10/26/90)

I'm having a problem setting default colors.  I want to check whether
the current display is color before I set them, but this requires a
"struct graphic *".

For example:

    if (graphic_DisplayClass(view_GetDrawable(self)) &
    graphic_Color){
        graphic_SetDefaultColors("white","blue");
    }

This won't work in InitializeObject because I don't have a "drawable"
yet.  If I wait until InsertView or something, the default colors for
the graphic are already set.  I would like these defaults to be used by
all subwindows of this view.

Any ideas?

Thanks,
-- Dave

Dave Gross
IBM Rochester
dgross@rchland.iinus1.ibm.com
507/286-6785

gk5g+@ANDREW.CMU.EDU (Gary Keim) (10/30/90)

Excerpts from misc: 25-Oct-90 setting default colors Dave
Gross@rchland.iinus (644)

> This won't work in InitializeObject because I don't have a "drawable"
> yet.  If I wait until InsertView or something, the default colors for
> the graphic are already set.  I would like these defaults to be used by
> all subwindows of this view.

Yes, check for the display-class in either the InsertView of FullUpdate
methods.  There is a single DefaultForeground and DefaultBackground
color for all graphics in the process.  When a view is inserted into the
view-tree, it's fore- and background colors are set to the defaults.  A
view can then set it's own colors or just go with the defaults by taking
no action. 

In conclusion, set the default fore- and background color when you test
for the display-class.  If they've already been set, that's OK.  Unless
your child views reset the defaults or set their own view-specific
colors, your default settings will come through.

dgross@rchland.iinus1.ibm.com (Dave Gross) (11/16/90)

Excerpts from ext.cmu.info-andrew: 29-Oct-90 Re: settingdefault colors
Gary Keim@RCHGATE.rchlan (958+0)

> Excerpts from misc: 25-Oct-90 setting defaultcolors Dave
> Gross@rchland.iinus (644)

>> This won't work in InitializeObject because I don't havea "drawable"
>> yet.  If I wait until InsertView orsomething, the default colors for the
>> graphic arealready set.  I would like these defaults to be used byall
>> subwindows of this view.

> Yes, check for the display-class in either the InsertView ofFullUpdate
> methods.  There is a single DefaultForeground and DefaultBackgroundcolor
> for all graphics in the process.  When a view is inserted into
> theview-tree, it's fore- and background colors are set to the defaults. 
> A viewcan then set it's own colors or just go with the defaults by
> taking no action.

> In conclusion, set the default fore- and background color when youtest
> for the display-class.  If they've already been set, that's OK. 
> Unlessyour child views reset the defaults or set their own view-specific
> colors,your default settings will come through.

I finally got around to trying this and it still doesn't work.  The
problemstill is that if I wait until InsertView of the parent view,
allthe subwindows' graphics have been set up (i.e., they have read in
the defaultcolors from graphic before I get a chance to change them).

Is there any other way, or can this be fixed?

Thanks,
-- Dave