Refurbishing the left panel

Toggle settings to show whole panel of settings
More space for main session panel (added notes)
This commit is contained in:
brunoherbelin
2021-04-11 01:27:21 +02:00
parent d7102809fc
commit eee9f49c05
5 changed files with 480 additions and 300 deletions

View File

@@ -1,6 +1,8 @@
#include <map>
#include <algorithm>
#include <string>
#include <cctype>
#ifdef _WIN32
# include <windows.h>
@@ -58,8 +60,10 @@ bool ImGuiToolkit::ButtonToggle( const char* label, bool* toggle )
}
void ImGuiToolkit::ButtonSwitch(const char* label, bool* toggle, const char* help)
bool ImGuiToolkit::ButtonSwitch(const char* label, bool* toggle, const char* help)
{
bool ret = false;
// utility style
ImVec4* colors = ImGui::GetStyle().Colors;
ImDrawList* draw_list = ImGui::GetWindowDrawList();
@@ -76,8 +80,10 @@ void ImGuiToolkit::ButtonSwitch(const char* label, bool* toggle, const char* hel
// toggle action : operate on the whole area
ImGui::InvisibleButton(label, ImVec2(frame_width, frame_height));
if (ImGui::IsItemClicked())
if (ImGui::IsItemClicked()) {
*toggle = !*toggle;
ret = true;
}
float t = *toggle ? 1.0f : 0.0f;
// animation
@@ -113,6 +119,7 @@ void ImGuiToolkit::ButtonSwitch(const char* label, bool* toggle, const char* hel
draw_list->AddRectFilled(p, ImVec2(p.x + width, p.y + height), col_bg, height * 0.5f);
draw_list->AddCircleFilled(ImVec2(p.x + radius + t * (width - radius * 2.0f), p.y + radius), radius - 1.5f, IM_COL32(255, 255, 255, 250));
return ret;
}
@@ -1113,4 +1120,76 @@ void ImGuiToolkit::SetAccentColor(accent_color color)
}
void word_wrap(std::string *str, unsigned per_line)
{
unsigned line_begin = 0;
while (line_begin < str->size())
{
const unsigned ideal_end = line_begin + per_line ;
unsigned line_end = ideal_end < str->size() ? ideal_end : str->size()-1;
if (line_end == str->size() - 1)
++line_end;
else if (std::isspace(str->at(line_end)))
{
str->replace(line_end, 1, 1, '\n' );
++line_end;
}
else // backtrack
{
unsigned end = line_end;
while ( end > line_begin && !std::isspace(str->at(end)))
--end;
if (end != line_begin)
{
line_end = end;
str->replace(line_end++, 1, 1, '\n' );
}
else {
str->insert(line_end++, 1, '\n' );
}
}
line_begin = line_end;
}
}
struct InputTextCallback_UserData
{
std::string* Str;
int WordWrap;
};
static int InputTextCallback(ImGuiInputTextCallbackData* data)
{
InputTextCallback_UserData* user_data = (InputTextCallback_UserData*)data->UserData;
if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)
{
if (user_data->WordWrap > 1)
word_wrap(user_data->Str, user_data->WordWrap );
// Resize string callback
std::string* str = user_data->Str;
IM_ASSERT(data->Buf == str->c_str());
str->resize(data->BufTextLen);
data->Buf = (char*)str->c_str();
}
// fprintf(stderr, "input %s\n", data->Buf);
return 0;
}
bool ImGuiToolkit::InputTextMultiline(const char* label, std::string* str, const ImVec2& size, int linesize)
{
ImGuiInputTextFlags flags = ImGuiInputTextFlags_CallbackResize;
InputTextCallback_UserData cb_user_data;
cb_user_data.Str = str;
cb_user_data.WordWrap = linesize;
return ImGui::InputTextMultiline(label, (char*)str->c_str(), str->capacity() + 1, size, flags, InputTextCallback, &cb_user_data);
}

View File

@@ -24,7 +24,7 @@ namespace ImGuiToolkit
// utility buttons
bool ButtonToggle (const char* label, bool* toggle);
void ButtonSwitch (const char* label, bool* toggle , const char *help = nullptr);
bool ButtonSwitch (const char* label, bool* toggle , const char *help = nullptr);
void ButtonOpenUrl (const char* url, const ImVec2& size_arg = ImVec2(0,0));
void ToolTip (const char* desc, const char* shortcut = nullptr);
@@ -62,6 +62,7 @@ namespace ImGuiToolkit
void SetAccentColor (accent_color color);
struct ImVec4 HighlightColor (bool active = true);
bool InputTextMultiline(const char* label, std::string* str, const ImVec2& size = ImVec2(0, 0), int linesize = 0);
}
#endif // __IMGUI_TOOLKIT_H_

View File

@@ -813,6 +813,12 @@ void UserInterface::showMenuEdit()
Mixer::manager().view()->selectAll();
navigator.hidePannel();
}
ImGui::Separator();
if ( ImGui::MenuItem( ICON_FA_UNDO " Undo", CTRL_MOD "Z") )
Action::manager().undo();
if ( ImGui::MenuItem( ICON_FA_REDO " Redo", CTRL_MOD "Shift+Z") )
Action::manager().redo();
}
void UserInterface::showMenuFile()
@@ -1648,12 +1654,11 @@ void MediaController::Render()
ImGui::MenuItem( ICON_FA_EYE " Preview", nullptr, &Settings::application.widget.media_player_view);
// ImGui::MenuItem( ICON_FA_QUESTION_CIRCLE " Help", nullptr, &media_player_help);
if ( ImGui::MenuItem( " RESET") ){
std::list<MediaPlayer*> lm = MediaPlayer::registered();
for( auto m=lm.begin(); m!=lm.end();++m)
(*m)->reopen();
}
// if ( ImGui::MenuItem( " RESET") ){
// std::list<MediaPlayer*> lm = MediaPlayer::registered();
// for( auto m=lm.begin(); m!=lm.end();++m)
// (*m)->reopen();
// }
if ( ImGui::MenuItem( ICON_FA_TIMES " Close", CTRL_MOD "P") )
Settings::application.widget.media_player = false;
@@ -2068,6 +2073,7 @@ Navigator::Navigator()
padding_width_ = 100;
// clean start
show_config_ = false;
pannel_visible_ = false;
view_pannel_visible = false;
clearButtonSelection();
@@ -2082,6 +2088,8 @@ void Navigator::applyButtonSelection(int index)
// set visible if button is active
pannel_visible_ = status;
show_config_ = false;
}
void Navigator::clearButtonSelection()
@@ -2123,6 +2131,7 @@ void Navigator::hidePannel()
clearButtonSelection();
pannel_visible_ = false;
view_pannel_visible = false;
show_config_ = false;
}
void Navigator::Render()
@@ -2163,11 +2172,6 @@ void Navigator::Render()
if (ImGui::IsItemHovered())
tooltip_ = "Main menu HOME";
// if (ImGui::Selectable( ICON_FA_ELLIPSIS_V, &selected_button[NAV_SES], 0, iconsize))
// applyButtonSelection(NAV_SES);
// if (ImGui::IsItemHovered())
// tooltip_ = "Session ";
// the list of INITIALS for sources
int index = 0;
SourceList::iterator iter;
@@ -2312,11 +2316,6 @@ void Navigator::Render()
{
RenderNewPannel();
}
// pannel session
else if (selected_button[NAV_SES])
{
RenderSessionPannel();
}
// pannel to configure a selected source
else
{
@@ -2377,7 +2376,7 @@ void Navigator::RenderSourcePannel(Source *s)
if (ImGui::Begin("##navigatorSource", NULL, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav))
{
// TITLE
ImGui::SetCursorPosY(10);
ImGui::SetCursorPosY(IMGUI_TOP_ALIGN);
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
ImGui::Text("Source");
ImGui::PopFont();
@@ -2491,13 +2490,14 @@ void Navigator::RenderNewPannel()
// Edit menu
ImGui::SetCursorPosY(width_);
ImGui::Text("Source");
ImGui::SameLine();
ImGui::SetCursorPosX(pannel_width_ IMGUI_RIGHT_ALIGN);
if (ImGui::BeginMenu("Edit"))
{
UserInterface::manager().showMenuEdit();
ImGui::EndMenu();
}
// ImGui::SameLine();
// ImGui::SetCursorPosX(pannel_width_ IMGUI_RIGHT_ALIGN);
// if (ImGui::BeginMenu("Edit"))
// {
// UserInterface::manager().showMenuEdit();
// ImGui::EndMenu();
// }
//
// News Source selection pannel
@@ -2689,138 +2689,31 @@ void Navigator::RenderNewPannel()
}
}
void Navigator::RenderSessionPannel()
void Navigator::RenderMainPannelVimix()
{
// Next window is a side pannel
ImGui::SetNextWindowPos( ImVec2(width_, 0), ImGuiCond_Always );
ImGui::SetNextWindowSize( ImVec2(pannel_width_, height_), ImGuiCond_Always );
ImGui::SetNextWindowBgAlpha(0.85f); // Transparent background
if (ImGui::Begin("##navigatorSession", NULL, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav))
{
// TITLE
ImGui::SetCursorPosY(10);
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
ImGui::Text("Session");
ImGui::PopFont();
// Edit menu
ImGui::SetCursorPosY(width_);
ImGui::Text("History");
ImGui::SameLine();
ImGui::SetCursorPosX(pannel_width_ IMGUI_RIGHT_ALIGN);
if (ImGui::BeginMenu("Action"))
{
if ( ImGui::MenuItem( ICON_FA_UNDO " Undo", CTRL_MOD "Z") )
Action::manager().undo();
if ( ImGui::MenuItem( ICON_FA_REDO " Redo", CTRL_MOD "Shift+Z") )
Action::manager().redo();
ImGui::EndMenu();
}
ImGui::End();
}
}
void Navigator::RenderTransitionPannel()
{
if (Settings::application.current_view < View::TRANSITION) {
hidePannel();
return;
}
// Next window is a side pannel
ImGui::SetNextWindowPos( ImVec2(width_, 0), ImGuiCond_Always );
ImGui::SetNextWindowSize( ImVec2(pannel_width_, height_), ImGuiCond_Always );
ImGui::SetNextWindowBgAlpha(0.85f); // Transparent background
if (ImGui::Begin("##navigatorTrans", NULL, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav))
{
// TITLE
ImGui::SetCursorPosY(10);
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
ImGui::Text("Transition");
ImGui::PopFont();
// Session menu
ImGui::SetCursorPosY(width_);
ImGui::Text("Behavior");
ImGuiToolkit::ButtonSwitch( ICON_FA_RANDOM " Cross fading", &Settings::application.transition.cross_fade);
ImGuiToolkit::ButtonSwitch( ICON_FA_CLOUD_SUN " Clear view", &Settings::application.transition.hide_windows);
// Transition options
ImGui::Spacing();
ImGui::Text("Animation");
if (ImGuiToolkit::ButtonIcon(4, 13)) Settings::application.transition.duration = 1.f;
ImGui::SameLine(0, 10);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::SliderFloat("Duration", &Settings::application.transition.duration, TRANSITION_MIN_DURATION, TRANSITION_MAX_DURATION, "%.1f s");
if (ImGuiToolkit::ButtonIcon(9, 1)) Settings::application.transition.profile = 0;
ImGui::SameLine(0, 10);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::Combo("Curve", &Settings::application.transition.profile, "Linear\0Quadratic\0");
// specific transition actions
ImGui::Text(" ");
if ( ImGui::Button( ICON_FA_PLAY_CIRCLE " Play ", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ){
TransitionView *tv = static_cast<TransitionView *>(Mixer::manager().view(View::TRANSITION));
if (tv) tv->play(false);
}
ImGui::SameLine();
ImGui::Text("Animation");
if ( ImGui::Button( ICON_FA_FILE_UPLOAD " Open ", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ){
TransitionView *tv = static_cast<TransitionView *>(Mixer::manager().view(View::TRANSITION));
if (tv) tv->open();
}
ImGui::SameLine();
ImGui::Text("Session");
// General transition actions
ImGui::Text(" ");
if ( ImGui::Button( ICON_FA_PLAY_CIRCLE " Play & " ICON_FA_FILE_UPLOAD " Open ", ImVec2(ImGui::GetContentRegionAvail().x, 0)) ){
TransitionView *tv = static_cast<TransitionView *>(Mixer::manager().view(View::TRANSITION));
if (tv) tv->play(true);
}
if ( ImGui::Button( ICON_FA_DOOR_OPEN " Exit", ImVec2(ImGui::GetContentRegionAvail().x, 0)) )
Mixer::manager().setView(View::MIXING);
}
ImGui::End();
}
void Navigator::RenderMainPannel()
{
// Next window is a side pannel
ImGui::SetNextWindowPos( ImVec2(width_, 0), ImGuiCond_Always );
ImGui::SetNextWindowSize( ImVec2(pannel_width_, height_), ImGuiCond_Always );
ImGui::SetNextWindowBgAlpha(0.85f); // Transparent background
if (ImGui::Begin("##navigatorMain", NULL, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav))
{
// TITLE
ImGui::SetCursorPosY(10);
ImGui::SetCursorPosY(IMGUI_TOP_ALIGN);
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
ImGui::Text(APP_NAME);
ImGui::PopFont();
// Icon to switch fullscreen
ImGui::SetCursorPos(ImVec2(pannel_width_ - 40.f, 13.f));
const char *tooltip[2] = {"Enter Fullscreen (" CTRL_MOD "Shift+F)", "Exit Fullscreen (" CTRL_MOD "Shift+F)"};
bool fs = Rendering::manager().mainWindow().isFullscreen();
if ( ImGuiToolkit::IconToggle(4,15,3,15, &fs, tooltip ) ) {
Rendering::manager().mainWindow().toggleFullscreen();
}
// Session menu
ImGui::SetCursorPosY(width_);
ImGui::Text("Sessions");
ImGui::SameLine();
ImGui::SetCursorPosX(pannel_width_ IMGUI_RIGHT_ALIGN);
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, IMGUI_TOP_ALIGN) );
if (ImGui::BeginMenu("File"))
{
UserInterface::manager().showMenuFile();
ImGui::EndMenu();
}
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, IMGUI_TOP_ALIGN + ImGui::GetTextLineHeightWithSpacing()) );
if (ImGui::BeginMenu("Edit"))
{
UserInterface::manager().showMenuEdit();
ImGui::EndMenu();
}
// Session menu
ImGui::SetCursorPosY(width_);
ImGui::Text("Sessions");
static bool selection_session_mode_changed = true;
static int selection_session_mode = 0;
@@ -2881,7 +2774,7 @@ void Navigator::RenderMainPannel()
}
// icon to clear list
ImVec2 pos = ImGui::GetCursorPos();
ImVec2 pos_top = ImGui::GetCursorPos();
ImGui::SameLine();
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.7);
bool reset = false;
@@ -2909,7 +2802,7 @@ void Navigator::RenderMainPannel()
}
}
ImGui::PopStyleVar();
ImGui::SetCursorPos(pos);
ImGui::SetCursorPos(pos_top);
// fill the session list depending on the mode
static std::list<std::string> sessions_list;
@@ -2934,7 +2827,7 @@ void Navigator::RenderMainPannel()
// display the sessions list and detect if one was selected (double clic)
bool session_selected = false;
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::ListBoxHeader("##Sessions", CLAMP(sessions_list.size(), 4, 8));
ImGui::ListBoxHeader("##Sessions", 6);
static std::string file_info = "";
static std::list<std::string>::iterator file_selected = sessions_list.end();
for(auto it = sessions_list.begin(); it != sessions_list.end(); it++) {
@@ -2975,11 +2868,6 @@ void Navigator::RenderMainPannel()
}
ImGui::ListBoxFooter();
pos = ImGui::GetCursorPos();
ImGui::SameLine();
ImGuiToolkit::HelpMarker("Quick access to Session files;\nSelect the history of recently\nopened files or a folder, and\ndouble-clic a filename to open.");
ImGui::SetCursorPos(pos);
// done the selection !
if (session_selected) {
// close pannel
@@ -2989,48 +2877,90 @@ void Navigator::RenderMainPannel()
selection_session_mode_changed = true;
}
// options session
ImGui::Spacing();
ImGui::Spacing();
ImGui::Text("Options");
ImGuiToolkit::ButtonSwitch( ICON_FA_ARROW_CIRCLE_RIGHT " Smooth transition", &Settings::application.smooth_transition);
ImGuiToolkit::ButtonSwitch( ICON_FA_MOUSE_POINTER " Smooth cursor", &Settings::application.smooth_cursor);
ImVec2 pos_bot = ImGui::GetCursorPos();
ImGui::SameLine();
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_top.y ));
ImGuiToolkit::HelpMarker("Quick access to Session files;\n\n"
"Select the history of recently\n"
"opened files or a folder, and\n"
"double-clic a filename to open it.\n\n"
ICON_FA_ARROW_CIRCLE_RIGHT " Enable smooth transition to\n"
"perform smooth cross fading.");
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_top.y + 6 * ImGui::GetTextLineHeight()) );
ImGuiToolkit::ButtonToggle(ICON_FA_ARROW_CIRCLE_RIGHT, &Settings::application.smooth_transition);
if (ImGui::IsItemHovered())
ImGuiToolkit::ToolTip("Smooth trantition");
// Continue Main pannel
// WINDOWS
// ImGuiToolkit::ButtonSwitch( ICON_FA_ARROW_CIRCLE_RIGHT " Smooth transition", &Settings::application.smooth_transition);
ImGui::SetCursorPos(pos_bot);
//
// Notes
//
ImGui::Spacing();
ImGuiToolkit::Icon(15, 10);
static std::string notes;
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_MONO);
pos_bot = ImGui::GetCursorPos();
if (notes.empty()) {
ImGui::SetCursorPos( ImVec2(pos_bot.x + ImGui::GetStyle().ItemSpacing.x, pos_bot.y + ImGui::GetStyle().ItemSpacing.y) );
ImGui::Text("Session notes");
ImGui::SetCursorPos(pos_bot);
}
ImGuiToolkit::InputTextMultiline("##notes", &notes, ImVec2(IMGUI_RIGHT_ALIGN, ImGui::GetTextLineHeight() * 7));
ImGui::PopFont();
//
// Windows
//
ImGui::Spacing();
// ImGuiToolkit::Icon(3, 6);
// ImGui::SameLine(0, 10);
ImGui::Text("Windows");
ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_PREVIEW, &Settings::application.widget.preview, CTRL_MOD "D");
ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_MEDIAPLAYER, &Settings::application.widget.media_player, CTRL_MOD "P");
#ifndef NDEBUG
ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_SHADEREDITOR, &Settings::application.widget.shader_editor, CTRL_MOD "E");
ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_TOOLBOX, &Settings::application.widget.toolbox, CTRL_MOD "T");
ImGuiToolkit::ButtonSwitch( ICON_FA_LIST " Logs", &Settings::application.widget.logs, CTRL_MOD "L");
#endif
ImGuiToolkit::ButtonSwitch( ICON_FA_HISTORY " History", &Settings::application.widget.history);
ImGuiToolkit::ButtonSwitch( ICON_FA_TACHOMETER_ALT " Metrics", &Settings::application.widget.stats);
bool fs = Rendering::manager().mainWindow().isFullscreen();
if (ImGuiToolkit::ButtonSwitch( ICON_FA_EXPAND " Fullscreen", &fs, CTRL_MOD "Shift+F") )
Rendering::manager().mainWindow().toggleFullscreen();
// Settings & application appearance
static bool show_config = false;
// std::string tooltip_ = "";
// ImGuiToolkit::ButtonToggle(IMGUI_TITLE_PREVIEW, &Settings::application.widget.preview);
// if (ImGui::IsItemHovered())
// tooltip_ = "Output " CTRL_MOD "D";
// ImGui::SameLine();
// ImGuiToolkit::ButtonToggle(IMGUI_TITLE_MEDIAPLAYER, &Settings::application.widget.media_player);
// if (ImGui::IsItemHovered())
// tooltip_ = "Player " CTRL_MOD "P";
// if (!tooltip_.empty()) {
// ImGuiToolkit::ToolTip(tooltip_.substr(0, tooltip_.size()-6).c_str(), tooltip_.substr(tooltip_.size()-6, 6).c_str());
// }
ImGui::Spacing();
if (show_config)
{
ImGui::Text("System");
bool vsync = (Settings::application.render.vsync > 0);
ImGuiToolkit::ButtonSwitch( "Vertical synchronization", &vsync);
Settings::application.render.vsync = vsync ? 1 : 0;
ImGuiToolkit::ButtonSwitch( "Blit framebuffer", &Settings::application.render.blit);
bool multi = (Settings::application.render.multisampling > 0);
ImGuiToolkit::ButtonSwitch( "Antialiasing framebuffer", &multi);
Settings::application.render.multisampling = multi ? 3 : 0;
ImGuiToolkit::ButtonSwitch( "Hardware video decoding", &Settings::application.render.gpu_decoding);
ImGui::Spacing();
if (ImGui::Button( ICON_FA_POWER_OFF " Restart to apply", ImVec2(ImGui::GetContentRegionAvail().x - 50, 0)))
Rendering::manager().close();
}
else {
}
void Navigator::RenderMainPannelSettings()
{
// TITLE
ImGui::SetCursorPosY(IMGUI_TOP_ALIGN);
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
ImGui::Text("Settings");
ImGui::PopFont();
ImGui::SetCursorPosY(width_);
// options session
// ImGuiToolkit::ButtonSwitch( ICON_FA_HISTORY " History", &Settings::application.widget.history);
// ImGuiToolkit::Icon(3, 2);
// ImGui::SameLine(0, 10);
ImGui::Text("Appearance");
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
if ( ImGui::DragFloat("Scale", &Settings::application.scale, 0.01, 0.5f, 2.0f, "%.1f"))
@@ -3041,14 +2971,181 @@ void Navigator::RenderMainPannel()
if (b || o || g)
ImGuiToolkit::SetAccentColor(static_cast<ImGuiToolkit::accent_color>(Settings::application.accent_color));
ImGui::Spacing();
// ImGuiToolkit::Icon(2, 2);
// ImGui::SameLine(0, 10);
ImGui::Text("Options");
ImGuiToolkit::ButtonSwitch( ICON_FA_MOUSE_POINTER " Smooth cursor", &Settings::application.smooth_cursor);
ImGuiToolkit::ButtonSwitch( ICON_FA_TACHOMETER_ALT " Metrics", &Settings::application.widget.stats);
#ifndef NDEBUG
ImGui::Text("Windows");
ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_SHADEREDITOR, &Settings::application.widget.shader_editor, CTRL_MOD "E");
ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_TOOLBOX, &Settings::application.widget.toolbox, CTRL_MOD "T");
ImGuiToolkit::ButtonSwitch( ICON_FA_LIST " Logs", &Settings::application.widget.logs, CTRL_MOD "L");
#endif
ImGui::Spacing();
#ifdef LINUX
// ImGuiToolkit::Icon(12, 6);
#else
// ImGuiToolkit::Icon(6, 0);
#endif
// ImGui::SameLine(0, 10);
ImGui::Text("System");
static bool need_restart = false;
static bool vsync = (Settings::application.render.vsync > 0);
static bool blit = Settings::application.render.blit;
static bool multi = (Settings::application.render.multisampling > 0);
static bool gpu = Settings::application.render.gpu_decoding;
bool change = false;
change |= ImGuiToolkit::ButtonSwitch( "Vertical synchronization", &vsync);
change |= ImGuiToolkit::ButtonSwitch( "Blit framebuffer", &blit);
change |= ImGuiToolkit::ButtonSwitch( "Antialiasing framebuffer", &multi);
change |= ImGuiToolkit::ButtonSwitch( "Hardware video decoding", &gpu);
if (change) {
need_restart = ( vsync != (Settings::application.render.vsync > 0) ||
blit != Settings::application.render.blit ||
multi != (Settings::application.render.multisampling > 0) ||
gpu != Settings::application.render.gpu_decoding );
}
if (need_restart) {
ImGui::Spacing();
if (ImGui::Button( ICON_FA_POWER_OFF " Restart to apply", ImVec2(ImGui::GetContentRegionAvail().x - 50, 0))) {
Settings::application.render.vsync = vsync ? 1 : 0;
Settings::application.render.blit = blit;
Settings::application.render.multisampling = multi ? 3 : 0;
Settings::application.render.gpu_decoding = gpu;
Rendering::manager().close();
}
}
// ImGui::Separator();
// ImGui::MenuItem( ICON_FA_DIRECTIONS " Follow view", nullptr, &Settings::application.action_history_follow_view);
// ImGui::Text("Undo history");
// ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
// ImGui::ListBoxHeader("##UndoHistory", CLAMP(Action::manager().max(), 4, 8));
// for (uint i = Action::manager().max(); i > 0; i--) {
// std::string step_label_ = Action::manager().label(i);
// bool enable = i == Action::manager().current();
// if (ImGui::Selectable( step_label_.c_str(), &enable, ImGuiSelectableFlags_AllowDoubleClick )) {
// if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
// Action::manager().stepTo(i);
// }
// }
// }
// ImGui::ListBoxFooter();
// ImVec2 pos = ImGui::GetCursorPos();
// ImGui::SameLine();
// ImGuiToolkit::HelpMarker("Double clic on a timepoint to restore (undo/redo).");
// ImGui::SetCursorPos(pos);
// ImGui::Spacing();
// ImGui::Text("Notes");
// static std::string notes;
// ImGuiToolkit::PushFont(ImGuiToolkit::FONT_MONO);
// ImGuiToolkit::InputTextMultiline("##notes", &notes, ImVec2(IMGUI_RIGHT_ALIGN, ImGui::GetTextLineHeight() * 7));
// ImGui::PopFont();
// ImGui::End();
// }
}
void Navigator::RenderTransitionPannel()
{
if (Settings::application.current_view < View::TRANSITION) {
hidePannel();
return;
}
// Next window is a side pannel
ImGui::SetNextWindowPos( ImVec2(width_, 0), ImGuiCond_Always );
ImGui::SetNextWindowSize( ImVec2(pannel_width_, height_), ImGuiCond_Always );
ImGui::SetNextWindowBgAlpha(0.85f); // Transparent background
if (ImGui::Begin("##navigatorTrans", NULL, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav))
{
// TITLE
ImGui::SetCursorPosY(IMGUI_TOP_ALIGN);
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
ImGui::Text("Transition");
ImGui::PopFont();
// Session menu
ImGui::SetCursorPosY(width_);
ImGui::Text("Behavior");
ImGuiToolkit::ButtonSwitch( ICON_FA_RANDOM " Cross fading", &Settings::application.transition.cross_fade);
ImGuiToolkit::ButtonSwitch( ICON_FA_CLOUD_SUN " Clear view", &Settings::application.transition.hide_windows);
// Transition options
ImGui::Spacing();
ImGui::Text("Animation");
if (ImGuiToolkit::ButtonIcon(4, 13)) Settings::application.transition.duration = 1.f;
ImGui::SameLine(0, 10);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::SliderFloat("Duration", &Settings::application.transition.duration, TRANSITION_MIN_DURATION, TRANSITION_MAX_DURATION, "%.1f s");
if (ImGuiToolkit::ButtonIcon(9, 1)) Settings::application.transition.profile = 0;
ImGui::SameLine(0, 10);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::Combo("Curve", &Settings::application.transition.profile, "Linear\0Quadratic\0");
// specific transition actions
ImGui::Text(" ");
if ( ImGui::Button( ICON_FA_PLAY_CIRCLE " Play ", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ){
TransitionView *tv = static_cast<TransitionView *>(Mixer::manager().view(View::TRANSITION));
if (tv) tv->play(false);
}
ImGui::SameLine();
ImGui::Text("Animation");
if ( ImGui::Button( ICON_FA_FILE_UPLOAD " Open ", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ){
TransitionView *tv = static_cast<TransitionView *>(Mixer::manager().view(View::TRANSITION));
if (tv) tv->open();
}
ImGui::SameLine();
ImGui::Text("Session");
// General transition actions
ImGui::Text(" ");
if ( ImGui::Button( ICON_FA_PLAY_CIRCLE " Play & " ICON_FA_FILE_UPLOAD " Open ", ImVec2(ImGui::GetContentRegionAvail().x, 0)) ){
TransitionView *tv = static_cast<TransitionView *>(Mixer::manager().view(View::TRANSITION));
if (tv) tv->play(true);
}
if ( ImGui::Button( ICON_FA_DOOR_OPEN " Exit", ImVec2(ImGui::GetContentRegionAvail().x, 0)) )
Mixer::manager().setView(View::MIXING);
}
ImGui::End();
}
void Navigator::RenderMainPannel()
{
// Next window is a side pannel
ImGui::SetNextWindowPos( ImVec2(width_, 0), ImGuiCond_Always );
ImGui::SetNextWindowSize( ImVec2(pannel_width_, height_), ImGuiCond_Always );
ImGui::SetNextWindowBgAlpha(0.85f); // Transparent background
if (ImGui::Begin("##navigatorMain", NULL, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav))
{
//
// Panel content depends on show_config_
//
if (show_config_)
RenderMainPannelSettings();
else
RenderMainPannelVimix();
// Bottom aligned Logo (if enougth room)
static unsigned int vimixicon = Resource::getTextureImage("images/vimix_256x256.png");
static float height_about = 1.6f * ImGui::GetTextLineHeightWithSpacing();
bool show_icon = ImGui::GetCursorPosY() + height_about + 128.f < height_ ;
if ( show_icon ) {
ImGui::SetCursorPos(ImVec2(pannel_width_ / 2.f - 64.f, height_ -height_about - 128.f));
ImGui::SetCursorPos(ImVec2((pannel_width_ -1.5f * ImGui::GetTextLineHeightWithSpacing()) / 2.f - 64.f, height_ -height_about - 128.f));
ImGui::Image((void*)(intptr_t)vimixicon, ImVec2(128, 128));
}
else {
@@ -3056,10 +3153,11 @@ void Navigator::RenderMainPannel()
}
// About & System config toggle
if ( ImGui::Button( ICON_FA_CROW " About vimix", ImVec2(ImGui::GetContentRegionAvail().x - 50, 0)) )
if ( ImGui::Button( ICON_FA_CROW " About vimix", ImVec2(pannel_width_ IMGUI_RIGHT_ALIGN, 0)) )
UserInterface::manager().show_vimix_about = true;
ImGui::SameLine();
ImGuiToolkit::IconToggle(13,5,12,5,&show_config);
ImGui::SameLine(0, ImGui::GetTextLineHeightWithSpacing());
ImGuiToolkit::IconToggle(13,5,12,5,&show_config_);
}
ImGui::End();

View File

@@ -5,8 +5,7 @@
#include <list>
#define NAV_COUNT 68
#define NAV_MAX 63
#define NAV_SES 64
#define NAV_MAX 64
#define NAV_NEW 65
#define NAV_MENU 66
#define NAV_TRANS 67
@@ -40,6 +39,7 @@ class Navigator
float padding_width_;
// behavior pannel
bool show_config_;
bool pannel_visible_;
bool view_pannel_visible;
bool selected_button[NAV_COUNT];
@@ -50,9 +50,10 @@ class Navigator
// side pannels
void RenderSourcePannel(Source *s);
void RenderMainPannel();
void RenderMainPannelVimix();
void RenderMainPannelSettings();
void RenderTransitionPannel();
void RenderNewPannel();
void RenderSessionPannel();
void RenderViewPannel(ImVec2 draw_pos, ImVec2 draw_size);
SourcePreview new_source_preview_;

View File

@@ -69,6 +69,7 @@
#define IMGUI_TITLE_DELETE ICON_FA_BROOM " Delete?"
#define IMGUI_LABEL_RECENT_FILES " Select recent"
#define IMGUI_RIGHT_ALIGN -3.5f * ImGui::GetTextLineHeightWithSpacing()
#define IMGUI_TOP_ALIGN 10
#define IMGUI_COLOR_OVERLAY IM_COL32(5, 5, 5, 150)
#define IMGUI_COLOR_RECORD 1.0, 0.05, 0.05
#define IMGUI_COLOR_STREAM 0.05, 0.8, 1.0