Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MryYe-0004xa-Oe for mharc-grub-devel@gnu.org; Sun, 27 Sep 2009 14:33:16 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MryYZ-0004wr-QG for grub-devel@gnu.org; Sun, 27 Sep 2009 14:33:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MryYU-0004wb-Cf for grub-devel@gnu.org; Sun, 27 Sep 2009 14:33:10 -0400 Received: from [199.232.76.173] (port=37324 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MryYU-0004wY-6w for grub-devel@gnu.org; Sun, 27 Sep 2009 14:33:06 -0400 Received: from mail-px0-f202.google.com ([209.85.216.202]:44714) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MryYT-0006HS-OJ for grub-devel@gnu.org; Sun, 27 Sep 2009 14:33:06 -0400 Received: by pxi40 with SMTP id 40so4869979pxi.24 for ; Sun, 27 Sep 2009 11:33:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=h8OyLBvyKPxqYqtMH/8Z/RHrjLf65TYhWMa5n8U36W4=; b=UbWTCs/nYnv+BnoZg2wOSZzU1iRFabMBUos18OY1w3S7TRO7pjX9K6g7VY0LW8NDd5 GXOSlsB+YHf5gHIJcQllhrXKdWAnxV1+jgiJnXEXxAZJaYzUvOiKzkDPL0DeizGFJPYs XhIhPfXlZK9cjV45oITW3nQqkbgYMpFD8pINg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=vVenN9nVbtbMFbtlU7TUzcKBsyC1HQF1EWx78Jom2ODVcu3Psi63iRzD9redHWX2k5 0nbR6geDj+qfgHyfIFX656VkvbqbxM286qWbXLkX/EY+0CE77Zoj8f+4oBIO7BxmD9Is 5RM9TdMealskIZPj/3Jz2oWV0oaBlXOxgUSM4= MIME-Version: 1.0 Received: by 10.141.18.18 with SMTP id v18mr102460rvi.10.1254076384833; Sun, 27 Sep 2009 11:33:04 -0700 (PDT) In-Reply-To: References: Date: Mon, 28 Sep 2009 02:33:04 +0800 Message-ID: From: Bean To: The development of GRUB 2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [GITGRUB] New menu interface (implementation) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2009 18:33:12 -0000 On Mon, Sep 28, 2009 at 12:12 AM, Michal Suchanek wro= te: >> Add new number format to specify size for both graphic and text mode: >> >> space =3D 10/0 > > I would prefer if the spacing would not need to be specified > separately for text mode and graphics mode. > > I hope I can get to creating some layout mockups so that we can see if > that is feasible. > Hi, You can still use character unit as: space =3D 1 But the problem is that minimum value is 1. In text mode, 1 character size is significant. We don't want to spend valuable space for parameters like vspace and hspace. But in graphic mode, we can afford some pixel on spacing. >> >> 10 pixel in graphic text, 0 in text mode >> >> New layout manger, it support the following parameters: >> >> columns >> valign >> halign >> width >> height >> vspace >> hspace >> vmargin >> hmargin >> >> width/height is the size of widget, if it's not set, the size is >> calculated automatically using the size of child widgets > > For sizing two modes are useful: the minimum sizing that assigns the > size required to display all content and the maximum sizing that > expands the widget as much as possible. If width =3D 100% means that any > siblings are not displayed because the widget occupies exactly the > available space then a different notation would be useful for taking a > share of the available width. > Yep, I have plans for the min_width/min_height/max_width/max_height propert= y. >> >> vmargin, hmargin is the distance between horizontal and vertical >> border, positive value is from left/top, while negative value is from >> right/bottom, for example: >> >> panel >> { >> =A0vmargin =3D -0 >> =A0hmargin =3D -0 >> } >> >> places the panel in the bottom right corner. > > How does this resolve the problem of setting the top, left, bottom and > right margin without knowing the size (width, height) of the panel? > > I know that when panel is drawn the size is known but the size might > not be known when the configuration is written (different screen sizes > or label lengths). Setting the size (width, height) might be > appropriate in some cases but in most it should be calculated > automatically so that the layout fits in the available space. > It'd work as expected, you can see it by setting the width/height of the last panel to 28%/28%, it'd still stick to the border. The program do this in two steps, first the size, then the position, it allows to the widget to change the size before position is calculated. > I might want a bit of space (like 0.5 em or 0.5c) around a label so > that the label text is not sticking to the border as it was in the > last demo. You can do this with vspace/hspace. The last panel looks compact as it does specify width/height so that the minimum required size is used. > > If I have a background picture over which I want to draw the menu and > it has a designated area for this I can either measure the menu > position as x,y,width, height or as top, left, bottom, right. The > latter has the advantage that if I decide to allow scaling the picture > I can measure the margin in % and the rounding error for each border > is the same. For x,y,width,height the rounding error of the bottom > corner is twice as large. > > In the general case I would want to avoid the menu sticking to the > border of the screen which again calls for a margin. > Actually, when vmargin and hmargin is positive number, it's exactly the same as x,y, but it also allows to stick to other borders, which is impossible for x,y without setting the size. >> >> Here is a sample config file that shows different valign/halign >> combination, the image file is inside the previous menu.zip. >> >> screen >> { >> =A0halign =3D "center" >> =A0valign =3D "center" >> =A0columns =3D 3 > > This is not nice because when you add a new panel it wraps to the next > row. For most uses grouping panels in a single direction seems more > useful. When they have some logical order that order is preserved when > a new panel is added. > For single row, set columns =3D 0 For single column, set: columns =3D 1 >> =A0background =3D "/menu/back.png" >> >> =A0panel >> =A0{ >> =A0 =A0background =3D ",blue" >> =A0 =A0hspace =3D 10/0 >> =A0 =A0vspace =3D 5/0 >> =A0 =A0halign =3D left >> =A0 =A0valign =3D top >> =A0 =A0width =3D 28% >> =A0 =A0height =3D 28% > > Calculating this value is error prone and redundant since it is the > same for all panels. This is just a demo, in fact, you can skip the width/height parameter and it will calculate the minimum size for you. But in this case, you can't see the valign/halign property in action inside the panel. --=20 Bean gitgrub home: http://github.com/grub/grub/ my fork page: http://github.com/bean123/grub/