X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbclistbox.C;h=e52d42fa49a1dd4a43f9174d043457a0eefa71cb;hb=21eb2e0b479adf7bf846b835e5c7d9613b6f1a6d;hp=320e98bc4d701269e2fa636f02556a2bc4c419c6;hpb=7cec2a82e63b4cbd8ce58fd98bd66eb4e7f2e826;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/bclistbox.C b/cinelerra-5.1/guicast/bclistbox.C index 320e98bc..e52d42fa 100644 --- a/cinelerra-5.1/guicast/bclistbox.C +++ b/cinelerra-5.1/guicast/bclistbox.C @@ -656,8 +656,8 @@ void BC_ListBox::calculate_item_coords_recursive( if( temp_display_format == LISTBOX_ICON_LIST ) { for( int i=0; iicon ) { - if( data[0].get(i)->icon->get_h() > row_height ) - row_height = data[0].get(i)->icon->get_h(); + int icon_h = data[0].get(i)->icon->get_h() + 2*ICON_MARGIN; + if( row_height < icon_h ) row_height = icon_h; } } } @@ -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); - y = get_item_y(item); - w = get_icon_w(item) + ICON_MARGIN * 2; - h = get_icon_h(item) + ICON_MARGIN * 2; + 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; } @@ -2135,6 +2150,14 @@ int BC_ListBox::get_cursor_item(ArrayList *data, int cursor_x, return -1; } +// short version +int BC_ListBox::get_cursor_item() +{ + int rx, ry; + gui->get_relative_cursor(rx, ry); + return get_cursor_item(data, rx, ry, 0, 0); +} + int BC_ListBox::repeat_event(int64_t duration) { switch( current_operation ) { @@ -2695,7 +2718,6 @@ int BC_ListBox::button_press_event() int BC_ListBox::button_release_event() { int result = 0; - int cursor_x, cursor_y; int do_event = 0; new_value = 0; unset_scroll_repeat(); @@ -2718,11 +2740,7 @@ int BC_ListBox::button_release_event() //printf("BC_ListBox::button_release_event 10\n"); current_operation = NO_OPERATION; if( gui ) { - translate_coordinates(top_level->event_win, gui->win, - gui->get_cursor_x(), gui->get_cursor_y(), - &cursor_x, &cursor_y); - selection_number1 = selection_number = - get_cursor_item(data, cursor_x, cursor_y); + selection_number1 = selection_number = get_cursor_item(); //printf("BC_ListBox::button_release_event %d %d\n", selection_number2, selection_number1); } @@ -3691,16 +3709,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); @@ -3818,8 +3837,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; } }