Skip to content

Commit de34ecc

Browse files
committed
fix build issue
1 parent 37d72fe commit de34ecc

File tree

5 files changed

+5
-135
lines changed

5 files changed

+5
-135
lines changed

common/device-model.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ namespace rs2
725725
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, sensor_bg);
726726

727727
label = rsutils::string::from() << "## " << id;
728-
if (ImGui::Combo(label.c_str(), &playback_speed_index, "Speed: x0.25\0Speed: x0.5\0Speed: x1\0Speed: x1.5\0Speed: x2\0\0", -1, false))
728+
if (ImGui::Combo(label.c_str(), &playback_speed_index, "Speed: x0.25\0Speed: x0.5\0Speed: x1\0Speed: x1.5\0Speed: x2\0\0", -1))
729729
{
730730
float speed = 1;
731731
switch (playback_speed_index)
@@ -1952,6 +1952,7 @@ namespace rs2
19521952
ImGui_ScopePushStyleColor(ImGuiCol_ButtonActive, button_color + 0.1f);
19531953
ImVec2 padding{ 2,2 };
19541954
ImGui_ScopePushStyleVar(ImGuiStyleVar_FramePadding, padding);
1955+
ImGui::PushStyleColor(ImGuiCol_PopupBg, black);
19551956
///////////////////////////////////////////
19561957
// Go over the loaded files and add them to the combo box
19571958
std::vector<std::string> full_files_names(advanced_mode_settings_file_names.begin(), advanced_mode_settings_file_names.end());
@@ -2023,6 +2024,7 @@ namespace rs2
20232024
return is_clicked;
20242025
};
20252026
sub->options_metadata[RS2_OPTION_VISUAL_PRESET].custom_draw_method = draw_preset_combo_box;
2027+
ImGui::PopStyleColor(1);
20262028
if (sub->draw_option(RS2_OPTION_VISUAL_PRESET, dev.is<playback>() || update_read_only_options, error_message, *viewer.not_model))
20272029
{
20282030
get_curr_advanced_controls = true;

common/model-views.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include <librealsense2/rs.hpp>
1111

12-
#include "realsense_imgui.h""
12+
#include <realsense_imgui.h>
1313
#include "model-views.h"
1414
#include "subdevice-model.h"
1515
#include "stream-model.h"

examples/align-gl/rs-align-gl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <librealsense2/rs.hpp>
55
#include "example-imgui.hpp"
66
#include <librealsense2-gl/rs_processing_gl.hpp> // Include GPU-Processing API
7+
#include <common/cli.h>
78
#include "imgui_impl_glfw.h"
89
#include <imgui_impl_opengl3.h>
910
#include<realsense_imgui.h>

third-party/imgui/realsense_imgui.cpp

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -341,133 +341,3 @@ void ImGui::RenderCollapseTriangle(ImVec2 p_min, bool is_open, float scale, bool
341341
window->DrawList->AddTriangleFilled(ImVec2(2+a.x, 2+a.y), ImVec2(2+b.x, 2+b.y), ImVec2(2+c.x, 2+c.y), GetColorU32(ImGuiCol_BorderShadow));
342342
window->DrawList->AddTriangleFilled(a, b, c, GetColorU32(ImGuiCol_Text));
343343
}
344-
// Combo box function.
345-
bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(void*, int, const char**), void* data, int items_count, int height_in_items, bool show_arrow_down)
346-
{
347-
ImGuiWindow* window = GetCurrentWindow();
348-
if (window->SkipItems)
349-
return false;
350-
351-
ImGuiContext& g = *GImGui;
352-
const ImGuiStyle& style = g.Style;
353-
const ImGuiID id = window->GetID(label);
354-
const float w = CalcItemWidth();
355-
356-
const ImVec2 label_size = CalcTextSize(label, NULL, true);
357-
const ImRect frame_bb(window->DC.CursorPos, ImVec2(w+ window->DC.CursorPos.x, label_size.y + style.FramePadding.y * 2.0f+ window->DC.CursorPos.y));
358-
const ImRect total_bb(frame_bb.Min,ImVec2(frame_bb.Max.x+label_size.x > frame_bb.Max.x + 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f+ frame_bb.Max.x, 0.0f+ frame_bb.Max.x));
359-
ItemSize(total_bb, style.FramePadding.y);
360-
if (!ItemAdd(total_bb, id))
361-
return false;
362-
363-
const float arrow_size = show_arrow_down ? (g.FontSize + style.FramePadding.x * 2.0f) : 0;
364-
const bool hovered = IsHovered(frame_bb, id);
365-
bool popup_open = IsPopupOpen(id, ImGuiPopupFlags_AnyPopupLevel);
366-
bool popup_opened_now = false;
367-
368-
const ImRect value_bb(frame_bb.Min, ImVec2(frame_bb.Max.x-arrow_size, frame_bb.Max.y-0.0f));
369-
if (show_arrow_down)
370-
{
371-
RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
372-
RenderFrame(ImVec2(frame_bb.Max.x - arrow_size, frame_bb.Min.y), frame_bb.Max, GetColorU32(popup_open || hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button), true, style.FrameRounding); // FIXME-ROUNDING
373-
RenderCollapseTriangle(ImVec2(frame_bb.Max.x - arrow_size+ style.FramePadding.x, frame_bb.Min.y+ style.FramePadding.y), true);
374-
}
375-
if (*current_item >= 0 && *current_item < items_count)
376-
{
377-
const char* item_text;
378-
if (items_getter(data, *current_item, &item_text))
379-
RenderTextClipped(ImVec2(frame_bb.Min.x + style.FramePadding.x, frame_bb.Min.y + style.FramePadding.y), value_bb.Max, item_text, NULL, NULL);
380-
}
381-
382-
if (label_size.x > 0)
383-
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
384-
385-
if (hovered)
386-
{
387-
SetHoveredID(id);
388-
if (g.IO.MouseClicked[0])
389-
{
390-
SetActiveID(0,NULL);
391-
if (IsPopupOpen(id, ImGuiPopupFlags_AnyPopupLevel))
392-
{
393-
ClosePopup(id);
394-
}
395-
else
396-
{
397-
FocusWindow(window);
398-
OpenPopup(label);
399-
popup_open = popup_opened_now = true;
400-
}
401-
}
402-
}
403-
404-
bool value_changed = false;
405-
if (IsPopupOpen(id, ImGuiPopupFlags_AnyPopupLevel))
406-
{
407-
// Size default to hold ~7 items
408-
if (height_in_items < 0)
409-
height_in_items = 7;
410-
411-
float popup_height = (label_size.y + style.ItemSpacing.y) * ImMin(items_count, height_in_items) + (style.FramePadding.y * 3);
412-
float popup_y1 = frame_bb.Max.y;
413-
float popup_y2 = ImClamp(popup_y1 + popup_height, popup_y1, g.IO.DisplaySize.y - style.DisplaySafeAreaPadding.y);
414-
if ((popup_y2 - popup_y1) < ImMin(popup_height, frame_bb.Min.y - style.DisplaySafeAreaPadding.y))
415-
{
416-
// Position our combo ABOVE because there's more space to fit! (FIXME: Handle in Begin() or use a shared helper. We have similar code in Begin() for popup placement)
417-
popup_y1 = ImClamp(frame_bb.Min.y - popup_height, style.DisplaySafeAreaPadding.y, frame_bb.Min.y);
418-
popup_y2 = frame_bb.Min.y;
419-
}
420-
ImRect popup_rect(ImVec2(frame_bb.Min.x, popup_y1), ImVec2(frame_bb.Max.x, popup_y2));
421-
SetNextWindowPos(popup_rect.Min);
422-
SetNextWindowSize(popup_rect.GetSize());
423-
PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding);
424-
425-
const ImGuiWindowFlags flags = ImGuiWindowFlags_NoCollapse;
426-
if (BeginPopupEx((ImGuiID)label, flags))
427-
{
428-
// Display items
429-
Spacing();
430-
for (int i = 0; i < items_count; i++)
431-
{
432-
PushID((void*)(intptr_t)i);
433-
const bool item_selected = (i == *current_item);
434-
const char* item_text;
435-
if (!items_getter(data, i, &item_text))
436-
item_text = "*Unknown item*";
437-
if (Selectable(item_text, item_selected))
438-
{
439-
ClearActiveID();
440-
value_changed = true;
441-
*current_item = i;
442-
}
443-
if (item_selected && popup_opened_now)
444-
SetScrollHereY();
445-
PopID();
446-
}
447-
EndPopup();
448-
}
449-
PopStyleVar();
450-
}
451-
return value_changed;
452-
}
453-
454-
// Combo box helper allowing to pass an array of strings.
455-
bool ImGui::Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items, bool show_arrow_down)
456-
{
457-
const bool value_changed = Combo(label, current_item, Items_ArrayGetter, (void*)items, items_count, height_in_items,false);
458-
return value_changed;
459-
}
460-
461-
// Combo box helper allowing to pass all items in a single string.
462-
bool ImGui::Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items, bool show_arrow_down)
463-
{
464-
int items_count = 0;
465-
const char* p = items_separated_by_zeros; // FIXME-OPT: Avoid computing this, or at least only when combo is open
466-
while (*p)
467-
{
468-
p += strlen(p) + 1;
469-
items_count++;
470-
}
471-
bool value_changed = Combo(label, current_item, Items_SingleStringGetter, (void*)items_separated_by_zeros, items_count, height_in_items, show_arrow_down);
472-
return value_changed;
473-
}

third-party/imgui/realsense_imgui.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ namespace ImGui
3636
//IMGUI_API bool VSliderFloatadd(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format, float power, bool render_bg);
3737
IMGUI_API bool SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags, bool render_bg);
3838
IMGUI_API float RoundScalar(float value, int decimal_precision);
39-
IMGUI_API bool Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1, bool show_arrow_down = true);
40-
IMGUI_API bool Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items = -1, bool show_arrow_down = true); // separate items with \0, end item-list with \0\0
41-
IMGUI_API bool Combo(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1, bool show_arrow_down = true);
4239
}
4340
#define CONCAT_(x,y) x##y
4441
#define CONCAT(x,y) CONCAT_(x,y)

0 commit comments

Comments
 (0)