Humungous refactor

This commit is contained in:
Jack Andersen 2016-03-04 13:03:47 -10:00
parent 2c9dcbd50f
commit f467cf019c
59 changed files with 744 additions and 744 deletions

View File

@ -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})

View File

@ -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 <thread>
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 <class Factory>
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

View File

@ -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<TextView> m_text;
std::unique_ptr<IconView> 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<std::unique_ptr<View>>& getMenu() {return m_modalMenu;}
void setMultiplyColor(const Zeus::CColor& color)
void setMultiplyColor(const zeus::CColor& color)
{
View::setMultiplyColor(color);
m_viewVertBlock.m_color = color;

View File

@ -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<View> buildMenu(const Specter::Button* button) {return std::unique_ptr<View>();}
virtual std::unique_ptr<View> buildMenu(const specter::Button* button) {return std::unique_ptr<View>();}
};
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();}

View File

@ -5,7 +5,7 @@
#include <mutex>
#include <condition_variable>
namespace Specter
namespace specter
{
template <class Receiver>

View File

@ -11,9 +11,9 @@
#include "IViewManager.hpp"
#include "MessageWindow.hpp"
#include "PathButtons.hpp"
#include <HECL/HECL.hpp>
#include <hecl/hecl.hpp>
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<HECL::SystemString> m_comps;
hecl::SystemString m_path;
std::vector<hecl::SystemString> 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<HECL::SystemString, std::string>&& path)
Entry(std::pair<hecl::SystemString, std::string>&& 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<TextView> m_recentBookmarksLabel;
ViewChild<std::unique_ptr<Table>> m_recentBookmarks;
std::function<void(bool, const HECL::SystemString&)> m_returnFunc;
std::function<void(bool, const hecl::SystemString&)> m_returnFunc;
public:
FileBrowser(ViewResources& res, View& parentView, const std::string& title, Type type,
std::function<void(bool, const HECL::SystemString&)> returnFunc)
: FileBrowser(res, parentView, title, type, HECL::GetcwdStr(), returnFunc) {}
std::function<void(bool, const hecl::SystemString&)> 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<void(bool, const HECL::SystemString&)> returnFunc);
const hecl::SystemString& initialPath,
std::function<void(bool, const hecl::SystemString&)> returnFunc);
static std::vector<HECL::SystemString> PathComponents(const HECL::SystemString& path);
static std::vector<hecl::SystemString> 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)
{

View File

@ -5,11 +5,11 @@
#include FT_FREETYPE_H
#include <boo/boo.hpp>
#include <HECL/Runtime.hpp>
#include <Athena/FileReader.hpp>
#include <Athena/FileWriter.hpp>
#include <hecl/Runtime.hpp>
#include <athena/FileReader.hpp>
#include <athena/FileWriter.hpp>
namespace Specter
namespace specter
{
class FontTag
{
@ -26,14 +26,14 @@ public:
namespace std
{
template <> struct hash<Specter::FontTag>
template <> struct hash<specter::FontTag>
{
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<Glyph> m_glyphs;
std::unordered_map<atUint16, std::vector<std::pair<atUint16, atInt16>>> m_kernAdjs;
struct TT_KernHead : Athena::io::DNA<Athena::BigEndian>
struct TT_KernHead : athena::io::DNA<athena::BigEndian>
{
DECL_DNA
Value<atUint32> length;
Value<atUint16> coverage;
};
struct TT_KernSubHead : Athena::io::DNA<Athena::BigEndian>
struct TT_KernSubHead : athena::io::DNA<athena::BigEndian>
{
DECL_DNA
Value<atUint16> nPairs;
@ -101,7 +101,7 @@ private:
Value<atUint16> rangeShift;
};
struct TT_KernPair : Athena::io::DNA<Athena::BigEndian>
struct TT_KernPair : athena::io::DNA<athena::BigEndian>
{
DECL_DNA
Value<atUint16> 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<FontTag, std::unique_ptr<FontAtlas>> 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;

View File

@ -3,7 +3,7 @@
#include "View.hpp"
namespace Specter
namespace specter
{
struct IMenuNode

View File

@ -3,9 +3,9 @@
#include "Translator.hpp"
#include "SplitView.hpp"
#include <HECL/HECL.hpp>
#include <hecl/hecl.hpp>
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<HECL::SystemString>* recentProjects() const {return nullptr;}
virtual void pushRecentProject(const HECL::SystemString& path) {}
virtual const std::vector<hecl::SystemString>* recentProjects() const {return nullptr;}
virtual void pushRecentProject(const hecl::SystemString& path) {}
virtual const std::vector<HECL::SystemString>* recentFiles() const {return nullptr;}
virtual void pushRecentFile(const HECL::SystemString& path) {}
virtual const std::vector<hecl::SystemString>* recentFiles() const {return nullptr;}
virtual void pushRecentFile(const hecl::SystemString& path) {}
};
}

View File

@ -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)

View File

@ -6,7 +6,7 @@
#include "ScrollView.hpp"
#include "IMenuNode.hpp"
namespace Specter
namespace specter
{
class Menu : public View

View File

@ -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);

View File

@ -1,10 +1,10 @@
#ifndef SPECTER_MODAL_WINDOW_HPP
#define SPECTER_MODAL_WINDOW_HPP
#include <Specter/View.hpp>
#include <Specter/MultiLineTextView.hpp>
#include <specter/View.hpp>
#include <specter/MultiLineTextView.hpp>
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();

View File

@ -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<TextView>& l : m_lines)
l->setMultiplyColor(color);

View File

@ -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;

View File

@ -1,7 +1,7 @@
#ifndef SPECTER_OUTLINER_HPP
#define SPECTER_OUTLINER_HPP
namespace Specter
namespace specter
{
class Outliner
{

View File

@ -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<std::unique_ptr<Button>> 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<HECL::SystemString>& comps);
void setMultiplyColor(const Zeus::CColor& color);
void setButtons(const std::vector<hecl::SystemString>& 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);

View File

@ -13,7 +13,7 @@
#include "IViewManager.hpp"
#include <boo/boo.hpp>
namespace Specter
namespace specter
{
class RootView : public View

View File

@ -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);

View File

@ -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)

View File

@ -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;

View File

@ -6,7 +6,7 @@
#include "TextView.hpp"
#include <array>
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);

View File

@ -5,7 +5,7 @@
#include "TextView.hpp"
#include <boo/IWindow.hpp>
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;

View File

@ -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);

View File

@ -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<ViewChild<View*>>& u : m_children)

