mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-05 23:40:02 +01:00
Player Video Fading dialog
New dialog to apply fade in & out with parameters. Fixed Timeline fading functions. New ImGuiToolkit items to draw icons in Combo boxes.
This commit is contained in:
121
ImGuiToolkit.cpp
121
ImGuiToolkit.cpp
@@ -326,17 +326,23 @@ bool ImGuiToolkit::ComboIcon (std::vector<std::pair<int, int> > icons, std::vect
|
||||
|
||||
ImVec2 draw_pos = ImGui::GetCursorScreenPos();
|
||||
float w = ImGui::GetTextLineHeight();
|
||||
ImGui::SetNextItemWidth(w * 2.6f);
|
||||
ImGui::SetNextItemWidth(w * 2.7f);
|
||||
if (ImGui::BeginCombo("##ComboIcon", " ") )
|
||||
{
|
||||
char space_buf[] = " ";
|
||||
const ImVec2 space_size = ImGui::CalcTextSize(" ", NULL);
|
||||
const int space_num = static_cast<int>( ceil(ImGui::GetTextLineHeightWithSpacing() / space_size.x) );
|
||||
space_buf[space_num]='\0';
|
||||
|
||||
std::vector<std::pair<int, int> >::iterator it_icon = icons.begin();
|
||||
std::vector<std::string>::iterator it_label = labels.begin();
|
||||
for(int i = 0 ; it_icon != icons.end(); i++, ++it_icon, ++it_label) {
|
||||
ImGui::PushID( id.sum + i + 1);
|
||||
ImVec2 pos = ImGui::GetCursorScreenPos();
|
||||
// combo selectable item
|
||||
std::string label = " " + (*it_label);
|
||||
if ( ImGui::Selectable(label.c_str(), i == *state )){
|
||||
char text_buf[256];
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%s %s", space_buf, it_label->c_str());
|
||||
if ( ImGui::Selectable(text_buf, i == *state )){
|
||||
*state = i;
|
||||
ret = true;
|
||||
}
|
||||
@@ -356,13 +362,82 @@ bool ImGuiToolkit::ComboIcon (std::vector<std::pair<int, int> > icons, std::vect
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ImGuiToolkit::ComboIcon (const char* label, std::vector<std::pair<int, int> > icons, std::vector<std::string> items, int* i)
|
||||
{
|
||||
bool ret = false;
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImVec2 draw_pos = ImGui::GetCursorScreenPos() + g.Style.FramePadding * 0.5;
|
||||
|
||||
// make some space
|
||||
char space_buf[] = " ";
|
||||
const ImVec2 space_size = ImGui::CalcTextSize(" ", NULL);
|
||||
const int space_num = static_cast<int>( ceil(g.FontSize / space_size.x) );
|
||||
space_buf[space_num]='\0';
|
||||
|
||||
char text_buf[256];
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%s %s", space_buf, items[*i].c_str());
|
||||
|
||||
if (ImGui::BeginCombo(label, text_buf))
|
||||
{
|
||||
for (int p = 0; p < items.size(); ++p){
|
||||
if (ImGuiToolkit::SelectableIcon( items[p].c_str(), icons[p].first, icons[p].second, p == *i) ) {
|
||||
*i = p;
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImVec2 end_pos = ImGui::GetCursorScreenPos();
|
||||
|
||||
// draw icon
|
||||
ImGui::SetCursorScreenPos(draw_pos);
|
||||
Icon(icons[*i].first, icons[*i].second);
|
||||
|
||||
ImGui::SetCursorScreenPos(end_pos);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ImGuiToolkit::SelectableIcon(const char* label, int i, int j, bool selected)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImVec2 draw_pos = ImGui::GetCursorScreenPos() - g.Style.FramePadding * 0.5;
|
||||
|
||||
// make some space
|
||||
char space_buf[] = " ";
|
||||
const ImVec2 space_size = ImGui::CalcTextSize(" ", NULL);
|
||||
const int space_num = static_cast<int>( ceil(g.FontSize / space_size.x) );
|
||||
space_buf[space_num]='\0';
|
||||
|
||||
char text_buf[256];
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%s %s", space_buf, label);
|
||||
|
||||
// draw menu item
|
||||
bool ret = ImGui::Selectable(text_buf, selected);
|
||||
ImVec2 end_pos = ImGui::GetCursorScreenPos();
|
||||
|
||||
// draw icon
|
||||
ImGui::SetCursorScreenPos(draw_pos);
|
||||
Icon(i, j);
|
||||
|
||||
ImGui::SetCursorScreenPos(end_pos);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool ImGuiToolkit::MenuItemIcon (int i, int j, const char* label, bool selected, bool enabled)
|
||||
{
|
||||
ImVec2 draw_pos = ImGui::GetCursorScreenPos();
|
||||
|
||||
// make some space
|
||||
char space_buf[] = " ";
|
||||
const ImVec2 space_size = ImGui::CalcTextSize(" ", NULL);
|
||||
const int space_num = static_cast<int>( ceil(ImGui::GetTextLineHeightWithSpacing() / space_size.x) );
|
||||
space_buf[space_num]='\0';
|
||||
|
||||
char text_buf[256];
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), " %s", label);
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%s %s", space_buf, label);
|
||||
|
||||
// draw menu item
|
||||
bool ret = ImGui::MenuItem(text_buf, NULL, selected, enabled);
|
||||
@@ -444,6 +519,44 @@ void ImGuiToolkit::HelpIcon(const char* desc, int i, int j, const char* shortcut
|
||||
ToolTip(desc, shortcut);
|
||||
}
|
||||
|
||||
|
||||
bool ImGuiToolkit::SliderTiming (const char* label, int* ms, int v_min, int v_max, const char* text_max)
|
||||
{
|
||||
char text_buf[256];
|
||||
if ( *ms < v_min || text_max == nullptr) {
|
||||
|
||||
int milisec = (*ms)%1000;
|
||||
int sec = (*ms)/1000;
|
||||
int min = sec/60;
|
||||
|
||||
if (min > 0) {
|
||||
if (milisec>0)
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%d min %d s %03d ms", min, sec%60, milisec);
|
||||
else
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%d min %d s", min, sec%60);
|
||||
}
|
||||
else if (sec > 0) {
|
||||
if (milisec>0)
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%d s %03d ms", sec, milisec);
|
||||
else
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%d s", sec);
|
||||
}
|
||||
else
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%03d ms", milisec);
|
||||
}
|
||||
else {
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%s", text_max);
|
||||
}
|
||||
|
||||
// precision 50 ms
|
||||
int val = *ms / 50;
|
||||
bool ret = ImGui::SliderInt(label, &val, v_min / 50, v_max / 50, text_buf);
|
||||
|
||||
*ms = val * 50;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Draws a timeline showing
|
||||
// 1) a cursor at position *time in the range [0 duration]
|
||||
// 2) a line of tick marks indicating time, every step if possible
|
||||
|
||||
@@ -21,8 +21,10 @@ namespace ImGuiToolkit
|
||||
bool ButtonIcon (int i, int j, const char* tooltip = nullptr);
|
||||
bool ButtonIconToggle (int i, int j, int i_toggle, int j_toggle, bool* toggle);
|
||||
bool ButtonIconMultistate (std::vector<std::pair<int, int> > icons, int* state);
|
||||
bool ComboIcon (std::vector<std::pair<int, int> > icons, std::vector<std::string> labels, int* state);
|
||||
bool MenuItemIcon (int i, int j, const char* label, bool selected = false, bool enabled = true);
|
||||
bool SelectableIcon(const char* label, int i, int j, bool selected = false);
|
||||
bool ComboIcon (std::vector<std::pair<int, int> > icons, std::vector<std::string> labels, int* state);
|
||||
bool ComboIcon (const char* label, std::vector<std::pair<int, int> > icons, std::vector<std::string> items, int* i);
|
||||
|
||||
// buttons
|
||||
bool ButtonToggle (const char* label, bool* toggle);
|
||||
@@ -35,6 +37,7 @@ namespace ImGuiToolkit
|
||||
void HelpIcon (const char* desc, int i = 19, int j = 5, const char* shortcut = nullptr);
|
||||
|
||||
// sliders
|
||||
bool SliderTiming (const char* label, int *ms, int v_min, int v_max, const char* text_max = nullptr);
|
||||
bool TimelineSlider (const char* label, guint64 *time, guint64 begin, guint64 first, guint64 end, guint64 step, const float width);
|
||||
void RenderTimeline (struct ImGuiWindow* window, struct ImRect timeline_bbox, guint64 begin, guint64 end, guint64 step, bool verticalflip = false);
|
||||
void Timeline (const char* label, guint64 time, guint64 begin, guint64 end, guint64 step, const float width);
|
||||
|
||||
76
Timeline.cpp
76
Timeline.cpp
@@ -454,10 +454,13 @@ void Timeline::smoothFading(uint N)
|
||||
}
|
||||
|
||||
|
||||
void Timeline::autoFading(uint milisecond)
|
||||
void Timeline::autoFading(uint milisecond, FadingCurve curve)
|
||||
{
|
||||
// mow many index values of timeline array for this duration?
|
||||
size_t N = (milisecond * 1000000) / (timing_.end / MAX_TIMELINE_ARRAY);
|
||||
size_t N = MAX_TIMELINE_ARRAY -1;
|
||||
GstClockTime d = static_cast<GstClockTime>(milisecond) * 1000000;
|
||||
if ( d < timing_.end )
|
||||
N = d / (timing_.end / MAX_TIMELINE_ARRAY);
|
||||
|
||||
// clear with static array
|
||||
memcpy(fadingArray_, empty_zeros, MAX_TIMELINE_ARRAY * sizeof(float));
|
||||
@@ -480,24 +483,41 @@ void Timeline::autoFading(uint milisecond)
|
||||
|
||||
// linear fade in starting at s
|
||||
size_t i = s;
|
||||
for (; i < s+n; ++i)
|
||||
fadingArray_[i] = static_cast<float>(i-s) / static_cast<float>(n);
|
||||
for (; i < s+n; ++i){
|
||||
const float x = static_cast<float>(i-s) / static_cast<float>(n);
|
||||
if (curve==FADING_BILINEAR)
|
||||
fadingArray_[i] = x * x;
|
||||
else if (curve==FADING_BILINEAR_INV)
|
||||
fadingArray_[i] = 1.f - ((x- 1.f) * (x - 1.f));
|
||||
else
|
||||
fadingArray_[i] = x;
|
||||
}
|
||||
// plateau
|
||||
for (; i < e-n; ++i)
|
||||
fadingArray_[i] = 1.f;
|
||||
// linear fade out ending at e
|
||||
for (; i < e; ++i)
|
||||
fadingArray_[i] = static_cast<float>(e-i) / static_cast<float>(n);
|
||||
for (; i < e; ++i) {
|
||||
const float x = static_cast<float>(e-i) / static_cast<float>(n);
|
||||
if (curve==FADING_BILINEAR)
|
||||
fadingArray_[i] = x * x;
|
||||
else if (curve==FADING_BILINEAR_INV)
|
||||
fadingArray_[i] = 1.f - ((x- 1.f) * (x - 1.f));
|
||||
else
|
||||
fadingArray_[i] = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Timeline::fadeIn(uint milisecond)
|
||||
void Timeline::fadeIn(uint milisecond, FadingCurve curve)
|
||||
{
|
||||
// mow many index values of timeline array for this duration?
|
||||
const size_t N = (milisecond * 1000000) / (timing_.end / MAX_TIMELINE_ARRAY);
|
||||
size_t N = MAX_TIMELINE_ARRAY -1;
|
||||
GstClockTime d = static_cast<GstClockTime>(milisecond) * 1000000;
|
||||
if ( d < timing_.end )
|
||||
N = d / (timing_.end / MAX_TIMELINE_ARRAY);
|
||||
|
||||
// get sections (inverse of gaps)
|
||||
// get sections (inverse of gaps) is never empty
|
||||
TimeIntervalSet sec = sections();
|
||||
auto it = sec.cbegin();
|
||||
|
||||
@@ -512,19 +532,31 @@ void Timeline::fadeIn(uint milisecond)
|
||||
|
||||
// linear fade in starting at s
|
||||
size_t i = s;
|
||||
float val = fadingArray_[i];
|
||||
for (; i < s+n; ++i)
|
||||
fadingArray_[i] = val * static_cast<float>(i-s) / static_cast<float>(n);
|
||||
float val = fadingArray_[s+n];
|
||||
for (; i < s+n; ++i) {
|
||||
const float x = static_cast<float>(i-s) / static_cast<float>(n);
|
||||
if (curve==FADING_BILINEAR)
|
||||
fadingArray_[i] = x * x;
|
||||
else if (curve==FADING_BILINEAR_INV)
|
||||
fadingArray_[i] = 1.f - ((x- 1.f) * (x - 1.f));
|
||||
else
|
||||
fadingArray_[i] = x;
|
||||
fadingArray_[i] *= val;
|
||||
}
|
||||
}
|
||||
|
||||
void Timeline::fadeOut(uint milisecond)
|
||||
void Timeline::fadeOut(uint milisecond, FadingCurve curve)
|
||||
{
|
||||
// mow many index values of timeline array for this duration?
|
||||
const size_t N = (milisecond * 1000000) / (timing_.end / MAX_TIMELINE_ARRAY);
|
||||
size_t N = MAX_TIMELINE_ARRAY -1;
|
||||
GstClockTime d = static_cast<GstClockTime>(milisecond) * 1000000;
|
||||
if ( d < timing_.end )
|
||||
N = d / (timing_.end / MAX_TIMELINE_ARRAY);
|
||||
|
||||
// get sections (inverse of gaps)
|
||||
// get sections (inverse of gaps) is never empty
|
||||
TimeIntervalSet sec = sections();
|
||||
auto it = sec.cbegin();
|
||||
auto it = sec.end();
|
||||
--it;
|
||||
|
||||
// get index of begining of section
|
||||
const size_t s = ( it->begin * MAX_TIMELINE_ARRAY ) / timing_.end;
|
||||
@@ -538,8 +570,16 @@ void Timeline::fadeOut(uint milisecond)
|
||||
// linear fade out ending at e
|
||||
size_t i = e-n;
|
||||
float val = fadingArray_[i];
|
||||
for (; i < e; ++i)
|
||||
fadingArray_[i] = val * static_cast<float>(e-i) / static_cast<float>(n);
|
||||
for (; i < e; ++i){
|
||||
const float x = static_cast<float>(e-i) / static_cast<float>(n);
|
||||
if (curve==FADING_BILINEAR)
|
||||
fadingArray_[i] = x * x;
|
||||
else if (curve==FADING_BILINEAR_INV)
|
||||
fadingArray_[i] = 1.f - ((x- 1.f) * (x - 1.f));
|
||||
else
|
||||
fadingArray_[i] = x;
|
||||
fadingArray_[i] *= val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
11
Timeline.h
11
Timeline.h
@@ -135,10 +135,15 @@ public:
|
||||
void clearFading();
|
||||
|
||||
// Edit
|
||||
typedef enum {
|
||||
FADING_LINEAR = 0,
|
||||
FADING_BILINEAR,
|
||||
FADING_BILINEAR_INV
|
||||
} FadingCurve;
|
||||
void smoothFading(uint N = 1);
|
||||
void autoFading(uint milisecond = 100);
|
||||
void fadeIn(uint milisecond = 100);
|
||||
void fadeOut(uint milisecond = 100);
|
||||
void autoFading(uint milisecond = 100, FadingCurve curve = FADING_LINEAR);
|
||||
void fadeIn(uint milisecond = 100, FadingCurve curve = FADING_LINEAR);
|
||||
void fadeOut(uint milisecond = 100, FadingCurve curve = FADING_LINEAR);
|
||||
bool autoCut();
|
||||
|
||||
private:
|
||||
|
||||
@@ -72,6 +72,7 @@ static TextEditor editor;
|
||||
#define PLOT_ARRAY_SIZE 180
|
||||
#define LABEL_AUTO_MEDIA_PLAYER ICON_FA_CARET_SQUARE_RIGHT " Dynamic selection"
|
||||
#define LABEL_STORE_SELECTION " Store selection"
|
||||
#define LABEL_EDIT_FADING ICON_FA_RANDOM " Fading"
|
||||
|
||||
// utility functions
|
||||
void ShowAboutGStreamer(bool* p_open);
|
||||
@@ -2126,32 +2127,21 @@ void SourceController::Render()
|
||||
oss << ": Reset timeline";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::BeginMenu(ICON_FA_RANDOM " Auto fading"))
|
||||
{
|
||||
const char* names[] = { "250 ms", "500 ms", "1 second", "2 seconds"};
|
||||
for (int i = 0; i < IM_ARRAYSIZE(names); ++i) {
|
||||
if (ImGui::MenuItem(names[i])) {
|
||||
mediaplayer_active_->timeline()->autoFading( 250 * (int ) pow(2, i) );
|
||||
mediaplayer_active_->timeline()->smoothFading( 2 * (i + 1) );
|
||||
std::ostringstream oss;
|
||||
oss << SystemToolkit::base_filename( mediaplayer_active_->filename() );
|
||||
oss << ": Timeline Auto fading " << 250 * (int ) pow(2, i);
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::BeginMenu(ICON_FA_CUT " Auto cut" ))
|
||||
{
|
||||
if (ImGuiToolkit::MenuItemIcon(14, 12, "Cut faded areas" ))
|
||||
if (mediaplayer_active_->timeline()->autoCut()){
|
||||
std::ostringstream oss;
|
||||
oss << SystemToolkit::base_filename( mediaplayer_active_->filename() );
|
||||
oss << ": Cut faded areas";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if ( ImGui::MenuItem(LABEL_EDIT_FADING) )
|
||||
mediaplayer_edit_fading_ = true;
|
||||
|
||||
// if (ImGui::BeginMenu(ICON_FA_CUT " Auto cut" ))
|
||||
// {
|
||||
// if (ImGuiToolkit::MenuItemIcon(14, 12, "Cut faded areas" ))
|
||||
// if (mediaplayer_active_->timeline()->autoCut()){
|
||||
// std::ostringstream oss;
|
||||
// oss << SystemToolkit::base_filename( mediaplayer_active_->filename() );
|
||||
// oss << ": Cut faded areas";
|
||||
// Action::manager().store(oss.str());
|
||||
// }
|
||||
// ImGui::EndMenu();
|
||||
// }
|
||||
if (Settings::application.render.gpu_decoding)
|
||||
{
|
||||
ImGui::Separator();
|
||||
@@ -2219,12 +2209,14 @@ void DrawTimeScale(const char* label, guint64 duration, double width_ratio)
|
||||
|
||||
}
|
||||
|
||||
void DrawTimeline(const char* label, Timeline *timeline, guint64 time, double width_ratio, float height)
|
||||
std::list< std::pair<float, guint64> > DrawTimeline(const char* label, Timeline *timeline, guint64 time, double width_ratio, float height)
|
||||
{
|
||||
std::list< std::pair<float, guint64> > ret;
|
||||
|
||||
// get window
|
||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return;
|
||||
return ret;
|
||||
|
||||
// get style & id
|
||||
const ImGuiContext& g = *GImGui;
|
||||
@@ -2248,7 +2240,7 @@ void DrawTimeline(const char* label, Timeline *timeline, guint64 time, double wi
|
||||
const ImRect bbox(frame_pos, frame_pos + frame_size);
|
||||
ImGui::ItemSize(frame_size, style.FramePadding.y);
|
||||
if (!ImGui::ItemAdd(bbox, id))
|
||||
return;
|
||||
return ret;
|
||||
|
||||
// capture hover to avoid tooltip on plotlines
|
||||
ImGui::ItemHoverable(bbox, id);
|
||||
@@ -2310,6 +2302,9 @@ void DrawTimeline(const char* label, Timeline *timeline, guint64 time, double wi
|
||||
if (i > 0)
|
||||
window->DrawList->AddRectFilled(ImVec2(section_bbox_min.x -2.f, plot_bbox.Min.y), ImVec2(section_bbox_min.x + 2.f, plot_bbox.Max.y), ImGui::GetColorU32(ImGuiCol_TitleBg));
|
||||
|
||||
ret.push_back( std::pair<float, guint64>(section_bbox_min.x,section->begin ) );
|
||||
ret.push_back( std::pair<float, guint64>(section_bbox_max.x,section->end ) );
|
||||
|
||||
// iterate: next bbox of section starts at end of current
|
||||
section_bbox_min.x = section_bbox_max.x;
|
||||
}
|
||||
@@ -2318,7 +2313,7 @@ void DrawTimeline(const char* label, Timeline *timeline, guint64 time, double wi
|
||||
if (e < timeline->duration())
|
||||
window->DrawList->AddRectFilled(ImVec2(section_bbox_min.x -2.f, plot_bbox.Min.y), ImVec2(section_bbox_min.x + 2.f, plot_bbox.Max.y), ImGui::GetColorU32(ImGuiCol_TitleBg));
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void SourceController::RenderSelection(size_t i)
|
||||
@@ -2882,6 +2877,7 @@ void SourceController::RenderMediaPlayer(MediaPlayer *mp)
|
||||
ImGui::SetCursorScreenPos(top_image);
|
||||
ImGui::Image((void*)(uintptr_t) mediaplayer_active_->texture(), framesize);
|
||||
|
||||
|
||||
///
|
||||
/// Info overlays
|
||||
///
|
||||
@@ -3120,6 +3116,73 @@ void SourceController::RenderMediaPlayer(MediaPlayer *mp)
|
||||
mediaplayer_active_->play( media_play );
|
||||
}
|
||||
|
||||
|
||||
if (mediaplayer_edit_fading_) {
|
||||
ImGui::OpenPopup(LABEL_EDIT_FADING);
|
||||
mediaplayer_edit_fading_ = false;
|
||||
}
|
||||
const ImVec2 mp_dialog_size(buttons_width_ * 2.f, buttons_height_ * 6);
|
||||
ImGui::SetNextWindowSize(mp_dialog_size, ImGuiCond_Always);
|
||||
const ImVec2 mp_dialog_pos = top + rendersize * 0.5f - mp_dialog_size * 0.5f;
|
||||
ImGui::SetNextWindowPos(mp_dialog_pos, ImGuiCond_Always);
|
||||
if (ImGui::BeginPopupModal(LABEL_EDIT_FADING, NULL, ImGuiWindowFlags_NoResize))
|
||||
{
|
||||
const ImVec2 pos = ImGui::GetCursorPos();
|
||||
const ImVec2 area = ImGui::GetContentRegionAvail();
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Text("Set parameters and apply:");
|
||||
ImGui::Spacing();
|
||||
|
||||
static int l = 0;
|
||||
static std::vector< std::pair<int, int> > icons_loc = { {19,7}, {18,7}, {0,8} };
|
||||
static std::vector< std::string > labels_loc = { "Fade in", "Fade out", "Fade in & out (all)" };
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGuiToolkit::ComboIcon("Fading", icons_loc, labels_loc, &l);
|
||||
|
||||
static int c = 0;
|
||||
static std::vector< std::pair<int, int> > icons_curve = { {18,3}, {19,3}, {17,3} };
|
||||
static std::vector< std::string > labels_curve = { "Linear", "Progressive", "Abrupt" };
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGuiToolkit::ComboIcon("Curve", icons_curve, labels_curve, &c);
|
||||
|
||||
static int d = 1000;
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGuiToolkit::SliderTiming ("Duration", &d, 200, 5000);
|
||||
|
||||
bool close = false;
|
||||
ImGui::SetCursorPos(pos + ImVec2(0.f, area.y - buttons_height_));
|
||||
if (ImGui::Button("Cancel", ImVec2(area.x * 0.3f, 0)))
|
||||
close = true;
|
||||
ImGui::SetCursorPos(pos + ImVec2(area.x * 0.7f, area.y - buttons_height_));
|
||||
if (ImGui::Button("Apply", ImVec2(area.x * 0.3f, 0))) {
|
||||
close = true;
|
||||
// timeline to edit
|
||||
Timeline *tl = mediaplayer_active_->timeline();
|
||||
switch (l) {
|
||||
case 0:
|
||||
tl->fadeIn(d, (Timeline::FadingCurve) c);
|
||||
oss << ": Timeline Fade in " << d;
|
||||
break;
|
||||
case 1:
|
||||
tl->fadeOut(d, (Timeline::FadingCurve) c);
|
||||
oss << ": Timeline Fade out " << d;
|
||||
break;
|
||||
case 2:
|
||||
tl->autoFading(d, (Timeline::FadingCurve) c);
|
||||
oss << ": Timeline Fade in&out " << d;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
tl->smoothFading( 4 );
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
|
||||
if (close)
|
||||
ImGui::CloseCurrentPopup();
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
}
|
||||
|
||||
const char *SourceController::SourcePlayIcon(Source *s)
|
||||
@@ -4286,31 +4349,31 @@ void Navigator::RenderMainPannelVimix()
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGuiToolkit::ToolTip("Take Snapshot ", CTRL_MOD "Y");
|
||||
|
||||
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_bot.y - ImGui::GetFrameHeightWithSpacing()));
|
||||
ImGuiToolkit::HelpMarker("Snapshots keeps a list of favorite\n"
|
||||
"status of the current session.\n"
|
||||
"Clic an item to preview or edit.\n"
|
||||
"Double-clic to restore immediately.\n");
|
||||
|
||||
// ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_bot.y - 2.f * ImGui::GetFrameHeightWithSpacing()));
|
||||
// ImGuiToolkit::HelpMarker("Snapshots capture the state of the session.\n"
|
||||
// "Double-clic on a snapshot to restore it.\n\n"
|
||||
// ICON_FA_ROUTE " Enable interpolation to animate\n"
|
||||
// "from current state to snapshot's state.");
|
||||
// // toggle button for smooth interpolation
|
||||
// ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_bot.y - ImGui::GetFrameHeightWithSpacing()));
|
||||
// ImGuiToolkit::ButtonToggle(ICON_FA_ROUTE, &Settings::application.smooth_snapshot);
|
||||
// if (ImGui::IsItemHovered())
|
||||
// ImGuiToolkit::ToolTip("Snapshot interpolation");
|
||||
// ImGuiToolkit::HelpMarker("Snapshots keeps a list of favorite\n"
|
||||
// "status of the current session.\n"
|
||||
// "Clic an item to preview or edit.\n"
|
||||
// "Double-clic to restore immediately.\n");
|
||||
|
||||
// if (Action::manager().currentSnapshot() > 0) {
|
||||
// ImGui::SetCursorPos( pos_bot );
|
||||
// int interpolation = static_cast<int> (Action::manager().interpolation() * 100.f);
|
||||
// ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
// if ( ImGui::SliderInt("Animate", &interpolation, 0, 100, "%d %%") )
|
||||
// Action::manager().interpolate( static_cast<float> ( interpolation ) * 0.01f );
|
||||
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_bot.y - 2.f * ImGui::GetFrameHeightWithSpacing()));
|
||||
ImGuiToolkit::HelpMarker("Snapshots capture the state of the session.\n"
|
||||
"Double-clic on a snapshot to restore it.\n\n"
|
||||
ICON_FA_ROUTE " Enable interpolation to animate\n"
|
||||
"from current state to snapshot's state.");
|
||||
// toggle button for smooth interpolation
|
||||
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_bot.y - ImGui::GetFrameHeightWithSpacing()) );
|
||||
ImGuiToolkit::ButtonToggle(ICON_FA_ROUTE, &Settings::application.smooth_snapshot);
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGuiToolkit::ToolTip("Snapshot interpolation");
|
||||
|
||||
// }
|
||||
if (Action::manager().currentSnapshot() > 0) {
|
||||
ImGui::SetCursorPos( pos_bot );
|
||||
int interpolation = static_cast<int> (Action::manager().interpolation() * 100.f);
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
if ( ImGui::SliderInt("Animate", &interpolation, 0, 100, "%d %%") )
|
||||
Action::manager().interpolate( static_cast<float> ( interpolation ) * 0.01f );
|
||||
|
||||
}
|
||||
|
||||
ImGui::SetCursorPos( pos_bot );
|
||||
}
|
||||
|
||||
@@ -141,6 +141,7 @@ class SourceController
|
||||
|
||||
// Render a single media player
|
||||
MediaPlayer *mediaplayer_active_;
|
||||
bool mediaplayer_edit_fading_;
|
||||
bool mediaplayer_mode_;
|
||||
bool mediaplayer_slider_pressed_;
|
||||
float mediaplayer_timeline_zoom_;
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user