From f467cf019c9f8f40bb01d48dc82f72ef3fff1425 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Fri, 4 Mar 2016 13:03:47 -1000 Subject: [PATCH] Humungous refactor --- specter/CMakeLists.txt | 82 +++---- specter/include/Specter/ViewResources.hpp | 220 ------------------ .../include/{Specter => specter}/Button.hpp | 24 +- .../include/{Specter => specter}/Control.hpp | 10 +- .../DeferredWindowEvents.hpp | 2 +- .../{Specter => specter}/FileBrowser.hpp | 50 ++-- .../{Specter => specter}/FontCache.hpp | 30 +-- .../{Specter => specter}/IMenuNode.hpp | 2 +- .../{Specter => specter}/IViewManager.hpp | 12 +- specter/include/{Specter => specter}/Icon.hpp | 4 +- specter/include/{Specter => specter}/Menu.hpp | 2 +- .../{Specter => specter}/MessageWindow.hpp | 4 +- .../{Specter => specter}/ModalWindow.hpp | 18 +- .../MultiLineTextView.hpp | 10 +- specter/include/{Specter => specter}/Node.hpp | 0 .../{Specter => specter}/NodeSocket.hpp | 0 .../{Specter => specter}/NumericField.hpp | 4 +- .../include/{Specter => specter}/Outliner.hpp | 2 +- .../include/{Specter => specter}/Panel.hpp | 0 .../{Specter => specter}/PathButtons.hpp | 10 +- .../include/{Specter => specter}/RootView.hpp | 2 +- .../{Specter => specter}/ScrollView.hpp | 4 +- .../include/{Specter => specter}/Space.hpp | 6 +- .../{Specter => specter}/SplitView.hpp | 6 +- .../include/{Specter => specter}/Table.hpp | 4 +- .../{Specter => specter}/TextField.hpp | 4 +- .../include/{Specter => specter}/TextView.hpp | 20 +- .../include/{Specter => specter}/Toolbar.hpp | 6 +- .../include/{Specter => specter}/Tooltip.hpp | 6 +- .../{Specter => specter}/Translator.hpp | 10 +- specter/include/{Specter => specter}/View.hpp | 28 +-- specter/include/specter/ViewResources.hpp | 220 ++++++++++++++++++ .../Specter.hpp => specter/specter.hpp} | 0 specter/lib/Button.cpp | 78 +++---- specter/lib/Control.cpp | 4 +- specter/lib/FileBrowser.cpp | 88 +++---- specter/lib/FontCache.cpp | 52 ++--- specter/lib/Icon.cpp | 8 +- specter/lib/Menu.cpp | 10 +- specter/lib/MessageWindow.cpp | 14 +- specter/lib/ModalWindow.cpp | 114 ++++----- specter/lib/MultiLineTextView.cpp | 18 +- specter/lib/PathButtons.cpp | 14 +- specter/lib/RootView.cpp | 16 +- specter/lib/ScrollView.cpp | 14 +- specter/lib/Space.cpp | 20 +- specter/lib/Specter.cpp | 6 - specter/lib/SplitView.cpp | 18 +- specter/lib/Table.cpp | 38 +-- specter/lib/TextField.cpp | 68 +++--- specter/lib/TextView.cpp | 26 +-- specter/lib/Toolbar.cpp | 16 +- specter/lib/Tooltip.cpp | 10 +- specter/lib/Translator.cpp | 22 +- specter/lib/View.cpp | 12 +- specter/lib/ViewResources.cpp | 10 +- specter/lib/specter.cpp | 6 + specter/resources/fonts/CMakeLists.txt | 2 +- specter/zeus | 2 +- 59 files changed, 744 insertions(+), 744 deletions(-) delete mode 100644 specter/include/Specter/ViewResources.hpp rename specter/include/{Specter => specter}/Button.hpp (86%) rename specter/include/{Specter => specter}/Control.hpp (93%) rename specter/include/{Specter => specter}/DeferredWindowEvents.hpp (99%) rename specter/include/{Specter => specter}/FileBrowser.hpp (87%) rename specter/include/{Specter => specter}/FontCache.hpp (88%) rename specter/include/{Specter => specter}/IMenuNode.hpp (96%) rename specter/include/{Specter => specter}/IViewManager.hpp (71%) rename specter/include/{Specter => specter}/Icon.hpp (96%) rename specter/include/{Specter => specter}/Menu.hpp (99%) rename specter/include/{Specter => specter}/MessageWindow.hpp (96%) rename specter/include/{Specter => specter}/ModalWindow.hpp (85%) rename specter/include/{Specter => specter}/MultiLineTextView.hpp (86%) rename specter/include/{Specter => specter}/Node.hpp (100%) rename specter/include/{Specter => specter}/NodeSocket.hpp (100%) rename specter/include/{Specter => specter}/NumericField.hpp (96%) rename specter/include/{Specter => specter}/Outliner.hpp (96%) rename specter/include/{Specter => specter}/Panel.hpp (100%) rename specter/include/{Specter => specter}/PathButtons.hpp (90%) rename specter/include/{Specter => specter}/RootView.hpp (99%) rename specter/include/{Specter => specter}/ScrollView.hpp (97%) rename specter/include/{Specter => specter}/Space.hpp (94%) rename specter/include/{Specter => specter}/SplitView.hpp (97%) rename specter/include/{Specter => specter}/Table.hpp (98%) rename specter/include/{Specter => specter}/TextField.hpp (98%) rename specter/include/{Specter => specter}/TextView.hpp (88%) rename specter/include/{Specter => specter}/Toolbar.hpp (94%) rename specter/include/{Specter => specter}/Tooltip.hpp (91%) rename specter/include/{Specter => specter}/Translator.hpp (78%) rename specter/include/{Specter => specter}/View.hpp (95%) create mode 100644 specter/include/specter/ViewResources.hpp rename specter/include/{Specter/Specter.hpp => specter/specter.hpp} (100%) delete mode 100644 specter/lib/Specter.cpp create mode 100644 specter/lib/specter.cpp diff --git a/specter/CMakeLists.txt b/specter/CMakeLists.txt index 8cd1aa62b..7c611a6a5 100644 --- a/specter/CMakeLists.txt +++ b/specter/CMakeLists.txt @@ -1,7 +1,7 @@ add_subdirectory(freetype2) add_definitions("-DZE_ATHENA_TYPES=1") -add_subdirectory(MathLib) -set(MATHLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/MathLib/include) +add_subdirectory(zeus) +set(ZEUS_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zeus/include) if(NOT DEFINED HECL_INCLUDE_DIR) message(FATAL_ERROR "Specter may only be built as a sub-project containing hecl with @@ -18,55 +18,55 @@ if(NOT DEFINED ATHENA_INCLUDE_DIR) ATHENA_INCLUDE_DIR set") endif() -if(NOT DEFINED LOG_VISOR_INCLUDE_DIR) - message(FATAL_ERROR "Specter may only be built as a sub-project containing LogVisor with - LOG_VISOR_INCLUDE_DIR set") +if(NOT DEFINED LOGVISOR_INCLUDE_DIR) + message(FATAL_ERROR "Specter may only be built as a sub-project containing logvisor with + LOGVISOR_INCLUDE_DIR set") endif() add_subdirectory(resources/fonts) include_directories(include ${HECL_INCLUDE_DIR} ${BOO_INCLUDE_DIR} - ${LOG_VISOR_INCLUDE_DIR} ${ATHENA_INCLUDE_DIR} + ${LOGVISOR_INCLUDE_DIR} ${ATHENA_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/freetype2/include - ${MATHLIB_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) + ${ZEUS_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) list(APPEND SPECTER_HEADERS - include/Specter/Specter.hpp - include/Specter/ViewResources.hpp - include/Specter/IViewManager.hpp - include/Specter/DeferredWindowEvents.hpp - include/Specter/View.hpp - include/Specter/RootView.hpp - include/Specter/ModalWindow.hpp - include/Specter/MessageWindow.hpp - include/Specter/Tooltip.hpp - include/Specter/SplitView.hpp - include/Specter/ScrollView.hpp - include/Specter/TextView.hpp - include/Specter/MultiLineTextView.hpp - include/Specter/Space.hpp - include/Specter/Toolbar.hpp - include/Specter/Table.hpp - include/Specter/Outliner.hpp - include/Specter/Panel.hpp - include/Specter/Control.hpp - include/Specter/Button.hpp - include/Specter/TextField.hpp - include/Specter/NumericField.hpp - include/Specter/Menu.hpp - include/Specter/IMenuNode.hpp - include/Specter/Node.hpp - include/Specter/NodeSocket.hpp - include/Specter/PathButtons.hpp - include/Specter/FileBrowser.hpp - include/Specter/Icon.hpp - include/Specter/FontCache.hpp - include/Specter/Translator.hpp) + include/specter/specter.hpp + include/specter/ViewResources.hpp + include/specter/IViewManager.hpp + include/specter/DeferredWindowEvents.hpp + include/specter/View.hpp + include/specter/RootView.hpp + include/specter/ModalWindow.hpp + include/specter/MessageWindow.hpp + include/specter/Tooltip.hpp + include/specter/SplitView.hpp + include/specter/ScrollView.hpp + include/specter/TextView.hpp + include/specter/MultiLineTextView.hpp + include/specter/Space.hpp + include/specter/Toolbar.hpp + include/specter/Table.hpp + include/specter/Outliner.hpp + include/specter/Panel.hpp + include/specter/Control.hpp + include/specter/Button.hpp + include/specter/TextField.hpp + include/specter/NumericField.hpp + include/specter/Menu.hpp + include/specter/IMenuNode.hpp + include/specter/Node.hpp + include/specter/NodeSocket.hpp + include/specter/PathButtons.hpp + include/specter/FileBrowser.hpp + include/specter/Icon.hpp + include/specter/FontCache.hpp + include/specter/Translator.hpp) -atdna(atdna_FontCache.cpp include/Specter/FontCache.hpp) +atdna(atdna_FontCache.cpp include/specter/FontCache.hpp) list(APPEND SPECTER_SOURCES - lib/Specter.cpp + lib/specter.cpp lib/ViewResources.cpp lib/View.cpp lib/RootView.cpp @@ -96,4 +96,4 @@ list(APPEND SPECTER_SOURCES lib/Translator.cpp atdna_FontCache.cpp) -add_library(Specter ${SPECTER_SOURCES} ${SPECTER_HEADERS}) +add_library(specter ${SPECTER_SOURCES} ${SPECTER_HEADERS}) diff --git a/specter/include/Specter/ViewResources.hpp b/specter/include/Specter/ViewResources.hpp deleted file mode 100644 index e75e61233..000000000 --- a/specter/include/Specter/ViewResources.hpp +++ /dev/null @@ -1,220 +0,0 @@ -#ifndef SPECTER_VIEWRESOURCES_HPP -#define SPECTER_VIEWRESOURCES_HPP - -#include "TextView.hpp" -#include "SplitView.hpp" -#include "Toolbar.hpp" -#include "Button.hpp" - -#include - -namespace Specter -{ -class IThemeData -{ -public: - virtual const Zeus::CColor& uiText() const=0; - virtual const Zeus::CColor& uiAltText() const=0; - virtual const Zeus::CColor& fieldText() const=0; - virtual const Zeus::CColor& fieldMarkedText() const=0; - virtual const Zeus::CColor& selectedFieldText() const=0; - - virtual const Zeus::CColor& viewportBackground() const=0; - virtual const Zeus::CColor& toolbarBackground() const=0; - virtual const Zeus::CColor& tooltipBackground() const=0; - virtual const Zeus::CColor& spaceBackground() const=0; - virtual const Zeus::CColor& splashBackground() const=0; - virtual const Zeus::CColor& splashErrorBackground() const=0; - - virtual const Zeus::CColor& splash1() const=0; - virtual const Zeus::CColor& splash2() const=0; - - virtual const Zeus::CColor& button1Inactive() const=0; - virtual const Zeus::CColor& button2Inactive() const=0; - virtual const Zeus::CColor& button1Hover() const=0; - virtual const Zeus::CColor& button2Hover() const=0; - virtual const Zeus::CColor& button1Press() const=0; - virtual const Zeus::CColor& button2Press() const=0; - virtual const Zeus::CColor& button1Disabled() const=0; - virtual const Zeus::CColor& button2Disabled() const=0; - - virtual const Zeus::CColor& textfield1Inactive() const=0; - virtual const Zeus::CColor& textfield2Inactive() const=0; - virtual const Zeus::CColor& textfield1Hover() const=0; - virtual const Zeus::CColor& textfield2Hover() const=0; - virtual const Zeus::CColor& textfield1Disabled() const=0; - virtual const Zeus::CColor& textfield2Disabled() const=0; - virtual const Zeus::CColor& textfieldSelection() const=0; - virtual const Zeus::CColor& textfieldMarkSelection() const=0; - - virtual const Zeus::CColor& tableCellBg1() const=0; - virtual const Zeus::CColor& tableCellBg2() const=0; - virtual const Zeus::CColor& tableCellBgSelected() const=0; - - virtual const Zeus::CColor& scrollIndicator() const=0; - - virtual const Zeus::CColor& spaceTriangleShading1() const=0; - virtual const Zeus::CColor& spaceTriangleShading2() const=0; -}; - -class DefaultThemeData : public IThemeData -{ - Zeus::CColor m_uiText = Zeus::CColor::skWhite; - Zeus::CColor m_uiAltText = Zeus::CColor::skGrey; - Zeus::CColor m_fieldText = Zeus::CColor::skBlack; - Zeus::CColor m_fieldMarkedText = {0.25, 0.25, 0.25, 1.0}; - Zeus::CColor m_selectedFieldText = Zeus::CColor::skWhite; - - Zeus::CColor m_vpBg = {0.2, 0.2, 0.2, 1.0}; - Zeus::CColor m_tbBg = {0.2, 0.2, 0.2, 0.9}; - Zeus::CColor m_tooltipBg = {0.1, 0.1, 0.1, 0.85}; - Zeus::CColor m_spaceBg = {0.075, 0.075, 0.075, 0.85}; - Zeus::CColor m_splashBg = {0.075, 0.075, 0.075, 0.85}; - Zeus::CColor m_splashErrorBg = {0.1, 0.01, 0.01, 0.85}; - - Zeus::CColor m_splash1 = {1.0, 1.0, 1.0, 1.0}; - Zeus::CColor m_splash2 = {0.3, 0.3, 0.3, 1.0}; - - Zeus::CColor m_button1Inactive = {0.2823, 0.2823, 0.2823, 1.0}; - Zeus::CColor m_button2Inactive = {0.1725, 0.1725, 0.1725, 1.0}; - Zeus::CColor m_button1Hover = {0.3523, 0.3523, 0.3523, 1.0}; - Zeus::CColor m_button2Hover = {0.2425, 0.2425, 0.2425, 1.0}; - Zeus::CColor m_button1Press = {0.1725, 0.1725, 0.1725, 1.0}; - Zeus::CColor m_button2Press = {0.2823, 0.2823, 0.2823, 1.0}; - Zeus::CColor m_button1Disabled = {0.2823, 0.2823, 0.2823, 0.5}; - Zeus::CColor m_button2Disabled = {0.1725, 0.1725, 0.1725, 0.5}; - - Zeus::CColor m_textfield2Inactive = {0.7823, 0.7823, 0.7823, 1.0}; - Zeus::CColor m_textfield1Inactive = {0.5725, 0.5725, 0.5725, 1.0}; - Zeus::CColor m_textfield2Hover = {0.8523, 0.8523, 0.8523, 1.0}; - Zeus::CColor m_textfield1Hover = {0.6425, 0.6425, 0.6425, 1.0}; - Zeus::CColor m_textfield2Disabled = {0.7823, 0.7823, 0.7823, 0.5}; - Zeus::CColor m_textfield1Disabled = {0.5725, 0.5725, 0.5725, 0.5}; - Zeus::CColor m_textfieldSelection = {0.2725, 0.2725, 0.2725, 1.0}; - Zeus::CColor m_textfieldMarkSelection = {1.0, 1.0, 0.2725, 1.0}; - - Zeus::CColor m_tableCellBg1 = {0.1725, 0.1725, 0.1725, 0.75}; - Zeus::CColor m_tableCellBg2 = {0.2425, 0.2425, 0.2425, 0.75}; - Zeus::CColor m_tableCellBgSelected = {0.6425, 0.6425, 0.6425, 1.0}; - - Zeus::CColor m_scrollIndicator = {0.2823, 0.2823, 0.2823, 1.0}; - - Zeus::CColor m_spaceTriangleShading1 = {0.6425, 0.6425, 0.6425, 1.0}; - Zeus::CColor m_spaceTriangleShading2 = {0.5725, 0.5725, 0.5725, 1.0}; - -public: - virtual const Zeus::CColor& uiText() const {return m_uiText;} - virtual const Zeus::CColor& uiAltText() const {return m_uiAltText;} - virtual const Zeus::CColor& fieldText() const {return m_fieldText;} - virtual const Zeus::CColor& fieldMarkedText() const {return m_fieldMarkedText;} - virtual const Zeus::CColor& selectedFieldText() const {return m_selectedFieldText;} - - virtual const Zeus::CColor& viewportBackground() const {return m_vpBg;} - virtual const Zeus::CColor& toolbarBackground() const {return m_tbBg;} - virtual const Zeus::CColor& tooltipBackground() const {return m_tooltipBg;} - virtual const Zeus::CColor& spaceBackground() const {return m_spaceBg;} - virtual const Zeus::CColor& splashBackground() const {return m_splashBg;} - virtual const Zeus::CColor& splashErrorBackground() const {return m_splashErrorBg;} - - virtual const Zeus::CColor& splash1() const {return m_splash1;} - virtual const Zeus::CColor& splash2() const {return m_splash2;} - - virtual const Zeus::CColor& button1Inactive() const {return m_button1Inactive;} - virtual const Zeus::CColor& button2Inactive() const {return m_button2Inactive;} - virtual const Zeus::CColor& button1Hover() const {return m_button1Hover;} - virtual const Zeus::CColor& button2Hover() const {return m_button2Hover;} - virtual const Zeus::CColor& button1Press() const {return m_button1Press;} - virtual const Zeus::CColor& button2Press() const {return m_button2Press;} - virtual const Zeus::CColor& button1Disabled() const {return m_button1Disabled;} - virtual const Zeus::CColor& button2Disabled() const {return m_button2Disabled;} - - virtual const Zeus::CColor& textfield1Inactive() const {return m_textfield1Inactive;} - virtual const Zeus::CColor& textfield2Inactive() const {return m_textfield2Inactive;} - virtual const Zeus::CColor& textfield1Hover() const {return m_textfield1Hover;} - virtual const Zeus::CColor& textfield2Hover() const {return m_textfield2Hover;} - virtual const Zeus::CColor& textfield1Disabled() const {return m_textfield1Disabled;} - virtual const Zeus::CColor& textfield2Disabled() const {return m_textfield2Disabled;} - virtual const Zeus::CColor& textfieldSelection() const {return m_textfieldSelection;} - virtual const Zeus::CColor& textfieldMarkSelection() const {return m_textfieldMarkSelection;} - - virtual const Zeus::CColor& tableCellBg1() const {return m_tableCellBg1;} - virtual const Zeus::CColor& tableCellBg2() const {return m_tableCellBg2;} - virtual const Zeus::CColor& tableCellBgSelected() const {return m_tableCellBgSelected;} - - virtual const Zeus::CColor& scrollIndicator() const {return m_scrollIndicator;} - - virtual const Zeus::CColor& spaceTriangleShading1() const {return m_spaceTriangleShading1;} - virtual const Zeus::CColor& spaceTriangleShading2() const {return m_spaceTriangleShading2;} -}; - -class ViewResources -{ - template - void init(Factory* factory, const IThemeData& theme, FontCache* fcache) - { - m_viewRes.init(factory, theme); - m_textRes.init(factory, fcache); - m_splitRes.init(factory, theme); - m_toolbarRes.init(factory, theme); - m_buttonRes.init(factory, theme); - } - -public: - boo::IGraphicsDataFactory* m_factory = nullptr; - FontCache* m_fcache = nullptr; - View::Resources m_viewRes; - TextView::Resources m_textRes; - SplitView::Resources m_splitRes; - Toolbar::Resources m_toolbarRes; - Button::Resources m_buttonRes; - boo::GraphicsDataToken m_resData; - - Specter::FontTag m_mainFont; - Specter::FontTag m_monoFont; - - Specter::FontTag m_heading14; - Specter::FontTag m_heading18; - - Specter::FontTag m_titleFont; - Specter::FontTag m_curveFont; - - std::thread m_fcacheThread; - bool m_fcacheInterrupt = false; - bool m_fcacheReady = false; - - ViewResources() = default; - ViewResources(const ViewResources& other) = delete; - ViewResources(ViewResources&& other) = default; - ViewResources& operator=(const ViewResources& other) = delete; - ViewResources& operator=(ViewResources&& other) = default; - - void destroyResData() - { - m_resData.doDestroy(); - } - - ~ViewResources() - { - if (m_fcacheThread.joinable()) - { - m_fcacheInterrupt = true; - m_fcacheThread.join(); - } - } - - void init(boo::IGraphicsDataFactory* factory, FontCache* fcache, const IThemeData* theme, float pixelFactor); - void prepFontCacheSync(); - void prepFontCacheAsync(boo::IWindow* window); - bool fontCacheReady() const {return m_fcacheReady;} - void resetPixelFactor(float pixelFactor); - void resetTheme(const IThemeData* theme); - - float m_pixelFactor = 0; - float pixelFactor() const {return m_pixelFactor;} - - const IThemeData* m_theme; - const IThemeData& themeData() const {return *m_theme;} -}; -} - -#endif // SPECTER_VIEWRESOURCES_HPP diff --git a/specter/include/Specter/Button.hpp b/specter/include/specter/Button.hpp similarity index 86% rename from specter/include/Specter/Button.hpp rename to specter/include/specter/Button.hpp index 53fcdb880..3b122bc3f 100644 --- a/specter/include/Specter/Button.hpp +++ b/specter/include/specter/Button.hpp @@ -1,11 +1,11 @@ #ifndef SPECTER_BUTTON_HPP #define SPECTER_BUTTON_HPP -#include "Specter/TextView.hpp" -#include "Specter/Control.hpp" -#include "Specter/Icon.hpp" +#include "specter/TextView.hpp" +#include "specter/Control.hpp" +#include "specter/Icon.hpp" -namespace Specter +namespace specter { class Button : public Control @@ -20,8 +20,8 @@ public: private: Style m_style; IButtonBinding::MenuStyle m_menuStyle = IButtonBinding::MenuStyle::None; - Zeus::CColor m_textColor; - Zeus::CColor m_bgColor; + zeus::CColor m_textColor; + zeus::CColor m_bgColor; std::string m_textStr; std::unique_ptr m_text; std::unique_ptr m_icon; @@ -87,11 +87,11 @@ public: ~Button() {closeMenu({});} Button(ViewResources& res, View& parentView, IButtonBinding* controlBinding, const std::string& text, Icon* icon=nullptr, - Style style=Style::Block, const Zeus::CColor& bgColor=Zeus::CColor::skWhite, + Style style=Style::Block, const zeus::CColor& bgColor=zeus::CColor::skWhite, RectangleConstraint constraint=RectangleConstraint()); Button(ViewResources& res, View& parentView, - IButtonBinding* controlBinding, const std::string& text, const Zeus::CColor& textColor, - Icon* icon=nullptr, Style style=Style::Block, const Zeus::CColor& bgColor=Zeus::CColor::skWhite, + IButtonBinding* controlBinding, const std::string& text, const zeus::CColor& textColor, + Icon* icon=nullptr, Style style=Style::Block, const zeus::CColor& bgColor=zeus::CColor::skWhite, RectangleConstraint constraint=RectangleConstraint()); void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey); void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey); @@ -101,18 +101,18 @@ public: void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub); void draw(boo::IGraphicsCommandQueue* gfxQ); - void setText(const std::string& text, const Zeus::CColor& textColor); + void setText(const std::string& text, const zeus::CColor& textColor); void setText(const std::string& text); void setIcon(Icon* icon=nullptr); const std::string& getText() const {return m_textStr;} - void colorGlyphs(const Zeus::CColor& newColor); + void colorGlyphs(const zeus::CColor& newColor); int nominalWidth() const {return m_nomWidth;} int nominalHeight() const {return m_nomHeight;} void closeMenu(const boo::SWindowCoord& coord); ViewChild>& getMenu() {return m_modalMenu;} - void setMultiplyColor(const Zeus::CColor& color) + void setMultiplyColor(const zeus::CColor& color) { View::setMultiplyColor(color); m_viewVertBlock.m_color = color; diff --git a/specter/include/Specter/Control.hpp b/specter/include/specter/Control.hpp similarity index 93% rename from specter/include/Specter/Control.hpp rename to specter/include/specter/Control.hpp index 38c081187..eb3a1eb00 100644 --- a/specter/include/Specter/Control.hpp +++ b/specter/include/specter/Control.hpp @@ -3,7 +3,7 @@ #include "View.hpp" -namespace Specter +namespace specter { class Control; class Button; @@ -35,10 +35,10 @@ struct IButtonBinding : IControlBinding }; /** Informs button which MenuStyle to present to user */ - virtual MenuStyle menuStyle(const Specter::Button* button) const {return MenuStyle::None;} + virtual MenuStyle menuStyle(const specter::Button* button) const {return MenuStyle::None;} /** Called when user requests menu, Button assumes modal ownership */ - virtual std::unique_ptr buildMenu(const Specter::Button* button) {return std::unique_ptr();} + virtual std::unique_ptr buildMenu(const specter::Button* button) {return std::unique_ptr();} }; struct IFloatBinding : IControlBinding @@ -63,8 +63,8 @@ struct IStringBinding : IControlBinding struct CVarControlBinding : IControlBinding { - HECL::CVar* m_cvar; - CVarControlBinding(HECL::CVar* cvar) + hecl::CVar* m_cvar; + CVarControlBinding(hecl::CVar* cvar) : m_cvar(cvar) {} const char* name(const Control* control) const {return m_cvar->name().c_str();} const char* help(const Control* control) const {return m_cvar->rawHelp().c_str();} diff --git a/specter/include/Specter/DeferredWindowEvents.hpp b/specter/include/specter/DeferredWindowEvents.hpp similarity index 99% rename from specter/include/Specter/DeferredWindowEvents.hpp rename to specter/include/specter/DeferredWindowEvents.hpp index cc91e7586..b352ea35d 100644 --- a/specter/include/Specter/DeferredWindowEvents.hpp +++ b/specter/include/specter/DeferredWindowEvents.hpp @@ -5,7 +5,7 @@ #include #include -namespace Specter +namespace specter { template diff --git a/specter/include/Specter/FileBrowser.hpp b/specter/include/specter/FileBrowser.hpp similarity index 87% rename from specter/include/Specter/FileBrowser.hpp rename to specter/include/specter/FileBrowser.hpp index 66ff8d54e..9acd7a6fd 100644 --- a/specter/include/Specter/FileBrowser.hpp +++ b/specter/include/specter/FileBrowser.hpp @@ -11,9 +11,9 @@ #include "IViewManager.hpp" #include "MessageWindow.hpp" #include "PathButtons.hpp" -#include +#include -namespace Specter +namespace specter { class FileBrowser : public ModalWindow, public IPathButtonsBinding @@ -30,8 +30,8 @@ public: }; private: Type m_type; - HECL::SystemString m_path; - std::vector m_comps; + hecl::SystemString m_path; + std::vector m_comps; bool m_showingHidden = false; class LeftSide : public View @@ -63,7 +63,7 @@ private: OKButton(FileBrowser& fb, ViewResources& res, const std::string& text) : m_fb(fb), m_text(text) { - m_button.m_view.reset(new Button(res, fb, this, text, nullptr, Button::Style::Block, Zeus::CColor::skWhite, + m_button.m_view.reset(new Button(res, fb, this, text, nullptr, Button::Style::Block, zeus::CColor::skWhite, RectangleConstraint(100 * res.pixelFactor(), -1, RectangleConstraint::Test::Minimum))); } const char* name(const Control* control) const {return m_text.c_str();} @@ -79,7 +79,7 @@ private: CancelButton(FileBrowser& fb, ViewResources& res, const std::string& text) : m_fb(fb), m_text(text) { - m_button.m_view.reset(new Button(res, fb, this, text, nullptr, Button::Style::Block, Zeus::CColor::skWhite, + m_button.m_view.reset(new Button(res, fb, this, text, nullptr, Button::Style::Block, zeus::CColor::skWhite, RectangleConstraint(m_fb.m_ok.m_button.m_view->nominalWidth(), -1, RectangleConstraint::Test::Minimum))); } const char* name(const Control* control) const {return m_text.c_str();} @@ -110,7 +110,7 @@ private: struct Entry { - HECL::SystemString m_path; + hecl::SystemString m_path; std::string m_name; std::string m_type; std::string m_size; @@ -172,21 +172,21 @@ private: m_columnSplits[cIdx] = split; } - void updateListing(const HECL::DirectoryEnumerator& dEnum) + void updateListing(const hecl::DirectoryEnumerator& dEnum) { m_entries.clear(); m_entries.reserve(dEnum.size()); - for (const HECL::DirectoryEnumerator::Entry& d : dEnum) + for (const hecl::DirectoryEnumerator::Entry& d : dEnum) { m_entries.emplace_back(); Entry& ent = m_entries.back(); ent.m_path = d.m_path; - HECL::SystemUTF8View nameUtf8(d.m_name); + hecl::SystemUTF8View nameUtf8(d.m_name); ent.m_name = nameUtf8.str(); if (d.m_isDir) { - if (HECL::SearchForProject(d.m_path)) + if (hecl::SearchForProject(d.m_path)) ent.m_type = m_projStr; else ent.m_type = m_dirStr; @@ -194,8 +194,8 @@ private: else { ent.m_type = m_fileStr; - ent.m_size = HECL::HumanizeNumber(d.m_fileSz, 7, nullptr, int(HECL::HNScale::AutoScale), - HECL::HNFlags::B | HECL::HNFlags::Decimal); + ent.m_size = hecl::HumanizeNumber(d.m_fileSz, 7, nullptr, int(hecl::HNScale::AutoScale), + hecl::HNFlags::B | hecl::HNFlags::Decimal); } } @@ -256,16 +256,16 @@ private: struct Entry { - HECL::SystemString m_path; + hecl::SystemString m_path; std::string m_name; - Entry(std::pair&& path) + Entry(std::pair&& path) : m_path(std::move(path.first)), m_name(std::move(path.second)) {} - Entry(const HECL::SystemString& path) + Entry(const hecl::SystemString& path) : m_path(path) { - HECL::SystemUTF8View utf8(path); + hecl::SystemUTF8View utf8(path); if (utf8.str().size() == 1 && utf8.str()[0] == '/') { m_name = "/"; @@ -307,21 +307,21 @@ private: std::unique_ptr m_recentBookmarksLabel; ViewChild> m_recentBookmarks; - std::function m_returnFunc; + std::function m_returnFunc; public: FileBrowser(ViewResources& res, View& parentView, const std::string& title, Type type, - std::function returnFunc) - : FileBrowser(res, parentView, title, type, HECL::GetcwdStr(), returnFunc) {} + std::function returnFunc) + : FileBrowser(res, parentView, title, type, hecl::GetcwdStr(), returnFunc) {} FileBrowser(ViewResources& res, View& parentView, const std::string& title, Type type, - const HECL::SystemString& initialPath, - std::function returnFunc); + const hecl::SystemString& initialPath, + std::function returnFunc); - static std::vector PathComponents(const HECL::SystemString& path); + static std::vector PathComponents(const hecl::SystemString& path); static void SyncBookmarkSelections(Table& table, BookmarkDataBind& binding, - const HECL::SystemString& sel); + const hecl::SystemString& sel); - void navigateToPath(const HECL::SystemString& path); + void navigateToPath(const hecl::SystemString& path); bool showingHidden() const {return m_showingHidden;} void setShowingHidden(bool showingHidden) { diff --git a/specter/include/Specter/FontCache.hpp b/specter/include/specter/FontCache.hpp similarity index 88% rename from specter/include/Specter/FontCache.hpp rename to specter/include/specter/FontCache.hpp index e39e998d8..dcd64eb49 100644 --- a/specter/include/Specter/FontCache.hpp +++ b/specter/include/specter/FontCache.hpp @@ -5,11 +5,11 @@ #include FT_FREETYPE_H #include -#include -#include -#include +#include +#include +#include -namespace Specter +namespace specter { class FontTag { @@ -26,14 +26,14 @@ public: namespace std { -template <> struct hash +template <> struct hash { - size_t operator() (const Specter::FontTag& handle) const NOEXCEPT + size_t operator() (const specter::FontTag& handle) const NOEXCEPT {return size_t(handle.hash());} }; } -namespace Specter +namespace specter { class FreeTypeGZipMemFace @@ -85,14 +85,14 @@ private: std::vector m_glyphs; std::unordered_map>> m_kernAdjs; - struct TT_KernHead : Athena::io::DNA + struct TT_KernHead : athena::io::DNA { DECL_DNA Value length; Value coverage; }; - struct TT_KernSubHead : Athena::io::DNA + struct TT_KernSubHead : athena::io::DNA { DECL_DNA Value nPairs; @@ -101,7 +101,7 @@ private: Value rangeShift; }; - struct TT_KernPair : Athena::io::DNA + struct TT_KernPair : athena::io::DNA { DECL_DNA Value left; @@ -115,9 +115,9 @@ private: public: FontAtlas(boo::IGraphicsDataFactory* gf, FT_Face face, uint32_t dpi, - bool subpixel, FCharFilter& filter, Athena::io::FileWriter& writer); + bool subpixel, FCharFilter& filter, athena::io::FileWriter& writer); FontAtlas(boo::IGraphicsDataFactory* gf, FT_Face face, uint32_t dpi, - bool subpixel, FCharFilter& filter, Athena::io::FileReader& reader); + bool subpixel, FCharFilter& filter, athena::io::FileReader& reader); FontAtlas(const FontAtlas& other) = delete; FontAtlas& operator=(const FontAtlas& other) = delete; @@ -153,8 +153,8 @@ extern const FCharFilter LatinAndJapaneseCharFilter; class FontCache { - const HECL::Runtime::FileStoreManager& m_fileMgr; - HECL::SystemString m_cacheRoot; + const hecl::Runtime::FileStoreManager& m_fileMgr; + hecl::SystemString m_cacheRoot; struct Library { FT_Library m_lib; @@ -168,7 +168,7 @@ class FontCache std::unordered_map> m_cachedAtlases; public: - FontCache(const HECL::Runtime::FileStoreManager& fileMgr); + FontCache(const hecl::Runtime::FileStoreManager& fileMgr); FontCache(const FontCache& other) = delete; FontCache& operator=(const FontCache& other) = delete; diff --git a/specter/include/Specter/IMenuNode.hpp b/specter/include/specter/IMenuNode.hpp similarity index 96% rename from specter/include/Specter/IMenuNode.hpp rename to specter/include/specter/IMenuNode.hpp index 05b7b48b7..b68bd51a3 100644 --- a/specter/include/Specter/IMenuNode.hpp +++ b/specter/include/specter/IMenuNode.hpp @@ -3,7 +3,7 @@ #include "View.hpp" -namespace Specter +namespace specter { struct IMenuNode diff --git a/specter/include/Specter/IViewManager.hpp b/specter/include/specter/IViewManager.hpp similarity index 71% rename from specter/include/Specter/IViewManager.hpp rename to specter/include/specter/IViewManager.hpp index 6e5d86227..ff76757df 100644 --- a/specter/include/Specter/IViewManager.hpp +++ b/specter/include/specter/IViewManager.hpp @@ -3,9 +3,9 @@ #include "Translator.hpp" #include "SplitView.hpp" -#include +#include -namespace Specter +namespace specter { struct ISpaceController; @@ -24,11 +24,11 @@ public: virtual void deferSpaceSplit(ISpaceController* split, SplitView::Axis axis, int thisSlot, const boo::SWindowCoord& coord) {} - virtual const std::vector* recentProjects() const {return nullptr;} - virtual void pushRecentProject(const HECL::SystemString& path) {} + virtual const std::vector* recentProjects() const {return nullptr;} + virtual void pushRecentProject(const hecl::SystemString& path) {} - virtual const std::vector* recentFiles() const {return nullptr;} - virtual void pushRecentFile(const HECL::SystemString& path) {} + virtual const std::vector* recentFiles() const {return nullptr;} + virtual void pushRecentFile(const hecl::SystemString& path) {} }; } diff --git a/specter/include/Specter/Icon.hpp b/specter/include/specter/Icon.hpp similarity index 96% rename from specter/include/Specter/Icon.hpp rename to specter/include/specter/Icon.hpp index 5b4bc373e..fb5329421 100644 --- a/specter/include/Specter/Icon.hpp +++ b/specter/include/specter/Icon.hpp @@ -3,13 +3,13 @@ #include "View.hpp" -namespace Specter +namespace specter { struct Icon { boo::ITexture* m_tex = nullptr; - Zeus::CVector2f m_uvCoords[4]; + zeus::CVector2f m_uvCoords[4]; Icon() = default; Icon(boo::ITexture* tex, float rect[4]) : m_tex(tex) diff --git a/specter/include/Specter/Menu.hpp b/specter/include/specter/Menu.hpp similarity index 99% rename from specter/include/Specter/Menu.hpp rename to specter/include/specter/Menu.hpp index 0847d5555..51c4c4fbc 100644 --- a/specter/include/Specter/Menu.hpp +++ b/specter/include/specter/Menu.hpp @@ -6,7 +6,7 @@ #include "ScrollView.hpp" #include "IMenuNode.hpp" -namespace Specter +namespace specter { class Menu : public View diff --git a/specter/include/Specter/MessageWindow.hpp b/specter/include/specter/MessageWindow.hpp similarity index 96% rename from specter/include/Specter/MessageWindow.hpp rename to specter/include/specter/MessageWindow.hpp index 780a7c0cc..0d31510e4 100644 --- a/specter/include/Specter/MessageWindow.hpp +++ b/specter/include/specter/MessageWindow.hpp @@ -5,7 +5,7 @@ #include "MultiLineTextView.hpp" #include "Button.hpp" -namespace Specter +namespace specter { class MessageWindow : public ModalWindow @@ -56,7 +56,7 @@ public: void updateContentOpacity(float opacity) { - Zeus::CColor color = Zeus::CColor::lerp({1,1,1,0}, {1,1,1,1}, opacity); + zeus::CColor color = zeus::CColor::lerp({1,1,1,0}, {1,1,1,1}, opacity); ModalWindow::setMultiplyColor(color); m_text->setMultiplyColor(color); m_ok.m_view->setMultiplyColor(color); diff --git a/specter/include/Specter/ModalWindow.hpp b/specter/include/specter/ModalWindow.hpp similarity index 85% rename from specter/include/Specter/ModalWindow.hpp rename to specter/include/specter/ModalWindow.hpp index 33d4d0a46..864050063 100644 --- a/specter/include/Specter/ModalWindow.hpp +++ b/specter/include/specter/ModalWindow.hpp @@ -1,10 +1,10 @@ #ifndef SPECTER_MODAL_WINDOW_HPP #define SPECTER_MODAL_WINDOW_HPP -#include -#include +#include +#include -namespace Specter +namespace specter { class ModalWindow : public View { @@ -29,11 +29,11 @@ private: int m_height = 0; RectangleConstraint m_constraint; - Zeus::CColor m_windowBg; - Zeus::CColor m_windowBgClear; - Zeus::CColor m_line1; - Zeus::CColor m_line2; - Zeus::CColor m_line2Clear; + zeus::CColor m_windowBg; + zeus::CColor m_windowBgClear; + zeus::CColor m_line1; + zeus::CColor m_line2; + zeus::CColor m_line2Clear; ViewBlock m_viewBlock; boo::IGraphicsBufferD* m_viewBlockBuf; @@ -62,7 +62,7 @@ protected: RectangleConstraint& constraint() {return m_constraint;} public: - ModalWindow(ViewResources& res, View& parentView, const RectangleConstraint& constraint, const Zeus::CColor& bgColor); + ModalWindow(ViewResources& res, View& parentView, const RectangleConstraint& constraint, const zeus::CColor& bgColor); ModalWindow(ViewResources& res, View& parentView, const RectangleConstraint& constraint); void think(); bool skipBuildInAnimation(); diff --git a/specter/include/Specter/MultiLineTextView.hpp b/specter/include/specter/MultiLineTextView.hpp similarity index 86% rename from specter/include/Specter/MultiLineTextView.hpp rename to specter/include/specter/MultiLineTextView.hpp index b6e859018..e8edee276 100644 --- a/specter/include/Specter/MultiLineTextView.hpp +++ b/specter/include/specter/MultiLineTextView.hpp @@ -5,7 +5,7 @@ #include "TextView.hpp" #include "FontCache.hpp" -namespace Specter +namespace specter { class MultiLineTextView : public View @@ -29,15 +29,15 @@ public: size_t lineCapacity=256, float lineHeight=1.0); void typesetGlyphs(const std::string& str, - const Zeus::CColor& defaultColor=Zeus::CColor::skWhite, + const zeus::CColor& defaultColor=zeus::CColor::skWhite, unsigned wrap=0); void typesetGlyphs(const std::wstring& str, - const Zeus::CColor& defaultColor=Zeus::CColor::skWhite, + const zeus::CColor& defaultColor=zeus::CColor::skWhite, unsigned wrap=0); - void colorGlyphs(const Zeus::CColor& newColor); + void colorGlyphs(const zeus::CColor& newColor); - void setMultiplyColor(const Zeus::CColor& color) + void setMultiplyColor(const zeus::CColor& color) { for (std::unique_ptr& l : m_lines) l->setMultiplyColor(color); diff --git a/specter/include/Specter/Node.hpp b/specter/include/specter/Node.hpp similarity index 100% rename from specter/include/Specter/Node.hpp rename to specter/include/specter/Node.hpp diff --git a/specter/include/Specter/NodeSocket.hpp b/specter/include/specter/NodeSocket.hpp similarity index 100% rename from specter/include/Specter/NodeSocket.hpp rename to specter/include/specter/NodeSocket.hpp diff --git a/specter/include/Specter/NumericField.hpp b/specter/include/specter/NumericField.hpp similarity index 96% rename from specter/include/Specter/NumericField.hpp rename to specter/include/specter/NumericField.hpp index c530a49e5..b3b051f9e 100644 --- a/specter/include/Specter/NumericField.hpp +++ b/specter/include/specter/NumericField.hpp @@ -1,9 +1,9 @@ #ifndef SPECTER_NUMERICFIELD_HPP #define SPECTER_NUMERICFIELD_HPP -#include "Specter/TextView.hpp" +#include "specter/TextView.hpp" -namespace Specter +namespace specter { class ViewResources; diff --git a/specter/include/Specter/Outliner.hpp b/specter/include/specter/Outliner.hpp similarity index 96% rename from specter/include/Specter/Outliner.hpp rename to specter/include/specter/Outliner.hpp index 4e914afad..21cbacb1c 100644 --- a/specter/include/Specter/Outliner.hpp +++ b/specter/include/specter/Outliner.hpp @@ -1,7 +1,7 @@ #ifndef SPECTER_OUTLINER_HPP #define SPECTER_OUTLINER_HPP -namespace Specter +namespace specter { class Outliner { diff --git a/specter/include/Specter/Panel.hpp b/specter/include/specter/Panel.hpp similarity index 100% rename from specter/include/Specter/Panel.hpp rename to specter/include/specter/Panel.hpp diff --git a/specter/include/Specter/PathButtons.hpp b/specter/include/specter/PathButtons.hpp similarity index 90% rename from specter/include/Specter/PathButtons.hpp rename to specter/include/specter/PathButtons.hpp index 54c4420c2..bf185c1e5 100644 --- a/specter/include/Specter/PathButtons.hpp +++ b/specter/include/specter/PathButtons.hpp @@ -4,7 +4,7 @@ #include "Button.hpp" #include "ScrollView.hpp" -namespace Specter +namespace specter { struct IPathButtonsBinding @@ -52,10 +52,10 @@ class PathButtons : public ScrollView PathButtons& m_pb; size_t m_idx; ViewChild> m_button; - PathButton(PathButtons& pb, ViewResources& res, size_t idx, const HECL::SystemString& str) + PathButton(PathButtons& pb, ViewResources& res, size_t idx, const hecl::SystemString& str) : m_pb(pb), m_idx(idx) { - m_button.m_view.reset(new Button(res, pb, this, HECL::SystemUTF8View(str).str())); + m_button.m_view.reset(new Button(res, pb, this, hecl::SystemUTF8View(str).str())); } const char* name(const Control* control) const {return m_button.m_view->getText().c_str();} void activated(const Button* button, const boo::SWindowCoord&) {m_pb.m_pathButtonPending = m_idx;} @@ -66,8 +66,8 @@ class PathButtons : public ScrollView public: PathButtons(ViewResources& res, View& parentView, IPathButtonsBinding& binding, bool fillContainer=false); - void setButtons(const std::vector& comps); - void setMultiplyColor(const Zeus::CColor& color); + void setButtons(const std::vector& comps); + void setMultiplyColor(const zeus::CColor& color); /* Fill all available space in container when requested */ void containerResized(const boo::SWindowRect& root, const boo::SWindowRect& sub); diff --git a/specter/include/Specter/RootView.hpp b/specter/include/specter/RootView.hpp similarity index 99% rename from specter/include/Specter/RootView.hpp rename to specter/include/specter/RootView.hpp index f63727f34..802535568 100644 --- a/specter/include/Specter/RootView.hpp +++ b/specter/include/specter/RootView.hpp @@ -13,7 +13,7 @@ #include "IViewManager.hpp" #include -namespace Specter +namespace specter { class RootView : public View diff --git a/specter/include/Specter/ScrollView.hpp b/specter/include/specter/ScrollView.hpp similarity index 97% rename from specter/include/Specter/ScrollView.hpp rename to specter/include/specter/ScrollView.hpp index 1244abf63..6f02dfbcc 100644 --- a/specter/include/Specter/ScrollView.hpp +++ b/specter/include/specter/ScrollView.hpp @@ -4,7 +4,7 @@ #include "Button.hpp" #include "IViewManager.hpp" -namespace Specter +namespace specter { class ViewResources; class Button; @@ -90,7 +90,7 @@ public: int nominalWidth() const {return subRect().size[0];} int nominalHeight() const {return subRect().size[1];} - void setMultiplyColor(const Zeus::CColor& color); + void setMultiplyColor(const zeus::CColor& color); void think(); void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub); diff --git a/specter/include/Specter/Space.hpp b/specter/include/specter/Space.hpp similarity index 94% rename from specter/include/Specter/Space.hpp rename to specter/include/specter/Space.hpp index 2f87fc27c..35d22ba13 100644 --- a/specter/include/Specter/Space.hpp +++ b/specter/include/specter/Space.hpp @@ -5,7 +5,7 @@ #include "Toolbar.hpp" #include "SplitView.hpp" -namespace Specter +namespace specter { class Space; struct ISplitSpaceController; @@ -39,7 +39,7 @@ class Space : public View Space& m_space; VertexBufferBinding m_vertexBinding; bool m_flip; - CornerView(ViewResources& res, Space& space, const Zeus::CColor& triColor); + CornerView(ViewResources& res, Space& space, const zeus::CColor& triColor); void mouseEnter(const boo::SWindowCoord&); void mouseLeave(const boo::SWindowCoord&); void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey); @@ -65,7 +65,7 @@ public: SplitView* findSplitViewOnSide(SplitView::Axis axis, int side); - void setMultiplyColor(const Zeus::CColor& color) + void setMultiplyColor(const zeus::CColor& color) { View::setMultiplyColor(color); if (m_contentView.m_view) diff --git a/specter/include/Specter/SplitView.hpp b/specter/include/specter/SplitView.hpp similarity index 97% rename from specter/include/Specter/SplitView.hpp rename to specter/include/specter/SplitView.hpp index 2bc987e06..0c8aef551 100644 --- a/specter/include/Specter/SplitView.hpp +++ b/specter/include/specter/SplitView.hpp @@ -1,9 +1,9 @@ #ifndef SPECTER_SPLITVIEW_HPP #define SPECTER_SPLITVIEW_HPP -#include "Specter/View.hpp" +#include "specter/View.hpp" -namespace Specter +namespace specter { struct ISplitSpaceController; @@ -100,7 +100,7 @@ public: void resized(const boo::SWindowRect& rootView, const boo::SWindowRect& sub); void draw(boo::IGraphicsCommandQueue* gfxQ); - void setMultiplyColor(const Zeus::CColor& color) + void setMultiplyColor(const zeus::CColor& color) { View::setMultiplyColor(color); m_splitBlock.m_color = color; diff --git a/specter/include/Specter/Table.hpp b/specter/include/specter/Table.hpp similarity index 98% rename from specter/include/Specter/Table.hpp rename to specter/include/specter/Table.hpp index 1c8fb4ca9..79f3f6db1 100644 --- a/specter/include/Specter/Table.hpp +++ b/specter/include/specter/Table.hpp @@ -6,7 +6,7 @@ #include "TextView.hpp" #include -namespace Specter +namespace specter { #define SPECTER_TABLE_MAX_ROWS 128ul @@ -125,7 +125,7 @@ public: void cycleSortColumn(size_t c); void selectRow(size_t r); - void setMultiplyColor(const Zeus::CColor& color); + void setMultiplyColor(const zeus::CColor& color); void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey); void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey); diff --git a/specter/include/Specter/TextField.hpp b/specter/include/specter/TextField.hpp similarity index 98% rename from specter/include/Specter/TextField.hpp rename to specter/include/specter/TextField.hpp index 1b540a75c..691c11212 100644 --- a/specter/include/Specter/TextField.hpp +++ b/specter/include/specter/TextField.hpp @@ -5,7 +5,7 @@ #include "TextView.hpp" #include -namespace Specter +namespace specter { class TextField : public ITextInputView @@ -113,7 +113,7 @@ public: void setSelectionRange(size_t start, size_t count); void clearSelectionRange(); - void setMultiplyColor(const Zeus::CColor& color) + void setMultiplyColor(const zeus::CColor& color) { View::setMultiplyColor(color); m_viewVertBlock.m_color = color; diff --git a/specter/include/Specter/TextView.hpp b/specter/include/specter/TextView.hpp similarity index 88% rename from specter/include/Specter/TextView.hpp rename to specter/include/specter/TextView.hpp index 3571506f8..4a7612b91 100644 --- a/specter/include/Specter/TextView.hpp +++ b/specter/include/specter/TextView.hpp @@ -9,7 +9,7 @@ #include "FontCache.hpp" -namespace Specter +namespace specter { class ViewResources; @@ -64,12 +64,12 @@ public: struct RenderGlyph { - Zeus::CVector3f m_pos[4]; - Zeus::CMatrix4f m_mv; - Zeus::CVector3f m_uv[4]; - Zeus::CColor m_color; + zeus::CVector3f m_pos[4]; + zeus::CMatrix4f m_mv; + zeus::CVector3f m_uv[4]; + zeus::CColor m_color; - RenderGlyph(int& adv, const FontAtlas::Glyph& glyph, const Zeus::CColor& defaultColor); + RenderGlyph(int& adv, const FontAtlas::Glyph& glyph, const zeus::CColor& defaultColor); }; struct RenderGlyphInfo { @@ -86,12 +86,12 @@ public: void updateGlyphs() {m_valid = false;} void typesetGlyphs(const std::string& str, - const Zeus::CColor& defaultColor=Zeus::CColor::skWhite); + const zeus::CColor& defaultColor=zeus::CColor::skWhite); void typesetGlyphs(const std::wstring& str, - const Zeus::CColor& defaultColor=Zeus::CColor::skWhite); + const zeus::CColor& defaultColor=zeus::CColor::skWhite); - void colorGlyphs(const Zeus::CColor& newColor); - void colorGlyphsTypeOn(const Zeus::CColor& newColor, float startInterval=0.2, float fadeTime=0.5); + void colorGlyphs(const zeus::CColor& newColor); + void colorGlyphsTypeOn(const zeus::CColor& newColor, float startInterval=0.2, float fadeTime=0.5); void think(); void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub); diff --git a/specter/include/Specter/Toolbar.hpp b/specter/include/specter/Toolbar.hpp similarity index 94% rename from specter/include/Specter/Toolbar.hpp rename to specter/include/specter/Toolbar.hpp index 1ae5ff003..764441537 100644 --- a/specter/include/Specter/Toolbar.hpp +++ b/specter/include/specter/Toolbar.hpp @@ -1,9 +1,9 @@ #ifndef SPECTER_TOOLBAR_HPP #define SPECTER_TOOLBAR_HPP -#include "Specter/View.hpp" +#include "specter/View.hpp" -namespace Specter +namespace specter { #define SPECTER_TOOLBAR_GAUGE 28 @@ -63,7 +63,7 @@ public: } void push_back(View* v, unsigned unit); - void setMultiplyColor(const Zeus::CColor& color) + void setMultiplyColor(const zeus::CColor& color) { View::setMultiplyColor(color); for (std::vector>& u : m_children) diff --git a/specter/include/Specter/Tooltip.hpp b/specter/include/specter/Tooltip.hpp similarity index 91% rename from specter/include/Specter/Tooltip.hpp rename to specter/include/specter/Tooltip.hpp index 6cab426e5..38768456d 100644 --- a/specter/include/Specter/Tooltip.hpp +++ b/specter/include/specter/Tooltip.hpp @@ -1,10 +1,10 @@ #ifndef SPECTER_TOOLTIP_HPP #define SPECTER_TOOLTIP_HPP -#include "Specter/View.hpp" -#include "Specter/MultiLineTextView.hpp" +#include "specter/View.hpp" +#include "specter/MultiLineTextView.hpp" -namespace Specter +namespace specter { class Tooltip : public View diff --git a/specter/include/Specter/Translator.hpp b/specter/include/specter/Translator.hpp similarity index 78% rename from specter/include/Specter/Translator.hpp rename to specter/include/specter/Translator.hpp index 369c92336..3b23c0466 100644 --- a/specter/include/Specter/Translator.hpp +++ b/specter/include/specter/Translator.hpp @@ -2,23 +2,23 @@ #define SPECTER_TRANSLATOR_HPP #include -#include +#include -namespace Specter +namespace specter { class Locale { std::string m_name; std::string m_fullName; - std::unique_ptr m_rootNode; - const Athena::io::YAMLNode* m_langNode; + std::unique_ptr m_rootNode; + const athena::io::YAMLNode* m_langNode; public: Locale(const std::string& name, const std::string& fullName, const unsigned char* yamlSource, size_t yamlLength); const std::string& name() const {return m_name;} const std::string& fullName() const {return m_fullName;} - const Athena::io::YAMLNode* rootNode() const {return m_langNode;} + const athena::io::YAMLNode* rootNode() const {return m_langNode;} }; class Translator diff --git a/specter/include/Specter/View.hpp b/specter/include/specter/View.hpp similarity index 95% rename from specter/include/Specter/View.hpp rename to specter/include/specter/View.hpp index 20c599566..99288e9f5 100644 --- a/specter/include/Specter/View.hpp +++ b/specter/include/specter/View.hpp @@ -2,18 +2,18 @@ #define SPECTER_VIEW_HPP #include -#include "CVector3f.hpp" -#include "CMatrix4f.hpp" -#include "CTransform.hpp" -#include "CColor.hpp" -#include "HECL/CVar.hpp" +#include "zeus/CVector3f.hpp" +#include "zeus/CMatrix4f.hpp" +#include "zeus/CTransform.hpp" +#include "zeus/CColor.hpp" +#include "hecl/CVar.hpp" #include #include #include #include -namespace Specter +namespace specter { class IThemeData; class ViewResources; @@ -83,13 +83,13 @@ class View public: struct SolidShaderVert { - Zeus::CVector3f m_pos; - Zeus::CColor m_color = Zeus::CColor::skClear; + zeus::CVector3f m_pos; + zeus::CColor m_color = zeus::CColor::skClear; }; struct TexShaderVert { - Zeus::CVector3f m_pos; - Zeus::CVector2f m_uv; + zeus::CVector3f m_pos; + zeus::CVector2f m_uv; }; struct VertexBufferBinding @@ -119,8 +119,8 @@ private: protected: struct ViewBlock { - Zeus::CMatrix4f m_mv; - Zeus::CColor m_color = Zeus::CColor::skWhite; + zeus::CMatrix4f m_mv; + zeus::CColor m_color = zeus::CColor::skWhite; void setViewRect(const boo::SWindowRect& root, const boo::SWindowRect& sub) { m_mv[0][0] = 2.0f / root.size[0]; @@ -188,14 +188,14 @@ public: int height() const {return m_subRect.size[1];} void updateSize(); - void setBackground(const Zeus::CColor& color) + void setBackground(const zeus::CColor& color) { for (int i=0 ; i<4 ; ++i) m_bgRect[i].m_color = color; m_bgVertsBinding.load(m_bgRect, sizeof(m_bgRect)); } - virtual void setMultiplyColor(const Zeus::CColor& color) + virtual void setMultiplyColor(const zeus::CColor& color) { m_viewVertBlock.m_color = color; m_viewVertBlockBuf->load(&m_viewVertBlock, sizeof(ViewBlock)); diff --git a/specter/include/specter/ViewResources.hpp b/specter/include/specter/ViewResources.hpp new file mode 100644 index 000000000..000fce3fa --- /dev/null +++ b/specter/include/specter/ViewResources.hpp @@ -0,0 +1,220 @@ +#ifndef SPECTER_VIEWRESOURCES_HPP +#define SPECTER_VIEWRESOURCES_HPP + +#include "TextView.hpp" +#include "SplitView.hpp" +#include "Toolbar.hpp" +#include "Button.hpp" + +#include + +namespace specter +{ +class IThemeData +{ +public: + virtual const zeus::CColor& uiText() const=0; + virtual const zeus::CColor& uiAltText() const=0; + virtual const zeus::CColor& fieldText() const=0; + virtual const zeus::CColor& fieldMarkedText() const=0; + virtual const zeus::CColor& selectedFieldText() const=0; + + virtual const zeus::CColor& viewportBackground() const=0; + virtual const zeus::CColor& toolbarBackground() const=0; + virtual const zeus::CColor& tooltipBackground() const=0; + virtual const zeus::CColor& spaceBackground() const=0; + virtual const zeus::CColor& splashBackground() const=0; + virtual const zeus::CColor& splashErrorBackground() const=0; + + virtual const zeus::CColor& splash1() const=0; + virtual const zeus::CColor& splash2() const=0; + + virtual const zeus::CColor& button1Inactive() const=0; + virtual const zeus::CColor& button2Inactive() const=0; + virtual const zeus::CColor& button1Hover() const=0; + virtual const zeus::CColor& button2Hover() const=0; + virtual const zeus::CColor& button1Press() const=0; + virtual const zeus::CColor& button2Press() const=0; + virtual const zeus::CColor& button1Disabled() const=0; + virtual const zeus::CColor& button2Disabled() const=0; + + virtual const zeus::CColor& textfield1Inactive() const=0; + virtual const zeus::CColor& textfield2Inactive() const=0; + virtual const zeus::CColor& textfield1Hover() const=0; + virtual const zeus::CColor& textfield2Hover() const=0; + virtual const zeus::CColor& textfield1Disabled() const=0; + virtual const zeus::CColor& textfield2Disabled() const=0; + virtual const zeus::CColor& textfieldSelection() const=0; + virtual const zeus::CColor& textfieldMarkSelection() const=0; + + virtual const zeus::CColor& tableCellBg1() const=0; + virtual const zeus::CColor& tableCellBg2() const=0; + virtual const zeus::CColor& tableCellBgSelected() const=0; + + virtual const zeus::CColor& scrollIndicator() const=0; + + virtual const zeus::CColor& spaceTriangleShading1() const=0; + virtual const zeus::CColor& spaceTriangleShading2() const=0; +}; + +class DefaultThemeData : public IThemeData +{ + zeus::CColor m_uiText = zeus::CColor::skWhite; + zeus::CColor m_uiAltText = zeus::CColor::skGrey; + zeus::CColor m_fieldText = zeus::CColor::skBlack; + zeus::CColor m_fieldMarkedText = {0.25, 0.25, 0.25, 1.0}; + zeus::CColor m_selectedFieldText = zeus::CColor::skWhite; + + zeus::CColor m_vpBg = {0.2, 0.2, 0.2, 1.0}; + zeus::CColor m_tbBg = {0.2, 0.2, 0.2, 0.9}; + zeus::CColor m_tooltipBg = {0.1, 0.1, 0.1, 0.85}; + zeus::CColor m_spaceBg = {0.075, 0.075, 0.075, 0.85}; + zeus::CColor m_splashBg = {0.075, 0.075, 0.075, 0.85}; + zeus::CColor m_splashErrorBg = {0.1, 0.01, 0.01, 0.85}; + + zeus::CColor m_splash1 = {1.0, 1.0, 1.0, 1.0}; + zeus::CColor m_splash2 = {0.3, 0.3, 0.3, 1.0}; + + zeus::CColor m_button1Inactive = {0.2823, 0.2823, 0.2823, 1.0}; + zeus::CColor m_button2Inactive = {0.1725, 0.1725, 0.1725, 1.0}; + zeus::CColor m_button1Hover = {0.3523, 0.3523, 0.3523, 1.0}; + zeus::CColor m_button2Hover = {0.2425, 0.2425, 0.2425, 1.0}; + zeus::CColor m_button1Press = {0.1725, 0.1725, 0.1725, 1.0}; + zeus::CColor m_button2Press = {0.2823, 0.2823, 0.2823, 1.0}; + zeus::CColor m_button1Disabled = {0.2823, 0.2823, 0.2823, 0.5}; + zeus::CColor m_button2Disabled = {0.1725, 0.1725, 0.1725, 0.5}; + + zeus::CColor m_textfield2Inactive = {0.7823, 0.7823, 0.7823, 1.0}; + zeus::CColor m_textfield1Inactive = {0.5725, 0.5725, 0.5725, 1.0}; + zeus::CColor m_textfield2Hover = {0.8523, 0.8523, 0.8523, 1.0}; + zeus::CColor m_textfield1Hover = {0.6425, 0.6425, 0.6425, 1.0}; + zeus::CColor m_textfield2Disabled = {0.7823, 0.7823, 0.7823, 0.5}; + zeus::CColor m_textfield1Disabled = {0.5725, 0.5725, 0.5725, 0.5}; + zeus::CColor m_textfieldSelection = {0.2725, 0.2725, 0.2725, 1.0}; + zeus::CColor m_textfieldMarkSelection = {1.0, 1.0, 0.2725, 1.0}; + + zeus::CColor m_tableCellBg1 = {0.1725, 0.1725, 0.1725, 0.75}; + zeus::CColor m_tableCellBg2 = {0.2425, 0.2425, 0.2425, 0.75}; + zeus::CColor m_tableCellBgSelected = {0.6425, 0.6425, 0.6425, 1.0}; + + zeus::CColor m_scrollIndicator = {0.2823, 0.2823, 0.2823, 1.0}; + + zeus::CColor m_spaceTriangleShading1 = {0.6425, 0.6425, 0.6425, 1.0}; + zeus::CColor m_spaceTriangleShading2 = {0.5725, 0.5725, 0.5725, 1.0}; + +public: + virtual const zeus::CColor& uiText() const {return m_uiText;} + virtual const zeus::CColor& uiAltText() const {return m_uiAltText;} + virtual const zeus::CColor& fieldText() const {return m_fieldText;} + virtual const zeus::CColor& fieldMarkedText() const {return m_fieldMarkedText;} + virtual const zeus::CColor& selectedFieldText() const {return m_selectedFieldText;} + + virtual const zeus::CColor& viewportBackground() const {return m_vpBg;} + virtual const zeus::CColor& toolbarBackground() const {return m_tbBg;} + virtual const zeus::CColor& tooltipBackground() const {return m_tooltipBg;} + virtual const zeus::CColor& spaceBackground() const {return m_spaceBg;} + virtual const zeus::CColor& splashBackground() const {return m_splashBg;} + virtual const zeus::CColor& splashErrorBackground() const {return m_splashErrorBg;} + + virtual const zeus::CColor& splash1() const {return m_splash1;} + virtual const zeus::CColor& splash2() const {return m_splash2;} + + virtual const zeus::CColor& button1Inactive() const {return m_button1Inactive;} + virtual const zeus::CColor& button2Inactive() const {return m_button2Inactive;} + virtual const zeus::CColor& button1Hover() const {return m_button1Hover;} + virtual const zeus::CColor& button2Hover() const {return m_button2Hover;} + virtual const zeus::CColor& button1Press() const {return m_button1Press;} + virtual const zeus::CColor& button2Press() const {return m_button2Press;} + virtual const zeus::CColor& button1Disabled() const {return m_button1Disabled;} + virtual const zeus::CColor& button2Disabled() const {return m_button2Disabled;} + + virtual const zeus::CColor& textfield1Inactive() const {return m_textfield1Inactive;} + virtual const zeus::CColor& textfield2Inactive() const {return m_textfield2Inactive;} + virtual const zeus::CColor& textfield1Hover() const {return m_textfield1Hover;} + virtual const zeus::CColor& textfield2Hover() const {return m_textfield2Hover;} + virtual const zeus::CColor& textfield1Disabled() const {return m_textfield1Disabled;} + virtual const zeus::CColor& textfield2Disabled() const {return m_textfield2Disabled;} + virtual const zeus::CColor& textfieldSelection() const {return m_textfieldSelection;} + virtual const zeus::CColor& textfieldMarkSelection() const {return m_textfieldMarkSelection;} + + virtual const zeus::CColor& tableCellBg1() const {return m_tableCellBg1;} + virtual const zeus::CColor& tableCellBg2() const {return m_tableCellBg2;} + virtual const zeus::CColor& tableCellBgSelected() const {return m_tableCellBgSelected;} + + virtual const zeus::CColor& scrollIndicator() const {return m_scrollIndicator;} + + virtual const zeus::CColor& spaceTriangleShading1() const {return m_spaceTriangleShading1;} + virtual const zeus::CColor& spaceTriangleShading2() const {return m_spaceTriangleShading2;} +}; + +class ViewResources +{ + template + void init(Factory* factory, const IThemeData& theme, FontCache* fcache) + { + m_viewRes.init(factory, theme); + m_textRes.init(factory, fcache); + m_splitRes.init(factory, theme); + m_toolbarRes.init(factory, theme); + m_buttonRes.init(factory, theme); + } + +public: + boo::IGraphicsDataFactory* m_factory = nullptr; + FontCache* m_fcache = nullptr; + View::Resources m_viewRes; + TextView::Resources m_textRes; + SplitView::Resources m_splitRes; + Toolbar::Resources m_toolbarRes; + Button::Resources m_buttonRes; + boo::GraphicsDataToken m_resData; + + specter::FontTag m_mainFont; + specter::FontTag m_monoFont; + + specter::FontTag m_heading14; + specter::FontTag m_heading18; + + specter::FontTag m_titleFont; + specter::FontTag m_curveFont; + + std::thread m_fcacheThread; + bool m_fcacheInterrupt = false; + bool m_fcacheReady = false; + + ViewResources() = default; + ViewResources(const ViewResources& other) = delete; + ViewResources(ViewResources&& other) = default; + ViewResources& operator=(const ViewResources& other) = delete; + ViewResources& operator=(ViewResources&& other) = default; + + void destroyResData() + { + m_resData.doDestroy(); + } + + ~ViewResources() + { + if (m_fcacheThread.joinable()) + { + m_fcacheInterrupt = true; + m_fcacheThread.join(); + } + } + + void init(boo::IGraphicsDataFactory* factory, FontCache* fcache, const IThemeData* theme, float pixelFactor); + void prepFontCacheSync(); + void prepFontCacheAsync(boo::IWindow* window); + bool fontCacheReady() const {return m_fcacheReady;} + void resetPixelFactor(float pixelFactor); + void resetTheme(const IThemeData* theme); + + float m_pixelFactor = 0; + float pixelFactor() const {return m_pixelFactor;} + + const IThemeData* m_theme; + const IThemeData& themeData() const {return *m_theme;} +}; +} + +#endif // SPECTER_VIEWRESOURCES_HPP diff --git a/specter/include/Specter/Specter.hpp b/specter/include/specter/specter.hpp similarity index 100% rename from specter/include/Specter/Specter.hpp rename to specter/include/specter/specter.hpp diff --git a/specter/lib/Button.cpp b/specter/lib/Button.cpp index 3157549a6..c91c828b8 100644 --- a/specter/lib/Button.cpp +++ b/specter/lib/Button.cpp @@ -1,11 +1,11 @@ -#include -#include "Specter/Button.hpp" -#include "Specter/ViewResources.hpp" -#include "Specter/RootView.hpp" +#include "logvisor/logvisor.hpp" +#include "specter/Button.hpp" +#include "specter/ViewResources.hpp" +#include "specter/RootView.hpp" -namespace Specter +namespace specter { -static LogVisor::LogModule Log("Specter::Button"); +static logvisor::Module Log("specter::Button"); void Button::Resources::init(boo::IGraphicsDataFactory* factory, const IThemeData& theme) { @@ -13,12 +13,12 @@ void Button::Resources::init(boo::IGraphicsDataFactory* factory, const IThemeDat Button::Button(ViewResources& res, View& parentView, IButtonBinding* controlBinding, const std::string& text, Icon* icon, - Style style, const Zeus::CColor& bgColor, RectangleConstraint constraint) + Style style, const zeus::CColor& bgColor, RectangleConstraint constraint) : Button(res, parentView, controlBinding, text, res.themeData().uiText(), icon, style, bgColor, constraint) {} Button::Button(ViewResources& res, View& parentView, - IButtonBinding* controlBinding, const std::string& text, const Zeus::CColor& textColor, - Icon* icon, Style style, const Zeus::CColor& bgColor, RectangleConstraint constraint) + IButtonBinding* controlBinding, const std::string& text, const zeus::CColor& textColor, + Icon* icon, Style style, const zeus::CColor& bgColor, RectangleConstraint constraint) : Control(res, parentView, controlBinding), m_style(style), m_textColor(textColor), m_bgColor(bgColor), m_textStr(text), m_constraint(constraint) { @@ -30,8 +30,8 @@ Button::Button(ViewResources& res, View& parentView, if (style == Style::Block) { - Zeus::CColor c1 = res.themeData().button1Inactive() * bgColor; - Zeus::CColor c2 = res.themeData().button2Inactive() * bgColor; + zeus::CColor c1 = res.themeData().button1Inactive() * bgColor; + zeus::CColor c2 = res.themeData().button2Inactive() * bgColor; m_verts[0].m_color = c1; m_verts[1].m_color = c2; m_verts[2].m_color = c1; @@ -49,9 +49,9 @@ Button::Button(ViewResources& res, View& parentView, else { for (int i=0 ; i<4 ; ++i) - m_verts[i].m_color = Zeus::CColor::skClear; + m_verts[i].m_color = zeus::CColor::skClear; for (int i=31 ; i<35 ; ++i) - m_verts[i].m_color = Zeus::CColor::skClear; + m_verts[i].m_color = zeus::CColor::skClear; } for (int i=28 ; i<31 ; ++i) m_verts[i].m_color = m_textColor; @@ -72,7 +72,7 @@ void Button::setText(const std::string& text) setText(text, m_textColor); } -void Button::setText(const std::string& text, const Zeus::CColor& textColor) +void Button::setText(const std::string& text, const zeus::CColor& textColor) { m_textStr = text; m_textColor = textColor; @@ -204,7 +204,7 @@ void Button::setIcon(Icon* icon) updateSize(); } -void Button::colorGlyphs(const Zeus::CColor& newColor) +void Button::colorGlyphs(const zeus::CColor& newColor) { m_textColor = newColor; m_text->colorGlyphs(newColor); @@ -217,8 +217,8 @@ void Button::ButtonTarget::setInactive() { if (m_button.m_style == Style::Block) { - Zeus::CColor c1 = rootView().themeData().button1Inactive() * m_button.m_bgColor; - Zeus::CColor c2 = rootView().themeData().button2Inactive() * m_button.m_bgColor; + zeus::CColor c1 = rootView().themeData().button1Inactive() * m_button.m_bgColor; + zeus::CColor c2 = rootView().themeData().button2Inactive() * m_button.m_bgColor; m_button.m_verts[0].m_color = c1; m_button.m_verts[1].m_color = c2; m_button.m_verts[2].m_color = c1; @@ -229,7 +229,7 @@ void Button::ButtonTarget::setInactive() else { for (int i=0 ; i<4 ; ++i) - m_button.m_verts[i].m_color = Zeus::CColor::skClear; + m_button.m_verts[i].m_color = zeus::CColor::skClear; m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts)); m_button.m_text->colorGlyphs(m_button.m_textColor); } @@ -239,8 +239,8 @@ void Button::MenuTarget::setInactive() { if (m_button.m_style == Style::Block) { - Zeus::CColor c1 = rootView().themeData().button1Inactive() * m_button.m_bgColor; - Zeus::CColor c2 = rootView().themeData().button2Inactive() * m_button.m_bgColor; + zeus::CColor c1 = rootView().themeData().button1Inactive() * m_button.m_bgColor; + zeus::CColor c2 = rootView().themeData().button2Inactive() * m_button.m_bgColor; m_button.m_verts[31].m_color = c1; m_button.m_verts[32].m_color = c2; m_button.m_verts[33].m_color = c1; @@ -252,7 +252,7 @@ void Button::MenuTarget::setInactive() for (int i=28 ; i<31 ; ++i) m_button.m_verts[i].m_color = m_button.m_textColor; for (int i=31 ; i<35 ; ++i) - m_button.m_verts[i].m_color = Zeus::CColor::skClear; + m_button.m_verts[i].m_color = zeus::CColor::skClear; m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts)); } } @@ -261,8 +261,8 @@ void Button::ButtonTarget::setHover() { if (m_button.m_style == Style::Block) { - Zeus::CColor c1 = rootView().themeData().button1Hover() * m_button.m_bgColor; - Zeus::CColor c2 = rootView().themeData().button2Hover() * m_button.m_bgColor; + zeus::CColor c1 = rootView().themeData().button1Hover() * m_button.m_bgColor; + zeus::CColor c2 = rootView().themeData().button2Hover() * m_button.m_bgColor; m_button.m_verts[0].m_color = c1; m_button.m_verts[1].m_color = c2; m_button.m_verts[2].m_color = c1; @@ -283,8 +283,8 @@ void Button::MenuTarget::setHover() { if (m_button.m_style == Style::Block) { - Zeus::CColor c1 = rootView().themeData().button1Hover() * m_button.m_bgColor; - Zeus::CColor c2 = rootView().themeData().button2Hover() * m_button.m_bgColor; + zeus::CColor c1 = rootView().themeData().button1Hover() * m_button.m_bgColor; + zeus::CColor c2 = rootView().themeData().button2Hover() * m_button.m_bgColor; m_button.m_verts[31].m_color = c1; m_button.m_verts[32].m_color = c2; m_button.m_verts[33].m_color = c1; @@ -305,8 +305,8 @@ void Button::ButtonTarget::setPressed() { if (m_button.m_style == Style::Block) { - Zeus::CColor c1 = rootView().themeData().button1Press() * m_button.m_bgColor; - Zeus::CColor c2 = rootView().themeData().button2Press() * m_button.m_bgColor; + zeus::CColor c1 = rootView().themeData().button1Press() * m_button.m_bgColor; + zeus::CColor c2 = rootView().themeData().button2Press() * m_button.m_bgColor; m_button.m_verts[0].m_color = c1; m_button.m_verts[1].m_color = c2; m_button.m_verts[2].m_color = c1; @@ -327,8 +327,8 @@ void Button::MenuTarget::setPressed() { if (m_button.m_style == Style::Block) { - Zeus::CColor c1 = rootView().themeData().button1Press() * m_button.m_bgColor; - Zeus::CColor c2 = rootView().themeData().button2Press() * m_button.m_bgColor; + zeus::CColor c1 = rootView().themeData().button1Press() * m_button.m_bgColor; + zeus::CColor c2 = rootView().themeData().button2Press() * m_button.m_bgColor; m_button.m_verts[31].m_color = c1; m_button.m_verts[32].m_color = c2; m_button.m_verts[33].m_color = c1; @@ -349,8 +349,8 @@ void Button::ButtonTarget::setDisabled() { if (m_button.m_style == Style::Block) { - Zeus::CColor c1 = rootView().themeData().button1Disabled() * m_button.m_bgColor; - Zeus::CColor c2 = rootView().themeData().button2Disabled() * m_button.m_bgColor; + zeus::CColor c1 = rootView().themeData().button1Disabled() * m_button.m_bgColor; + zeus::CColor c2 = rootView().themeData().button2Disabled() * m_button.m_bgColor; m_button.m_verts[0].m_color = c1; m_button.m_verts[1].m_color = c2; m_button.m_verts[2].m_color = c1; @@ -361,9 +361,9 @@ void Button::ButtonTarget::setDisabled() else { for (int i=0 ; i<4 ; ++i) - m_button.m_verts[i].m_color = Zeus::CColor::skClear; + m_button.m_verts[i].m_color = zeus::CColor::skClear; m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts)); - Zeus::CColor dimText = m_button.m_textColor; + zeus::CColor dimText = m_button.m_textColor; dimText[3] *= 0.5; m_button.m_text->colorGlyphs(dimText); } @@ -373,8 +373,8 @@ void Button::MenuTarget::setDisabled() { if (m_button.m_style == Style::Block) { - Zeus::CColor c1 = rootView().themeData().button1Disabled() * m_button.m_bgColor; - Zeus::CColor c2 = rootView().themeData().button2Disabled() * m_button.m_bgColor; + zeus::CColor c1 = rootView().themeData().button1Disabled() * m_button.m_bgColor; + zeus::CColor c2 = rootView().themeData().button2Disabled() * m_button.m_bgColor; m_button.m_verts[31].m_color = c1; m_button.m_verts[32].m_color = c2; m_button.m_verts[33].m_color = c1; @@ -383,12 +383,12 @@ void Button::MenuTarget::setDisabled() } else { - Zeus::CColor dimText = m_button.m_textColor; + zeus::CColor dimText = m_button.m_textColor; dimText[3] *= 0.5; for (int i=28 ; i<31 ; ++i) m_button.m_verts[i].m_color = dimText; for (int i=31 ; i<35 ; ++i) - m_button.m_verts[i].m_color = Zeus::CColor::skClear; + m_button.m_verts[i].m_color = zeus::CColor::skClear; m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts)); } } @@ -414,7 +414,7 @@ void Button::MenuTarget::mouseDown(const boo::SWindowCoord& coord, boo::EMouseBu setPressed(); if (m_hovered) { - Log.report(LogVisor::Info, "button menu '%s' activated", m_button.m_textStr.c_str()); + Log.report(logvisor::Info, "button menu '%s' activated", m_button.m_textStr.c_str()); if (m_button.m_controlBinding) { m_button.m_modalMenu.m_view = static_cast(*m_button.m_controlBinding).buildMenu(&m_button); @@ -439,7 +439,7 @@ void Button::ButtonTarget::mouseUp(const boo::SWindowCoord& coord, boo::EMouseBu static_cast(*m_button.m_controlBinding).up(&m_button, coord); if (m_hovered) { - Log.report(LogVisor::Info, "button '%s' activated", m_button.m_textStr.c_str()); + Log.report(logvisor::Info, "button '%s' activated", m_button.m_textStr.c_str()); if (m_button.m_controlBinding) static_cast(*m_button.m_controlBinding).activated(&m_button, coord); } diff --git a/specter/lib/Control.cpp b/specter/lib/Control.cpp index e861e254b..a5dc8e6a4 100644 --- a/specter/lib/Control.cpp +++ b/specter/lib/Control.cpp @@ -1,6 +1,6 @@ -#include "Specter/Control.hpp" +#include "specter/Control.hpp" -namespace Specter +namespace specter { Control::Control(ViewResources& res, View& parentView, diff --git a/specter/lib/FileBrowser.cpp b/specter/lib/FileBrowser.cpp index 7b2225280..def24d28b 100644 --- a/specter/lib/FileBrowser.cpp +++ b/specter/lib/FileBrowser.cpp @@ -1,20 +1,20 @@ -#include "Specter/FileBrowser.hpp" -#include "Specter/RootView.hpp" -#include "Specter/MessageWindow.hpp" +#include "specter/FileBrowser.hpp" +#include "specter/RootView.hpp" +#include "specter/MessageWindow.hpp" -namespace Specter +namespace specter { -static LogVisor::LogModule Log("Specter::FileBrowser"); +static logvisor::Module Log("specter::FileBrowser"); #define BROWSER_MARGIN 8 #define BROWSER_MIN_WIDTH 600 #define BROWSER_MIN_HEIGHT 300 -std::vector FileBrowser::PathComponents(const HECL::SystemString& path) +std::vector FileBrowser::PathComponents(const hecl::SystemString& path) { - std::vector ret; - HECL::SystemString sPath = path; - HECL::SanitizePath(sPath); + std::vector ret; + hecl::SystemString sPath = path; + hecl::SanitizePath(sPath); if (sPath.empty()) return ret; auto it = sPath.cbegin(); @@ -23,7 +23,7 @@ std::vector FileBrowser::PathComponents(const HECL::SystemSt ret.push_back(_S("/")); ++it; } - HECL::SystemString comp; + hecl::SystemString comp; for (; it != sPath.cend() ; ++it) { if (*it == _S('/')) @@ -42,8 +42,8 @@ std::vector FileBrowser::PathComponents(const HECL::SystemSt } FileBrowser::FileBrowser(ViewResources& res, View& parentView, const std::string& title, - Type type, const HECL::SystemString& initialPath, - std::function returnFunc) + Type type, const hecl::SystemString& initialPath, + std::function returnFunc) : ModalWindow(res, parentView, RectangleConstraint(BROWSER_MIN_WIDTH * res.pixelFactor(), BROWSER_MIN_HEIGHT * res.pixelFactor(), RectangleConstraint::Test::Minimum, @@ -78,18 +78,18 @@ FileBrowser::FileBrowser(ViewResources& res, View& parentView, const std::string m_recentBookmarksLabel->typesetGlyphs(vm.translateOr("recent_files", "Recent Files"), res.themeData().uiText()); /* Populate system bookmarks */ - std::vector> systemLocs = HECL::GetSystemLocations(); + std::vector> systemLocs = hecl::GetSystemLocations(); for (auto& loc : systemLocs) m_systemBookmarkBind.m_entries.emplace_back(std::move(loc)); m_systemBookmarks.m_view->updateData(); - const std::vector* recentProjects = vm.recentProjects(); + const std::vector* recentProjects = vm.recentProjects(); for (auto& proj : *recentProjects) m_projectBookmarkBind.m_entries.emplace_back(proj); m_projectBookmarks.m_view->updateData(); - const std::vector* recentFiles = vm.recentFiles(); + const std::vector* recentFiles = vm.recentFiles(); for (auto& file : *recentFiles) m_recentBookmarkBind.m_entries.emplace_back(file); @@ -106,7 +106,7 @@ FileBrowser::FileBrowser(ViewResources& res, View& parentView, const std::string } void FileBrowser::SyncBookmarkSelections(Table& table, BookmarkDataBind& binding, - const HECL::SystemString& sel) + const hecl::SystemString& sel) { size_t idx = 0; for (const BookmarkDataBind::Entry& e : binding.m_entries) @@ -122,25 +122,25 @@ void FileBrowser::SyncBookmarkSelections(Table& table, BookmarkDataBind& binding table.selectRow(-1); } -void FileBrowser::navigateToPath(const HECL::SystemString& path) +void FileBrowser::navigateToPath(const hecl::SystemString& path) { - HECL::Sstat theStat; - if (HECL::Stat(path.c_str(), &theStat)) + hecl::Sstat theStat; + if (hecl::Stat(path.c_str(), &theStat)) return; m_path = path; m_comps = PathComponents(m_path); if (S_ISREG(theStat.st_mode)) { - HECL::SystemUTF8View utf8(m_comps.back()); + hecl::SystemUTF8View utf8(m_comps.back()); m_fileField.m_view->setText(utf8); m_fileField.m_view->clearErrorState(); m_comps.pop_back(); } - HECL::SystemString dir; + hecl::SystemString dir; bool needSlash = false; - for (const HECL::SystemString& d : m_comps) + for (const hecl::SystemString& d : m_comps) { if (needSlash) dir += _S('/'); @@ -153,7 +153,7 @@ void FileBrowser::navigateToPath(const HECL::SystemString& path) SyncBookmarkSelections(*m_projectBookmarks.m_view, m_projectBookmarkBind, dir); SyncBookmarkSelections(*m_recentBookmarks.m_view, m_recentBookmarkBind, dir); - HECL::DirectoryEnumerator dEnum(dir, HECL::DirectoryEnumerator::Mode::DirsThenFilesSorted, + hecl::DirectoryEnumerator dEnum(dir, hecl::DirectoryEnumerator::Mode::DirsThenFilesSorted, m_fileListingBind.m_sizeSort, m_fileListingBind.m_sortDir==SortDirection::Descending, !m_showingHidden); @@ -168,7 +168,7 @@ void FileBrowser::navigateToPath(const HECL::SystemString& path) void FileBrowser::updateContentOpacity(float opacity) { - Zeus::CColor color = Zeus::CColor::lerp({1,1,1,0}, {1,1,1,1}, opacity); + zeus::CColor color = zeus::CColor::lerp({1,1,1,0}, {1,1,1,1}, opacity); m_split.m_view->setMultiplyColor(color); m_pathButtons.m_view->setMultiplyColor(color); m_fileField.m_view->setMultiplyColor(color); @@ -187,9 +187,9 @@ void FileBrowser::okActivated(bool viaButton) { IViewManager& vm = rootView().viewManager(); - HECL::SystemString path; + hecl::SystemString path; bool needSlash = false; - for (const HECL::SystemString& d : m_comps) + for (const hecl::SystemString& d : m_comps) { if (needSlash) path += _S('/'); @@ -198,20 +198,20 @@ void FileBrowser::okActivated(bool viaButton) path += d; } - HECL::Sstat theStat; - if (HECL::Stat(path.c_str(), &theStat) || !S_ISDIR(theStat.st_mode)) + hecl::Sstat theStat; + if (hecl::Stat(path.c_str(), &theStat) || !S_ISDIR(theStat.st_mode)) { - HECL::SystemUTF8View utf8(path); + hecl::SystemUTF8View utf8(path); m_fileField.m_view->setErrorState( - HECL::Format(vm.translateOr("no_access_as_dir", "Unable to access '%s' as directory").c_str(), + hecl::Format(vm.translateOr("no_access_as_dir", "Unable to access '%s' as directory").c_str(), utf8.c_str())); return; } path += _S('/'); - path += HECL::SystemStringView(m_fileField.m_view->getText()).sys_str(); + path += hecl::SystemStringView(m_fileField.m_view->getText()).sys_str(); - int err = HECL::Stat(path.c_str(), &theStat); + int err = hecl::Stat(path.c_str(), &theStat); if (m_type == Type::SaveFile) { if (m_fileField.m_view->getText().empty()) @@ -224,7 +224,7 @@ void FileBrowser::okActivated(bool viaButton) { m_confirmWindow.reset(new MessageWindow(rootView().viewRes(), *this, MessageWindow::Type::ConfirmOkCancel, - HECL::Format(vm.translateOr("overwrite_confirm", "Overwrite '%s'?").c_str(), path.c_str()), + hecl::Format(vm.translateOr("overwrite_confirm", "Overwrite '%s'?").c_str(), path.c_str()), [&,path](bool ok) { if (ok) @@ -266,7 +266,7 @@ void FileBrowser::okActivated(bool viaButton) { if (m_type == Type::NewHECLProject) { - HECL::ProjectRootPath projRoot = HECL::SearchForProject(path); + hecl::ProjectRootPath projRoot = hecl::SearchForProject(path); if (projRoot) { m_fileField.m_view->setErrorState( @@ -291,9 +291,9 @@ void FileBrowser::okActivated(bool viaButton) } else if (err || !S_ISREG(theStat.st_mode)) { - HECL::SystemUTF8View utf8(path); + hecl::SystemUTF8View utf8(path); m_fileField.m_view->setErrorState( - HECL::Format(vm.translateOr("no_access_as_file", "Unable to access '%s' as file").c_str(), + hecl::Format(vm.translateOr("no_access_as_file", "Unable to access '%s' as file").c_str(), utf8.c_str())); return; } @@ -307,7 +307,7 @@ void FileBrowser::okActivated(bool viaButton) { if (m_type == Type::OpenHECLProject) { - HECL::ProjectRootPath projRoot = HECL::SearchForProject(path); + hecl::ProjectRootPath projRoot = hecl::SearchForProject(path); if (projRoot) { m_returnFunc(true, projRoot.getAbsolutePath()); @@ -320,9 +320,9 @@ void FileBrowser::okActivated(bool viaButton) } if (err || !S_ISDIR(theStat.st_mode)) { - HECL::SystemUTF8View utf8(path); + hecl::SystemUTF8View utf8(path); m_fileField.m_view->setErrorState( - HECL::Format(vm.translateOr("no_access_as_dir", "Unable to access '%s' as directory").c_str(), + hecl::Format(vm.translateOr("no_access_as_dir", "Unable to access '%s' as directory").c_str(), utf8.c_str())); return; } @@ -334,9 +334,9 @@ void FileBrowser::okActivated(bool viaButton) void FileBrowser::cancelActivated() { - HECL::SystemString path; + hecl::SystemString path; bool needSlash = false; - for (const HECL::SystemString& d : m_comps) + for (const hecl::SystemString& d : m_comps) { if (needSlash) path += _S('/'); @@ -346,7 +346,7 @@ void FileBrowser::cancelActivated() } path += _S('/'); - path += HECL::SystemStringView(m_fileField.m_view->getText()).sys_str(); + path += hecl::SystemStringView(m_fileField.m_view->getText()).sys_str(); m_returnFunc(false, path); close(); @@ -357,10 +357,10 @@ void FileBrowser::pathButtonActivated(size_t idx) if (idx >= m_comps.size()) return; - HECL::SystemString dir; + hecl::SystemString dir; bool needSlash = false; size_t i = 0; - for (const HECL::SystemString& d : m_comps) + for (const hecl::SystemString& d : m_comps) { if (needSlash) dir += _S('/'); diff --git a/specter/lib/FontCache.cpp b/specter/lib/FontCache.cpp index 3bb0375e6..2df4748af 100644 --- a/specter/lib/FontCache.cpp +++ b/specter/lib/FontCache.cpp @@ -2,9 +2,9 @@ #define NOMINMAX 1 #endif -#include "Specter/FontCache.hpp" -#include -#include +#include "specter/FontCache.hpp" +#include "logvisor/logvisor.hpp" +#include #include #include @@ -26,9 +26,9 @@ extern "C" size_t SPECTERCURVES_SZ; extern "C" const FT_Driver_ClassRec tt_driver_class; -namespace Specter +namespace specter { -static LogVisor::LogModule Log("Specter::FontCache"); +static logvisor::Module Log("specter::FontCache"); const FCharFilter AllCharFilter = std::make_pair("all-glyphs", [](uint32_t)->bool @@ -70,7 +70,7 @@ void FreeTypeGZipMemFace::open() return; if (FT_Stream_OpenGzip(&m_decomp, &m_comp)) - Log.report(LogVisor::FatalError, "unable to open FreeType gzip stream"); + Log.report(logvisor::Fatal, "unable to open FreeType gzip stream"); FT_Open_Args args = { @@ -82,7 +82,7 @@ void FreeTypeGZipMemFace::open() }; if (FT_Open_Face(m_lib, &args, 0, &m_face)) - Log.report(LogVisor::FatalError, "unable to open FreeType gzip face"); + Log.report(logvisor::Fatal, "unable to open FreeType gzip face"); } void FreeTypeGZipMemFace::close() @@ -155,7 +155,7 @@ void FontAtlas::buildKernTable(FT_Face face) TT_Face ttface = reinterpret_cast(face); if (!ttface->kern_table) return; - Athena::io::MemoryReader r(ttface->kern_table, ttface->kern_table_size); + athena::io::MemoryReader r(ttface->kern_table, ttface->kern_table_size); auto it = m_kernAdjs.end(); atUint32 nSubs = r.readUint32Big(); for (atUint32 i=0 ; i> 8 != 0) { - r.seek(kernHead.length - 6, Athena::Current); + r.seek(kernHead.length - 6, athena::Current); continue; } @@ -187,7 +187,7 @@ void FontAtlas::buildKernTable(FT_Face face) #define NO_ZLIB 0 #define ZLIB_BUF_SZ 32768 -static void WriteCompressed(Athena::io::FileWriter& writer, const atUint8* data, size_t sz) +static void WriteCompressed(athena::io::FileWriter& writer, const atUint8* data, size_t sz) { #if NO_ZLIB writer.writeUBytes(data, sz); @@ -219,13 +219,13 @@ static void WriteCompressed(Athena::io::FileWriter& writer, const atUint8* data, writer.writeUBytes(compBuf, ZLIB_BUF_SZ - z.avail_out); } - writer.seek(adlerPos, Athena::Begin); + writer.seek(adlerPos, athena::Begin); writer.writeUint32Big(z.adler); deflateEnd(&z); } -static bool ReadDecompressed(Athena::io::FileReader& reader, atUint8* data, size_t sz) +static bool ReadDecompressed(athena::io::FileReader& reader, atUint8* data, size_t sz) { #if NO_ZLIB reader.readUBytesToBuf(data, sz); @@ -253,7 +253,7 @@ static bool ReadDecompressed(Athena::io::FileReader& reader, atUint8* data, size } FontAtlas::FontAtlas(boo::IGraphicsDataFactory* gf, FT_Face face, uint32_t dpi, - bool subpixel, FCharFilter& filter, Athena::io::FileWriter& writer) + bool subpixel, FCharFilter& filter, athena::io::FileWriter& writer) : m_dpi(dpi), m_ftXscale(face->size->metrics.x_scale), m_ftXPpem(face->size->metrics.x_ppem), @@ -481,7 +481,7 @@ FontAtlas::FontAtlas(boo::IGraphicsDataFactory* gf, FT_Face face, uint32_t dpi, } FontAtlas::FontAtlas(boo::IGraphicsDataFactory* gf, FT_Face face, uint32_t dpi, - bool subpixel, FCharFilter& filter, Athena::io::FileReader& reader) + bool subpixel, FCharFilter& filter, athena::io::FileReader& reader) : m_dpi(dpi), m_ftXscale(face->size->metrics.x_scale), m_ftXPpem(face->size->metrics.x_ppem), @@ -685,7 +685,7 @@ FontCache::Library::Library() { FT_Error err = FT_Init_FreeType(&m_lib); if (err) - Log.report(LogVisor::FatalError, "unable to FT_Init_FreeType"); + Log.report(logvisor::Fatal, "unable to FT_Init_FreeType"); } FontCache::Library::~Library() @@ -693,13 +693,13 @@ FontCache::Library::~Library() FT_Done_FreeType(m_lib); } -FontCache::FontCache(const HECL::Runtime::FileStoreManager& fileMgr) +FontCache::FontCache(const hecl::Runtime::FileStoreManager& fileMgr) : m_fileMgr(fileMgr), m_cacheRoot(m_fileMgr.getStoreRoot() + _S("/fontcache")), m_regFace(m_fontLib, DROIDSANS_PERMISSIVE, DROIDSANS_PERMISSIVE_SZ), m_monoFace(m_fontLib, BMONOFONT, BMONOFONT_SZ), m_curvesFace(m_fontLib, SPECTERCURVES, SPECTERCURVES_SZ) -{HECL::MakeDir(m_cacheRoot.c_str());} +{hecl::MakeDir(m_cacheRoot.c_str());} FontTag FontCache::prepCustomFont(boo::IGraphicsDataFactory* gf, const std::string& name, FT_Face face, FCharFilter filter, bool subpixel, @@ -707,10 +707,10 @@ FontTag FontCache::prepCustomFont(boo::IGraphicsDataFactory* gf, const std::stri { /* Quick validation */ if (!face) - Log.report(LogVisor::FatalError, "invalid freetype face"); + Log.report(logvisor::Fatal, "invalid freetype face"); if (!face->charmap || face->charmap->encoding != FT_ENCODING_UNICODE) - Log.report(LogVisor::FatalError, "font does not contain a unicode char map"); + Log.report(logvisor::Fatal, "font does not contain a unicode char map"); /* Set size with FreeType */ FT_Set_Char_Size(face, 0, points * 64.0, 0, dpi); @@ -722,11 +722,11 @@ FontTag FontCache::prepCustomFont(boo::IGraphicsDataFactory* gf, const std::stri return tag; /* Now check filesystem cache */ - HECL::SystemString cachePath = m_cacheRoot + _S('/') + HECL::SysFormat(_S("%" PRIx64), tag.hash()); - HECL::Sstat st; - if (!HECL::Stat(cachePath.c_str(), &st) && S_ISREG(st.st_mode)) + hecl::SystemString cachePath = m_cacheRoot + _S('/') + hecl::SysFormat(_S("%" PRIx64), tag.hash()); + hecl::Sstat st; + if (!hecl::Stat(cachePath.c_str(), &st) && S_ISREG(st.st_mode)) { - Athena::io::FileReader r(cachePath); + athena::io::FileReader r(cachePath); if (!r.hasError()) { atUint32 magic = r.readUint32Big(); @@ -743,9 +743,9 @@ FontTag FontCache::prepCustomFont(boo::IGraphicsDataFactory* gf, const std::stri } /* Nada, build and cache now */ - Athena::io::FileWriter w(cachePath); + athena::io::FileWriter w(cachePath); if (w.hasError()) - Log.report(LogVisor::FatalError, "unable to open '%s' for writing", cachePath.c_str()); + Log.report(logvisor::Fatal, "unable to open '%s' for writing", cachePath.c_str()); w.writeUint32Big('FONT'); m_cachedAtlases.emplace(tag, std::make_unique(gf, face, dpi, subpixel, filter, w)); return tag; @@ -755,7 +755,7 @@ const FontAtlas& FontCache::lookupAtlas(FontTag tag) const { auto search = m_cachedAtlases.find(tag); if (search == m_cachedAtlases.cend()) - Log.report(LogVisor::FatalError, "invalid font"); + Log.report(logvisor::Fatal, "invalid font"); return *search->second.get(); } diff --git a/specter/lib/Icon.cpp b/specter/lib/Icon.cpp index a38171b42..50df673c7 100644 --- a/specter/lib/Icon.cpp +++ b/specter/lib/Icon.cpp @@ -1,7 +1,7 @@ -#include "Specter/Icon.hpp" -#include "Specter/RootView.hpp" +#include "specter/Icon.hpp" +#include "specter/RootView.hpp" -namespace Specter +namespace specter { IconView::IconView(ViewResources& res, View& parentView, Icon& icon) @@ -17,7 +17,7 @@ IconView::IconView(ViewResources& res, View& parentView, Icon& icon) {{1, 0, 0}, icon.m_uvCoords[3]}, }; m_vertexBinding.load(verts, sizeof(verts)); - setBackground(Zeus::CColor::skBlue); + setBackground(zeus::CColor::skBlue); } void IconView::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub) diff --git a/specter/lib/Menu.cpp b/specter/lib/Menu.cpp index 319a4b771..0777fec34 100644 --- a/specter/lib/Menu.cpp +++ b/specter/lib/Menu.cpp @@ -1,11 +1,11 @@ -#include "Specter/Menu.hpp" -#include "Specter/RootView.hpp" -#include "Specter/ViewResources.hpp" +#include "specter/Menu.hpp" +#include "specter/RootView.hpp" +#include "specter/ViewResources.hpp" #define ROW_HEIGHT 18 #define ITEM_MARGIN 1 -namespace Specter +namespace specter { Menu::Menu(ViewResources& res, View& parentView, IMenuNode* rootNode) @@ -92,7 +92,7 @@ Menu::ItemView::ItemView(ViewResources& res, Menu& menu, const std::string& text : View(res, menu), m_menu(menu), m_idx(idx), m_node(node) { commitResources(res); - m_textView.reset(new Specter::TextView(res, *this, res.m_mainFont)); + m_textView.reset(new specter::TextView(res, *this, res.m_mainFont)); m_textView->typesetGlyphs(text, res.themeData().uiText()); } diff --git a/specter/lib/MessageWindow.cpp b/specter/lib/MessageWindow.cpp index e8b86eb4e..308f5e9d1 100644 --- a/specter/lib/MessageWindow.cpp +++ b/specter/lib/MessageWindow.cpp @@ -1,9 +1,9 @@ -#include "Specter/MessageWindow.hpp" -#include "Specter/ViewResources.hpp" -#include "Specter/RootView.hpp" -#include "Specter/Menu.hpp" +#include "specter/MessageWindow.hpp" +#include "specter/ViewResources.hpp" +#include "specter/RootView.hpp" +#include "specter/Menu.hpp" -namespace Specter +namespace specter { MessageWindow::MessageWindow(ViewResources& res, View& parentView, @@ -22,11 +22,11 @@ MessageWindow::MessageWindow(ViewResources& res, View& parentView, constraint() = RectangleConstraint(400 * res.pixelFactor(), 80 * res.pixelFactor() + m_text->nominalHeight()); m_ok.m_view.reset(new Button(res, *this, &m_okBind, m_okBind.m_name, nullptr, - Button::Style::Block, Zeus::CColor::skWhite, + Button::Style::Block, zeus::CColor::skWhite, RectangleConstraint(150 * res.pixelFactor()))); if (type == Type::ConfirmOkCancel) m_cancel.m_view.reset(new Button(res, *this, &m_cancelBind, m_cancelBind.m_name, nullptr, - Button::Style::Block, Zeus::CColor::skWhite, + Button::Style::Block, zeus::CColor::skWhite, RectangleConstraint(150 * res.pixelFactor()))); updateContentOpacity(0.0); diff --git a/specter/lib/ModalWindow.cpp b/specter/lib/ModalWindow.cpp index a575fd6e9..57d7e50f7 100644 --- a/specter/lib/ModalWindow.cpp +++ b/specter/lib/ModalWindow.cpp @@ -1,8 +1,8 @@ -#include "Specter/ModalWindow.hpp" -#include "Specter/ViewResources.hpp" -#include "Specter/RootView.hpp" +#include "specter/ModalWindow.hpp" +#include "specter/ViewResources.hpp" +#include "specter/RootView.hpp" -namespace Specter +namespace specter { #define WIRE_START 0 @@ -19,17 +19,17 @@ namespace Specter void ModalWindow::setLineVerts(int width, int height, float pf, float t) { std::pair margin = m_cornersOutline[0]->queryGlyphDimensions(0); - float t1 = Zeus::Math::clamp(0.f, t * 2.f, 1.f); - float t2 = Zeus::Math::clamp(0.f, t * 2.f - 1.f, 1.f); + float t1 = zeus::clamp(0.f, t * 2.f, 1.f); + float t2 = zeus::clamp(0.f, t * 2.f - 1.f, 1.f); float lineLeft = 0; float lineRight = pf*LINE_WIDTH; float lineTop = height-margin.second; float lineBottom = margin.second; m_verts.lineVerts[0].m_pos.assign(lineLeft, lineTop, 0); - m_verts.lineVerts[1].m_pos = Zeus::CVector3f::lerp({lineLeft, lineTop, 0}, {lineLeft, lineBottom, 0}, t1); + m_verts.lineVerts[1].m_pos = zeus::CVector3f::lerp({lineLeft, lineTop, 0}, {lineLeft, lineBottom, 0}, t1); m_verts.lineVerts[2].m_pos.assign(lineRight, lineTop, 0); - m_verts.lineVerts[3].m_pos = Zeus::CVector3f::lerp({lineRight, lineTop, 0}, {lineRight, lineBottom, 0}, t1); + m_verts.lineVerts[3].m_pos = zeus::CVector3f::lerp({lineRight, lineTop, 0}, {lineRight, lineBottom, 0}, t1); m_verts.lineVerts[4].m_pos = m_verts.lineVerts[3].m_pos; lineLeft = margin.first; @@ -39,8 +39,8 @@ void ModalWindow::setLineVerts(int width, int height, float pf, float t) m_verts.lineVerts[5].m_pos.assign(lineLeft, lineTop, 0); m_verts.lineVerts[6].m_pos = m_verts.lineVerts[5].m_pos; m_verts.lineVerts[7].m_pos.assign(lineLeft, lineBottom, 0); - m_verts.lineVerts[8].m_pos = Zeus::CVector3f::lerp({lineLeft, lineTop, 0}, {lineRight, lineTop, 0}, t1); - m_verts.lineVerts[9].m_pos = Zeus::CVector3f::lerp({lineLeft, lineBottom, 0}, {lineRight, lineBottom, 0}, t1); + m_verts.lineVerts[8].m_pos = zeus::CVector3f::lerp({lineLeft, lineTop, 0}, {lineRight, lineTop, 0}, t1); + m_verts.lineVerts[9].m_pos = zeus::CVector3f::lerp({lineLeft, lineBottom, 0}, {lineRight, lineBottom, 0}, t1); m_verts.lineVerts[10].m_pos = m_verts.lineVerts[9].m_pos; lineLeft = width-pf*LINE_WIDTH; @@ -49,9 +49,9 @@ void ModalWindow::setLineVerts(int width, int height, float pf, float t) lineBottom = margin.second; m_verts.lineVerts[11].m_pos.assign(lineLeft, lineTop, 0); m_verts.lineVerts[12].m_pos = m_verts.lineVerts[11].m_pos; - m_verts.lineVerts[13].m_pos = Zeus::CVector3f::lerp({lineLeft, lineTop, 0}, {lineLeft, lineBottom, 0}, t2); + m_verts.lineVerts[13].m_pos = zeus::CVector3f::lerp({lineLeft, lineTop, 0}, {lineLeft, lineBottom, 0}, t2); m_verts.lineVerts[14].m_pos.assign(lineRight, lineTop, 0); - m_verts.lineVerts[15].m_pos = Zeus::CVector3f::lerp({lineRight, lineTop, 0}, {lineRight, lineBottom, 0}, t2); + m_verts.lineVerts[15].m_pos = zeus::CVector3f::lerp({lineRight, lineTop, 0}, {lineRight, lineBottom, 0}, t2); m_verts.lineVerts[16].m_pos = m_verts.lineVerts[15].m_pos; lineLeft = margin.first; @@ -61,23 +61,23 @@ void ModalWindow::setLineVerts(int width, int height, float pf, float t) m_verts.lineVerts[17].m_pos.assign(lineLeft, lineTop, 0); m_verts.lineVerts[18].m_pos = m_verts.lineVerts[17].m_pos; m_verts.lineVerts[19].m_pos.assign(lineLeft, lineBottom, 0); - m_verts.lineVerts[20].m_pos = Zeus::CVector3f::lerp({lineLeft, lineTop, 0}, {lineRight, lineTop, 0}, t2); - m_verts.lineVerts[21].m_pos = Zeus::CVector3f::lerp({lineLeft, lineBottom, 0}, {lineRight, lineBottom, 0}, t2); + m_verts.lineVerts[20].m_pos = zeus::CVector3f::lerp({lineLeft, lineTop, 0}, {lineRight, lineTop, 0}, t2); + m_verts.lineVerts[21].m_pos = zeus::CVector3f::lerp({lineLeft, lineBottom, 0}, {lineRight, lineBottom, 0}, t2); } void ModalWindow::setLineVertsOut(int width, int height, float pf, float t) { std::pair margin = m_cornersOutline[0]->queryGlyphDimensions(0); - float t1 = Zeus::Math::clamp(0.f, t * 2.f - 1.f, 1.f); - float t2 = Zeus::Math::clamp(0.f, t * 2.f, 1.f); + float t1 = zeus::clamp(0.f, t * 2.f - 1.f, 1.f); + float t2 = zeus::clamp(0.f, t * 2.f, 1.f); float lineLeft = 0; float lineRight = pf*LINE_WIDTH; float lineTop = height-margin.second; float lineBottom = margin.second; - m_verts.lineVerts[0].m_pos = Zeus::CVector3f::lerp({lineLeft, lineBottom, 0}, {lineLeft, lineTop, 0}, t1); + m_verts.lineVerts[0].m_pos = zeus::CVector3f::lerp({lineLeft, lineBottom, 0}, {lineLeft, lineTop, 0}, t1); m_verts.lineVerts[1].m_pos.assign(lineLeft, lineBottom, 0); - m_verts.lineVerts[2].m_pos = Zeus::CVector3f::lerp({lineRight, lineBottom, 0}, {lineRight, lineTop, 0}, t1); + m_verts.lineVerts[2].m_pos = zeus::CVector3f::lerp({lineRight, lineBottom, 0}, {lineRight, lineTop, 0}, t1); m_verts.lineVerts[3].m_pos.assign(lineRight, lineBottom, 0); m_verts.lineVerts[4].m_pos = m_verts.lineVerts[3].m_pos; @@ -85,9 +85,9 @@ void ModalWindow::setLineVertsOut(int width, int height, float pf, float t) lineRight = width-margin.first; lineTop = height; lineBottom = height-pf*LINE_WIDTH; - m_verts.lineVerts[5].m_pos = Zeus::CVector3f::lerp({lineRight, lineTop, 0}, {lineLeft, lineTop, 0}, t1); + m_verts.lineVerts[5].m_pos = zeus::CVector3f::lerp({lineRight, lineTop, 0}, {lineLeft, lineTop, 0}, t1); m_verts.lineVerts[6].m_pos = m_verts.lineVerts[5].m_pos; - m_verts.lineVerts[7].m_pos = Zeus::CVector3f::lerp({lineRight, lineBottom, 0}, {lineLeft, lineBottom, 0}, t1); + m_verts.lineVerts[7].m_pos = zeus::CVector3f::lerp({lineRight, lineBottom, 0}, {lineLeft, lineBottom, 0}, t1); m_verts.lineVerts[8].m_pos.assign(lineRight, lineTop, 0); m_verts.lineVerts[9].m_pos.assign(lineRight, lineBottom, 0); m_verts.lineVerts[10].m_pos = m_verts.lineVerts[9].m_pos; @@ -96,10 +96,10 @@ void ModalWindow::setLineVertsOut(int width, int height, float pf, float t) lineRight = width; lineTop = height-margin.second; lineBottom = margin.second; - m_verts.lineVerts[11].m_pos = Zeus::CVector3f::lerp({lineLeft, lineBottom, 0}, {lineLeft, lineTop, 0}, t2); + m_verts.lineVerts[11].m_pos = zeus::CVector3f::lerp({lineLeft, lineBottom, 0}, {lineLeft, lineTop, 0}, t2); m_verts.lineVerts[12].m_pos = m_verts.lineVerts[11].m_pos; m_verts.lineVerts[13].m_pos.assign(lineLeft, lineBottom, 0); - m_verts.lineVerts[14].m_pos = Zeus::CVector3f::lerp({lineRight, lineBottom, 0}, {lineRight, lineTop, 0}, t2); + m_verts.lineVerts[14].m_pos = zeus::CVector3f::lerp({lineRight, lineBottom, 0}, {lineRight, lineTop, 0}, t2); m_verts.lineVerts[15].m_pos.assign(lineRight, lineBottom, 0); m_verts.lineVerts[16].m_pos = m_verts.lineVerts[15].m_pos; @@ -107,34 +107,34 @@ void ModalWindow::setLineVertsOut(int width, int height, float pf, float t) lineRight = width-margin.first; lineTop = pf*LINE_WIDTH; lineBottom = 0; - m_verts.lineVerts[17].m_pos = Zeus::CVector3f::lerp({lineRight, lineTop, 0}, {lineLeft, lineTop, 0}, t2); + m_verts.lineVerts[17].m_pos = zeus::CVector3f::lerp({lineRight, lineTop, 0}, {lineLeft, lineTop, 0}, t2); m_verts.lineVerts[18].m_pos = m_verts.lineVerts[17].m_pos; - m_verts.lineVerts[19].m_pos = Zeus::CVector3f::lerp({lineRight, lineBottom, 0}, {lineLeft, lineBottom, 0}, t2); + m_verts.lineVerts[19].m_pos = zeus::CVector3f::lerp({lineRight, lineBottom, 0}, {lineLeft, lineBottom, 0}, t2); m_verts.lineVerts[20].m_pos.assign(lineRight, lineTop, 0); m_verts.lineVerts[21].m_pos.assign(lineRight, lineBottom, 0); } void ModalWindow::setLineColors(float t) { - float t1 = Zeus::Math::clamp(0.f, t * 2.f, 1.f); - float t2 = Zeus::Math::clamp(0.f, t * 2.f - 1.f, 1.f); - float t3 = Zeus::Math::clamp(0.f, t * 2.f - 2.f, 1.f); + float t1 = zeus::clamp(0.f, t * 2.f, 1.f); + float t2 = zeus::clamp(0.f, t * 2.f - 1.f, 1.f); + float t3 = zeus::clamp(0.f, t * 2.f - 2.f, 1.f); - Zeus::CColor c1 = Zeus::CColor::lerp(m_line1, m_line2, t1); - Zeus::CColor c2 = Zeus::CColor::lerp(m_line1, m_line2, t2); - Zeus::CColor c3 = Zeus::CColor::lerp(m_line1, m_line2, t3); + zeus::CColor c1 = zeus::CColor::lerp(m_line1, m_line2, t1); + zeus::CColor c2 = zeus::CColor::lerp(m_line1, m_line2, t2); + zeus::CColor c3 = zeus::CColor::lerp(m_line1, m_line2, t3); m_cornersOutline[0]->colorGlyphs(c1); if (t < 0.5) { - m_cornersOutline[1]->colorGlyphs(Zeus::CColor::skClear); - m_cornersOutline[2]->colorGlyphs(Zeus::CColor::skClear); - m_cornersOutline[3]->colorGlyphs(Zeus::CColor::skClear); + m_cornersOutline[1]->colorGlyphs(zeus::CColor::skClear); + m_cornersOutline[2]->colorGlyphs(zeus::CColor::skClear); + m_cornersOutline[3]->colorGlyphs(zeus::CColor::skClear); } else if (t < 1.0) { m_cornersOutline[1]->colorGlyphs(c2); - m_cornersOutline[2]->colorGlyphs(Zeus::CColor::skClear); + m_cornersOutline[2]->colorGlyphs(zeus::CColor::skClear); m_cornersOutline[3]->colorGlyphs(c2); } else @@ -173,25 +173,25 @@ void ModalWindow::setLineColors(float t) void ModalWindow::setLineColorsOut(float t) { - float t1 = Zeus::Math::clamp(0.f, t * 2.f, 1.f); - float t2 = Zeus::Math::clamp(0.f, t * 2.f - 1.f, 1.f); - float t3 = Zeus::Math::clamp(0.f, t * 2.f - 2.f, 1.f); + float t1 = zeus::clamp(0.f, t * 2.f, 1.f); + float t2 = zeus::clamp(0.f, t * 2.f - 1.f, 1.f); + float t3 = zeus::clamp(0.f, t * 2.f - 2.f, 1.f); - Zeus::CColor c1 = Zeus::CColor::lerp(m_line2Clear, m_line2, t1); - Zeus::CColor c2 = Zeus::CColor::lerp(m_line2Clear, m_line2, t2); - Zeus::CColor c3 = Zeus::CColor::lerp(m_line2Clear, m_line2, t3); + zeus::CColor c1 = zeus::CColor::lerp(m_line2Clear, m_line2, t1); + zeus::CColor c2 = zeus::CColor::lerp(m_line2Clear, m_line2, t2); + zeus::CColor c3 = zeus::CColor::lerp(m_line2Clear, m_line2, t3); m_cornersOutline[2]->colorGlyphs(c1); if (t < 0.5) { - m_cornersOutline[1]->colorGlyphs(Zeus::CColor::skClear); - m_cornersOutline[0]->colorGlyphs(Zeus::CColor::skClear); - m_cornersOutline[3]->colorGlyphs(Zeus::CColor::skClear); + m_cornersOutline[1]->colorGlyphs(zeus::CColor::skClear); + m_cornersOutline[0]->colorGlyphs(zeus::CColor::skClear); + m_cornersOutline[3]->colorGlyphs(zeus::CColor::skClear); } else if (t < 1.0) { m_cornersOutline[1]->colorGlyphs(c2); - m_cornersOutline[0]->colorGlyphs(Zeus::CColor::skClear); + m_cornersOutline[0]->colorGlyphs(zeus::CColor::skClear); m_cornersOutline[3]->colorGlyphs(c2); } else @@ -266,8 +266,8 @@ void ModalWindow::setFillVerts(int width, int height, float pf) void ModalWindow::setFillColors(float t) { - t = Zeus::Math::clamp(0.f, t, 1.f); - Zeus::CColor color = Zeus::CColor::lerp(m_windowBgClear, m_windowBg, t); + t = zeus::clamp(0.f, t, 1.f); + zeus::CColor color = zeus::CColor::lerp(m_windowBgClear, m_windowBg, t); for (int i=0 ; i<16 ; ++i) m_verts.fillVerts[i].m_color = color; @@ -278,7 +278,7 @@ void ModalWindow::setFillColors(float t) ModalWindow::ModalWindow(ViewResources& res, View& parentView, const RectangleConstraint& constraint) : ModalWindow(res, parentView, constraint, res.themeData().splashBackground()) {} -ModalWindow::ModalWindow(ViewResources& res, View& parentView, const RectangleConstraint& constraint, const Zeus::CColor& bgColor) +ModalWindow::ModalWindow(ViewResources& res, View& parentView, const RectangleConstraint& constraint, const zeus::CColor& bgColor) : View(res, parentView), m_constraint(constraint), m_windowBg(bgColor), @@ -297,8 +297,8 @@ ModalWindow::ModalWindow(ViewResources& res, View& parentView, const RectangleCo for (int i=0 ; i<4 ; ++i) { - m_cornersOutline[i].reset(new Specter::TextView(res, *this, res.m_curveFont, Specter::TextView::Alignment::Left, 1)); - m_cornersFilled[i].reset(new Specter::TextView(res, *this, res.m_curveFont, Specter::TextView::Alignment::Left, 1)); + m_cornersOutline[i].reset(new specter::TextView(res, *this, res.m_curveFont, specter::TextView::Alignment::Left, 1)); + m_cornersFilled[i].reset(new specter::TextView(res, *this, res.m_curveFont, specter::TextView::Alignment::Left, 1)); } m_cornersOutline[0]->typesetGlyphs(L"\xF4F0"); m_cornersFilled[0]->typesetGlyphs(L"\xF4F1", res.themeData().splashBackground()); @@ -325,7 +325,7 @@ static float CubicEase(float t) void ModalWindow::think() { - Specter::ViewResources& res = rootView().viewRes(); + specter::ViewResources& res = rootView().viewRes(); float pf = res.pixelFactor(); switch (m_phase) @@ -337,7 +337,7 @@ void ModalWindow::think() if (m_frame > WIRE_START) { float wt = (m_frame-WIRE_START) / float(WIRE_FRAMES); - wt = Zeus::Math::clamp(0.f, wt, 2.f); + wt = zeus::clamp(0.f, wt, 2.f); m_lineTime = CubicEase(wt); setLineVerts(m_width, m_height, pf, m_lineTime); setLineColors(wt); @@ -348,7 +348,7 @@ void ModalWindow::think() if (m_frame > SOLID_START) { float ft = (m_frame-SOLID_START) / float(SOLID_FRAMES); - ft = Zeus::Math::clamp(0.f, ft, 2.f); + ft = zeus::clamp(0.f, ft, 2.f); setFillColors(ft); if (ft == 2.f) ++doneCount; @@ -359,7 +359,7 @@ void ModalWindow::think() if (!m_contentStartFrame) m_contentStartFrame = m_frame; float tt = (m_frame-m_contentStartFrame) / float(CONTENT_FRAMES); - tt = Zeus::Math::clamp(0.f, tt, 1.f); + tt = zeus::clamp(0.f, tt, 1.f); updateContentOpacity(tt); if (tt == 1.f) ++doneCount; @@ -384,7 +384,7 @@ void ModalWindow::think() { { float wt = (WIRE_FRAMES - m_frame) / float(WIRE_FRAMES); - wt = Zeus::Math::clamp(0.f, wt, 1.f); + wt = zeus::clamp(0.f, wt, 1.f); m_lineTime = CubicEase(wt); setLineVertsOut(m_width, m_height, pf, m_lineTime); setLineColorsOut(wt); @@ -393,13 +393,13 @@ void ModalWindow::think() } { float ft = (SOLID_FRAMES - m_frame) / float(SOLID_FRAMES); - ft = Zeus::Math::clamp(0.f, ft, 1.f); + ft = zeus::clamp(0.f, ft, 1.f); setFillColors(ft); } if (res.fontCacheReady()) { float tt = (CONTENT_FRAMES - m_frame) / float(CONTENT_FRAMES); - tt = Zeus::Math::clamp(0.f, tt, 1.f); + tt = zeus::clamp(0.f, tt, 1.f); updateContentOpacity(tt); } m_vertsBinding.load(&m_verts, sizeof(m_verts)); @@ -415,7 +415,7 @@ bool ModalWindow::skipBuildInAnimation() if (m_phase != Phase::BuildIn) return false; - Specter::ViewResources& res = rootView().viewRes(); + specter::ViewResources& res = rootView().viewRes(); float pf = res.pixelFactor(); m_lineTime = 1.0; diff --git a/specter/lib/MultiLineTextView.cpp b/specter/lib/MultiLineTextView.cpp index eb731b03c..47c93068f 100644 --- a/specter/lib/MultiLineTextView.cpp +++ b/specter/lib/MultiLineTextView.cpp @@ -1,9 +1,9 @@ -#include "Specter/MultiLineTextView.hpp" -#include "Specter/ViewResources.hpp" +#include "specter/MultiLineTextView.hpp" +#include "specter/ViewResources.hpp" -namespace Specter +namespace specter { -static LogVisor::LogModule Log("Specter::MultiLineTextView"); +static logvisor::Module Log("specter::MultiLineTextView"); std::string MultiLineTextView::LineWrap(const std::string& str, int wrap) { @@ -22,7 +22,7 @@ std::string MultiLineTextView::LineWrap(const std::string& str, int wrap) utf8proc_int32_t ch; utf8proc_ssize_t sz = utf8proc_iterate(it, -1, &ch); if (sz < 0) - Log.report(LogVisor::FatalError, "invalid UTF-8 char"); + Log.report(logvisor::Fatal, "invalid UTF-8 char"); if (ch == '\n') { ret += '\n'; @@ -156,7 +156,7 @@ MultiLineTextView::MultiLineTextView(ViewResources& res, lineHeight) {} void MultiLineTextView::typesetGlyphs(const std::string& str, - const Zeus::CColor& defaultColor, + const zeus::CColor& defaultColor, unsigned wrap) { if (wrap) @@ -176,7 +176,7 @@ void MultiLineTextView::typesetGlyphs(const std::string& str, utf8proc_int32_t ch; utf8proc_ssize_t sz = utf8proc_iterate(it, -1, &ch); if (sz < 0) - Log.report(LogVisor::FatalError, "invalid UTF-8 char"); + Log.report(logvisor::Fatal, "invalid UTF-8 char"); if (ch == '\n' || ch == '\0') ++lineCount; rem -= sz; @@ -207,7 +207,7 @@ void MultiLineTextView::typesetGlyphs(const std::string& str, } void MultiLineTextView::typesetGlyphs(const std::wstring& str, - const Zeus::CColor& defaultColor, + const zeus::CColor& defaultColor, unsigned wrap) { if (wrap) @@ -251,7 +251,7 @@ void MultiLineTextView::typesetGlyphs(const std::wstring& str, updateSize(); } -void MultiLineTextView::colorGlyphs(const Zeus::CColor& newColor) +void MultiLineTextView::colorGlyphs(const zeus::CColor& newColor) { for (std::unique_ptr& tv : m_lines) tv->colorGlyphs(newColor); diff --git a/specter/lib/PathButtons.cpp b/specter/lib/PathButtons.cpp index a8d095d74..50f3e85ab 100644 --- a/specter/lib/PathButtons.cpp +++ b/specter/lib/PathButtons.cpp @@ -1,8 +1,8 @@ -#include "Specter/PathButtons.hpp" -#include "Specter/RootView.hpp" -#include "Specter/ViewResources.hpp" +#include "specter/PathButtons.hpp" +#include "specter/RootView.hpp" +#include "specter/ViewResources.hpp" -namespace Specter +namespace specter { PathButtons::PathButtons(ViewResources& res, View& parentView, IPathButtonsBinding& binding, bool fillContainer) @@ -12,17 +12,17 @@ PathButtons::PathButtons(ViewResources& res, View& parentView, IPathButtonsBindi setContentView(m_contentView.m_view.get()); } -void PathButtons::setButtons(const std::vector& comps) +void PathButtons::setButtons(const std::vector& comps) { m_pathButtons.clear(); m_pathButtons.reserve(comps.size()); size_t idx = 0; ViewResources& res = rootView().viewRes(); - for (const HECL::SystemString& c : comps) + for (const hecl::SystemString& c : comps) m_pathButtons.emplace_back(*this, res, idx++, c); } -void PathButtons::setMultiplyColor(const Zeus::CColor& color) +void PathButtons::setMultiplyColor(const zeus::CColor& color) { ScrollView::setMultiplyColor(color); for (PathButton& b : m_pathButtons) diff --git a/specter/lib/RootView.cpp b/specter/lib/RootView.cpp index edf202280..585bd258a 100644 --- a/specter/lib/RootView.cpp +++ b/specter/lib/RootView.cpp @@ -1,11 +1,11 @@ -#include "Specter/RootView.hpp" -#include "Specter/ViewResources.hpp" -#include "Specter/Space.hpp" -#include "Specter/Menu.hpp" +#include "specter/RootView.hpp" +#include "specter/ViewResources.hpp" +#include "specter/Space.hpp" +#include "specter/Menu.hpp" -namespace Specter +namespace specter { -static LogVisor::LogModule Log("Specter::RootView"); +static logvisor::Module Log("specter::RootView"); RootView::RootView(IViewManager& viewMan, ViewResources& res, boo::IWindow* window) : View(res), m_window(window), m_viewMan(viewMan), m_viewRes(&res), m_events(*this), @@ -25,7 +25,7 @@ RootView::SplitMenuSystem::SplitMenuSystem(RootView& rv) m_viewVertBlockBuf = rv.m_viewRes->m_factory->newDynamicBuffer(boo::BufferUse::Vertex, sizeof(View::ViewBlock), 1); m_vertsBinding.initSolid(*rv.m_viewRes, 32, m_viewVertBlockBuf); - Zeus::CColor col = {0.0,0.0,0.0,0.5}; + zeus::CColor col = {0.0,0.0,0.0,0.5}; for (int i=0 ; i<32 ; ++i) m_verts[i].m_color = col; @@ -208,7 +208,7 @@ void RootView::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton butto else if (button == boo::EMouseButton::Secondary) { m_splitMenuSystem.m_splitView = m_hoverSplitDragView; - adoptRightClickMenu(std::make_unique(*m_viewRes, *this, &m_splitMenuSystem), coord); + adoptRightClickMenu(std::make_unique(*m_viewRes, *this, &m_splitMenuSystem), coord); } return; } diff --git a/specter/lib/ScrollView.cpp b/specter/lib/ScrollView.cpp index b222c3204..e02bd0d9e 100644 --- a/specter/lib/ScrollView.cpp +++ b/specter/lib/ScrollView.cpp @@ -1,9 +1,9 @@ -#include "Specter/ScrollView.hpp" -#include "Specter/ViewResources.hpp" -#include "Specter/RootView.hpp" -#include "Specter/Button.hpp" +#include "specter/ScrollView.hpp" +#include "specter/ViewResources.hpp" +#include "specter/RootView.hpp" +#include "specter/Button.hpp" -namespace Specter +namespace specter { #define MAX_SCROLL_SPEED 100 @@ -169,7 +169,7 @@ void ScrollView::scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& updateSize(); } -void ScrollView::setMultiplyColor(const Zeus::CColor& color) +void ScrollView::setMultiplyColor(const zeus::CColor& color) { View::setMultiplyColor(color); if (m_style == Style::SideButtons) @@ -270,7 +270,7 @@ void ScrollView::resized(const boo::SWindowRect& root, const boo::SWindowRect& s m_verts[1].m_pos.assign(x, y-barHeight, 0); m_verts[2].m_pos.assign(x+2*pf, y, 0); m_verts[3].m_pos.assign(x+2*pf, y-barHeight, 0); - const Zeus::CColor& color = rootView().themeData().scrollIndicator(); + const zeus::CColor& color = rootView().themeData().scrollIndicator(); for (int i=0 ; i<4 ; ++i) m_verts[i].m_color = color; m_vertsBinding.load(m_verts, sizeof(m_verts)); diff --git a/specter/lib/Space.cpp b/specter/lib/Space.cpp index e11ed15c2..b195b24bb 100644 --- a/specter/lib/Space.cpp +++ b/specter/lib/Space.cpp @@ -1,11 +1,11 @@ -#include -#include "Specter/Space.hpp" -#include "Specter/ViewResources.hpp" -#include "Specter/RootView.hpp" +#include "logvisor/logvisor.hpp" +#include "specter/Space.hpp" +#include "specter/ViewResources.hpp" +#include "specter/RootView.hpp" -namespace Specter +namespace specter { -static LogVisor::LogModule Log("Specter::Space"); +static logvisor::Module Log("specter::Space"); #define TRIANGLE_DIM 12 #define TRIANGLE_DIM1 10 @@ -22,21 +22,21 @@ Space::Space(ViewResources& res, View& parentView, ISpaceController& controller, { commitResources(res); setBackground(res.themeData().spaceBackground()); - static const Zeus::CColor triColor = {0.75, 0.75, 0.75, 1.0}; + static const zeus::CColor triColor = {0.75, 0.75, 0.75, 1.0}; if (controller.spaceSplitAllowed()) m_cornerView.m_view.reset(new CornerView(res, *this, triColor)); if (tbPos != Toolbar::Position::None) m_toolbar.m_view.reset(new Toolbar(res, *this, tbPos, tbUnits)); } -Space::CornerView::CornerView(ViewResources& res, Space& space, const Zeus::CColor& triColor) +Space::CornerView::CornerView(ViewResources& res, Space& space, const zeus::CColor& triColor) : View(res, space), m_space(space) { m_vertexBinding.initSolid(res, 34, m_viewVertBlockBuf); float pf = res.pixelFactor(); - Zeus::CColor edgeColor1 = triColor * res.themeData().spaceTriangleShading1(); - Zeus::CColor edgeColor2 = triColor * res.themeData().spaceTriangleShading2(); + zeus::CColor edgeColor1 = triColor * res.themeData().spaceTriangleShading1(); + zeus::CColor edgeColor2 = triColor * res.themeData().spaceTriangleShading2(); View::SolidShaderVert verts[34]; verts[0].m_pos.assign(0, TRIANGLE_DIM * pf, 0); diff --git a/specter/lib/Specter.cpp b/specter/lib/Specter.cpp deleted file mode 100644 index 3cb962e87..000000000 --- a/specter/lib/Specter.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include - -namespace Specter -{ -static LogVisor::LogModule Log("Specter"); -} diff --git a/specter/lib/SplitView.cpp b/specter/lib/SplitView.cpp index 716dd00bf..7137dc1dc 100644 --- a/specter/lib/SplitView.cpp +++ b/specter/lib/SplitView.cpp @@ -1,16 +1,16 @@ -#include -#include "Specter/SplitView.hpp" -#include "Specter/RootView.hpp" -#include "Specter/ViewResources.hpp" -#include "Specter/Space.hpp" +#include "logvisor/logvisor.hpp" +#include "specter/SplitView.hpp" +#include "specter/RootView.hpp" +#include "specter/ViewResources.hpp" +#include "specter/Space.hpp" -namespace Specter +namespace specter { -static LogVisor::LogModule Log("Specter::SplitView"); +static logvisor::Module Log("specter::SplitView"); void SplitView::Resources::init(boo::IGraphicsDataFactory* factory, const IThemeData& theme) { - static const Zeus::RGBA32 tex[3] = + static const zeus::RGBA32 tex[3] = { {0,0,0,64}, {0,0,0,255}, @@ -32,7 +32,7 @@ SplitView::SplitView(ViewResources& res, View& parentView, ISplitSpaceController View* SplitView::setContentView(int slot, View* view) { if (slot < 0 || slot > 1) - Log.report(LogVisor::FatalError, "out-of-range slot to RootView::SplitView::setContentView"); + Log.report(logvisor::Fatal, "out-of-range slot to RootView::SplitView::setContentView"); View* ret = m_views[slot].m_view; m_views[slot].m_view = view; m_views[slot].m_mouseDown = 0; diff --git a/specter/lib/Table.cpp b/specter/lib/Table.cpp index 792d3f888..c477143ed 100644 --- a/specter/lib/Table.cpp +++ b/specter/lib/Table.cpp @@ -1,11 +1,11 @@ -#include "Specter/Table.hpp" -#include "Specter/ViewResources.hpp" -#include "Specter/RootView.hpp" -#include "Specter/ScrollView.hpp" +#include "specter/Table.hpp" +#include "specter/ViewResources.hpp" +#include "specter/RootView.hpp" +#include "specter/ScrollView.hpp" -namespace Specter +namespace specter { -static LogVisor::LogModule Log("Specter::Table"); +static logvisor::Module Log("specter::Table"); #define ROW_HEIGHT 18 #define CELL_MARGIN 1 @@ -15,7 +15,7 @@ Table::Table(ViewResources& res, View& parentView, ITableDataBinding* data, m_hVerts(new SolidShaderVert[maxColumns * 6]), m_rowsView(*this, res) { if (!maxColumns) - Log.report(LogVisor::FatalError, "0-column tables not supported"); + Log.report(logvisor::Fatal, "0-column tables not supported"); m_vertsBinding.initSolid(res, maxColumns * 6, m_viewVertBlockBuf); commitResources(res); @@ -64,8 +64,8 @@ void Table::_setHeaderVerts(const boo::SWindowRect& sub) for (c=0 ; c>& hv = *it; - const Zeus::CColor* c1 = &theme.button1Inactive(); - const Zeus::CColor* c2 = &theme.button2Inactive(); + const zeus::CColor* c1 = &theme.button1Inactive(); + const zeus::CColor* c2 = &theme.button2Inactive(); if (hv.m_mouseDown && hv.m_mouseIn) { c1 = &theme.button1Press(); @@ -77,19 +77,19 @@ void Table::_setHeaderVerts(const boo::SWindowRect& sub) c2 = &theme.button2Hover(); } - Zeus::CColor cm1 = *c1; - Zeus::CColor cm2 = *c2; + zeus::CColor cm1 = *c1; + zeus::CColor cm2 = *c2; if (sCol == c) { if (sDir == SortDirection::Ascending) { - cm1 *= Zeus::CColor::skGreen; - cm2 *= Zeus::CColor::skGreen; + cm1 *= zeus::CColor::skGreen; + cm2 *= zeus::CColor::skGreen; } else if (sDir == SortDirection::Descending) { - cm1 *= Zeus::CColor::skRed; - cm2 *= Zeus::CColor::skRed; + cm1 *= zeus::CColor::skRed; + cm2 *= zeus::CColor::skRed; } } @@ -143,7 +143,7 @@ void Table::RowsView::_setRowVerts(const boo::SWindowRect& sub, const boo::SWind for (r=0, c=0 ; r= scissor.location[1] ; ++r) { - const Zeus::CColor& color = (startIdx+r==m_t.m_selectedRow) ? theme.tableCellBgSelected() : + const zeus::CColor& color = (startIdx+r==m_t.m_selectedRow) ? theme.tableCellBgSelected() : ((r&1) ? theme.tableCellBg1() : theme.tableCellBg2()); int xOff = 0; auto cellRectsIt = cellRects.begin(); @@ -175,7 +175,7 @@ void Table::RowsView::_setRowVerts(const boo::SWindowRect& sub, const boo::SWind void Table::cycleSortColumn(size_t c) { if (c >= m_columns) - Log.report(LogVisor::FatalError, "cycleSortColumn out of bounds (%" PRISize ", %" PRISize ")", + Log.report(logvisor::Fatal, "cycleSortColumn out of bounds (%" PRISize ", %" PRISize ")", c, m_columns); if (m_state) { @@ -195,7 +195,7 @@ void Table::selectRow(size_t r) if (m_inSelectRow) return; if (r >= m_rows && r != -1) - Log.report(LogVisor::FatalError, "selectRow out of bounds (%" PRISize ", %" PRISize ")", + Log.report(logvisor::Fatal, "selectRow out of bounds (%" PRISize ", %" PRISize ")", r, m_rows); if (r == m_selectedRow) { @@ -270,7 +270,7 @@ void Table::selectRow(size_t r) } } -void Table::setMultiplyColor(const Zeus::CColor& color) +void Table::setMultiplyColor(const zeus::CColor& color) { View::setMultiplyColor(color); if (m_scroll.m_view) diff --git a/specter/lib/TextField.cpp b/specter/lib/TextField.cpp index 8bf47520b..3f899dd3b 100644 --- a/specter/lib/TextField.cpp +++ b/specter/lib/TextField.cpp @@ -1,8 +1,8 @@ -#include "Specter/TextField.hpp" -#include "Specter/RootView.hpp" -#include "Specter/ViewResources.hpp" +#include "specter/TextField.hpp" +#include "specter/RootView.hpp" +#include "specter/ViewResources.hpp" -namespace Specter +namespace specter { TextField::TextField(ViewResources& res, View& parentView, IStringBinding* strBind) @@ -109,13 +109,13 @@ void TextField::setInactive() const IThemeData& theme = rootView().themeData(); if (m_error) { - m_verts[0].m_color = theme.textfield1Inactive() * Zeus::CColor::skRed; - m_verts[1].m_color = theme.textfield2Inactive() * Zeus::CColor::skRed; - m_verts[2].m_color = theme.textfield1Inactive() * Zeus::CColor::skRed; - m_verts[3].m_color = theme.textfield2Inactive() * Zeus::CColor::skRed; - m_verts[4].m_color = theme.textfield2Inactive() * Zeus::CColor::skRed; + m_verts[0].m_color = theme.textfield1Inactive() * zeus::CColor::skRed; + m_verts[1].m_color = theme.textfield2Inactive() * zeus::CColor::skRed; + m_verts[2].m_color = theme.textfield1Inactive() * zeus::CColor::skRed; + m_verts[3].m_color = theme.textfield2Inactive() * zeus::CColor::skRed; + m_verts[4].m_color = theme.textfield2Inactive() * zeus::CColor::skRed; for (int i=5 ; i<28 ; ++i) - m_verts[i].m_color = theme.textfield2Inactive() * Zeus::CColor::skRed; + m_verts[i].m_color = theme.textfield2Inactive() * zeus::CColor::skRed; } else { @@ -136,13 +136,13 @@ void TextField::setHover() const IThemeData& theme = rootView().themeData(); if (m_error) { - m_verts[0].m_color = theme.textfield1Hover() * Zeus::CColor::skRed; - m_verts[1].m_color = theme.textfield2Hover() * Zeus::CColor::skRed; - m_verts[2].m_color = theme.textfield1Hover() * Zeus::CColor::skRed; - m_verts[3].m_color = theme.textfield2Hover() * Zeus::CColor::skRed; - m_verts[4].m_color = theme.textfield2Hover() * Zeus::CColor::skRed; + m_verts[0].m_color = theme.textfield1Hover() * zeus::CColor::skRed; + m_verts[1].m_color = theme.textfield2Hover() * zeus::CColor::skRed; + m_verts[2].m_color = theme.textfield1Hover() * zeus::CColor::skRed; + m_verts[3].m_color = theme.textfield2Hover() * zeus::CColor::skRed; + m_verts[4].m_color = theme.textfield2Hover() * zeus::CColor::skRed; for (int i=5 ; i<28 ; ++i) - m_verts[i].m_color = theme.textfield2Inactive() * Zeus::CColor::skRed; + m_verts[i].m_color = theme.textfield2Inactive() * zeus::CColor::skRed; } else { @@ -163,13 +163,13 @@ void TextField::setDisabled() const IThemeData& theme = rootView().themeData(); if (m_error) { - m_verts[0].m_color = theme.textfield1Disabled() * Zeus::CColor::skRed; - m_verts[1].m_color = theme.textfield2Disabled() * Zeus::CColor::skRed; - m_verts[2].m_color = theme.textfield1Disabled() * Zeus::CColor::skRed; - m_verts[3].m_color = theme.textfield2Disabled() * Zeus::CColor::skRed; - m_verts[4].m_color = theme.textfield2Disabled() * Zeus::CColor::skRed; + m_verts[0].m_color = theme.textfield1Disabled() * zeus::CColor::skRed; + m_verts[1].m_color = theme.textfield2Disabled() * zeus::CColor::skRed; + m_verts[2].m_color = theme.textfield1Disabled() * zeus::CColor::skRed; + m_verts[3].m_color = theme.textfield2Disabled() * zeus::CColor::skRed; + m_verts[4].m_color = theme.textfield2Disabled() * zeus::CColor::skRed; for (int i=5 ; i<28 ; ++i) - m_verts[i].m_color = theme.textfield2Disabled() * Zeus::CColor::skRed; + m_verts[i].m_color = theme.textfield2Disabled() * zeus::CColor::skRed; } else { @@ -579,8 +579,8 @@ void TextField::think() if (m_error && m_errorFrames <= 360) { - Zeus::CColor errMult; - Zeus::CColor errBg; + zeus::CColor errMult; + zeus::CColor errBg; if (m_errorFrames < 300) { errMult = m_viewVertBlock.m_color; @@ -588,16 +588,16 @@ void TextField::think() } else if (m_errorFrames >= 360) { - errMult = Zeus::CColor::skClear; + errMult = zeus::CColor::skClear; errBg = rootView().themeData().tooltipBackground(); errBg[3] = 0.0; } else { float t = (m_errorFrames - 300) / 60.0; - errMult = Zeus::CColor::lerp(m_viewVertBlock.m_color, Zeus::CColor::skClear, t); - errBg = Zeus::CColor::lerp(rootView().themeData().tooltipBackground() * m_viewVertBlock.m_color, - Zeus::CColor::skClear, t); + errMult = zeus::CColor::lerp(m_viewVertBlock.m_color, zeus::CColor::skClear, t); + errBg = zeus::CColor::lerp(rootView().themeData().tooltipBackground() * m_viewVertBlock.m_color, + zeus::CColor::skClear, t); } for (size_t i=32 ; i<41 ; ++i) m_verts[i].m_color = errBg; @@ -635,7 +635,7 @@ void TextField::_reallySetCursorPos(size_t pos) float pf = rootView().viewRes().pixelFactor(); int offset1 = 4 * pf + m_text->queryReverseAdvance(pos); int offset2 = offset1 + 2 * pf; - const Zeus::CColor& selColor = rootView().viewRes().themeData().textfieldSelection(); + const zeus::CColor& selColor = rootView().viewRes().themeData().textfieldSelection(); m_verts[28].m_pos.assign(offset1, 18 * pf, 0); m_verts[28].m_color = selColor; m_verts[29].m_pos.assign(offset1, 4 * pf, 0); @@ -708,8 +708,8 @@ void TextField::_reallySetSelectionRange(size_t start, size_t len) std::vector& glyphs = m_text->accessGlyphs(); offset1 += glyphs[start].m_pos[0][0]; offset2 += glyphs[start+len-1].m_pos[2][0]; - const Zeus::CColor& selColor = rootView().themeData().selectedFieldText(); - const Zeus::CColor& deselColor = m_error ? rootView().themeData().uiText() : + const zeus::CColor& selColor = rootView().themeData().selectedFieldText(); + const zeus::CColor& deselColor = m_error ? rootView().themeData().uiText() : rootView().themeData().fieldText(); for (size_t i=0 ; i& glyphs = m_text->accessGlyphs(); @@ -877,7 +877,7 @@ void TextField::resized(const boo::SWindowRect& root, const boo::SWindowRect& su m_verts[39].m_pos.assign(eX, eY + eHeight, 0); m_verts[40].m_pos.assign(eX + 14 * pf, eY + eHeight, 0); for (size_t i=32 ; i<41 ; ++i) - m_verts[i].m_color = Zeus::CColor::skClear; + m_verts[i].m_color = zeus::CColor::skClear; } m_vertsBinding.load(m_verts, sizeof(m_verts)); diff --git a/specter/lib/TextView.cpp b/specter/lib/TextView.cpp index 24f76083e..1c20e6a0c 100644 --- a/specter/lib/TextView.cpp +++ b/specter/lib/TextView.cpp @@ -1,13 +1,13 @@ -#include "Specter/TextView.hpp" -#include "Specter/ViewResources.hpp" +#include "specter/TextView.hpp" +#include "specter/ViewResources.hpp" #include "utf8proc.h" #include #include -namespace Specter +namespace specter { -static LogVisor::LogModule Log("Specter::TextView"); +static logvisor::Module Log("specter::TextView"); static const char* GLSLVS = "#version 330\n" @@ -351,7 +351,7 @@ TextView::TextView(ViewResources& res, View& parentView, const FontAtlas& font, TextView::TextView(ViewResources& res, View& parentView, FontTag font, Alignment align, size_t capacity) : TextView(res, parentView, res.m_textRes.m_fcache->lookupAtlas(font), align, capacity) {} -TextView::RenderGlyph::RenderGlyph(int& adv, const FontAtlas::Glyph& glyph, const Zeus::CColor& defaultColor) +TextView::RenderGlyph::RenderGlyph(int& adv, const FontAtlas::Glyph& glyph, const zeus::CColor& defaultColor) { m_pos[0].assign(adv + glyph.m_leftPadding, glyph.m_verticalOffset + glyph.m_height, 0.f); m_pos[1].assign(adv + glyph.m_leftPadding, glyph.m_verticalOffset, 0.f); @@ -381,7 +381,7 @@ int TextView::DoKern(FT_Pos val, const FontAtlas& atlas) return FT_PIX_ROUND(val) >> 6; } -void TextView::typesetGlyphs(const std::string& str, const Zeus::CColor& defaultColor) +void TextView::typesetGlyphs(const std::string& str, const zeus::CColor& defaultColor) { size_t rem = str.size(); const utf8proc_uint8_t* it = reinterpret_cast(str.data()); @@ -397,7 +397,7 @@ void TextView::typesetGlyphs(const std::string& str, const Zeus::CColor& default utf8proc_int32_t ch; utf8proc_ssize_t sz = utf8proc_iterate(it, -1, &ch); if (sz < 0) - Log.report(LogVisor::FatalError, "invalid UTF-8 char"); + Log.report(logvisor::Fatal, "invalid UTF-8 char"); if (ch == '\n') break; @@ -450,7 +450,7 @@ void TextView::typesetGlyphs(const std::string& str, const Zeus::CColor& default updateSize(); } -void TextView::typesetGlyphs(const std::wstring& str, const Zeus::CColor& defaultColor) +void TextView::typesetGlyphs(const std::wstring& str, const zeus::CColor& defaultColor) { uint32_t lCh = -1; m_glyphs.clear(); @@ -507,13 +507,13 @@ void TextView::typesetGlyphs(const std::wstring& str, const Zeus::CColor& defaul updateSize(); } -void TextView::colorGlyphs(const Zeus::CColor& newColor) +void TextView::colorGlyphs(const zeus::CColor& newColor) { for (RenderGlyph& glyph : m_glyphs) glyph.m_color = newColor; m_valid = false; } -void TextView::colorGlyphsTypeOn(const Zeus::CColor& newColor, float startInterval, float fadeTime) +void TextView::colorGlyphsTypeOn(const zeus::CColor& newColor, float startInterval, float fadeTime) { } void TextView::think() @@ -543,7 +543,7 @@ void TextView::draw(boo::IGraphicsCommandQueue* gfxQ) std::pair TextView::queryGlyphDimensions(size_t pos) const { if (pos >= m_glyphInfo.size()) - Log.report(LogVisor::FatalError, + Log.report(logvisor::Fatal, "TextView::queryGlyphWidth(%" PRISize ") out of bounds: %" PRISize, pos, m_glyphInfo.size()); @@ -571,7 +571,7 @@ size_t TextView::reverseSelectGlyph(int x) const int TextView::queryReverseAdvance(size_t idx) const { if (idx > m_glyphInfo.size()) - Log.report(LogVisor::FatalError, + Log.report(logvisor::Fatal, "TextView::queryReverseGlyph(%" PRISize ") out of inclusive bounds: %" PRISize, idx, m_glyphInfo.size()); if (!idx) return 0; @@ -581,7 +581,7 @@ int TextView::queryReverseAdvance(size_t idx) const std::pair TextView::queryWholeWordRange(size_t idx) const { if (idx > m_glyphInfo.size()) - Log.report(LogVisor::FatalError, + Log.report(logvisor::Fatal, "TextView::queryWholeWordRange(%" PRISize ") out of inclusive bounds: %" PRISize, idx, m_glyphInfo.size()); if (m_glyphInfo.empty()) diff --git a/specter/lib/Toolbar.cpp b/specter/lib/Toolbar.cpp index 8f346ae7c..25779a523 100644 --- a/specter/lib/Toolbar.cpp +++ b/specter/lib/Toolbar.cpp @@ -1,17 +1,17 @@ -#include -#include "Specter/Toolbar.hpp" -#include "Specter/ViewResources.hpp" -#include "Specter/RootView.hpp" +#include "logvisor/logvisor.hpp" +#include "specter/Toolbar.hpp" +#include "specter/ViewResources.hpp" +#include "specter/RootView.hpp" #define TOOLBAR_PADDING 10 -namespace Specter +namespace specter { -static LogVisor::LogModule Log("Specter::Space"); +static logvisor::Module Log("specter::Space"); void Toolbar::Resources::init(boo::IGraphicsDataFactory* factory, const IThemeData& theme) { - static const Zeus::RGBA32 tex[] = + static const zeus::RGBA32 tex[] = { {{255,255,255,64}}, {{255,255,255,64}}, @@ -123,7 +123,7 @@ void Toolbar::setVerticalVerts(int height) void Toolbar::push_back(View* v, unsigned unit) { if (unit >= m_units) - Log.report(LogVisor::FatalError, "unit %u out of range %u", unit, m_units); + Log.report(logvisor::Fatal, "unit %u out of range %u", unit, m_units); std::vector>& u = m_children[unit]; u.emplace_back(); u.back().m_view = v; diff --git a/specter/lib/Tooltip.cpp b/specter/lib/Tooltip.cpp index f91c66019..4e09febee 100644 --- a/specter/lib/Tooltip.cpp +++ b/specter/lib/Tooltip.cpp @@ -1,8 +1,8 @@ -#include "Specter/Tooltip.hpp" -#include "Specter/ViewResources.hpp" -#include "Specter/RootView.hpp" +#include "specter/Tooltip.hpp" +#include "specter/ViewResources.hpp" +#include "specter/RootView.hpp" -namespace Specter +namespace specter { #define TOOLTIP_MAX_WIDTH 316 @@ -37,7 +37,7 @@ Tooltip::Tooltip(ViewResources& res, View& parentView, const std::string& title, m_title.reset(new TextView(res, *this, res.m_heading14)); m_title->typesetGlyphs(m_titleStr); m_message.reset(new MultiLineTextView(res, *this, res.m_mainFont)); - m_message->typesetGlyphs(m_messageStr, Zeus::CColor::skWhite, + m_message->typesetGlyphs(m_messageStr, zeus::CColor::skWhite, int(TOOLTIP_MAX_TEXT_WIDTH * res.pixelFactor())); float pf = res.pixelFactor(); diff --git a/specter/lib/Translator.cpp b/specter/lib/Translator.cpp index 17d53bf9b..1725479d2 100644 --- a/specter/lib/Translator.cpp +++ b/specter/lib/Translator.cpp @@ -1,15 +1,15 @@ -#include "Specter/Translator.hpp" -#include +#include "specter/Translator.hpp" +#include "logvisor/logvisor.hpp" -namespace Specter +namespace specter { -static LogVisor::LogModule Log("Specter::Translator"); +static logvisor::Module Log("specter::Translator"); Locale::Locale(const std::string& name, const std::string& fullName, const unsigned char* yamlSource, size_t yamlLength) : m_name(name), m_fullName(fullName) { - Athena::io::YAMLDocReader reader; + athena::io::YAMLDocReader reader; yaml_parser_set_input_string(reader.getParser(), yamlSource, yamlLength); reader.parse(); m_rootNode = std::move(reader.releaseRootNode()); @@ -17,20 +17,20 @@ Locale::Locale(const std::string& name, const std::string& fullName, { m_langNode = m_rootNode->findMapChild(name.c_str()); if (!m_langNode) - Log.report(LogVisor::FatalError, "no root node '%s' found in locale", name.c_str()); + Log.report(logvisor::Fatal, "no root node '%s' found in locale", name.c_str()); } else - Log.report(LogVisor::Warning, "locale empty"); + Log.report(logvisor::Warning, "locale empty"); } void Translator::setLocale(const Locale* targetLocale) { if (!targetLocale) - Log.report(LogVisor::FatalError, "null locale"); + Log.report(logvisor::Fatal, "null locale"); m_targetLocale = targetLocale; } -static const std::string* RecursiveLookup(const Athena::io::YAMLNode* node, +static const std::string* RecursiveLookup(const athena::io::YAMLNode* node, std::string::const_iterator start, std::string::const_iterator end) { @@ -38,13 +38,13 @@ static const std::string* RecursiveLookup(const Athena::io::YAMLNode* node, { if (*it == '/') { - const Athena::io::YAMLNode* ch = node->findMapChild(std::string(start, it).c_str()); + const athena::io::YAMLNode* ch = node->findMapChild(std::string(start, it).c_str()); if (!ch) return nullptr; return RecursiveLookup(ch, it+1, end); } } - const Athena::io::YAMLNode* ch = node->findMapChild(std::string(start, end).c_str()); + const athena::io::YAMLNode* ch = node->findMapChild(std::string(start, end).c_str()); if (!ch) return nullptr; return &ch->m_scalarString; diff --git a/specter/lib/View.cpp b/specter/lib/View.cpp index 9f8a67c98..4a539ff25 100644 --- a/specter/lib/View.cpp +++ b/specter/lib/View.cpp @@ -1,10 +1,10 @@ -#include "Specter/View.hpp" -#include "Specter/ViewResources.hpp" -#include "Specter/RootView.hpp" +#include "specter/View.hpp" +#include "specter/ViewResources.hpp" +#include "specter/RootView.hpp" -namespace Specter +namespace specter { -static LogVisor::LogModule Log("Specter::View"); +static logvisor::Module Log("specter::View"); static const char* GLSLSolidVS = "#version 330\n" @@ -375,7 +375,7 @@ void View::draw(boo::IGraphicsCommandQueue* gfxQ) void View::commitResources(ViewResources& res) { if (m_gfxData) - Log.report(LogVisor::FatalError, "multiple resource commits not allowed"); + Log.report(logvisor::Fatal, "multiple resource commits not allowed"); m_gfxData = res.m_factory->commit(); } diff --git a/specter/lib/ViewResources.cpp b/specter/lib/ViewResources.cpp index d8b58b917..8111b55f2 100644 --- a/specter/lib/ViewResources.cpp +++ b/specter/lib/ViewResources.cpp @@ -1,14 +1,14 @@ -#include "Specter/ViewResources.hpp" +#include "specter/ViewResources.hpp" -namespace Specter +namespace specter { -static LogVisor::LogModule Log("Specter::ViewResources"); +static logvisor::Module Log("specter::ViewResources"); void ViewResources::init(boo::IGraphicsDataFactory* factory, FontCache* fcache, const IThemeData* theme, float pf) { if (!factory || !fcache || !theme) - Log.report(LogVisor::FatalError, "all arguments of ViewResources::init() must be non-null"); + Log.report(logvisor::Fatal, "all arguments of ViewResources::init() must be non-null"); m_pixelFactor = pf; m_theme = theme; m_factory = factory; @@ -37,7 +37,7 @@ void ViewResources::init(boo::IGraphicsDataFactory* factory, FontCache* fcache, break; #endif default: - Log.report(LogVisor::FatalError, _S("unable to init view system for %s"), factory->platformName()); + Log.report(logvisor::Fatal, _S("unable to init view system for %s"), factory->platformName()); } m_resData = factory->commit(); } diff --git a/specter/lib/specter.cpp b/specter/lib/specter.cpp new file mode 100644 index 000000000..0d1467d6b --- /dev/null +++ b/specter/lib/specter.cpp @@ -0,0 +1,6 @@ +#include "logvisor/logvisor.hpp" + +namespace specter +{ +static logvisor::Module Log("Specter"); +} diff --git a/specter/resources/fonts/CMakeLists.txt b/specter/resources/fonts/CMakeLists.txt index 925b90bfe..3ac15ce6a 100644 --- a/specter/resources/fonts/CMakeLists.txt +++ b/specter/resources/fonts/CMakeLists.txt @@ -1,4 +1,4 @@ bintoc(droidsans-permissive.c droidsans-permissive.ttf.gz DROIDSANS_PERMISSIVE) bintoc(bmonofont-i18n.c bmonofont-i18n.ttf.gz BMONOFONT) bintoc(SpecterCurveGlyphs.c SpecterCurveGlyphs.ttf.gz SPECTERCURVES) -add_library(SpecterFonts droidsans-permissive.c bmonofont-i18n.c SpecterCurveGlyphs.c) +add_library(specter-fonts droidsans-permissive.c bmonofont-i18n.c SpecterCurveGlyphs.c) diff --git a/specter/zeus b/specter/zeus index cd28979d0..a76d43d5d 160000 --- a/specter/zeus +++ b/specter/zeus @@ -1 +1 @@ -Subproject commit cd28979d0aa17f08b7244e7e3aac5a9c8ef0e8ae +Subproject commit a76d43d5df9f0bd533ee4806fa6ae34d5d93ff0b