asset menu size fixups, new picons+prefs, more timecode del, stretch scrollbars,...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / awindowgui.C
index 049be4e800db38161dae1d66956334e51dec23fe..e1c34a578d8969996d60e7f58f99850890bab02e 100644 (file)
@@ -35,6 +35,7 @@
 #include "cwindow.h"
 #include "edl.h"
 #include "edlsession.h"
+#include "effectlist.h"
 #include "file.h"
 #include "filesystem.h"
 #include "folderlistmenu.h"
@@ -279,7 +280,11 @@ void AssetPicon::create_objects()
                                                        asset->width, asset->height,
                                                        BC_RGB888, -1);
                                        }
-
+                                       { char string[BCTEXTLEN];
+                                       sprintf(string, _("Reading %s"), name);
+                                       mwindow->gui->lock_window("AssetPicon::create_objects");
+                                       mwindow->gui->show_message(string);
+                                       mwindow->gui->unlock_window(); }
                                        file->read_frame(gui->temp_picon);
                                        if( debug ) printf("AssetPicon::create_objects %d\n", __LINE__);
                                        mwindow->video_cache->check_in(asset);
@@ -338,7 +343,7 @@ void AssetPicon::create_objects()
        }
        else
        if( plugin ) {
-               strcpy(name, _(plugin->title));
+               strcpy(name,  plugin->title);
                set_text(name);
                icon_vframe = plugin->get_picon();
                if( icon_vframe )
@@ -434,6 +439,7 @@ AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
        plugin_visibility = ((uint64_t)1<<(8*sizeof(uint64_t)-1))-1;
        newfolder_thread = 0;
        asset_menu = 0;
+       effectlist_menu = 0;
        assetlist_menu = 0;
        cliplist_menu = 0;
        labellist_menu = 0;
@@ -477,6 +483,7 @@ AWindowGUI::~AWindowGUI()
        delete asset_menu;
        delete clip_menu;
        delete label_menu;
+       delete effectlist_menu;
        delete assetlist_menu;
        delete cliplist_menu;
        delete labellist_menu;
@@ -630,6 +637,8 @@ SET_TRACE
        add_subwindow(label_menu = new LabelPopup(mwindow, this));
        label_menu->create_objects();
 
+       add_subwindow(effectlist_menu = new EffectListMenu(mwindow, this));
+       effectlist_menu->create_objects();
        add_subwindow(assetlist_menu = new AssetListMenu(mwindow, this));
        assetlist_menu->create_objects();
        add_subwindow(cliplist_menu = new ClipListMenu(mwindow, this));
@@ -822,12 +831,13 @@ void AWindowRemovePlugin::handle_close_event(int result)
                mwindow->plugindb->remove(plugin);
                remove(plugin_path);
                char index_path[BCTEXTLEN];
-               sprintf(index_path, "%s/%s", mwindow->preferences->plugin_dir, PLUGIN_FILE);
+               snprintf(index_path, sizeof(index_path), "%s/%s",
+                       mwindow->preferences->plugin_dir, PLUGIN_FILE);
                remove(index_path);
                char png_path[BCTEXTLEN];
-               if( plugin->get_theme_png_path(png_path, mwindow->preferences->theme) )
+               if( plugin->get_plugin_png_path(png_path, mwindow->preferences->plugin_icons) )
                        remove(png_path);
-               if( plugin->get_theme_png_path(png_path, "picon") )
+               if( plugin->get_plugin_png_path(png_path, DEFAULT_PICON) )
                        remove(png_path);
                delete plugin;  plugin = 0;
                awindow->gui->async_update_assets();
@@ -1068,7 +1078,9 @@ void AWindowGUI::update_asset_list()
                }
        }
 
-
+       mwindow->gui->lock_window("AWindowGUI::update_asset_list");
+       mwindow->gui->default_message();
+       mwindow->gui->unlock_window();
 
 //printf("AWindowGUI::update_asset_list %d\n", __LINE__);
 
