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: Thu, 24 Sep 2009 18:31:30 +0800

On Thu, Sep 24, 2009 at 5:40 PM, Michal Suchanek <address@hidden> wrote:
>>>
>>> There is also a background glitch in graphics mode. In text mode the
>>> background of the menu items is cyan but it is blue in graphics.
>>
>> It's actually the background image back.png, if you want to use color
>> rect, change
>>
>> background = "/menu/back.png,,#808080/cyan"
>>
>> to
>>
>> background = ",#808080/cyan"
>
> It's background of the menu panel, the items still do have cyan
> background so that should apply (and should make the text visible).

Hi,

Oh, background color is ignored in graphic mode text, as it can ruin
the background image.

>
>>
>>
>>>
>>> 2009/9/23 Bean <address@hidden>:
>>>> Hi,
>>>>
>>>> Update:
>>>> Add label widget
>>>> Simple layout manager for panel widget.
>>>>
>>>> The resource file for new demo is uploaded at:
>>>> http://grub4dos.sourceforge.net/menu.zip
>>>>
>>>> Here is the theme file for new demo:
>>>>
>>>> screen
>>>> {
>>>
>>> This is an odd element. Can't this be another panel or just background
>>> form the toplevel panel?
>>>
>>> It may be easier this way initially but getting the layout of the
>>> inner pane right without a special element means that the layout is
>>> actually usable at all levels.
>>>
>>> Also requiring a screen element makes it harder to just take a menu
>>> and pack it inside another menu.
>>
>> The config file can store other information besides screen layout, for
>> example styles. I use the screen node to locate the top widget.
>
> That should not be necessary. Either a particular panel is installed
> as the top window explicitly (and this should be possible because
> later it should be possible to replace it with another panel) or one
> is selected based on some implicit rule.

screen is special case as width/height need to be set to the size of
screen, but panel doesn't have initial size. We can always add a panel
to cover the screen:

screen
{
  panel
  {
    x = 0
    y = 0
    width = 100%
    height = 100%
  }
}

>
>>
>> As for menu, it's better to move it to a different tree, and reference
>> it in the menu widget, perhaps something like this:
>
> What is a menu widget, and how does it relate to the other menu widget(s)?
>
> I do not see the connection.
>
> I also do not see why the panel cannot be specified completely at the
> very start.
>
> If need be it could be done like
>
> panel top_menu{
> }
>
> # add to the panel
> panel top_menu{
> #these don't have a name
>  label {
>  text = Ubuntu Linux
>  Icon = ubuntu.png
> }}
>
> panel top_menu{
>  label {
>  text = Debian GNU/Linux
>  icon = debian.png
> }}
>
> show top_menu
>
> Adding to an already created object should be possible
> programatically, and it is possible even in configuration. However,
> this method is quite error-prone in case you mistype the element name.
>
> Defining the element tree all at once either succeeds or fails visibly.
>

Consider submenu, for example, in the first level, it shows three
label aa, bb, cc, after clicking aa, it change to label dd, ee,ff. In
this case, label can be set directly in panel, otherwise we need
complex mechanism to add/remove them on the air.

menu is a special widget that handles these for us. It reads the menu
from another place and generate the labels inside a panel.

>>
>>
>> screen {
>>  menu {
>>    start = "sub_menu/bb"
>>  }
>> }
>>
>> menu {
>>  item {
>>    title = "aa"
>>    command =  ..
>>  }
>>  menu {
>>    title = "sub_menu"
>>    item {
>>      title = "bb"
>>      command =  ..
>>    }
>>    item {
>>      title = "cc"
>>      command =  ..
>>    }
>>  }
>> }
>>
>> Then we can use <enter> and <escape> to walk the menu tree. menu
>> widget would generate the corresponding label based on the current
>> menu level.
>>
>>>
>>>> ápanel
>>>> á{
>>>> á áx = "5"
>>>> á áy = "5"
>>>
>>> What is x and y? Isn't there a more descriptive name for this property?
>>>
>>> Why does a panel even need x and y?
>>
>> x, y is the top left coordination of the widget. x,y,width,height is
>> used to defined the position of widget, although for label, it can be
>> omit as panel can calculate it for them.
>>
>
> This is not what layout should be about. Internally the position and
> size of the element should be known but people are usually concerned
> about the element being in the center of the screen, offset at least
> some amount from each edge, etc.

But sometimes we do need to set location manually. For example we may
need to adjust the location of menu corresponds to the background
image. IMO, layout manager is best used for widgets like label where
location is not easy to calculate.

And we can also use this feature to divide the screen into different
blocks, like:

panel
{
  panel
  {
    x = 0
    y = 0
    width = 100%
    height = 30%
  }
  panel
  {
    x = 0
    y = 30%
    width = 100%
    height = 30%
  }
  panel
  {
    x = 0
    y = 60%
    width = 100%
    height = 40%
  }
}

-- 
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]