mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-09 17:29:59 +01:00
Improv GUI, begin menu icon, tool menu name
This commit is contained in:
Binary file not shown.
@@ -171,7 +171,7 @@ bool ImGuiToolkit::ButtonSwitch(const char* label, bool* toggle, const char* too
|
||||
|
||||
|
||||
|
||||
void _drawIcon(ImVec2 screenpos, int i, int j, bool enabled = true)
|
||||
void _drawIcon(ImVec2 screenpos, int i, int j, bool enabled = true, ImGuiWindow* window = ImGui::GetCurrentWindow() )
|
||||
{
|
||||
// icons.dds is a 20 x 20 grid of icons
|
||||
if (textureicons == 0)
|
||||
@@ -184,7 +184,6 @@ void _drawIcon(ImVec2 screenpos, int i, int j, bool enabled = true)
|
||||
if (!enabled)
|
||||
tint_color = ImGui::GetStyle().Colors[ImGuiCol_TextDisabled];
|
||||
|
||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||
ImRect bb(screenpos, screenpos + ImVec2(ImGui::GetTextLineHeightWithSpacing(), ImGui::GetTextLineHeightWithSpacing()));
|
||||
window->DrawList->AddImage((void*)(intptr_t)textureicons, bb.Min, bb.Max, uv0, uv1, ImGui::GetColorU32(tint_color) );
|
||||
}
|
||||
@@ -565,14 +564,8 @@ bool ImGuiToolkit::ComboIcon (const char* label, int* current_item,
|
||||
|
||||
*current_item = CLAMP( *current_item, 0, (int) items.size() - 1);
|
||||
|
||||
// make some space
|
||||
char space_buf[] = " ";
|
||||
const ImVec2 space_size = ImGui::CalcTextSize(" ", NULL);
|
||||
const int space_num = static_cast<int>( ceil(g.FontSize / space_size.x) );
|
||||
space_buf[space_num]='\0';
|
||||
|
||||
char text_buf[256];
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%s %s", space_buf, std::get<2>( items.at(*current_item) ).c_str());
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), " %s", std::get<2>( items.at(*current_item) ).c_str());
|
||||
if ( ImGui::BeginCombo( label, text_buf, ImGuiComboFlags_None) ) {
|
||||
for (int p = 0; p < (int) items.size(); ++p){
|
||||
ImGui::PushID((void*)(intptr_t)p);
|
||||
@@ -600,17 +593,12 @@ bool ImGuiToolkit::SelectableIcon(int i, int j, const char* label, bool selected
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImVec2 draw_pos = ImGui::GetCursorScreenPos() - g.Style.FramePadding * 0.5;
|
||||
|
||||
// make some space
|
||||
char space_buf[] = " ";
|
||||
const ImVec2 space_size = ImGui::CalcTextSize(" ", NULL);
|
||||
const int space_num = static_cast<int>( ceil(g.FontSize / space_size.x) );
|
||||
space_buf[space_num+1]='\0';
|
||||
|
||||
char text_buf[256];
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%s%s", space_buf, label);
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), " %s", label);
|
||||
|
||||
ImGui::PushID( i * 20 + j + ImGui::GetID("##SelectableIcon") );
|
||||
ImGui::PushID( i * 20 + j + ImGui::GetID(text_buf) );
|
||||
|
||||
// draw menu item
|
||||
bool ret = ImGui::Selectable(text_buf, selected, ImGuiSelectableFlags_None, size_arg);
|
||||
@@ -627,26 +615,39 @@ bool ImGuiToolkit::SelectableIcon(int i, int j, const char* label, bool selected
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool ImGuiToolkit::MenuItemIcon (int i, int j, const char* label, const char* shortcut, bool selected, bool enabled)
|
||||
{
|
||||
ImVec2 draw_pos = ImGui::GetCursorScreenPos();
|
||||
|
||||
// make some space
|
||||
char space_buf[] = " ";
|
||||
const ImVec2 space_size = ImGui::CalcTextSize(" ", NULL);
|
||||
const int space_num = static_cast<int>( ceil(ImGui::GetTextLineHeightWithSpacing() / space_size.x) );
|
||||
space_buf[space_num]='\0';
|
||||
ImGuiContext& g = *GImGui;
|
||||
draw_pos.y -= g.Style.ItemSpacing.y * 0.5f;
|
||||
|
||||
char text_buf[256];
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%s %s", space_buf, label);
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), " %s", label);
|
||||
|
||||
// draw menu item
|
||||
bool ret = ImGui::MenuItem(text_buf, shortcut, selected, enabled);
|
||||
|
||||
// draw icon
|
||||
ImGui::SetCursorScreenPos(draw_pos);
|
||||
Icon(i, j, enabled);
|
||||
// overlay of icon on top of first item
|
||||
_drawIcon(draw_pos, i, j, enabled);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ImGuiToolkit::BeginMenuIcon(int i, int j, const char *label, bool enabled)
|
||||
{
|
||||
ImGuiWindow *win = ImGui::GetCurrentWindow();
|
||||
ImVec2 draw_pos = ImGui::GetCursorScreenPos();
|
||||
ImGuiContext &g = *GImGui;
|
||||
draw_pos.y += g.Style.ItemSpacing.y * 0.5f;
|
||||
|
||||
char text_buf[256];
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), " %s", label);
|
||||
|
||||
// draw menu item
|
||||
bool ret = ImGui::BeginMenu(text_buf, enabled);
|
||||
|
||||
// overlay of icon on top of first item
|
||||
_drawIcon(draw_pos, i, j, enabled, win);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace ImGuiToolkit
|
||||
bool ButtonIcon (int i, int j, const char* tooltip = nullptr, bool expanded = false);
|
||||
bool ButtonIconToggle (int i, int j, bool* toggle, const char *tooltip = nullptr);
|
||||
bool ButtonIconMultistate (std::vector<std::pair<int, int> > icons, int* state, std::vector<std::string> tooltips);
|
||||
bool BeginMenuIcon(int i, int j, const char *label, bool enabled = true);
|
||||
bool MenuItemIcon (int i, int j, const char* label, const char* shortcut = nullptr, bool selected = false, bool enabled = true);
|
||||
bool SelectableIcon(int i, int j, const char* label, bool selected, const ImVec2& size_arg = ImVec2(0,0));
|
||||
bool ComboIcon (const char* label, int* current_item, std::vector<std::tuple<int, int, std::string> > items, std::vector<std::string> tooltips = {});
|
||||
|
||||
@@ -385,7 +385,7 @@ void OutputPreviewWindow::Render()
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::BeginMenu(ICON_FA_WIFI " Stream"))
|
||||
if (ImGuiToolkit::BeginMenuIcon(19, 11, "Stream"))
|
||||
{
|
||||
// Stream sharing menu
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(IMGUI_COLOR_STREAM, 0.9f));
|
||||
|
||||
@@ -2517,7 +2517,6 @@ void UserInterface::RenderHelp()
|
||||
|
||||
if (ImGui::CollapsingHeader("Views"))
|
||||
{
|
||||
|
||||
ImGui::Columns(2, "viewscolumn", false); // 4-ways, with border
|
||||
ImGui::SetColumnWidth(0, width_column0);
|
||||
ImGui::PushTextWrapPos(width_window );
|
||||
@@ -2546,7 +2545,7 @@ void UserInterface::RenderHelp()
|
||||
ImGui::PopTextWrapPos();
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Windows"))
|
||||
if (ImGui::CollapsingHeader("Tools"))
|
||||
{
|
||||
ImGui::Columns(2, "windowcolumn", false); // 4-ways, with border
|
||||
ImGui::SetColumnWidth(0, width_column0);
|
||||
@@ -2580,6 +2579,62 @@ void UserInterface::RenderHelp()
|
||||
ImGui::PopTextWrapPos();
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Files"))
|
||||
{
|
||||
{
|
||||
float H = ImGui::GetFrameHeightWithSpacing();
|
||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_MenuBar;
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
|
||||
|
||||
ImGui::BeginChild("PlaylistHelp", ImVec2(0, 10.f * H), true, window_flags);
|
||||
if (ImGui::BeginMenuBar()) {
|
||||
ImGuiToolkit::Icon(4, 8);
|
||||
ImGui::Text (" Playlist");
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
{
|
||||
ImGui::BeginChild("SessionHelp", ImVec2(0, 7.f * H), true, window_flags);
|
||||
if (ImGui::BeginMenuBar()) {
|
||||
ImGuiToolkit::Icon(7, 1);
|
||||
ImGui::Text (" Session");
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
{
|
||||
ImGui::BeginChild("SourceHelp", ImVec2(0, 4.f * H), true, window_flags);
|
||||
if (ImGui::BeginMenuBar()) {
|
||||
ImGuiToolkit::Icon(14, 11);
|
||||
ImGui::Text ("Source");
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
ImGui::BulletText("Video, image & session files");
|
||||
ImGui::BulletText("Image sequence (image files)");
|
||||
ImGui::BulletText("Input devices & streams (e.g. webcams)");
|
||||
ImGui::BulletText("Patterns & generated graphics (e.g. text)");
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
ImGui::PushTextWrapPos(width_window - 10.f);
|
||||
ImGui::Spacing();
|
||||
ImGui::Text ("A session contains several sources mixed together and keeps previous versions. "
|
||||
"It is saved in a .mix file.");
|
||||
ImGui::PopTextWrapPos();
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
ImGui::PushTextWrapPos(width_window - 10.f);
|
||||
ImGui::Spacing();
|
||||
ImGui::Text ("A playlist keeps a list of sessions (or lists the .mix files in a folder) "
|
||||
"for smooth transitions between files.");
|
||||
ImGui::PopTextWrapPos();
|
||||
ImGui::EndChild();
|
||||
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Sources"))
|
||||
{
|
||||
ImGui::Columns(2, "sourcecolumn", false); // 4-ways, with border
|
||||
@@ -3507,12 +3562,7 @@ void Navigator::RenderSourcePannel(Source *s, const ImVec2 &iconsize)
|
||||
Mixer::manager().addSource ( Mixer::manager().createSourceClone() );
|
||||
|
||||
// replace button
|
||||
if ( s->cloned() ) {
|
||||
ImGuiToolkit::ButtonDisabled( ICON_FA_PLUS_SQUARE " Replace", ImVec2(ImGui::GetContentRegionAvail().x, 0));
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGuiToolkit::ToolTip("Cannot replace if source is cloned");
|
||||
}
|
||||
else if ( ImGui::Button( ICON_FA_PLUS_SQUARE " Replace", ImVec2(ImGui::GetContentRegionAvail().x, 0)) ) {
|
||||
if ( ImGui::Button( ICON_FA_PLUS_SQUARE " Replace", ImVec2(ImGui::GetContentRegionAvail().x, 0)) ) {
|
||||
// prepare panel for new source of same type
|
||||
MediaSource *file = dynamic_cast<MediaSource *>(s);
|
||||
MultiFileSource *sequence = dynamic_cast<MultiFileSource *>(s);
|
||||
@@ -6068,7 +6118,7 @@ void Navigator::RenderMainPannel(const ImVec2 &iconsize)
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, IMGUI_TOP_ALIGN + 2.f * ImGui::GetTextLineHeightWithSpacing()) );
|
||||
if (ImGui::BeginMenu("View")) {
|
||||
if (ImGui::BeginMenu("Tools")) {
|
||||
UserInterface::manager().showMenuWindows();
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user