vicon jittering, opengl no draw_refresh if no ovly for last frame
[goodguy/history.git] / cinelerra-5.1 / guicast / bclistbox.C
index 16a477bbe309d0de365f9029675516f61a3f2487..e52d42fa49a1dd4a43f9174d043457a0eefa71cb 100644 (file)
@@ -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; }
@@ -3694,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);
@@ -3821,8 +3837,14 @@ void BC_ListBox::draw_text_recursive(ArrayList<BC_ListBoxItem*> *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;
                                }
                        }