Skip to content

Commit

Permalink
cmake chang & combobox change
Browse files Browse the repository at this point in the history
  • Loading branch information
Noy-Zini committed Dec 4, 2024
1 parent 4ed121d commit 00a7344
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 131 deletions.
39 changes: 19 additions & 20 deletions common/device-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1965,7 +1965,7 @@ namespace rs2
}

ImGui::SameLine();
ImGui::PushItemWidth(210);
ImGui::PushItemWidth(185);

///////////////////////////////////////////
//TODO: make this a member function
Expand All @@ -1976,12 +1976,12 @@ namespace rs2
counters.push_back(i);
///////////////////////////////////////////

ImGui_ScopePushStyleColor(ImGuiCol_TextSelectedBg, white);
ImGui_ScopePushStyleColor(ImGuiCol_Button, button_color);
ImGui_ScopePushStyleColor(ImGuiCol_ButtonHovered, button_color + 0.1f);
ImGui_ScopePushStyleColor(ImGuiCol_ButtonActive, button_color + 0.1f);
RsImGui_ScopePushStyleColor(ImGuiCol_TextSelectedBg, white);
RsImGui_ScopePushStyleColor(ImGuiCol_Button, button_color);
RsImGui_ScopePushStyleColor(ImGuiCol_ButtonHovered, button_color + 0.1f);
RsImGui_ScopePushStyleColor(ImGuiCol_ButtonActive, button_color + 0.1f);
ImVec2 padding{ 2,2 };
ImGui_ScopePushStyleVar(ImGuiStyleVar_FramePadding, padding);
RsImGui_ScopePushStyleVar(ImGuiStyleVar_FramePadding, padding);
ImGui::PushStyleColor(ImGuiCol_PopupBg, black);
///////////////////////////////////////////
// Go over the loaded files and add them to the combo box
Expand Down Expand Up @@ -2371,7 +2371,7 @@ namespace rs2
auto advanced_mode_pos = ImVec2{ pos.x + horizontal_space_before_device_control, pos.y + vertical_space_before_advanced_mode_control };
ImGui::SetCursorPos(advanced_mode_pos);
const float advanced_mode_panel_height = draw_preset_panel(panel_width, window, error_message, viewer, update_read_only_options, load_json_if_streaming, json_loading);
ImGui::SetCursorPos({ advanced_mode_pos.x, advanced_mode_pos.y + advanced_mode_panel_height+10});
ImGui::SetCursorPos({ advanced_mode_pos.x, advanced_mode_pos.y + advanced_mode_panel_height });
}

////////////////////////////////////////
Expand Down Expand Up @@ -2461,12 +2461,11 @@ namespace rs2
bool stop_recording = false;

ImGui::SetCursorPos({ windows_width - 60, pos.y + 7 });
ImGui_ScopePushFont(window.get_font());
RsImGui_ScopePushFont(window.get_font());

ImGui_ScopePushStyleColor(ImGuiCol_Button, sensor_bg);
ImGui_ScopePushStyleColor(ImGuiCol_ButtonHovered, sensor_bg);
ImGui_ScopePushStyleColor(ImGuiCol_ButtonActive, sensor_bg);
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(5, 5));
RsImGui_ScopePushStyleColor(ImGuiCol_Button, sensor_bg);
RsImGui_ScopePushStyleColor(ImGuiCol_ButtonHovered, sensor_bg);
RsImGui_ScopePushStyleColor(ImGuiCol_ButtonActive, sensor_bg);
int font_size = window.get_font_size();
ImVec2 button_size = { font_size * 3.0f, font_size * 1.0f };

Expand All @@ -2476,8 +2475,8 @@ namespace rs2
<<textual_icons::toggle_off<<" off "<< id << ", "
<< sub->s->get_info( RS2_CAMERA_INFO_NAME );

ImGui_ScopePushStyleColor(ImGuiCol_Text, redish);
ImGui_ScopePushStyleColor(ImGuiCol_TextSelectedBg, redish + 0.1f);
RsImGui_ScopePushStyleColor(ImGuiCol_Text, redish);
RsImGui_ScopePushStyleColor(ImGuiCol_TextSelectedBg, redish + 0.1f);

std::vector<stream_profile> profiles;
auto is_comb_supported = sub->is_selected_combination_supported();
Expand Down Expand Up @@ -2566,8 +2565,8 @@ namespace rs2
std::string label = rsutils::string::from()
<< textual_icons::toggle_on << " on " << id << ","
<< sub->s->get_info( RS2_CAMERA_INFO_NAME );
ImGui_ScopePushStyleColor(ImGuiCol_Text, light_blue);
ImGui_ScopePushStyleColor(ImGuiCol_TextSelectedBg, light_blue + 0.1f);
RsImGui_ScopePushStyleColor(ImGuiCol_Text, light_blue);
RsImGui_ScopePushStyleColor(ImGuiCol_TextSelectedBg, light_blue + 0.1f);

