85 {
86 ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoCollapse;
88 {
89 window_flags |= ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize;
90 }
91
92 ImGui::SetNextWindowSizeConstraints(ImVec2(ImGui::GetIO().DisplaySize.x * 0.1, ImGui::GetIO().DisplaySize.y * 0.1), ImVec2(ImGui::GetIO().DisplaySize.x - 200, ImGui::GetIO().DisplaySize.y));
95
96
98 {
99 float minScale = 0.10f, maxScale = 10.0f;
100 ImGui::Separator();
101 ImGui::TextUnformatted("Default Marker Size Scale");
102 ImGui::SameLine();
103 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
104 if (ImGui::SliderFloat(
"##marker_size_slider", &
global_size_slider, minScale, maxScale,
"x%.2f"))
105 {
106
111 }
112 }
113
114 ImGui::Separator();
115
116 float minScale = 25.0f, maxScale = 550.0f;
117 ImGui::Separator();
118 ImGui::TextUnformatted("Directory Thumb Pixel Size");
119 ImGui::SameLine();
120 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
121 if (ImGui::SliderFloat(
"##image_size_slider", &
imageSize, minScale, maxScale,
"x%.2f"))
122 {
123
128 }
129
130 ImGui::Separator();
131
132 ImGui::BeginChild("DirectoryScrollRegion", ImVec2(0, 0), true, ImGuiWindowFlags_HorizontalScrollbar);
133 float window_width = ImGui::GetWindowWidth();
134 ImVec2 content_region = ImGui::GetContentRegionAvail();
135 int columns = (int)(content_region.x /
imageSize);
136 if (columns <= 0)
137 columns = 1;
138 int count = 0;
139 {
140
141 std::shared_lock<std::shared_mutex> lock(
imagesMutex);
142 for (
auto& image :
images)
143 {
144 if (count % columns != 0)
145 ImGui::SameLine();
146 std::string path_file =
directoryPath +
"\\" + image.filename.c_str();
147 if (image.textureID == 0)
148 {
150 }
151
152 ImGui::BeginGroup();
153 ImGui::PushID(count);
154
156 {
157
158 if (ImGui::ImageButton((
void*)(intptr_t)image.textureID, ImVec2(
imageSize,
imageSize)))
159 {
161 std::cout <<
"Selected Image: " << image.
filename <<
" | " << image.textureID << std::endl;
162 ImGui::OpenPopup("Image Popup");
163 }
164
165
166 if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceAllowNullID))
167 {
168 ImGui::SetDragDropPayload("MARKER_IMAGE", &image, sizeof(image));
169 ImGui::Text("Drag Marker: %s", image.filename.c_str());
170 ImGui::EndDragDropSource();
171 }
172 }
173 else
174 {
175 if (ImGui::ImageButton((
void*)(intptr_t)image.textureID, ImVec2(
imageSize,
imageSize)))
176 {
178 std::cout <<
"Selected Image: " << image.
filename <<
" | " << image.textureID << std::endl;
179 ImGui::OpenPopup("Image Popup");
180 }
181
182 if (ImGui::BeginPopup("Image Popup"))
183 {
184 ImGui::Text("File: %s", image.filename.c_str());
185 ImGui::EndPopup();
186 }
187 }
188 ImGui::TextWrapped(
"%s",
TruncateString(image.filename.c_str(), 16).c_str());
189 ImGui::PopID();
190 ImGui::EndGroup();
191 count++;
192 }
193 }
194 ImGui::EndChild();
195 ImGui::End();
196 }
std::string TruncateString(const std::string &str, size_t maxLength)