@@ -1428,21 +1440,18 @@ 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,
+ : BC_ListBox(x, y, w, h,
                mwindow->edl->session->folderlist_format == ASSETS_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
+               &gui->folders,    // Each column has an ArrayList of BC_ListBoxItems.
+               0,                // Titles for columns.  Set to 0 for no titles
                0,                // width of each column
-               1,                      // Total columns.
-               0,                    // Pixel of top of window.
-               0,                        // If this listbox is a popup window
-               LISTBOX_SINGLE,  // Select one item or multiple items
-               ICON_TOP,        // Position of icon relative to text of each item
-               1)               // Allow drags
+               1,                // Total columns.
+               0,                // Pixel of top of window.
+               0,                // If this listbox is a popup window
+               LISTBOX_SINGLE,   // Select one item or multiple items
+               ICON_TOP,         // Position of icon relative to text of each item
+               1)                // Allow drags
 {
        this->mwindow = mwindow;
        this->gui = gui;
@@ -1503,18 +1512,19 @@ AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, in
                (mwindow->edl->session->assetlist_format == ASSETS_ICONS && gui->allow_iconlisting ) ?
                        LISTBOX_ICONS : 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
-               1,                      // Total columns.
-               0,                    // Pixel of top of window.
-               0,                        // If this listbox is a popup window
-               LISTBOX_MULTIPLE,  // Select one item or multiple items
-               ICON_TOP,        // Position of icon relative to text of each item
-               1)               // Allow drag
+               gui->asset_titles,// Titles for columns.  Set to 0 for no titles
+               mwindow->edl->session->asset_columns, // width of each column
+               1,                // Total columns.
+               0,                // Pixel of top of window.
+               0,                // If this listbox is a popup window
+               LISTBOX_MULTIPLE, // Select one item or multiple items
+               ICON_TOP,         // Position of icon relative to text of each item
+               1)                // Allow drag
 {
        this->mwindow = mwindow;
        this->gui = gui;
        set_drag_scroll(0);
+       set_scroll_stretch(1, 1);
 }
 
 AWindowAssets::~AWindowAssets()
@@ -1531,6 +1541,13 @@ int AWindowAssets::button_press_event()
                BC_ListBox::deactivate_selection();
                int folder = mwindow->edl->session->awindow_folder;
                switch( folder ) {
+               case AW_AEFFECT_FOLDER:
+               case AW_VEFFECT_FOLDER:
+               case AW_ATRANSITION_FOLDER:
+               case AW_VTRANSITION_FOLDER:
+                       gui->effectlist_menu->update();
+                       gui->effectlist_menu->activate_menu();
+                       break;
                case AW_LABEL_FOLDER:
                        gui->labellist_menu->update();
                        gui->labellist_menu->activate_menu();
@@ -1539,7 +1556,7 @@ int AWindowAssets::button_press_event()
                        gui->cliplist_menu->update();
                        gui->cliplist_menu->activate_menu();
                        break;
-               default:
+               case AW_MEDIA_FOLDER:
                        gui->assetlist_menu->update_titles();
                        gui->assetlist_menu->activate_menu();
                        break;
@@ -1589,8 +1606,8 @@ int AWindowAssets::selection_changed()
                case AW_VEFFECT_FOLDER:
                case AW_ATRANSITION_FOLDER:
                case AW_VTRANSITION_FOLDER:
-                       gui->assetlist_menu->update_titles();
-                       gui->assetlist_menu->activate_menu();
+                       gui->effectlist_menu->update();
+                       gui->effectlist_menu->activate_menu();
                        break;
                case AW_LABEL_FOLDER:
                        if( !item->label ) break;
@@ -1867,7 +1884,9 @@ AWindowInfo::AWindowInfo(MWindow *mwindow, AWindowGUI *gui, int x, int y)
 
 int AWindowInfo::handle_event()
 {
-       gui->awindow->asset_edit->edit_asset(gui->selected_asset());
+       int cur_x, cur_y;
+       gui->get_abs_cursor_xy(cur_x, cur_y, 0);
+       gui->awindow->asset_edit->edit_asset(gui->selected_asset(), cur_x, cur_y);
        return 1;
 }
 
@@ -2021,15 +2040,15 @@ int AVIconDrawing::handle_event()
 }
 
 
-AWindowListFormat::AWindowListFormat(MWindow *mwindow)
+AWindowListFormat::AWindowListFormat(MWindow *mwindow, AWindowGUI *gui)
  : BC_MenuItem("")
 {
        this->mwindow = mwindow;
+       this->gui = gui;
 }
 
 int AWindowListFormat::handle_event()
 {
-       AWindowGUI *gui = mwindow->awindow->gui;
        gui->stop_vicon_drawing();
 
        EDLSession *session = mwindow->edl->session;
@@ -2057,15 +2076,15 @@ void AWindowListFormat::update()
                 (char*)_("Display icons") : (char*)_("Display text"));
 }
 
-AWindowListSort::AWindowListSort(MWindow *mwindow)
+AWindowListSort::AWindowListSort(MWindow *mwindow, AWindowGUI *gui)
  : BC_MenuItem(_("Sort items"))
 {
        this->mwindow = mwindow;
+       this->gui = gui;
 }
 
 int AWindowListSort::handle_event()
 {
-       AWindowGUI *gui = mwindow->awindow->gui;
        gui->sort_assets();
        return 1;
 }