if( ImGui::Button( label.c_str(), button_size ) )
{
Expand Down Expand Up @@ -2615,7 +2614,6 @@ namespace rs2
}
}
}
ImGui::PopStyleVar();
});
}

Expand Down Expand Up @@ -2897,7 +2895,7 @@ namespace rs2
ImGui::PushStyleColor(ImGuiCol_Text, white);
ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background);
label = rsutils::string::from() << "Enable " << pb->get_name() << " post-processing filter";
ImGui::SetTooltip("%s",label.c_str());
ImGui::SetTooltip("%s", label.c_str());
window.link_hovered();
ImGui::PopStyleColor(2);
}
Expand All @@ -2922,7 +2920,7 @@ namespace rs2
ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background);
label = rsutils::string::from()
<< "Disable " << pb->get_name() << " post-processing filter";
ImGui::SetTooltip("%s",label.c_str());
ImGui::SetTooltip("%s", label.c_str());
window.link_hovered();
ImGui::PopStyleColor(2);
}
Expand All @@ -2943,6 +2941,7 @@ namespace rs2
label = rsutils::string::from() << pb->get_name() << "##" << id;
if (ImGui::TreeNode(label.c_str()))
{
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5);
pb->draw_options( viewer,
dev.is< playback >() || update_read_only_options,
false,
Expand All @@ -2962,7 +2961,7 @@ namespace rs2
ImGui::PopStyleVar();
ImGui::PopStyleColor(3);

ImGui::SetCursorPosY(ImGui::GetCursorPosY());
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 2);
}

for (auto&& sub : subdevices)
Expand Down
46 changes: 23 additions & 23 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,29 +293,29 @@ namespace rs2

bool yes_no_dialog(const std::string& title, const std::string& message_text, bool& approved, ux_window& window, const std::string& error_message, bool disabled, const std::string& disabled_reason)
{
ImGui_ScopePushFont(window.get_font());
ImGui_ScopePushStyleColor(ImGuiCol_Button, button_color);
ImGui_ScopePushStyleColor(ImGuiCol_ButtonHovered, sensor_header_light_blue); //TODO: Change color?
ImGui_ScopePushStyleColor(ImGuiCol_ButtonActive, regular_blue); //TODO: Change color?
ImGui_ScopePushStyleColor(ImGuiCol_TextSelectedBg, light_grey);
ImGui_ScopePushStyleColor(ImGuiCol_TitleBg, header_color);
ImGui_ScopePushStyleColor(ImGuiCol_PopupBg, sensor_bg);
ImGui_ScopePushStyleColor(ImGuiCol_BorderShadow, dark_grey);
ImGui_ScopePushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20, 10));
RsImGui_ScopePushFont(window.get_font());
RsImGui_ScopePushStyleColor(ImGuiCol_Button, button_color);
RsImGui_ScopePushStyleColor(ImGuiCol_ButtonHovered, sensor_header_light_blue); //TODO: Change color?
RsImGui_ScopePushStyleColor(ImGuiCol_ButtonActive, regular_blue); //TODO: Change color?
RsImGui_ScopePushStyleColor(ImGuiCol_TextSelectedBg, light_grey);
RsImGui_ScopePushStyleColor(ImGuiCol_TitleBg, header_color);
RsImGui_ScopePushStyleColor(ImGuiCol_PopupBg, sensor_bg);
RsImGui_ScopePushStyleColor(ImGuiCol_BorderShadow, dark_grey);
RsImGui_ScopePushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20, 10));
auto clicked = false;

