Improve Layers view icons and Workspace management

Added 'Workspace any' in list of workspaces to allow Geometry view to list sources from all workspaces. Updated icon for layers view, in left panel and in view.
This commit is contained in:
Bruno Herbelin
2023-08-30 20:47:14 +02:00
parent de850b39f2
commit 124415363f
12 changed files with 2994 additions and 2856 deletions

View File

@@ -556,7 +556,8 @@ bool ImGuiToolkit::ButtonIconMultistate(std::vector<std::pair<int, int> > icons,
return ret;
}
bool ImGuiToolkit::ComboIcon (const char* label, int* current_item, std::vector< std::tuple<int, int, std::string> > items, bool tooltiptext)
bool ImGuiToolkit::ComboIcon (const char* label, int* current_item,
std::vector< std::tuple<int, int, std::string> > items, std::vector<std::string> tooltips)
{
bool ret = false;
ImGuiContext& g = *GImGui;
@@ -571,41 +572,22 @@ bool ImGuiToolkit::ComboIcon (const char* label, int* current_item, std::vector<
space_buf[space_num]='\0';
char text_buf[256];
if (tooltiptext) {
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%s", space_buf);
if ( ImGui::BeginCombo( label, text_buf, ImGuiComboFlags_None) ) {
for (int p = 0; p < (int) items.size(); ++p){
ImGui::PushID((void*)(intptr_t)p);
if (ImGuiToolkit::SelectableIcon( std::get<0>( items.at(p) ),
std::get<1>( items.at(p) ),
"",
p == *current_item) ) {
*current_item = p;
ret = true;
}
if (ImGui::IsItemHovered())
ImGuiToolkit::ToolTip(std::get<2>( items.at(p) ).c_str());
ImGui::PopID();
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%s %s", space_buf, 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);
if (ImGuiToolkit::SelectableIcon( std::get<0>( items.at(p) ),
std::get<1>( items.at(p) ),
std::get<2>( items.at(p) ).c_str(),
p == *current_item) ) {
*current_item = p;
ret = true;
}
ImGui::EndCombo();
}
}
else {
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%s %s", space_buf, 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);
if (ImGuiToolkit::SelectableIcon( std::get<0>( items.at(p) ),
std::get<1>( items.at(p) ),
std::get<2>( items.at(p) ).c_str(),
p == *current_item) ) {
*current_item = p;
ret = true;
}
ImGui::PopID();
}
ImGui::EndCombo();
if (ImGui::IsItemHovered() && p < (int) tooltips.size() )
ImGuiToolkit::ToolTip( tooltips.at(p).c_str() );
ImGui::PopID();
}
ImGui::EndCombo();
}
// overlay of icon on top of first item