2022-12-29 19:26:00 +01:00
|
|
|
#include <hex/api/theme_manager.hpp>
|
|
|
|
|
|
|
|
#include <imgui.h>
|
2023-02-16 18:06:40 +01:00
|
|
|
#include <imgui_internal.h>
|
2022-12-29 19:26:00 +01:00
|
|
|
#include <implot.h>
|
|
|
|
#include <hex/ui/imgui_imhex_extensions.h>
|
|
|
|
#include <imnodes.h>
|
|
|
|
#include <TextEditor.h>
|
|
|
|
#include <romfs/romfs.hpp>
|
|
|
|
|
|
|
|
#include <hex/helpers/fs.hpp>
|
|
|
|
|
2023-11-18 14:50:43 +01:00
|
|
|
#include <hex/api/event_manager.hpp>
|
2023-02-16 18:06:40 +01:00
|
|
|
|
2023-03-12 18:27:29 +01:00
|
|
|
#include <wolv/io/file.hpp>
|
|
|
|
|
2022-12-29 19:26:00 +01:00
|
|
|
namespace hex::plugin::builtin {
|
|
|
|
|
2023-02-16 18:06:40 +01:00
|
|
|
void registerThemeHandlers() {
|
2023-12-08 10:29:44 +01:00
|
|
|
RequestInitThemeHandlers::subscribe([] {
|
2023-02-16 18:06:40 +01:00
|
|
|
{
|
2023-03-23 20:35:16 +01:00
|
|
|
const static ThemeManager::ColorMap ImGuiColorMap = {
|
2023-02-16 18:06:40 +01:00
|
|
|
{ "text", ImGuiCol_Text },
|
|
|
|
{ "text-disabled", ImGuiCol_TextDisabled },
|
|
|
|
{ "window-background", ImGuiCol_WindowBg },
|
|
|
|
{ "child-background", ImGuiCol_ChildBg },
|
|
|
|
{ "popup-background", ImGuiCol_PopupBg },
|
|
|
|
{ "border", ImGuiCol_Border },
|
|
|
|
{ "border-shadow", ImGuiCol_BorderShadow },
|
|
|
|
{ "frame-background", ImGuiCol_FrameBg },
|
|
|
|
{ "frame-background-hovered", ImGuiCol_FrameBgHovered },
|
|
|
|
{ "frame-background-active", ImGuiCol_FrameBgActive },
|
|
|
|
{ "title-background", ImGuiCol_TitleBg },
|
|
|
|
{ "title-background-active", ImGuiCol_TitleBgActive },
|
|
|
|
{ "title-background-collapse", ImGuiCol_TitleBgCollapsed },
|
|
|
|
{ "menu-bar-background", ImGuiCol_MenuBarBg },
|
|
|
|
{ "scrollbar-background", ImGuiCol_ScrollbarBg },
|
|
|
|
{ "scrollbar-grab", ImGuiCol_ScrollbarGrab },
|
|
|
|
{ "scrollbar-grab-hovered", ImGuiCol_ScrollbarGrabHovered },
|
|
|
|
{ "scrollbar-grab-active", ImGuiCol_ScrollbarGrabActive },
|
|
|
|
{ "check-mark", ImGuiCol_CheckMark },
|
|
|
|
{ "slider-grab", ImGuiCol_SliderGrab },
|
|
|
|
{ "slider-grab-active", ImGuiCol_SliderGrabActive },
|
|
|
|
{ "button", ImGuiCol_Button },
|
|
|
|
{ "button-hovered", ImGuiCol_ButtonHovered },
|
|
|
|
{ "button-active", ImGuiCol_ButtonActive },
|
|
|
|
{ "header", ImGuiCol_Header },
|
|
|
|
{ "header-hovered", ImGuiCol_HeaderHovered },
|
|
|
|
{ "header-active", ImGuiCol_HeaderActive },
|
|
|
|
{ "separator", ImGuiCol_Separator },
|
|
|
|
{ "separator-hovered", ImGuiCol_SeparatorHovered },
|
|
|
|
{ "separator-active", ImGuiCol_SeparatorActive },
|
|
|
|
{ "resize-grip", ImGuiCol_ResizeGrip },
|
|
|
|
{ "resize-grip-hovered", ImGuiCol_ResizeGripHovered },
|
|
|
|
{ "resize-grip-active", ImGuiCol_ResizeGripActive },
|
|
|
|
{ "tab", ImGuiCol_Tab },
|
|
|
|
{ "tab-hovered", ImGuiCol_TabHovered },
|
|
|
|
{ "tab-active", ImGuiCol_TabActive },
|
|
|
|
{ "tab-unfocused", ImGuiCol_TabUnfocused },
|
|
|
|
{ "tab-unfocused-active", ImGuiCol_TabUnfocusedActive },
|
|
|
|
{ "docking-preview", ImGuiCol_DockingPreview },
|
|
|
|
{ "docking-empty-background", ImGuiCol_DockingEmptyBg },
|
|
|
|
{ "plot-lines", ImGuiCol_PlotLines },
|
|
|
|
{ "plot-lines-hovered", ImGuiCol_PlotLinesHovered },
|
|
|
|
{ "plot-histogram", ImGuiCol_PlotHistogram },
|
|
|
|
{ "plot-histogram-hovered", ImGuiCol_PlotHistogramHovered },
|
|
|
|
{ "table-header-background", ImGuiCol_TableHeaderBg },
|
|
|
|
{ "table-border-strong", ImGuiCol_TableBorderStrong },
|
|
|
|
{ "table-border-light", ImGuiCol_TableBorderLight },
|
|
|
|
{ "table-row-background", ImGuiCol_TableRowBg },
|
|
|
|
{ "table-row-background-alt", ImGuiCol_TableRowBgAlt },
|
|
|
|
{ "text-selected-background", ImGuiCol_TextSelectedBg },
|
|
|
|
{ "drag-drop-target", ImGuiCol_DragDropTarget },
|
|
|
|
{ "nav-highlight", ImGuiCol_NavHighlight },
|
|
|
|
{ "nav-windowing-highlight", ImGuiCol_NavWindowingHighlight },
|
|
|
|
{ "nav-windowing-background", ImGuiCol_NavWindowingDimBg },
|
2023-11-24 15:31:27 +01:00
|
|
|
{ "modal-window-dim-background", ImGuiCol_ModalWindowDimBg },
|
|
|
|
{ "window-shadow", ImGuiCol_WindowShadow }
|
2023-02-16 18:06:40 +01:00
|
|
|
};
|
2023-01-03 16:34:22 +01:00
|
|
|
|
2023-03-23 20:35:16 +01:00
|
|
|
ThemeManager::addThemeHandler("imgui", ImGuiColorMap,
|
2023-02-16 18:06:40 +01:00
|
|
|
[](u32 colorId) -> ImColor {
|
|
|
|
return ImGui::GetStyle().Colors[colorId];
|
|
|
|
},
|
|
|
|
[](u32 colorId, ImColor color) {
|
|
|
|
ImGui::GetStyle().Colors[colorId] = color;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2023-01-03 16:34:22 +01:00
|
|
|
|
2023-02-16 18:06:40 +01:00
|
|
|
{
|
2023-03-23 20:35:16 +01:00
|
|
|
const static ThemeManager::ColorMap ImPlotColorMap = {
|
2023-02-16 18:06:40 +01:00
|
|
|
{ "line", ImPlotCol_Line },
|
|
|
|
{ "fill", ImPlotCol_Fill },
|
|
|
|
{ "marker-outline", ImPlotCol_MarkerOutline },
|
|
|
|
{ "marker-fill", ImPlotCol_MarkerFill },
|
|
|
|
{ "error-bar", ImPlotCol_ErrorBar },
|
|
|
|
{ "frame-bg", ImPlotCol_FrameBg },
|
|
|
|
{ "plot-bg", ImPlotCol_PlotBg },
|
|
|
|
{ "plot-border", ImPlotCol_PlotBorder },
|
|
|
|
{ "legend-bg", ImPlotCol_LegendBg },
|
|
|
|
{ "legend-border", ImPlotCol_LegendBorder },
|
|
|
|
{ "legend-text", ImPlotCol_LegendText },
|
|
|
|
{ "title-text", ImPlotCol_TitleText },
|
|
|
|
{ "inlay-text", ImPlotCol_InlayText },
|
|
|
|
{ "axis-text", ImPlotCol_AxisText },
|
|
|
|
{ "axis-grid", ImPlotCol_AxisGrid },
|
|
|
|
{ "axis-tick", ImPlotCol_AxisTick },
|
|
|
|
{ "axis-bg", ImPlotCol_AxisBg },
|
|
|
|
{ "axis-bg-hovered", ImPlotCol_AxisBgHovered },
|
|
|
|
{ "axis-bg-active", ImPlotCol_AxisBgActive },
|
|
|
|
{ "selection", ImPlotCol_Selection },
|
|
|
|
{ "crosshairs", ImPlotCol_Crosshairs }
|
|
|
|
};
|
2023-01-03 16:34:22 +01:00
|
|
|
|
2023-03-23 20:35:16 +01:00
|
|
|
ThemeManager::addThemeHandler("implot", ImPlotColorMap,
|
2023-02-16 18:06:40 +01:00
|
|
|
[](u32 colorId) -> ImColor {
|
|
|
|
return ImPlot::GetStyle().Colors[colorId];
|
|
|
|
},
|
|
|
|
[](u32 colorId, ImColor color) {
|
|
|
|
ImPlot::GetStyle().Colors[colorId] = color;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2022-12-29 19:26:00 +01:00
|
|
|
|
2023-02-16 18:06:40 +01:00
|
|
|
{
|
2023-03-23 20:35:16 +01:00
|
|
|
const static ThemeManager::ColorMap ImNodesColorMap = {
|
2022-12-29 19:26:00 +01:00
|
|
|
{ "node-background", ImNodesCol_NodeBackground },
|
|
|
|
{ "node-background-hovered", ImNodesCol_NodeBackgroundHovered },
|
|
|
|
{ "node-background-selected", ImNodesCol_NodeBackgroundSelected },
|
|
|
|
{ "node-outline", ImNodesCol_NodeOutline },
|
|
|
|
{ "title-bar", ImNodesCol_TitleBar },
|
|
|
|
{ "title-bar-hovered", ImNodesCol_TitleBarHovered },
|
|
|
|
{ "title-bar-selected", ImNodesCol_TitleBarSelected },
|
|
|
|
{ "link", ImNodesCol_Link },
|
|
|
|
{ "link-hovered", ImNodesCol_LinkHovered },
|
|
|
|
{ "link-selected", ImNodesCol_LinkSelected },
|
|
|
|
{ "pin", ImNodesCol_Pin },
|
|
|
|
{ "pin-hovered", ImNodesCol_PinHovered },
|
|
|
|
{ "box-selector", ImNodesCol_BoxSelector },
|
|
|
|
{ "box-selector-outline", ImNodesCol_BoxSelectorOutline },
|
|
|
|
{ "grid-background", ImNodesCol_GridBackground },
|
|
|
|
{ "grid-line", ImNodesCol_GridLine },
|
|
|
|
{ "grid-line-primary", ImNodesCol_GridLinePrimary },
|
|
|
|
{ "mini-map-background", ImNodesCol_MiniMapBackground },
|
|
|
|
{ "mini-map-background-hovered", ImNodesCol_MiniMapBackgroundHovered },
|
|
|
|
{ "mini-map-outline", ImNodesCol_MiniMapOutline },
|
|
|
|
{ "mini-map-outline-hovered", ImNodesCol_MiniMapOutlineHovered },
|
|
|
|
{ "mini-map-node-background", ImNodesCol_MiniMapNodeBackground },
|
|
|
|
{ "mini-map-node-background-hovered", ImNodesCol_MiniMapNodeBackgroundHovered },
|
|
|
|
{ "mini-map-node-background-selected", ImNodesCol_MiniMapNodeBackgroundSelected },
|
|
|
|
{ "mini-map-node-outline", ImNodesCol_MiniMapNodeOutline },
|
|
|
|
{ "mini-map-link", ImNodesCol_MiniMapLink },
|
|
|
|
{ "mini-map-link-selected", ImNodesCol_MiniMapLinkSelected },
|
|
|
|
{ "mini-map-canvas", ImNodesCol_MiniMapCanvas },
|
|
|
|
{ "mini-map-canvas-outline", ImNodesCol_MiniMapCanvasOutline },
|
2023-02-16 18:06:40 +01:00
|
|
|
};
|
2022-12-29 19:26:00 +01:00
|
|
|
|
2023-03-23 20:35:16 +01:00
|
|
|
ThemeManager::addThemeHandler("imnodes", ImNodesColorMap,
|
2023-02-16 18:06:40 +01:00
|
|
|
[](u32 colorId) -> ImColor {
|
|
|
|
return ImNodes::GetStyle().Colors[colorId];
|
|
|
|
},
|
|
|
|
[](u32 colorId, ImColor color) {
|
|
|
|
ImNodes::GetStyle().Colors[colorId] = color;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2022-12-29 19:26:00 +01:00
|
|
|
|
2023-02-16 18:06:40 +01:00
|
|
|
{
|
2023-03-23 20:35:16 +01:00
|
|
|
const static ThemeManager::ColorMap ImHexColorMap = {
|
2023-10-20 12:30:21 +02:00
|
|
|
{ "desc-button", ImGuiCustomCol_DescButton },
|
|
|
|
{ "desc-button-hovered", ImGuiCustomCol_DescButtonHovered },
|
|
|
|
{ "desc-button-active", ImGuiCustomCol_DescButtonActive },
|
|
|
|
{ "toolbar-gray", ImGuiCustomCol_ToolbarGray },
|
|
|
|
{ "toolbar-red", ImGuiCustomCol_ToolbarRed },
|
|
|
|
{ "toolbar-yellow", ImGuiCustomCol_ToolbarYellow },
|
|
|
|
{ "toolbar-green", ImGuiCustomCol_ToolbarGreen },
|
|
|
|
{ "toolbar-blue", ImGuiCustomCol_ToolbarBlue },
|
|
|
|
{ "toolbar-purple", ImGuiCustomCol_ToolbarPurple },
|
|
|
|
{ "toolbar-brown", ImGuiCustomCol_ToolbarBrown },
|
|
|
|
{ "logger-debug", ImGuiCustomCol_LoggerDebug },
|
|
|
|
{ "logger-info", ImGuiCustomCol_LoggerInfo },
|
|
|
|
{ "logger-warning", ImGuiCustomCol_LoggerWarning },
|
|
|
|
{ "logger-error", ImGuiCustomCol_LoggerError },
|
|
|
|
{ "logger-fatal", ImGuiCustomCol_LoggerFatal },
|
|
|
|
{ "achievement-unlocked", ImGuiCustomCol_AchievementUnlocked },
|
|
|
|
{ "find-highlight", ImGuiCustomCol_FindHighlight },
|
|
|
|
{ "highlight", ImGuiCustomCol_Highlight },
|
|
|
|
{ "diff-added", ImGuiCustomCol_DiffAdded },
|
|
|
|
{ "diff-removed", ImGuiCustomCol_DiffRemoved },
|
|
|
|
{ "diff-changed", ImGuiCustomCol_DiffChanged },
|
|
|
|
{ "advanced-encoding-ascii", ImGuiCustomCol_AdvancedEncodingASCII },
|
|
|
|
{ "advanced-encoding-single", ImGuiCustomCol_AdvancedEncodingSingleChar },
|
|
|
|
{ "advanced-encoding-multi", ImGuiCustomCol_AdvancedEncodingMultiChar },
|
|
|
|
{ "advanced-encoding-unknown", ImGuiCustomCol_AdvancedEncodingUnknown },
|
|
|
|
{ "patches", ImGuiCustomCol_Patches },
|
|
|
|
{ "pattern-selected", ImGuiCustomCol_PatternSelected },
|
|
|
|
{ "IEEE-tool-sign", ImGuiCustomCol_IEEEToolSign },
|
|
|
|
{ "IEEE-tool-exp", ImGuiCustomCol_IEEEToolExp },
|
|
|
|
{ "IEEE-tool-mantissa", ImGuiCustomCol_IEEEToolMantissa },
|
|
|
|
{ "blur-background", ImGuiCustomCol_BlurBackground }
|
2023-05-19 21:18:38 +02:00
|
|
|
|
2023-02-16 18:06:40 +01:00
|
|
|
};
|
2022-12-29 19:26:00 +01:00
|
|
|
|
2023-03-23 20:35:16 +01:00
|
|
|
ThemeManager::addThemeHandler("imhex", ImHexColorMap,
|
2023-02-16 18:06:40 +01:00
|
|
|
[](u32 colorId) -> ImColor {
|
2023-11-16 22:24:06 +01:00
|
|
|
return static_cast<ImGuiExt::ImHexCustomData *>(GImGui->IO.UserData)->Colors[colorId];
|
2022-12-29 19:26:00 +01:00
|
|
|
|
2023-02-16 18:06:40 +01:00
|
|
|
},
|
|
|
|
[](u32 colorId, ImColor color) {
|
2023-11-16 22:24:06 +01:00
|
|
|
static_cast<ImGuiExt::ImHexCustomData *>(GImGui->IO.UserData)->Colors[colorId] = color;
|
2023-02-16 18:06:40 +01:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2023-03-23 20:35:16 +01:00
|
|
|
const static ThemeManager::ColorMap TextEditorColorMap = {
|
2023-02-16 18:06:40 +01:00
|
|
|
{ "default", u32(TextEditor::PaletteIndex::Default) },
|
|
|
|
{ "keyword", u32(TextEditor::PaletteIndex::Keyword) },
|
|
|
|
{ "number", u32(TextEditor::PaletteIndex::Number) },
|
|
|
|
{ "string", u32(TextEditor::PaletteIndex::String) },
|
|
|
|
{ "char-literal", u32(TextEditor::PaletteIndex::CharLiteral) },
|
|
|
|
{ "punctuation", u32(TextEditor::PaletteIndex::Punctuation) },
|
|
|
|
{ "preprocessor", u32(TextEditor::PaletteIndex::Preprocessor) },
|
|
|
|
{ "identifier", u32(TextEditor::PaletteIndex::Identifier) },
|
|
|
|
{ "known-identifier", u32(TextEditor::PaletteIndex::KnownIdentifier) },
|
|
|
|
{ "preproc-identifier", u32(TextEditor::PaletteIndex::PreprocIdentifier) },
|
|
|
|
{ "comment", u32(TextEditor::PaletteIndex::Comment) },
|
|
|
|
{ "multi-line-comment", u32(TextEditor::PaletteIndex::MultiLineComment) },
|
|
|
|
{ "background", u32(TextEditor::PaletteIndex::Background) },
|
|
|
|
{ "cursor", u32(TextEditor::PaletteIndex::Cursor) },
|
|
|
|
{ "selection", u32(TextEditor::PaletteIndex::Selection) },
|
|
|
|
{ "error-marker", u32(TextEditor::PaletteIndex::ErrorMarker) },
|
|
|
|
{ "breakpoint", u32(TextEditor::PaletteIndex::Breakpoint) },
|
|
|
|
{ "line-number", u32(TextEditor::PaletteIndex::LineNumber) },
|
|
|
|
{ "current-line-fill", u32(TextEditor::PaletteIndex::CurrentLineFill) },
|
|
|
|
{ "current-line-fill-inactive", u32(TextEditor::PaletteIndex::CurrentLineFillInactive) },
|
|
|
|
{ "current-line-edge", u32(TextEditor::PaletteIndex::CurrentLineEdge) }
|
|
|
|
};
|
|
|
|
|
2023-03-23 20:35:16 +01:00
|
|
|
ThemeManager::addThemeHandler("text-editor", TextEditorColorMap,
|
2023-02-16 18:06:40 +01:00
|
|
|
[](u32 colorId) -> ImColor {
|
|
|
|
return TextEditor::GetPalette()[colorId];
|
|
|
|
},
|
|
|
|
[](u32 colorId, ImColor color) {
|
|
|
|
auto palette = TextEditor::GetPalette();
|
|
|
|
palette[colorId] = color;
|
|
|
|
TextEditor::SetPalette(palette);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2022-12-29 19:26:00 +01:00
|
|
|
});
|
2023-02-16 18:06:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void registerStyleHandlers() {
|
2023-12-08 10:29:44 +01:00
|
|
|
RequestInitThemeHandlers::subscribe([] {
|
2023-02-16 18:06:40 +01:00
|
|
|
{
|
|
|
|
auto &style = ImGui::GetStyle();
|
2023-03-23 20:35:16 +01:00
|
|
|
const static ThemeManager::StyleMap ImGuiStyleMap = {
|
2023-11-24 15:31:27 +01:00
|
|
|
{ "alpha", { &style.Alpha, 0.1F, 1.0F, false } },
|
|
|
|
{ "disabled-alpha", { &style.DisabledAlpha, 0.0F, 1.0F, false } },
|
|
|
|
{ "window-padding", { &style.WindowPadding, 0.0F, 20.0F, true } },
|
|
|
|
{ "window-rounding", { &style.WindowRounding, 0.0F, 12.0F, true } },
|
|
|
|
{ "window-border-size", { &style.WindowBorderSize, 0.0F, 1.0F, true } },
|
|
|
|
{ "window-min-size", { &style.WindowMinSize, 0.0F, 1000.0F, true } },
|
|
|
|
{ "window-title-align", { &style.WindowTitleAlign, 0.0F, 1.0F , false } },
|
|
|
|
{ "child-rounding", { &style.ChildRounding, 0.0F, 12.0F, true } },
|
|
|
|
{ "child-border-size", { &style.ChildBorderSize, 0.0F, 1.0F , true } },
|
|
|
|
{ "popup-rounding", { &style.PopupRounding, 0.0F, 12.0F, true } },
|
|
|
|
{ "popup-border-size", { &style.PopupBorderSize, 0.0F, 1.0F, true } },
|
|
|
|
{ "frame-padding", { &style.FramePadding, 0.0F, 20.0F, true } },
|
|
|
|
{ "frame-rounding", { &style.FrameRounding, 0.0F, 12.0F, true } },
|
|
|
|
{ "frame-border-size", { &style.FrameBorderSize, 0.0F, 1.0F, true } },
|
|
|
|
{ "item-spacing", { &style.ItemSpacing, 0.0F, 20.0F, true } },
|
|
|
|
{ "item-inner-spacing", { &style.ItemInnerSpacing, 0.0F, 20.0F, true } },
|
|
|
|
{ "indent-spacing", { &style.IndentSpacing, 0.0F, 30.0F, true } },
|
|
|
|
{ "cell-padding", { &style.CellPadding, 0.0F, 20.0F, true } },
|
|
|
|
{ "scrollbar-size", { &style.ScrollbarSize, 0.0F, 20.0F, true } },
|
|
|
|
{ "scrollbar-rounding", { &style.ScrollbarRounding, 0.0F, 12.0F, true } },
|
|
|
|
{ "grab-min-size", { &style.GrabMinSize, 0.0F, 20.0F, true } },
|
|
|
|
{ "grab-rounding", { &style.GrabRounding, 0.0F, 12.0F, true } },
|
|
|
|
{ "tab-rounding", { &style.TabRounding, 0.0F, 12.0F, true } },
|
|
|
|
{ "button-text-align", { &style.ButtonTextAlign, 0.0F, 1.0F, false } },
|
|
|
|
{ "selectable-text-align", { &style.SelectableTextAlign, 0.0F, 1.0F, false } },
|
|
|
|
{ "window-shadow-size", { &style.WindowShadowSize, 0.0F, 100.0F, true } },
|
|
|
|
{ "window-shadow-offset", { &style.WindowShadowOffsetDist, 0.0F, 100.0F, true } },
|
|
|
|
{ "window-shadow-angle", { &style.WindowShadowOffsetAngle, 0.0F, 10.0F, false } },
|
2023-02-16 18:06:40 +01:00
|
|
|
};
|
2022-12-29 19:26:00 +01:00
|
|
|
|
2023-03-23 20:35:16 +01:00
|
|
|
ThemeManager::addStyleHandler("imgui", ImGuiStyleMap);
|
2023-02-16 18:06:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
auto &style = ImPlot::GetStyle();
|
2023-03-23 20:35:16 +01:00
|
|
|
const static ThemeManager::StyleMap ImPlotStyleMap = {
|
2023-03-18 10:52:50 +01:00
|
|
|
{ "line-weight", { &style.LineWeight, 0.0F, 5.0F, true } },
|
|
|
|
{ "marker-size", { &style.MarkerSize, 2.0F, 10.0F, true } },
|
|
|
|
{ "marker-weight", { &style.MarkerWeight, 0.0F, 5.0F, true } },
|
|
|
|
{ "fill-alpha", { &style.FillAlpha, 0.0F, 1.0F, false } },
|
|
|
|
{ "error-bar-size", { &style.ErrorBarSize, 0.0F, 10.0F, true } },
|
|
|
|
{ "error-bar-weight", { &style.ErrorBarWeight, 0.0F, 5.0F, true } },
|
|
|
|
{ "digital-bit-height", { &style.DigitalBitHeight, 0.0F, 20.0F, true } },
|
|
|
|
{ "digital-bit-gap", { &style.DigitalBitGap, 0.0F, 20.0F, true } },
|
|
|
|
{ "plot-border-size", { &style.PlotBorderSize, 0.0F, 2.0F, true } },
|
|
|
|
{ "minor-alpha", { &style.MinorAlpha, 0.0F, 1.0F, false } },
|
|
|
|
{ "major-tick-len", { &style.MajorTickLen, 0.0F, 20.0F, true } },
|
|
|
|
{ "minor-tick-len", { &style.MinorTickLen, 0.0F, 20.0F, true } },
|
|
|
|
{ "major-tick-size", { &style.MajorTickSize, 0.0F, 2.0F, true } },
|
|
|
|
{ "minor-tick-size", { &style.MinorTickSize, 0.0F, 2.0F, true } },
|
|
|
|
{ "major-grid-size", { &style.MajorGridSize, 0.0F, 2.0F, true } },
|
|
|
|
{ "minor-grid-size", { &style.MinorGridSize, 0.0F, 2.0F, true } },
|
|
|
|
{ "plot-padding", { &style.PlotPadding, 0.0F, 20.0F, true } },
|
|
|
|
{ "label-padding", { &style.LabelPadding, 0.0F, 20.0F, true } },
|
|
|
|
{ "legend-padding", { &style.LegendPadding, 0.0F, 20.0F, true } },
|
|
|
|
{ "legend-inner-padding", { &style.LegendInnerPadding, 0.0F, 10.0F, true } },
|
|
|
|
{ "legend-spacing", { &style.LegendSpacing, 0.0F, 5.0F, true } },
|
|
|
|
{ "mouse-pos-padding", { &style.MousePosPadding, 0.0F, 20.0F, true } },
|
|
|
|
{ "annotation-padding", { &style.AnnotationPadding, 0.0F, 5.0F, true } },
|
|
|
|
{ "fit-padding", { &style.FitPadding, 0.0F, 0.2F, true } },
|
|
|
|
{ "plot-default-size", { &style.PlotDefaultSize, 0.0F, 1000.0F, true } },
|
|
|
|
{ "plot-min-size", { &style.PlotMinSize, 0.0F, 300.0F, true } },
|
2023-02-16 18:06:40 +01:00
|
|
|
};
|
|
|
|
|
2023-03-23 20:35:16 +01:00
|
|
|
ThemeManager::addStyleHandler("implot", ImPlotStyleMap);
|
2023-02-16 18:06:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
auto &style = ImNodes::GetStyle();
|
2023-03-23 20:35:16 +01:00
|
|
|
const static ThemeManager::StyleMap ImNodesStyleMap = {
|
2023-03-18 10:52:50 +01:00
|
|
|
{ "grid-spacing", { &style.GridSpacing, 0.0F, 100.0F, true } },
|
|
|
|
{ "node-corner-rounding", { &style.NodeCornerRounding, 0.0F, 12.0F, true } },
|
|
|
|
{ "node-padding", { &style.NodePadding, 0.0F, 20.0F, true } },
|
|
|
|
{ "node-border-thickness", { &style.NodeBorderThickness, 0.0F, 1.0F, true } },
|
|
|
|
{ "link-thickness", { &style.LinkThickness, 0.0F, 10.0F, true } },
|
|
|
|
{ "link-line-segments-per-length", { &style.LinkLineSegmentsPerLength, 0.0F, 2.0F, true } },
|
|
|
|
{ "link-hover-distance", { &style.LinkHoverDistance, 0.0F, 20.0F, true } },
|
|
|
|
{ "pin-circle-radius", { &style.PinCircleRadius, 0.0F, 20.0F, true } },
|
|
|
|
{ "pin-quad-side-length", { &style.PinQuadSideLength, 0.0F, 20.0F, true } },
|
|
|
|
{ "pin-triangle-side-length", { &style.PinTriangleSideLength, 0.0F, 20.0F, true } },
|
|
|
|
{ "pin-line-thickness", { &style.PinLineThickness, 0.0F, 5.0F, true } },
|
|
|
|
{ "pin-hover-radius", { &style.PinHoverRadius, 0.0F, 20.0F, true } },
|
|
|
|
{ "pin-offset", { &style.PinOffset, -10.0F, 10.0F, true } },
|
|
|
|
{ "mini-map-padding", { &style.MiniMapPadding, 0.0F, 20.0F, true } },
|
|
|
|
{ "mini-map-offset", { &style.MiniMapOffset, -10.0F, 10.0F, true } },
|
2023-02-16 18:06:40 +01:00
|
|
|
};
|
|
|
|
|
2023-03-23 20:35:16 +01:00
|
|
|
ThemeManager::addStyleHandler("imnodes", ImNodesStyleMap);
|
2023-02-16 18:06:40 +01:00
|
|
|
}
|
2023-05-22 12:00:35 +02:00
|
|
|
|
|
|
|
{
|
2023-11-16 22:24:06 +01:00
|
|
|
auto &style = ImGuiExt::GetCustomStyle();
|
2023-05-22 12:00:35 +02:00
|
|
|
const static ThemeManager::StyleMap ImHexStyleMap = {
|
2023-05-22 13:20:25 +02:00
|
|
|
{ "window-blur", { &style.WindowBlur, 0.0F, 1.0F, true } },
|
2023-05-22 12:00:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
ThemeManager::addStyleHandler("imhex", ImHexStyleMap);
|
|
|
|
}
|
2022-12-29 19:26:00 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
void registerThemes() {
|
|
|
|
// Load built-in themes
|
|
|
|
for (const auto &theme : romfs::list("themes")) {
|
2023-03-23 20:35:16 +01:00
|
|
|
ThemeManager::addTheme(std::string(romfs::get(theme).string()));
|
2022-12-29 19:26:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Load user themes
|
|
|
|
for (const auto &themeFolder : fs::getDefaultPaths(fs::ImHexPath::Themes)) {
|
|
|
|
for (const auto &theme : std::fs::directory_iterator(themeFolder)) {
|
|
|
|
if (theme.is_regular_file())
|
2023-03-23 20:35:16 +01:00
|
|
|
ThemeManager::addTheme(wolv::io::File(theme.path(), wolv::io::File::Mode::Read).readString());
|
2022-12-29 19:26:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|