Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Mj3zR-0008TE-PO for mharc-grub-devel@gnu.org; Thu, 03 Sep 2009 00:32:05 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mj3zQ-0008T3-4z for grub-devel@gnu.org; Thu, 03 Sep 2009 00:32:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mj3zL-0008ST-KI for grub-devel@gnu.org; Thu, 03 Sep 2009 00:32:03 -0400 Received: from [199.232.76.173] (port=58412 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mj3zL-0008SQ-Es for grub-devel@gnu.org; Thu, 03 Sep 2009 00:31:59 -0400 Received: from mail-pz0-f200.google.com ([209.85.222.200]:36707) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mj3zK-0003gh-Sq for grub-devel@gnu.org; Thu, 03 Sep 2009 00:31:59 -0400 Received: by pzk38 with SMTP id 38so1351793pzk.5 for ; Wed, 02 Sep 2009 21:31:55 -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=/zuBE7ptHr/WbbDpfgGUA2hi8JdOHF7jqNSls/0zJKk=; b=we8keqFI22PRtVXrZyG0t/1EXxiL6pf0i5GB/nyyziK107m+lNWPZRY1fsLDUi2taX Qs+i4mS9ylXgWaQvnhmQHfBe649fA0WbVsdSTDrE5K62kEBm8BG9cydhAMX62Z455cJS rd6q44FzsDsyTbOdcF3VocST4BpH9GiReiadw= 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=rKxm1fAB2gx90M516d6aIDB0FLAwc1ML3bKW//LTvvp0yk2HYGknDhHwo2hQwglPBg qdOqzFQl5uyBP2pvstVAr/MjUz108/4qS/JN3+QtU4mZQlaI/DIyFriPhgpEEFI8geSo XtGP9bT0GHU9NXC3aEJEUxL8meRo/eUFdZDOI= MIME-Version: 1.0 Received: by 10.140.192.18 with SMTP id p18mr2754974rvf.95.1251952300664; Wed, 02 Sep 2009 21:31:40 -0700 (PDT) In-Reply-To: References: Date: Thu, 3 Sep 2009 12:31:40 +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 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: Thu, 03 Sep 2009 04:32:04 -0000 On Thu, Sep 3, 2009 at 3:43 AM, Michal Suchanek wrote: > 2009/9/2 Bean : >> On Thu, Sep 3, 2009 at 1:25 AM, Michal Suchanek wro= te: >>> 2009/9/2 Bean : >>>> On Wed, Sep 2, 2009 at 11:27 PM, Michal Suchanek = wrote: >>>>> How will it fit screen? What if the image is 4:3 and =A0the screen is >>>>> 5:4 or widescreen? >>>> >>>> It'd scale to fit the new proportion, although the image perhaps won't >>>> look nice in this case. We could choose one of the following rendering >>>> method based on option: >>>> >>>> Center >>>> Scaling (full) >>>> Scaling (keep ratio) >>>> Tiling >>> >>> Other common uses are >>> >>> Scaling (cover) - keep aspect but cover the whole area (with parts of >>> the picture sticking out of the viewport) - useful with a >>> non-intrusive background like a photo of fallen leaves or the like >>> >>> Left, Right, TopLeft, BottomRight, ... - for side and corner decoration= s. >> >> Hi, >> >> Sounds good, and it shouldn't be difficult to implement. >> >>> >>>> >>>>> Percentages are a good start. However, if you make your menu >>>>> percentage based adding new items or new menu areas is still >>>>> problematic. >>>> >>>> Actually I've though of another representation, using the font metrics >>>> as base unit, =A0something like this: >>>> >>>> + menu { >>>> =A0x =3D 10% >>>> =A0y =3D 10% >>>> =A0width =3D 30c >>>> =A0height =3D 30c >>>> } >>> >>> Does that c represent the width of the character "c"? What about >>> proportional fonts? >> >> The suffix c means character. For proportional fonts, it's the average >> width of font used by the current component. > > Still why would you want an object about 30 characters wide? You > either want an object that can accommodate its content or an object > that fills available space. An object "about 30 characters wide" is > useless in my view. Hi, For example, we might want to limit the width of edit box to display at most 30 characters, in this case 30c is quite useful. And the c unit is usable in both text and graphic mode. If we write y=3D2c, y is 2 character height, this looks acceptable in both text and graphics mode, but y=3D2 is extremely narrow in graphic mode. In fact, c is the unit used in the current gfxterm. > If it's height you can be sure you can put 30 menu items in there then > (but then it would be in some units on fount height not width) For y and height property, c is calculated using font height instead of wid= th. > >> >>> >>> I think it is OK if the layout manager was in Lua if that makes >>> hacking on it easier but you still need the support functions for a >>> fully functional layout manager in C for that to work. >> >> Yeah, I think it'd be better to implement to whole framework in C at >> first. LUA could be used to write custom component that extends the >> function of existing components. >> > > Actually the code in video subsystem that is required for writing a > layout manager is already there or easy to add. > > - get_viewport - get available area > - set_viewport - limit drawing to selected component > - get_text_width > - get_font_height - find out the size of a rectangle needed to draw a > specific string > > What is needed is parser for some configuration format that can store > arbitrary attributes which can then be interpreted by the layout > manager. We can select the layout manager using layout property. Although for simple interface, I don't think layout manager is necessary, as there won't be too many components on screen. --=20 Bean gitgrub home: http://github.com/grub/grub/ my fork page: http://github.com/bean123/grub/