All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] New menu design based on MVC
@ 2009-06-25  4:07 Bean
  2009-06-25 12:37 ` Robert Millan
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Bean @ 2009-06-25  4:07 UTC (permalink / raw)
  To: The development of GRUB 2

Hi,

The current menu system is a little chaotic, the various components
are mixed together which make it difficult to maintain and extend.
Therefore, I propose a new design which seperates model, view and
controller.

Model. It's the menu items. Currently, menu are added using menuitem
statement, which is unique to sh script engine. I think it'd be
advantageous to have a scipt independent way to define menu. Also,
using configfile to define submenu is not good, as it is
difficult to implement interaction between parent and child menu, for
example, auto expand the child menu when parent is selected, or
implement a hotkey that will jump back to the top menu regardless of
the current menu level. IMO, the menu should be loaded as a whole.

The menu is tree structure, a natural way to represent it is to use
xml, for example, we may write it like this:

<menu>
  <menu title="OS">
    <menu title="Windows 98" class="win98" fallback="Linux">
      root (hd0,1)
      chainloader +1
    </menu>
    <menu title="Linux" class="linux" lock>
      root (hd0,2)
      linux /vmlinuz
      initrd /initrd.img
    </menu>
  </menu>
  <menu title="Tools">
  </menu
</menu>

We can add a command load_menu to load it.

View. It's the menu viewer. Currently, the menu viewer resides in
normal.mod, but it should be placed in a standalone module. Also,
besides the current c version, we could add a new one written in lua.
LUA script is quite flexible, we can extend the function of menu
viewer without recompiling from source code.

Another improvement of menu viewer is to define the layout
dynamically, instead of hardcoding them in the source. And again, we
could utilize the xml to define the layout, perhaps something like
this:

<root>
  <image x="0" y="0" src="background.png" />
  <menu x="100" y="100" width="200" height="200" />
  <progressbar x="0" y="400" style="circular" />
</root>

Controller. Currenlt, the controller is mixed with viewer, the
show_menu function of menu viewer takes over once it's invoked. I
think it's better to move this part out of viewer. In fact, we can
implement this using event model. The controller waits for events,
such as keyboard, timer, etc, and then dispatch them to the viewer.

-- 
Bean



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-06-28  8:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-25  4:07 [RFC] New menu design based on MVC Bean
2009-06-25 12:37 ` Robert Millan
2009-06-25 13:50   ` Colin D Bennett
2009-06-25 14:05     ` Bean
2009-06-25 14:25     ` Robert Millan
2009-06-25 15:54       ` Bean
2009-06-25 16:27         ` Colin D Bennett
2009-06-25 16:34         ` Isaac Dupree
2009-06-25 17:48         ` Pavel Roskin
2009-06-25 16:47     ` Vladimir 'phcoder' Serbinenko
2009-06-26 14:31 ` Robert Millan
2009-06-26 15:25   ` Pavel Roskin
2009-06-28  8:30 ` Marco Gerards

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.