UX tiny changes Media Player

Menu for selection and batch in Player add indication of selection.
This commit is contained in:
Bruno Herbelin
2024-12-08 10:16:46 +01:00
parent edbc6190e4
commit 6027fc61dd
2 changed files with 24 additions and 20 deletions

View File

@@ -91,7 +91,7 @@ SourceControlWindow::SourceControlWindow() : WorkspaceWindow("SourceController")
min_width_(0.f), h_space_(0.f), v_space_(0.f), scrollbar_(0.f),
timeline_height_(0.f), mediaplayer_height_(0.f), buttons_width_(0.f), buttons_height_(0.f),
play_toggle_request_(false), replay_request_(false), pending_(false),
active_label_(LABEL_AUTO_MEDIA_PLAYER), active_selection_(-1),
active_label_(LABEL_PLAYER_SELECTION), active_selection_(-1),
selection_context_menu_(false), selection_mediaplayer_(nullptr), selection_target_slower_(0), selection_target_faster_(0),
mediaplayer_active_(nullptr), mediaplayer_edit_fading_(false), mediaplayer_set_duration_(0),
mediaplayer_edit_pipeline_(false), mediaplayer_mode_(false), mediaplayer_slider_pressed_(false), mediaplayer_timeline_zoom_(1.f),
@@ -118,7 +118,7 @@ void SourceControlWindow::resetActiveSelection()
{
info_.reset();
active_selection_ = -1;
active_label_ = LABEL_AUTO_MEDIA_PLAYER;
active_label_ = LABEL_PLAYER_SELECTION;
play_toggle_request_ = false;
replay_request_ = false;
capture_request_ = false;
@@ -348,23 +348,14 @@ void SourceControlWindow::Render()
bool enabled = !selection_.empty() && active_selection_ < 0;
// Menu : Dynamic selection
if (ImGui::MenuItem(LABEL_AUTO_MEDIA_PLAYER))
if (ImGui::MenuItem(LABEL_PLAYER_SELECTION, NULL, active_selection_ < 0))
resetActiveSelection();
// Menu : store selection
if (ImGui::MenuItem(ICON_FA_PLUS_CIRCLE LABEL_STORE_SELECTION, NULL, false, enabled))
{
active_selection_ = N;
active_label_ = std::string(ICON_FA_CHECK_CIRCLE " Batch #") + std::to_string(active_selection_);
Mixer::manager().session()->addBatch( ids(selection_) );
info_.reset();
}
// Menu : list of selections
if (N>0) {
ImGui::Separator();
for (size_t i = 0 ; i < N; ++i)
{
std::string label = std::string(ICON_FA_CHECK_CIRCLE " Batch #") + std::to_string(i);
if (ImGui::MenuItem( label.c_str() ))
std::string label = std::string(LABEL_PLAYER_BATCH) + std::to_string(i);
if (ImGui::MenuItem( label.c_str(), NULL, active_selection_ == (int) i ))
{
active_selection_ = i;
active_label_ = label;
@@ -372,6 +363,15 @@ void SourceControlWindow::Render()
}
}
}
// Menu : store selection
ImGui::Separator();
if (ImGui::MenuItem(ICON_FA_PLUS_CIRCLE LABEL_PLAYER_BATCH_ADD, NULL, false, enabled))
{
active_selection_ = N;
active_label_ = std::string(LABEL_PLAYER_BATCH) + std::to_string(active_selection_);
Mixer::manager().session()->addBatch( ids(selection_) );
info_.reset();
}
ImGui::EndMenu();
}
@@ -1650,7 +1650,7 @@ void SourceControlWindow::RenderSelectedSources()
float width = buttons_height_;
std::string label(ICON_FA_PLUS_CIRCLE);
if (space > buttons_width_) { // enough space to show full button with label text
label += LABEL_STORE_SELECTION;
label += LABEL_PLAYER_BATCH_ADD;
width = buttons_width_ - ImGui::GetTextLineHeightWithSpacing();
}
ImGui::SameLine(0, space -width);
@@ -1661,7 +1661,7 @@ void SourceControlWindow::RenderSelectedSources()
Mixer::manager().session()->addBatch( ids(selection_) );
}
if (space < buttons_width_ && ImGui::IsItemHovered())
ImGuiToolkit::ToolTip(LABEL_STORE_SELECTION);
ImGuiToolkit::ToolTip(LABEL_PLAYER_BATCH_ADD);
ImGui::PopStyleColor(2);
}
@@ -1770,7 +1770,7 @@ void SourceControlWindow::RenderSingleSource(Source *s)
width = buttons_width_ - ImGui::GetTextLineHeightWithSpacing();
ImGui::SameLine(0, space -width);
ImGui::SetNextItemWidth(width);
if (ImGuiToolkit::ButtonIcon( 0, 14, LABEL_ADD_TIMELINE, true, space > buttons_width_ )) {
if (ImGuiToolkit::ButtonIcon( 0, 14, LABEL_PLAYER_TIMELINE_ADD, true, space > buttons_width_ )) {
// activate mediaplayer
mediaplayer_active_ = ms->mediaplayer();

View File

@@ -256,13 +256,17 @@
#define MENU_PLAY_BEGIN ICON_FA_FAST_BACKWARD " Go to Beginning"
#define SHORTCUT_PLAY_BEGIN CTRL_MOD "B"
#define LABEL_AUTO_MEDIA_PLAYER ICON_FA_USER_CIRCLE " User selection"
#define LABEL_STORE_SELECTION " Create batch"
#define LABEL_PLAYER_SELECTION ICON_FA_USER_CIRCLE " User selection"
#define LABEL_PLAYER_BATCH ICON_FA_CHECK_CIRCLE " Batch #"
#define LABEL_PLAYER_BATCH_ADD " Add batch"
#define LABEL_PLAYER_TIMELINE_ADD "Add timeline"
#define LABEL_EDIT_FADING ICON_FA_RANDOM " Edit timeline fading"
#define LABEL_EDIT_GAPS ICON_FA_CUT " Cut timeline"
#define LABEL_VIDEO_SEQUENCE " Encode an image sequence"
#define LABEL_ADD_TIMELINE "Add timeline"
#define DIALOG_TIMELINE_DURATION ICON_FA_HOURGLASS_HALF " Set timeline duration"
#define DIALOG_GST_EFFECT "Gstreamer Video effect"
#define LABEL_SHADER_EMBEDDED ICON_FA_FILE_ALT " Embedded code"
#define LABEL_SHADER_SAVE ICON_FA_FILE_DOWNLOAD " Save as"
#define LABEL_SHADER_ADD ICON_FA_FILE_MEDICAL " Load"
#endif // VMIX_DEFINES_H