ImGui::OpenPopup(title.c_str());
ImGui::SetNextWindowPos( {window.width() * 0.35f, window.height() * 0.35f });
if (ImGui::BeginPopup(title.c_str()))
{
{
ImGui_ScopePushStyleColor(ImGuiCol_Text, almost_white_bg);
RsImGui_ScopePushStyleColor(ImGuiCol_Text, almost_white_bg);

ImGui::SetWindowFontScale(1.3f);
ImGui::Text("%s", title.c_str());
}
{
ImGui_ScopePushStyleColor(ImGuiCol_Text, light_grey);
RsImGui_ScopePushStyleColor(ImGuiCol_Text, light_grey);
ImGui::Separator();
ImGui::SetWindowFontScale(1.1f);
ImGui::Text("\n%s\n", message_text.c_str());
Expand Down Expand Up @@ -345,7 +345,7 @@ namespace rs2
{
ImGui::NewLine();
{
ImGui_ScopePushStyleColor(ImGuiCol_Text, red);
RsImGui_ScopePushStyleColor(ImGuiCol_Text, red);
ImGui::Text("%s\n\n", disabled_reason.c_str());
}
auto window_width = ImGui::GetWindowWidth();
Expand All @@ -367,24 +367,24 @@ namespace rs2
// and close button activated by the caller
bool status_dialog(const std::string& title, const std::string& process_topic_text, const std::string& process_status_text , bool enable_close, ux_window& window)
{
ImGui_ScopePushFont(window.get_font());
ImGui_ScopePushStyleColor(ImGuiCol_Button, button_color);
ImGui_ScopePushStyleColor(ImGuiCol_ButtonHovered, sensor_header_light_blue); //TODO: Change color?
ImGui_ScopePushStyleColor(ImGuiCol_ButtonActive, regular_blue); //TODO: Change color?
ImGui_ScopePushStyleColor(ImGuiCol_Text, light_grey);
ImGui_ScopePushStyleColor(ImGuiCol_TextSelectedBg, light_grey);
ImGui_ScopePushStyleColor(ImGuiCol_TitleBg, header_color);
ImGui_ScopePushStyleColor(ImGuiCol_PopupBg, sensor_bg);
ImGui_ScopePushStyleColor(ImGuiCol_BorderShadow, dark_grey);
ImGui_ScopePushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20, 10));
RsImGui_ScopePushFont(window.get_font());
RsImGui_ScopePushStyleColor(ImGuiCol_Button, button_color);
RsImGui_ScopePushStyleColor(ImGuiCol_ButtonHovered, sensor_header_light_blue); //TODO: Change color?
RsImGui_ScopePushStyleColor(ImGuiCol_ButtonActive, regular_blue); //TODO: Change color?
RsImGui_ScopePushStyleColor(ImGuiCol_Text, light_grey);
RsImGui_ScopePushStyleColor(ImGuiCol_TextSelectedBg, light_grey);
RsImGui_ScopePushStyleColor(ImGuiCol_TitleBg, header_color);
RsImGui_ScopePushStyleColor(ImGuiCol_PopupBg, sensor_bg);
RsImGui_ScopePushStyleColor(ImGuiCol_BorderShadow, dark_grey);
RsImGui_ScopePushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20, 10));
auto close_clicked = false;

ImGui::OpenPopup(title.c_str());
ImGui::SetNextWindowPos({ window.width() * 0.35f, window.height() * 0.35f });
if (ImGui::BeginPopup(title.c_str()))
{
{
ImGui_ScopePushStyleColor(ImGuiCol_Text, almost_white_bg);
RsImGui_ScopePushStyleColor(ImGuiCol_Text, almost_white_bg);

ImGui::SetWindowFontScale(1.3f);
ImGui::Text("%s", title.c_str());
Expand Down
2 changes: 1 addition & 1 deletion common/notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ namespace rs2

auto s = ss.str();
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, regular_blue);
ImGui::InputTextMultiline("notification", const_cast<char*>(s.c_str()),
ImGui::InputTextMultiline("##notification", const_cast<char*>(s.c_str()),
s.size() + 1, { 500,100 }, ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_ReadOnly);
ImGui::PopStyleColor();

Expand Down
2 changes: 1 addition & 1 deletion common/option-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ bool option_model::draw_combobox( notifications_model & model,
if( new_line )
ImGui::SetCursorPosX( combo_position_x );

ImGui::PushItemWidth( new_line ? -1.f : 100.f );
ImGui::PushItemWidth( new_line ? ImGui::GetContentRegionAvail().x - 25 : 100.f );

int selected;
std::vector< const char * > labels = get_combo_labels( &selected );
Expand Down
4 changes: 2 additions & 2 deletions common/stream-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ namespace rs2
if (viewer.streams.size() > 1) ++num_of_buttons;
if (RS2_STREAM_DEPTH == profile.stream_type()) ++num_of_buttons; // Color map ruler button

ImGui_ScopePushFont(font);
RsImGui_ScopePushFont(font);
ImGui::PushStyleColor(ImGuiCol_Text, light_grey);
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, white);

Expand Down Expand Up @@ -1200,7 +1200,7 @@ namespace rs2

std::string msg(ss.str().c_str());

ImGui_ScopePushFont(font);
RsImGui_ScopePushFont(font);

// adjust windows size to the message length
auto new_line_start_idx = msg.find_first_of('\n');
Expand Down
12 changes: 6 additions & 6 deletions common/subdevice-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ namespace rs2
}
else
{
ImGui::PushItemWidth(-1); // Set the width for the combo box itself
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - 25 ); // Set the width for the combo box itself with a 25 buffer
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, { 1,1,1,1 });
auto tmp_selected_res_id = ui.selected_res_id;
if (RsImGui::CustomComboBox(label.c_str(), &tmp_selected_res_id, res_chars.data(),
Expand Down Expand Up @@ -639,7 +639,7 @@ namespace rs2
}
else
{
ImGui::PushItemWidth(-1); // Set the width for the combo box itself
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - 25); // Set the width for the combo box itself with a 25 buffer
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, { 1,1,1,1 });
if (RsImGui::CustomComboBox(label.c_str(), &ui.selected_shared_fps_id, fps_chars.data(),
static_cast<int>(fps_chars.size())))
Expand Down Expand Up @@ -718,7 +718,7 @@ namespace rs2
}
else
{
ImGui::PushItemWidth(-1); // Set the width for the combo box itself
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - 25); // Set the width for the combo box itself with a 25 buffer
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, { 1,1,1,1 });
RsImGui::CustomComboBox(label.c_str(), &ui.selected_format_id[f.first], formats_chars.data(),
static_cast<int>(formats_chars.size()));
Expand All @@ -745,7 +745,7 @@ namespace rs2
}
else
{
ImGui::PushItemWidth(-1); // Set the width for the combo box itself
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - 25); // Set the width for the combo box itself with a 25 buffer
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, { 1,1,1,1 });
RsImGui::CustomComboBox(label.c_str(), &ui.selected_fps_id[f.first], fps_chars.data(),
static_cast<int>(fps_chars.size()));
Expand Down Expand Up @@ -800,7 +800,7 @@ namespace rs2
}
else
{
ImGui::PushItemWidth(-1); // Set the width for the combo box itself
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - 25); // Set the width for the combo box itself with a 25 buffer
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, { 1,1,1,1 });
auto tmp_selected_res_id = ui.selected_res_id_map[stream_type_id];
if (RsImGui::CustomComboBox(label.c_str(), &tmp_selected_res_id, res_chars.data(),
Expand Down Expand Up @@ -933,7 +933,7 @@ namespace rs2
}
else
{
ImGui::PushItemWidth(-1); // Set the width for the combo box itself
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - 25); // Set the width for the combo box itself with a 25 buffer
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, { 1,1,1,1 });
RsImGui::CustomComboBox(label.c_str(), &ui.selected_format_id[f.first], formats_chars.data(),
static_cast<int>(formats_chars.size()));
Expand Down
12 changes: 6 additions & 6 deletions common/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace rs2
auto flags = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings;

