[comp.sys.mac.programmer] Proper menu title appearance when all items are dimmed

ra_robert@gsbacd.uchicago.edu (12/13/88)

I have a short question regarding menu bar etiquette: when all the
items in a menu are disabled (dimmed), should the menu title also be
dimmed?  I think so, 'cause in Apple's Human Interface Guidelines
it says just that, but even the Finder doesn't follow this rule.
Check out the 'View By' Menu in the Finder when all windows are closed
and nothing is selected.  All menu items are dimmed but the menu title
itself is not.  Is this an example of "do as I say, not as I do", or
is this interface rule not a strict one?  (The reason I'm asking this
is because I'm trying to avoid a lot of DrawMenuBar calls in my code
when all menu items become dimmed; lots of these calls tend to make
the menu bar flicker).

Robert
---------
ra_robert@gsbacd.uchicago.edu
---------
disclaimer: all these opinions, such as they are, are mine

pratt@boulder.Colorado.EDU (Jonathan Pratt) (12/13/88)

I too dislike the annoying flash of DrawMenuBar when all I want
to do is dim the title of one menu.  My solution was to dim and
redraw the menu title myself.  Unfortunately this is a bit of a
kludge since it involves direct access to the window manager
port, but it works so well I think Apple should have included
a call like this to begin with.

My question is, what is the best way to do this that minimizes the
risk of its breaking in the future?  Are we allowed to determine
the horizontal coordinate of the left edge of a menu from the
MenuList?  If so what is the calculation (in terms of ?System
Font, etc.) that determines where to draw the string?  Has any-
one nosed around in ROM to see how it is done?

Jonathan Pratt
pratt@boulder.colorado.edu

lippin@twinkies.berkeley.edu (The Apathist) (12/13/88)

Recently ra_robert@gsbacd.uchicago.edu wrote:

>I have a short question regarding menu bar etiquette: when all the
>items in a menu are disabled (dimmed), should the menu title also be
>dimmed?  I think so, 'cause in Apple's Human Interface Guidelines
>it says just that, but even the Finder doesn't follow this rule.
[...]
>(The reason I'm asking this
>is because I'm trying to avoid a lot of DrawMenuBar calls in my code
>when all menu items become dimmed; lots of these calls tend to make
>the menu bar flicker).

My feeling is to go with the HIG; I suspect that the finder doesn't
precisely to avoid the flicker.  I'm also bothered by the flicker --
it makes my programs look bad, and there's no workaround.  I suspect,
though it's hard to tell from IM, that the flickering code is in the
MBDF, so Apple could change it without much trouble.  Even a wrapper
patch for DrawMenuBar wouldn't be very large.  If they did fix this, I
wouldn't mind a bit.

(While we're at the wishing well, how about fixing FrameOval so that
it doesn't leave gaps?)

					--Tom Lippincott
					  lippin@math.berkeley.edu

		"Those are line *segments*, sir."
			--Second City,
			  "Football Comes to the University of Chicago"

sho@pur-phy (Sho Kuwamoto) (12/13/88)

In article <18216@agate.BERKELEY.EDU> lippin@math.berkeley.edu writes:

>(While we're at the wishing well, how about fixing FrameOval so that
>it doesn't leave gaps?)

Amen.  If they were going for speed still, I could understand, but 
seeing as they didn't feel so bad about the inefficiencies of Color 
Quickdraw, I don't see why they didn't just change it.  BTW, what 
algorithm do they use to draw these ovals anyway?  How much faster
is it then Brezhenham's (sp?) ?

-Sho

parent@Apple.COM (Shean Parent) (12/14/88)

In article <1723@pur-phy>, sho@pur-phy (Sho Kuwamoto) writes:
> In article <18216@agate.BERKELEY.EDU> lippin@math.berkeley.edu writes:
> >(While we're at the wishing well, how about fixing FrameOval so that
> >it doesn't leave gaps?)
> Amen.  If they were going for speed still, I could understand, but 

The way that QuickDraw draws an oval is to strike an oval inside the given
rectangle then inset by the pen size and strike a second oval. The area between
the two strikes is filled with the current pen pattern and color. If you think
of it like this then it is clear why the ovals fall apart. The area between
the two strikes closes to less the one pixel.

It is not a bug. It was designed that way.

Sean

parent@Apple.COM (Shean Parent) (12/14/88)

In article <5279@boulder.Colorado.EDU>, pratt@boulder.Colorado.EDU (Jonathan Pratt) writes:
> I too dislike the annoying flash of DrawMenuBar when all I want
> to do is dim the title of one menu.  My solution was to dim and

Darin Adler has an init called buffer menu bar that eliminates this flicker.
It was shown at MacHack some last June. I'm not sure if it is in the Public
Domain (I'll ask him and see if he would like to post it).

I would live with the problem for now since the proper place to fix it is in
the Mac system and I'm sure that sooner or later it will be.

Sean

wilson@csli.STANFORD.EDU (Nathan Wilson) (12/20/88)

In article <18216@agate.BERKELEY.EDU> lippin@math.berkeley.edu writes:
>(While we're at the wishing well, how about fixing FrameOval so that
>it doesn't leave gaps?)
. and various peole explain why...

So I understand the problems with ovals and the reason for their
existence.  What I don't understand are the bugs in the drawing
routines for framed round rects.  The two bugs I've found are due to
weird interactions between the pen dimensions and the corner oval
dimensions.  As far as I can tell none of the currently available
graphics packages allow you to exercise these bugs since they only
provide a limited set of oval width and height selections.  The first
bug occurs when the pen height is larger than the oval width.  The
effect is a widening of the *sides* of the round rect.  It appears to
be using half the oval width rather than the pen width.  The second
bug occurs when the oval height is set to 1.  Such "round rects"
collapse inward in width and develop very interesting feet coming out
the bottom.  This bug is a bit unfair as it does seem reasonable to
require that both the oval dimensions be greater than one, but this
should be documented.  The first bug, on the other hand, is somewhat
more disturbing since I actually wanted such a beast and was a bit
disturbed when I found I couldn't get it.  Finally, these bugs
probably explain why all the standard graphics programs don't let you
have direct control over oval width and height which has always struck
me as a bug.  The weirdest thing about both of these bugs is that if
you flip both the oval dimensions and the pen dimensions they go away.

Since most people can't easily create a round rect with
any desired settings for the pen and oval dimensions, I have included
a small binhexed file with this note that demonstrates the bugs.  The
file is in Scrapbook File format *NOT* PICT format.  The easiest way
to view after unbinhexing it, is to change its name to "Scrapbook File"
and move it into your system folder (save any current scrapbook you
might cherish by changing its name).  The Scrapbook DA will now show
you the goods.  Of course if you're using one of the DAs that allow
multiple scrapbooks you won't have to do all this name changing and
moving around.  The reason I didn't put it in PICT format is because
many graphics programs decide that you didn't really mean to create
such weird round rects so they change them for you.  It's actually
kind of interesting to paste these into such programs and see how they
change them.
	Nathan Wilson
	Teleos Research
	nathan@teleos.com

------------snip-------------------snip----------------snip---------
(This file must be converted with BinHex 4.0)
:$dCeEQYj8QpeEQ45C@0dF`"D8eP668&$8`%!!!!!!!!!#&SCD`!!!!!"!!!!"m`
!!!E-!!!!MJ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$P0MFQ&`BQp
[Db"'D@aPD`)!!!"D8eP668&$8`%!!(J!!&T6@9003806!3!!H!'!!!"'-!!!!!!
!!!!!!!!!!!!!Rp+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