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 16:51:25 +0800

On Thu, Sep 24, 2009 at 3:20 PM, Michal Suchanek <address@hidden> wrote:
> Hello,
>
> Thanks for this menu preview looks very good.
>
> I guess it could use more padding but if that can be added in the
> style there is no problem with that.
>
> There is also an odd column with blue background in text mode. Is that
> replacement for the icons? I guess they should not be displayed if it
> is not possible to render them.

Hi,

The default handling for bitmap is to replace it with rect if it can't
be displayed (text mode or file not found), although I can just skip
it for the image in label widget.

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


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

As for menu, it's better to move it to a different tree, and reference
it in the menu widget, perhaps something like this:


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.

>
> Typically it needs something like margin or border or padding to get
> some offset between the inner elements and the outside.
>
> This also reminds me that there is nice way of handling pixels in text
> mode - just ignore them. That places the menu inside something like
> this
>
> http://www.gnome-look.org/CONTENT/content-files/84298-terminal.jpg
>
> would also look reasonably in text where the image is not displayed.
>

But sometimes we also need border in text mode, currently it would
show bitmap in graphic mode, and a ascii box in text mode.

>>
>>    top_left = "/menu/menu_tl.png,,black/cyan/#0x250F"
>>    top = "/menu/menu_t.png,tiling,black/cyan/#0x2501"
>>    top_right = "/menu/menu_tr.png,,black/cyan/#0x2513"
>>    left = "/menu/menu_l.png,tiling,black/cyan/#0x2503"
>>    right = "/menu/menu_r.png,tiling,black/cyan/#0x2503"
>>    bottom_left = "/menu/menu_bl.png,,black/cyan/#0x2517"
>>    bottom = "/menu/menu_b.png,tiling,black/cyan/#0x2501"
>>    bottom_right = "/menu/menu_br.png,tiling,black/cyan/#0x251B"
>>
>>    background = "/menu/back.png,,#808080/cyan"
>>
>>    label
>>    {
>>      color = "black/cyan"
>>      image = "/menu/debian.png,,blue"
>>      title = "Hello Debian"
>>      spacing = 1
>>    }
>>    label
>>    {
>>      color = "yellow/cyan"
>>      image = "/menu/ubuntu.png,,blue"
>>      title = "Hello Ubuntui (long)"
>>      spacing = 1
>>    }
>>    label
>>    {
>>      color = "blue/cyan"
>>      image = "/menu/gentoo.png,,blue"
>>      title = "Hello Gentoo"
>>      spacing = 1
>>    }
>>  }
>> }
>>
>> The x/y/width/height property is not set in label widget, they'll be
>> calculated automatically by panel. The width/height property of panel
>> is also skipped, which means using the minimum width/height that
>> contains child widgets.
>>
>> The full properties of these widgets are:
>>
>> screen:
>> background - background image
>>
>> panel:
>> background - background image
>> top_left. top, top_right, left, right, bottom_left, bottom,
>> bottom_right - image for borders
>
> Are these meant to be borders only?
>
> I guess people who use something like
>
> http://openclipart.org/people/Anonymous/Anonymous_celtic_vine_corner.svg
>
> won't want the whole menu offset by the size of the image.
>
> Is it possible to set a border without supplying these images?

For those image, just use it as background image. Perhaps sometime like this:

panel
{
  background = "image.png"
  panel
  {
    x = 10%
    y = 10%
    width = -0
    height = -0
    ..
}

>
>
>>
>> label
>> font - font name
>> color - font color
>> image - icon image
>> title - title text
>> spacing - space between image and title
>
> I guess it would be better to change the naming a bit.
> I would use 'text' rather than 'title'. The label can be used even for
> plain text, not only huge captions (and there is no choice actually
> because we have only a single plain font).
>
> 'spacing' should not be used alone. There is font spacing, line
> spacing, the padding between contained elements, the padding the
> padding between the contained elements and the border....
> Each should be possible to set by a property so there is clearly more
> than one spacing.

Right, the naming need some tuning.

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