Subject: New proposed menu syntax

From: Mikhael Goikhman <[email-masked]>
Date: Sun, 17 Mar 2002 12:41:05 +0000

I combined all nice ideas suggested here. Comments are welcome.
I may help implementing new commands.

Currently we have multiple titles per menu. Several menu operations
require that a menu has only one title and I suggest to force this.
A title should be a property of the menu, not an item. Current non-top
titles may be simulated by "separator, centered item, separator" with no
item action.

There are 4 commands that work with a menu by its name:

  DestroyMenu - just like the current one
  AddToMenu   - the old syntax, may be obsoleted later
  AddMenuProperties - the new syntax
  AddMenuItems      - the new syntax

And probably DestroyMenuProperties and DestroyMenuItems.

The old syntax example:

  DestroyMenu RootMenu
  AddToMenu "[email-masked]@^black^"
  + "Root Menu" Title
  + "&Shells%mini-term.xpm%"               Popup Shells
  + "&Remote Shells%mini-red_term.xpm%"    Popup Remote-Shells
  + ""                                     Nop
  + "S&creensaver%mini-monitor.xpm%"       Exec xlock -nolock
  + "&Quit%mini-stop.xpm%"                 Quit

The same using the new syntax (it is longer, but more readable):

  DestroyMenu RootMenu

  AddMenuProperties RootMenu
  + SidePixmap "side.fvwm2.xpm"
  + SideColor black
  + Title "Root Menu"

  AddMenuItems RootMenu
  + I "Shells"
  + P   Icon mini-term.xpm
  + P   Hotkey s
  + A   Popup Shells
  + I "Remote Shells"
  + P   Icon mini-red_term.xpm
  + P   Hotkey r
  + A   Popup Remote-Shells
  + S
  + I "Screensaver"
  + P   Icon mini-monitor.xpm
  + P   Hotkey c
  + A   Exec xlock -nolock
  + I "Quit"
  + P   Icon mini-stop.xpm
  + P   Hotkey q
  + A   Quit

One more example, here a menu has several columns and no title.

  DestroyMenu WindowList
  AddMenuItems WindowList
  + I "Desk: 0" "Geometry"
  + A   (Mouse 2) FuncDoSomething
  + S
  + I "Some xterm" "80x40+100+100"
  + A   FuncDeiconifyAndWarp
  + A   (Mouse 3) Menu SomeMenu
  + I "Some iconified xterm" "80x40+200+200"
  + A   FuncDeiconifyAndWarp
  + A   (Mouse 3) Menu SomeMenu
  + P   Disabled   # or: Greyed

Now, a formal description of new commands:

AddMenuProperties gets parameters:

  DynamicPopUpAction
  DynamicPopDownAction
  MissingSubmenuFunction
  SidePixmap
  SideColor  # probably SideColorset
  Title
  WindowTitle  # used instead of Title on tear-off

AddMenuItems gets parameters:

  I or Item - starts a new item
    parameters: one or more labels
  S or Separator - starts a new "item", i.e. separator
    parameters: TearOff?
  P or Property - defines the current item property
    parameters:
      Icon (or Image) - multiple Icon parameters may be given
      BottomImage - if we are going to continue support this
      Hotkey - defines a hotkey char, here locale should be used I think
      Centered - this is to emulate non-top titles
      Disabled (or Greyed)
  A or Action - defines the current item action
    parameters:
      command
      (Mouse n) command
      (Key k) command - maybe in the future

By default, the title is separated from items using a tear-off separator,
but this may be configured.

The title (and possibly a separator) is removed when the menu is enclosed
into a window. But now the question is what to do with multi-column
titles:

  AddMenuProperties my-menu
  + Title "one column" "another column"

There are several solutions and I tend to the first one:

  1) don't allow multi-column title, use multi-column item instead
  2) allow multi-column title, but don't remove it on tear-off,
     otherwise the menu losses some information, and it is not clear
     what separator to use to join columns in a window title
  3) allow multi-column titles, remove it on tear-off

Regards,
Mikhael.
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
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: Daniel Henninger <[email-masked]>
Date: Sun, 17 Mar 2002 17:47:27 -0500 (EST)

