From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UUaNF-0002Gx-QU for mharc-grub-devel@gnu.org; Tue, 23 Apr 2013 06:22:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUaNC-0002GG-Kr for grub-devel@gnu.org; Tue, 23 Apr 2013 06:22:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUaNA-0006Qe-Vm for grub-devel@gnu.org; Tue, 23 Apr 2013 06:22:54 -0400 Received: from collab.rosalab.ru ([217.199.216.181]:34347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUaNA-0006Q5-Jh for grub-devel@gnu.org; Tue, 23 Apr 2013 06:22:52 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by collab.rosalab.ru (Postfix) with ESMTP id 642B329C35C; Tue, 23 Apr 2013 14:22:50 +0400 (MSK) X-Virus-Scanned: amavisd-new at rosalab.ru Received: from collab.rosalab.ru ([127.0.0.1]) by localhost (collab.rosalab.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id J8hTfF80Np89; Tue, 23 Apr 2013 14:22:49 +0400 (MSK) Received: from icedphoenix.localnet (unknown [10.168.1.56]) by collab.rosalab.ru (Postfix) with ESMTPSA id 832AC29C2BC; Tue, 23 Apr 2013 14:22:49 +0400 (MSK) From: Vladimir Testov To: grub-devel@gnu.org Subject: Re: [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities Date: Tue, 23 Apr 2013 14:22:49 +0400 Message-ID: <7857026.WXShG2GPYX@icedphoenix> User-Agent: KMail/4.9.5 (Linux/3.5.0-26-generic; KDE/4.9.5; x86_64; ; ) In-Reply-To: <20130419181636.0621e195@opensuse.site> References: <2436865.mmQVWtOiim@icedphoenix> <20130419181636.0621e195@opensuse.site> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart7637622.Yt4V8Gfgpm" Content-Transfer-Encoding: 7Bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 217.199.216.181 Cc: Andrey Borzenkov X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Apr 2013 10:22:56 -0000 This is a multi-part message in MIME format. --nextPart7637622.Yt4V8Gfgpm Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Smth like that? (presumed "documentation update - draft" patch is applied) On Friday, April 19, 2013 06:16:36 PM Andrey Borzenkov wrote: > =D0=92 Fri, 12 Apr 2013 11:27:21 +0400 >=20 > Vladimir Testov =D0=BF=D0=B8=D1=88=D0=B5= =D1=82: > > >I think "XXX deg" is enough. It avoids confusion with single/plura= l > > >forms and we just need something to distinguish from plain number.= > >=20 > > Maybe we should use all three keywords - "deg", "degree", "degrees"= ? >=20 > I do not see any real need for it. >=20 > > >Please add also documentation for it. > >=20 > > Ok. Please tell me where and how should I do it. :) >=20 > docs/grub.texi, section Theme file format. I assume it should go > somewhere in Component properties. >=20 > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel --=20 With best regards, _______________________________ Vladimir Testov, ROSA Laboratory. www.rosalab.ru --nextPart7637622.Yt4V8Gfgpm Content-Disposition: attachment; filename="grub-angle-translation.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="grub-angle-translation.patch" diff -Naur grub-new/docs/grub.texi grub-new2/docs/grub.texi --- grub-new/docs/grub.texi 2013-04-19 03:45:33.641661014 +0400 +++ grub-new2/docs/grub.texi 2013-04-19 03:55:05.026961965 +0400 @@ -2035,6 +2035,9 @@ @item start_angle @tab The position of the first tick mark to appear or disappear. Measured in ``parrots``, where 1 ``parrot`` equals to 1 / 256 of the full circle. + The value of this property could be set in degrees if used value pattern + ``XXX deg``. Also the value could be set in rads if used value pattern + ``XXX rad``. @item theme_dir @tab The full path to the directory where bitmaps are holded. This property should be set if bitmaps are not placed in the diff -Naur grub-new/grub-core/gfxmenu/gui_circular_progress.c grub-new2/grub-core/gfxmenu/gui_circular_progress.c --- grub-new/grub-core/gfxmenu/gui_circular_progress.c 2013-04-08 13:00:36.000000000 +0400 +++ grub-new2/grub-core/gfxmenu/gui_circular_progress.c 2013-04-19 03:51:38.075342193 +0400 @@ -223,6 +223,32 @@ self->end = end; } +static int +parse_angle (const char *value) +{ + int pos = 0; + int len = grub_strlen (value); + int angle = grub_strtol (value, 0, 10); + /* Find space symbol */ + while (pos < len && value[pos] != ' ') + pos++; + /* Skip spaces */ + while (pos < len && value[pos] == ' ') + pos++; + if (pos < len) + { + char *unit = grub_new_substring (value, pos, len); + if (!unit) + return angle; + if (grub_strcmp (unit, "deg") == 0) + angle = angle * 64 / 90; + else if (grub_strcmp (unit, "rad") == 0) + angle = angle * 64 / 100; + grub_free (unit); + } + return angle; +} + static grub_err_t circprog_set_property (void *vself, const char *name, const char *value) { @@ -233,7 +259,7 @@ } else if (grub_strcmp (name, "start_angle") == 0) { - self->start_angle = grub_strtol (value, 0, 10); + self->start_angle = parse_angle(value); } else if (grub_strcmp (name, "ticks_disappear") == 0) { --nextPart7637622.Yt4V8Gfgpm--