From: Vladimir Testov <vladimir.testov@rosalab.ru>
To: grub-devel@gnu.org
Subject: [PATCH] [5/?] grub-core/gfxmenu/gui_list.c - print scrollbar in separate viewport
Date: Wed, 17 Jul 2013 22:05:11 +0400 [thread overview]
Message-ID: <76340047.CLFMpyTXpM@icedphoenix> (raw)
[-- Attachment #1: Type: text/plain, Size: 551 bytes --]
Changelog entry: grub-core/gfxmenu/gui_list.c: print scrollbar in separate
viewport
Print the scrollbar in the separate viewport. Patch makes it clear where
exactly the scrollbar will be drawn. Also it simplifies the drawing of the
scrollbar.
scrollbar thumb and frame processing has been fixed. Now we can use any kind of
styled box for thumb and frame.
scrollbar_width is total width of the scrollbar
backward compatibility is contained
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
[-- Attachment #2: grub-list-scrollbar-print-in-viewport.patch --]
[-- Type: text/x-patch, Size: 3347 bytes --]
diff -Naur grub-new4/grub-core/gfxmenu/gui_list.c grub-new5/grub-core/gfxmenu/gui_list.c
--- grub-new4/grub-core/gfxmenu/gui_list.c 2013-07-15 16:36:34.544169956 +0400
+++ grub-new5/grub-core/gfxmenu/gui_list.c 2013-07-17 18:57:56.597740755 +0400
@@ -211,7 +211,7 @@
static void
draw_scrollbar (list_impl_t self,
int value, int extent, int min, int max,
- int rightx, int topy, int height)
+ int scrollbar_width, int scrollbar_height)
{
grub_gfxmenu_box_t frame = self->scrollbar_frame;
grub_gfxmenu_box_t thumb = self->scrollbar_thumb;
@@ -219,21 +219,23 @@
+ frame->get_bottom_pad (frame));
int frame_horizontal_pad = (frame->get_left_pad (frame)
+ frame->get_right_pad (frame));
- int tracktop = topy + frame->get_top_pad (frame);
- int tracklen = height - frame_vertical_pad;
- frame->set_content_size (frame, self->scrollbar_width, tracklen);
+ int thumb_vertical_pad = (thumb->get_top_pad (thumb)
+ + thumb->get_bottom_pad (thumb));
+ int thumb_horizontal_pad = (thumb->get_left_pad (thumb)
+ + thumb->get_right_pad (thumb));
+ int tracktop = frame->get_top_pad (frame);
+ int tracklen = scrollbar_height - frame_vertical_pad;
+ frame->set_content_size (frame,
+ scrollbar_width - frame_horizontal_pad,
+ tracklen);
int thumby = tracktop + tracklen * (value - min) / (max - min);
int thumbheight = tracklen * extent / (max - min) + 1;
thumb->set_content_size (thumb,
- self->scrollbar_width - frame_horizontal_pad,
- thumbheight - (thumb->get_top_pad (thumb)
- + thumb->get_bottom_pad (thumb)));
- frame->draw (frame,
- rightx - (self->scrollbar_width + frame_horizontal_pad),
- topy);
- thumb->draw (thumb,
- rightx - (self->scrollbar_width - frame->get_right_pad (frame)),
- thumby);
+ scrollbar_width - frame_horizontal_pad
+ - thumb_horizontal_pad,
+ thumbheight - thumb_vertical_pad);
+ frame->draw (frame, 0, 0);
+ thumb->draw (thumb, frame->get_left_pad (frame), thumby);
}
/* Draw the list of items. */
@@ -390,13 +392,19 @@
grub_gui_restore_viewport (&vpsave2);
if (drawing_scrollbar)
- draw_scrollbar (self,
- self->first_shown_index, num_shown_items,
- 0, self->view->menu->size,
- self->bounds.width - box_right_pad
- + self->scrollbar_width,
- box_top_pad,
- self->bounds.height - box_top_pad - box_bottom_pad);
+ {
+ /* Draw the scrollbar in the east slice. */
+ content_rect.x = self->bounds.width - box_right_pad;
+ content_rect.width = box_right_pad;
+
+ grub_gui_set_viewport (&content_rect, &vpsave2);
+ draw_scrollbar (self,
+ self->first_shown_index, num_shown_items,
+ 0, self->view->menu->size,
+ self->scrollbar_width,
+ content_rect.height);
+ grub_gui_restore_viewport (&vpsave2);
+ }
}
grub_gui_restore_viewport (&vpsave);
reply other threads:[~2013-07-17 18:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=76340047.CLFMpyTXpM@icedphoenix \
--to=vladimir.testov@rosalab.ru \
--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 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).