View File

@ -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

View File

@ -2,23 +2,23 @@
#define SPECTER_TRANSLATOR_HPP
#include <string>
#include <Athena/DNAYaml.hpp>
#include <athena/DNAYaml.hpp>
namespace Specter
namespace specter
{
class Locale
{
std::string m_name;
std::string m_fullName;
std::unique_ptr<Athena::io::YAMLNode> m_rootNode;
const Athena::io::YAMLNode* m_langNode;
std::unique_ptr<athena::io::YAMLNode> 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

View File

@ -2,18 +2,18 @@
#define SPECTER_VIEW_HPP
#include <boo/boo.hpp>
#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 <boo/graphicsdev/GL.hpp>
#include <boo/graphicsdev/D3D.hpp>
#include <boo/graphicsdev/Metal.hpp>
#include <boo/graphicsdev/Vulkan.hpp>
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));

View File

@ -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 <thread>
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 <class Factory>
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

View File

@ -1,11 +1,11 @@
#include <LogVisor/LogVisor.hpp>
#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<IButtonBinding&>(*m_button.m_controlBinding).buildMenu(&m_button);
@ -439,7 +439,7 @@ void Button::ButtonTarget::mouseUp(const boo::SWindowCoord& coord, boo::EMouseBu
static_cast<IButtonBinding&>(*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<IButtonBinding&>(*m_button.m_controlBinding).activated(&m_button, coord);
}

View File

@ -1,6 +1,6 @@
#include "Specter/Control.hpp"
#include "specter/Control.hpp"
namespace Specter
namespace specter
{
Control::Control(ViewResources& res, View& parentView,

View File

@ -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<HECL::SystemString> FileBrowser::PathComponents(const HECL::SystemString& path)
std::vector<hecl::SystemString> FileBrowser::PathComponents(const hecl::SystemString& path)
{
std::vector<HECL::SystemString> ret;
HECL::SystemString sPath = path;
HECL::SanitizePath(sPath);
std::vector<hecl::SystemString> ret;
hecl::SystemString sPath = path;
hecl::SanitizePath(sPath);
if (sPath.empty())
return ret;
auto it = sPath.cbegin();
@ -23,7 +23,7 @@ std::vector<HECL::SystemString> 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<HECL::SystemString> FileBrowser::PathComponents(const HECL::SystemSt
}
FileBrowser::FileBrowser(ViewResources& res, View& parentView, const std::string& title,
Type type, const HECL::SystemString& initialPath,
std::function<void(bool, const HECL::SystemString&)> returnFunc)
Type type, const hecl::SystemString& initialPath,
std::function<void(bool, const hecl::SystemString&)> 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<std::pair<HECL::SystemString, std::string>> systemLocs = HECL::GetSystemLocations();
std::vector<std::pair<hecl::SystemString, std::string>> systemLocs = hecl::GetSystemLocations();
for (auto& loc : systemLocs)
m_systemBookmarkBind.m_entries.emplace_back(std::move(loc));
m_systemBookmarks.m_view->updateData();
const std::vector<HECL::SystemString>* recentProjects = vm.recentProjects();
const std::vector<hecl::SystemString>* recentProjects = vm.recentProjects();
for (auto& proj : *recentProjects)
m_projectBookmarkBind.m_entries.emplace_back(proj);
m_projectBookmarks.m_view->updateData();
const std::vector<HECL::SystemString>* recentFiles = vm.recentFiles();
const std::vector<hecl::SystemString>* 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('/');

View File

@ -2,9 +2,9 @@
#define NOMINMAX 1
#endif
#include "Specter/FontCache.hpp"
#include <LogVisor/LogVisor.hpp>
#include <Athena/MemoryReader.hpp>
#include "specter/FontCache.hpp"
#include "logvisor/logvisor.hpp"
#include <athena/MemoryReader.hpp>
#include <stdint.h>
#include <zlib.h>
@ -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<TT_Face>(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<nSubs ; ++i)
@ -164,7 +164,7 @@ void FontAtlas::buildKernTable(FT_Face face)
kernHead.read(r);
if (kernHead.coverage >> 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<FontAtlas>(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();
}

View File

@ -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)

View File

@ -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());
}

View File

@ -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);

View File

@ -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<int,int> 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<int,int> 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;

View File

@ -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<TextView>& tv : m_lines)
tv->colorGlyphs(newColor);