I like this.. I like this a lot.  My only other suggestion was going to be
a completely different menu style of:
StartMenu "AppMenu" ( SidePic "ninja.xpm", SideColor blue )
	Title "Application Menu"
	Separator ( Height 6, Color red, Lines 2 )
	Item "Corporate Time" ( Greyed ) Exec /usr/local/bin/ctime &
	Item "Ninja" Exec /usr/local/bin/ninja
	Item "Crazy" ( Greyed )
	+	Exec /usr/bin/crazy
	Item "Whee" Exec /usr/bin/whee &
	Item "Foo"
	+	( Greyed )
	+	Exec /bin/foo
	Separator ( Height 1, Color lightblue, Lines 1 )
	Item "Logout" Quit
EndMenu

Where + was simply a "continue the previous line" so you could split
things up.  But I really like Mikhael's (this) suggestion better.

Daniel

-- 
/\\\----------------------------------------------------------------------///\
\ \\\      Daniel Henninger           http://www.vorpalcloud.org/        /// /
 \_\\\      North Carolina State University - Systems Programmer        ///_/
    \\\                   Information Technology <IT>                  ///
     """--------------------------------------------------------------"""

---

From: Mikhael Goikhman <[email-masked]>
Date: Mon, 18 Mar 2002 17:52:12 +0000

On 17 Mar 2002 17:47:27 -0500, Daniel Henninger wrote:
> 
> My only other suggestion was going to be a completely different menu
> style of:
> 
> things up.

This can't work with the current command philosophy. There are no
multiline commands, all commands are executed immediately one by one.
There are many reasons for this. But I will only list some problems with
the sample above.

Suppose a user forgot one EndMenu or one StartMenu. Or added some commands
inside a menu definition (it is possible now). What to do? Ignore the menu
definition? Ignore the non menu lines until the end of file? Close EndMenu
automatically? But if this can be done automatically, why EndMenu is
needed?

Moreover. Currently it is pretty possible to add a function definition
in a menu action and a menu definition in a function:

  AddToFunc func1 I AddToMenu menu1 "some label" AddToFunc func2 I Beep

Try to think how to do this using StartMenu/EndMenu StartFunc/EndFunc and
what kind of parser (using lex/yacc?) should be implemented. :)

Regards,
Mikhael.

---

From: Dan Espen <[email-masked]>
Date: Mon, 18 Mar 2002 13:05:54 -0500

> > StartMenu "AppMenu" ( SidePic "ninja.xpm", SideColor blue )
...
> automatically? But if this can be done automatically, why EndMenu is

I hadn't been paying much attention until now.

Getting rid of start/end was one of the reasons for the fvwm1/fvwm2
break.

-- 
Dan Espen                           E-mail: [email-masked]
444 Hoes Lane  Room RRC 1C-214      Phone: (732) 699-5570
Piscataway, NJ 08854
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
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: Daniel Henninger <[email-masked]>
Date: Thu, 21 Mar 2002 00:47:11 -0500 (EST)

Alrighty, so...  I haven't heard any objections to this particular style,
and I like it.  Shall I start working on doing it this way?

Daniel

---

From: Dominik Vogt <[email-masked]>
Date: Thu, 21 Mar 2002 21:46:31 +0100

> and I like it.  Shall I start working on doing it this way?

Can we please wait another week before starting this?  I know
you're eager to begin the work, but I'm too busy to give that
topic enough thoughts to come to a decision.  It's a very
difficult matter and we may very well regret some of the decisions
if made hastily.

Well, you could definitely start isolating parts of the current
AddToMenu() function that may be called individually by the new
function.  If you do, please keep the old code as it is and write
completely independent functions for the new syntax.  Oh - and I'd
like to splite all the menu code into smaller functions with fewer
levels of indentation.  So it is a good idea to write many small
functions instead of the monolithic behemoths we have now.

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
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: Daniel Henninger <[email-masked]>
Date: Thu, 21 Mar 2002 20:14:31 -0500 (EST)

> difficult matter and we may very well regret some of the decisions

Actually...  I've been sick and stuck at home and growing antsy, but am
going back to work tomorrow, so I'm not near as anxious about it as I was
before.  I'll just wait for us all to finish discussing it through.
Besides, I have some FvwmForm mods to work on.

Daniel