mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 10:49:59 +01:00
Cleanup Menu and navigator.
This commit is contained in:
@@ -58,6 +58,7 @@ void Settings::Save()
|
|||||||
applicationNode->SetAttribute("stats", application.stats);
|
applicationNode->SetAttribute("stats", application.stats);
|
||||||
applicationNode->SetAttribute("stats_corner", application.stats_corner);
|
applicationNode->SetAttribute("stats_corner", application.stats_corner);
|
||||||
applicationNode->SetAttribute("logs", application.logs);
|
applicationNode->SetAttribute("logs", application.logs);
|
||||||
|
applicationNode->SetAttribute("toolbox", application.toolbox);
|
||||||
pRoot->InsertEndChild(applicationNode);
|
pRoot->InsertEndChild(applicationNode);
|
||||||
|
|
||||||
// block: views
|
// block: views
|
||||||
@@ -147,6 +148,7 @@ void Settings::Load()
|
|||||||
pElement->QueryBoolAttribute("shader_editor", &application.shader_editor);
|
pElement->QueryBoolAttribute("shader_editor", &application.shader_editor);
|
||||||
pElement->QueryBoolAttribute("stats", &application.stats);
|
pElement->QueryBoolAttribute("stats", &application.stats);
|
||||||
pElement->QueryBoolAttribute("logs", &application.logs);
|
pElement->QueryBoolAttribute("logs", &application.logs);
|
||||||
|
pElement->QueryBoolAttribute("toolbox", &application.toolbox);
|
||||||
pElement->QueryIntAttribute("stats_corner", &application.stats_corner);
|
pElement->QueryIntAttribute("stats_corner", &application.stats_corner);
|
||||||
|
|
||||||
// block: views
|
// block: views
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ struct Application
|
|||||||
bool preview;
|
bool preview;
|
||||||
bool media_player;
|
bool media_player;
|
||||||
bool shader_editor;
|
bool shader_editor;
|
||||||
|
bool toolbox;
|
||||||
|
|
||||||
// Settings of Views
|
// Settings of Views
|
||||||
int current_view;
|
int current_view;
|
||||||
@@ -62,9 +63,10 @@ struct Application
|
|||||||
stats = false;
|
stats = false;
|
||||||
stats_corner = 1;
|
stats_corner = 1;
|
||||||
logs = false;
|
logs = false;
|
||||||
preview = true;
|
preview = false;
|
||||||
media_player = false;
|
media_player = false;
|
||||||
shader_editor = false;
|
shader_editor = false;
|
||||||
|
toolbox = false;
|
||||||
current_view = 1;
|
current_view = 1;
|
||||||
windows.push_back(WindowConfig(APP_TITLE));
|
windows.push_back(WindowConfig(APP_TITLE));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ static std::thread loadThread;
|
|||||||
static bool loadThreadDone = false;
|
static bool loadThreadDone = false;
|
||||||
static TextEditor editor;
|
static TextEditor editor;
|
||||||
|
|
||||||
|
void ShowAboutGStreamer(bool* p_open);
|
||||||
|
void ShowAboutOpengl(bool* p_open);
|
||||||
|
void ShowAbout(bool* p_open);
|
||||||
|
|
||||||
static void NativeOpenFile(std::string ext)
|
static void NativeOpenFile(std::string ext)
|
||||||
{
|
{
|
||||||
@@ -79,6 +82,10 @@ static void NativeOpenFile(std::string ext)
|
|||||||
|
|
||||||
UserInterface::UserInterface()
|
UserInterface::UserInterface()
|
||||||
{
|
{
|
||||||
|
show_about = false;
|
||||||
|
show_imgui_about = false;
|
||||||
|
show_gst_about = false;
|
||||||
|
show_opengl_about = false;
|
||||||
currentTextEdit = "";
|
currentTextEdit = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,22 +153,37 @@ void UserInterface::handleKeyboard()
|
|||||||
// Application "CTRL +"" Shortcuts
|
// Application "CTRL +"" Shortcuts
|
||||||
if ( io.KeyCtrl ) {
|
if ( io.KeyCtrl ) {
|
||||||
|
|
||||||
if (ImGui::IsKeyPressed( GLFW_KEY_Q ))
|
if (ImGui::IsKeyPressed( GLFW_KEY_Q )) {
|
||||||
|
// Quit
|
||||||
Rendering::manager().Close();
|
Rendering::manager().Close();
|
||||||
else if (ImGui::IsKeyPressed( GLFW_KEY_O ))
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (ImGui::IsKeyPressed( GLFW_KEY_S ))
|
else if (ImGui::IsKeyPressed( GLFW_KEY_O )) {
|
||||||
{
|
// Open session
|
||||||
|
}
|
||||||
|
else if (ImGui::IsKeyPressed( GLFW_KEY_S )) {
|
||||||
|
// Save Session
|
||||||
std::cerr <<" Save File " << std::endl;
|
std::cerr <<" Save File " << std::endl;
|
||||||
}
|
}
|
||||||
else if (ImGui::IsKeyPressed( GLFW_KEY_W ))
|
else if (ImGui::IsKeyPressed( GLFW_KEY_W )) {
|
||||||
{
|
// New Session
|
||||||
std::cerr <<" Close File " << std::endl;
|
std::cerr <<" Close File " << std::endl;
|
||||||
}
|
}
|
||||||
else if (ImGui::IsKeyPressed( GLFW_KEY_L ))
|
else if (ImGui::IsKeyPressed( GLFW_KEY_L )) {
|
||||||
mainwindow.ToggleLogs();
|
// Logs
|
||||||
|
Settings::application.logs = !Settings::application.logs;
|
||||||
|
}
|
||||||
|
else if (ImGui::IsKeyPressed( GLFW_KEY_T )) {
|
||||||
|
// Logs
|
||||||
|
Settings::application.toolbox = !Settings::application.toolbox;
|
||||||
|
}
|
||||||
|
else if (ImGui::IsKeyPressed( GLFW_KEY_P )) {
|
||||||
|
// Logs
|
||||||
|
Settings::application.preview = !Settings::application.preview;
|
||||||
|
}
|
||||||
|
else if (ImGui::IsKeyPressed( GLFW_KEY_M )) {
|
||||||
|
// Logs
|
||||||
|
Settings::application.media_player = !Settings::application.media_player;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +195,7 @@ void UserInterface::handleKeyboard()
|
|||||||
if (ImGui::IsKeyPressed( GLFW_KEY_F12 ))
|
if (ImGui::IsKeyPressed( GLFW_KEY_F12 ))
|
||||||
Rendering::manager().ToggleFullscreen();
|
Rendering::manager().ToggleFullscreen();
|
||||||
else if (ImGui::IsKeyPressed( GLFW_KEY_F11 ))
|
else if (ImGui::IsKeyPressed( GLFW_KEY_F11 ))
|
||||||
mainwindow.StartScreenshot();
|
toolbox.StartScreenshot();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,8 +303,7 @@ void UserInterface::NewFrame()
|
|||||||
handleKeyboard();
|
handleKeyboard();
|
||||||
handleMouse();
|
handleMouse();
|
||||||
|
|
||||||
// Main window
|
// navigator bar first
|
||||||
mainwindow.Render();
|
|
||||||
navigator.Render();
|
navigator.Render();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -309,6 +330,8 @@ void UserInterface::Render()
|
|||||||
Log::Render();
|
Log::Render();
|
||||||
|
|
||||||
// windows
|
// windows
|
||||||
|
if (Settings::application.toolbox)
|
||||||
|
toolbox.Render();
|
||||||
if (Settings::application.preview)
|
if (Settings::application.preview)
|
||||||
RenderPreview();
|
RenderPreview();
|
||||||
if (Settings::application.media_player)
|
if (Settings::application.media_player)
|
||||||
@@ -320,6 +343,16 @@ void UserInterface::Render()
|
|||||||
if (Settings::application.logs)
|
if (Settings::application.logs)
|
||||||
Log::ShowLogWindow(&Settings::application.logs);
|
Log::ShowLogWindow(&Settings::application.logs);
|
||||||
|
|
||||||
|
// about
|
||||||
|
if (show_about)
|
||||||
|
ShowAbout(&show_about);
|
||||||
|
if (show_imgui_about)
|
||||||
|
ImGui::ShowAboutWindow(&show_imgui_about);
|
||||||
|
if (show_gst_about)
|
||||||
|
ShowAboutGStreamer(&show_gst_about);
|
||||||
|
if (show_opengl_about)
|
||||||
|
ShowAboutOpengl(&show_opengl_about);
|
||||||
|
|
||||||
// all IMGUI Rendering
|
// all IMGUI Rendering
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||||
@@ -333,233 +366,60 @@ void UserInterface::Terminate()
|
|||||||
ImGui::DestroyContext();
|
ImGui::DestroyContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UserInterface::showMenuFile()
|
||||||
|
{
|
||||||
|
// TODO : New
|
||||||
|
if (ImGui::MenuItem( ICON_FA_FILE " New", "Ctrl+W")) {
|
||||||
|
|
||||||
|
}
|
||||||
|
if (ImGui::MenuItem( ICON_FA_FILE_UPLOAD " Open", "Ctrl+O")) {
|
||||||
|
// UserInterface::manager().OpenFileMedia();
|
||||||
|
}
|
||||||
|
if (ImGui::MenuItem( ICON_FA_FILE_DOWNLOAD " Save", "Ctrl+S")) {
|
||||||
|
// UserInterface::manager().OpenFileMedia();
|
||||||
|
}
|
||||||
|
// TODO : Save As...
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
if (ImGui::MenuItem( ICON_FA_POWER_OFF " Quit", "Ctrl+Q")) {
|
||||||
|
Rendering::manager().Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ToolBox::ToolBox()
|
ToolBox::ToolBox()
|
||||||
{
|
{
|
||||||
show_app_about = false;
|
|
||||||
show_gst_about = false;
|
|
||||||
show_opengl_about = false;
|
|
||||||
show_demo_window = false;
|
show_demo_window = false;
|
||||||
// show_logs_window = false;
|
|
||||||
show_icons_window = false;
|
show_icons_window = false;
|
||||||
screenshot_step = 0;
|
screenshot_step = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolBox::ToggleLogs()
|
|
||||||
{
|
|
||||||
Settings::application.logs = !Settings::application.logs;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ToolBox::StartScreenshot()
|
void ToolBox::StartScreenshot()
|
||||||
{
|
{
|
||||||
screenshot_step = 1;
|
screenshot_step = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ShowAboutOpengl(bool* p_open)
|
|
||||||
{
|
|
||||||
if (!ImGui::Begin("About OpenGL", p_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize))
|
|
||||||
{
|
|
||||||
ImGui::End();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_BOLD);
|
|
||||||
ImGui::Text("OpenGL %s", glGetString(GL_VERSION) );
|
|
||||||
ImGui::PopFont();
|
|
||||||
ImGui::Separator();
|
|
||||||
ImGui::Text("OpenGL is the premier environment for developing portable, \ninteractive 2D and 3D graphics applications.");
|
|
||||||
ImGuiToolkit::ButtonOpenWebpage("https://www.opengl.org");
|
|
||||||
ImGui::SameLine();
|
|
||||||
|
|
||||||
// static std::string allextensions( glGetString(GL_EXTENSIONS) );
|
|
||||||
|
|
||||||
static bool show_opengl_info = false;
|
|
||||||
ImGuiToolkit::ButtonIconToggle(10,0,13,14,&show_opengl_info);
|
|
||||||
ImGui::SameLine(); ImGui::Text("Details");
|
|
||||||
if (show_opengl_info)
|
|
||||||
{
|
|
||||||
ImGui::Separator();
|
|
||||||
bool copy_to_clipboard = ImGui::Button( ICON_FA_COPY " Copy");
|
|
||||||
ImGui::SameLine(0.f, 60.f);
|
|
||||||
static char _openglfilter[64] = "";
|
|
||||||
ImGui::InputText("Filter", _openglfilter, 64);
|
|
||||||
ImGui::SameLine();
|
|
||||||
if ( ImGuiToolkit::ButtonIcon( 12, 14 ) )
|
|
||||||
_openglfilter[0] = '\0';
|
|
||||||
std::string filter(_openglfilter);
|
|
||||||
|
|
||||||
ImGui::BeginChildFrame(ImGui::GetID("gstinfos"), ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 18), ImGuiWindowFlags_NoMove);
|
|
||||||
if (copy_to_clipboard)
|
|
||||||
{
|
|
||||||
ImGui::LogToClipboard();
|
|
||||||
ImGui::LogText("```\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Text("OpenGL %s", glGetString(GL_VERSION) );
|
|
||||||
ImGui::Text("%s %s", glGetString(GL_RENDERER), glGetString(GL_VENDOR));
|
|
||||||
ImGui::Text("Extensions (runtime) :");
|
|
||||||
|
|
||||||
GLint numExtensions = 0;
|
|
||||||
glGetIntegerv( GL_NUM_EXTENSIONS, &numExtensions );
|
|
||||||
for (int i = 0; i < numExtensions; ++i){
|
|
||||||
std::string ext( (char*) glGetStringi(GL_EXTENSIONS, i) );
|
|
||||||
if ( filter.empty() || ext.find(filter) != std::string::npos )
|
|
||||||
ImGui::Text("%s", ext.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (copy_to_clipboard)
|
|
||||||
{
|
|
||||||
ImGui::LogText("\n```\n");
|
|
||||||
ImGui::LogFinish();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndChildFrame();
|
|
||||||
}
|
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void ShowAboutGStreamer(bool* p_open)
|
|
||||||
{
|
|
||||||
if (!ImGui::Begin("About Gstreamer", p_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize))
|
|
||||||
{
|
|
||||||
ImGui::End();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_BOLD);
|
|
||||||
ImGui::Text("GStreamer %s", GstToolkit::gst_version().c_str());
|
|
||||||
ImGui::PopFont();
|
|
||||||
ImGui::Separator();
|
|
||||||
ImGui::Text("A flexible, fast and multiplatform multimedia framework.");
|
|
||||||
ImGui::Text("GStreamer is licensed under the LGPL License.");
|
|
||||||
ImGuiToolkit::ButtonOpenWebpage("https://gstreamer.freedesktop.org/");
|
|
||||||
ImGui::SameLine();
|
|
||||||
|
|
||||||
static bool show_config_info = false;
|
|
||||||
ImGuiToolkit::ButtonIconToggle(10,0,13,14,&show_config_info);
|
|
||||||
ImGui::SameLine(); ImGui::Text("Details");
|
|
||||||
if (show_config_info)
|
|
||||||
{
|
|
||||||
ImGui::Separator();
|
|
||||||
bool copy_to_clipboard = ImGui::Button( ICON_FA_COPY " Copy");
|
|
||||||
ImGui::SameLine(0.f, 60.f);
|
|
||||||
static char _filter[64] = ""; ImGui::InputText("Filter", _filter, 64);
|
|
||||||
ImGui::SameLine();
|
|
||||||
if ( ImGuiToolkit::ButtonIcon( 12, 14 ) )
|
|
||||||
_filter[0] = '\0';
|
|
||||||
std::string filter(_filter);
|
|
||||||
|
|
||||||
ImGui::BeginChildFrame(ImGui::GetID("gstinfos"), ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 18), ImGuiWindowFlags_NoMove);
|
|
||||||
if (copy_to_clipboard)
|
|
||||||
{
|
|
||||||
ImGui::LogToClipboard();
|
|
||||||
ImGui::LogText("```\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Text("GStreamer %s", GstToolkit::gst_version().c_str());
|
|
||||||
ImGui::Text("Plugins & features (runtime) :");
|
|
||||||
|
|
||||||
std::list<std::string> filteredlist;
|
|
||||||
|
|
||||||
// filter
|
|
||||||
if ( filter.empty() )
|
|
||||||
filteredlist = GstToolkit::all_plugins();
|
|
||||||
else {
|
|
||||||
std::list<std::string> plist = GstToolkit::all_plugins();
|
|
||||||
for (auto const& i: plist) {
|
|
||||||
// add plugin if plugin name match
|
|
||||||
if ( i.find(filter) != std::string::npos )
|
|
||||||
filteredlist.push_back( i.c_str() );
|
|
||||||
// check in features
|
|
||||||
std::list<std::string> flist = GstToolkit::all_plugin_features(i);
|
|
||||||
for (auto const& j: flist) {
|
|
||||||
// add plugin if feature name matches
|
|
||||||
if ( j.find(filter) != std::string::npos )
|
|
||||||
filteredlist.push_back( i.c_str() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// display list
|
|
||||||
for (auto const& t: filteredlist) {
|
|
||||||
ImGui::Text("> %s", t.c_str());
|
|
||||||
std::list<std::string> flist = GstToolkit::all_plugin_features(t);
|
|
||||||
for (auto const& j: flist) {
|
|
||||||
if ( j.find(filter) != std::string::npos )
|
|
||||||
{
|
|
||||||
ImGui::Text(" - %s", j.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (copy_to_clipboard)
|
|
||||||
{
|
|
||||||
ImGui::LogText("\n```\n");
|
|
||||||
ImGui::LogFinish();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndChildFrame();
|
|
||||||
}
|
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ToolBox::Render()
|
void ToolBox::Render()
|
||||||
{
|
{
|
||||||
// first run
|
// first run
|
||||||
ImGui::SetNextWindowPos(ImVec2(40, 40), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowPos(ImVec2(40, 40), ImGuiCond_FirstUseEver);
|
||||||
ImGui::SetNextWindowSize(ImVec2(400, 300), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(400, 300), ImGuiCond_FirstUseEver);
|
||||||
|
if ( !ImGui::Begin(IMGUI_TITLE_TOOLBOX, &Settings::application.toolbox, ImGuiWindowFlags_MenuBar) )
|
||||||
ImGui::Begin(IMGUI_TITLE_MAINWINDOW, NULL, ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoCollapse);
|
{
|
||||||
|
ImGui::End();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Menu Bar
|
// Menu Bar
|
||||||
if (ImGui::BeginMenuBar())
|
if (ImGui::BeginMenuBar())
|
||||||
{
|
{
|
||||||
if (ImGui::BeginMenu("File"))
|
|
||||||
{
|
|
||||||
if (ImGui::MenuItem( ICON_FA_FILE_UPLOAD " Open", "Ctrl+O")) {
|
|
||||||
// UserInterface::manager().OpenFileMedia();
|
|
||||||
}
|
|
||||||
if (ImGui::MenuItem( ICON_FA_FILE_DOWNLOAD " Save", "Ctrl+S")) {
|
|
||||||
// UserInterface::manager().OpenFileMedia();
|
|
||||||
}
|
|
||||||
if (ImGui::MenuItem( ICON_FA_FILE " Close", "Ctrl+W")) {
|
|
||||||
|
|
||||||
}
|
|
||||||
if (ImGui::MenuItem( ICON_FA_POWER_OFF " Quit", "Ctrl+Q")) {
|
|
||||||
Rendering::manager().Close();
|
|
||||||
}
|
|
||||||
ImGui::EndMenu();
|
|
||||||
}
|
|
||||||
// if (ImGui::BeginMenu("Windows"))
|
|
||||||
// {
|
|
||||||
//// ImGui::MenuItem( IMGUI_TITLE_PREVIEW, NULL, &Settings::application.preview);
|
|
||||||
//// ImGui::MenuItem( IMGUI_TITLE_MEDIAPLAYER, NULL, &Settings::application.media_player);
|
|
||||||
//// ImGui::MenuItem( IMGUI_TITLE_SHADEREDITOR, NULL, &Settings::application.shader_editor);
|
|
||||||
// ImGui::MenuItem("Appearance", NULL, false, false);
|
|
||||||
// ImGui::SetNextItemWidth(200);
|
|
||||||
// if ( ImGui::SliderFloat("Scale", &Settings::application.scale, 0.8f, 1.2f, "%.1f"))
|
|
||||||
// ImGui::GetIO().FontGlobalScale = Settings::application.scale;
|
|
||||||
|
|
||||||
// ImGui::SetNextItemWidth(200);
|
|
||||||
// if ( ImGui::Combo("Color", &Settings::application.accent_color, "Blue\0Orange\0Grey\0\0"))
|
|
||||||
// ImGuiToolkit::SetAccentColor(static_cast<ImGuiToolkit::accent_color>(Settings::application.accent_color));
|
|
||||||
// ImGui::EndMenu();
|
|
||||||
// }
|
|
||||||
if (ImGui::BeginMenu("Tools"))
|
if (ImGui::BeginMenu("Tools"))
|
||||||
{
|
{
|
||||||
// ImGui::MenuItem( ICON_FA_LIST " Logs", "Ctrl+L", &show_logs_window);
|
|
||||||
// ImGui::MenuItem( ICON_FA_TACHOMETER_ALT " Metrics", NULL, &Settings::application.stats);
|
|
||||||
if ( ImGui::MenuItem( ICON_FA_CAMERA_RETRO " Screenshot", NULL) )
|
if ( ImGui::MenuItem( ICON_FA_CAMERA_RETRO " Screenshot", NULL) )
|
||||||
StartScreenshot();
|
StartScreenshot();
|
||||||
|
|
||||||
ImGui::MenuItem("About", NULL, false, false);
|
|
||||||
ImGui::MenuItem("About ImGui", NULL, &show_app_about);
|
|
||||||
ImGui::MenuItem("About OpenGL", NULL, &show_opengl_about);
|
|
||||||
ImGui::MenuItem("About GStreamer", NULL, &show_gst_about);
|
|
||||||
|
|
||||||
ImGui::MenuItem("Dev", NULL, false, false);
|
ImGui::MenuItem("Dev", NULL, false, false);
|
||||||
ImGui::MenuItem("Icons", NULL, &show_icons_window);
|
ImGui::MenuItem("Icons", NULL, &show_icons_window);
|
||||||
ImGui::MenuItem("Demo ImGui", NULL, &show_demo_window);
|
ImGui::MenuItem("Demo ImGui", NULL, &show_demo_window);
|
||||||
@@ -583,20 +443,12 @@ void ToolBox::Render()
|
|||||||
|
|
||||||
ImGui::End(); // "v-mix"
|
ImGui::End(); // "v-mix"
|
||||||
|
|
||||||
// if (show_logs_window)
|
|
||||||
// Log::ShowLogWindow(&show_logs_window);
|
|
||||||
|
|
||||||
// About and other utility windows
|
// About and other utility windows
|
||||||
if (show_icons_window)
|
if (show_icons_window)
|
||||||
ImGuiToolkit::ShowIconsWindow(&show_icons_window);
|
ImGuiToolkit::ShowIconsWindow(&show_icons_window);
|
||||||
if (show_demo_window)
|
if (show_demo_window)
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
ImGui::ShowDemoWindow(&show_demo_window);
|
||||||
if (show_app_about)
|
|
||||||
ImGui::ShowAboutWindow(&show_app_about);
|
|
||||||
if (show_gst_about)
|
|
||||||
ShowAboutGStreamer(&show_gst_about);
|
|
||||||
if (show_opengl_about)
|
|
||||||
ShowAboutOpengl(&show_opengl_about);
|
|
||||||
|
|
||||||
// taking screenshot is in 3 steps
|
// taking screenshot is in 3 steps
|
||||||
// 1) wait 1 frame that the menu / action showing button to take screenshot disapears
|
// 1) wait 1 frame that the menu / action showing button to take screenshot disapears
|
||||||
@@ -664,8 +516,7 @@ void UserInterface::RenderMediaPlayer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(200, 200), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowPos(ImVec2(200, 200), ImGuiCond_FirstUseEver);
|
||||||
ImGui::SetNextWindowSize(ImVec2(400, 300), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(400, 400), ImGuiCond_FirstUseEver);
|
||||||
|
|
||||||
if ( !ImGui::Begin(IMGUI_TITLE_MEDIAPLAYER, &Settings::application.media_player, ImGuiWindowFlags_NoScrollbar) || !show)
|
if ( !ImGui::Begin(IMGUI_TITLE_MEDIAPLAYER, &Settings::application.media_player, ImGuiWindowFlags_NoScrollbar) || !show)
|
||||||
{
|
{
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
@@ -976,7 +827,7 @@ void Navigator::Render()
|
|||||||
{
|
{
|
||||||
Mixer::manager().setCurrentView(View::GEOMETRY);
|
Mixer::manager().setCurrentView(View::GEOMETRY);
|
||||||
}
|
}
|
||||||
if (ImGui::Selectable( ICON_FA_CUBE, &selected_view[3], 0, iconsize))
|
if (ImGui::Selectable( ICON_FA_LAYER_GROUP, &selected_view[3], 0, iconsize))
|
||||||
{
|
{
|
||||||
// TODO : Layers view
|
// TODO : Layers view
|
||||||
}
|
}
|
||||||
@@ -1009,7 +860,6 @@ void Navigator::Render()
|
|||||||
ImGui::PopStyleColor(2);
|
ImGui::PopStyleColor(2);
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1107,26 +957,226 @@ void Navigator::RenderMainPannel()
|
|||||||
{
|
{
|
||||||
// TITLE
|
// TITLE
|
||||||
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
|
||||||
ImGui::Text("vimix");
|
ImGui::Text(APP_NAME);
|
||||||
ImGui::PopFont();
|
ImGui::PopFont();
|
||||||
|
|
||||||
|
if (ImGui::BeginMenu("Session"))
|
||||||
|
{
|
||||||
|
UserInterface::manager().showMenuFile();
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
|
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||||
|
static int recent_session = 0;
|
||||||
|
if ( ImGui::Combo("Recent", &recent_session, "Select\0") ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Text(" ");
|
||||||
ImGui::Text("Windows");
|
ImGui::Text("Windows");
|
||||||
ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_PREVIEW, &Settings::application.preview);
|
ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_TOOLBOX, &Settings::application.toolbox, "Ctrl + T");
|
||||||
ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_MEDIAPLAYER, &Settings::application.media_player);
|
ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_PREVIEW, &Settings::application.preview, "Ctrl + P");
|
||||||
|
ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_MEDIAPLAYER, &Settings::application.media_player, "Ctrl + M");
|
||||||
ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_SHADEREDITOR, &Settings::application.shader_editor);
|
ImGuiToolkit::ButtonSwitch( IMGUI_TITLE_SHADEREDITOR, &Settings::application.shader_editor);
|
||||||
ImGuiToolkit::ButtonSwitch( ICON_FA_TACHOMETER_ALT " Metrics", &Settings::application.stats);
|
ImGuiToolkit::ButtonSwitch( ICON_FA_TACHOMETER_ALT " Metrics", &Settings::application.stats);
|
||||||
ImGuiToolkit::ButtonSwitch( ICON_FA_LIST " Logs", &Settings::application.logs, "Ctrl + L");
|
ImGuiToolkit::ButtonSwitch( ICON_FA_LIST " Logs", &Settings::application.logs, "Ctrl + L");
|
||||||
|
|
||||||
|
ImGui::Text(" ");
|
||||||
ImGui::Text("Appearance");
|
ImGui::Text("Appearance");
|
||||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||||
if ( ImGui::SliderFloat("Scale", &Settings::application.scale, 0.8f, 1.2f, "%.1f"))
|
if ( ImGui::SliderFloat("Scale", &Settings::application.scale, 0.8f, 1.2f, "%.1f"))
|
||||||
ImGui::GetIO().FontGlobalScale = Settings::application.scale;
|
ImGui::GetIO().FontGlobalScale = Settings::application.scale;
|
||||||
|
|
||||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||||
if ( ImGui::Combo("Color", &Settings::application.accent_color, "Blue\0Orange\0Grey\0\0"))
|
if ( ImGui::Combo("Accent", &Settings::application.accent_color, "Blue\0Orange\0Grey\0\0"))
|
||||||
ImGuiToolkit::SetAccentColor(static_cast<ImGuiToolkit::accent_color>(Settings::application.accent_color));
|
ImGuiToolkit::SetAccentColor(static_cast<ImGuiToolkit::accent_color>(Settings::application.accent_color));
|
||||||
|
|
||||||
|
// Bottom aligned
|
||||||
|
ImGui::SetCursorPosY(height - 4.f * ImGui::GetTextLineHeightWithSpacing());
|
||||||
|
ImGui::Text("About");
|
||||||
|
if ( ImGui::Button( " About vimix", ImVec2(5.f * width - padding_width, 0)) )
|
||||||
|
UserInterface::manager().show_about = true;
|
||||||
|
if ( ImGui::Button("About ImGui"))
|
||||||
|
UserInterface::manager().show_imgui_about = true;
|
||||||
|
ImGui::SameLine();
|
||||||
|
if ( ImGui::Button("About GStreamer"))
|
||||||
|
UserInterface::manager().show_gst_about = true;
|
||||||
|
ImGui::SameLine();
|
||||||
|
if ( ImGui::Button("About OpenGL"))
|
||||||
|
UserInterface::manager().show_opengl_about = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ShowAbout(bool* p_open)
|
||||||
|
{
|
||||||
|
ImGui::SetNextWindowPos(ImVec2(300, 300), ImGuiCond_FirstUseEver);
|
||||||
|
if (!ImGui::Begin(APP_TITLE, p_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize))
|
||||||
|
{
|
||||||
|
ImGui::End();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_BOLD);
|
||||||
|
ImGui::Text("%s %d.%d", APP_NAME, APP_VERSION_MAJOR, APP_VERSION_MINOR);
|
||||||
|
ImGui::PopFont();
|
||||||
|
ImGui::Separator();
|
||||||
|
ImGui::Text("vimix is a video mixing software for live performance.");
|
||||||
|
ImGui::Text("vimix is licensed under the GNU GPL version 3. Copyright 2019-2020 Bruno Herbelin.");
|
||||||
|
ImGuiToolkit::ButtonOpenWebpage("https://github.com/brunoherbelin/v-mix");
|
||||||
|
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShowAboutOpengl(bool* p_open)
|
||||||
|
{
|
||||||
|
ImGui::SetNextWindowPos(ImVec2(300, 300), ImGuiCond_FirstUseEver);
|
||||||
|
if (!ImGui::Begin("About OpenGL", p_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize))
|
||||||
|
{
|
||||||
|
ImGui::End();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_BOLD);
|
||||||
|
ImGui::Text("OpenGL %s", glGetString(GL_VERSION) );
|
||||||
|
ImGui::PopFont();
|
||||||
|
ImGui::Separator();
|
||||||
|
ImGui::Text("OpenGL is the premier environment for developing portable, \ninteractive 2D and 3D graphics applications.");
|
||||||
|
ImGuiToolkit::ButtonOpenWebpage("https://www.opengl.org");
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
static bool show_opengl_info = false;
|
||||||
|
ImGuiToolkit::ButtonIconToggle(10,0,13,14,&show_opengl_info);
|
||||||
|
ImGui::SameLine(); ImGui::Text("Details");
|
||||||
|
if (show_opengl_info)
|
||||||
|
{
|
||||||
|
ImGui::Separator();
|
||||||
|
bool copy_to_clipboard = ImGui::Button( ICON_FA_COPY " Copy");
|
||||||
|
ImGui::SameLine(0.f, 60.f);
|
||||||
|
static char _openglfilter[64] = "";
|
||||||
|
ImGui::InputText("Filter", _openglfilter, 64);
|
||||||
|
ImGui::SameLine();
|
||||||
|
if ( ImGuiToolkit::ButtonIcon( 12, 14 ) )
|
||||||
|
_openglfilter[0] = '\0';
|
||||||
|
std::string filter(_openglfilter);
|
||||||
|
|
||||||
|
ImGui::BeginChildFrame(ImGui::GetID("gstinfos"), ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 18), ImGuiWindowFlags_NoMove);
|
||||||
|
if (copy_to_clipboard)
|
||||||
|
{
|
||||||
|
ImGui::LogToClipboard();
|
||||||
|
ImGui::LogText("```\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Text("OpenGL %s", glGetString(GL_VERSION) );
|
||||||
|
ImGui::Text("%s %s", glGetString(GL_RENDERER), glGetString(GL_VENDOR));
|
||||||
|
ImGui::Text("Extensions (runtime) :");
|
||||||
|
|
||||||
|
GLint numExtensions = 0;
|
||||||
|
glGetIntegerv( GL_NUM_EXTENSIONS, &numExtensions );
|
||||||
|
for (int i = 0; i < numExtensions; ++i){
|
||||||
|
std::string ext( (char*) glGetStringi(GL_EXTENSIONS, i) );
|
||||||
|
if ( filter.empty() || ext.find(filter) != std::string::npos )
|
||||||
|
ImGui::Text("%s", ext.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (copy_to_clipboard)
|
||||||
|
{
|
||||||
|
ImGui::LogText("\n```\n");
|
||||||
|
ImGui::LogFinish();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::EndChildFrame();
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ShowAboutGStreamer(bool* p_open)
|
||||||
|
{
|
||||||
|
|
||||||
|
ImGui::SetNextWindowPos(ImVec2(300, 300), ImGuiCond_FirstUseEver);
|
||||||
|
if (!ImGui::Begin("About Gstreamer", p_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize))
|
||||||
|
{
|
||||||
|
ImGui::End();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_BOLD);
|
||||||
|
ImGui::Text("GStreamer %s", GstToolkit::gst_version().c_str());
|
||||||
|
ImGui::PopFont();
|
||||||
|
ImGui::Separator();
|
||||||
|
ImGui::Text("A flexible, fast and multiplatform multimedia framework.");
|
||||||
|
ImGui::Text("GStreamer is licensed under the LGPL License.");
|
||||||
|
ImGuiToolkit::ButtonOpenWebpage("https://gstreamer.freedesktop.org/");
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
static bool show_config_info = false;
|
||||||
|
ImGuiToolkit::ButtonIconToggle(10,0,13,14,&show_config_info);
|
||||||
|
ImGui::SameLine(); ImGui::Text("Details");
|
||||||
|
if (show_config_info)
|
||||||
|
{
|
||||||
|
ImGui::Separator();
|
||||||
|
bool copy_to_clipboard = ImGui::Button( ICON_FA_COPY " Copy");
|
||||||
|
ImGui::SameLine(0.f, 60.f);
|
||||||
|
static char _filter[64] = ""; ImGui::InputText("Filter", _filter, 64);
|
||||||
|
ImGui::SameLine();
|
||||||
|
if ( ImGuiToolkit::ButtonIcon( 12, 14 ) )
|
||||||
|
_filter[0] = '\0';
|
||||||
|
std::string filter(_filter);
|
||||||
|
|
||||||
|
ImGui::BeginChildFrame(ImGui::GetID("gstinfos"), ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 18), ImGuiWindowFlags_NoMove);
|
||||||
|
if (copy_to_clipboard)
|
||||||
|
{
|
||||||
|
ImGui::LogToClipboard();
|
||||||
|
ImGui::LogText("```\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Text("GStreamer %s", GstToolkit::gst_version().c_str());
|
||||||
|
ImGui::Text("Plugins & features (runtime) :");
|
||||||
|
|
||||||
|
std::list<std::string> filteredlist;
|
||||||
|
|
||||||
|
// filter
|
||||||
|
if ( filter.empty() )
|
||||||
|
filteredlist = GstToolkit::all_plugins();
|
||||||
|
else {
|
||||||
|
std::list<std::string> plist = GstToolkit::all_plugins();
|
||||||
|
for (auto const& i: plist) {
|
||||||
|
// add plugin if plugin name match
|
||||||
|
if ( i.find(filter) != std::string::npos )
|
||||||
|
filteredlist.push_back( i.c_str() );
|
||||||
|
// check in features
|
||||||
|
std::list<std::string> flist = GstToolkit::all_plugin_features(i);
|
||||||
|
for (auto const& j: flist) {
|
||||||
|
// add plugin if feature name matches
|
||||||
|
if ( j.find(filter) != std::string::npos )
|
||||||
|
filteredlist.push_back( i.c_str() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// display list
|
||||||
|
for (auto const& t: filteredlist) {
|
||||||
|
ImGui::Text("> %s", t.c_str());
|
||||||
|
std::list<std::string> flist = GstToolkit::all_plugin_features(t);
|
||||||
|
for (auto const& j: flist) {
|
||||||
|
if ( j.find(filter) != std::string::npos )
|
||||||
|
{
|
||||||
|
ImGui::Text(" - %s", j.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (copy_to_clipboard)
|
||||||
|
{
|
||||||
|
ImGui::LogText("\n```\n");
|
||||||
|
ImGui::LogFinish();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::EndChildFrame();
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|||||||
@@ -40,32 +40,33 @@ public:
|
|||||||
|
|
||||||
class ToolBox
|
class ToolBox
|
||||||
{
|
{
|
||||||
bool show_app_about;
|
|
||||||
bool show_gst_about;
|
|
||||||
bool show_opengl_about;
|
|
||||||
bool show_demo_window;
|
bool show_demo_window;
|
||||||
// bool show_logs_window;
|
|
||||||
bool show_icons_window;
|
bool show_icons_window;
|
||||||
unsigned int screenshot_step;
|
unsigned int screenshot_step;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ToolBox();
|
ToolBox();
|
||||||
|
|
||||||
void ToggleLogs();
|
|
||||||
void StartScreenshot();
|
void StartScreenshot();
|
||||||
void Render();
|
void Render();
|
||||||
};
|
};
|
||||||
|
|
||||||
class UserInterface
|
class UserInterface
|
||||||
{
|
{
|
||||||
friend class ToolBox;
|
friend class Navigator;
|
||||||
Navigator navigator;
|
Navigator navigator;
|
||||||
ToolBox mainwindow;
|
ToolBox toolbox;
|
||||||
|
|
||||||
|
bool show_about;
|
||||||
|
bool show_imgui_about;
|
||||||
|
bool show_gst_about;
|
||||||
|
bool show_opengl_about;
|
||||||
|
|
||||||
std::string currentTextEdit;
|
std::string currentTextEdit;
|
||||||
|
|
||||||
void handleKeyboard();
|
void handleKeyboard();
|
||||||
void handleMouse();
|
void handleMouse();
|
||||||
|
void showMenuFile();
|
||||||
|
|
||||||
// Private Constructor
|
// Private Constructor
|
||||||
UserInterface();
|
UserInterface();
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#define IMGUI_TITLE_MAINWINDOW ICON_FA_CIRCLE_NOTCH " vimix"
|
#define IMGUI_TITLE_MAINWINDOW ICON_FA_CIRCLE_NOTCH " vimix"
|
||||||
#define IMGUI_TITLE_MEDIAPLAYER ICON_FA_FILM " Media Player"
|
#define IMGUI_TITLE_MEDIAPLAYER ICON_FA_FILM " Media Player"
|
||||||
|
#define IMGUI_TITLE_TOOLBOX ICON_FA_WRENCH " Tools"
|
||||||
#define IMGUI_TITLE_SHADEREDITOR ICON_FA_CODE " Shader Editor"
|
#define IMGUI_TITLE_SHADEREDITOR ICON_FA_CODE " Shader Editor"
|
||||||
#define IMGUI_TITLE_PREVIEW ICON_FA_LAPTOP " Preview"
|
#define IMGUI_TITLE_PREVIEW ICON_FA_LAPTOP " Preview"
|
||||||
#define IMGUI_RIGHT_ALIGN -100
|
#define IMGUI_RIGHT_ALIGN -100
|
||||||
|
|||||||
34
main.cpp
34
main.cpp
@@ -68,40 +68,6 @@ void drawScene()
|
|||||||
|
|
||||||
Mixer::manager().draw();
|
Mixer::manager().draw();
|
||||||
|
|
||||||
// draw GUI tree scene
|
|
||||||
ImGui::Begin(IMGUI_TITLE_MAINWINDOW);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static ImGuiVisitor v;
|
|
||||||
// Mixer::manager().currentView()->scene.accept(v);
|
|
||||||
// Mixer::manager().getView(View::RENDERING)->scene.accept(v);
|
|
||||||
|
|
||||||
Source *s = Mixer::manager().currentSource();
|
|
||||||
if ( s != nullptr) {
|
|
||||||
|
|
||||||
if (ImGui::TreeNode("Current Source"))
|
|
||||||
{
|
|
||||||
static char buf5[128];
|
|
||||||
sprintf ( buf5, "%s", s->name().c_str() );
|
|
||||||
ImGui::SetNextItemWidth(-100);
|
|
||||||
if (ImGui::InputText("Name", buf5, 64, ImGuiInputTextFlags_CharsNoBlank)){
|
|
||||||
Mixer::manager().renameSource(s, buf5);
|
|
||||||
}
|
|
||||||
|
|
||||||
s->blendingShader()->accept(v);
|
|
||||||
|
|
||||||
float width = ImGui::GetContentRegionAvail().x - 100;
|
|
||||||
ImVec2 imagesize ( width, width / s->frame()->aspectRatio());
|
|
||||||
ImGui::Image((void*)(uintptr_t) s->frame()->texture(), imagesize);
|
|
||||||
|
|
||||||
s->processingShader()->accept(v);
|
|
||||||
|
|
||||||
ImGui::TreePop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::End();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user