start angle (option of circular_progress) is measured in unusual quantities
PATCH 3/4 start angle (option of circular_progress) is measured in unusual quantities
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 = -90nothing else is affected
Signature · 4 lines
With best regards, _______________________________ Vladimir Testov, ROSA Laboratory. www.rosalab.ru
grub-core/gfxmenu/gui_circular_progress.c +1 -1
@@ -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 ) {
В Wed, 13 Mar 2013 14:52:13 +0400
Vladimir Testov <[email protected]> пишет:
Quoted 6 lines
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)?
Quoted 10 lines
theme.txt:
before:
start_angle = -64 after: start_angle = -90nothing else is affected
Quoted 10 lines · Andrey Borzenkov
В Wed, 13 Mar 2013 14:52:13 +0400
Vladimir Testov <[email protected]> пишет:Quoted 6 lines
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)
Quoted 5 lines
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_anglelooks 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
Signature · 1 line
Len Sorensen
Quoted 14 lines · Lennart Sorensen
Quoted 13 lines · Andrey Borzenkov
В Wed, 13 Mar 2013 14:52:13 +0400
Vladimir Testov <[email protected]> пишет:Quoted 6 lines
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.
Quoted 7 lines
Quoted 2 lines
What about adding new parameter name instead (although
start_angle_anglelooks rather silly)?
start_angle_degrees?Could have
start_angle_radianstoo (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.
Quoted 3 lines
Could even have
start_angle_gradians
This would be featuritus
Quoted 10 lines · Andrey Borzenkov
В Wed, 13 Mar 2013 14:52:13 +0400
Vladimir Testov <[email protected]> пишет:Quoted 6 lines
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)
Quoted 6 lines
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_anglelooks 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.
Quoted 16 lines
Quoted 10 lines
theme.txt:
before:
start_angle = -64 after: start_angle = -90nothing else is affected
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 7 lines · Vladimir Testov
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)
Quoted 10 lines
theme.txt:
before:
start_angle = -64 after: start_angle = -90nothing else is affected
This breaks backward compatibility with already existing themes.
Quoted 6 lines
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Like that? :)
usestart_angle = "XXX degree" or start_angle = "XXX degrees" for setting angle in degrees
usestart_angle = "XXX rad" or start_angle = "XXX rads" for setting angle int rads
or usestart_angle = XXX
for setting angle in "parrots", like it was before
Signature · 4 lines
With best regards, _______________________________ Vladimir Testov, ROSA Laboratory. www.rosalab.ru
grub-core/gfxmenu/gui_circular_progress.c +27 -1
@@ -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 ) {
В Thu, 11 Apr 2013 19:48:35 +0400
Vladimir Testov <[email protected]> пишет:
Quoted 5 lines
Like that? :)
use
start_angle= "XXX degree"
orstart_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.
Quoted 11 lines
for setting angle in degrees
use
start_angle= "XXX rad"
orstart_angle= "XXX rads"
for setting angle int radsor use
start_angle= XXX
for setting angle in "parrots", like it was before
Oh, I think that version of patch is safer.
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
grub-core/gfxmenu/gui_circular_progress.c +29 -1
@@ -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 ) {