mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
Don't show pattern editor when no file is loaded
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
|
||||
namespace hex {
|
||||
|
||||
ViewPattern::ViewPattern(std::vector<Highlight> &highlights) : View(), m_highlights(highlights) {
|
||||
ViewPattern::ViewPattern(prv::Provider* &dataProvider, std::vector<Highlight> &highlights)
|
||||
: View(), m_dataProvider(dataProvider), m_highlights(highlights) {
|
||||
this->m_buffer = new char[0xFFFFFF];
|
||||
std::memset(this->m_buffer, 0x00, 0xFFFFFF);
|
||||
}
|
||||
@@ -34,22 +35,25 @@ namespace hex {
|
||||
return;
|
||||
|
||||
if (ImGui::Begin("Pattern", &this->m_windowOpen, ImGuiWindowFlags_None)) {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||
if (this->m_dataProvider != nullptr && this->m_dataProvider->isReadable()) {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||
|
||||
auto size = ImGui::GetWindowSize();
|
||||
size.y -= 50;
|
||||
ImGui::InputTextMultiline("Pattern", this->m_buffer, 0xFFFF, size, ImGuiInputTextFlags_AllowTabInput | ImGuiInputTextFlags_CallbackEdit,
|
||||
[](ImGuiInputTextCallbackData* data) -> int {
|
||||
auto _this = static_cast<ViewPattern*>(data->UserData);
|
||||
auto size = ImGui::GetWindowSize();
|
||||
size.y -= 50;
|
||||
ImGui::InputTextMultiline("Pattern", this->m_buffer, 0xFFFF, size,
|
||||
ImGuiInputTextFlags_AllowTabInput | ImGuiInputTextFlags_CallbackEdit,
|
||||
[](ImGuiInputTextCallbackData *data) -> int {
|
||||
auto _this = static_cast<ViewPattern *>(data->UserData);
|
||||
|
||||
_this->parsePattern(data->Buf);
|
||||
_this->parsePattern(data->Buf);
|
||||
|
||||
return 0;
|
||||
}, this
|
||||
);
|
||||
return 0;
|
||||
}, this
|
||||
);
|
||||
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::PopStyleVar(2);
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user