fixed height detemination
PATCH 1/11 fixed height detemination
fixed:
- get_num_shown_item
- list_get_minimal_size
- height of the selected item (it was item_height - 1)
based on patch made by Andrey Borzenkov and my own patch. (And also base on the coversation about how the menu should work)
see screenshots included for explanation of the problem 1-1 - how the styled box should look
1-2 - how it looks on the las position
1-3 - result of get_minimal_size function - we can see only one pixel (should see 5 of them) of selected_item_pixmap_style - because:
1) height of the center slice is item_height - 1
2) selected_bottom_pad hasn't been taken into account
Signature · 4 lines
With best regards, _______________________________ Vladimir Testov, ROSA Laboratory. www.rosalab.ru
Quoted 12 lines · you
fixed:
-get_num_shown_item
-list_get_minimal_size
- height of the selected item (it wasitem_height- 1)based on patch made by Andrey Borzenkov and my own patch. (And also base on the coversation about how the menu should work)
see screenshots included for explanation of the problem 1-1 - how the styled box should look
1-2 - how it looks on the las position
Quoted 9 lines
1-3 - result of
get_minimal_sizefunction - we can see only one pixel (should see 5 of them) ofselected_item_pixmap_style- because:
1) height of the center slice isitem_height- 1
2)selected_bottom_padhasn't been taken into account
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
Oups, forgot to include the patch. :)
Signature · 4 lines
With best regards, _______________________________ Vladimir Testov, ROSA Laboratory. www.rosalab.ru
grub-core/gfxmenu/gui_list.c +35 -8
@@ -98,9 +98,21 @@grub_gfxmenu_box_t box = self->menu_box;int box_top_pad = box->get_top_pad (box);int box_bottom_pad = box->get_bottom_pad (box); +grub_gfxmenu_box_t selbox = self->selected_item_box; +int sel_top_pad = selbox->get_top_pad (selbox); +int sel_bottom_pad = selbox->get_bottom_pad (selbox); -return (self->bounds.height + item_vspace -2 * boxpad - - box_top_pad - box_bottom_pad) / (item_height + item_vspace); +if (self->list_version ==0 ) + { +return (self->bounds.height + item_vspace -2 * boxpad + - box_top_pad - box_bottom_pad) / (item_height + item_vspace); + } +else + { +return (self->bounds.height + item_vspace -2 * boxpad + - sel_top_pad - sel_bottom_pad + - box_top_pad - box_bottom_pad) / (item_height + item_vspace); + } } static int
@@ -253,7 +265,10 @@int cwidth = oviewport.width -2 * boxpad -2 ;if (selbox->get_border_width) cwidth -= selbox->get_border_width (selbox); - selbox->set_content_size (selbox, cwidth, item_height -1 ); +if (self->list_version ==0 ) + selbox->set_content_size (selbox, cwidth, item_height -1 ); +else + selbox->set_content_size (selbox, cwidth, item_height); selbox->draw (selbox,0 , item_top - sel_toppad); }
@@ -393,7 +408,8 @@unsigned width_s;grub_gfxmenu_box_t selbox = self->selected_item_box; -int sel_toppad = selbox->get_top_pad (selbox); +int sel_top_pad = selbox->get_top_pad (selbox); +int sel_bottom_pad = selbox->get_bottom_pad (selbox); *width =grub_font_get_string_width (self->item_font,"Typical OS" ); width_s = grub_font_get_string_width (self->selected_item_font,
@@ -404,10 +420,21 @@ *width +=2 * boxpad + box_left_pad + box_right_pad;/* Set the menu box height to fit the items. */ - *height = (item_height * num_items - + item_vspace * (num_items -1 ) - +2 * boxpad - + box_top_pad + box_bottom_pad + sel_toppad); +if (self->list_version ==0 ) + { + *height = (item_height * num_items + + item_vspace * (num_items -1 ) + +2 * boxpad + + box_top_pad + box_bottom_pad + sel_top_pad); + } +else + { + *height = (item_height * num_items + + item_vspace * (num_items -1 ) + +2 * boxpad + + box_top_pad + box_bottom_pad + + sel_top_pad + sel_bottom_pad); + } }else {