diff --git a/resource/common/locale/English.toml b/resource/common/locale/English.toml index 07e4fcf..f467871 100644 --- a/resource/common/locale/English.toml +++ b/resource/common/locale/English.toml @@ -184,9 +184,10 @@ Overlay = "Overlay" Position = "Position" Remove = "Remove" Favourites = "Add to favourites" -FavouritesText = "Added to favourites" +FavouritesNone = "You don't have any favourites!" FavouritesRemove = "Remove from favourites" FavouritesRemoveText = "Removed from favourites" +FavouritesText = "Added to favourites" Close = "Close" QuickSSKey = "Quick screenshot" QuickTPKey = "Toogle quick teleport" @@ -556,7 +557,7 @@ Siren = "Siren" SkidMarks = "Always skid marks" Small = "Small" SpawnInAir = "Spawn aircraft in air" -SpawnInside = "Spawn inside as driver" +SpawnInside = "Spawn as driver" StayOnBike = "Don't fall off bike" SteeringLock = "Steering lock" SuspensionBias = "Suspension bias" diff --git a/src/resourcestore.cpp b/src/resourcestore.cpp index 2c23bfd..98d94e7 100644 --- a/src/resourcestore.cpp +++ b/src/resourcestore.cpp @@ -56,7 +56,7 @@ void ResourceStore::LoadTextureResource(std::string&& name) if (!std::filesystem::exists(fullPath)) { - //Log::PrintWarn("Failed to load {}", fullPath); + Log::Print("Failed to load {}", fullPath); return; } @@ -66,7 +66,7 @@ void ResourceStore::LoadTextureResource(std::string&& name) { RwLinkList *pRLL = (RwLinkList*)pRwTexDictionary->texturesInDict.link.next; RwTexDictionary *pEndDic; - bool addCategories = m_Categories.empty(); + bool addCategories = (m_Categories.size() < 2); // "All" do { pEndDic = (RwTexDictionary*)pRLL->link.next; @@ -114,7 +114,7 @@ void ResourceStore::LoadTextureResource(std::string&& name) } // Genereate categories - if (m_Type == TYPE_IMAGE_TEXT && + if (m_Type != TYPE_TEXT_IMAGE && !std::count(m_Categories.begin(), m_Categories.end(), m_ImagesList.back().get()->m_CategoryName)) { m_Categories.push_back(m_ImagesList.back().get()->m_CategoryName); diff --git a/src/widget.cpp b/src/widget.cpp index faf8b93..b7a9d8c 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -91,21 +91,8 @@ void Widget::DataList(ResourceStore& data, ArgCallback3 clickFunc, ArgCallback3 // Category box ImGui::PushItemWidth((ImGui::GetWindowContentRegionWidth() - ImGui::GetStyle().ItemSpacing.x)/2); Ui::ListBoxStr("##Categories", data.m_Categories, data.m_Selected); - ImGui::SameLine(); - - // Search box - data.m_Filter.Draw("##Filter"); - if (strlen(data.m_Filter.InputBuf) == 0) - { - ImDrawList* drawlist = ImGui::GetWindowDrawList(); - - ImVec2 min = ImGui::GetItemRectMin(); - min.x += ImGui::GetStyle().FramePadding.x; - min.y += ImGui::GetStyle().FramePadding.y; - - drawlist->AddText(min, ImGui::GetColorU32(ImGuiCol_TextDisabled), "Search"); - } + FilterWithHint("##Filter", data.m_Filter, TEXT("Window.Search")); ImGui::PopItemWidth(); ImGui::Spacing(); @@ -163,8 +150,13 @@ void Widget::DataList(ResourceStore& data, ArgCallback3 clickFunc, ArgCallback3 } if (ImGui::BeginTabItem(TEXT("Window.FavouritesTab"))) { + ImGui::Spacing(); + ImGui::PushItemWidth(ImGui::GetWindowContentRegionWidth()); + FilterWithHint("##Filter", data.m_Filter, TEXT("Window.Search")); + ImGui::PopItemWidth(); ImGui::Spacing(); ImGui::BeginChild(1); + size_t count = 0; for (auto [k, v] : *data.m_pData->GetTable("Favourites")) { std::string key = std::string(k.str()); @@ -179,9 +171,14 @@ void Widget::DataList(ResourceStore& data, ArgCallback3 clickFunc, ArgCallback3 if (ImGui::IsItemClicked(1)) { - contextMenu = {std::string("Favourites"), key, val}; + contextMenu = {std::string("Favourites"), key, val, removeFunc}; } } + ++count; + } + if (count == 0) + { + Widget::TextCentered(TEXT("Menu.FavouritesNone")); } if (contextMenu.func != nullptr) {