* [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities
@ 2013-03-13 10:52 Vladimir Testov
2013-03-15 16:52 ` Andrey Borzenkov
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Vladimir Testov @ 2013-03-13 10:52 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 451 bytes --]
In current state, start angle is measured in "parrots", where 1 "parrot" = 1 /
256 of full circle.
With simple patch we can set start angle in degrees (which makes no difference
for the program, but makes configuration to be more user-friendly)
theme.txt:
before:
start_angle = -64
after:
start_angle = -90
nothing else is affected
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
[-- Attachment #2: grub-2.00-parrots-to-degrees.patch --]
[-- Type: text/x-patch, Size: 575 bytes --]
diff -Naur grub-new2/grub-core/gfxmenu/gui_circular_progress.c grub-new3/grub-core/gfxmenu/gui_circular_progress.c
--- grub-new2/grub-core/gfxmenu/gui_circular_progress.c 2013-03-11 12:52:06.000000000 +0400
+++ grub-new3/grub-core/gfxmenu/gui_circular_progress.c 2013-03-11 16:01:08.585385148 +0400
@@ -233,7 +233,7 @@
}
else if (grub_strcmp (name, "start_angle") == 0)
{
- self->start_angle = grub_strtol (value, 0, 10);
+ self->start_angle = grub_strtol (value, 0, 10) * 64 / 90;
}
else if (grub_strcmp (name, "ticks_disappear") == 0)
{
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities
2013-03-13 10:52 [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities Vladimir Testov
@ 2013-03-15 16:52 ` Andrey Borzenkov
2013-03-15 17:56 ` Lennart Sorensen
2013-03-19 7:00 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-03-19 6:57 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-04-11 15:48 ` Vladimir Testov
2 siblings, 2 replies; 12+ messages in thread
From: Andrey Borzenkov @ 2013-03-15 16:52 UTC (permalink / raw)
To: grub-devel
В Wed, 13 Mar 2013 14:52:13 +0400
Vladimir Testov <vladimir.testov@rosalab.ru> пишет:
> In current state, start angle is measured in "parrots", where 1 "parrot" = 1 /
> 256 of full circle.
>
> With simple patch we can set start angle in degrees (which makes no difference
> for the program, but makes configuration to be more user-friendly)
>
This has compatibility issue and probably cannot be done without
introducing theme file format version.
What about adding new parameter name instead (although start_angle_angle
looks rather silly)?
>
> theme.txt:
>
> before:
> start_angle = -64
> after:
> start_angle = -90
>
> nothing else is affected
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities
2013-03-15 16:52 ` Andrey Borzenkov
@ 2013-03-15 17:56 ` Lennart Sorensen
2013-03-19 7:01 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-03-19 7:00 ` Vladimir 'φ-coder/phcoder' Serbinenko
1 sibling, 1 reply; 12+ messages in thread
From: Lennart Sorensen @ 2013-03-15 17:56 UTC (permalink / raw)
To: The development of GNU GRUB
On Fri, Mar 15, 2013 at 08:52:08PM +0400, Andrey Borzenkov wrote:
> В Wed, 13 Mar 2013 14:52:13 +0400
> Vladimir Testov <vladimir.testov@rosalab.ru> пишет:
>
> > In current state, start angle is measured in "parrots", where 1 "parrot" = 1 /
> > 256 of full circle.
> >
> > With simple patch we can set start angle in degrees (which makes no difference
> > for the program, but makes configuration to be more user-friendly)
> >
>
> This has compatibility issue and probably cannot be done without
> introducing theme file format version.
>
> What about adding new parameter name instead (although start_angle_angle
> looks rather silly)?
start_angle_degrees?
Could have start_angle_radians too (although it would need floating
point to be useful).
Could even have start_angle_gradians
--
Len Sorensen
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities
2013-03-15 17:56 ` Lennart Sorensen
@ 2013-03-19 7:01 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 0 replies; 12+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-03-19 7:01 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]
On 15.03.2013 18:56, Lennart Sorensen wrote:
> On Fri, Mar 15, 2013 at 08:52:08PM +0400, Andrey Borzenkov wrote:
>> В Wed, 13 Mar 2013 14:52:13 +0400
>> Vladimir Testov <vladimir.testov@rosalab.ru> пишет:
>>
>>> In current state, start angle is measured in "parrots", where 1 "parrot" = 1 /
>>> 256 of full circle.
>>>
>>> With simple patch we can set start angle in degrees (which makes no difference
>>> for the program, but makes configuration to be more user-friendly)
>>>
>>
>> This has compatibility issue and probably cannot be done without
>> introducing theme file format version.
>>
>> What about adding new parameter name instead (although start_angle_angle
>> looks rather silly)?
>
> start_angle_degrees?
>
> Could have start_angle_radians too (although it would need floating
> point to be useful).
GRUB doesn't use floats at all as it would decrease compatibility and
brings nothing useful to us.
>
> Could even have start_angle_gradians
>
This would be featuritus
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities
2013-03-15 16:52 ` Andrey Borzenkov
2013-03-15 17:56 ` Lennart Sorensen
@ 2013-03-19 7:00 ` Vladimir 'φ-coder/phcoder' Serbinenko
1 sibling, 0 replies; 12+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-03-19 7:00 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 1196 bytes --]
On 15.03.2013 17:52, Andrey Borzenkov wrote:
> В Wed, 13 Mar 2013 14:52:13 +0400
> Vladimir Testov <vladimir.testov@rosalab.ru> пишет:
>
>> In current state, start angle is measured in "parrots", where 1 "parrot" = 1 /
>> 256 of full circle.
>>
>> With simple patch we can set start angle in degrees (which makes no difference
>> for the program, but makes configuration to be more user-friendly)
>>
>
> This has compatibility issue and probably cannot be done without
> introducing theme file format version.
>
> What about adding new parameter name instead (although start_angle_angle
> looks rather silly)?
>
It would be better to have some kind of angle format. I think it would
be reasonable to use:
start_angle = 90°;
The only problem is start ° is a non-ASCII character and while GRUB
handles those fine, it is easily corrupted on transmission.
>>
>> theme.txt:
>>
>> before:
>> start_angle = -64
>> after:
>> start_angle = -90
>>
>> nothing else is affected
>>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities
2013-03-13 10:52 [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities Vladimir Testov
2013-03-15 16:52 ` Andrey Borzenkov
@ 2013-03-19 6:57 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-04-11 15:48 ` Vladimir Testov
2 siblings, 0 replies; 12+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2013-03-19 6:57 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 684 bytes --]
On 13.03.2013 11:52, Vladimir Testov wrote:
> In current state, start angle is measured in "parrots", where 1 "parrot" = 1 /
> 256 of full circle.
>
> With simple patch we can set start angle in degrees (which makes no difference
> for the program, but makes configuration to be more user-friendly)
>
>
> theme.txt:
>
> before:
> start_angle = -64
> after:
> start_angle = -90
>
> nothing else is affected
>
>
This breaks backward compatibility with already existing themes.
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities
2013-03-13 10:52 [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities Vladimir Testov
2013-03-15 16:52 ` Andrey Borzenkov
2013-03-19 6:57 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2013-04-11 15:48 ` Vladimir Testov
2013-04-11 15:56 ` Andrey Borzenkov
2013-04-11 16:00 ` Vladimir Testov
2 siblings, 2 replies; 12+ messages in thread
From: Vladimir Testov @ 2013-04-11 15:48 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 371 bytes --]
Like that? :)
use
start_angle = "XXX degree"
or start_angle = "XXX degrees"
for setting angle in degrees
use
start_angle = "XXX rad"
or start_angle = "XXX rads"
for setting angle int rads
or use
start_angle = XXX
for setting angle in "parrots", like it was before
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
[-- Attachment #2: grub-2.00-angle-translation.patch --]
[-- Type: text/x-patch, Size: 1400 bytes --]
diff -Naur grub-2.00/grub-core/gfxmenu/gui_circular_progress.c grub-new/grub-core/gfxmenu/gui_circular_progress.c
--- grub-2.00/grub-core/gfxmenu/gui_circular_progress.c 2010-12-01 17:45:43.000000000 +0300
+++ grub-new/grub-core/gfxmenu/gui_circular_progress.c 2013-04-11 17:51:33.242196806 +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 ((grub_strcmp (unit, "degree") == 0)
+ || (grub_strcmp (unit, "degrees") == 0))
+ angle = angle * 64 / 90;
+ else if ((grub_strcmp (unit, "rad") == 0)
+ || grub_strcmp (unit, "rads") == 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)
{
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities
2013-04-11 15:48 ` Vladimir Testov
@ 2013-04-11 15:56 ` Andrey Borzenkov
2013-04-11 16:00 ` Vladimir Testov
1 sibling, 0 replies; 12+ messages in thread
From: Andrey Borzenkov @ 2013-04-11 15:56 UTC (permalink / raw)
To: grub-devel
В Thu, 11 Apr 2013 19:48:35 +0400
Vladimir Testov <vladimir.testov@rosalab.ru> пишет:
> Like that? :)
>
> use
> start_angle = "XXX degree"
> or start_angle = "XXX degrees"
I think "XXX deg" is enough. It avoids confusion with single/plural
forms and we just need something to distinguish from plain number.
Please add also documentation for it.
> for setting angle in degrees
>
> use
> start_angle = "XXX rad"
> or start_angle = "XXX rads"
> for setting angle int rads
>
> or use
> start_angle = XXX
> for setting angle in "parrots", like it was before
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities
2013-04-11 15:48 ` Vladimir Testov
2013-04-11 15:56 ` Andrey Borzenkov
@ 2013-04-11 16:00 ` Vladimir Testov
1 sibling, 0 replies; 12+ messages in thread
From: Vladimir Testov @ 2013-04-11 16:00 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 147 bytes --]
Oh, I think that version of patch is safer.
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
[-- Attachment #2: grub-2.00-angle-translation.patch --]
[-- Type: text/x-patch, Size: 1441 bytes --]
diff -Naur grub-2.00/grub-core/gfxmenu/gui_circular_progress.c grub-new/grub-core/gfxmenu/gui_circular_progress.c
--- grub-2.00/grub-core/gfxmenu/gui_circular_progress.c 2010-12-01 17:45:43.000000000 +0300
+++ grub-new/grub-core/gfxmenu/gui_circular_progress.c 2013-04-11 19:58:24.459060324 +0400
@@ -223,6 +223,34 @@
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, "degree") == 0)
+ || (grub_strcmp (unit, "degrees") == 0))
+ angle = angle * 64 / 90;
+ else if ((grub_strcmp (unit, "rad") == 0)
+ || grub_strcmp (unit, "rads") == 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 +261,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)
{
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities
@ 2013-04-12 7:27 Vladimir Testov
2013-04-19 14:16 ` Andrey Borzenkov
0 siblings, 1 reply; 12+ messages in thread
From: Vladimir Testov @ 2013-04-12 7:27 UTC (permalink / raw)
To: grub-devel
>I think "XXX deg" is enough. It avoids confusion with single/plural
>forms and we just need something to distinguish from plain number.
Maybe we should use all three keywords - "deg", "degree", "degrees" ?
>Please add also documentation for it.
Ok. Please tell me where and how should I do it. :)
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities
2013-04-12 7:27 Vladimir Testov
@ 2013-04-19 14:16 ` Andrey Borzenkov
2013-04-23 10:22 ` Vladimir Testov
0 siblings, 1 reply; 12+ messages in thread
From: Andrey Borzenkov @ 2013-04-19 14:16 UTC (permalink / raw)
To: grub-devel
В Fri, 12 Apr 2013 11:27:21 +0400
Vladimir Testov <vladimir.testov@rosalab.ru> пишет:
> >I think "XXX deg" is enough. It avoids confusion with single/plural
> >forms and we just need something to distinguish from plain number.
>
> Maybe we should use all three keywords - "deg", "degree", "degrees" ?
>
I do not see any real need for it.
> >Please add also documentation for it.
>
> Ok. Please tell me where and how should I do it. :)
>
docs/grub.texi, section Theme file format. I assume it should go
somewhere in Component properties.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities
2013-04-19 14:16 ` Andrey Borzenkov
@ 2013-04-23 10:22 ` Vladimir Testov
0 siblings, 0 replies; 12+ messages in thread
From: Vladimir Testov @ 2013-04-23 10:22 UTC (permalink / raw)
To: grub-devel; +Cc: Andrey Borzenkov
[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]
Smth like that?
(presumed "documentation update - draft" patch is applied)
On Friday, April 19, 2013 06:16:36 PM Andrey Borzenkov wrote:
> В Fri, 12 Apr 2013 11:27:21 +0400
>
> Vladimir Testov <vladimir.testov@rosalab.ru> пишет:
> > >I think "XXX deg" is enough. It avoids confusion with single/plural
> > >forms and we just need something to distinguish from plain number.
> >
> > Maybe we should use all three keywords - "deg", "degree", "degrees" ?
>
> I do not see any real need for it.
>
> > >Please add also documentation for it.
> >
> > Ok. Please tell me where and how should I do it. :)
>
> docs/grub.texi, section Theme file format. I assume it should go
> somewhere in Component properties.
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
[-- Attachment #2: grub-angle-translation.patch --]
[-- Type: text/x-patch, Size: 2061 bytes --]
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)
{
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-04-23 10:22 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-13 10:52 [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities Vladimir Testov
2013-03-15 16:52 ` Andrey Borzenkov
2013-03-15 17:56 ` Lennart Sorensen
2013-03-19 7:01 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-03-19 7:00 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-03-19 6:57 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-04-11 15:48 ` Vladimir Testov
2013-04-11 15:56 ` Andrey Borzenkov
2013-04-11 16:00 ` Vladimir Testov
-- strict thread matches above, loose matches on Subject: below --
2013-04-12 7:27 Vladimir Testov
2013-04-19 14:16 ` Andrey Borzenkov
2013-04-23 10:22 ` Vladimir Testov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).