sys: Removed all references to hex.builtin from main application

This commit is contained in:
WerWolv
2022-07-02 16:22:38 +02:00
parent f9fc7051fc
commit 0ed885fe0f
10 changed files with 153 additions and 53 deletions

View File

@@ -12,6 +12,7 @@
#include <hex/helpers/concepts.hpp>
#include <hex/api/task.hpp>
#include <hex/api/keybinding.hpp>
#include <hex/helpers/fs.hpp>
using ImGuiID = unsigned int;
struct ImVec2;
@@ -158,6 +159,9 @@ namespace hex {
void setProgramArguments(int argc, char **argv, char **envp);
void setBorderlessWindowMode(bool enabled);
void setCustomFontPath(const std::fs::path &path);
void setFontSize(float size);
}
struct ProgramArguments {
@@ -166,6 +170,12 @@ namespace hex {
char **envp;
};
enum class Theme {
Dark = 1,
Light = 2,
Classic = 3
};
const ProgramArguments &getProgramArguments();
float getTargetFPS();
@@ -181,6 +191,14 @@ namespace hex {
std::map<std::string, std::string> &getInitArguments();
const std::fs::path &getCustomFontPath();
float getFontSize();
void setTheme(Theme theme);
Theme getTheme();
void enableSystemThemeDetection(bool enabled);
bool usesSystemThemeDetection();
}
}

View File

@@ -1,13 +1,16 @@
#include <hex/api/imhex_api.hpp>
#include <hex/api/content_registry.hpp>
#include <hex/api/event.hpp>
#include <hex/providers/provider.hpp>
#include <utility>
#include <utility>
#include <unistd.h>
#include <imgui.h>
#include <nlohmann/json.hpp>
namespace hex {
namespace ImHexApi::Common {
@@ -315,6 +318,16 @@ namespace hex {
s_borderlessWindowMode = enabled;
}
static std::fs::path s_customFontPath;
void setCustomFontPath(const std::fs::path &path) {
s_customFontPath = path;
}
static float s_fontSize;
void setFontSize(float size) {
s_fontSize = size;
}
}
@@ -360,6 +373,39 @@ namespace hex {
return initArgs;
}
const std::fs::path &getCustomFontPath() {
return impl::s_customFontPath;
}
float getFontSize() {
return impl::s_fontSize;
}
static Theme s_theme;
static bool s_systemThemeDetection;
void setTheme(Theme theme) {
s_theme = theme;
EventManager::post<EventSettingsChanged>();
}
Theme getTheme() {
return s_theme;
}
void enableSystemThemeDetection(bool enabled) {
s_systemThemeDetection = enabled;
EventManager::post<EventSettingsChanged>();
}
bool usesSystemThemeDetection() {
return s_systemThemeDetection;
}
}
}