Skip to contentSkip to conversation

start angle (option of circular_progress) is measured in unusual quantities

PATCH Vladimir Testov 2 participants 3 messages Apr 12, 2013 – Apr 23, 2013

lore
Share & tools
lore
#0 lore raw
Quoted 2 lines

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" ?

Quoted 1 line

Please add also documentation for it.

Ok. Please tell me where and how should I do it. :)

Signature · 4 lines
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
#1 lore raw

В Fri, 12 Apr 2013 11:27:21 +0400
Vladimir Testov <[email protected]> пишет:

Quoted 5 lines
Quoted 2 lines

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.

Quoted 4 lines
Quoted 1 line

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.

#2 lore raw

Smth like that?

(presumed "documentation update - draft" patch is applied)

Quoted 21 lines · Andrey Borzenkov

В Fri, 12 Apr 2013 11:27:21 +0400

Vladimir Testov <[email protected]> пишет:

Quoted 4 lines
Quoted 2 lines

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.

Quoted 3 lines
Quoted 1 line

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
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 4 lines
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
docs/grub.texi +3 -0
diff -Naur grub-new/docs/grub.texi grub-new2/docs/grub.texi
@@ -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
grub-core/gfxmenu/gui_circular_progress.c +27 -1
diff -Naur grub-new/grub-core/gfxmenu/gui_circular_progress.c grub-new2/grub-core/gfxmenu/gui_circular_progress.c
@@ -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)
     {