mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Improved UI tooltips
This commit is contained in:
@@ -53,9 +53,9 @@ void ImGuiToolkit::ButtonOpenUrl( const char* label, const char* url, const ImVe
|
||||
}
|
||||
|
||||
|
||||
bool ImGuiToolkit::ButtonToggle( const char* label, bool* toggle )
|
||||
bool ImGuiToolkit::ButtonToggle( const char* label, bool* toggle, const char *tooltip)
|
||||
{
|
||||
ImVec4* colors = ImGui::GetStyle().Colors;
|
||||
const ImVec4* colors = ImGui::GetStyle().Colors;
|
||||
const auto active = *toggle;
|
||||
if( active ) {
|
||||
ImGui::PushStyleColor( ImGuiCol_Button, colors[ImGuiCol_TabActive] );
|
||||
@@ -63,6 +63,8 @@ bool ImGuiToolkit::ButtonToggle( const char* label, bool* toggle )
|
||||
ImGui::PushStyleColor( ImGuiCol_ButtonActive, colors[ImGuiCol_Tab] );
|
||||
}
|
||||
bool action = ImGui::Button( label );
|
||||
if (tooltip != nullptr && ImGui::IsItemHovered())
|
||||
ImGuiToolkit::ToolTip(tooltip);
|
||||
if( action ) *toggle = !*toggle;
|
||||
if( active ) ImGui::PopStyleColor( 3 );
|
||||
return action;
|
||||
@@ -169,16 +171,23 @@ bool ImGuiToolkit::ButtonIcon(int i, int j, const char *tooltip)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ImGuiToolkit::ButtonIconToggle(int i, int j, int i_toggle, int j_toggle, bool* toggle)
|
||||
bool ImGuiToolkit::ButtonIconToggle(int i, int j, int i_toggle, int j_toggle, bool* toggle, const char *tooltip)
|
||||
{
|
||||
bool ret = false;
|
||||
ImGui::PushID( i * 20 + j + i_toggle * 20 + j_toggle);
|
||||
|
||||
if (*toggle) {
|
||||
const ImVec4* colors = ImGui::GetStyle().Colors;
|
||||
const auto active = *toggle;
|
||||
if( active ) {
|
||||
ImGui::PushStyleColor( ImGuiCol_Button, colors[ImGuiCol_TabActive] );
|
||||
ImGui::PushStyleColor( ImGuiCol_ButtonHovered, colors[ImGuiCol_TabHovered] );
|
||||
ImGui::PushStyleColor( ImGuiCol_ButtonActive, colors[ImGuiCol_Tab] );
|
||||
|
||||
if ( ButtonIcon(i_toggle, j_toggle)) {
|
||||
*toggle = false;
|
||||
ret = true;
|
||||
}
|
||||
ImGui::PopStyleColor( 3 );
|
||||
}
|
||||
else {
|
||||
if ( ButtonIcon(i, j)) {
|
||||
@@ -187,6 +196,9 @@ bool ImGuiToolkit::ButtonIconToggle(int i, int j, int i_toggle, int j_toggle, bo
|
||||
}
|
||||
}
|
||||
|
||||
if (tooltip != nullptr && ImGui::IsItemHovered())
|
||||
ImGuiToolkit::ToolTip(tooltip);
|
||||
|
||||
ImGui::PopID();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace ImGuiToolkit
|
||||
|
||||
// buttons and gui items with icon
|
||||
bool ButtonIcon (int i, int j, const char* tooltip = nullptr);
|
||||
bool ButtonIconToggle (int i, int j, int i_toggle, int j_toggle, bool* toggle);
|
||||
bool ButtonIconToggle (int i, int j, int i_toggle, int j_toggle, bool* toggle, const char *tooltip = nullptr);
|
||||
bool ButtonIconMultistate (std::vector<std::pair<int, int> > icons, int* state, const char* tooltip = nullptr);
|
||||
bool MenuItemIcon (int i, int j, const char* label, bool selected = false, bool enabled = true);
|
||||
bool SelectableIcon(const char* label, int i, int j, bool selected = false);
|
||||
@@ -32,8 +32,8 @@ namespace ImGuiToolkit
|
||||
bool ComboIcon (const char* label, std::vector<std::pair<int, int> > icons, std::vector<std::string> items, int* i);
|
||||
|
||||
// buttons
|
||||
bool ButtonToggle (const char* label, bool* toggle);
|
||||
bool ButtonSwitch (const char* label, bool* toggle , const char *help = nullptr);
|
||||
bool ButtonToggle (const char* label, bool* toggle, const char *tooltip = nullptr);
|
||||
bool ButtonSwitch (const char* label, bool* toggle, const char *help = nullptr);
|
||||
void ButtonOpenUrl (const char* label, const char* url, const ImVec2& size_arg = ImVec2(0,0));
|
||||
|
||||
// tooltip and mouse over
|
||||
|
||||
@@ -470,7 +470,7 @@ void ImGuiVisitor::visit (Source& s)
|
||||
// toggle enable/disable image processing
|
||||
bool on = s.imageProcessingEnabled();
|
||||
ImGui::SetCursorPos( ImVec2(preview_width + 15, pos.y + 3.5f * ImGui::GetFrameHeightWithSpacing()) );
|
||||
if ( ImGuiToolkit::ButtonToggle(ICON_FA_MAGIC, &on) ){
|
||||
if ( ImGuiToolkit::ButtonIconToggle(6, 2, 6, 2, &on, "Filters") ){
|
||||
std::ostringstream oss;
|
||||
oss << s.name() << ": " << ( on ? "Enable Filter" : "Disable Filter");
|
||||
Action::manager().store(oss.str());
|
||||
|
||||
@@ -3709,7 +3709,13 @@ Navigator::Navigator()
|
||||
view_pannel_visible = false;
|
||||
clearButtonSelection();
|
||||
|
||||
// restore media mode as saved
|
||||
if (Settings::application.recentImportFolders.path.compare(IMGUI_LABEL_RECENT_FILES) == 0)
|
||||
new_media_mode = MEDIA_RECENT;
|
||||
else if (Settings::application.recentImportFolders.path.compare(IMGUI_LABEL_RECENT_RECORDS) == 0)
|
||||
new_media_mode = MEDIA_RECORDING;
|
||||
else
|
||||
new_media_mode = MEDIA_FOLDER;
|
||||
new_media_mode_changed = true;
|
||||
}
|
||||
|
||||
@@ -3737,6 +3743,7 @@ void Navigator::clearButtonSelection()
|
||||
pattern_type = -1;
|
||||
sourceSequenceFiles.clear();
|
||||
sourceMediaFileCurrent.clear();
|
||||
new_media_mode_changed = true;
|
||||
}
|
||||
|
||||
void Navigator::showPannelSource(int index)
|
||||
@@ -3767,6 +3774,7 @@ void Navigator::togglePannelNew()
|
||||
{
|
||||
selected_button[NAV_NEW] = !selected_button[NAV_NEW];
|
||||
applyButtonSelection(NAV_NEW);
|
||||
new_media_mode_changed = true;
|
||||
}
|
||||
|
||||
void Navigator::hidePannel()
|
||||
@@ -4294,9 +4302,9 @@ void Navigator::RenderNewPannel()
|
||||
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_bot.y - 2.f * ImGui::GetFrameHeightWithSpacing()));
|
||||
ImGuiToolkit::HelpMarker("Recently recorded videos (lastest on top). Clic on a filename to open.\n\n"
|
||||
ICON_FA_CHEVRON_CIRCLE_RIGHT " Auto-preload prepares this panel with the "
|
||||
"most recent video after finishing recording.");
|
||||
"most recent recording after 'Stop Record' or 'Save & continue'.");
|
||||
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_bot.y - ImGui::GetFrameHeightWithSpacing()) );
|
||||
if (ImGuiToolkit::ButtonToggle( ICON_FA_CHEVRON_CIRCLE_RIGHT, &Settings::application.recentRecordings.load_at_start ) ){
|
||||
if (ImGuiToolkit::ButtonToggle( ICON_FA_CHEVRON_CIRCLE_RIGHT, &Settings::application.recentRecordings.load_at_start, "Auto-preload" ) ){
|
||||
// demonstrate action
|
||||
if (Settings::application.recentRecordings.load_at_start
|
||||
&& Settings::application.recentRecordings.filenames.size() > 0) {
|
||||
@@ -4305,8 +4313,6 @@ void Navigator::RenderNewPannel()
|
||||
new_source_preview_.setSource( Mixer::manager().createSourceFile(sourceMediaFileCurrent), label);
|
||||
}
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGuiToolkit::ToolTip("Auto-preload");
|
||||
// come back...
|
||||
ImGui::SetCursorPos(pos_bot);
|
||||
}
|
||||
@@ -4711,14 +4717,12 @@ void Navigator::RenderMainPannelVimix()
|
||||
|
||||
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_bot.y - 2.f * ImGui::GetFrameHeightWithSpacing()));
|
||||
ImGuiToolkit::HelpMarker("Select the history of recently opened files or a folder. "
|
||||
"Double-clic on a filename to open it.\n\n"
|
||||
"Double-clic on a filename to open the session.\n\n"
|
||||
ICON_FA_ARROW_CIRCLE_RIGHT " Smooth transition "
|
||||
"performs cross fading to the openned session.");
|
||||
// toggle button for smooth transition
|
||||
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_bot.y - ImGui::GetFrameHeightWithSpacing()) );
|
||||
ImGuiToolkit::ButtonToggle(ICON_FA_ARROW_CIRCLE_RIGHT, &Settings::application.smooth_transition);
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGuiToolkit::ToolTip("Smooth transition");
|
||||
ImGuiToolkit::ButtonToggle(ICON_FA_ARROW_CIRCLE_RIGHT, &Settings::application.smooth_transition, "Smooth transition");
|
||||
// come back...
|
||||
ImGui::SetCursorPos(pos_bot);
|
||||
|
||||
@@ -4960,9 +4964,7 @@ void Navigator::RenderMainPannelVimix()
|
||||
ImGui::TextDisabled( ICON_FA_REDO );
|
||||
|
||||
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_bot.y - ImGui::GetFrameHeightWithSpacing()) );
|
||||
ImGuiToolkit::ButtonToggle(ICON_FA_MAP_MARKED_ALT, &Settings::application.action_history_follow_view);
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGuiToolkit::ToolTip("Show in view");
|
||||
ImGuiToolkit::ButtonToggle(ICON_FA_MAP_MARKED_ALT, &Settings::application.action_history_follow_view, "Show in view");
|
||||
}
|
||||
//
|
||||
// Current 0. VERSIONS
|
||||
@@ -5111,9 +5113,7 @@ void Navigator::RenderMainPannelVimix()
|
||||
"keeps a version each time a session is saved.");
|
||||
// toggle button for versioning
|
||||
ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_bot.y - ImGui::GetFrameHeightWithSpacing()) );
|
||||
ImGuiToolkit::ButtonToggle(" " ICON_FA_CODE_BRANCH " ", &Settings::application.save_version_snapshot);
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGuiToolkit::ToolTip("Iterative saving");
|
||||
ImGuiToolkit::ButtonToggle(" " ICON_FA_CODE_BRANCH " ", &Settings::application.save_version_snapshot,"Iterative saving");
|
||||
|
||||
ImGui::SetCursorPos( pos_bot );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user