sys: Better name for the pattern editor view
This commit is contained in:
parent
1c4a00dd00
commit
a7e2c06bc4
@ -74,7 +74,7 @@ add_executable(imhex ${application_type}
|
|||||||
source/providers/file_provider.cpp
|
source/providers/file_provider.cpp
|
||||||
|
|
||||||
source/views/view_hexeditor.cpp
|
source/views/view_hexeditor.cpp
|
||||||
source/views/view_pattern.cpp
|
source/views/view_pattern_editor.cpp
|
||||||
source/views/view_pattern_data.cpp
|
source/views/view_pattern_data.cpp
|
||||||
source/views/view_hashes.cpp
|
source/views/view_hashes.cpp
|
||||||
source/views/view_information.cpp
|
source/views/view_information.cpp
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
namespace hex {
|
namespace hex {
|
||||||
|
|
||||||
class ViewPattern : public View {
|
class ViewPatternEditor : public View {
|
||||||
public:
|
public:
|
||||||
ViewPattern();
|
ViewPatternEditor();
|
||||||
~ViewPattern() override;
|
~ViewPatternEditor() override;
|
||||||
|
|
||||||
void drawMenu() override;
|
void drawMenu() override;
|
||||||
void drawAlwaysVisible() override;
|
void drawAlwaysVisible() override;
|
@ -5,7 +5,7 @@
|
|||||||
#include <hex/api/content_registry.hpp>
|
#include <hex/api/content_registry.hpp>
|
||||||
|
|
||||||
#include "views/view_hexeditor.hpp"
|
#include "views/view_hexeditor.hpp"
|
||||||
#include "views/view_pattern.hpp"
|
#include "views/view_pattern_editor.hpp"
|
||||||
#include "views/view_pattern_data.hpp"
|
#include "views/view_pattern_data.hpp"
|
||||||
#include "views/view_hashes.hpp"
|
#include "views/view_hashes.hpp"
|
||||||
#include "views/view_information.hpp"
|
#include "views/view_information.hpp"
|
||||||
@ -93,7 +93,7 @@ namespace hex::init {
|
|||||||
bool loadDefaultViews() {
|
bool loadDefaultViews() {
|
||||||
|
|
||||||
ContentRegistry::Views::add<ViewHexEditor>();
|
ContentRegistry::Views::add<ViewHexEditor>();
|
||||||
ContentRegistry::Views::add<ViewPattern>();
|
ContentRegistry::Views::add<ViewPatternEditor>();
|
||||||
ContentRegistry::Views::add<ViewPatternData>();
|
ContentRegistry::Views::add<ViewPatternData>();
|
||||||
ContentRegistry::Views::add<ViewDataInspector>();
|
ContentRegistry::Views::add<ViewDataInspector>();
|
||||||
ContentRegistry::Views::add<ViewHashes>();
|
ContentRegistry::Views::add<ViewHashes>();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "views/view_pattern.hpp"
|
#include "views/view_pattern_editor.hpp"
|
||||||
|
|
||||||
#include "helpers/project_file_handler.hpp"
|
#include "helpers/project_file_handler.hpp"
|
||||||
#include <hex/helpers/utils.hpp>
|
#include <hex/helpers/utils.hpp>
|
||||||
@ -73,7 +73,7 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ViewPattern::ViewPattern() : View("hex.view.pattern.name") {
|
ViewPatternEditor::ViewPatternEditor() : View("hex.view.pattern.name") {
|
||||||
this->m_patternLanguageRuntime = new lang::PatternLanguage();
|
this->m_patternLanguageRuntime = new lang::PatternLanguage();
|
||||||
|
|
||||||
this->m_textEditor.SetLanguageDefinition(PatternLanguage());
|
this->m_textEditor.SetLanguageDefinition(PatternLanguage());
|
||||||
@ -200,7 +200,7 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewPattern::~ViewPattern() {
|
ViewPatternEditor::~ViewPatternEditor() {
|
||||||
delete this->m_patternLanguageRuntime;
|
delete this->m_patternLanguageRuntime;
|
||||||
|
|
||||||
EventManager::unsubscribe<EventProjectFileStore>(this);
|
EventManager::unsubscribe<EventProjectFileStore>(this);
|
||||||
@ -210,7 +210,7 @@ namespace hex {
|
|||||||
EventManager::unsubscribe<EventSettingsChanged>(this);
|
EventManager::unsubscribe<EventSettingsChanged>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewPattern::drawMenu() {
|
void ViewPatternEditor::drawMenu() {
|
||||||
if (ImGui::BeginMenu("hex.menu.file"_lang)) {
|
if (ImGui::BeginMenu("hex.menu.file"_lang)) {
|
||||||
if (ImGui::MenuItem("hex.view.pattern.menu.file.load_pattern"_lang)) {
|
if (ImGui::MenuItem("hex.view.pattern.menu.file.load_pattern"_lang)) {
|
||||||
hex::openFileBrowser("hex.view.pattern.open_pattern"_lang, DialogMode::Open, { { "Pattern File", "hexpat" } }, [this](auto path) {
|
hex::openFileBrowser("hex.view.pattern.open_pattern"_lang, DialogMode::Open, { { "Pattern File", "hexpat" } }, [this](auto path) {
|
||||||
@ -221,7 +221,7 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewPattern::drawContent() {
|
void ViewPatternEditor::drawContent() {
|
||||||
if (ImGui::Begin(View::toWindowName("hex.view.pattern.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_None | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
|
if (ImGui::Begin(View::toWindowName("hex.view.pattern.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_None | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
|
||||||
auto provider = SharedData::currentProvider;
|
auto provider = SharedData::currentProvider;
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ namespace hex {
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewPattern::drawAlwaysVisible() {
|
void ViewPatternEditor::drawAlwaysVisible() {
|
||||||
if (ImGui::BeginPopupModal("hex.view.pattern.accept_pattern"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (ImGui::BeginPopupModal("hex.view.pattern.accept_pattern"_lang, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
ImGui::TextWrapped("hex.view.pattern.accept_pattern.desc"_lang);
|
ImGui::TextWrapped("hex.view.pattern.accept_pattern.desc"_lang);
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ViewPattern::loadPatternFile(std::string_view path) {
|
void ViewPatternEditor::loadPatternFile(std::string_view path) {
|
||||||
FILE *file = fopen(path.data(), "rb");
|
FILE *file = fopen(path.data(), "rb");
|
||||||
|
|
||||||
if (file != nullptr) {
|
if (file != nullptr) {
|
||||||
@ -353,7 +353,7 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewPattern::clearPatternData() {
|
void ViewPatternEditor::clearPatternData() {
|
||||||
for (auto &data : SharedData::patternData)
|
for (auto &data : SharedData::patternData)
|
||||||
delete data;
|
delete data;
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ namespace hex {
|
|||||||
lang::PatternData::resetPalette();
|
lang::PatternData::resetPalette();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewPattern::parsePattern(char *buffer) {
|
void ViewPatternEditor::parsePattern(char *buffer) {
|
||||||
this->m_evaluatorRunning = true;
|
this->m_evaluatorRunning = true;
|
||||||
|
|
||||||
this->clearPatternData();
|
this->clearPatternData();
|
Loading…
x
Reference in New Issue
Block a user