Skip to content

Commit

Permalink
Add Paste Button & AutoResize for BeatmapIdSearchUi
Browse files Browse the repository at this point in the history
  • Loading branch information
KyuubiRan committed Jun 26, 2023
1 parent d89919a commit 690147d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Downloader/res/language/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,6 @@
"MainMenuHotkey": "Toggle Main Menu UI Show",
"IdSearchHotkey": "Toggle Sid/Bid Search UI Show",
"Main": "Main",
"Theme": "Theme"
"Theme": "Theme",
"Paste": "Paste"
}
3 changes: 2 additions & 1 deletion Downloader/res/language/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,6 @@
"MainMenuHotkey": "切换主菜单显示",
"IdSearchHotkey": "切换Sid/Bid搜索界面显示",
"Main": "主要",
"Theme": "主题"
"Theme": "主题",
"Paste": "粘贴"
}
9 changes: 7 additions & 2 deletions Downloader/src/ui/BeatmapIdSearchUi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void ui::search::beatmapid::Update() {

auto &lang = i18n::I18nManager::GetInstance();

constexpr static ImVec2 windowSize = ImVec2(400, 65);
constexpr static ImVec2 windowSize = ImVec2(425, 65);
if (static bool inited = false; !inited) {
const ImVec2 screenSize = ImGui::GetIO().DisplaySize;
const ImVec2 windowPos(screenSize.x / 2 - windowSize.x / 2, screenSize.y / 2 - windowSize.y / 2);
Expand All @@ -41,7 +41,8 @@ void ui::search::beatmapid::Update() {
inited = true;
}

ImGui::Begin(lang.getTextCStr("SearchBeatmapId"), nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize);
ImGui::Begin(lang.getTextCStr("SearchBeatmapId"), nullptr,
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize);
static std::string input;
static const char *items[] = {"Sid", "Bid"};

Expand All @@ -60,6 +61,10 @@ void ui::search::beatmapid::Update() {
if (ImGui::Button(lang.getTextCStr("Clear"))) {
input = "";
}
ImGui::SameLine();
if (ImGui::Button(lang.getTextCStr("Paste"))) {
input = ImGui::GetClipboardText();
}

ImGui::SameLine();
if (ImGui::Button(lang.getTextCStr("Search"))) {
Expand Down

0 comments on commit 690147d

Please sign in to comment.