mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-19 06:09:59 +01:00
UI selection Workspace in Geometry View
Back to the combo box (smaller and unified with other views) but following the unified color accent.
This commit is contained in:
@@ -215,11 +215,14 @@ void GeometryView::draw()
|
||||
source_iter != Mixer::manager().session()->end(); ++source_iter) {
|
||||
// if it is in the current workspace
|
||||
if ((*source_iter)->workspace() == Settings::application.current_workspace) {
|
||||
// if ((*source_iter)->blendingShader()->color.a > 0.f) // TODO: option to hide non visible
|
||||
{
|
||||
// will draw its surface
|
||||
surfaces.push_back((*source_iter)->groups_[mode_]);
|
||||
// will draw its frame and locker icon
|
||||
overlays.push_back((*source_iter)->frames_[mode_]);
|
||||
overlays.push_back((*source_iter)->locker_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,11 +254,11 @@ void GeometryView::draw()
|
||||
|
||||
// display interface
|
||||
// Locate window at upper right corner
|
||||
glm::vec2 P = glm::vec2(output_surface_->scale_.x + 0.02f, output_surface_->scale_.y );
|
||||
glm::vec2 P = glm::vec2(-output_surface_->scale_.x - 0.02f, output_surface_->scale_.y + 0.01);
|
||||
P = Rendering::manager().project(glm::vec3(P, 0.f), scene.root()->transform_, false);
|
||||
// Set window position depending on icons size
|
||||
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
|
||||
ImGui::SetNextWindowPos(ImVec2(P.x, P.y), ImGuiCond_Always);
|
||||
ImGui::SetNextWindowPos(ImVec2(P.x, P.y - 1.5f * ImGui::GetFrameHeight() ), ImGuiCond_Always);
|
||||
if (ImGui::Begin("##GeometryViewOptions", NULL, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoBackground
|
||||
| ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings
|
||||
| ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoBringToFrontOnFocus ))
|
||||
@@ -263,26 +266,40 @@ void GeometryView::draw()
|
||||
// style
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.14f, 0.14f, 0.14f, 0.f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.24f, 0.24f, 0.24f, 0.46f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.00f, 0.00f, 0.00f, 0.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.4f, 0.4f, 0.4f, 0.56f));
|
||||
ImGui::PushStyleColor(ImGuiCol_PopupBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f));
|
||||
|
||||
bool on = Settings::application.current_workspace == Source::BACKGROUND;
|
||||
if ( ImGuiToolkit::ButtonIconToggle(10,16,10,16, &on, "Background") ) {
|
||||
Settings::application.current_workspace = Source::BACKGROUND;
|
||||
++View::need_deep_update_;
|
||||
}
|
||||
on = Settings::application.current_workspace == Source::STAGE;
|
||||
if ( ImGuiToolkit::ButtonIconToggle(11,16,11,16, &on, "Workspace") ) {
|
||||
Settings::application.current_workspace = Source::STAGE;
|
||||
++View::need_deep_update_;
|
||||
}
|
||||
on = Settings::application.current_workspace == Source::FOREGROUND;
|
||||
if ( ImGuiToolkit::ButtonIconToggle(12,16,12,16, &on, "Foreground") ) {
|
||||
Settings::application.current_workspace = Source::FOREGROUND;
|
||||
++View::need_deep_update_;
|
||||
// bool on = Settings::application.current_workspace == Source::BACKGROUND;
|
||||
// if ( ImGuiToolkit::ButtonIconToggle(10,16,10,16, &on, "Background") ) {
|
||||
// Settings::application.current_workspace = Source::BACKGROUND;
|
||||
// ++View::need_deep_update_;
|
||||
// }
|
||||
// ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
// on = Settings::application.current_workspace == Source::STAGE;
|
||||
// if ( ImGuiToolkit::ButtonIconToggle(11,16,11,16, &on, "Workspace") ) {
|
||||
// Settings::application.current_workspace = Source::STAGE;
|
||||
// ++View::need_deep_update_;
|
||||
// }
|
||||
// ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
// on = Settings::application.current_workspace == Source::FOREGROUND;
|
||||
// if ( ImGuiToolkit::ButtonIconToggle(12,16,12,16, &on, "Foreground") ) {
|
||||
// Settings::application.current_workspace = Source::FOREGROUND;
|
||||
// ++View::need_deep_update_;
|
||||
// }
|
||||
|
||||
static std::vector< std::tuple<int, int, std::string> > _workspaces = {
|
||||
{10, 16, "Background"},
|
||||
{11, 16, "Workspace"},
|
||||
{12, 16, "Foreground"}
|
||||
};
|
||||
ImGui::SetNextItemWidth( ImGui::GetTextLineHeight() * 2.6);
|
||||
if ( ImGuiToolkit::ComboIcon ("##WORKSPACE", &Settings::application.current_workspace, _workspaces, true) ){
|
||||
++View::need_deep_update_;
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(4);
|
||||
ImGui::PopStyleColor(6);
|
||||
ImGui::End();
|
||||
}
|
||||
ImGui::PopFont();
|
||||
|
||||
@@ -463,7 +463,7 @@ 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 ImGuiToolkit::ComboIcon (const char* label, int* current_item, std::vector< std::tuple<int, int, std::string> > items, bool tooltiptext)
|
||||
{
|
||||
bool ret = false;
|
||||
ImGuiContext& g = *GImGui;
|
||||
@@ -478,22 +478,41 @@ bool ImGuiToolkit::ComboIcon (const char* label, int* current_item, std::vector<
|
||||
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());
|
||||
|
||||
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<2>( items.at(p) ).c_str(),
|
||||
std::get<0>( items.at(p) ),
|
||||
std::get<1>( items.at(p) ),
|
||||
p == *current_item) ) {
|
||||
*current_item = p;
|
||||
ret = true;
|
||||
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();
|
||||
}
|
||||
ImGui::PopID();
|
||||
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<2>( items.at(p) ).c_str(),
|
||||
std::get<0>( items.at(p) ),
|
||||
std::get<1>( items.at(p) ),
|
||||
p == *current_item) ) {
|
||||
*current_item = p;
|
||||
ret = true;
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
// overlay of icon on top of first item
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace ImGuiToolkit
|
||||
bool ButtonIconMultistate (std::vector<std::pair<int, int> > icons, int* state, std::vector<std::string> tooltips);
|
||||
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);
|
||||
bool ComboIcon (const char* label, int* current_item, std::vector<std::tuple<int, int, std::string> > items);
|
||||
bool ComboIcon (const char* label, int* current_item, std::vector<std::tuple<int, int, std::string> > items, bool tooltiptext = false);
|
||||
|
||||
// buttons
|
||||
bool ButtonToggle (const char* label, bool* toggle, const char *tooltip = nullptr);
|
||||
|
||||
Reference in New Issue
Block a user