ImGui_ScopePushFont(font);
RsImGui_ScopePushFont(font);
ImGui::PushStyleColor(ImGuiCol_PopupBg, sensor_bg);
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, white);
ImGui::PushStyleColor(ImGuiCol_Text, light_grey);
Expand Down Expand Up @@ -950,7 +950,7 @@ namespace rs2
{
auto font_dynamic = window.get_font();

ImGui_ScopePushFont(font_dynamic);
RsImGui_ScopePushFont(font_dynamic);
ImGui::PushStyleColor(ImGuiCol_PopupBg, sensor_bg);
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, white);
ImGui::PushStyleColor(ImGuiCol_Text, light_grey);
Expand Down Expand Up @@ -1093,7 +1093,7 @@ namespace rs2
void viewer_model::show_icon(ImFont* font_18, const char* label_str, const char* text, int x, int y, int id,
const ImVec4& text_color, const std::string& tooltip)
{
ImGui_ScopePushFont(font_18);
RsImGui_ScopePushFont(font_18);

std::string label = rsutils::string::from() << label_str << id;

Expand Down Expand Up @@ -2258,7 +2258,7 @@ namespace rs2
ImGui::SetNextWindowPos({ panel_width, 0 });
ImGui::SetNextWindowSize({ window.width() - panel_width, panel_y });

ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(5, 5));
ImGui::PushStyleColor(ImGuiCol_WindowBg, button_color);
ImGui::Begin("Toolbar Panel", nullptr, flags);

Expand Down Expand Up @@ -2411,7 +2411,7 @@ namespace rs2
flags = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar;

ImGui_ScopePushFont(window.get_font());
RsImGui_ScopePushFont(window.get_font());
ImGui::PushStyleColor(ImGuiCol_PopupBg, sensor_bg);
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, white);
ImGui::PushStyleColor(ImGuiCol_Text, light_grey);
Expand Down Expand Up @@ -2960,7 +2960,7 @@ namespace rs2
flags = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar;

ImGui_ScopePushFont(window.get_font());
RsImGui_ScopePushFont(window.get_font());
ImGui::PushStyleColor(ImGuiCol_PopupBg, sensor_bg);
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, white);
ImGui::PushStyleColor(ImGuiCol_Text, light_grey);
Expand Down
Loading

0 comments on commit 00a7344

Please sign in to comment.