Skip to content

Commit 5b1ea01

Browse files
authored
PR #13392 from Noy-Zini: Update ImGui v1.90.9
2 parents 367937d + c6188ef commit 5b1ea01

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+43158
-11026
lines changed

common/calibration-model.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ void calibration_model::update(ux_window& window, std::string& error_message)
280280
ImGui::PopStyleColor(2);
281281
}
282282

283-
ImGui::PushStyleColor(ImGuiCol_ChildWindowBg, dark_sensor_bg);
283+
ImGui::PushStyleColor(ImGuiCol_ChildBg, dark_sensor_bg);
284284

285285
ImGui::BeginChild("##CalibData",ImVec2(w - 15, h - 110), true);
286286

common/device-model.cpp

+117-47
Large diffs are not rendered by default.

common/measurement.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ std::vector<int> measurement_state::find_path(int from, int to)
7777

7878
void measurement::add_point(interest_point p)
7979
{
80-
auto shift = ImGui::IsKeyDown(GLFW_KEY_LEFT_SHIFT) || ImGui::IsKeyDown(GLFW_KEY_RIGHT_SHIFT);
80+
ImGuiIO& io = ImGui::GetIO();
81+
auto shift = io.KeysDown[GLFW_KEY_LEFT_SHIFT] || io.KeysDown[GLFW_KEY_RIGHT_SHIFT];
8182

8283
if (is_enabled())
8384
{
@@ -334,7 +335,7 @@ void measurement::update_input(ux_window& win, const rs2::rect& viewer_rect)
334335
{
335336
id = 0;
336337

337-
if (ImGui::IsKeyPressed('Z') || ImGui::IsKeyPressed('z'))
338+
if (ImGui::IsKeyPressed(ImGuiKey_Z))
338339
restore_state();
339340

340341
input_ctrl.prev_mouse_down = input_ctrl.mouse_down;
@@ -430,7 +431,8 @@ void measurement::restore_state()
430431

431432
void measurement::draw(ux_window& win)
432433
{
433-
auto shift = ImGui::IsKeyDown(GLFW_KEY_LEFT_SHIFT) || ImGui::IsKeyDown(GLFW_KEY_RIGHT_SHIFT);
434+
ImGuiIO& io = ImGui::GetIO();
435+
auto shift = io.KeysDown[GLFW_KEY_LEFT_SHIFT] || io.KeysDown[GLFW_KEY_RIGHT_SHIFT];
434436

435437
auto p_idx = point_hovered(win);
436438
if (p_idx >= 0 && !win.get_mouse().mouse_down[0])

common/model-views.cpp

+24-23
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <librealsense2/rs.hpp>
1111

12+
#include <realsense_imgui.h>
1213
#include "model-views.h"
1314
#include "subdevice-model.h"
1415
#include "stream-model.h"
@@ -280,29 +281,29 @@ namespace rs2
280281

281282
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)
282283
{
283-
ImGui_ScopePushFont(window.get_font());
284-
ImGui_ScopePushStyleColor(ImGuiCol_Button, button_color);
285-
ImGui_ScopePushStyleColor(ImGuiCol_ButtonHovered, sensor_header_light_blue); //TODO: Change color?
286-
ImGui_ScopePushStyleColor(ImGuiCol_ButtonActive, regular_blue); //TODO: Change color?
287-
ImGui_ScopePushStyleColor(ImGuiCol_TextSelectedBg, light_grey);
288-
ImGui_ScopePushStyleColor(ImGuiCol_TitleBg, header_color);
289-
ImGui_ScopePushStyleColor(ImGuiCol_PopupBg, sensor_bg);
290-
ImGui_ScopePushStyleColor(ImGuiCol_BorderShadow, dark_grey);
291-
ImGui_ScopePushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20, 10));
284+
RsImGui_ScopePushFont(window.get_font());
285+
RsImGui_ScopePushStyleColor(ImGuiCol_Button, button_color);
286+
RsImGui_ScopePushStyleColor(ImGuiCol_ButtonHovered, sensor_header_light_blue); //TODO: Change color?
287+
RsImGui_ScopePushStyleColor(ImGuiCol_ButtonActive, regular_blue); //TODO: Change color?
288+
RsImGui_ScopePushStyleColor(ImGuiCol_TextSelectedBg, light_grey);
289+
RsImGui_ScopePushStyleColor(ImGuiCol_TitleBg, header_color);
290+
RsImGui_ScopePushStyleColor(ImGuiCol_PopupBg, sensor_bg);
291+
RsImGui_ScopePushStyleColor(ImGuiCol_BorderShadow, dark_grey);
292+
RsImGui_ScopePushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20, 10));
292293
auto clicked = false;
293294

