mirror of https://github.com/WerWolv/ImHex.git
pattern/ux: Added copying support to console, clip content, removed prefix
This commit is contained in:
parent
541c0d7547
commit
65212f22a6
|
@ -5,13 +5,7 @@
|
|||
namespace hex::pl {
|
||||
|
||||
void LogConsole::log(Level level, const std::string &message) {
|
||||
switch (level) {
|
||||
default:
|
||||
case Level::Debug: this->m_consoleLog.emplace_back(level, "[-] " + message); break;
|
||||
case Level::Info: this->m_consoleLog.emplace_back(level, "[i] " + message); break;
|
||||
case Level::Warning: this->m_consoleLog.emplace_back(level, "[*] " + message); break;
|
||||
case Level::Error: this->m_consoleLog.emplace_back(level, "[!] " + message); break;
|
||||
}
|
||||
this->m_consoleLog.emplace_back(level, message);
|
||||
}
|
||||
|
||||
[[noreturn]]
|
||||
|
|
|
@ -158,32 +158,46 @@ namespace hex::plugin::builtin {
|
|||
if (ImGui::BeginTabBar("about_tab_bar")) {
|
||||
|
||||
if (ImGui::BeginTabItem("ImHex")) {
|
||||
ImGui::NewLine();
|
||||
if (ImGui::BeginChild(1)) {
|
||||
this->drawAboutMainPage();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("hex.builtin.view.help.about.contributor"_lang)) {
|
||||
ImGui::NewLine();
|
||||
if (ImGui::BeginChild(1)) {
|
||||
this->drawContributorPage();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("hex.builtin.view.help.about.libs"_lang)) {
|
||||
ImGui::NewLine();
|
||||
if (ImGui::BeginChild(1)) {
|
||||
this->drawLibraryCreditsPage();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("hex.builtin.view.help.about.paths"_lang)) {
|
||||
ImGui::NewLine();
|
||||
if (ImGui::BeginChild(1)) {
|
||||
this->drawPathsPage();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui::BeginTabItem("hex.builtin.view.help.about.license"_lang)) {
|
||||
ImGui::NewLine();
|
||||
if (ImGui::BeginChild(1)) {
|
||||
this->drawLicensePage();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
|
|
|
@ -344,8 +344,12 @@ namespace hex::plugin::builtin {
|
|||
|
||||
void ViewPatternEditor::drawConsole(ImVec2 size) {
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, this->m_textEditor.GetPalette()[u32(TextEditor::PaletteIndex::Background)]);
|
||||
if (ImGui::BeginChild("##console", size, true, ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
|
||||
for (auto &[level, message] : this->m_console) {
|
||||
if (ImGui::BeginChild("##console", size, true, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_HorizontalScrollbar)) {
|
||||
ImGuiListClipper clipper(this->m_console.size());
|
||||
while (clipper.Step())
|
||||
for (u64 i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
|
||||
const auto &[level, message] = this->m_console[i];
|
||||
|
||||
switch (level) {
|
||||
case pl::LogConsole::Level::Debug:
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, this->m_textEditor.GetPalette()[u32(TextEditor::PaletteIndex::Comment)]);
|
||||
|
@ -362,7 +366,8 @@ namespace hex::plugin::builtin {
|
|||
default: continue;
|
||||
}
|
||||
|
||||
ImGui::TextUnformatted(message.c_str());
|
||||
if (ImGui::Selectable(message.c_str()))
|
||||
ImGui::SetClipboardText(message.c_str());
|
||||
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
@ -470,6 +475,9 @@ namespace hex::plugin::builtin {
|
|||
|
||||
void ViewPatternEditor::drawVariableSettings(ImVec2 size) {
|
||||
if (ImGui::BeginChild("##settings", size, true, ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
|
||||
if (this->m_patternVariables.empty()) {
|
||||
ImGui::TextFormattedCentered("hex.builtin.view.pattern_editor.no_in_out_vars"_lang);
|
||||
} else {
|
||||
if (ImGui::BeginTable("##in_out_vars_table", 2, ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_BordersInnerH)) {
|
||||
ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthStretch, 0.4F);
|
||||
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch, 0.6F);
|
||||
|
@ -512,6 +520,7 @@ namespace hex::plugin::builtin {
|
|||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue