BugFix Minor UI corrections and bugs fixed

This commit is contained in:
Bruno Herbelin
2024-01-01 17:54:27 +01:00
parent 578a72f560
commit b599fbf88d
10 changed files with 120 additions and 73 deletions

View File

@@ -546,7 +546,7 @@ void DisplaysView::draw()
// display interface // display interface
// Locate window at upper left corner // Locate window at upper left corner
glm::vec2 P = glm::vec2(0.01f, 0.01 ); glm::vec2 P(0.0f, 0.01f);
P = Rendering::manager().project(glm::vec3(P, 0.f), scene.root()->transform_, false); P = Rendering::manager().project(glm::vec3(P, 0.f), scene.root()->transform_, false);
// Set window position depending on icons size // Set window position depending on icons size
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE); ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
@@ -559,11 +559,11 @@ void DisplaysView::draw()
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.0f)); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.0f));
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f)); ImGui::PushStyleColor(ImGuiCol_PopupBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f));
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.14f, 0.14f, 0.14f, 0.f)); ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.14f, 0.14f, 0.14f, 0.f));
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.24f, 0.24f, 0.24f, 0.46f)); ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.15f, 0.15f, 0.15f, 0.99f));
ImGui::PushStyleColor(ImGuiCol_SliderGrab, ImVec4(0.85f, 0.85f, 0.85f, 0.86f)); ImGui::PushStyleColor(ImGuiCol_SliderGrab, ImVec4(0.85f, 0.85f, 0.85f, 0.86f));
ImGui::PushStyleColor(ImGuiCol_SliderGrabActive, ImVec4(0.95f, 0.95f, 0.95f, 1.00f)); ImGui::PushStyleColor(ImGuiCol_SliderGrabActive, ImVec4(0.95f, 0.95f, 0.95f, 1.00f));
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.00f, 0.00f, 0.00f, 0.00f)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.00f, 0.00f, 0.00f, 0.00f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.4f, 0.4f, 0.4f, 0.56f)); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.15f, 0.15f, 0.15f, 0.99f));
// //
// Buttons on top // Buttons on top
@@ -760,21 +760,23 @@ void DisplaysView::draw()
} }
ImGui::Separator(); ImGui::Separator();
if ( ImGui::MenuItem( ICON_FA_REPLY " Reset") ) { if ( ImGui::MenuItem( ICON_FA_WINDOW_RESTORE " Reset shape") ) {
glm::ivec4 rect (0, 0, 800, 600); glm::ivec4 rect (0, 0, 800, 600);
rect.p = Mixer::manager().session()->frame()->width(); rect.p = Mixer::manager().session()->frame()->width();
rect.q = Mixer::manager().session()->frame()->height(); rect.q = Mixer::manager().session()->frame()->height();
Rendering::manager().outputWindow(current_window_).setDecoration(true); Rendering::manager().outputWindow(current_window_).setDecoration(true);
Settings::application.windows[1+current_window_].show_pattern = false; Settings::application.windows[1+current_window_].show_pattern = false;
Settings::application.windows[1+current_window_].custom = false; Settings::application.windows[1+current_window_].custom = false;
Settings::application.windows[1+current_window_].whitebalance = glm::vec4(1.f, 1.f, 1.f, 0.5f);
if (Settings::application.windows[current_window_+1].fullscreen) if (Settings::application.windows[current_window_+1].fullscreen)
Rendering::manager().outputWindow(current_window_).exitFullscreen(); Rendering::manager().outputWindow(current_window_).exitFullscreen();
else else
Rendering::manager().outputWindow(current_window_).setCoordinates( rect ); Rendering::manager().outputWindow(current_window_).setCoordinates( rect );
windows_[current_window_].need_update_ += 2; windows_[current_window_].need_update_ += 2;
} }
if ( ImGui::MenuItem( ICON_FA_TEMPERATURE_LOW " Reset white balance") ) {
Settings::application.windows[1+current_window_].whitebalance = glm::vec4(1.f, 1.f, 1.f, 0.5f);
windows_[current_window_].need_update_ += 2;
}
if ( Settings::application.windows[current_window_+1].custom ) { if ( Settings::application.windows[current_window_+1].custom ) {
ImGui::PopStyleColor(1); ImGui::PopStyleColor(1);
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(COLOR_FRAME, 1.f)); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(COLOR_FRAME, 1.f));
@@ -872,8 +874,6 @@ void DisplaysView::select(glm::vec2 A, glm::vec2 B)
} }
} }
int _prev_mouse_pointer = 0;
void DisplaysView::initiate() void DisplaysView::initiate()
{ {
// initiate pending action // initiate pending action

View File

@@ -292,7 +292,7 @@ void GeometryView::draw()
// display interface // display interface
// Locate window at upper right corner // Locate window at upper right corner
glm::vec2 P = glm::vec2(-output_surface_->scale_.x - 0.02f, output_surface_->scale_.y + 0.01); glm::vec2 P(-output_surface_->scale_.x, output_surface_->scale_.y + 0.01f);
P = Rendering::manager().project(glm::vec3(P, 0.f), scene.root()->transform_, false); P = Rendering::manager().project(glm::vec3(P, 0.f), scene.root()->transform_, false);
// Set window position depending on icons size // Set window position depending on icons size
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE); ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);

