* grub-core/gfxmenu/gui_progress_bar.c: New option `highlight_overlay
`
* docs/gurb.texi: Likewise.
This commit is contained in:
parent
9c13c57623
commit
946fd07357
3 changed files with 33 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2013-10-17 Vladimir Testov <vladimir.testov@rosalab.ru>
|
||||||
|
|
||||||
|
* grub-core/gfxmenu/gui_progress_bar.c: New option ``highlight_overlay``
|
||||||
|
* docs/gurb.texi: Likewise.
|
||||||
|
|
||||||
2013-10-17 Vladimir Testov <vladimir.testov@rosalab.ru>
|
2013-10-17 Vladimir Testov <vladimir.testov@rosalab.ru>
|
||||||
|
|
||||||
* grub-core/gfxmenu/gui_progress_bar.c (draw_pixmap_bar): Fixed bug.
|
* grub-core/gfxmenu/gui_progress_bar.c (draw_pixmap_bar): Fixed bug.
|
||||||
|
|
|
@ -2121,6 +2121,14 @@ The following is a list of the components and the properties they support.
|
||||||
Example: ``progress_hl_*.png``.
|
Example: ``progress_hl_*.png``.
|
||||||
If the value is equal to ``bar_style`` then no styled boxes
|
If the value is equal to ``bar_style`` then no styled boxes
|
||||||
will be shown.
|
will be shown.
|
||||||
|
@item highlight_overlay
|
||||||
|
@tab If this option is set to ``true`` then the highlight box
|
||||||
|
side slices (every slice except the center slice) will overlay the
|
||||||
|
frame box side slices. And the center slice of the highlight box
|
||||||
|
can move all the way (from top to bottom), being drawn on the center
|
||||||
|
slice of the frame box. That way we can make a progress bar with
|
||||||
|
round-shaped edges so there won't be a free space from the highlight to
|
||||||
|
the frame in top and bottom scrollbar positions. Default is ``false``.
|
||||||
@item font
|
@item font
|
||||||
@tab The font to use for progress bar.
|
@tab The font to use for progress bar.
|
||||||
@item text
|
@item text
|
||||||
|
|
|
@ -52,6 +52,7 @@ struct grub_gui_progress_bar
|
||||||
char *highlight_pattern;
|
char *highlight_pattern;
|
||||||
grub_gfxmenu_box_t bar_box;
|
grub_gfxmenu_box_t bar_box;
|
||||||
grub_gfxmenu_box_t highlight_box;
|
grub_gfxmenu_box_t highlight_box;
|
||||||
|
int highlight_overlay;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct grub_gui_progress_bar *grub_gui_progress_bar_t;
|
typedef struct grub_gui_progress_bar *grub_gui_progress_bar_t;
|
||||||
|
@ -152,17 +153,29 @@ draw_pixmap_bar (grub_gui_progress_bar_t self)
|
||||||
int tracklen = w - bar_h_pad;
|
int tracklen = w - bar_h_pad;
|
||||||
int trackheight = h - bar_v_pad;
|
int trackheight = h - bar_v_pad;
|
||||||
int barwidth;
|
int barwidth;
|
||||||
|
int hlheight = trackheight;
|
||||||
|
int hlx = bar_l_pad;
|
||||||
|
int hly = bar_t_pad;
|
||||||
|
|
||||||
bar->set_content_size (bar, tracklen, trackheight);
|
bar->set_content_size (bar, tracklen, trackheight);
|
||||||
bar->draw (bar, 0, 0);
|
bar->draw (bar, 0, 0);
|
||||||
|
|
||||||
|
if (self->highlight_overlay)
|
||||||
|
{
|
||||||
|
tracklen += hl_h_pad;
|
||||||
|
hlx -= hl_l_pad;
|
||||||
|
hly -= hl_t_pad;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
hlheight -= hl_v_pad;
|
||||||
|
|
||||||
barwidth = (tracklen * (self->value - self->start)
|
barwidth = (tracklen * (self->value - self->start)
|
||||||
/ (self->end - self->start));
|
/ (self->end - self->start));
|
||||||
|
|
||||||
if (barwidth >= hl_h_pad)
|
if (barwidth >= hl_h_pad)
|
||||||
{
|
{
|
||||||
hl->set_content_size (hl, barwidth - hl_h_pad, h - bar_v_pad - hl_v_pad);
|
hl->set_content_size (hl, barwidth - hl_h_pad, hlheight);
|
||||||
hl->draw (hl, bar_l_pad, bar_t_pad);
|
hl->draw (hl, hlx, hly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,6 +352,10 @@ progress_bar_set_property (void *vself, const char *name, const char *value)
|
||||||
grub_free (self->highlight_pattern);
|
grub_free (self->highlight_pattern);
|
||||||
self->highlight_pattern = value ? grub_strdup (value) : 0;
|
self->highlight_pattern = value ? grub_strdup (value) : 0;
|
||||||
}
|
}
|
||||||
|
else if (grub_strcmp (name, "highlight_overlay") == 0)
|
||||||
|
{
|
||||||
|
self->highlight_overlay = grub_strcmp (value, "true") == 0;
|
||||||
|
}
|
||||||
else if (grub_strcmp (name, "theme_dir") == 0)
|
else if (grub_strcmp (name, "theme_dir") == 0)
|
||||||
{
|
{
|
||||||
self->need_to_recreate_pixmaps = 1;
|
self->need_to_recreate_pixmaps = 1;
|
||||||
|
@ -399,6 +416,7 @@ grub_gui_progress_bar_new (void)
|
||||||
self->border_color = black;
|
self->border_color = black;
|
||||||
self->bg_color = gray;
|
self->bg_color = gray;
|
||||||
self->fg_color = lightgray;
|
self->fg_color = lightgray;
|
||||||
|
self->highlight_overlay = 0;
|
||||||
|
|
||||||
return (grub_gui_component_t) self;
|
return (grub_gui_component_t) self;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue