olaf updates neophyte theme, keypad numlock tweaks
[goodguy/history.git] / cinelerra-5.1 / cinelerra / awindowgui.C
index e7f8e7bee9daf24980b67d1314079838394ab733..4b9a912d3fd8774f77b23ef2cd38393d156560e2 100644 (file)
@@ -134,6 +134,15 @@ VFrame *AssetVIcon::frame()
                temp->draw_line(x,0, x,vh);
                return temp;
        }
+       int ww = picon->gui->vicon_thread->view_w;
+       int hh = picon->gui->vicon_thread->view_h;
+       if( !asset->video_data ) {
+               if( !temp ) {
+                       temp = new VFrame(0, -1, ww, hh, BC_RGB888, -1);
+                       temp->clear_frame();
+               }
+               return temp;
+       }
        if( seq_no >= images.size() ) {
                MWindow *mwindow = picon->mwindow;
                File *file = mwindow->video_cache->check_out(asset, mwindow->edl, 1);
@@ -143,8 +152,6 @@ VFrame *AssetVIcon::frame()
                }
                if( !temp )
                        temp = new VFrame(0, -1, asset->width, asset->height, BC_RGB888, -1);
-               int ww = picon->gui->vicon_thread->view_w;
-               int hh = picon->gui->vicon_thread->view_h;
                while( seq_no >= images.size() ) {
                        file->set_layer(0);
                        int64_t pos = images.size() / picon->gui->vicon_thread->refresh_rate * frame_rate;
@@ -1195,6 +1202,39 @@ void AWindowGUI::stop_vicon_drawing()
        vicon_thread->stop_drawing();
 }
 
+int AWindowGUI::cycle_assetlist_format()
+{
+       EDLSession *session = mwindow->edl->session;
+       int format = ASSETS_TEXT;
+       if( allow_iconlisting ) {
+               switch( session->assetlist_format ) {
+               case ASSETS_TEXT:
+                       format = ASSETS_ICONS;
+                       break;
+               case ASSETS_ICONS:
+                       format = ASSETS_ICONS_PACKED;
+                       break;
+               case ASSETS_ICONS_PACKED:
+                       format = ASSETS_ICON_LIST;
+                       break;
+               case ASSETS_ICON_LIST:
+                       format = ASSETS_TEXT;
+                       break;
+               }
+       }
+       stop_vicon_drawing();
+       session->assetlist_format = format;
+       asset_list->update_format(session->assetlist_format, 0);
+       int x0 = 0;
+       int x1 = asset_list->get_w();
+       int y0 = asset_list->get_title_h();
+       int y1 = asset_list->get_h();
+       vicon_thread->set_drawing_area(x0,y0, x1,y1);
+       async_update_assets();
+       start_vicon_drawing();
+       return 1;
+}
+
 AWindowRemovePluginGUI::
 AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread,
        int x, int y, PluginServer *plugin)
@@ -1330,6 +1370,8 @@ int AWindowGUI::keypress_event()
                        return 1;
                }
                break;
+       case 'v':
+               return cycle_assetlist_format();
        case DELETE:
                if( shift_down() ) {
                        PluginServer* plugin = selected_plugin();
@@ -2605,7 +2647,7 @@ int AVIconDrawing::handle_event()
 
 
 AWindowListFormat::AWindowListFormat(MWindow *mwindow, AWindowGUI *gui)
- : BC_MenuItem("")
+ : BC_MenuItem("","v",'v')
 {
        this->mwindow = mwindow;
        this->gui = gui;
@@ -2613,37 +2655,7 @@ AWindowListFormat::AWindowListFormat(MWindow *mwindow, AWindowGUI *gui)
 
 int AWindowListFormat::handle_event()
 {
-       gui->stop_vicon_drawing();
-
-       EDLSession *session = mwindow->edl->session;
-       if( mwindow->awindow->gui->allow_iconlisting ) {
-               switch( session->assetlist_format ) {
-               case ASSETS_TEXT:
-                       session->assetlist_format = ASSETS_ICONS;
-                       break;
-               case ASSETS_ICONS:
-                       session->assetlist_format = ASSETS_ICONS_PACKED;
-                       break;
-               case ASSETS_ICONS_PACKED:
-                       session->assetlist_format = ASSETS_ICON_LIST;
-                       break;
-               case ASSETS_ICON_LIST:
-                       session->assetlist_format = ASSETS_TEXT;
-                       break;
-               }
-       }
-       else
-               mwindow->edl->session->assetlist_format = ASSETS_TEXT;
-       gui->asset_list->update_format(session->assetlist_format, 0);
-       int x0 = 0;
-       int x1 = gui->asset_list->get_w();
-       int y0 = gui->asset_list->get_title_h();
-       int y1 = gui->asset_list->get_h();
-       gui->vicon_thread->set_drawing_area(x0,y0, x1,y1);
-
-       gui->async_update_assets();
-       gui->start_vicon_drawing();
-       return 1;
+       return gui->cycle_assetlist_format();
 }
 
 void AWindowListFormat::update()