Cleanup use of new icons

This commit is contained in:
Bruno Herbelin
2022-05-22 11:18:57 +02:00
parent e26563c3d6
commit 7867aac55f
3 changed files with 35 additions and 15 deletions

View File

@@ -135,6 +135,12 @@ bool ImGuiToolkit::ButtonSwitch(const char* label, bool* toggle, const char* sho
return ret; return ret;
} }
/// used icons
/// 0 2, 1 7, 1 13, 1 16, 2 1, 2 13, 3 1, 3 13, 4 2, 4 12, 4 16, 5 2, 5 8, 5 16,
/// 6 2, 6 4, 6 6, 6 9, 6 13, 6 16, 7 0, 7 9, 7 14, 7 16, 8 1, 8 9, 8 12, 8 13, 8 16,
/// 9 2, 9 3, 9 12, 9 13, 9 16, 10 15, 11 3, 11 5, 11 16, 12 4, 12 5, 12 7, 12 14,
/// 13 4, 13 5, 14 16, 15 1, 15 6, 15 12, 15 16, 16 1, 16 5, 16 7, 16 10, 16 16, 17 6,
/// 18 1, 18 5, 18 12, 18 13, 18 15, 19 6, 19 12,
void ImGuiToolkit::Icon(int i, int j, bool enabled) void ImGuiToolkit::Icon(int i, int j, bool enabled)
{ {

View File

@@ -774,8 +774,10 @@ void ImGuiVisitor::visit (DelayFilter& f)
void ImGuiVisitor::visit (ImageFilter& f) void ImGuiVisitor::visit (ImageFilter& f)
{ {
if (ImGuiToolkit::IconButton(16, 10)) { // Selection of Algorithm
Settings::application.widget.shader_editor = true; if (ImGuiToolkit::IconButton(1, 4)) {
FilteringProgram target;
f.setProgram( target );
} }
ImGui::SameLine(0, IMGUI_SAME_LINE); ImGui::SameLine(0, IMGUI_SAME_LINE);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
@@ -789,20 +791,23 @@ void ImGuiVisitor::visit (ImageFilter& f)
} }
ImGui::EndCombo(); ImGui::EndCombo();
} }
ImGui::SameLine(); ImGui::SameLine(0, IMGUI_SAME_LINE);
ImGui::Text("Algorithm"); ImGui::Text("Algorithm");
// List of parameters
std::map<std::string, float> filter_parameters = f.program().parameters(); std::map<std::string, float> filter_parameters = f.program().parameters();
FilteringProgram target = f.program(); FilteringProgram target = f.program();
for (auto param = filter_parameters.begin(); param != filter_parameters.end(); ++param) for (auto param = filter_parameters.begin(); param != filter_parameters.end(); ++param)
{ {
if (ImGuiToolkit::IconButton(12, 14)) { ImGui::PushID( param->first.c_str() );
target.setParameter(param->first, 0.f); float v = param->second;
if (ImGuiToolkit::IconButton(11, 11)) {
v = 0.f;
target.setParameter(param->first, v);
f.setProgram( target ); f.setProgram( target );
} }
ImGui::SameLine(0, IMGUI_SAME_LINE); ImGui::SameLine(0, IMGUI_SAME_LINE);
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
float v = param->second;
if (ImGui::SliderFloat( param->first.c_str(), &v, 0.f, 1.f, "%.2f")) { if (ImGui::SliderFloat( param->first.c_str(), &v, 0.f, 1.f, "%.2f")) {
target.setParameter(param->first, v); target.setParameter(param->first, v);
f.setProgram( target ); f.setProgram( target );
@@ -813,8 +818,14 @@ void ImGuiVisitor::visit (ImageFilter& f)
// oss << "Delay " << std::setprecision(3) << d << " s"; // oss << "Delay " << std::setprecision(3) << d << " s";
// Action::manager().store(oss.str()); // Action::manager().store(oss.str());
} }
ImGui::PopID();
} }
// Open Editor
if ( ImGui::Button( ICON_FA_CODE " Edit", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
Settings::application.widget.shader_editor = true;
ImGui::SameLine(0, IMGUI_SAME_LINE);
ImGui::Text("Code");
} }
void ImGuiVisitor::visit (CloneSource& s) void ImGuiVisitor::visit (CloneSource& s)

View File

@@ -964,6 +964,14 @@ void UserInterface::showMenuFile()
selectOpenFilename(); selectOpenFilename();
if (ImGui::MenuItem( MENU_REOPEN_FILE, SHORTCUT_REOPEN_FILE, false, currentfileopen)) if (ImGui::MenuItem( MENU_REOPEN_FILE, SHORTCUT_REOPEN_FILE, false, currentfileopen))
Mixer::manager().load( currentfilename ); Mixer::manager().load( currentfilename );
if (sessionimportdialog && ImGui::MenuItem( ICON_FA_FILE_EXPORT " Import" )) {
// launch file dialog to open a session file
sessionimportdialog->open();
// close pannel to select file
navigator.hidePannel();
}
if (ImGui::MenuItem( MENU_SAVE_FILE, SHORTCUT_SAVE_FILE, false, currentfileopen)) { if (ImGui::MenuItem( MENU_SAVE_FILE, SHORTCUT_SAVE_FILE, false, currentfileopen)) {
if (saveOrSaveAs()) if (saveOrSaveAs())
navigator.hidePannel(); navigator.hidePannel();
@@ -973,20 +981,15 @@ void UserInterface::showMenuFile()
ImGui::MenuItem( MENU_SAVE_ON_EXIT, nullptr, &Settings::application.recentSessions.save_on_exit); ImGui::MenuItem( MENU_SAVE_ON_EXIT, nullptr, &Settings::application.recentSessions.save_on_exit);
// IMPORT AND GROUP // GROUP
ImGui::Separator(); ImGui::Separator();
if (sessionimportdialog && ImGui::MenuItem( ICON_FA_SIGN_OUT_ALT " Import sources" )) { if (ImGuiToolkit::MenuItemIcon(11, 2, "Group all sources", false, Mixer::manager().numSource() > 0)) {
// launch file dialog to open a session file
sessionimportdialog->open();
// close pannel to select file
navigator.hidePannel();
}
if (ImGui::MenuItem( ICON_FA_SIGN_IN_ALT " Group all sources", nullptr, false, Mixer::manager().numSource() > 0)) {
// create a new group session with all sources // create a new group session with all sources
Mixer::manager().groupAll(); Mixer::manager().groupAll();
// switch pannel to show first source (created) // switch pannel to show first source (created)
navigator.showPannelSource(0); navigator.showPannelSource(0);
} }
// TODO : FLATTEN (import all sources from all groups)
// HELP AND QUIT // HELP AND QUIT
ImGui::Separator(); ImGui::Separator();