View File

@@ -137,7 +137,7 @@ list<string> GstToolkit::all_plugins()
} }
list<string> GstToolkit::all_plugin_features(string pluginname) list<string> GstToolkit::all_plugin_features(const std::string &pluginname)
{ {
list<string> featurelist; list<string> featurelist;
GList *l, *g; GList *l, *g;
@@ -154,13 +154,16 @@ list<string> GstToolkit::all_plugin_features(string pluginname)
return featurelist; return featurelist;
} }
bool GstToolkit::enable_feature (string name, bool enable) { bool GstToolkit::enable_feature (const std::string &name, bool enable)
GstRegistry *registry = NULL; {
if (name.empty())
return false;
static GstRegistry *registry = NULL;
if (!registry)
registry = gst_registry_get();
GstElementFactory *factory = NULL; GstElementFactory *factory = NULL;
registry = gst_registry_get();
if (!registry) return false;
factory = gst_element_factory_find (name.c_str()); factory = gst_element_factory_find (name.c_str());
if (!factory) return false; if (!factory) return false;
@@ -177,17 +180,16 @@ bool GstToolkit::enable_feature (string name, bool enable) {
return true; return true;
} }
bool GstToolkit::has_feature (string name) bool GstToolkit::has_feature (const string &name)
{ {
if (name.empty()) if (name.empty())
return false; return false;
GstRegistry *registry = NULL; static GstRegistry *registry = NULL;
if (!registry)
registry = gst_registry_get();
GstElementFactory *factory = NULL; GstElementFactory *factory = NULL;
registry = gst_registry_get();
if (!registry) return false;
factory = gst_element_factory_find (name.c_str()); factory = gst_element_factory_find (name.c_str());
if (!factory) return false; if (!factory) return false;

View File

@@ -27,9 +27,9 @@ std::list<std::string> enable_gpu_decoding_plugins(bool enable = true);
std::string used_gpu_decoding_plugins(GstElement *gstbin); std::string used_gpu_decoding_plugins(GstElement *gstbin);
std::string used_decoding_plugins(GstElement *gstbin); std::string used_decoding_plugins(GstElement *gstbin);
std::list<std::string> all_plugin_features(std::string pluginname); std::list<std::string> all_plugin_features(const std::string &pluginname);
bool has_feature (std::string name); bool has_feature (const std::string &name);
bool enable_feature (std::string name, bool enable); bool enable_feature (const std::string &name, bool enable);
struct PipelineConfig { struct PipelineConfig {

View File

@@ -113,7 +113,7 @@ bool ImGuiToolkit::ButtonSwitch(const char* label, bool* toggle, const char* too
// layout // layout
float frame_height = ImGui::GetFrameHeight(); float frame_height = ImGui::GetFrameHeight();
float frame_width = ImGui::GetContentRegionAvail().x; float frame_width = MAX(ImGui::GetContentRegionAvail().x, 2);
float height = ImGui::GetFrameHeight() * 0.75f; float height = ImGui::GetFrameHeight() * 0.75f;
float width = height * 1.6f; float width = height * 1.6f;
float radius = height * 0.50f; float radius = height * 0.50f;

View File

@@ -52,7 +52,7 @@ LayerView::LayerView() : View(LAYER), aspect_ratio(1.f)
saveSettings(); saveSettings();
else else
restoreSettings(); restoreSettings();
Settings::application.views[mode_].name = "Layer"; Settings::application.views[mode_].name = "Layers";
// Geometry Scene background // Geometry Scene background
frame_ = new Group; frame_ = new Group;

View File

@@ -350,7 +350,7 @@ struct Application
Application() : fresh_start(false), instance_id(0), name(APP_NAME), executable(APP_NAME) { Application() : fresh_start(false), instance_id(0), name(APP_NAME), executable(APP_NAME) {
scale = 1.f; scale = 1.f;
accent_color = 0; accent_color = 0;
smooth_transition = false; smooth_transition = true;
save_version_snapshot = false; save_version_snapshot = false;
proportional_grid = true; proportional_grid = true;
mouse_pointer = 1; mouse_pointer = 1;
@@ -375,8 +375,8 @@ struct Application
num_output_windows = 1; num_output_windows = 1;
windows = std::vector<WindowConfig>(1+MAX_OUTPUT_WINDOW); windows = std::vector<WindowConfig>(1+MAX_OUTPUT_WINDOW);
windows[0].w = 1600; windows[0].w = 1600;
windows[0].h = 900; windows[0].h = 930;
accept_audio = true; accept_audio = false;
} }
}; };

View File

@@ -636,7 +636,7 @@ void TextureView::draw()
// display interface // display interface
// Locate window at upper left corner // Locate window at upper left corner
glm::vec2 P = glm::vec2(-background_frame_->scale_.x - 0.02f, background_frame_->scale_.y + 0.01 ); glm::vec2 P(-background_frame_->scale_.x, background_frame_->scale_.y + 0.01f);
P = Rendering::manager().project(glm::vec3(P, 0.f), scene.root()->transform_, false); P = Rendering::manager().project(glm::vec3(P, 0.f), scene.root()->transform_, false);
// Set window position depending on icons size // Set window position depending on icons size
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE); ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
@@ -1008,7 +1008,7 @@ void TextureView::draw()
ImGui::OpenPopup( "AppearanceSourceContextMenu" ); ImGui::OpenPopup( "AppearanceSourceContextMenu" );
show_context_menu_ = MENU_NONE; show_context_menu_ = MENU_NONE;
} }
if (ImGui::BeginPopup("AppearanceSourceContextMenu")) { if (ImGui::BeginPopup("AppearanceSourceContextMenu", ImGuiWindowFlags_NoMove)) {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(COLOR_APPEARANCE_SOURCE, 1.f)); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(COLOR_APPEARANCE_SOURCE, 1.f));
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(COLOR_MENU_HOVERED, 0.5f)); ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(COLOR_MENU_HOVERED, 0.5f));
Source *s = Mixer::manager().currentSource(); Source *s = Mixer::manager().currentSource();
@@ -1030,7 +1030,6 @@ void TextureView::draw()
if (ImGui::Selectable( ICON_FA_VECTOR_SQUARE " Reset" )){ if (ImGui::Selectable( ICON_FA_VECTOR_SQUARE " Reset" )){
s->group(mode_)->scale_ = glm::vec3(1.f); s->group(mode_)->scale_ = glm::vec3(1.f);
s->group(mode_)->rotation_.z = 0; s->group(mode_)->rotation_.z = 0;
// s->group(mode_)->crop_ = glm::vec3(1.f);
s->group(mode_)->translation_ = glm::vec3(0.f); s->group(mode_)->translation_ = glm::vec3(0.f);
s->touch(); s->touch();
Action::manager().store(s->name() + std::string(": Texture Reset")); Action::manager().store(s->name() + std::string(": Texture Reset"));
@@ -1040,7 +1039,7 @@ void TextureView::draw()
s->touch(); s->touch();
Action::manager().store(s->name() + std::string(": Texture Reset position")); Action::manager().store(s->name() + std::string(": Texture Reset position"));
} }
if (ImGui::Selectable( ICON_FA_COMPASS " Reset rotation" )){ if (ImGui::Selectable( ICON_FA_CIRCLE_NOTCH " Reset rotation" )){
s->group(mode_)->rotation_.z = 0; s->group(mode_)->rotation_.z = 0;
s->touch(); s->touch();
Action::manager().store(s->name() + std::string(": Texture Reset rotation")); Action::manager().store(s->name() + std::string(": Texture Reset rotation"));

View File

@@ -998,9 +998,9 @@ void UserInterface::showMenuEdit()
bool has_clipboard = (clipboard != nullptr && strlen(clipboard) > 0 && SessionLoader::isClipboard(clipboard)); bool has_clipboard = (clipboard != nullptr && strlen(clipboard) > 0 && SessionLoader::isClipboard(clipboard));
// UNDO // UNDO
if ( ImGui::MenuItem( MENU_UNDO, SHORTCUT_UNDO) ) if ( ImGui::MenuItem( MENU_UNDO, SHORTCUT_UNDO, false, Action::manager().current() > 1) )
Action::manager().undo(); Action::manager().undo();
if ( ImGui::MenuItem( MENU_REDO, SHORTCUT_REDO) ) if ( ImGui::MenuItem( MENU_REDO, SHORTCUT_REDO, false, Action::manager().current() < Action::manager().max()) )
Action::manager().redo(); Action::manager().redo();
// EDIT // EDIT
@@ -1024,7 +1024,7 @@ void UserInterface::showMenuEdit()
Mixer::manager().paste(clipboard); Mixer::manager().paste(clipboard);
navigator.discardPannel(); navigator.discardPannel();
} }
if (ImGui::MenuItem( MENU_SELECTALL, SHORTCUT_SELECTALL)) { if (ImGui::MenuItem( MENU_SELECTALL, SHORTCUT_SELECTALL, false, Mixer::manager().numSource() > 0)) {
Mixer::manager().view()->selectAll(); Mixer::manager().view()->selectAll();
navigator.discardPannel(); navigator.discardPannel();
} }
@@ -1217,7 +1217,7 @@ int UserInterface::RenderViewNavigator(int *shift)
*shift = 0; *shift = 0;
} }
ImGui::NextColumn(); ImGui::NextColumn();
if (ImGui::Selectable( ICON_FA_LAYER_GROUP, &selected_view[3], 0, iconsize)) if (ImGuiToolkit::SelectableIcon(ICON_WORKSPACE, "", selected_view[3], iconsize))
{ {
setView(View::LAYER); setView(View::LAYER);
*shift = 0; *shift = 0;
@@ -1230,7 +1230,7 @@ int UserInterface::RenderViewNavigator(int *shift)
} }
// skip TRANSITION view // skip TRANSITION view
ImGui::NextColumn(); ImGui::NextColumn();
if (ImGui::Selectable( ICON_FA_TV, &selected_view[6], 0, iconsize)) if (ImGuiToolkit::SelectableIcon(10, 7, "", selected_view[6], iconsize))
{ {
setView(View::DISPLAYS); setView(View::DISPLAYS);
*shift = 0; *shift = 0;
@@ -2700,10 +2700,10 @@ std::vector< std::string > Navigator::tooltips_ordering_files = { "Alphabetical"
Navigator::Navigator() Navigator::Navigator()
{ {
// default geometry // default geometry
width_ = 100; width_ = 100.f;
pannel_width_ = 5.f * width_; pannel_width_ = 5.f * width_;
height_ = 100; height_ = 100.f;
padding_width_ = 100; padding_width_ = 100.f;
// clean start // clean start
pannel_main_mode_ = Settings::application.pannel_main_mode; pannel_main_mode_ = Settings::application.pannel_main_mode;
@@ -2713,13 +2713,13 @@ Navigator::Navigator()
clearButtonSelection(); clearButtonSelection();
// restore media mode as saved // restore media mode as saved
if (Settings::application.recentImportFolders.path.compare(IMGUI_LABEL_RECENT_FILES) == 0) if (Settings::application.recentImportFolders.path.empty() ||
new_media_mode = MEDIA_RECENT; Settings::application.recentImportFolders.path.compare(IMGUI_LABEL_RECENT_FILES) == 0)
setNewMedia(MEDIA_RECENT);
else if (Settings::application.recentImportFolders.path.compare(IMGUI_LABEL_RECENT_RECORDS) == 0) else if (Settings::application.recentImportFolders.path.compare(IMGUI_LABEL_RECENT_RECORDS) == 0)
new_media_mode = MEDIA_RECORDING; setNewMedia(MEDIA_RECORDING);
else else
new_media_mode = MEDIA_FOLDER; setNewMedia(MEDIA_FOLDER, Settings::application.recentImportFolders.path);
new_media_mode_changed = true;
source_to_replace = nullptr; source_to_replace = nullptr;
} }
@@ -3025,7 +3025,7 @@ void Navigator::Render()
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoScrollWithMouse)) ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoScrollWithMouse))
{ {
// Mouse pointer selector // Mouse pointer selector
RenderMousePointerSelector(iconsize); tooltip = RenderMousePointerSelector(iconsize);
// List of icons for View selection // List of icons for View selection
static uint view_options_timeout = 0; static uint view_options_timeout = 0;
@@ -3044,7 +3044,7 @@ void Navigator::Render()
} }
} }
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) { if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) {
tooltip = {"Mixing ", "F1"}; tooltip = {Settings::application.views[View::MIXING].name, "F1"};
view_options_timeout = 0; view_options_timeout = 0;
} }
@@ -3057,7 +3057,7 @@ void Navigator::Render()
} }
} }
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) { if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) {
tooltip = {"Geometry ", "F2"}; tooltip = {Settings::application.views[View::GEOMETRY].name, "F2"};
view_options_timeout = 0; view_options_timeout = 0;
} }
@@ -3071,7 +3071,7 @@ void Navigator::Render()
} }
} }
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) { if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) {
tooltip = {"Layers ", "F3"}; tooltip = {Settings::application.views[View::LAYER].name, "F3"};
view_options_timeout = 0; view_options_timeout = 0;
} }
@@ -3084,13 +3084,12 @@ void Navigator::Render()
} }
} }
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) { if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) {
tooltip = {"Texturing ", "F4"}; tooltip = {Settings::application.views[View::TEXTURE].name, "F4"};
view_options_timeout = 0; view_options_timeout = 0;
} }
int j = Settings::application.render.disabled ? 8 : 7; int j = Settings::application.render.disabled ? 8 : 7;
if (ImGuiToolkit::SelectableIcon(10, j, "", selected_view[View::DISPLAYS], iconsize)) if (ImGuiToolkit::SelectableIcon(10, j, "", selected_view[View::DISPLAYS], iconsize))
// if (ImGui::Selectable( ICON_FA_TV, &selected_view[View::DISPLAYS], 0, iconsize))
{ {
UserInterface::manager().setView(View::DISPLAYS); UserInterface::manager().setView(View::DISPLAYS);
Settings::application.current_view = View::DISPLAYS; Settings::application.current_view = View::DISPLAYS;
@@ -3100,7 +3099,7 @@ void Navigator::Render()
} }
} }
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) { if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) {
tooltip = {"Displays ", "F5"}; tooltip = {Settings::application.views[View::DISPLAYS].name, "F5"};
view_options_timeout = 0; view_options_timeout = 0;
} }
@@ -4162,11 +4161,12 @@ void Navigator::RenderNewPannel(const ImVec2 &iconsize)
} }
} }
void Navigator::RenderMousePointerSelector(const ImVec2 &size) std::pair<std::string, std::string> Navigator::RenderMousePointerSelector(const ImVec2 &size)
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
ImVec2 top = ImGui::GetCursorPos(); ImVec2 top = ImGui::GetCursorPos();
bool enabled = Settings::application.current_view != View::TRANSITION; bool enabled = Settings::application.current_view != View::TRANSITION;
std::pair<std::string, std::string> tooltip = {"", ""};
/// ///
/// interactive button of the given size: show menu if clic or mouse over /// interactive button of the given size: show menu if clic or mouse over
/// ///
@@ -4179,7 +4179,7 @@ void Navigator::RenderMousePointerSelector(const ImVec2 &size)
ImVec2 bottom = ImGui::GetCursorScreenPos(); ImVec2 bottom = ImGui::GetCursorScreenPos();
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) { if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) {
ImGuiToolkit::ToolTip("Snap cursor", ALT_MOD); tooltip = {"Snap cursor", ALT_MOD};
counter_menu_timeout=0; counter_menu_timeout=0;
} }
@@ -4289,6 +4289,7 @@ void Navigator::RenderMousePointerSelector(const ImVec2 &size)
ImGui::EndPopup(); ImGui::EndPopup();
} }
return tooltip;
} }
void Navigator::RenderMainPannelSession() void Navigator::RenderMainPannelSession()
@@ -5181,11 +5182,12 @@ void Navigator::RenderMainPannelPlaylist()
// //
// Popup window to create playlist // Popup window to create playlist
// //
ImGui::SetNextWindowSize(ImVec2(0.8f * pannel_width_, 2.2f*ImGui::GetFrameHeightWithSpacing()), ImGuiCond_Always );
if (ImGui::BeginPopup("new_playlist_popup", ImGuiWindowFlags_NoMove)) if (ImGui::BeginPopup("new_playlist_popup", ImGuiWindowFlags_NoMove))
{ {
static bool withcopy = false; static bool withcopy = false;
char text_buf[64] = ""; char text_buf[64] = "";
ImGui::SetNextItemWidth(200); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
if ( ImGui::InputTextWithHint("Name", "[Enter] to validate", text_buf, 64, ImGuiInputTextFlags_EnterReturnsTrue) ) { if ( ImGui::InputTextWithHint("Name", "[Enter] to validate", text_buf, 64, ImGuiInputTextFlags_EnterReturnsTrue) ) {
std::string filename = std::string(text_buf); std::string filename = std::string(text_buf);
@@ -5216,7 +5218,7 @@ void Navigator::RenderMainPannelPlaylist()
} }
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_ITALIC); ImGuiToolkit::PushFont(ImGuiToolkit::FONT_ITALIC);
ImGuiToolkit::ButtonSwitch("Copy content", &withcopy, NULL, true ); ImGuiToolkit::ButtonSwitch("Duplicate current", &withcopy);
ImGui::PopFont(); ImGui::PopFont();
ImGui::EndPopup(); ImGui::EndPopup();
@@ -5271,31 +5273,50 @@ void Navigator::RenderMainPannelSettings()
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetCursorPosX(width_); ImGui::SetCursorPosX(width_);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
if ( ImGui::InputFloat("Scale", &Settings::application.scale, 0.1f, 0.1f, "%.1f")) { if ( ImGui::InputFloat("##Scale", &Settings::application.scale, 0.1f, 0.1f, "%.1f")) {
Settings::application.scale = CLAMP(Settings::application.scale, 0.5f, 2.f); Settings::application.scale = CLAMP(Settings::application.scale, 0.5f, 2.f);
ImGui::GetIO().FontGlobalScale = Settings::application.scale; ImGui::GetIO().FontGlobalScale = Settings::application.scale;
} }
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("Scale")) {
Settings::application.scale = 1.f;
ImGui::GetIO().FontGlobalScale = Settings::application.scale;
}
// //
// Recording preferences // Recording preferences
// //
ImGuiToolkit::Spacing();
ImGui::TextDisabled("Recording"); ImGui::TextDisabled("Recording");
// select CODEC and FPS // select CODEC and FPS
ImGui::SetCursorPosX(width_); ImGui::SetCursorPosX(width_);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::Combo("Codec", &Settings::application.record.profile, VideoRecorder::profile_name, IM_ARRAYSIZE(VideoRecorder::profile_name) ); ImGui::Combo("##Codec",
&Settings::application.record.profile,
VideoRecorder::profile_name,
IM_ARRAYSIZE(VideoRecorder::profile_name));
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("Codec"))
Settings::application.record.profile = 0;
ImGui::SetCursorPosX(width_); ImGui::SetCursorPosX(width_);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::Combo("Framerate", &Settings::application.record.framerate_mode, VideoRecorder::framerate_preset_name, IM_ARRAYSIZE(VideoRecorder::framerate_preset_name) ); ImGui::Combo("##Framerate",
&Settings::application.record.framerate_mode,
VideoRecorder::framerate_preset_name,
IM_ARRAYSIZE(VideoRecorder::framerate_preset_name));
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("Framerate"))
Settings::application.record.framerate_mode = 1;
// compute number of frames in buffer and show warning sign if too low // compute number of frames in buffer and show warning sign if too low
const FrameBuffer *output = Mixer::manager().session()->frame(); const FrameBuffer *output = Mixer::manager().session()->frame();
if (output) { if (output) {
guint64 nb = 0; guint64 nb = 0;
nb = VideoRecorder::buffering_preset_value[Settings::application.record.buffering_mode] / (output->width() * output->height() * 4); nb = VideoRecorder::buffering_preset_value[Settings::application.record.buffering_mode] / (output->width() * output->height() * 4);
char buf[512]; snprintf(buf, 512, "Buffer at %s can contain %ld frames (%dx%d), i.e. %.1f sec", VideoRecorder::buffering_preset_name[Settings::application.record.buffering_mode], char buf[512]; snprintf(buf, 512, "Buffer of %s can contain %ld frames (%dx%d), i.e. %.1f sec",
VideoRecorder::buffering_preset_name[Settings::application.record.buffering_mode],
(unsigned long)nb, output->width(), output->height(), (unsigned long)nb, output->width(), output->height(),
(float)nb / (float) VideoRecorder::framerate_preset_value[Settings::application.record.framerate_mode] ); (float)nb / (float) VideoRecorder::framerate_preset_value[Settings::application.record.framerate_mode] );
ImGuiToolkit::Indication(buf, 4, 6); ImGuiToolkit::Indication(buf, 4, 6);
@@ -5304,17 +5325,24 @@ void Navigator::RenderMainPannelSettings()
ImGui::SetCursorPosX(width_); ImGui::SetCursorPosX(width_);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::SliderInt("Buffer", &Settings::application.record.buffering_mode, 0, IM_ARRAYSIZE(VideoRecorder::buffering_preset_name)-1, ImGui::SliderInt("##Buffer", &Settings::application.record.buffering_mode, 0,
IM_ARRAYSIZE(VideoRecorder::buffering_preset_name)-1,
VideoRecorder::buffering_preset_name[Settings::application.record.buffering_mode]); VideoRecorder::buffering_preset_name[Settings::application.record.buffering_mode]);
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("Buffer"))
Settings::application.record.buffering_mode = 2;
ImGuiToolkit::Indication("Priority when buffer is full and recorder has to skip frames;\n" ImGuiToolkit::Indication("Priority when buffer is full and recorder has to skip frames;\n"
ICON_FA_CARET_RIGHT " Duration:\n Variable framerate, correct duration.\n" ICON_FA_CARET_RIGHT " Duration: Correct duration, variable framerate."
ICON_FA_CARET_RIGHT " Framerate:\n Correct framerate, shorter duration.", ICON_FA_CARET_RIGHT " Framerate: Correct framerate, shorter duration.\n",
ICON_FA_CHECK_DOUBLE); ICON_FA_CHECK_DOUBLE);
ImGui::SameLine(0); ImGui::SameLine(0);
ImGui::SetCursorPosX(width_); ImGui::SetCursorPosX(width_);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::Combo("Priority", &Settings::application.record.priority_mode, "Duration\0Framerate\0"); ImGui::Combo("##Priority", &Settings::application.record.priority_mode, "Duration\0Framerate\0");
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("Priority"))
Settings::application.record.priority_mode = 1;
// //
// AUDIO // AUDIO
@@ -5341,7 +5369,7 @@ void Navigator::RenderMainPannelSettings()
// Combo selector of audio device // Combo selector of audio device
ImGui::SetCursorPosX(width_); ImGui::SetCursorPosX(width_);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
if (ImGui::BeginCombo("Audio", current_audio.c_str())) { if (ImGui::BeginCombo("##Audio", current_audio.c_str())) {
// No audio selection // No audio selection
if (ImGui::Selectable(ICON_FA_MICROPHONE_ALT_SLASH " None")) if (ImGui::Selectable(ICON_FA_MICROPHONE_ALT_SLASH " None"))
Settings::application.record.audio_device = ""; Settings::application.record.audio_device = "";
@@ -5359,6 +5387,9 @@ void Navigator::RenderMainPannelSettings()
} }
if (!Settings::application.record.audio_device.empty() && ImGui::IsItemHovered()) if (!Settings::application.record.audio_device.empty() && ImGui::IsItemHovered())
ImGuiToolkit::ToolTip(current_audio.c_str()); ImGuiToolkit::ToolTip(current_audio.c_str());
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("Audio"))
Settings::application.record.audio_device = "";
} }
@@ -5373,7 +5404,10 @@ void Navigator::RenderMainPannelSettings()
ImGui::SameLine(0); ImGui::SameLine(0);
ImGui::SetCursorPosX(width_); ImGui::SetCursorPosX(width_);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::Combo("P2P codec", &Settings::application.stream_protocol, "JPEG\0H264\0"); ImGui::Combo("##P2P codec", &Settings::application.stream_protocol, "JPEG\0H264\0");
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("P2P codec"))
Settings::application.stream_protocol = 0;
if (VideoBroadcast::available()) { if (VideoBroadcast::available()) {
char msg[256]; char msg[256];
@@ -5392,11 +5426,14 @@ void Navigator::RenderMainPannelSettings()
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
char bufport[7] = ""; char bufport[7] = "";
snprintf(bufport, 7, "%d", Settings::application.broadcast_port); snprintf(bufport, 7, "%d", Settings::application.broadcast_port);
ImGui::InputTextWithHint("SRT Port", "7070", bufport, 6, ImGuiInputTextFlags_CharsDecimal); ImGui::InputTextWithHint("##SRT Port", "7070", bufport, 6, ImGuiInputTextFlags_CharsDecimal);
if (ImGui::IsItemDeactivatedAfterEdit()){ if (ImGui::IsItemDeactivatedAfterEdit()){
if ( BaseToolkit::is_a_number(bufport, &Settings::application.broadcast_port)) if ( BaseToolkit::is_a_number(bufport, &Settings::application.broadcast_port))
Settings::application.broadcast_port = CLAMP(Settings::application.broadcast_port, 1029, 49150); Settings::application.broadcast_port = CLAMP(Settings::application.broadcast_port, 1029, 49150);
} }
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("SRT Port"))
Settings::application.broadcast_port = 7070;
} }
if (ShmdataBroadcast::available()) { if (ShmdataBroadcast::available()) {
@@ -5427,10 +5464,13 @@ void Navigator::RenderMainPannelSettings()
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
char bufsocket[64] = ""; char bufsocket[64] = "";
snprintf(bufsocket, 64, "%s", Settings::application.shm_socket_path.c_str()); snprintf(bufsocket, 64, "%s", Settings::application.shm_socket_path.c_str());
ImGui::InputTextWithHint("SHM path", SystemToolkit::home_path().c_str(), bufsocket, 64); ImGui::InputTextWithHint("##SHM path", SystemToolkit::home_path().c_str(), bufsocket, 64);
if (ImGui::IsItemDeactivatedAfterEdit()) { if (ImGui::IsItemDeactivatedAfterEdit()) {
Settings::application.shm_socket_path = bufsocket; Settings::application.shm_socket_path = bufsocket;
} }
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("SHM path"))
Settings::application.shm_socket_path = "";
if (ShmdataBroadcast::available(ShmdataBroadcast::SHM_SHMDATASINK)) { if (ShmdataBroadcast::available(ShmdataBroadcast::SHM_SHMDATASINK)) {
ImGui::SetCursorPosX(width_); ImGui::SetCursorPosX(width_);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
@@ -5461,25 +5501,31 @@ void Navigator::RenderMainPannelSettings()
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
char bufreceive[7] = ""; char bufreceive[7] = "";
snprintf(bufreceive, 7, "%d", Settings::application.control.osc_port_receive); snprintf(bufreceive, 7, "%d", Settings::application.control.osc_port_receive);
ImGui::InputTextWithHint("Port in", "7000", bufreceive, 7, ImGuiInputTextFlags_CharsDecimal); ImGui::InputTextWithHint("##Port in", "7000", bufreceive, 7, ImGuiInputTextFlags_CharsDecimal);
if (ImGui::IsItemDeactivatedAfterEdit()){ if (ImGui::IsItemDeactivatedAfterEdit()){
if ( BaseToolkit::is_a_number(bufreceive, &Settings::application.control.osc_port_receive)){ if ( BaseToolkit::is_a_number(bufreceive, &Settings::application.control.osc_port_receive)){
Settings::application.control.osc_port_receive = CLAMP(Settings::application.control.osc_port_receive, 1029, 49150); Settings::application.control.osc_port_receive = CLAMP(Settings::application.control.osc_port_receive, 1029, 49150);
Control::manager().init(); Control::manager().init();
} }
} }
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("Port in"))
Settings::application.control.osc_port_receive = OSC_PORT_RECV_DEFAULT;
ImGui::SetCursorPosX(width_); ImGui::SetCursorPosX(width_);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
char bufsend[7] = ""; char bufsend[7] = "";
snprintf(bufsend, 7, "%d", Settings::application.control.osc_port_send); snprintf(bufsend, 7, "%d", Settings::application.control.osc_port_send);
ImGui::InputTextWithHint("Port out", "7001", bufsend, 7, ImGuiInputTextFlags_CharsDecimal); ImGui::InputTextWithHint("##Port out", "7001", bufsend, 7, ImGuiInputTextFlags_CharsDecimal);
if (ImGui::IsItemDeactivatedAfterEdit()){ if (ImGui::IsItemDeactivatedAfterEdit()){
if ( BaseToolkit::is_a_number(bufsend, &Settings::application.control.osc_port_send)){ if ( BaseToolkit::is_a_number(bufsend, &Settings::application.control.osc_port_send)){
Settings::application.control.osc_port_send = CLAMP(Settings::application.control.osc_port_send, 1029, 49150); Settings::application.control.osc_port_send = CLAMP(Settings::application.control.osc_port_send, 1029, 49150);
Control::manager().init(); Control::manager().init();
} }
} }
ImGui::SameLine(0, IMGUI_SAME_LINE);
if (ImGuiToolkit::TextButton("Port out"))
Settings::application.control.osc_port_send = OSC_PORT_SEND_DEFAULT;
ImGui::SetCursorPosX(width_); ImGui::SetCursorPosX(width_);
const float w = IMGUI_RIGHT_ALIGN - ImGui::GetFrameHeightWithSpacing(); const float w = IMGUI_RIGHT_ALIGN - ImGui::GetFrameHeightWithSpacing();

View File

@@ -72,7 +72,7 @@ class Navigator
void RenderTransitionPannel(const ImVec2 &iconsize); void RenderTransitionPannel(const ImVec2 &iconsize);
void RenderNewPannel(const ImVec2 &iconsize); void RenderNewPannel(const ImVec2 &iconsize);
void RenderViewOptions(uint *timeout, const ImVec2 &pos, const ImVec2 &size); void RenderViewOptions(uint *timeout, const ImVec2 &pos, const ImVec2 &size);
void RenderMousePointerSelector(const ImVec2 &size); std::pair<std::string, std::string> RenderMousePointerSelector(const ImVec2 &size);
public: public: