From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UQFXf-00081f-28 for mharc-grub-devel@gnu.org; Thu, 11 Apr 2013 07:19:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQFXY-0007sR-8c for grub-devel@gnu.org; Thu, 11 Apr 2013 07:19:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQFXW-0003PN-Nl for grub-devel@gnu.org; Thu, 11 Apr 2013 07:19:40 -0400 Received: from collab.rosalab.ru ([217.199.216.181]:51379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQFXW-0003Ox-AA for grub-devel@gnu.org; Thu, 11 Apr 2013 07:19:38 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by collab.rosalab.ru (Postfix) with ESMTP id 8A28829C33C for ; Thu, 11 Apr 2013 15:19:37 +0400 (MSK) X-Virus-Scanned: amavisd-new at rosalab.ru Received: from collab.rosalab.ru ([127.0.0.1]) by localhost (collab.rosalab.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uhqrvnhLy8dH for ; Thu, 11 Apr 2013 15:19:36 +0400 (MSK) Received: from icedphoenix.localnet (unknown [10.168.1.56]) by collab.rosalab.ru (Postfix) with ESMTPSA id E4EC029C14B for ; Thu, 11 Apr 2013 15:19:36 +0400 (MSK) From: Vladimir Testov To: grub-devel@gnu.org Subject: [PATCH] [7/11] [gfxmenu/list] scrollbar padding Date: Thu, 11 Apr 2013 15:19:36 +0400 Message-ID: <3893181.cedFTOVlW5@icedphoenix> User-Agent: KMail/4.9.5 (Linux/3.5.0-26-generic; KDE/4.9.5; x86_64; ; ) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart1639863.LNvkXbjnpr" Content-Transfer-Encoding: 7Bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 217.199.216.181 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Apr 2013 11:19:45 -0000 This is a multi-part message in MIME format. --nextPart1639863.LNvkXbjnpr Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" New options to manage scrollbar's padding. Ask if it should be commented and supported with screenshots. -- With best regards, _______________________________ Vladimir Testov, ROSA Laboratory. www.rosalab.ru --nextPart1639863.LNvkXbjnpr Content-Disposition: attachment; filename="grub-2.00-list-scrollbar-padding.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="grub-2.00-list-scrollbar-padding.patch" diff -Naur grub-new7/grub-core/gfxmenu/gui_list.c grub-new8/grub-core/gfxmenu/gui_list.c --- grub-new7/grub-core/gfxmenu/gui_list.c 2013-03-28 14:56:58.157916412 +0400 +++ grub-new8/grub-core/gfxmenu/gui_list.c 2013-04-03 17:46:21.953921226 +0400 @@ -54,6 +54,10 @@ grub_gfxmenu_box_t scrollbar_frame; grub_gfxmenu_box_t scrollbar_thumb; int scrollbar_width; + int scrollbar_left_pad; + int scrollbar_right_pad; + int scrollbar_top_pad; + int scrollbar_bottom_pad; int first_shown_index; @@ -254,7 +258,11 @@ oviewport.width - 2 * boxpad, oviewport.height - 2 * boxpad); - int cwidth = oviewport.width - 2 * boxpad - 2; + int cwidth; + if (self->list_version == 0) + cwidth = oviewport.width - 2 * boxpad - 2; + else + cwidth = oviewport.width - 2 * boxpad - self->scrollbar_left_pad; if (selbox->get_border_width) cwidth -= selbox->get_border_width (selbox); if (self->list_version == 0) @@ -381,6 +389,8 @@ int drawing_scrollbar = (self->draw_scrollbar && (num_shown_items < self->view->menu->size) && check_scrollbar (self)); + if (!drawing_scrollbar) + self->scrollbar_left_pad = 0; content_rect.x = box_left_pad; content_rect.y = box_top_pad; @@ -396,7 +406,7 @@ grub_gfxmenu_box_t frame = self->scrollbar_frame; int frame_horizontal_pad = frame->get_left_pad (frame) + frame->get_right_pad (frame); - content_rect.width -= frame_horizontal_pad + self->scrollbar_width; + content_rect.width -= frame_horizontal_pad + self->scrollbar_width - self->scrollbar_right_pad; } grub_gui_set_viewport (&content_rect, &vpsave2); @@ -406,13 +416,22 @@ int rightx = self->bounds.width - box_right_pad; if (self->list_version == 0) rightx += self->scrollbar_width; + else + rightx -= self->scrollbar_right_pad; + int topy = box_top_pad; + int height = self->bounds.height - box_top_pad - box_bottom_pad; + if (self->list_version > 0) + { + topy += self->scrollbar_top_pad; + height -= self->scrollbar_top_pad + self->scrollbar_bottom_pad; + } if (drawing_scrollbar) draw_scrollbar (self, self->first_shown_index, num_shown_items, 0, self->view->menu->size, rightx, - box_top_pad, - self->bounds.height - box_top_pad - box_bottom_pad); + topy, + height); } grub_gui_restore_viewport (&vpsave); @@ -599,6 +618,22 @@ { self->scrollbar_width = grub_strtol (value, 0, 10); } + else if (grub_strcmp (name, "scrollbar_left_pad") == 0) + { + self->scrollbar_left_pad = grub_strtol (value, 0, 10); + } + else if (grub_strcmp (name, "scrollbar_right_pad") == 0) + { + self->scrollbar_right_pad = grub_strtol (value, 0, 10); + } + else if (grub_strcmp (name, "scrollbar_top_pad") == 0) + { + self->scrollbar_top_pad = grub_strtol (value, 0, 10); + } + else if (grub_strcmp (name, "scrollbar_bottom_pad") == 0) + { + self->scrollbar_bottom_pad = grub_strtol (value, 0, 10); + } else if (grub_strcmp (name, "scrollbar") == 0) { self->draw_scrollbar = grub_strcmp (value, "false") != 0; @@ -694,6 +729,10 @@ self->scrollbar_frame_pattern = 0; self->scrollbar_thumb_pattern = 0; self->scrollbar_width = 16; + self->scrollbar_left_pad = 2; + self->scrollbar_right_pad = 0; + self->scrollbar_top_pad = 0; + self->scrollbar_bottom_pad = 0; self->first_shown_index = 0; --nextPart1639863.LNvkXbjnpr--