X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbclistbox.C;h=54bab352a6f7a6b12db02067a4b21c36b5831db3;hb=a4387a272874bd4ed9f010684976f336fa3d0190;hp=16a477bbe309d0de365f9029675516f61a3f2487;hpb=a95193c3fd88733d184f2d460eca1fe6ddf8af28;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/bclistbox.C b/cinelerra-5.1/guicast/bclistbox.C index 16a477bb..54bab352 100644 --- a/cinelerra-5.1/guicast/bclistbox.C +++ b/cinelerra-5.1/guicast/bclistbox.C @@ -918,14 +918,24 @@ int BC_ListBox::get_item_h(BC_ListBoxItem *item) } +int BC_ListBox::get_icon_x(BC_ListBoxItem *item) +{ + return get_item_x(item) + ICON_MARGIN; +} + +int BC_ListBox::get_icon_y(BC_ListBoxItem *item) +{ + return get_item_y(item) + ICON_MARGIN; +} + int BC_ListBox::get_icon_w(BC_ListBoxItem *item) { - return item->get_icon_w(); + return item->get_icon_w() + 2*ICON_MARGIN; } int BC_ListBox::get_icon_h(BC_ListBoxItem *item) { - return item->get_icon_h(); + return item->get_icon_h() + 2*ICON_MARGIN; } int BC_ListBox::get_text_w(BC_ListBoxItem *item) @@ -1041,6 +1051,11 @@ int BC_ListBox::set_xposition(int position) return 0; } +int BC_ListBox::is_highlighted() +{ + return list_highlighted; +} + void BC_ListBox::expand_item(BC_ListBoxItem *item, int expand) { if( item ) { @@ -1173,10 +1188,10 @@ int BC_ListBox::get_icon_mask(BC_ListBoxItem *item, case LISTBOX_ICONS: case LISTBOX_ICONS_PACKED: case LISTBOX_ICON_LIST: { - x = get_item_x(item) + ICON_MARGIN; - y = get_item_y(item) + ICON_MARGIN; - w = get_icon_w(item) + ICON_MARGIN; - h = get_icon_h(item) + ICON_MARGIN; + x = get_icon_x(item); + y = get_icon_y(item); + w = get_icon_w(item); + h = get_icon_h(item); break; } case LISTBOX_TEXT: default: { @@ -1200,15 +1215,15 @@ int BC_ListBox::get_text_mask(BC_ListBoxItem *item, case LISTBOX_ICONS: case LISTBOX_ICONS_PACKED: { if( icon_position == ICON_LEFT ) { - x += get_icon_w(item) + ICON_MARGIN * 2; + x += get_icon_w(item); y += get_icon_h(item) - get_text_h(item); } else { - y += get_icon_h(item) + ICON_MARGIN; + y += get_icon_h(item); } w = packed_icons ? - get_icon_w(item) + ICON_MARGIN * 4 : + get_icon_w(item) + ICON_MARGIN * 2 : get_text_w(item) + ICON_MARGIN * 2 ; h = get_text_h(item) + ICON_MARGIN * 2; break; } @@ -3137,7 +3152,8 @@ int BC_ListBox::cursor_motion_event() // Moved out of item area if( old_highlighted_item != highlighted_item ) { - redraw_items = 1; + if( !mouse_over_event(highlighted_item) ) + redraw_items = 1; } //printf("BC_ListBox::cursor_motion_event 1 %d\n", highlighted_item); @@ -3694,16 +3710,17 @@ int BC_ListBox::draw_items(int flush, int draw_bg) } // Draw icons gui->set_color(get_item_color(data, 0, i)); - if( item->icon ) - gui->pixmap->draw_pixmap(item->icon, - icon_x + ICON_MARGIN, icon_y + ICON_MARGIN); + VFrame *vicon = item->get_vicon_frame(); + if( vicon ) + gui->pixmap->draw_vframe(vicon, icon_x, icon_y); + else if( item->icon ) + gui->pixmap->draw_pixmap(item->icon, icon_x, icon_y); char item_text[BCTEXTLEN]; if( display_format == LISTBOX_ICONS_PACKED ) gui->truncate_text(item_text, item->text, text_w); else strcpy(item_text, item->text); - gui->draw_text(text_x + ICON_MARGIN, - text_y + ICON_MARGIN + get_baseline(item), item_text); + gui->draw_text(text_x, text_y + get_baseline(item), item_text); } else item->set_in_view(0); @@ -3821,8 +3838,14 @@ void BC_ListBox::draw_text_recursive(ArrayList *data, if( column == 0 && display_format == LISTBOX_ICON_LIST ) { - if( item->icon ) { - gui->pixmap->draw_pixmap(item->icon, x, y); + int ix = get_icon_x(item), iy = get_icon_y(item); + VFrame *vicon = item->get_vicon_frame(); + if( vicon ) { + gui->pixmap->draw_vframe(vicon, ix, iy); + x += vicon->get_w() + ICON_MARGIN; + } + else if( item->icon ) { + gui->pixmap->draw_pixmap(item->icon, ix, iy); x += item->icon->get_w() + ICON_MARGIN; } }