Subject: Re: Menu code, anyone working on it?

From: [email-masked] (Albrecht Kadlec)
Date: Tue, 4 Feb 97 16:24:03 +0100

>>>>> Ilkka E T Tuohela writes:

I> I wanted to fix ugly keyboard handling with menus, almost made it but
I> my code was so bad that I didn't like it and began thinking of rewriting 
I> menus.c ... 

[ideas about keyboard handling deleted, although I do very much agree]

I've been thinking of rewriting menus.c, too.

displaying: 
	. make a show_picture() function, so that we don't duplicate so
		much code (query if bitmap/pixmap and respective handling)
	. make arrows on both sides, but if a mini_icon exists, use it's
		area instead for popping uo submenus (to eliminate
		unnecessary items, mini_icon and arrow would be too much)
	. make arrows full height		
	. change placement code (leftmenu replacement):
		if the right arrow/icon was touched, place the submenu at
		new_popup_x = old_popup_x + old_popup_width/2 

		otherwise (left arrow/icon touched)
		new_popup_x = old_popup_x + old_popup_width/2 - new_popup_width
		
		if the preferred position is invisible, use the other.
		
		This automatically places submenus so, that half of the old
		menu is still visible (try opening a _wide_ submenu of a
		narrow one).

There already is also a patch from me for the following feature 
(didn't make it into 2.0.45)

additional 'command' parameter for popup & menu functions: string in which
$0 $1 etc are replaced by 
	the splitted menu return string

e.g: (from my 2.0.43 developer .fvwm2rc)

AddToMenu Machine "Machine" Title
+	&einstein	einstein	$HOSTDISPLAY
+	&euler		euler		$HOSTDISPLAY
+	&hilbert	hilbert		$HOSTDISPLAY
+	&newton		newton		$HOSTDISPLAY
+	&pascal		pascal		$HOSTDISPLAY
+	&kodiak		kodiak.vlsivie.tuwien.ac.at ${HOST}.auto.tuwien.ac.at:0

AddToFunc X		"I"	Exec exec $0 $1 $2 $3 $4 $5 $6 $7 $8 $9
AddToFunc OnHostExec	"I"	X "xhost +$0 & rsh $0 -n \"setenv DISPLAY $1; exec $2 $3 $4 $5 $6 $7 $8 $9 </dev/null >&/dev/null\""

AddToMenu Tools "Tools"			Title
+	"X&term%xterm-blank.xpm%"	XTerm
+	"uptimes%graphs.xpm%"		X	rsh kodiak.vlsivie.tuwien.ac.at up >/dev/console
#	"Xterm&s%xterm.xpm%"		PopUp	Xterms
+	"Xterm@%xterm.xpm%"		PopUp	Machine OnHostExec $0 $1 xterm
+	"&Emacs@%gnu-animal.xpm%"	PopUp	Machine OnHostExec $0 $1 emacs
+	"&Perfmeter@%graphs.xpm%"	PopUp	Machine OpenWin perfmeter $0 -title perfmeter:$0 -geometry 132x74 -bg Grey -fg Black
+	"X&calc%xcalc.xpm"		X	xcalc
+	"Calculator%xcalc.xpm"		OpenWin calctool
+	"X&man%question.xpm%"		X	xman
+	"Xma&g%mag_glass.xpm%"		X	xmag
+	"X&lock%Jxlock.xpm%"		XLock
+	"&Netscape@%mini.netscape.xpm%"	PopUp	Machine OnHostExec $0 $1 netscape
+	""				Nop
+	"&Quit%exit.xpm%"		Quit

In "PopUp	Machine OnHostExec $0 $1 xterm"

$0 is the returned machine (einstein | euler | ...)
$1 is HOSTDISPLAY (or the corrected value, as 'hostname' is broken on
our local machines)

so this saves a lot of typing.

If you want to incorporate this, I can send you a patch (for 2.0.43) or the
corresponding files - mail me.

regards,
albrecht
PS: Make sure chuck is fond of your ideas, or you could save a lot of typing.
    And ask if he plans to reimplement your code, once you submit it. 
    Then you don't have to test so hard, since he'll have to do the beta
    testing again, anyway.
-- 
My mother came to Hazard when I was just seven
Even then the folks in town said with prejudiced eyes
That boy's not right ...
Three years ago when I came to know Mary
First time that someone looked beyond the rumours and the lies
And saw the man inside ...			-- Richard Marx
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: [email-masked] (Albrecht Kadlec)
Date: Tue, 4 Feb 97 19:10:42 +0100

displaying: 

		

regards,
albrecht

PPS: at the first attemt to send this mail, your .forward returned
     with error #75, so I'm resending this.