294295
ImGui::OpenPopup(title.c_str());
295296
ImGui::SetNextWindowPos( {window.width() * 0.35f, window.height() * 0.35f });
296297
if (ImGui::BeginPopup(title.c_str()))
297298
{
298299
{
299-
ImGui_ScopePushStyleColor(ImGuiCol_Text, almost_white_bg);
300+
RsImGui_ScopePushStyleColor(ImGuiCol_Text, almost_white_bg);
300301

301302
ImGui::SetWindowFontScale(1.3f);
302303
ImGui::Text("%s", title.c_str());
303304
}
304305
{
305-
ImGui_ScopePushStyleColor(ImGuiCol_Text, light_grey);
306+
RsImGui_ScopePushStyleColor(ImGuiCol_Text, light_grey);
306307
ImGui::Separator();
307308
ImGui::SetWindowFontScale(1.1f);
308309
ImGui::Text("\n%s\n", message_text.c_str());
@@ -332,7 +333,7 @@ namespace rs2
332333
{
333334
ImGui::NewLine();
334335
{
335-
ImGui_ScopePushStyleColor(ImGuiCol_Text, red);
336+
RsImGui_ScopePushStyleColor(ImGuiCol_Text, red);
336337
ImGui::Text("%s\n\n", disabled_reason.c_str());
337338
}
338339
auto window_width = ImGui::GetWindowWidth();
@@ -354,24 +355,24 @@ namespace rs2
354355
// and close button activated by the caller
355356
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)
356357
{
357-
ImGui_ScopePushFont(window.get_font());
358-
ImGui_ScopePushStyleColor(ImGuiCol_Button, button_color);
359-
ImGui_ScopePushStyleColor(ImGuiCol_ButtonHovered, sensor_header_light_blue); //TODO: Change color?
360-
ImGui_ScopePushStyleColor(ImGuiCol_ButtonActive, regular_blue); //TODO: Change color?
361-
ImGui_ScopePushStyleColor(ImGuiCol_Text, light_grey);
362-
ImGui_ScopePushStyleColor(ImGuiCol_TextSelectedBg, light_grey);
363-
ImGui_ScopePushStyleColor(ImGuiCol_TitleBg, header_color);
364-
ImGui_ScopePushStyleColor(ImGuiCol_PopupBg, sensor_bg);
365-
ImGui_ScopePushStyleColor(ImGuiCol_BorderShadow, dark_grey);
366-
ImGui_ScopePushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20, 10));
358+
RsImGui_ScopePushFont(window.get_font());
359+
RsImGui_ScopePushStyleColor(ImGuiCol_Button, button_color);
360+
RsImGui_ScopePushStyleColor(ImGuiCol_ButtonHovered, sensor_header_light_blue); //TODO: Change color?
361+
RsImGui_ScopePushStyleColor(ImGuiCol_ButtonActive, regular_blue); //TODO: Change color?
362+
RsImGui_ScopePushStyleColor(ImGuiCol_Text, light_grey);
363+
RsImGui_ScopePushStyleColor(ImGuiCol_TextSelectedBg, light_grey);
364+
RsImGui_ScopePushStyleColor(ImGuiCol_TitleBg, header_color);
365+
RsImGui_ScopePushStyleColor(ImGuiCol_PopupBg, sensor_bg);
366+
RsImGui_ScopePushStyleColor(ImGuiCol_BorderShadow, dark_grey);
367+
RsImGui_ScopePushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20, 10));
367368
auto close_clicked = false;
368369