View File

@ -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<HECL::SystemString>& comps)
void PathButtons::setButtons(const std::vector<hecl::SystemString>& 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)

View File

@ -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<Specter::Menu>(*m_viewRes, *this, &m_splitMenuSystem), coord);
adoptRightClickMenu(std::make_unique<specter::Menu>(*m_viewRes, *this, &m_splitMenuSystem), coord);
}
return;
}

View File

@ -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));

View File

@ -1,11 +1,11 @@
#include <LogVisor/LogVisor.hpp>
#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);

View File

@ -1,6 +0,0 @@
#include <LogVisor/LogVisor.hpp>
namespace Specter
{
static LogVisor::LogModule Log("Specter");
}

View File

@ -1,16 +1,16 @@
#include <LogVisor/LogVisor.hpp>
#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;

View File

@ -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<std::min(m_maxColumns, m_columns) ; ++c)
{
const ViewChild<std::unique_ptr<CellView>>& 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<SPECTER_TABLE_MAX_ROWS &&
(sub.location[1] + yOff + spacing) >= 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)

View File

@ -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<TextView::RenderGlyph>& 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.size() ; ++i)
@ -741,7 +741,7 @@ void TextField::_reallySetMarkRange(size_t start, size_t len)
offset1 += glyphs[start].m_pos[0][0];
offset2 += glyphs[start+len-1].m_pos[2][0];
const Zeus::CColor& selColor = rootView().themeData().textfieldMarkSelection();
const zeus::CColor& selColor = rootView().themeData().textfieldMarkSelection();
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);
@ -793,7 +793,7 @@ void TextField::_clearSelectionRange()
m_selectionStart = 0;
m_selectionCount = 0;
const Zeus::CColor& deselColor = m_error ? rootView().themeData().uiText() :
const zeus::CColor& deselColor = m_error ? rootView().themeData().uiText() :
rootView().themeData().fieldText();
std::vector<TextView::RenderGlyph>& 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));

View File

@ -1,13 +1,13 @@
#include "Specter/TextView.hpp"
#include "Specter/ViewResources.hpp"
#include "specter/TextView.hpp"
#include "specter/ViewResources.hpp"
#include "utf8proc.h"
#include <freetype/internal/internal.h>
#include <freetype/internal/ftobjs.h>
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<const utf8proc_uint8_t*>(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<int,int> 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<size_t,size_t> 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())

View File

@ -1,17 +1,17 @@
#include <LogVisor/LogVisor.hpp>
#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<ViewChild<View*>>& u = m_children[unit];
u.emplace_back();
u.back().m_view = v;

View File

@ -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();

View File

@ -1,15 +1,15 @@
#include "Specter/Translator.hpp"
#include <LogVisor/LogVisor.hpp>
#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;

View File

@ -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();
}

View File

@ -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();
}

6
specter/lib/specter.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "logvisor/logvisor.hpp"
namespace specter
{
static logvisor::Module Log("Specter");
}

View File

@ -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)

@ -1 +1 @@
Subproject commit cd28979d0aa17f08b7244e7e3aac5a9c8ef0e8ae
Subproject commit a76d43d5df9f0bd533ee4806fa6ae34d5d93ff0b