add 2 asset list fmts, user title rework, added show edit, bt tweak
[goodguy/history.git] / cinelerra-5.1 / cinelerra / awindowgui.C
index 7ea4759f49fdc36d402fc243b9a5529096a12a10..e7f8e7bee9daf24980b67d1314079838394ab733 100644 (file)
@@ -171,7 +171,7 @@ int AssetVIcon::get_vx()
 int AssetVIcon::get_vy()
 {
        BC_ListBox *lbox = picon->gui->asset_list;
-       return lbox->get_item_y(picon) + lbox->get_title_h();
+       return lbox->get_item_y(picon);
 }
 
 void AssetVIcon::load_audio()
@@ -1026,6 +1026,8 @@ void AWindowGUI::create_objects()
        add_subwindow(asset_list = new AWindowAssets(mwindow, this, x1, y1, w1, h1));
 
        vicon_thread = new VIconThread(asset_list);
+       int x0 = 0, y0 = asset_list->get_title_h();
+       vicon_thread->set_drawing_area(x0,y0, get_w(),get_h());
        vicon_thread->start();
        vicon_audio = new AssetVIconAudio(this);
 
@@ -1177,8 +1179,15 @@ void AWindowGUI::start_vicon_drawing()
 {
        if( !vicon_drawing ) return;
        if( mwindow->edl->session->awindow_folder != AW_MEDIA_FOLDER ) return;
-       if( mwindow->edl->session->assetlist_format != ASSETS_ICONS ) return;
-       vicon_thread->start_drawing();
+       switch( mwindow->edl->session->assetlist_format ) {
+       case ASSETS_ICONS:
+       case ASSETS_ICONS_PACKED:
+       case ASSETS_ICON_LIST:
+               vicon_thread->start_drawing();
+               break;
+       default:
+               break;
+       }
 }
 
 void AWindowGUI::stop_vicon_drawing()
@@ -1783,6 +1792,11 @@ void AWindowGUI::update_assets()
 
        if( mwindow->edl->session->assetlist_format != asset_list->get_format() ) {
                asset_list->update_format(mwindow->edl->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);
        }
        int asset_xposition = asset_list->get_xposition();
        int asset_yposition = asset_list->get_yposition();
@@ -1910,7 +1924,7 @@ int AWindowDivider::button_release_event()
 
 AWindowFolders::AWindowFolders(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
  : BC_ListBox(x, y, w, h,
-               mwindow->edl->session->folderlist_format == ASSETS_ICONS ?
+               mwindow->edl->session->folderlist_format == FOLDERS_ICONS ?
                        LISTBOX_ICONS : LISTBOX_TEXT,
                &gui->folders,    // Each column has an ArrayList of BC_ListBoxItems.
                0,                // Titles for columns.  Set to 0 for no titles
@@ -1976,9 +1990,11 @@ int AWindowFolders::button_press_event()
 
 
 AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h)
- : BC_ListBox(x, y, w, h,
-               (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
-                       LISTBOX_ICONS : LISTBOX_TEXT,
+ : BC_ListBox(x, y, w, h, !gui->allow_iconlisting ? LISTBOX_TEXT :
+               mwindow->edl->session->assetlist_format == ASSETS_ICONS ? LISTBOX_ICONS :
+               mwindow->edl->session->assetlist_format == ASSETS_ICONS_PACKED ? LISTBOX_ICONS_PACKED :
+               mwindow->edl->session->assetlist_format == ASSETS_ICON_LIST ? LISTBOX_ICON_LIST :
+                       LISTBOX_TEXT,
                &gui->assets,     // Each column has an ArrayList of BC_ListBoxItems.
                gui->asset_titles,// Titles for columns.  Set to 0 for no titles
                mwindow->edl->session->asset_columns, // width of each column
@@ -2600,28 +2616,55 @@ int AWindowListFormat::handle_event()
        gui->stop_vicon_drawing();
 
        EDLSession *session = mwindow->edl->session;
-       switch( session->assetlist_format ) {
-       case ASSETS_TEXT:
-               session->assetlist_format = ASSETS_ICONS;
-               break;
-       case ASSETS_ICONS:
-               session->assetlist_format = ASSETS_TEXT;
-               break;
+       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;
+               }
        }
-
-       gui->asset_list->update_format(session->assetlist_format, 1);
-       if( !mwindow->awindow->gui->allow_iconlisting ) {
+       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;
 }
 
 void AWindowListFormat::update()
 {
-       set_text(mwindow->edl->session->assetlist_format == ASSETS_TEXT ?
-               (char*)_("Display icons") : (char*)_("Display text"));
+       EDLSession *session = mwindow->edl->session;
+       const char *text = 0;
+       switch( session->assetlist_format ) {
+       case ASSETS_TEXT:
+               text = _("Display icons");
+               break;
+       case ASSETS_ICONS:
+               text = _("Display icons packed");
+               break;
+       case ASSETS_ICONS_PACKED:
+               text = _("Display icon list");
+               break;
+       case ASSETS_ICON_LIST:
+               text = _("Display text");
+               break;
+       }
+       set_text(text);
 }
 
 AWindowListSort::AWindowListSort(MWindow *mwindow, AWindowGUI *gui)