X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fawindowgui.C;h=0a8fcf26566b8ec8417e9d91f85bff069fae5287;hp=95c8056ff6f8d00e971e855353623950ecad7785;hb=9e779f63289f91f132569a933ddc93f4c1487751;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 95c8056f..0a8fcf26 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -397,16 +397,10 @@ void AssetPicon::create_objects() AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow) - : BC_Window(PROGRAM_NAME ": Resources", - mwindow->session->awindow_x, - mwindow->session->awindow_y, - mwindow->session->awindow_w, - mwindow->session->awindow_h, - 100, - 100, - 1, - 1, - 1) + : BC_Window(_(PROGRAM_NAME ": Resources"), + mwindow->session->awindow_x, mwindow->session->awindow_y, + mwindow->session->awindow_w, mwindow->session->awindow_h, + 100, 100, 1, 1, 1) { // printf("AWindowGUI::AWindowGUI %d %d %d %d\n", // mwindow->session->awindow_x, @@ -542,25 +536,19 @@ SET_TRACE SET_TRACE // Mandatory folders - folders.append(picon = new AssetPicon(mwindow, - this, - AEFFECT_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, AEFFECT_FOLDER)); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, - this, - VEFFECT_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, VEFFECT_FOLDER)); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, - this, - ATRANSITION_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, ATRANSITION_FOLDER)); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, - this, - VTRANSITION_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, VTRANSITION_FOLDER)); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, - this, - LABEL_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, LABEL_FOLDER)); + picon->persistent = 1; + folders.append(picon = new AssetPicon(mwindow, this, CLIP_FOLDER)); + picon->persistent = 1; + folders.append(picon = new AssetPicon(mwindow, this, MEDIA_FOLDER)); picon->persistent = 1; create_label_folder(); @@ -597,7 +585,7 @@ SET_TRACE VFrame **images = mwindow->theme->get_image_set("playpatch_data"); AVIconDrawing::calculate_geometry(this, images, &avicon_w, &avicon_h); add_subwindow(avicon_drawing = new AVIconDrawing(this, fw-avicon_w, fy, images)); - add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, "Visibility")); + add_subwindow(add_tools = new AddTools(mwindow, this, fx, fy, _("Visibility"))); add_tools->create_objects(); fy += add_tools->get_h(); fh -= add_tools->get_h(); SET_TRACE @@ -684,38 +672,9 @@ int AWindowGUI::translation_event() void AWindowGUI::reposition_objects() { - int wmax = mwindow->session->awindow_w-mwindow->theme->adivider_w; - int x = mwindow->theme->afolders_x; - int w = mwindow->theme->afolders_w; - if (w > wmax) - w = wmax; - if (w <= 0) - w = 1; - folder_list->reposition_window(x, mwindow->theme->afolders_y, - w, mwindow->theme->afolders_h); - x = mwindow->theme->adivider_x; - if (x > wmax) - x = wmax; - if (x < 0) - x = 0; - divider->reposition_window(x, - mwindow->theme->adivider_y, - mwindow->theme->adivider_w, - mwindow->theme->adivider_h); - int x2 = mwindow->theme->alist_x; - if (x2 < x+mwindow->theme->adivider_w) - x2 = x+mwindow->theme->adivider_w; - w = mwindow->theme->alist_w; - if (w > wmax) - w = wmax; - if (w <= 0) - w = 1; - asset_list->reposition_window(x2, mwindow->theme->alist_y, - w, mwindow->theme->alist_h); - mwindow->theme->get_awindow_sizes(this); asset_list->reposition_window( mwindow->theme->alist_x, mwindow->theme->alist_y, - mwindow->theme->alist_w, mwindow->theme->alist_h); + mwindow->theme->alist_w, mwindow->theme->alist_h); divider->reposition_window( mwindow->theme->adivider_x, mwindow->theme->adivider_y, mwindow->theme->adivider_w, mwindow->theme->adivider_h); @@ -773,7 +732,7 @@ void AWindowGUI::stop_vicon_drawing() AWindowRemovePluginGUI:: AWindowRemovePluginGUI(AWindow *awindow, AWindowRemovePlugin *thread, int x, int y, PluginServer *plugin) - : BC_Window(PROGRAM_NAME ": Remove plugin", x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1) + : BC_Window(_(PROGRAM_NAME ": Remove plugin"), x,y, 500,200, 50, 50, 1, 0, 1, -1, "", 1) { this->awindow = awindow; this->thread = thread; @@ -826,7 +785,7 @@ int AWindowRemovePlugin::remove_plugin(PluginServer *plugin, ArrayListpath); + printf(_("remove %s\n"), plugin->path); ArrayList *folder = plugin->audio ? plugin->transition ? &awindow->gui->atransitions : @@ -840,7 +799,6 @@ void AWindowRemovePlugin::handle_close_event(int result) strcpy(plugin_path, plugin->path); MWindow *mwindow = awindow->mwindow; mwindow->plugindb->remove(plugin); - delete plugin; plugin = 0; remove(plugin_path); char index_path[BCTEXTLEN]; sprintf(index_path, "%s/%s", mwindow->preferences->plugin_dir, PLUGIN_FILE); @@ -850,6 +808,7 @@ void AWindowRemovePlugin::handle_close_event(int result) remove(png_path); if( plugin->get_theme_png_path(png_path, "picon") ) remove(png_path); + delete plugin; plugin = 0; awindow->gui->async_update_assets(); } } @@ -908,11 +867,10 @@ int AWindowGUI::create_custom_xatoms() } int AWindowGUI::recieve_custom_xatoms(xatom_event *event) { - if (event->message_type == UpdateAssetsXAtom) - { + if( event->message_type == UpdateAssetsXAtom ) { update_assets(); return 1; - } else + } return 0; } @@ -1364,6 +1322,7 @@ void AWindowGUI::update_assets() asset_list->get_yposition(), -1, 0); + asset_list->center_selection(); //printf("AWindowGUI::update_assets 7\n"); flush(); @@ -1461,7 +1420,12 @@ int AWindowDivider::cursor_motion_event() { if(mwindow->session->current_operation == DRAG_PARTITION) { - mwindow->session->afolders_w = gui->get_relative_cursor_x(); + int wmin = 25; + int wmax = mwindow->session->awindow_w - mwindow->theme->adivider_w - wmin; + int fw = gui->get_relative_cursor_x(); + if( fw > wmax ) fw = wmax; + if( fw < wmin ) fw = wmin; + mwindow->session->afolders_w = fw; mwindow->theme->get_awindow_sizes(gui); gui->reposition_objects(); gui->flush(); @@ -1517,12 +1481,6 @@ int AWindowFolders::selection_changed() { gui->stop_vicon_drawing(); - if(get_button_down() && get_buttonpress() == 3) - { - gui->folderlist_menu->update_titles(); - gui->folderlist_menu->activate_menu(); - } - strcpy(mwindow->edl->session->current_folder, picon->get_text()); //printf("AWindowFolders::selection_changed 1\n"); gui->asset_list->draw_background(); @@ -1535,21 +1493,20 @@ int AWindowFolders::selection_changed() int AWindowFolders::button_press_event() { - int result = 0; - - result = BC_ListBox::button_press_event(); + return BC_ListBox::button_press_event(); +} - if(!result) +int AWindowFolders::button_release_event() +{ + int result = 0; + if(get_buttonpress() == 3 && is_event_win() && cursor_inside()) { - if(get_buttonpress() == 3 && is_event_win() && cursor_inside()) - { - gui->folderlist_menu->update_titles(); - gui->folderlist_menu->activate_menu(); - result = 1; - } + gui->folderlist_menu->update_titles(); + gui->folderlist_menu->activate_menu(); + result = 1; } - - + else + result = BC_ListBox::button_release_event(); return result; } @@ -1558,7 +1515,6 @@ int AWindowFolders::button_press_event() - AWindowAssets::AWindowAssets(MWindow *mwindow, AWindowGUI *gui, int x, int y, int w, int h) : BC_ListBox(x, y, @@ -1587,19 +1543,33 @@ AWindowAssets::~AWindowAssets() int AWindowAssets::button_press_event() { - int result = 0; - - result = BC_ListBox::button_press_event(); + return BC_ListBox::button_press_event(); +} - if(!result && get_buttonpress() == 3 && is_event_win() && cursor_inside()) - { - BC_ListBox::deactivate_selection(); - gui->assetlist_menu->update_titles(); - gui->assetlist_menu->activate_menu(); +int AWindowAssets::button_release_event() +{ + int result = 0; + if(get_buttonpress() == 3 && is_event_win() && cursor_inside()) { + if( !strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) || + !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) || + !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) || + !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER)) { + BC_ListBox::deactivate_selection(); + gui->assetlist_menu->update_titles(); + gui->assetlist_menu->activate_menu(); + } + else if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) { + gui->label_menu->update(); + gui->label_menu->activate_menu(); + } + else { + gui->asset_menu->update(); + gui->asset_menu->activate_menu(); + } result = 1; } - - + else + result = BC_ListBox::button_release_event(); return result; } @@ -1607,79 +1577,31 @@ int AWindowAssets::button_press_event() int AWindowAssets::handle_event() { //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0)); - if(get_selection(0, 0)) - { - if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER)) - { - } - else - if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER)) - { - } - else - if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER)) - { - } - else - if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER)) - { - } - else - if(mwindow->vwindows.size()) - { + AssetPicon *asset_picon = (AssetPicon *)get_selection(0, 0); + if( !asset_picon ) return 0; + const char *folder = mwindow->edl->session->current_folder; + if( !strcasecmp(folder, AEFFECT_FOLDER) ) return 1; + if( !strcasecmp(folder, VEFFECT_FOLDER) ) return 1; + if( !strcasecmp(folder, ATRANSITION_FOLDER) ) return 1; + if( !strcasecmp(folder, VTRANSITION_FOLDER) ) return 1; + VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ? + mwindow->vwindows.get(DEFAULT_VWINDOW) : 0; + if( !vwindow || !vwindow->is_running() ) return 1; //printf("AWindowAssets::handle_event 2 %d %d\n", get_buttonpress(), get_selection(0, 0)); - mwindow->vwindows.get(DEFAULT_VWINDOW)->gui->lock_window("AWindowAssets::handle_event"); - - if(((AssetPicon*)get_selection(0, 0))->indexable) - mwindow->vwindows.get(DEFAULT_VWINDOW)->change_source(((AssetPicon*)get_selection(0, 0))->indexable); - else - if(((AssetPicon*)get_selection(0, 0))->edl) - mwindow->vwindows.get(DEFAULT_VWINDOW)->change_source(((AssetPicon*)get_selection(0, 0))->edl); - - mwindow->vwindows.get(DEFAULT_VWINDOW)->gui->unlock_window(); - } - return 1; - } - return 0; + vwindow->gui->lock_window("AWindowAssets::handle_event"); + if( asset_picon->indexable ) + vwindow->change_source(asset_picon->indexable); + else if( asset_picon->edl ) + vwindow->change_source(asset_picon->edl); + vwindow->gui->unlock_window(); + return 1; } int AWindowAssets::selection_changed() { // Show popup window - if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0)) - { - if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) || - !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) || - !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) || - !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER)) - { - gui->assetlist_menu->update_titles(); - gui->assetlist_menu->activate_menu(); - } - else - if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) - { - if(((AssetPicon*)get_selection(0, 0))->label) - gui->label_menu->activate_menu(); - } - else - { - if(((AssetPicon*)get_selection(0, 0))->indexable) - gui->asset_menu->update(); - else - if(((AssetPicon*)get_selection(0, 0))->edl) - gui->asset_menu->update(); - - - - gui->asset_menu->activate_menu(); - } - - BC_ListBox::deactivate_selection(); - return 1; - } - else if( get_button_down() && get_buttonpress() == 1 && get_selection(0, 0) ) { + if( get_button_down() && get_buttonpress() == 1 && get_selection(0, 0) ) { VIcon *vicon = 0; if( !gui->vicon_thread->viewing ) { AssetPicon *picon = (AssetPicon*)get_selection(0, 0); @@ -1781,6 +1703,7 @@ int AWindowAssets::drag_motion_event() for(int i = 0; i < mwindow->vwindows.size(); i++) { VWindow *vwindow = mwindow->vwindows.get(i); + if( !vwindow->is_running() ) continue; vwindow->gui->lock_window("AWindowAssets::drag_motion_event"); vwindow->gui->drag_motion(); vwindow->gui->unlock_window(); @@ -1814,6 +1737,7 @@ int AWindowAssets::drag_stop_event() for(int i = 0; i < mwindow->vwindows.size(); i++) { VWindow *vwindow = mwindow->vwindows.get(i); + if( !vwindow->is_running() ) continue; vwindow->gui->lock_window("AWindowAssets::drag_stop_event"); result = vwindow->gui->drag_stop(); vwindow->gui->unlock_window(); @@ -1843,17 +1767,16 @@ int AWindowAssets::column_resize_event() return 1; } -int AWindowAssets::cursor_enter_event() +int AWindowAssets::focus_in_event() { - int ret = BC_ListBox::cursor_enter_event(); gui->start_vicon_drawing(); - return ret; + return 0; } -int AWindowAssets::cursor_leave_event() +int AWindowAssets::focus_out_event() { gui->stop_vicon_drawing(); - return BC_ListBox::cursor_leave_event(); + return BC_ListBox::focus_out_event(); } @@ -2025,6 +1948,11 @@ void LabelPopup::create_objects() add_item(editlabel = new LabelPopupEdit(mwindow, this)); } +int LabelPopup::update() +{ + gui->collect_assets(); + return 0; +}