grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GITGRUB] New menu interface (implementation)


From: Bean
Subject: Re: [GITGRUB] New menu interface (implementation)
Date: Wed, 21 Oct 2009 12:07:15 +0800

On Wed, Oct 21, 2009 at 3:31 AM, Michal Suchanek <address@hidden> wrote:
> 2009/10/20 Bean <address@hidden>:
>> Hi,
>>
>> Update:
>>
>> Add dialog support, it allows you to write a template and call it with
>> different parameters, for example:
>>
>> dialog_edit {
>>  panel {
>>    parameters = "text=edit.text"
>>    class = frame
>>    width = 80%
>>    attach_hcenter = 0
>>    attach_vcenter = 0
>>
>>    edit {
>>      lines = 10
>>    }
>>  }
>> }
>
> I can see this used for the edit boxen and text mesasge dialogs which
> would be quite similar.
>
> Also the templating seems quite flexible and versatile.
>
> However, can't this be done with a shell function?
>
> Both the grub.d scripts and grub.cfg can define a function with a few
> parameters to achieve pretty much the same results.
>
> IIRC one of the sample menu.cfg files defined functions as part of
> grub configuration so we do not need another facility for this.
>

Hi,

IMO it's more easy to write widget this way, you can still pack it in
shell script as menu_popup support string argument:

menu_popup -s "panel { width=100% height=100% }"

This is fine for short code, but as the widget become more complex,
it's quite difficult to use this notion, especially when you add
command property which requires quotes. There seems to be some issue
with embedded quote handling.

>>
>> The parameters property control the mapping between parameter and
>> internal property name. To use it to edit current command:
>>
>> menu_edit dialog_edit text=command
>>
>> It also allows you to edit other properties, for example, the demo add
>> a hotkey t to edit the title:
>>
>> t = "menu_edit dialog_edit text=title\nmenu_refresh"
>>
>> The generated menu also uses templates, one for submenu, and one for 
>> menuitem:
>>
>> menu_template {
>>  panel {
>>    class = frame
>>  }
>> }
>>
>> item_template {
>>  panel {
>>    parameters = "class=image.class:title=text.text"
>>    class = select
>>    image {}
>>    text {}
>>  }
>> }
>>
>> The names of the template is passed to menu_create command:
>>
>> menu_create menu_template item_template.
>>
>> Smart popup window. The sub menu would pop to the direction with the
>> most space, which would make sure it won't be truncated by the border.
>
> It won't. You cannot know how much space the "most space" is.

First I calculate the central point of current node, if it's in the
top-left quadrant, I pop up sub menu at its bottom-right corner, etc.
The handling is quite simple and it should avoid popping up sub menu
off screen.

-- 
Bean

gitgrub home: http://github.com/grub/grub/
my fork page: http://github.com/bean123/grub/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]