369370
ImGui::OpenPopup(title.c_str());
370371
ImGui::SetNextWindowPos({ window.width() * 0.35f, window.height() * 0.35f });
371372
if (ImGui::BeginPopup(title.c_str()))
372373
{
373374
{
374-
ImGui_ScopePushStyleColor(ImGuiCol_Text, almost_white_bg);
375+
RsImGui_ScopePushStyleColor(ImGuiCol_Text, almost_white_bg);
375376

376377
ImGui::SetWindowFontScale(1.3f);
377378
ImGui::Text("%s", title.c_str());

common/notifications.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ namespace rs2
614614

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

common/option-model.cpp

+13-11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Copyright(c) 2022 Intel Corporation. All Rights Reserved.
33

44
#include "option-model.h"
5+
#include <realsense_imgui.h>
56
#include <librealsense2/rs_advanced_mode.hpp>
67
#include <imgui.h>
78
#include <imgui_internal.h>
@@ -256,15 +257,15 @@ bool option_model::draw_combobox( notifications_model & model,
256257
if( new_line )
257258
ImGui::SetCursorPosX( combo_position_x );
258259

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

261262
int selected;
262263
std::vector< const char * > labels = get_combo_labels( &selected );
263264
ImGui::PushStyleColor( ImGuiCol_TextSelectedBg, { 1, 1, 1, 1 } );
264265

265266
try
266267
{
267-
if( ImGui::Combo( id.c_str(), &selected, labels.data(), static_cast< int >( labels.size() ) ) )
268+
if( RsImGui::CustomComboBox( id.c_str(), &selected, labels.data(), static_cast< int >( labels.size() ) ) )
268269
{
269270
float tmp_value = range.min + range.step * selected;
270271
model.add_log( rsutils::string::from()
@@ -337,7 +338,7 @@ bool option_model::draw_slider( notifications_model & model,
337338
ImGui::Text( "%s", txt.c_str() );
338339

339340
ImGui::SameLine();
340-
ImGui::SetCursorPosX( read_only ? 268.f : 245.f );
341+
ImGui::SetCursorPosX( read_only ? 280.f : 257.f );
341342
ImGui::PushStyleColor( ImGuiCol_Text, grey );
342343
ImGui::PushStyleColor( ImGuiCol_TextSelectedBg, grey );
343344
ImGui::PushStyleColor( ImGuiCol_ButtonActive, { 1.f, 1.f, 1.f, 0.f } );
@@ -353,7 +354,7 @@ bool option_model::draw_slider( notifications_model & model,
353354
if( ! read_only )
354355
{
355356
ImGui::SameLine();
356-
ImGui::SetCursorPosX( 268 );
357+
ImGui::SetCursorPosX( 280 );
357358
if( ! edit_mode )
358359
{
359360
std::string edit_id = rsutils::string::from() << textual_icons::edit << "##" << id;
@@ -390,9 +391,10 @@ bool option_model::draw_slider( notifications_model & model,
390391
ImGui::PopStyleColor( 4 );
391392
}
392393
}
393-
394-
ImGui::PushItemWidth( -1 );
395-
394+
float customWidth = 295 - ImGui::GetCursorPosX(); //set slider width from the current Xpos to the right border at 295 (the edit button pos)
395+
ImGui::PushItemWidth(customWidth);
396+
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, black);
397+
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, black);
396398
try
397399
{
398400
if( read_only )
@@ -495,12 +497,11 @@ bool option_model::draw_slider( notifications_model & model,
495497
// runs when changing a value with slider and not the textbox
496498
auto int_value = static_cast< int >( value_as_float() );
497499

498-
if( ImGui::SliderIntWithSteps( id.c_str(),
500+
if( RsImGui::SliderIntWithSteps( id.c_str(),
499501
&int_value,
500502
static_cast< int >( range.min ),
501503
static_cast< int >( range.max ),
502-
static_cast< int >( range.step ),
503-
"%.0f" ) ) // integers don't have any precision
504+
static_cast< int >( range.step )) )
504505
{
505506
// TODO: Round to step?
506507
slider_clicked = slider_selected( opt,
@@ -579,7 +580,8 @@ bool option_model::draw_slider( notifications_model & model,
579580
{
580581
error_message = error_to_string( e );
581582
}
582-
583+
ImGui::PopStyleColor(2);
584+
ImGui::PopItemWidth();
583585
return slider_clicked;
584586
}
585587

common/output-model.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ bool output_model::round_indicator(ux_window& win, std::string icon,
182182

183183
auto pos = ImGui::GetCursorScreenPos();
184184
ImGui::GetWindowDrawList()->AddRectFilled({ pos.x, pos.y + 3 },
185-
{ pos.x + size.x + 15, pos.y + 27 }, ImColor(color), 12, 15);
185+
{ pos.x + size.x + 15, pos.y + 27 }, ImColor(color), 12, ImDrawFlags_RoundCornersNone);
186186

187187
auto res = ImGui::Button(ss.str().c_str(), ImVec2(size.x + 15, 28));
188188
if (count > 0 && ImGui::IsItemHovered())
@@ -438,7 +438,7 @@ void output_model::draw(ux_window& win, rect view_rect, device_models_list & dev
438438

439439

440440
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0,0));
441-
ImGui::PushStyleColor(ImGuiCol_ChildWindowBg, dark_sensor_bg);
441+
ImGui::PushStyleColor(ImGuiCol_ChildBg, dark_sensor_bg);
442442

443443
const float log_area_width = w - get_dashboard_width() - 2;
444444

@@ -520,7 +520,7 @@ void output_model::draw(ux_window& win, rect view_rect, device_models_list & dev
520520
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 4);
521521

522522
std::string label = rsutils::string::from() << "##log_entry" << i++;
523-
ImGui::InputTextEx(label.c_str(),
523+
ImGui::InputTextEx(label.c_str(),NULL,
524524
(char*)line.data(),
525525
static_cast<int>(line.size() + 1),
526526
ImVec2(-1, size.y + margin),
@@ -592,19 +592,19 @@ void output_model::draw(ux_window& win, rect view_rect, device_models_list & dev
592592
ImGui::PushItemWidth( w - get_dashboard_width() - 30 );
593593

594594
bool force_refresh = false;
595-
if (ImGui::IsWindowFocused() && (ImGui::IsKeyPressed(GLFW_KEY_UP) || ImGui::IsKeyPressed(GLFW_KEY_DOWN)))
595+
if (ImGui::IsWindowFocused() && (ImGui::GetIO().KeysDown[ImGuiKey_UpArrow] || ImGui::GetIO().KeysDown[ImGuiKey_DownArrow]))
596596
{
597597
if (commands_histroy.size())
598598
{
599-
if (ImGui::IsKeyPressed(GLFW_KEY_UP)) history_offset = (history_offset + 1) % commands_histroy.size();
600-
if (ImGui::IsKeyPressed(GLFW_KEY_DOWN)) history_offset = (history_offset - 1 + (int)commands_histroy.size()) % commands_histroy.size();
599+
if (ImGui::GetIO().KeysDown[ImGuiKey_UpArrow]) history_offset = (history_offset + 1) % commands_histroy.size();
600+
if (ImGui::GetIO().KeysDown[ImGuiKey_DownArrow]) history_offset = (history_offset - 1 + (int)commands_histroy.size()) % commands_histroy.size();
601601
command_line = commands_histroy[history_offset];
602602

603603
force_refresh = true;
604604
}
605605
}
606606

607-
if (ImGui::IsWindowFocused() && ImGui::IsKeyPressed(GLFW_KEY_TAB))
607+
if (ImGui::IsWindowFocused() && ImGui::GetIO().KeysDown[GLFW_KEY_TAB])
608608
{
609609
if (!autocomplete.size() || !starts_with(to_lower(autocomplete.front()), to_lower(command_line)))
610610
{
@@ -661,7 +661,7 @@ void output_model::draw(ux_window& win, rect view_rect, device_models_list & dev
661661
ImGui::PopFont();
662662
ImGui::PopStyleColor();
663663

664-
if (ImGui::IsWindowFocused() && (ImGui::IsKeyPressed(GLFW_KEY_ENTER) || ImGui::IsKeyPressed(GLFW_KEY_KP_ENTER)))
664+
if (ImGui::IsWindowFocused() && (ImGui::GetIO().KeysDown[GLFW_KEY_ENTER] || ImGui::GetIO().KeysDown[GLFW_KEY_KP_ENTER]))
665665
{
666666
if (commands_histroy.size() > 100) commands_histroy.pop_back();
667667
commands_histroy.push_front(command_line);
@@ -671,7 +671,7 @@ void output_model::draw(ux_window& win, rect view_rect, device_models_list & dev
671671
}
672672
else command_focus = false;
673673

674-
if (ImGui::IsWindowFocused() && ImGui::IsKeyPressed(GLFW_KEY_ESCAPE))
674+
if (ImGui::IsWindowFocused() && ImGui::GetIO().KeysDown[GLFW_KEY_ESCAPE])
675675
{
676676
command_line = "";
677677
}
@@ -862,7 +862,7 @@ void output_model::foreach_log(std::function<void(log_entry& line)> action)
862862

863863
if (new_log)
864864
{
865-
ImGui::SetScrollPosHere();
865+
ImGui::SetScrollHereY();
866866
new_log = false;
867867
}
868868
}

0 commit comments

Comments
 (0)