mirror of https://github.com/AxioDL/metaforce.git
General: Include headers where applicable
Ensures necessary dependencies are always included where applicable, as well as avoiding including dependencies where they aren't necessary.
This commit is contained in:
parent
50a7f7a860
commit
21dece5b1e
|
@ -1,12 +1,24 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "specter/TextView.hpp"
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "specter/Control.hpp"
|
#include "specter/Control.hpp"
|
||||||
#include "specter/Icon.hpp"
|
#include "specter/View.hpp"
|
||||||
|
|
||||||
|
#include <boo/IWindow.hpp>
|
||||||
|
#include <zeus/CColor.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
class IconView;
|
||||||
|
class TextView;
|
||||||
|
|
||||||
|
struct Icon;
|
||||||
|
|
||||||
class Button : public Control {
|
class Button : public Control {
|
||||||
|
struct ButtonTarget;
|
||||||
|
struct MenuTarget;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class Style {
|
enum class Style {
|
||||||
Block,
|
Block,
|
||||||
|
@ -28,65 +40,34 @@ private:
|
||||||
void _loadVerts() { m_vertsBinding.load<decltype(m_verts)>(m_verts); }
|
void _loadVerts() { m_vertsBinding.load<decltype(m_verts)>(m_verts); }
|
||||||
|
|
||||||
RectangleConstraint m_constraint;
|
RectangleConstraint m_constraint;
|
||||||
int m_nomWidth, m_nomHeight;
|
|
||||||
int m_textWidth, m_textIconWidth;
|
|
||||||
|
|
||||||
struct ButtonTarget : View {
|
int m_nomWidth;
|
||||||
Button& m_button;
|
int m_nomHeight;
|
||||||
|
|
||||||
bool m_pressed = false;
|
int m_textWidth;
|
||||||
bool m_hovered = false;
|
int m_textIconWidth;
|
||||||
|
|
||||||
void setInactive();
|
|
||||||
void setHover();
|
|
||||||
void setPressed();
|
|
||||||
void setDisabled();
|
|
||||||
|
|
||||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
|
||||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
|
||||||
void mouseEnter(const boo::SWindowCoord&) override;
|
|
||||||
void mouseLeave(const boo::SWindowCoord&) override;
|
|
||||||
ButtonTarget(ViewResources& res, Button& button) : View(res, button), m_button(button) {}
|
|
||||||
};
|
|
||||||
ViewChild<std::unique_ptr<ButtonTarget>> m_buttonTarget;
|
ViewChild<std::unique_ptr<ButtonTarget>> m_buttonTarget;
|
||||||
|
|
||||||
struct MenuTarget : View {
|
|
||||||
Button& m_button;
|
|
||||||
|
|
||||||
bool m_pressed = false;
|
|
||||||
bool m_hovered = false;
|
|
||||||
|
|
||||||
void setInactive();
|
|
||||||
void setHover();
|
|
||||||
void setPressed();
|
|
||||||
void setDisabled();
|
|
||||||
|
|
||||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
|
||||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
|
||||||
void mouseEnter(const boo::SWindowCoord&) override;
|
|
||||||
void mouseLeave(const boo::SWindowCoord&) override;
|
|
||||||
MenuTarget(ViewResources& res, Button& button) : View(res, button), m_button(button) {}
|
|
||||||
};
|
|
||||||
ViewChild<std::unique_ptr<MenuTarget>> m_menuTarget;
|
ViewChild<std::unique_ptr<MenuTarget>> m_menuTarget;
|
||||||
|
|
||||||
ViewChild<std::unique_ptr<View>> m_modalMenu;
|
ViewChild<std::unique_ptr<View>> m_modalMenu;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class Resources {
|
class Resources {
|
||||||
friend class ViewResources;
|
|
||||||
friend class Button;
|
friend class Button;
|
||||||
|
friend class ViewResources;
|
||||||
|
|
||||||
void init(boo::IGraphicsDataFactory::Context& ctx, const IThemeData& theme);
|
void init(boo::IGraphicsDataFactory::Context& ctx, const IThemeData& theme);
|
||||||
void destroy() {}
|
void destroy() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
~Button() override { closeMenu({}); }
|
|
||||||
Button(ViewResources& res, View& parentView, IButtonBinding* controlBinding, std::string_view text,
|
Button(ViewResources& res, View& parentView, IButtonBinding* controlBinding, std::string_view text,
|
||||||
Icon* icon = nullptr, Style style = Style::Block, const zeus::CColor& bgColor = zeus::skWhite,
|
Icon* icon = nullptr, Style style = Style::Block, const zeus::CColor& bgColor = zeus::skWhite,
|
||||||
RectangleConstraint constraint = RectangleConstraint());
|
RectangleConstraint constraint = RectangleConstraint());
|
||||||
Button(ViewResources& res, View& parentView, IButtonBinding* controlBinding, std::string_view text,
|
Button(ViewResources& res, View& parentView, IButtonBinding* controlBinding, std::string_view text,
|
||||||
const zeus::CColor& textColor, Icon* icon = nullptr, Style style = Style::Block,
|
const zeus::CColor& textColor, Icon* icon = nullptr, Style style = Style::Block,
|
||||||
const zeus::CColor& bgColor = zeus::skWhite, RectangleConstraint constraint = RectangleConstraint());
|
const zeus::CColor& bgColor = zeus::skWhite, RectangleConstraint constraint = RectangleConstraint());
|
||||||
|
~Button() override;
|
||||||
|
|
||||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
void mouseMove(const boo::SWindowCoord&) override;
|
void mouseMove(const boo::SWindowCoord&) override;
|
||||||
|
@ -106,15 +87,7 @@ public:
|
||||||
void closeMenu(const boo::SWindowCoord& coord);
|
void closeMenu(const boo::SWindowCoord& coord);
|
||||||
ViewChild<std::unique_ptr<View>>& getMenu() { return m_modalMenu; }
|
ViewChild<std::unique_ptr<View>>& getMenu() { return m_modalMenu; }
|
||||||
|
|
||||||
void setMultiplyColor(const zeus::CColor& color) override {
|
void setMultiplyColor(const zeus::CColor& color) override;
|
||||||
View::setMultiplyColor(color);
|
|
||||||
m_viewVertBlock.m_color = color;
|
|
||||||
if (m_viewVertBlockBuf)
|
|
||||||
m_viewVertBlockBuf.access().finalAssign(m_viewVertBlock);
|
|
||||||
m_text->setMultiplyColor(color);
|
|
||||||
if (m_icon)
|
|
||||||
m_icon->setMultiplyColor(color);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace specter
|
} // namespace specter
|
||||||
|
|
|
@ -1,6 +1,19 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "View.hpp"
|
#include <cfloat>
|
||||||
|
#include <climits>
|
||||||
|
#include <memory>
|
||||||
|
#include <mutex>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "specter/View.hpp"
|
||||||
|
|
||||||
|
#include <boo/IWindow.hpp>
|
||||||
|
|
||||||
|
namespace hecl {
|
||||||
|
class CVar;
|
||||||
|
}
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
class Control;
|
class Control;
|
||||||
|
@ -41,7 +54,7 @@ struct IButtonBinding : IControlBinding {
|
||||||
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 */
|
/** 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 nullptr; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IFloatBinding : IControlBinding {
|
struct IFloatBinding : IControlBinding {
|
||||||
|
@ -80,8 +93,8 @@ struct CVarControlBinding : IControlBinding {
|
||||||
static CVarControlBinding* castTo(IControlBinding* bind) {
|
static CVarControlBinding* castTo(IControlBinding* bind) {
|
||||||
return bind->type() == ControlType::CVar ? static_cast<CVarControlBinding*>(bind) : nullptr;
|
return bind->type() == ControlType::CVar ? static_cast<CVarControlBinding*>(bind) : nullptr;
|
||||||
}
|
}
|
||||||
std::string_view name(const Control* control) const override { return m_cvar->name(); }
|
std::string_view name(const Control* control) const override;
|
||||||
std::string_view help(const Control* control) const override { return m_cvar->rawHelp(); }
|
std::string_view help(const Control* control) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Control : public View {
|
class Control : public View {
|
||||||
|
|
|
@ -1,18 +1,28 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "View.hpp"
|
#include <cstddef>
|
||||||
#include "ModalWindow.hpp"
|
#include <functional>
|
||||||
#include "Button.hpp"
|
#include <memory>
|
||||||
#include "TextField.hpp"
|
#include <string>
|
||||||
#include "ScrollView.hpp"
|
#include <vector>
|
||||||
#include "Table.hpp"
|
|
||||||
#include "ViewResources.hpp"
|
#include "specter/ModalWindow.hpp"
|
||||||
#include "IViewManager.hpp"
|
#include "specter/PathButtons.hpp"
|
||||||
#include "MessageWindow.hpp"
|
#include "specter/Table.hpp"
|
||||||
#include "PathButtons.hpp"
|
#include "specter/View.hpp"
|
||||||
#include <hecl/hecl.hpp>
|
#include "specter/ViewResources.hpp"
|
||||||
|
|
||||||
|
#include <hecl/SystemChar.hpp>
|
||||||
|
|
||||||
|
namespace hecl {
|
||||||
|
class DirectoryEnumerator;
|
||||||
|
}
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
class MessageWindow;
|
||||||
|
class TextField;
|
||||||
|
|
||||||
|
struct IViewManager;
|
||||||
|
|
||||||
class FileBrowser : public ModalWindow, public IPathButtonsBinding {
|
class FileBrowser : public ModalWindow, public IPathButtonsBinding {
|
||||||
public:
|
public:
|
||||||
|
@ -47,11 +57,7 @@ private:
|
||||||
FileBrowser& m_fb;
|
FileBrowser& m_fb;
|
||||||
ViewChild<std::unique_ptr<Button>> m_button;
|
ViewChild<std::unique_ptr<Button>> m_button;
|
||||||
std::string m_text;
|
std::string m_text;
|
||||||
OKButton(FileBrowser& fb, ViewResources& res, std::string_view text) : m_fb(fb), m_text(text) {
|
OKButton(FileBrowser& fb, ViewResources& res, std::string_view text);
|
||||||
m_button.m_view.reset(
|
|
||||||
new Button(res, fb, this, text, nullptr, Button::Style::Block, zeus::skWhite,
|
|
||||||
RectangleConstraint(100 * res.pixelFactor(), -1, RectangleConstraint::Test::Minimum)));
|
|
||||||
}
|
|
||||||
std::string_view name(const Control* control) const override { return m_text; }
|
std::string_view name(const Control* control) const override { return m_text; }
|
||||||
void activated(const Button* button, const boo::SWindowCoord&) override { m_fb.okActivated(true); }
|
void activated(const Button* button, const boo::SWindowCoord&) override { m_fb.okActivated(true); }
|
||||||
} m_ok;
|
} m_ok;
|
||||||
|
@ -61,11 +67,7 @@ private:
|
||||||
FileBrowser& m_fb;
|
FileBrowser& m_fb;
|
||||||
ViewChild<std::unique_ptr<Button>> m_button;
|
ViewChild<std::unique_ptr<Button>> m_button;
|
||||||
std::string m_text;
|
std::string m_text;
|
||||||
CancelButton(FileBrowser& fb, ViewResources& res, std::string_view text) : m_fb(fb), m_text(text) {
|
CancelButton(FileBrowser& fb, ViewResources& res, std::string_view text);
|
||||||
m_button.m_view.reset(new Button(
|
|
||||||
res, fb, this, text, nullptr, Button::Style::Block, zeus::skWhite,
|
|
||||||
RectangleConstraint(m_fb.m_ok.m_button.m_view->nominalWidth(), -1, RectangleConstraint::Test::Minimum)));
|
|
||||||
}
|
|
||||||
std::string_view name(const Control* control) const override { return m_text; }
|
std::string_view name(const Control* control) const override { return m_text; }
|
||||||
void activated(const Button* button, const boo::SWindowCoord&) override { m_fb.cancelActivated(); }
|
void activated(const Button* button, const boo::SWindowCoord&) override { m_fb.cancelActivated(); }
|
||||||
} m_cancel;
|
} m_cancel;
|
||||||
|
@ -77,8 +79,7 @@ private:
|
||||||
struct FileFieldBind : IStringBinding {
|
struct FileFieldBind : IStringBinding {
|
||||||
FileBrowser& m_browser;
|
FileBrowser& m_browser;
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
FileFieldBind(FileBrowser& browser, const IViewManager& vm)
|
FileFieldBind(FileBrowser& browser, const IViewManager& vm);
|
||||||
: m_browser(browser), m_name(vm.translate<locale::file_name>()) {}
|
|
||||||
std::string_view name(const Control* control) const override { return m_name; }
|
std::string_view name(const Control* control) const override { return m_name; }
|
||||||
void changed(const Control* control, std::string_view val) override {}
|
void changed(const Control* control, std::string_view val) override {}
|
||||||
} m_fileFieldBind;
|
} m_fileFieldBind;
|
||||||
|
@ -143,30 +144,7 @@ private:
|
||||||
|
|
||||||
void setColumnSplit(size_t cIdx, float split) override { m_columnSplits[cIdx] = split; }
|
void setColumnSplit(size_t cIdx, float split) override { 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) {
|
|
||||||
m_entries.emplace_back();
|
|
||||||
Entry& ent = m_entries.back();
|
|
||||||
ent.m_path = d.m_path;
|
|
||||||
hecl::SystemUTF8Conv nameUtf8(d.m_name);
|
|
||||||
ent.m_name = nameUtf8.str();
|
|
||||||
if (d.m_isDir) {
|
|
||||||
if (hecl::SearchForProject(d.m_path))
|
|
||||||
ent.m_type = m_projStr;
|
|
||||||
else
|
|
||||||
ent.m_type = m_dirStr;
|
|
||||||
} 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_needsUpdate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool m_sizeSort = false;
|
bool m_sizeSort = false;
|
||||||
SortDirection m_sortDir = SortDirection::Ascending;
|
SortDirection m_sortDir = SortDirection::Ascending;
|
||||||
|
@ -185,25 +163,11 @@ private:
|
||||||
m_needsUpdate = true;
|
m_needsUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSelectedRow(size_t rIdx) override {
|
void setSelectedRow(size_t rIdx) override;
|
||||||
if (rIdx != SIZE_MAX)
|
|
||||||
m_fb.m_fileField.m_view->setText(m_entries.at(rIdx).m_name);
|
|
||||||
else
|
|
||||||
m_fb.m_fileField.m_view->setText("");
|
|
||||||
m_fb.m_fileField.m_view->clearErrorState();
|
|
||||||
}
|
|
||||||
|
|
||||||
void rowActivated(size_t rIdx) override { m_fb.okActivated(false); }
|
void rowActivated(size_t rIdx) override { m_fb.okActivated(false); }
|
||||||
|
|
||||||
FileListingDataBind(FileBrowser& fb, const IViewManager& vm) : m_fb(fb) {
|
FileListingDataBind(FileBrowser& fb, const IViewManager& vm);
|
||||||
m_nameCol = vm.translate<locale::name>();
|
|
||||||
m_typeCol = vm.translate<locale::type>();
|
|
||||||
m_sizeCol = vm.translate<locale::size>();
|
|
||||||
m_dirStr = vm.translate<locale::directory>();
|
|
||||||
m_projStr = vm.translate<locale::hecl_project>();
|
|
||||||
m_fileStr = vm.translate<locale::file>();
|
|
||||||
}
|
|
||||||
|
|
||||||
} m_fileListingBind;
|
} m_fileListingBind;
|
||||||
ViewChild<std::unique_ptr<Table>> m_fileListing;
|
ViewChild<std::unique_ptr<Table>> m_fileListing;
|
||||||
|
|
||||||
|
@ -266,6 +230,7 @@ public:
|
||||||
: FileBrowser(res, parentView, title, type, hecl::GetcwdStr(), returnFunc) {}
|
: FileBrowser(res, parentView, title, type, hecl::GetcwdStr(), returnFunc) {}
|
||||||
FileBrowser(ViewResources& res, View& parentView, std::string_view title, Type type,
|
FileBrowser(ViewResources& res, View& parentView, std::string_view title, Type type,
|
||||||
hecl::SystemStringView initialPath, std::function<void(bool, hecl::SystemStringView)> returnFunc);
|
hecl::SystemStringView initialPath, std::function<void(bool, hecl::SystemStringView)> returnFunc);
|
||||||
|
~FileBrowser() override;
|
||||||
|
|
||||||
static std::vector<hecl::SystemString> PathComponents(hecl::SystemStringView path);
|
static std::vector<hecl::SystemString> PathComponents(hecl::SystemStringView path);
|
||||||
static void SyncBookmarkSelections(Table& table, BookmarkDataBind& binding, const hecl::SystemString& sel);
|
static void SyncBookmarkSelections(Table& table, BookmarkDataBind& binding, const hecl::SystemString& sel);
|
||||||
|
|
|
@ -3,12 +3,27 @@
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
|
|
||||||
#include <boo/boo.hpp>
|
#include <cstddef>
|
||||||
#include <hecl/Runtime.hpp>
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <athena/FileReader.hpp>
|
#include <athena/FileReader.hpp>
|
||||||
#include <athena/FileWriter.hpp>
|
#include <athena/FileWriter.hpp>
|
||||||
#include <athena/DNA.hpp>
|
#include <athena/DNA.hpp>
|
||||||
|
|
||||||
|
#include <boo/BooObject.hpp>
|
||||||
|
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
|
||||||
|
|
||||||
|
#include <hecl/SystemChar.hpp>
|
||||||
|
|
||||||
|
namespace hecl::Runtime {
|
||||||
|
class FileStoreManager;
|
||||||
|
}
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
class FontTag {
|
class FontTag {
|
||||||
friend class FontCache;
|
friend class FontCache;
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "View.hpp"
|
#include <cstddef>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace boo {
|
||||||
|
struct ITexture;
|
||||||
|
struct SWindowCoord;
|
||||||
|
} // namespace boo
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,16 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "specter/SplitView.hpp"
|
||||||
|
|
||||||
#include <locale.hpp>
|
#include <locale.hpp>
|
||||||
#include "SplitView.hpp"
|
#include <hecl/SystemChar.hpp>
|
||||||
#include <hecl/hecl.hpp>
|
|
||||||
|
namespace boo {
|
||||||
|
struct SWindowCoord;
|
||||||
|
}
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
struct ISpaceController;
|
struct ISpaceController;
|
||||||
|
|
|
@ -1,8 +1,17 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "View.hpp"
|
#include <cstddef>
|
||||||
|
|
||||||
|
#include "specter/View.hpp"
|
||||||
|
|
||||||
|
#include <boo/BooObject.hpp>
|
||||||
|
#include <boo/IWindow.hpp>
|
||||||
|
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
|
||||||
|
|
||||||
|
#include <zeus/CVector2f.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
class ViewResources;
|
||||||
|
|
||||||
struct Icon {
|
struct Icon {
|
||||||
boo::ObjToken<boo::ITexture> m_tex;
|
boo::ObjToken<boo::ITexture> m_tex;
|
||||||
|
|
|
@ -1,11 +1,19 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "View.hpp"
|
#include <cstddef>
|
||||||
#include "TextView.hpp"
|
#include <memory>
|
||||||
#include "ScrollView.hpp"
|
#include <string_view>
|
||||||
#include "IMenuNode.hpp"
|
#include <vector>
|
||||||
|
|
||||||
|
#include "specter/View.hpp"
|
||||||
|
|
||||||
|
#include <boo/IWindow.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
class ScrollView;
|
||||||
|
class TextView;
|
||||||
|
|
||||||
|
struct IMenuNode;
|
||||||
|
|
||||||
class Menu : public View {
|
class Menu : public View {
|
||||||
IMenuNode* m_rootNode;
|
IMenuNode* m_rootNode;
|
||||||
|
@ -70,6 +78,8 @@ class Menu : public View {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Menu(ViewResources& res, View& parentView, IMenuNode* rootNode);
|
Menu(ViewResources& res, View& parentView, IMenuNode* rootNode);
|
||||||
|
~Menu() override;
|
||||||
|
|
||||||
void reset(IMenuNode* rootNode);
|
void reset(IMenuNode* rootNode);
|
||||||
|
|
||||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ModalWindow.hpp"
|
#include <functional>
|
||||||
#include "MultiLineTextView.hpp"
|
#include <memory>
|
||||||
#include "Button.hpp"
|
#include <string>
|
||||||
|
|
||||||
|
#include "specter/Button.hpp"
|
||||||
|
#include "specter/ModalWindow.hpp"
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
class MultiLineTextView;
|
||||||
|
|
||||||
class MessageWindow : public ModalWindow {
|
class MessageWindow : public ModalWindow {
|
||||||
public:
|
public:
|
||||||
|
@ -37,14 +41,9 @@ private:
|
||||||
public:
|
public:
|
||||||
MessageWindow(ViewResources& res, View& parentView, Type type, std::string_view message,
|
MessageWindow(ViewResources& res, View& parentView, Type type, std::string_view message,
|
||||||
std::function<void(bool ok)> func);
|
std::function<void(bool ok)> func);
|
||||||
|
~MessageWindow() override;
|
||||||
|
|
||||||
void updateContentOpacity(float opacity) override {
|
void updateContentOpacity(float opacity) override;
|
||||||
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);
|
|
||||||
m_cancel.m_view->setMultiplyColor(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
|
|
|
@ -1,9 +1,17 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <specter/View.hpp>
|
#include <memory>
|
||||||
#include <specter/MultiLineTextView.hpp>
|
|
||||||
|
#include "specter/View.hpp"
|
||||||
|
|
||||||
|
#include <boo/IWindow.hpp>
|
||||||
|
#include <hecl/UniformBufferPool.hpp>
|
||||||
|
#include <zeus/CColor.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
class TextView;
|
||||||
|
class ViewResources;
|
||||||
|
|
||||||
class ModalWindow : public View {
|
class ModalWindow : public View {
|
||||||
public:
|
public:
|
||||||
enum class Phase { BuildIn, ResWait, Showing, BuildOut, Done };
|
enum class Phase { BuildIn, ResWait, Showing, BuildOut, Done };
|
||||||
|
@ -55,6 +63,8 @@ protected:
|
||||||
public:
|
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);
|
ModalWindow(ViewResources& res, View& parentView, const RectangleConstraint& constraint);
|
||||||
|
~ModalWindow() override;
|
||||||
|
|
||||||
void think() override;
|
void think() override;
|
||||||
bool skipBuildInAnimation();
|
bool skipBuildInAnimation();
|
||||||
void close(bool skipAnimation = false);
|
void close(bool skipAnimation = false);
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "View.hpp"
|
#include <cstddef>
|
||||||
#include "TextView.hpp"
|
#include <memory>
|
||||||
#include "FontCache.hpp"
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "specter/FontCache.hpp"
|
||||||
|
#include "specter/TextView.hpp"
|
||||||
|
#include "specter/View.hpp"
|
||||||
|
|
||||||
|
#include <boo/IWindow.hpp>
|
||||||
|
#include <zeus/CColor.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
class ViewResources;
|
||||||
|
|
||||||
class MultiLineTextView : public View {
|
class MultiLineTextView : public View {
|
||||||
ViewResources& m_viewSystem;
|
ViewResources& m_viewSystem;
|
||||||
|
|
|
@ -1,8 +1,18 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "specter/TextView.hpp"
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "specter/View.hpp"
|
||||||
|
|
||||||
|
namespace boo {
|
||||||
|
struct IGraphicsBufferD;
|
||||||
|
struct IGraphicsDataFactory;
|
||||||
|
struct IShaderDataBinding;
|
||||||
|
} // namespace boo
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
class TextView;
|
||||||
class ViewResources;
|
class ViewResources;
|
||||||
|
|
||||||
class NumericField : public View {
|
class NumericField : public View {
|
||||||
|
@ -27,8 +37,8 @@ class NumericField : public View {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class Resources {
|
class Resources {
|
||||||
friend class ViewResources;
|
|
||||||
friend class Button;
|
friend class Button;
|
||||||
|
friend class ViewResources;
|
||||||
|
|
||||||
void init(boo::IGraphicsDataFactory* factory, const IThemeData& theme);
|
void init(boo::IGraphicsDataFactory* factory, const IThemeData& theme);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "specter/View.hpp"
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
class Outliner {
|
class Outliner {
|
||||||
class Node : public View {
|
class Node : public View {
|
||||||
|
|
|
@ -1,59 +1,34 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Button.hpp"
|
#include <cstddef>
|
||||||
#include "ScrollView.hpp"
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "specter/ScrollView.hpp"
|
||||||
|
|
||||||
|
#include <hecl/SystemChar.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
class ViewResources;
|
||||||
|
|
||||||
struct IPathButtonsBinding {
|
struct IPathButtonsBinding {
|
||||||
virtual void pathButtonActivated(size_t idx) = 0;
|
virtual void pathButtonActivated(size_t idx) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PathButtons : public ScrollView {
|
class PathButtons : public ScrollView {
|
||||||
struct ContentView : public View {
|
struct ContentView;
|
||||||
PathButtons& m_pb;
|
struct PathButton;
|
||||||
boo::SWindowRect m_scissorRect;
|
friend struct PathButton;
|
||||||
|
|
||||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
|
||||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
|
||||||
void mouseMove(const boo::SWindowCoord&) override;
|
|
||||||
void mouseLeave(const boo::SWindowCoord&) override;
|
|
||||||
|
|
||||||
int nominalWidth() const override {
|
|
||||||
int ret = 0;
|
|
||||||
for (PathButton& b : m_pb.m_pathButtons)
|
|
||||||
ret += b.m_button.m_view->nominalWidth() + 2;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
int nominalHeight() const override {
|
|
||||||
return m_pb.m_pathButtons.size() ? m_pb.m_pathButtons[0].m_button.m_view->nominalHeight() : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub, const boo::SWindowRect& scissor) override;
|
|
||||||
void draw(boo::IGraphicsCommandQueue* gfxQ) override;
|
|
||||||
|
|
||||||
ContentView(ViewResources& res, PathButtons& pb) : View(res, pb), m_pb(pb) {}
|
|
||||||
};
|
|
||||||
ViewChild<std::unique_ptr<ContentView>> m_contentView;
|
ViewChild<std::unique_ptr<ContentView>> m_contentView;
|
||||||
|
|
||||||
int m_pathButtonPending = -1;
|
int m_pathButtonPending = -1;
|
||||||
IPathButtonsBinding& m_binding;
|
IPathButtonsBinding& m_binding;
|
||||||
bool m_fillContainer;
|
bool m_fillContainer;
|
||||||
struct PathButton final : IButtonBinding {
|
|
||||||
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) : m_pb(pb), m_idx(idx) {
|
|
||||||
m_button.m_view.reset(new Button(res, pb, this, hecl::SystemUTF8Conv(str).str()));
|
|
||||||
}
|
|
||||||
std::string_view name(const Control* control) const override { return m_button.m_view->getText(); }
|
|
||||||
void activated(const Button* button, const boo::SWindowCoord&) override { m_pb.m_pathButtonPending = m_idx; }
|
|
||||||
};
|
|
||||||
friend struct PathButton;
|
|
||||||
std::vector<PathButton> m_pathButtons;
|
std::vector<PathButton> m_pathButtons;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PathButtons(ViewResources& res, View& parentView, IPathButtonsBinding& binding, bool fillContainer = false);
|
PathButtons(ViewResources& res, View& parentView, IPathButtonsBinding& binding, bool fillContainer = false);
|
||||||
|
~PathButtons() override;
|
||||||
|
|
||||||
void setButtons(const std::vector<hecl::SystemString>& comps);
|
void setButtons(const std::vector<hecl::SystemString>& comps);
|
||||||
void setMultiplyColor(const zeus::CColor& color) override;
|
void setMultiplyColor(const zeus::CColor& color) override;
|
||||||
|
|
|
@ -1,18 +1,27 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "View.hpp"
|
#include <cstddef>
|
||||||
#include "ViewResources.hpp"
|
#include <memory>
|
||||||
#include "MultiLineTextView.hpp"
|
|
||||||
#include "TextField.hpp"
|
|
||||||
#include "SplitView.hpp"
|
|
||||||
#include "Tooltip.hpp"
|
|
||||||
#include "FontCache.hpp"
|
|
||||||
#include "IMenuNode.hpp"
|
|
||||||
#include "IViewManager.hpp"
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include "boo/boo.hpp"
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "specter/IMenuNode.hpp"
|
||||||
|
#include "specter/SplitView.hpp"
|
||||||
|
#include "specter/View.hpp"
|
||||||
|
|
||||||
|
#include <boo/BooObject.hpp>
|
||||||
|
#include <boo/IWindow.hpp>
|
||||||
|
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
|
||||||
|
#include <hecl/UniformBufferPool.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
class Button;
|
||||||
|
class ITextInputView;
|
||||||
|
class Tooltip;
|
||||||
|
class ViewResources;
|
||||||
|
|
||||||
|
struct IViewManager;
|
||||||
|
|
||||||
class RootView : public View {
|
class RootView : public View {
|
||||||
boo::IWindow* m_window = nullptr;
|
boo::IWindow* m_window = nullptr;
|
||||||
|
@ -130,7 +139,7 @@ public:
|
||||||
void specialKeyUp(boo::ESpecialKey key, boo::EModifierKey mods) override;
|
void specialKeyUp(boo::ESpecialKey key, boo::EModifierKey mods) override;
|
||||||
void modKeyDown(boo::EModifierKey mod, bool isRepeat) override;
|
void modKeyDown(boo::EModifierKey mod, bool isRepeat) override;
|
||||||
void modKeyUp(boo::EModifierKey mod) override;
|
void modKeyUp(boo::EModifierKey mod) override;
|
||||||
boo::ITextInputCallback* getTextInputCallback() { return m_activeTextView; }
|
boo::ITextInputCallback* getTextInputCallback();
|
||||||
|
|
||||||
void internalThink();
|
void internalThink();
|
||||||
void dispatchEvents() { m_events.dispatchEvents(); }
|
void dispatchEvents() { m_events.dispatchEvents(); }
|
||||||
|
@ -140,7 +149,7 @@ public:
|
||||||
boo::IWindow* window() const { return m_window; }
|
boo::IWindow* window() const { return m_window; }
|
||||||
IViewManager& viewManager() const { return m_viewMan; }
|
IViewManager& viewManager() const { return m_viewMan; }
|
||||||
ViewResources& viewRes() const { return *m_viewRes; }
|
ViewResources& viewRes() const { return *m_viewRes; }
|
||||||
const IThemeData& themeData() const { return *m_viewRes->m_theme; }
|
const IThemeData& themeData() const;
|
||||||
const boo::ObjToken<boo::ITextureR>& renderTex() const { return m_renderTex; }
|
const boo::ObjToken<boo::ITextureR>& renderTex() const { return m_renderTex; }
|
||||||
|
|
||||||
std::vector<View*>& accessContentViews() { return m_views; }
|
std::vector<View*>& accessContentViews() { return m_views; }
|
||||||
|
@ -154,13 +163,7 @@ public:
|
||||||
}
|
}
|
||||||
View* getRightClickMenu() { return m_rightClickMenu.m_view.get(); }
|
View* getRightClickMenu() { return m_rightClickMenu.m_view.get(); }
|
||||||
|
|
||||||
void setActiveTextView(ITextInputView* textView) {
|
void setActiveTextView(ITextInputView* textView);
|
||||||
if (m_activeTextView)
|
|
||||||
m_activeTextView->setActive(false);
|
|
||||||
m_activeTextView = textView;
|
|
||||||
if (textView)
|
|
||||||
textView->setActive(true);
|
|
||||||
}
|
|
||||||
void setActiveDragView(View* dragView) { m_activeDragView = dragView; }
|
void setActiveDragView(View* dragView) { m_activeDragView = dragView; }
|
||||||
void unsetActiveDragView(View* dragView) {
|
void unsetActiveDragView(View* dragView) {
|
||||||
if (dragView == m_activeDragView)
|
if (dragView == m_activeDragView)
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Button.hpp"
|
#include <cstddef>
|
||||||
#include "IViewManager.hpp"
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "specter/Button.hpp"
|
||||||
|
#include "specter/View.hpp"
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
class ViewResources;
|
|
||||||
class Button;
|
class Button;
|
||||||
|
class Control;
|
||||||
|
class ViewResources;
|
||||||
|
|
||||||
|
struct IViewManager;
|
||||||
|
|
||||||
class ScrollView : public View {
|
class ScrollView : public View {
|
||||||
public:
|
public:
|
||||||
|
@ -30,23 +37,11 @@ private:
|
||||||
struct SideButtonBinding : IButtonBinding {
|
struct SideButtonBinding : IButtonBinding {
|
||||||
ScrollView& m_sv;
|
ScrollView& m_sv;
|
||||||
std::string m_leftName, m_rightName;
|
std::string m_leftName, m_rightName;
|
||||||
SideButtonBinding(ScrollView& sv, IViewManager& vm)
|
|
||||||
: m_sv(sv)
|
SideButtonBinding(ScrollView& sv, IViewManager& vm);
|
||||||
, m_leftName(vm.translate<locale::scroll_left>())
|
std::string_view name(const Control* control) const override;
|
||||||
, m_rightName(vm.translate<locale::scroll_right>()) {}
|
void down(const Button* button, const boo::SWindowCoord& coord) override;
|
||||||
std::string_view name(const Control* control) const override {
|
void up(const Button* button, const boo::SWindowCoord& coord) override;
|
||||||
return (control == reinterpret_cast<Control*>(m_sv.m_sideButtons[0].m_view.get())) ? m_leftName.c_str()
|
|
||||||
: m_rightName.c_str();
|
|
||||||
}
|
|
||||||
void down(const Button* button, const boo::SWindowCoord& coord) override {
|
|
||||||
if (button == m_sv.m_sideButtons[0].m_view.get())
|
|
||||||
m_sv.m_sideButtonState = SideButtonState::ScrollRight;
|
|
||||||
else
|
|
||||||
m_sv.m_sideButtonState = SideButtonState::ScrollLeft;
|
|
||||||
}
|
|
||||||
void up(const Button* button, const boo::SWindowCoord& coord) override {
|
|
||||||
m_sv.m_sideButtonState = SideButtonState::None;
|
|
||||||
}
|
|
||||||
} m_sideButtonBind;
|
} m_sideButtonBind;
|
||||||
ViewChild<std::unique_ptr<Button>> m_sideButtons[2];
|
ViewChild<std::unique_ptr<Button>> m_sideButtons[2];
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "View.hpp"
|
#include <memory>
|
||||||
#include "Toolbar.hpp"
|
|
||||||
#include "SplitView.hpp"
|
#include "specter/SplitView.hpp"
|
||||||
|
#include "specter/Toolbar.hpp"
|
||||||
|
#include "specter/View.hpp"
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
class Space;
|
class ViewResources;
|
||||||
|
|
||||||
struct ISplitSpaceController;
|
struct ISplitSpaceController;
|
||||||
|
|
||||||
struct ISpaceController {
|
struct ISpaceController {
|
||||||
|
@ -20,7 +23,10 @@ struct ISplitSpaceController {
|
||||||
};
|
};
|
||||||
|
|
||||||
class Space : public View {
|
class Space : public View {
|
||||||
|
struct CornerView;
|
||||||
friend class RootView;
|
friend class RootView;
|
||||||
|
friend struct CornerView;
|
||||||
|
|
||||||
ISpaceController& m_controller;
|
ISpaceController& m_controller;
|
||||||
Toolbar::Position m_tbPos;
|
Toolbar::Position m_tbPos;
|
||||||
ViewChild<std::unique_ptr<Toolbar>> m_toolbar;
|
ViewChild<std::unique_ptr<Toolbar>> m_toolbar;
|
||||||
|
@ -29,25 +35,13 @@ class Space : public View {
|
||||||
bool m_cornerDrag = false;
|
bool m_cornerDrag = false;
|
||||||
int m_cornerDragPoint[2];
|
int m_cornerDragPoint[2];
|
||||||
|
|
||||||
struct CornerView : View {
|
|
||||||
Space& m_space;
|
|
||||||
VertexBufferBindingSolid m_vertexBinding;
|
|
||||||
bool m_flip;
|
|
||||||
CornerView(ViewResources& res, Space& space, const zeus::CColor& triColor);
|
|
||||||
void mouseEnter(const boo::SWindowCoord&) override;
|
|
||||||
void mouseLeave(const boo::SWindowCoord&) override;
|
|
||||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
|
||||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
|
||||||
using View::resized;
|
|
||||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub, bool flip);
|
|
||||||
void draw(boo::IGraphicsCommandQueue* gfxQ) override;
|
|
||||||
};
|
|
||||||
friend struct CornerView;
|
|
||||||
ViewChild<std::unique_ptr<CornerView>> m_cornerView;
|
ViewChild<std::unique_ptr<CornerView>> m_cornerView;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Space(ViewResources& res, View& parentView, ISpaceController& controller, Toolbar::Position toolbarPos,
|
Space(ViewResources& res, View& parentView, ISpaceController& controller, Toolbar::Position toolbarPos,
|
||||||
unsigned tbUnits);
|
unsigned tbUnits);
|
||||||
|
~Space() override;
|
||||||
|
|
||||||
View* setContentView(View* view);
|
View* setContentView(View* view);
|
||||||
Toolbar* toolbar() { return m_toolbar.m_view.get(); }
|
Toolbar* toolbar() { return m_toolbar.m_view.get(); }
|
||||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
#include "specter/View.hpp"
|
#include "specter/View.hpp"
|
||||||
|
|
||||||
|
#include <boo/BooObject.hpp>
|
||||||
|
#include <hecl/UniformBufferPool.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
struct ISplitSpaceController;
|
struct ISplitSpaceController;
|
||||||
|
|
||||||
|
@ -11,8 +14,8 @@ class SplitView : public View {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class Resources {
|
class Resources {
|
||||||
friend class ViewResources;
|
|
||||||
friend class SplitView;
|
friend class SplitView;
|
||||||
|
friend class ViewResources;
|
||||||
boo::ObjToken<boo::ITextureS> m_shadingTex;
|
boo::ObjToken<boo::ITextureS> m_shadingTex;
|
||||||
|
|
||||||
void init(boo::IGraphicsDataFactory::Context& ctx, const IThemeData& theme);
|
void init(boo::IGraphicsDataFactory::Context& ctx, const IThemeData& theme);
|
||||||
|
|
|
@ -1,13 +1,19 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "View.hpp"
|
|
||||||
#include "ScrollView.hpp"
|
|
||||||
#include "TextView.hpp"
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "specter/View.hpp"
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
#define SPECTER_TABLE_MAX_ROWS 128ul
|
#define SPECTER_TABLE_MAX_ROWS 128ul
|
||||||
|
|
||||||
|
class ScrollView;
|
||||||
|
|
||||||
enum class SortDirection { None, Ascending, Descending };
|
enum class SortDirection { None, Ascending, Descending };
|
||||||
|
|
||||||
struct ITableDataBinding {
|
struct ITableDataBinding {
|
||||||
|
@ -31,6 +37,8 @@ struct ITableStateBinding {
|
||||||
};
|
};
|
||||||
|
|
||||||
class Table : public View {
|
class Table : public View {
|
||||||
|
struct CellView;
|
||||||
|
|
||||||
ITableDataBinding* m_data;
|
ITableDataBinding* m_data;
|
||||||
ITableStateBinding* m_state;
|
ITableStateBinding* m_state;
|
||||||
|
|
||||||
|
@ -41,28 +49,6 @@ class Table : public View {
|
||||||
size_t m_deferredActivation = SIZE_MAX;
|
size_t m_deferredActivation = SIZE_MAX;
|
||||||
size_t m_clickFrames = 15;
|
size_t m_clickFrames = 15;
|
||||||
|
|
||||||
struct CellView : public View {
|
|
||||||
Table& m_t;
|
|
||||||
std::unique_ptr<TextView> m_text;
|
|
||||||
size_t m_c = SIZE_MAX, m_r = SIZE_MAX;
|
|
||||||
boo::SWindowRect m_scissorRect;
|
|
||||||
uint64_t m_textHash = 0;
|
|
||||||
CellView(Table& t, ViewResources& res);
|
|
||||||
|
|
||||||
bool m_selected = false;
|
|
||||||
void select();
|
|
||||||
void deselect();
|
|
||||||
void reset();
|
|
||||||
bool reset(size_t c);
|
|
||||||
bool reset(size_t c, size_t r);
|
|
||||||
|
|
||||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
|
||||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
|
||||||
void mouseEnter(const boo::SWindowCoord&) override;
|
|
||||||
void mouseLeave(const boo::SWindowCoord&) override;
|
|
||||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub, const boo::SWindowRect& scissor) override;
|
|
||||||
void draw(boo::IGraphicsCommandQueue* gfxQ) override;
|
|
||||||
};
|
|
||||||
std::vector<ViewChild<std::unique_ptr<CellView>>> m_headerViews;
|
std::vector<ViewChild<std::unique_ptr<CellView>>> m_headerViews;
|
||||||
using ColumnPool = std::array<std::array<ViewChild<std::unique_ptr<CellView>>, SPECTER_TABLE_MAX_ROWS>, 2>;
|
using ColumnPool = std::array<std::array<ViewChild<std::unique_ptr<CellView>>, SPECTER_TABLE_MAX_ROWS>, 2>;
|
||||||
std::vector<ColumnPool> m_cellPools;
|
std::vector<ColumnPool> m_cellPools;
|
||||||
|
@ -94,7 +80,7 @@ class Table : public View {
|
||||||
|
|
||||||
RowsView(Table& t, ViewResources& res);
|
RowsView(Table& t, ViewResources& res);
|
||||||
int nominalHeight() const override;
|
int nominalHeight() const override;
|
||||||
int nominalWidth() const override { return m_t.m_scroll.m_view->nominalWidth(); }
|
int nominalWidth() const override;
|
||||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
void mouseMove(const boo::SWindowCoord&) override;
|
void mouseMove(const boo::SWindowCoord&) override;
|
||||||
|
@ -111,6 +97,7 @@ class Table : public View {
|
||||||
public:
|
public:
|
||||||
Table(ViewResources& res, View& parentView, ITableDataBinding* data, ITableStateBinding* state = nullptr,
|
Table(ViewResources& res, View& parentView, ITableDataBinding* data, ITableStateBinding* state = nullptr,
|
||||||
size_t maxColumns = 8);
|
size_t maxColumns = 8);
|
||||||
|
~Table() override;
|
||||||
|
|
||||||
void cycleSortColumn(size_t c);
|
void cycleSortColumn(size_t c);
|
||||||
void selectRow(size_t r);
|
void selectRow(size_t r);
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Control.hpp"
|
#include <cstddef>
|
||||||
#include "TextView.hpp"
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "specter/Control.hpp"
|
||||||
|
|
||||||
#include <boo/IWindow.hpp>
|
#include <boo/IWindow.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
class TextView;
|
||||||
|
class ViewResources;
|
||||||
|
|
||||||
class TextField : public ITextInputView {
|
class TextField : public ITextInputView {
|
||||||
bool m_hasTextSet = false;
|
bool m_hasTextSet = false;
|
||||||
|
@ -60,6 +67,7 @@ class TextField : public ITextInputView {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TextField(ViewResources& res, View& parentView, IStringBinding* strBind);
|
TextField(ViewResources& res, View& parentView, IStringBinding* strBind);
|
||||||
|
~TextField() override;
|
||||||
|
|
||||||
std::string_view getText() const { return m_textStr; }
|
std::string_view getText() const { return m_textStr; }
|
||||||
void setText(std::string_view str);
|
void setText(std::string_view str);
|
||||||
|
@ -103,15 +111,7 @@ public:
|
||||||
void setSelectionRange(size_t start, size_t count);
|
void setSelectionRange(size_t start, size_t count);
|
||||||
void clearSelectionRange();
|
void clearSelectionRange();
|
||||||
|
|
||||||
void setMultiplyColor(const zeus::CColor& color) override {
|
void setMultiplyColor(const zeus::CColor& color) override;
|
||||||
View::setMultiplyColor(color);
|
|
||||||
m_viewVertBlock.m_color = color;
|
|
||||||
if (m_viewVertBlockBuf)
|
|
||||||
m_viewVertBlockBuf.access().finalAssign(m_viewVertBlock);
|
|
||||||
m_text->setMultiplyColor(color);
|
|
||||||
if (m_errText)
|
|
||||||
m_errText->setMultiplyColor(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _setCursorPos();
|
void _setCursorPos();
|
||||||
|
|
|
@ -1,7 +1,19 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "specter/View.hpp"
|
#include "specter/View.hpp"
|
||||||
|
|
||||||
|
#include <boo/BooObject.hpp>
|
||||||
|
#include <boo/IWindow.hpp>
|
||||||
|
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
|
||||||
|
|
||||||
|
#include <hecl/UniformBufferPool.hpp>
|
||||||
|
|
||||||
|
namespace boo {
|
||||||
|
struct IGraphicsCommandQueue;
|
||||||
|
}
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
#define SPECTER_TOOLBAR_GAUGE 28
|
#define SPECTER_TOOLBAR_GAUGE 28
|
||||||
|
|
||||||
|
@ -35,6 +47,8 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Toolbar(ViewResources& res, View& parentView, Position toolbarPos, unsigned units);
|
Toolbar(ViewResources& res, View& parentView, Position toolbarPos, unsigned units);
|
||||||
|
~Toolbar() override;
|
||||||
|
|
||||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
void mouseMove(const boo::SWindowCoord&) override;
|
void mouseMove(const boo::SWindowCoord&) override;
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "specter/View.hpp"
|
#include "specter/View.hpp"
|
||||||
#include "specter/MultiLineTextView.hpp"
|
|
||||||
|
#include <hecl/UniformBufferPool.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
class MultiLineTextView;
|
||||||
|
class TextView;
|
||||||
|
|
||||||
class Tooltip : public View {
|
class Tooltip : public View {
|
||||||
ViewBlock m_ttBlock;
|
ViewBlock m_ttBlock;
|
||||||
|
@ -26,6 +32,8 @@ class Tooltip : public View {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Tooltip(ViewResources& res, View& parentView, std::string_view title, std::string_view message);
|
Tooltip(ViewResources& res, View& parentView, std::string_view title, std::string_view message);
|
||||||
|
~Tooltip() override;
|
||||||
|
|
||||||
void resized(const boo::SWindowRect& rootView, const boo::SWindowRect& sub) override;
|
void resized(const boo::SWindowRect& rootView, const boo::SWindowRect& sub) override;
|
||||||
void draw(boo::IGraphicsCommandQueue* gfxQ) override;
|
void draw(boo::IGraphicsCommandQueue* gfxQ) override;
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,31 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "boo/boo.hpp"
|
#include <algorithm>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include "zeus/CVector3f.hpp"
|
#include <utility>
|
||||||
#include "zeus/CMatrix4f.hpp"
|
|
||||||
#include "zeus/CTransform.hpp"
|
#include <boo/BooObject.hpp>
|
||||||
#include "zeus/CColor.hpp"
|
#include <boo/IWindow.hpp>
|
||||||
#include "hecl/CVar.hpp"
|
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
|
||||||
#include "hecl/UniformBufferPool.hpp"
|
|
||||||
#include "hecl/VertexBufferPool.hpp"
|
#include <hecl/UniformBufferPool.hpp>
|
||||||
|
#include <hecl/VertexBufferPool.hpp>
|
||||||
|
|
||||||
|
#include <zeus/CColor.hpp>
|
||||||
|
#include <zeus/CMatrix4f.hpp>
|
||||||
|
#include <zeus/CTransform.hpp>
|
||||||
|
#include <zeus/CVector3f.hpp>
|
||||||
|
|
||||||
|
namespace boo {
|
||||||
|
struct IGraphicsCommandQueue;
|
||||||
|
}
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
class IThemeData;
|
class IThemeData;
|
||||||
class ViewResources;
|
|
||||||
class RootView;
|
class RootView;
|
||||||
|
class Space;
|
||||||
|
class SplitView;
|
||||||
|
class ViewResources;
|
||||||
|
|
||||||
extern zeus::CMatrix4f g_PlatformMatrix;
|
extern zeus::CMatrix4f g_PlatformMatrix;
|
||||||
|
|
||||||
|
@ -67,8 +79,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Space;
|
|
||||||
class SplitView;
|
|
||||||
class View {
|
class View {
|
||||||
public:
|
public:
|
||||||
struct SolidShaderVert {
|
struct SolidShaderVert {
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "TextView.hpp"
|
#include <atomic>
|
||||||
#include "SplitView.hpp"
|
|
||||||
#include "Toolbar.hpp"
|
|
||||||
#include "Button.hpp"
|
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
#include "specter/Button.hpp"
|
||||||
|
#include "specter/SplitView.hpp"
|
||||||
|
#include "specter/TextView.hpp"
|
||||||
|
#include "specter/Toolbar.hpp"
|
||||||
|
|
||||||
|
#include <zeus/CColor.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
class IThemeData {
|
class IThemeData {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,11 +1,51 @@
|
||||||
#include "logvisor/logvisor.hpp"
|
|
||||||
#include "specter/Button.hpp"
|
#include "specter/Button.hpp"
|
||||||
#include "specter/ViewResources.hpp"
|
|
||||||
|
#include "specter/Icon.hpp"
|
||||||
#include "specter/RootView.hpp"
|
#include "specter/RootView.hpp"
|
||||||
|
#include "specter/TextView.hpp"
|
||||||
|
#include "specter/ViewResources.hpp"
|
||||||
|
|
||||||
|
#include <logvisor/logvisor.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
static logvisor::Module Log("specter::Button");
|
static logvisor::Module Log("specter::Button");
|
||||||
|
|
||||||
|
struct Button::ButtonTarget : View {
|
||||||
|
Button& m_button;
|
||||||
|
|
||||||
|
bool m_pressed = false;
|
||||||
|
bool m_hovered = false;
|
||||||
|
|
||||||
|
void setInactive();
|
||||||
|
void setHover();
|
||||||
|
void setPressed();
|
||||||
|
void setDisabled();
|
||||||
|
|
||||||
|
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
|
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
|
void mouseEnter(const boo::SWindowCoord&) override;
|
||||||
|
void mouseLeave(const boo::SWindowCoord&) override;
|
||||||
|
ButtonTarget(ViewResources& res, Button& button) : View(res, button), m_button(button) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Button::MenuTarget : View {
|
||||||
|
Button& m_button;
|
||||||
|
|
||||||
|
bool m_pressed = false;
|
||||||
|
bool m_hovered = false;
|
||||||
|
|
||||||
|
void setInactive();
|
||||||
|
void setHover();
|
||||||
|
void setPressed();
|
||||||
|
void setDisabled();
|
||||||
|
|
||||||
|
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
|
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
|
void mouseEnter(const boo::SWindowCoord&) override;
|
||||||
|
void mouseLeave(const boo::SWindowCoord&) override;
|
||||||
|
MenuTarget(ViewResources& res, Button& button) : View(res, button), m_button(button) {}
|
||||||
|
};
|
||||||
|
|
||||||
void Button::Resources::init(boo::IGraphicsDataFactory::Context& ctx, const IThemeData& theme) {}
|
void Button::Resources::init(boo::IGraphicsDataFactory::Context& ctx, const IThemeData& theme) {}
|
||||||
|
|
||||||
Button::Button(ViewResources& res, View& parentView, IButtonBinding* controlBinding, std::string_view text, Icon* icon,
|
Button::Button(ViewResources& res, View& parentView, IButtonBinding* controlBinding, std::string_view text, Icon* icon,
|
||||||
|
@ -66,6 +106,8 @@ Button::Button(ViewResources& res, View& parentView, IButtonBinding* controlBind
|
||||||
setText(m_textStr);
|
setText(m_textStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button::~Button() { closeMenu({}); }
|
||||||
|
|
||||||
void Button::setText(std::string_view text) { setText(text, m_textColor); }
|
void Button::setText(std::string_view text) { setText(text, m_textColor); }
|
||||||
|
|
||||||
void Button::setText(std::string_view text, const zeus::CColor& textColor) {
|
void Button::setText(std::string_view text, const zeus::CColor& textColor) {
|
||||||
|
@ -449,6 +491,16 @@ void Button::closeMenu(const boo::SWindowCoord& coord) {
|
||||||
m_menuTarget.mouseMove(coord);
|
m_menuTarget.mouseMove(coord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Button::setMultiplyColor(const zeus::CColor& color) {
|
||||||
|
View::setMultiplyColor(color);
|
||||||
|
m_viewVertBlock.m_color = color;
|
||||||
|
if (m_viewVertBlockBuf)
|
||||||
|
m_viewVertBlockBuf.access().finalAssign(m_viewVertBlock);
|
||||||
|
m_text->setMultiplyColor(color);
|
||||||
|
if (m_icon)
|
||||||
|
m_icon->setMultiplyColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
void Button::think() {
|
void Button::think() {
|
||||||
if (m_modalMenu.m_view)
|
if (m_modalMenu.m_view)
|
||||||
m_modalMenu.m_view->think();
|
m_modalMenu.m_view->think();
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
#include "specter/Control.hpp"
|
#include "specter/Control.hpp"
|
||||||
|
|
||||||
|
#include <hecl/CVar.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
|
||||||
|
std::string_view CVarControlBinding::name([[maybe_unused]] const Control* control) const { return m_cvar->name(); }
|
||||||
|
|
||||||
|
std::string_view CVarControlBinding::help([[maybe_unused]] const Control* control) const { return m_cvar->rawHelp(); }
|
||||||
|
|
||||||
Control::Control(ViewResources& res, View& parentView, IControlBinding* controlBinding)
|
Control::Control(ViewResources& res, View& parentView, IControlBinding* controlBinding)
|
||||||
: View(res, parentView), m_controlBinding(controlBinding) {}
|
: View(res, parentView), m_controlBinding(controlBinding) {}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
#include "specter/FileBrowser.hpp"
|
#include "specter/FileBrowser.hpp"
|
||||||
#include "specter/RootView.hpp"
|
|
||||||
|
#include "specter/Button.hpp"
|
||||||
|
#include "specter/IViewManager.hpp"
|
||||||
#include "specter/MessageWindow.hpp"
|
#include "specter/MessageWindow.hpp"
|
||||||
|
#include "specter/RootView.hpp"
|
||||||
|
#include "specter/TextField.hpp"
|
||||||
|
|
||||||
|
#include <hecl/hecl.hpp>
|
||||||
|
#include <logvisor/logvisor.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
static logvisor::Module Log("specter::FileBrowser");
|
static logvisor::Module Log("specter::FileBrowser");
|
||||||
|
@ -99,6 +106,8 @@ FileBrowser::FileBrowser(ViewResources& res, View& parentView, std::string_view
|
||||||
updateContentOpacity(0.0);
|
updateContentOpacity(0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileBrowser::~FileBrowser() = default;
|
||||||
|
|
||||||
void FileBrowser::SyncBookmarkSelections(Table& table, BookmarkDataBind& binding, const hecl::SystemString& sel) {
|
void FileBrowser::SyncBookmarkSelections(Table& table, BookmarkDataBind& binding, const hecl::SystemString& sel) {
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
for (const BookmarkDataBind::Entry& e : binding.m_entries) {
|
for (const BookmarkDataBind::Entry& e : binding.m_entries) {
|
||||||
|
@ -298,6 +307,9 @@ void FileBrowser::cancelActivated() {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileBrowser::FileFieldBind::FileFieldBind(FileBrowser& browser, const IViewManager& vm)
|
||||||
|
: m_browser(browser), m_name(vm.translate<locale::file_name>()) {}
|
||||||
|
|
||||||
void FileBrowser::pathButtonActivated(size_t idx) {
|
void FileBrowser::pathButtonActivated(size_t idx) {
|
||||||
if (idx >= m_comps.size())
|
if (idx >= m_comps.size())
|
||||||
return;
|
return;
|
||||||
|
@ -317,6 +329,50 @@ void FileBrowser::pathButtonActivated(size_t idx) {
|
||||||
navigateToPath(dir);
|
navigateToPath(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileBrowser::FileListingDataBind::updateListing(const hecl::DirectoryEnumerator& dEnum) {
|
||||||
|
m_entries.clear();
|
||||||
|
m_entries.reserve(dEnum.size());
|
||||||
|
|
||||||
|
for (const hecl::DirectoryEnumerator::Entry& d : dEnum) {
|
||||||
|
m_entries.emplace_back();
|
||||||
|
Entry& ent = m_entries.back();
|
||||||
|
ent.m_path = d.m_path;
|
||||||
|
hecl::SystemUTF8Conv nameUtf8(d.m_name);
|
||||||
|
ent.m_name = nameUtf8.str();
|
||||||
|
if (d.m_isDir) {
|
||||||
|
if (hecl::SearchForProject(d.m_path))
|
||||||
|
ent.m_type = m_projStr;
|
||||||
|
else
|
||||||
|
ent.m_type = m_dirStr;
|
||||||
|
} 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_needsUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileBrowser::FileListingDataBind::setSelectedRow(size_t rIdx) {
|
||||||
|
if (rIdx != SIZE_MAX) {
|
||||||
|
m_fb.m_fileField.m_view->setText(m_entries.at(rIdx).m_name);
|
||||||
|
} else {
|
||||||
|
m_fb.m_fileField.m_view->setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
m_fb.m_fileField.m_view->clearErrorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
FileBrowser::FileListingDataBind::FileListingDataBind(FileBrowser& fb, const IViewManager& vm) : m_fb(fb) {
|
||||||
|
m_nameCol = vm.translate<locale::name>();
|
||||||
|
m_typeCol = vm.translate<locale::type>();
|
||||||
|
m_sizeCol = vm.translate<locale::size>();
|
||||||
|
m_dirStr = vm.translate<locale::directory>();
|
||||||
|
m_projStr = vm.translate<locale::hecl_project>();
|
||||||
|
m_fileStr = vm.translate<locale::file>();
|
||||||
|
}
|
||||||
|
|
||||||
void FileBrowser::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod) {
|
void FileBrowser::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod) {
|
||||||
if (skipBuildInAnimation() || closed())
|
if (skipBuildInAnimation() || closed())
|
||||||
return;
|
return;
|
||||||
|
@ -530,4 +586,17 @@ void FileBrowser::RightSide::draw(boo::IGraphicsCommandQueue* gfxQ) {
|
||||||
m_fb.m_fileField.m_view->draw(gfxQ);
|
m_fb.m_fileField.m_view->draw(gfxQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileBrowser::OKButton::OKButton(FileBrowser& fb, ViewResources& res, std::string_view text) : m_fb(fb), m_text(text) {
|
||||||
|
m_button.m_view.reset(
|
||||||
|
new Button(res, fb, this, text, nullptr, Button::Style::Block, zeus::skWhite,
|
||||||
|
RectangleConstraint(100 * res.pixelFactor(), -1, RectangleConstraint::Test::Minimum)));
|
||||||
|
}
|
||||||
|
|
||||||
|
FileBrowser::CancelButton::CancelButton(FileBrowser& fb, ViewResources& res, std::string_view text)
|
||||||
|
: m_fb(fb), m_text(text) {
|
||||||
|
m_button.m_view.reset(new Button(
|
||||||
|
res, fb, this, text, nullptr, Button::Style::Block, zeus::skWhite,
|
||||||
|
RectangleConstraint(m_fb.m_ok.m_button.m_view->nominalWidth(), -1, RectangleConstraint::Test::Minimum)));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace specter
|
} // namespace specter
|
||||||
|
|
|
@ -3,10 +3,17 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "specter/FontCache.hpp"
|
#include "specter/FontCache.hpp"
|
||||||
#include "logvisor/logvisor.hpp"
|
|
||||||
#include <athena/MemoryReader.hpp>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <zlib.h>
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <athena/FileReader.hpp>
|
||||||
|
#include <athena/FileWriter.hpp>
|
||||||
|
#include <athena/MemoryReader.hpp>
|
||||||
|
|
||||||
|
#include <boo/System.hpp>
|
||||||
|
|
||||||
#include FT_GZIP_H
|
#include FT_GZIP_H
|
||||||
#include FT_SYSTEM_H
|
#include FT_SYSTEM_H
|
||||||
|
@ -15,6 +22,13 @@
|
||||||
#include <freetype/internal/ftstream.h>
|
#include <freetype/internal/ftstream.h>
|
||||||
#include <freetype/internal/tttypes.h>
|
#include <freetype/internal/tttypes.h>
|
||||||
|
|
||||||
|
#include <hecl/hecl.hpp>
|
||||||
|
#include <hecl/Runtime.hpp>
|
||||||
|
|
||||||
|
#include <logvisor/logvisor.hpp>
|
||||||
|
#include <xxhash/xxhash.h>
|
||||||
|
#include <zlib.h>
|
||||||
|
|
||||||
extern "C" const uint8_t DROIDSANS_PERMISSIVE[];
|
extern "C" const uint8_t DROIDSANS_PERMISSIVE[];
|
||||||
extern "C" size_t DROIDSANS_PERMISSIVE_SZ;
|
extern "C" size_t DROIDSANS_PERMISSIVE_SZ;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#include "specter/Menu.hpp"
|
#include "specter/Menu.hpp"
|
||||||
|
|
||||||
|
#include "specter/IMenuNode.hpp"
|
||||||
#include "specter/RootView.hpp"
|
#include "specter/RootView.hpp"
|
||||||
|
#include "specter/ScrollView.hpp"
|
||||||
|
#include "specter/TextView.hpp"
|
||||||
#include "specter/ViewResources.hpp"
|
#include "specter/ViewResources.hpp"
|
||||||
|
|
||||||
#define ROW_HEIGHT 18
|
#define ROW_HEIGHT 18
|
||||||
|
@ -20,6 +24,8 @@ Menu::Menu(ViewResources& res, View& parentView, IMenuNode* rootNode) : View(res
|
||||||
reset(rootNode);
|
reset(rootNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Menu::~Menu() = default;
|
||||||
|
|
||||||
void Menu::reset(IMenuNode* rootNode) {
|
void Menu::reset(IMenuNode* rootNode) {
|
||||||
m_rootNode = rootNode;
|
m_rootNode = rootNode;
|
||||||
m_thisNode = rootNode;
|
m_thisNode = rootNode;
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
#include "specter/MessageWindow.hpp"
|
#include "specter/MessageWindow.hpp"
|
||||||
#include "specter/ViewResources.hpp"
|
|
||||||
#include "specter/RootView.hpp"
|
#include "specter/IViewManager.hpp"
|
||||||
#include "specter/Menu.hpp"
|
#include "specter/Menu.hpp"
|
||||||
|
#include "specter/MultiLineTextView.hpp"
|
||||||
|
#include "specter/RootView.hpp"
|
||||||
|
#include "specter/ViewResources.hpp"
|
||||||
|
|
||||||
|
#include <locale.hpp>
|
||||||
|
#include <zeus/CColor.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
|
||||||
|
@ -26,6 +32,16 @@ MessageWindow::MessageWindow(ViewResources& res, View& parentView, Type type, st
|
||||||
updateContentOpacity(0.0);
|
updateContentOpacity(0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageWindow::~MessageWindow() = default;
|
||||||
|
|
||||||
|
void MessageWindow::updateContentOpacity(float 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);
|
||||||
|
m_cancel.m_view->setMultiplyColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
void MessageWindow::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mods) {
|
void MessageWindow::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mods) {
|
||||||
if (closed() || skipBuildInAnimation())
|
if (closed() || skipBuildInAnimation())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#include "specter/ModalWindow.hpp"
|
#include "specter/ModalWindow.hpp"
|
||||||
#include "specter/ViewResources.hpp"
|
|
||||||
|
#include "specter/MultiLineTextView.hpp"
|
||||||
#include "specter/RootView.hpp"
|
#include "specter/RootView.hpp"
|
||||||
|
#include "specter/ViewResources.hpp"
|
||||||
|
|
||||||
|
#include <boo/System.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
|
||||||
|
@ -300,6 +304,8 @@ ModalWindow::ModalWindow(ViewResources& res, View& parentView, const RectangleCo
|
||||||
_loadVerts();
|
_loadVerts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ModalWindow::~ModalWindow() = default;
|
||||||
|
|
||||||
static float CubicEase(float t) {
|
static float CubicEase(float t) {
|
||||||
t *= 2.f;
|
t *= 2.f;
|
||||||
if (t < 1)
|
if (t < 1)
|
||||||
|
|
|
@ -1,8 +1,95 @@
|
||||||
#include "specter/PathButtons.hpp"
|
#include "specter/PathButtons.hpp"
|
||||||
|
|
||||||
|
#include "specter/Button.hpp"
|
||||||
#include "specter/RootView.hpp"
|
#include "specter/RootView.hpp"
|
||||||
#include "specter/ViewResources.hpp"
|
#include "specter/ViewResources.hpp"
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
struct PathButtons::PathButton final : IButtonBinding {
|
||||||
|
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) : m_pb(pb), m_idx(idx) {
|
||||||
|
m_button.m_view.reset(new Button(res, pb, this, hecl::SystemUTF8Conv(str).str()));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string_view name(const Control* control) const override { return m_button.m_view->getText(); }
|
||||||
|
void activated(const Button* button, const boo::SWindowCoord&) override { m_pb.m_pathButtonPending = m_idx; }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct PathButtons::ContentView : public View {
|
||||||
|
PathButtons& m_pb;
|
||||||
|
boo::SWindowRect m_scissorRect;
|
||||||
|
|
||||||
|
ContentView(ViewResources& res, PathButtons& pb) : View(res, pb), m_pb(pb) {}
|
||||||
|
|
||||||
|
void mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod) override {
|
||||||
|
for (PathButton& b : m_pb.m_pathButtons) {
|
||||||
|
b.m_button.mouseDown(coord, button, mod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod) override {
|
||||||
|
for (PathButton& b : m_pb.m_pathButtons) {
|
||||||
|
b.m_button.mouseUp(coord, button, mod);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pb.m_pathButtonPending >= 0) {
|
||||||
|
m_pb.m_binding.pathButtonActivated(m_pb.m_pathButtonPending);
|
||||||
|
m_pb.m_pathButtonPending = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void mouseMove(const boo::SWindowCoord& coord) override {
|
||||||
|
for (PathButton& b : m_pb.m_pathButtons) {
|
||||||
|
b.m_button.mouseMove(coord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void mouseLeave(const boo::SWindowCoord& coord) override {
|
||||||
|
for (PathButton& b : m_pb.m_pathButtons) {
|
||||||
|
b.m_button.mouseLeave(coord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int nominalWidth() const override {
|
||||||
|
int ret = 0;
|
||||||
|
for (const PathButton& b : m_pb.m_pathButtons) {
|
||||||
|
ret += b.m_button.m_view->nominalWidth() + 2;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int nominalHeight() const override {
|
||||||
|
return m_pb.m_pathButtons.size() ? m_pb.m_pathButtons[0].m_button.m_view->nominalHeight() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub, const boo::SWindowRect& scissor) override {
|
||||||
|
View::resized(root, sub);
|
||||||
|
|
||||||
|
m_scissorRect = scissor;
|
||||||
|
m_scissorRect.size[1] += 2;
|
||||||
|
|
||||||
|
boo::SWindowRect pathRect = sub;
|
||||||
|
for (PathButton& b : m_pb.m_pathButtons) {
|
||||||
|
pathRect.size[0] = b.m_button.m_view->nominalWidth();
|
||||||
|
pathRect.size[1] = b.m_button.m_view->nominalHeight();
|
||||||
|
b.m_button.m_view->resized(root, pathRect);
|
||||||
|
pathRect.location[0] += pathRect.size[0] + 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw(boo::IGraphicsCommandQueue* gfxQ) override {
|
||||||
|
gfxQ->setScissor(m_scissorRect);
|
||||||
|
|
||||||
|
for (PathButton& b : m_pb.m_pathButtons) {
|
||||||
|
b.m_button.m_view->draw(gfxQ);
|
||||||
|
}
|
||||||
|
|
||||||
|
gfxQ->setScissor(rootView().subRect());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
PathButtons::PathButtons(ViewResources& res, View& parentView, IPathButtonsBinding& binding, bool fillContainer)
|
PathButtons::PathButtons(ViewResources& res, View& parentView, IPathButtonsBinding& binding, bool fillContainer)
|
||||||
: ScrollView(res, parentView, ScrollView::Style::SideButtons), m_binding(binding), m_fillContainer(fillContainer) {
|
: ScrollView(res, parentView, ScrollView::Style::SideButtons), m_binding(binding), m_fillContainer(fillContainer) {
|
||||||
|
@ -10,6 +97,8 @@ PathButtons::PathButtons(ViewResources& res, View& parentView, IPathButtonsBindi
|
||||||
setContentView(m_contentView.m_view.get());
|
setContentView(m_contentView.m_view.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PathButtons::~PathButtons() = default;
|
||||||
|
|
||||||
void PathButtons::setButtons(const std::vector<hecl::SystemString>& comps) {
|
void PathButtons::setButtons(const std::vector<hecl::SystemString>& comps) {
|
||||||
m_pathButtons.clear();
|
m_pathButtons.clear();
|
||||||
m_pathButtons.reserve(comps.size());
|
m_pathButtons.reserve(comps.size());
|
||||||
|
@ -25,46 +114,6 @@ void PathButtons::setMultiplyColor(const zeus::CColor& color) {
|
||||||
b.m_button.m_view->setMultiplyColor(color);
|
b.m_button.m_view->setMultiplyColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathButtons::ContentView::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button,
|
|
||||||
boo::EModifierKey mod) {
|
|
||||||
for (PathButton& b : m_pb.m_pathButtons)
|
|
||||||
b.m_button.mouseDown(coord, button, mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PathButtons::ContentView::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button,
|
|
||||||
boo::EModifierKey mod) {
|
|
||||||
for (PathButton& b : m_pb.m_pathButtons)
|
|
||||||
b.m_button.mouseUp(coord, button, mod);
|
|
||||||
if (m_pb.m_pathButtonPending >= 0) {
|
|
||||||
m_pb.m_binding.pathButtonActivated(m_pb.m_pathButtonPending);
|
|
||||||
m_pb.m_pathButtonPending = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PathButtons::ContentView::mouseMove(const boo::SWindowCoord& coord) {
|
|
||||||
for (PathButton& b : m_pb.m_pathButtons)
|
|
||||||
b.m_button.mouseMove(coord);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PathButtons::ContentView::mouseLeave(const boo::SWindowCoord& coord) {
|
|
||||||
for (PathButton& b : m_pb.m_pathButtons)
|
|
||||||
b.m_button.mouseLeave(coord);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PathButtons::ContentView::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub,
|
|
||||||
const boo::SWindowRect& scissor) {
|
|
||||||
View::resized(root, sub);
|
|
||||||
m_scissorRect = scissor;
|
|
||||||
m_scissorRect.size[1] += 2;
|
|
||||||
boo::SWindowRect pathRect = sub;
|
|
||||||
for (PathButton& b : m_pb.m_pathButtons) {
|
|
||||||
pathRect.size[0] = b.m_button.m_view->nominalWidth();
|
|
||||||
pathRect.size[1] = b.m_button.m_view->nominalHeight();
|
|
||||||
b.m_button.m_view->resized(root, pathRect);
|
|
||||||
pathRect.location[0] += pathRect.size[0] + 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PathButtons::containerResized(const boo::SWindowRect& root, const boo::SWindowRect& sub) {
|
void PathButtons::containerResized(const boo::SWindowRect& root, const boo::SWindowRect& sub) {
|
||||||
if (m_fillContainer) {
|
if (m_fillContainer) {
|
||||||
boo::SWindowRect fillRect = sub;
|
boo::SWindowRect fillRect = sub;
|
||||||
|
@ -73,11 +122,4 @@ void PathButtons::containerResized(const boo::SWindowRect& root, const boo::SWin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathButtons::ContentView::draw(boo::IGraphicsCommandQueue* gfxQ) {
|
|
||||||
gfxQ->setScissor(m_scissorRect);
|
|
||||||
for (PathButton& b : m_pb.m_pathButtons)
|
|
||||||
b.m_button.m_view->draw(gfxQ);
|
|
||||||
gfxQ->setScissor(rootView().subRect());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace specter
|
} // namespace specter
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
#include "specter/RootView.hpp"
|
#include "specter/RootView.hpp"
|
||||||
#include "specter/ViewResources.hpp"
|
|
||||||
#include "specter/Space.hpp"
|
#include "specter/Button.hpp"
|
||||||
|
#include "specter/Control.hpp"
|
||||||
|
#include "specter/IViewManager.hpp"
|
||||||
#include "specter/Menu.hpp"
|
#include "specter/Menu.hpp"
|
||||||
|
#include "specter/Space.hpp"
|
||||||
|
#include "specter/Tooltip.hpp"
|
||||||
|
#include "specter/ViewResources.hpp"
|
||||||
|
|
||||||
|
#include <logvisor/logvisor.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
static logvisor::Module Log("specter::RootView");
|
static logvisor::Module Log("specter::RootView");
|
||||||
|
@ -497,6 +504,8 @@ void RootView::modKeyUp(boo::EModifierKey mod) {
|
||||||
m_activeTextView->modKeyUp(mod);
|
m_activeTextView->modKeyUp(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boo::ITextInputCallback* RootView::getTextInputCallback() { return m_activeTextView; }
|
||||||
|
|
||||||
void RootView::resetTooltip(ViewResources& res) {
|
void RootView::resetTooltip(ViewResources& res) {
|
||||||
m_tooltip.reset(
|
m_tooltip.reset(
|
||||||
new Tooltip(res, *this, "Test",
|
new Tooltip(res, *this, "Test",
|
||||||
|
@ -528,6 +537,18 @@ void RootView::internalThink() {
|
||||||
m_rightClickMenu.m_view->think();
|
m_rightClickMenu.m_view->think();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RootView::setActiveTextView(ITextInputView* textView) {
|
||||||
|
if (m_activeTextView) {
|
||||||
|
m_activeTextView->setActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_activeTextView = textView;
|
||||||
|
|
||||||
|
if (textView) {
|
||||||
|
textView->setActive(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RootView::draw(boo::IGraphicsCommandQueue* gfxQ) {
|
void RootView::draw(boo::IGraphicsCommandQueue* gfxQ) {
|
||||||
if (m_resizeRTDirty) {
|
if (m_resizeRTDirty) {
|
||||||
gfxQ->resizeRenderTexture(m_renderTex, m_rootRect.size[0], m_rootRect.size[1]);
|
gfxQ->resizeRenderTexture(m_renderTex, m_rootRect.size[0], m_rootRect.size[1]);
|
||||||
|
@ -549,6 +570,8 @@ void RootView::draw(boo::IGraphicsCommandQueue* gfxQ) {
|
||||||
gfxQ->resolveDisplay(m_renderTex);
|
gfxQ->resolveDisplay(m_renderTex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const IThemeData& RootView::themeData() const { return *m_viewRes->m_theme; }
|
||||||
|
|
||||||
void RootView::SplitMenuSystem::draw(boo::IGraphicsCommandQueue* gfxQ) {
|
void RootView::SplitMenuSystem::draw(boo::IGraphicsCommandQueue* gfxQ) {
|
||||||
if (m_phase == Phase::Inactive)
|
if (m_phase == Phase::Inactive)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
#include "specter/ScrollView.hpp"
|
#include "specter/ScrollView.hpp"
|
||||||
#include "specter/ViewResources.hpp"
|
|
||||||
#include "specter/RootView.hpp"
|
#include <algorithm>
|
||||||
|
|
||||||
#include "specter/Button.hpp"
|
#include "specter/Button.hpp"
|
||||||
|
#include "specter/IViewManager.hpp"
|
||||||
|
#include "specter/RootView.hpp"
|
||||||
|
#include "specter/ViewResources.hpp"
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
#define MAX_SCROLL_SPEED 100
|
#define MAX_SCROLL_SPEED 100
|
||||||
|
@ -20,6 +24,27 @@ ScrollView::ScrollView(ViewResources& res, View& parentView, Style style)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScrollView::SideButtonBinding::SideButtonBinding(ScrollView& sv, IViewManager& vm)
|
||||||
|
: m_sv(sv), m_leftName(vm.translate<locale::scroll_left>()), m_rightName(vm.translate<locale::scroll_right>()) {}
|
||||||
|
|
||||||
|
std::string_view ScrollView::SideButtonBinding::name(const Control* control) const {
|
||||||
|
return (control == reinterpret_cast<Control*>(m_sv.m_sideButtons[0].m_view.get())) ? m_leftName.c_str()
|
||||||
|
: m_rightName.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrollView::SideButtonBinding::down(const Button* button, [[maybe_unused]] const boo::SWindowCoord& coord) {
|
||||||
|
if (button == m_sv.m_sideButtons[0].m_view.get()) {
|
||||||
|
m_sv.m_sideButtonState = SideButtonState::ScrollRight;
|
||||||
|
} else {
|
||||||
|
m_sv.m_sideButtonState = SideButtonState::ScrollLeft;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrollView::SideButtonBinding::up([[maybe_unused]] const Button* button,
|
||||||
|
[[maybe_unused]] const boo::SWindowCoord& coord) {
|
||||||
|
m_sv.m_sideButtonState = SideButtonState::None;
|
||||||
|
}
|
||||||
|
|
||||||
bool ScrollView::_scroll(const boo::SScrollDelta& scroll) {
|
bool ScrollView::_scroll(const boo::SScrollDelta& scroll) {
|
||||||
if (m_contentView.m_view) {
|
if (m_contentView.m_view) {
|
||||||
float ratioX = subRect().size[0] / float(m_contentView.m_view->nominalWidth());
|
float ratioX = subRect().size[0] / float(m_contentView.m_view->nominalWidth());
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
#include "logvisor/logvisor.hpp"
|
|
||||||
#include "specter/Space.hpp"
|
#include "specter/Space.hpp"
|
||||||
#include "specter/ViewResources.hpp"
|
|
||||||
|
#include "specter/IViewManager.hpp"
|
||||||
#include "specter/RootView.hpp"
|
#include "specter/RootView.hpp"
|
||||||
|
#include "specter/ViewResources.hpp"
|
||||||
|
|
||||||
|
#include <logvisor/logvisor.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
static logvisor::Module Log("specter::Space");
|
static logvisor::Module Log("specter::Space");
|
||||||
|
@ -17,6 +20,21 @@ static logvisor::Module Log("specter::Space");
|
||||||
|
|
||||||
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};
|
||||||
|
|
||||||
|
struct Space::CornerView : View {
|
||||||
|
Space& m_space;
|
||||||
|
VertexBufferBindingSolid m_vertexBinding;
|
||||||
|
bool m_flip;
|
||||||
|
|
||||||
|
CornerView(ViewResources& res, Space& space, const zeus::CColor& triColor);
|
||||||
|
void mouseEnter(const boo::SWindowCoord&) override;
|
||||||
|
void mouseLeave(const boo::SWindowCoord&) override;
|
||||||
|
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
|
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
|
using View::resized;
|
||||||
|
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub, bool flip);
|
||||||
|
void draw(boo::IGraphicsCommandQueue* gfxQ) override;
|
||||||
|
};
|
||||||
|
|
||||||
Space::Space(ViewResources& res, View& parentView, ISpaceController& controller, Toolbar::Position tbPos,
|
Space::Space(ViewResources& res, View& parentView, ISpaceController& controller, Toolbar::Position tbPos,
|
||||||
unsigned tbUnits)
|
unsigned tbUnits)
|
||||||
: View(res, parentView), m_controller(controller), m_tbPos(tbPos) {
|
: View(res, parentView), m_controller(controller), m_tbPos(tbPos) {
|
||||||
|
@ -31,6 +49,8 @@ Space::Space(ViewResources& res, View& parentView, ISpaceController& controller,
|
||||||
m_toolbar.m_view.reset(new Toolbar(res, *this, tbPos, tbUnits));
|
m_toolbar.m_view.reset(new Toolbar(res, *this, tbPos, tbUnits));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Space::~Space() = default;
|
||||||
|
|
||||||
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) {
|
: View(res, space), m_space(space) {
|
||||||
commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool {
|
commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool {
|
||||||
|
|
|
@ -1,13 +1,39 @@
|
||||||
#include "specter/Table.hpp"
|
#include "specter/Table.hpp"
|
||||||
#include "specter/ViewResources.hpp"
|
|
||||||
#include "specter/RootView.hpp"
|
#include "specter/RootView.hpp"
|
||||||
#include "specter/ScrollView.hpp"
|
#include "specter/ScrollView.hpp"
|
||||||
|
#include "specter/TextView.hpp"
|
||||||
|
#include "specter/ViewResources.hpp"
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
static logvisor::Module Log("specter::Table");
|
static logvisor::Module Log("specter::Table");
|
||||||
#define ROW_HEIGHT 18
|
#define ROW_HEIGHT 18
|
||||||
#define CELL_MARGIN 1
|
#define CELL_MARGIN 1
|
||||||
|
|
||||||
|
struct Table::CellView : public View {
|
||||||
|
Table& m_t;
|
||||||
|
std::unique_ptr<TextView> m_text;
|
||||||
|
size_t m_c = SIZE_MAX, m_r = SIZE_MAX;
|
||||||
|
boo::SWindowRect m_scissorRect;
|
||||||
|
uint64_t m_textHash = 0;
|
||||||
|
bool m_selected = false;
|
||||||
|
|
||||||
|
CellView(Table& t, ViewResources& res);
|
||||||
|
|
||||||
|
void select();
|
||||||
|
void deselect();
|
||||||
|
void reset();
|
||||||
|
bool reset(size_t c);
|
||||||
|
bool reset(size_t c, size_t r);
|
||||||
|
|
||||||
|
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
|
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
|
||||||
|
void mouseEnter(const boo::SWindowCoord&) override;
|
||||||
|
void mouseLeave(const boo::SWindowCoord&) override;
|
||||||
|
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub, const boo::SWindowRect& scissor) override;
|
||||||
|
void draw(boo::IGraphicsCommandQueue* gfxQ) override;
|
||||||
|
};
|
||||||
|
|
||||||
Table::Table(ViewResources& res, View& parentView, ITableDataBinding* data, ITableStateBinding* state,
|
Table::Table(ViewResources& res, View& parentView, ITableDataBinding* data, ITableStateBinding* state,
|
||||||
size_t maxColumns)
|
size_t maxColumns)
|
||||||
: View(res, parentView)
|
: View(res, parentView)
|
||||||
|
@ -31,6 +57,8 @@ Table::Table(ViewResources& res, View& parentView, ITableDataBinding* data, ITab
|
||||||
updateData();
|
updateData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Table::~Table() = default;
|
||||||
|
|
||||||
Table::RowsView::RowsView(Table& t, ViewResources& res)
|
Table::RowsView::RowsView(Table& t, ViewResources& res)
|
||||||
: View(res, t), m_t(t), m_verts(new SolidShaderVert[SPECTER_TABLE_MAX_ROWS * t.m_maxColumns * 6]) {
|
: View(res, t), m_t(t), m_verts(new SolidShaderVert[SPECTER_TABLE_MAX_ROWS * t.m_maxColumns * 6]) {
|
||||||
commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool {
|
commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool {
|
||||||
|
@ -659,6 +687,8 @@ int Table::RowsView::nominalHeight() const {
|
||||||
return rows * (ROW_HEIGHT + CELL_MARGIN * 2) * pf;
|
return rows * (ROW_HEIGHT + CELL_MARGIN * 2) * pf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Table::RowsView::nominalWidth() const { return m_t.m_scroll.m_view->nominalWidth(); }
|
||||||
|
|
||||||
void Table::RowsView::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub,
|
void Table::RowsView::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub,
|
||||||
const boo::SWindowRect& scissor) {
|
const boo::SWindowRect& scissor) {
|
||||||
View::resized(root, sub);
|
View::resized(root, sub);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "specter/TextField.hpp"
|
#include "specter/TextField.hpp"
|
||||||
|
|
||||||
#include "specter/RootView.hpp"
|
#include "specter/RootView.hpp"
|
||||||
|
#include "specter/TextView.hpp"
|
||||||
#include "specter/ViewResources.hpp"
|
#include "specter/ViewResources.hpp"
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
@ -22,6 +24,8 @@ TextField::TextField(ViewResources& res, View& parentView, IStringBinding* strBi
|
||||||
setText(strBind->getDefault(this));
|
setText(strBind->getDefault(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextField::~TextField() = default;
|
||||||
|
|
||||||
void TextField::_setText() {
|
void TextField::_setText() {
|
||||||
if (m_hasTextSet) {
|
if (m_hasTextSet) {
|
||||||
_clearSelectionRange();
|
_clearSelectionRange();
|
||||||
|
@ -721,6 +725,21 @@ void TextField::clearSelectionRange() {
|
||||||
m_hasSelectionSet = false;
|
m_hasSelectionSet = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextField::setMultiplyColor(const zeus::CColor& color) {
|
||||||
|
View::setMultiplyColor(color);
|
||||||
|
m_viewVertBlock.m_color = color;
|
||||||
|
|
||||||
|
if (m_viewVertBlockBuf) {
|
||||||
|
m_viewVertBlockBuf.access().finalAssign(m_viewVertBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_text->setMultiplyColor(color);
|
||||||
|
|
||||||
|
if (m_errText) {
|
||||||
|
m_errText->setMultiplyColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TextField::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub) {
|
void TextField::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub) {
|
||||||
float pf = rootView().viewRes().pixelFactor();
|
float pf = rootView().viewRes().pixelFactor();
|
||||||
int width = sub.size[0];
|
int width = sub.size[0];
|
||||||
|
|
|
@ -31,6 +31,8 @@ Toolbar::Toolbar(ViewResources& res, View& parentView, Position tbPos, unsigned
|
||||||
setBackground(res.themeData().toolbarBackground());
|
setBackground(res.themeData().toolbarBackground());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Toolbar::~Toolbar() = default;
|
||||||
|
|
||||||
void Toolbar::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod) {
|
void Toolbar::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod) {
|
||||||
for (std::vector<ViewChild<View*>>& u : m_children)
|
for (std::vector<ViewChild<View*>>& u : m_children)
|
||||||
for (ViewChild<View*>& c : u)
|
for (ViewChild<View*>& c : u)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "specter/Tooltip.hpp"
|
#include "specter/Tooltip.hpp"
|
||||||
#include "specter/ViewResources.hpp"
|
|
||||||
|
#include "specter/MultiLineTextView.hpp"
|
||||||
#include "specter/RootView.hpp"
|
#include "specter/RootView.hpp"
|
||||||
|
#include "specter/ViewResources.hpp"
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
|
|
||||||
|
@ -44,6 +46,8 @@ Tooltip::Tooltip(ViewResources& res, View& parentView, std::string_view title, s
|
||||||
m_nomHeight = m_title->nominalHeight() + m_message->nominalHeight() + margin.second * 3;
|
m_nomHeight = m_title->nominalHeight() + m_message->nominalHeight() + margin.second * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Tooltip::~Tooltip() = default;
|
||||||
|
|
||||||
void Tooltip::setVerts(int width, int height, float pf) {
|
void Tooltip::setVerts(int width, int height, float pf) {
|
||||||
std::pair<int, int> margin = m_cornersFilled[0]->queryGlyphDimensions(0);
|
std::pair<int, int> margin = m_cornersFilled[0]->queryGlyphDimensions(0);
|
||||||
width = std::max(width, margin.first * 2);
|
width = std::max(width, margin.first * 2);
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
#include "specter/View.hpp"
|
#include "specter/View.hpp"
|
||||||
#include "specter/ViewResources.hpp"
|
|
||||||
#include "specter/RootView.hpp"
|
#include "specter/RootView.hpp"
|
||||||
#include "hecl/Pipeline.hpp"
|
#include "specter/ViewResources.hpp"
|
||||||
|
|
||||||
|
#include <boo/System.hpp>
|
||||||
|
#include <hecl/Pipeline.hpp>
|
||||||
|
#include <logvisor/logvisor.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
static logvisor::Module Log("specter::View");
|
static logvisor::Module Log("specter::View");
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "specter/ViewResources.hpp"
|
#include "specter/ViewResources.hpp"
|
||||||
|
|
||||||
|
#include <boo/System.hpp>
|
||||||
|
#include <logvisor/logvisor.hpp>
|
||||||
|
|
||||||
namespace specter {
|
namespace specter {
|
||||||
static logvisor::Module Log("specter::ViewResources");
|
static logvisor::Module Log("specter::ViewResources");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue