38 #include <imgui_internal.h>
91 ImGuiWindowFlags win_flags = ImGuiWindowFlags_NoCollapse;
92 ImGui::SetNextWindowPosCenter(ImGuiCond_FirstUseEver);
93 ImGui::SetNextWindowSize(ImVec2((ImGui::GetIO().DisplaySize.x / 1.4), (ImGui::GetIO().DisplaySize.y / 1.2)), ImGuiCond_FirstUseEver);
94 bool keep_open =
true;
95 if (!ImGui::Begin(
_LC(
"MainSelector",
"Loader"), &keep_open, win_flags))
106 if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_RightArrow)))
114 else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_LeftArrow)))
135 ImGui::PopItemWidth();
139 const ImVec2 searchbox_cursor = ImGui::GetCursorPos();
140 const float searchbox_width = ImGui::GetWindowWidth() -
141 (
LEFT_PANE_WIDTH + 2 * (ImGui::GetStyle().WindowPadding.x) + ImGui::GetStyle().ItemSpacing.x);
145 ImGui::SetKeyboardFocusHere();
149 if (!
m_searchbox_was_active && (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Tab)) || ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Slash))))
151 ImGui::SetKeyboardFocusHere();
153 ImGui::PushItemWidth(searchbox_width);
161 ImGui::PopItemWidth();
163 const ImVec2 separator_cursor = ImGui::GetCursorPos()
164 + ImVec2(0, ImGui::GetStyle().WindowPadding.y - ImGui::GetStyle().ItemSpacing.y);
167 const char* searchbox_hint =
"(?)";
168 ImGui::SetCursorPos(searchbox_cursor + ImVec2(searchbox_width - (ImGui::CalcTextSize(searchbox_hint).
x + ImGui::GetStyle().FramePadding.x), ImGui::GetStyle().FramePadding.y));
169 ImGui::TextDisabled(searchbox_hint);
170 if (ImGui::IsItemHovered())
172 ImGui::BeginTooltip();
173 ImGui::TextDisabled(
"Fulltext search:");
174 ImGui::Text(
"~ partial name, filename, description, author name or e-mail");
175 ImGui::TextDisabled(
"Advanced search:");
176 ImGui::Text(
"guid: ~ partial GUID");
177 ImGui::Text(
"author: ~ partial author name or e-mail");
178 ImGui::Text(
"wheels: ~ wheel configuration (i.e. 4x4)");
179 ImGui::Text(
"file: ~ partial file name");
183 ImGui::SetCursorPos(separator_cursor);
189 bool scroll_to_selected =
false;
193 if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow)))
197 scroll_to_selected =
true;
199 else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow)))
203 scroll_to_selected =
true;
207 ImDrawList* drawlist = ImGui::GetWindowDrawList();
208 drawlist->ChannelsSplit(2);
209 bool do_apply =
false;
210 for (
int i = 0; i < num_entries; ++i)
216 drawlist->ChannelsSetCurrent(1);
218 ImGui::GetStyle().Colors[ImGuiCol_Text],
223 drawlist->ChannelsSetCurrent(0);
225 if (ImGui::Selectable(
"##dummy", &is_selected, 0, mouse_area))
231 if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0))
238 if (is_selected && scroll_to_selected)
240 ImGui::SetScrollHere();
249 drawlist->ChannelsMerge();
256 ImGui::BeginChild(
"item view", ImVec2(0, -ImGui::GetItemsLineHeightWithSpacing()));
265 ImVec2 cursor_pos = ImGui::GetCursorPos();
268 Ogre::TexturePtr preview_tex =
269 Ogre::TextureManager::getSingleton().load(
275 ImVec2 size(preview_tex->getWidth(), preview_tex->getHeight());
276 size *= max_size.x / size.x;
277 if (size.y > max_size.y)
279 size *= max_size.y / size.y;
282 ImGui::SetCursorPos((cursor_pos + ImGui::GetWindowSize()) - size);
283 ImGui::Image(
reinterpret_cast<ImTextureID
>(preview_tex->getHandle()), size);
284 ImGui::SetCursorPos(cursor_pos);
301 ImGui::TextDisabled(
"%s",
_LC(
"MainSelector",
"Author(s): "));
308 ImGui::Text(
"%s",
_LC(
"MainSelector",
"Wheels: "));
314 ImGui::Text(
"%s",
_LC(
"MainSelector",
"Mass: "));
323 ImGui::Text(
"%s",
_LC(
"MainSelector",
"Load Mass: "));
341 ImGui::Text(
"%s",
_LC(
"MainSelector",
"Using Submeshs: "));
347 ImGui::Text(
"%s",
_LC(
"MainSelector",
"Default skin: "));
355 ImGui::Text(
"%s",
_LC(
"MainSelector",
"Engine RPM: "));
381 ImGui::Text(
"%s",
_LC(
"MainSelector",
"Source: "));
388 ImGui::Text(
"%s",
_LC(
"MainSelector",
"Filename: "));
398 ImGui::BeginChild(
"buttons");
404 ImGui::PushItemWidth(ImGui::GetWindowWidth() / 2);
410 ImGui::SameLine(ImGui::GetWindowWidth()-280);
411 if (ImGui::Button(
_LC(
"MainSelector",
"OK"), ImVec2(120.f, 0.0f)) ||
412 ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Enter)))
417 ImGui::SameLine(ImGui::GetWindowWidth()-150);
418 if (ImGui::Button(
_LC(
"MainSelector",
"Cancel"), ImVec2(120.f, 0.0f)) || ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape)))
426 m_is_hovered = ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows);
435 template <
typename T1,
typename T2>
438 bool operator ()(std::pair<int, Ogre::String>
const& a, std::pair<int, Ogre::String>
const& b)
const
448 return a.second < b.second;
486 std::vector<std::pair<int, Ogre::String>> sorted_cats(cats.begin(), cats.end());
490 for (
auto itor: sorted_cats)
504 if (input.find(
":") == std::string::npos)
511 Ogre::StringVector v = Ogre::StringUtil::split(input,
":");
517 else if (v[0] ==
"guid")
522 else if (v[0] ==
"author")
527 else if (v[0] ==
"wheels")
532 else if (v[0] ==
"file")
558 ImGui::Text(
"%s", title);
560 ImGui::TextColored(
App::GetGuiManager()->GetTheme().value_blue_text_color,
"%d", val);
568 ImGui::Text(
"%s", title);
570 ImGui::TextColored(
App::GetGuiManager()->GetTheme().value_blue_text_color,
"%f", val);
578 ImGui::TextColored(
App::GetGuiManager()->GetTheme().value_red_text_color,
"%s", label);
586 ImGui::Text(
"%s", desc);
588 ImGui::TextColored(
App::GetGuiManager()->GetTheme().value_blue_text_color,
"%s", str.c_str());
634 std::string sectionconfig;
650 *out_text = dc_vec->at(idx).sdc_title.ToCStr();
671 : sdc_category_id(id)
673 sdc_title <<
"(" << usage <<
") " <<
_LC(
"ModCategory", name.c_str());