From 797896499574634e7c52007f53b8a69485fc8d1f Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 27 Sep 2021 23:19:41 +0200 Subject: [PATCH] ui: Centered "No bookmarks" text --- plugins/builtin/source/lang/de_DE.cpp | 2 +- plugins/builtin/source/lang/en_US.cpp | 2 +- plugins/builtin/source/lang/it_IT.cpp | 2 +- plugins/builtin/source/lang/zh_CN.cpp | 2 +- source/views/view_bookmarks.cpp | 9 ++++++--- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/builtin/source/lang/de_DE.cpp b/plugins/builtin/source/lang/de_DE.cpp index 41dc6add5..fcf51cd25 100644 --- a/plugins/builtin/source/lang/de_DE.cpp +++ b/plugins/builtin/source/lang/de_DE.cpp @@ -84,7 +84,7 @@ namespace hex::plugin::builtin { { "hex.view.bookmarks.name", "Lesezeichen" }, { "hex.view.bookmarks.default_title", "Lesezeichen [0x{0:X} - 0x{1:X}]" }, - { "hex.view.bookmarks.no_bookmarks", "Noch kein Lesezeichen erstellt. Füge eines hinzu mit Bearbeiten -> Lesezeichen hinzufügen" }, + { "hex.view.bookmarks.no_bookmarks", "Noch kein Lesezeichen erstellt. Füge eines hinzu mit Bearbeiten -> Lesezeichen erstellen" }, { "hex.view.bookmarks.title.info", "Informationen" }, { "hex.view.bookmarks.address", "0x{0:X} : 0x{1:X} ({2} bytes)" }, { "hex.view.bookmarks.button.jump", "Springen" }, diff --git a/plugins/builtin/source/lang/en_US.cpp b/plugins/builtin/source/lang/en_US.cpp index 25388cbad..6ee9b6eef 100644 --- a/plugins/builtin/source/lang/en_US.cpp +++ b/plugins/builtin/source/lang/en_US.cpp @@ -84,7 +84,7 @@ namespace hex::plugin::builtin { { "hex.view.bookmarks.name", "Bookmarks" }, { "hex.view.bookmarks.default_title", "Bookmark [0x{0:X} - 0x{1:X}]" }, - { "hex.view.bookmarks.no_bookmarks", "No bookmarks created yet. Add one with Edit -> Add Bookmark" }, + { "hex.view.bookmarks.no_bookmarks", "No bookmarks created yet. Add one with Edit -> Create Bookmark" }, { "hex.view.bookmarks.title.info", "Information" }, { "hex.view.bookmarks.address", "0x{0:X} : 0x{1:X} ({2} bytes)" }, { "hex.view.bookmarks.button.jump", "Jump to" }, diff --git a/plugins/builtin/source/lang/it_IT.cpp b/plugins/builtin/source/lang/it_IT.cpp index 3a9b12fc8..b153b2e33 100644 --- a/plugins/builtin/source/lang/it_IT.cpp +++ b/plugins/builtin/source/lang/it_IT.cpp @@ -83,7 +83,7 @@ namespace hex::plugin::builtin { { "hex.view.bookmarks.name", "Segnalibri" }, { "hex.view.bookmarks.default_title", "Segnalibro [0x{0:X} - 0x{1:X}]" }, - { "hex.view.bookmarks.no_bookmarks", "Non è stato creato alcun segnalibro. Aggiungine uno andando su Modifica -> Aggiungi Segnalibro" }, + { "hex.view.bookmarks.no_bookmarks", "Non è stato creato alcun segnalibro. Aggiungine uno andando su Modifica -> Crea Segnalibro" }, { "hex.view.bookmarks.title.info", "Informazioni" }, { "hex.view.bookmarks.address", "0x{0:X} : 0x{1:X} ({2} bytes)" }, { "hex.view.bookmarks.button.jump", "Vai a" }, diff --git a/plugins/builtin/source/lang/zh_CN.cpp b/plugins/builtin/source/lang/zh_CN.cpp index 40f811e86..3a0f5f796 100644 --- a/plugins/builtin/source/lang/zh_CN.cpp +++ b/plugins/builtin/source/lang/zh_CN.cpp @@ -84,7 +84,7 @@ namespace hex::plugin::builtin { { "hex.view.bookmarks.name", "书签" }, { "hex.view.bookmarks.default_title", "书签 [0x{0:X} - 0x{1:X}]" }, - { "hex.view.bookmarks.no_bookmarks", "空空如也。通过 编辑->添加书签 添加一个" }, + { "hex.view.bookmarks.no_bookmarks", "空空如也。通过 编辑->添加书签" }, { "hex.view.bookmarks.title.info", "信息" }, { "hex.view.bookmarks.address", "0x{0:X} : 0x{1:X} ({2} 字节)" }, { "hex.view.bookmarks.button.jump", "转到" }, diff --git a/source/views/view_bookmarks.cpp b/source/views/view_bookmarks.cpp index af023bdeb..74d8bdda3 100644 --- a/source/views/view_bookmarks.cpp +++ b/source/views/view_bookmarks.cpp @@ -52,9 +52,12 @@ namespace hex { auto &bookmarks = ImHexApi::Bookmarks::getEntries(); if (bookmarks.empty()) { - ImGui::NewLine(); - ImGui::Indent(30); - ImGui::TextWrapped("%s", static_cast("hex.view.bookmarks.no_bookmarks"_lang)); + std::string text = "hex.view.bookmarks.no_bookmarks"_lang; + auto textSize = ImGui::CalcTextSize(text.c_str()); + auto availableSpace = ImGui::GetContentRegionAvail(); + + ImGui::SetCursorPos((availableSpace - textSize) / 2.0F); + ImGui::TextUnformatted(text.c_str()); } u32 id = 1;