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: Michal Suchanek
Subject: Re: [GITGRUB] New menu interface (implementation)
Date: Thu, 24 Sep 2009 11:40:25 +0200

2009/9/24 Bean <address@hidden>:
> 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.

Since there should be no element that shows only bitmap it can be
simply omitted.

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

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

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

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


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

This is somewhat problematic. What if I have a border in the
background bitmap already but want to show a border in text mode. How
does this work if I set the border bitmap only for some directions
(incomplete border) ?


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

That would work for single decoration. However, if I have such
decoration for multiple locations (ie top right and bottom left) I
would have to compose them into a single image and scale them which is
doable but not nice, especially because scaling is slow and ugly.

Also in some cases the border bitmap is meant to be mostly background
(ie it contains the border and a large gradient that only slightly
differs from the background colour).

Thanks

Michal




reply via email to

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