All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Testov <vladimir.testov@rosalab.ru>
To: grub-devel@gnu.org
Cc: Andrey Borzenkov <arvidjaar@gmail.com>
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	[thread overview]
Message-ID: <7857026.WXShG2GPYX@icedphoenix> (raw)
In-Reply-To: <20130419181636.0621e195@opensuse.site>

[-- 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)
     {

  reply	other threads:[~2013-04-23 10:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-12  7:27 [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities Vladimir Testov
2013-04-19 14:16 ` Andrey Borzenkov
2013-04-23 10:22   ` Vladimir Testov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-03-13 10:52 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7857026.WXShG2GPYX@icedphoenix \
    --to=vladimir.testov@rosalab.ru \
    --cc=arvidjaar@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.