mirror of https://github.com/AxioDL/metaforce.git
Merge pull request #11 from lioncash/make
General: Use std::make_unique where applicable
This commit is contained in:
commit
6902ba49be
|
@ -68,8 +68,8 @@ Button::Button(ViewResources& res, View& parentView, IButtonBinding* controlBind
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
m_buttonTarget.m_view.reset(new ButtonTarget(res, *this));
|
m_buttonTarget.m_view = std::make_unique<ButtonTarget>(res, *this);
|
||||||
m_menuTarget.m_view.reset(new MenuTarget(res, *this));
|
m_menuTarget.m_view = std::make_unique<MenuTarget>(res, *this);
|
||||||
|
|
||||||
if (style == Style::Block) {
|
if (style == Style::Block) {
|
||||||
zeus::CColor c1 = res.themeData().button1Inactive() * bgColor;
|
zeus::CColor c1 = res.themeData().button1Inactive() * bgColor;
|
||||||
|
@ -97,13 +97,15 @@ Button::Button(ViewResources& res, View& parentView, IButtonBinding* controlBind
|
||||||
m_verts[i].m_color = m_textColor;
|
m_verts[i].m_color = m_textColor;
|
||||||
_loadVerts();
|
_loadVerts();
|
||||||
|
|
||||||
if (controlBinding)
|
if (controlBinding != nullptr) {
|
||||||
m_menuStyle = controlBinding->menuStyle(this);
|
m_menuStyle = controlBinding->menuStyle(this);
|
||||||
|
}
|
||||||
|
|
||||||
if (icon)
|
if (icon != nullptr) {
|
||||||
m_icon.reset(new IconView(res, *this, *icon));
|
m_icon = std::make_unique<IconView>(res, *this, *icon);
|
||||||
|
}
|
||||||
|
|
||||||
m_text.reset(new TextView(res, *this, res.m_mainFont, TextView::Alignment::Center));
|
m_text = std::make_unique<TextView>(res, *this, res.m_mainFont, TextView::Alignment::Center);
|
||||||
setText(m_textStr);
|
setText(m_textStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,10 +229,12 @@ void Button::setText(std::string_view text, const zeus::CColor& textColor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button::setIcon(Icon* icon) {
|
void Button::setIcon(Icon* icon) {
|
||||||
if (icon)
|
if (icon != nullptr) {
|
||||||
m_icon.reset(new IconView(rootView().viewRes(), *this, *icon));
|
m_icon = std::make_unique<IconView>(rootView().viewRes(), *this, *icon);
|
||||||
else
|
} else {
|
||||||
m_icon.reset();
|
m_icon.reset();
|
||||||
|
}
|
||||||
|
|
||||||
setText(m_textStr);
|
setText(m_textStr);
|
||||||
updateSize();
|
updateSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,23 +60,21 @@ FileBrowser::FileBrowser(ViewResources& res, View& parentView, std::string_view
|
||||||
, m_systemBookmarkBind(*this)
|
, m_systemBookmarkBind(*this)
|
||||||
, m_projectBookmarkBind(*this)
|
, m_projectBookmarkBind(*this)
|
||||||
, m_recentBookmarkBind(*this)
|
, m_recentBookmarkBind(*this)
|
||||||
, m_returnFunc(returnFunc) {
|
, m_returnFunc(std::move(returnFunc)) {
|
||||||
setBackground({0, 0, 0, 0.5});
|
setBackground({0, 0, 0, 0.5});
|
||||||
|
|
||||||
IViewManager& vm = rootView().viewManager();
|
IViewManager& vm = rootView().viewManager();
|
||||||
m_pathButtons.m_view.reset(new PathButtons(res, *this, *this));
|
m_pathButtons.m_view = std::make_unique<PathButtons>(res, *this, *this);
|
||||||
m_fileField.m_view.reset(new TextField(res, *this, &m_fileFieldBind));
|
m_fileField.m_view = std::make_unique<TextField>(res, *this, &m_fileFieldBind);
|
||||||
m_fileListing.m_view.reset(new Table(res, *this, &m_fileListingBind, &m_fileListingBind, 3));
|
m_fileListing.m_view = std::make_unique<Table>(res, *this, &m_fileListingBind, &m_fileListingBind, 3);
|
||||||
m_systemBookmarks.m_view.reset(new Table(res, *this, &m_systemBookmarkBind, &m_systemBookmarkBind, 1));
|
m_systemBookmarks.m_view = std::make_unique<Table>(res, *this, &m_systemBookmarkBind, &m_systemBookmarkBind, 1);
|
||||||
m_systemBookmarksLabel.reset(new TextView(res, *this, res.m_mainFont));
|
m_systemBookmarksLabel = std::make_unique<TextView>(res, *this, res.m_mainFont);
|
||||||
m_systemBookmarksLabel->typesetGlyphs(vm.translate<locale::system_locations>(),
|
m_systemBookmarksLabel->typesetGlyphs(vm.translate<locale::system_locations>(), res.themeData().uiText());
|
||||||
res.themeData().uiText());
|
m_projectBookmarks.m_view = std::make_unique<Table>(res, *this, &m_projectBookmarkBind, &m_projectBookmarkBind, 1);
|
||||||
m_projectBookmarks.m_view.reset(new Table(res, *this, &m_projectBookmarkBind, &m_projectBookmarkBind, 1));
|
m_projectBookmarksLabel = std::make_unique<TextView>(res, *this, res.m_mainFont);
|
||||||
m_projectBookmarksLabel.reset(new TextView(res, *this, res.m_mainFont));
|
m_projectBookmarksLabel->typesetGlyphs(vm.translate<locale::recent_projects>(), res.themeData().uiText());
|
||||||
m_projectBookmarksLabel->typesetGlyphs(vm.translate<locale::recent_projects>(),
|
m_recentBookmarks.m_view = std::make_unique<Table>(res, *this, &m_recentBookmarkBind, &m_recentBookmarkBind, 1);
|
||||||
res.themeData().uiText());
|
m_recentBookmarksLabel = std::make_unique<TextView>(res, *this, res.m_mainFont);
|
||||||
m_recentBookmarks.m_view.reset(new Table(res, *this, &m_recentBookmarkBind, &m_recentBookmarkBind, 1));
|
|
||||||
m_recentBookmarksLabel.reset(new TextView(res, *this, res.m_mainFont));
|
|
||||||
m_recentBookmarksLabel->typesetGlyphs(vm.translate<locale::recent_files>(), res.themeData().uiText());
|
m_recentBookmarksLabel->typesetGlyphs(vm.translate<locale::recent_files>(), res.themeData().uiText());
|
||||||
|
|
||||||
/* Populate system bookmarks */
|
/* Populate system bookmarks */
|
||||||
|
@ -99,8 +97,8 @@ FileBrowser::FileBrowser(ViewResources& res, View& parentView, std::string_view
|
||||||
|
|
||||||
navigateToPath(initialPath);
|
navigateToPath(initialPath);
|
||||||
|
|
||||||
m_split.m_view.reset(new SplitView(res, *this, nullptr, SplitView::Axis::Vertical, 0.2, 200 * res.pixelFactor(),
|
m_split.m_view = std::make_unique<SplitView>(res, *this, nullptr, SplitView::Axis::Vertical, 0.2,
|
||||||
400 * res.pixelFactor()));
|
200 * res.pixelFactor(), 400 * res.pixelFactor());
|
||||||
m_split.m_view->setContentView(0, &m_left);
|
m_split.m_view->setContentView(0, &m_left);
|
||||||
m_split.m_view->setContentView(1, &m_right);
|
m_split.m_view->setContentView(1, &m_right);
|
||||||
|
|
||||||
|
@ -208,17 +206,16 @@ void FileBrowser::okActivated(bool viaButton) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!err && !S_ISDIR(theStat.st_mode)) {
|
if (!err && !S_ISDIR(theStat.st_mode)) {
|
||||||
m_confirmWindow.reset(
|
m_confirmWindow = std::make_unique<MessageWindow>(
|
||||||
new MessageWindow(rootView().viewRes(), *this, MessageWindow::Type::ConfirmOkCancel,
|
rootView().viewRes(), *this, MessageWindow::Type::ConfirmOkCancel,
|
||||||
vm.translate<locale::overwrite_confirm>(hecl::SystemUTF8Conv(path)),
|
vm.translate<locale::overwrite_confirm>(hecl::SystemUTF8Conv(path)), [&, path](bool ok) {
|
||||||
[&, path](bool ok) {
|
if (ok) {
|
||||||
if (ok) {
|
m_returnFunc(true, path);
|
||||||
m_returnFunc(true, path);
|
m_confirmWindow->close();
|
||||||
m_confirmWindow->close();
|
close();
|
||||||
close();
|
} else
|
||||||
} else
|
m_confirmWindow->close();
|
||||||
m_confirmWindow->close();
|
});
|
||||||
}));
|
|
||||||
updateSize();
|
updateSize();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -587,16 +584,16 @@ void FileBrowser::RightSide::draw(boo::IGraphicsCommandQueue* gfxQ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FileBrowser::OKButton::OKButton(FileBrowser& fb, ViewResources& res, std::string_view text) : m_fb(fb), m_text(text) {
|
FileBrowser::OKButton::OKButton(FileBrowser& fb, ViewResources& res, std::string_view text) : m_fb(fb), m_text(text) {
|
||||||
m_button.m_view.reset(
|
m_button.m_view =
|
||||||
new Button(res, fb, this, text, nullptr, Button::Style::Block, zeus::skWhite,
|
std::make_unique<Button>(res, fb, this, text, nullptr, Button::Style::Block, zeus::skWhite,
|
||||||
RectangleConstraint(100 * res.pixelFactor(), -1, RectangleConstraint::Test::Minimum)));
|
RectangleConstraint(100 * res.pixelFactor(), -1, RectangleConstraint::Test::Minimum));
|
||||||
}
|
}
|
||||||
|
|
||||||
FileBrowser::CancelButton::CancelButton(FileBrowser& fb, ViewResources& res, std::string_view text)
|
FileBrowser::CancelButton::CancelButton(FileBrowser& fb, ViewResources& res, std::string_view text)
|
||||||
: m_fb(fb), m_text(text) {
|
: m_fb(fb), m_text(text) {
|
||||||
m_button.m_view.reset(new Button(
|
m_button.m_view = std::make_unique<Button>(
|
||||||
res, fb, this, text, nullptr, Button::Style::Block, zeus::skWhite,
|
res, fb, this, text, nullptr, Button::Style::Block, zeus::skWhite,
|
||||||
RectangleConstraint(m_fb.m_ok.m_button.m_view->nominalWidth(), -1, RectangleConstraint::Test::Minimum)));
|
RectangleConstraint(m_fb.m_ok.m_button.m_view->nominalWidth(), -1, RectangleConstraint::Test::Minimum));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace specter
|
} // namespace specter
|
||||||
|
|
|
@ -19,9 +19,9 @@ Menu::Menu(ViewResources& res, View& parentView, IMenuNode* rootNode) : View(res
|
||||||
m_vertsBinding.init(ctx, res, 8, m_viewVertBlockBuf);
|
m_vertsBinding.init(ctx, res, 8, m_viewVertBlockBuf);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
m_headText.reset(new TextView(res, *this, res.m_mainFont));
|
m_headText = std::make_unique<TextView>(res, *this, res.m_mainFont);
|
||||||
m_scroll.m_view.reset(new ScrollView(res, *this, ScrollView::Style::ThinIndicator));
|
m_scroll.m_view = std::make_unique<ScrollView>(res, *this, ScrollView::Style::ThinIndicator);
|
||||||
m_content.reset(new ContentView(res, *this));
|
m_content = std::make_unique<ContentView>(res, *this);
|
||||||
m_scroll.m_view->setContentView(m_content.get());
|
m_scroll.m_view->setContentView(m_content.get());
|
||||||
reset(rootNode);
|
reset(rootNode);
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,8 @@ void Menu::reset(IMenuNode* rootNode) {
|
||||||
const std::string* nodeText = node->text();
|
const std::string* nodeText = node->text();
|
||||||
ViewChild<std::unique_ptr<ItemView>>& item = m_items.emplace_back();
|
ViewChild<std::unique_ptr<ItemView>>& item = m_items.emplace_back();
|
||||||
|
|
||||||
if (nodeText) {
|
if (nodeText != nullptr) {
|
||||||
item.m_view.reset(new ItemView(res, *this, *nodeText, i, node));
|
item.m_view = std::make_unique<ItemView>(res, *this, *nodeText, i, node);
|
||||||
m_cWidth = std::max(m_cWidth, int(item.m_view->m_textView->nominalWidth() + 10 * pf));
|
m_cWidth = std::max(m_cWidth, int(item.m_view->m_textView->nominalWidth() + 10 * pf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,9 +74,9 @@ Menu::Menu(ViewResources& res, View& parentView, IMenuNode* rootNode, IMenuNode*
|
||||||
m_vertsBinding.init(ctx, res, 8, m_viewVertBlockBuf);
|
m_vertsBinding.init(ctx, res, 8, m_viewVertBlockBuf);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
m_headText.reset(new TextView(res, *this, res.m_mainFont));
|
m_headText = std::make_unique<TextView>(res, *this, res.m_mainFont);
|
||||||
m_scroll.m_view.reset(new ScrollView(res, *this, ScrollView::Style::ThinIndicator));
|
m_scroll.m_view = std::make_unique<ScrollView>(res, *this, ScrollView::Style::ThinIndicator);
|
||||||
m_content.reset(new ContentView(res, *this));
|
m_content = std::make_unique<ContentView>(res, *this);
|
||||||
m_scroll.m_view->setContentView(m_content.get());
|
m_scroll.m_view->setContentView(m_content.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ Menu::ItemView::ItemView(ViewResources& res, Menu& menu, std::string_view text,
|
||||||
buildResources(ctx, res);
|
buildResources(ctx, res);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
m_textView.reset(new specter::TextView(res, *this, res.m_mainFont));
|
m_textView = std::make_unique<TextView>(res, *this, res.m_mainFont);
|
||||||
m_textView->typesetGlyphs(text, res.themeData().uiText());
|
m_textView->typesetGlyphs(text, res.themeData().uiText());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,18 +16,20 @@ MessageWindow::MessageWindow(ViewResources& res, View& parentView, Type type, st
|
||||||
: ModalWindow(res, parentView, RectangleConstraint(),
|
: ModalWindow(res, parentView, RectangleConstraint(),
|
||||||
type == Type::ErrorOk ? res.themeData().splashErrorBackground() : res.themeData().splashBackground())
|
type == Type::ErrorOk ? res.themeData().splashErrorBackground() : res.themeData().splashBackground())
|
||||||
, m_type(type)
|
, m_type(type)
|
||||||
, m_func(func)
|
, m_func(std::move(func))
|
||||||
, m_okBind(*this, rootView().viewManager().translate<locale::ok>())
|
, m_okBind(*this, rootView().viewManager().translate<locale::ok>())
|
||||||
, m_cancelBind(*this, rootView().viewManager().translate<locale::cancel>()) {
|
, m_cancelBind(*this, rootView().viewManager().translate<locale::cancel>()) {
|
||||||
m_text.reset(new MultiLineTextView(res, *this, res.m_mainFont, TextView::Alignment::Center));
|
m_text = std::make_unique<MultiLineTextView>(res, *this, res.m_mainFont, TextView::Alignment::Center);
|
||||||
m_text->typesetGlyphs(message, res.themeData().uiText(), 380 * res.pixelFactor());
|
m_text->typesetGlyphs(message, res.themeData().uiText(), 380 * res.pixelFactor());
|
||||||
constraint() = RectangleConstraint(400 * res.pixelFactor(), 80 * res.pixelFactor() + m_text->nominalHeight());
|
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,
|
m_ok.m_view = std::make_unique<Button>(res, *this, &m_okBind, m_okBind.m_name, nullptr, Button::Style::Block,
|
||||||
zeus::skWhite, RectangleConstraint(150 * res.pixelFactor())));
|
zeus::skWhite, RectangleConstraint(150 * res.pixelFactor()));
|
||||||
if (type == Type::ConfirmOkCancel)
|
if (type == Type::ConfirmOkCancel) {
|
||||||
m_cancel.m_view.reset(new Button(res, *this, &m_cancelBind, m_cancelBind.m_name, nullptr, Button::Style::Block,
|
m_cancel.m_view =
|
||||||
zeus::skWhite, RectangleConstraint(150 * res.pixelFactor())));
|
std::make_unique<Button>(res, *this, &m_cancelBind, m_cancelBind.m_name, nullptr, Button::Style::Block,
|
||||||
|
zeus::skWhite, RectangleConstraint(150 * res.pixelFactor()));
|
||||||
|
}
|
||||||
|
|
||||||
updateContentOpacity(0.0);
|
updateContentOpacity(0.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,9 +288,9 @@ ModalWindow::ModalWindow(ViewResources& res, View& parentView, const RectangleCo
|
||||||
} BooTrace);
|
} BooTrace);
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
m_cornersOutline[i].reset(
|
m_cornersOutline[i] =
|
||||||
new specter::TextView(res, *this, res.m_curveFont, specter::TextView::Alignment::Left, 1));
|
std::make_unique<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_cornersFilled[i] = std::make_unique<TextView>(res, *this, res.m_curveFont, specter::TextView::Alignment::Left, 1);
|
||||||
}
|
}
|
||||||
m_cornersOutline[0]->typesetGlyphs(L"\xF4F0");
|
m_cornersOutline[0]->typesetGlyphs(L"\xF4F0");
|
||||||
m_cornersFilled[0]->typesetGlyphs(L"\xF4F1", res.themeData().splashBackground());
|
m_cornersFilled[0]->typesetGlyphs(L"\xF4F1", res.themeData().splashBackground());
|
||||||
|
|
|
@ -164,10 +164,9 @@ void MultiLineTextView::typesetGlyphs(std::string_view str, const zeus::CColor&
|
||||||
utf8proc_int32_t ch;
|
utf8proc_int32_t ch;
|
||||||
utf8proc_ssize_t sz = utf8proc_iterate(it, -1, &ch);
|
utf8proc_ssize_t sz = utf8proc_iterate(it, -1, &ch);
|
||||||
if (ch == '\n' || ch == '\0') {
|
if (ch == '\n' || ch == '\0') {
|
||||||
TextView& tv =
|
TextView& tv = (lineIt < m_lines.size()) ? *m_lines[lineIt]
|
||||||
(lineIt < m_lines.size())
|
: *m_lines.emplace_back(std::make_unique<TextView>(
|
||||||
? *m_lines[lineIt]
|
m_viewSystem, *this, m_fontAtlas, m_align, m_lineCapacity));
|
||||||
: *m_lines.emplace_back(new TextView(m_viewSystem, *this, m_fontAtlas, m_align, m_lineCapacity));
|
|
||||||
tv.typesetGlyphs(std::string((char*)beginIt, it - beginIt), defaultColor);
|
tv.typesetGlyphs(std::string((char*)beginIt, it - beginIt), defaultColor);
|
||||||
m_width = std::max(m_width, tv.nominalWidth());
|
m_width = std::max(m_width, tv.nominalWidth());
|
||||||
beginIt = it + 1;
|
beginIt = it + 1;
|
||||||
|
@ -206,10 +205,9 @@ void MultiLineTextView::typesetGlyphs(std::wstring_view str, const zeus::CColor&
|
||||||
|
|
||||||
while (rem) {
|
while (rem) {
|
||||||
if (*it == L'\n' || *it == L'\0') {
|
if (*it == L'\n' || *it == L'\0') {
|
||||||
TextView& tv =
|
TextView& tv = (lineIt < m_lines.size()) ? *m_lines[lineIt]
|
||||||
(lineIt < m_lines.size())
|
: *m_lines.emplace_back(std::make_unique<TextView>(
|
||||||
? *m_lines[lineIt]
|
m_viewSystem, *this, m_fontAtlas, m_align, m_lineCapacity));
|
||||||
: *m_lines.emplace_back(new TextView(m_viewSystem, *this, m_fontAtlas, m_align, m_lineCapacity));
|
|
||||||
tv.typesetGlyphs(std::wstring(beginIt, it), defaultColor);
|
tv.typesetGlyphs(std::wstring(beginIt, it), defaultColor);
|
||||||
m_width = std::max(m_width, tv.nominalWidth());
|
m_width = std::max(m_width, tv.nominalWidth());
|
||||||
beginIt = it + 1;
|
beginIt = it + 1;
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct PathButtons::PathButton final : IButtonBinding {
|
||||||
ViewChild<std::unique_ptr<Button>> m_button;
|
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) {
|
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()));
|
m_button.m_view = std::make_unique<Button>(res, pb, this, hecl::SystemUTF8Conv(str).str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string_view name(const Control* control) const override { return m_button.m_view->getText(); }
|
std::string_view name(const Control* control) const override { return m_button.m_view->getText(); }
|
||||||
|
@ -95,7 +95,7 @@ struct PathButtons::ContentView : public View {
|
||||||
|
|
||||||
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) {
|
||||||
m_contentView.m_view.reset(new ContentView(res, *this));
|
m_contentView.m_view = std::make_unique<ContentView>(res, *this);
|
||||||
setContentView(m_contentView.m_view.get());
|
setContentView(m_contentView.m_view.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -506,13 +506,13 @@ void RootView::modKeyUp(boo::EModifierKey mod) {
|
||||||
boo::ITextInputCallback* RootView::getTextInputCallback() { return m_activeTextView; }
|
boo::ITextInputCallback* RootView::getTextInputCallback() { return m_activeTextView; }
|
||||||
|
|
||||||
void RootView::resetTooltip(ViewResources& res) {
|
void RootView::resetTooltip(ViewResources& res) {
|
||||||
m_tooltip.reset(
|
m_tooltip = std::make_unique<Tooltip>(
|
||||||
new Tooltip(res, *this, "Test",
|
res, *this, "Test",
|
||||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi hendrerit nisl quis lobortis mattis. "
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi hendrerit nisl quis lobortis mattis. "
|
||||||
"Mauris efficitur, est a vestibulum iaculis, leo orci pellentesque nunc, non rutrum ipsum lectus "
|
"Mauris efficitur, est a vestibulum iaculis, leo orci pellentesque nunc, non rutrum ipsum lectus "
|
||||||
"eget nisl. Aliquam accumsan vestibulum turpis. Duis id lacus ac lectus sollicitudin posuere vel sit "
|
"eget nisl. Aliquam accumsan vestibulum turpis. Duis id lacus ac lectus sollicitudin posuere vel sit "
|
||||||
"amet metus. Aenean nec tortor id enim efficitur accumsan vitae eu ante. Lorem ipsum dolor sit amet, "
|
"amet metus. Aenean nec tortor id enim efficitur accumsan vitae eu ante. Lorem ipsum dolor sit amet, "
|
||||||
"consectetur adipiscing elit. Fusce magna eros, lacinia a leo eget, volutpat rhoncus urna."));
|
"consectetur adipiscing elit. Fusce magna eros, lacinia a leo eget, volutpat rhoncus urna.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RootView::displayTooltip(std::string_view name, std::string_view help) {}
|
void RootView::displayTooltip(std::string_view name, std::string_view help) {}
|
||||||
|
|
|
@ -21,8 +21,8 @@ ScrollView::ScrollView(ViewResources& res, View& parentView, Style style)
|
||||||
});
|
});
|
||||||
|
|
||||||
if (style == Style::SideButtons) {
|
if (style == Style::SideButtons) {
|
||||||
m_sideButtons[0].m_view.reset(new Button(res, *this, &m_sideButtonBind, "<"));
|
m_sideButtons[0].m_view = std::make_unique<Button>(res, *this, &m_sideButtonBind, "<");
|
||||||
m_sideButtons[1].m_view.reset(new Button(res, *this, &m_sideButtonBind, ">"));
|
m_sideButtons[1].m_view = std::make_unique<Button>(res, *this, &m_sideButtonBind, ">");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,10 +41,12 @@ Space::Space(ViewResources& res, View& parentView, ISpaceController& controller,
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
setBackground(res.themeData().spaceBackground());
|
setBackground(res.themeData().spaceBackground());
|
||||||
if (controller.spaceSplitAllowed())
|
if (controller.spaceSplitAllowed()) {
|
||||||
m_cornerView.m_view.reset(new CornerView(res, *this, TriColor));
|
m_cornerView.m_view = std::make_unique<CornerView>(res, *this, TriColor);
|
||||||
if (tbPos != Toolbar::Position::None)
|
}
|
||||||
m_toolbar.m_view.reset(new Toolbar(res, *this, tbPos, tbUnits));
|
if (tbPos != Toolbar::Position::None) {
|
||||||
|
m_toolbar.m_view = std::make_unique<Toolbar>(res, *this, tbPos, tbUnits);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Space::~Space() = default;
|
Space::~Space() = default;
|
||||||
|
|
|
@ -43,12 +43,13 @@ Table::Table(ViewResources& res, View& parentView, ITableDataBinding* data, ITab
|
||||||
, m_data(data)
|
, m_data(data)
|
||||||
, m_state(state)
|
, m_state(state)
|
||||||
, m_maxColumns(maxColumns)
|
, m_maxColumns(maxColumns)
|
||||||
, m_hVerts(new SolidShaderVert[maxColumns * 6])
|
, m_hVerts(std::make_unique<SolidShaderVert[]>(maxColumns * 6))
|
||||||
, m_rowsView(*this, res) {
|
, m_rowsView(*this, res) {
|
||||||
if (!maxColumns)
|
if (maxColumns == 0) {
|
||||||
Log.report(logvisor::Fatal, fmt("0-column tables not supported"));
|
Log.report(logvisor::Fatal, fmt("0-column tables not supported"));
|
||||||
|
}
|
||||||
|
|
||||||
m_scroll.m_view.reset(new ScrollView(res, *this, ScrollView::Style::ThinIndicator));
|
m_scroll.m_view = std::make_unique<ScrollView>(res, *this, ScrollView::Style::ThinIndicator);
|
||||||
|
|
||||||
commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool {
|
commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool {
|
||||||
buildResources(ctx, res);
|
buildResources(ctx, res);
|
||||||
|
@ -63,7 +64,7 @@ Table::Table(ViewResources& res, View& parentView, ITableDataBinding* data, ITab
|
||||||
Table::~Table() = default;
|
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(std::make_unique<SolidShaderVert[]>(SPECTER_TABLE_MAX_ROWS * t.m_maxColumns * 6)) {
|
||||||
commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool {
|
commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool {
|
||||||
buildResources(ctx, res);
|
buildResources(ctx, res);
|
||||||
m_vertsBinding.init(ctx, res, SPECTER_TABLE_MAX_ROWS * t.m_maxColumns * 6, m_viewVertBlockBuf);
|
m_vertsBinding.init(ctx, res, SPECTER_TABLE_MAX_ROWS * t.m_maxColumns * 6, m_viewVertBlockBuf);
|
||||||
|
@ -72,7 +73,7 @@ Table::RowsView::RowsView(Table& t, ViewResources& res)
|
||||||
}
|
}
|
||||||
|
|
||||||
Table::CellView::CellView(Table& t, ViewResources& res)
|
Table::CellView::CellView(Table& t, ViewResources& res)
|
||||||
: View(res, t), m_t(t), m_text(new TextView(res, *this, res.m_mainFont)) {}
|
: View(res, t), m_t(t), m_text(std::make_unique<TextView>(res, *this, res.m_mainFont)) {}
|
||||||
|
|
||||||
void Table::_setHeaderVerts(const boo::SWindowRect& sub) {
|
void Table::_setHeaderVerts(const boo::SWindowRect& sub) {
|
||||||
;
|
;
|
||||||
|
@ -532,18 +533,23 @@ std::vector<Table::ColumnPool>& Table::ensureCellPools(size_t rows, size_t cols,
|
||||||
for (size_t i = 0; i < cols; ++i) {
|
for (size_t i = 0; i < cols; ++i) {
|
||||||
ColumnPool& cp = m_cellPools[i];
|
ColumnPool& cp = m_cellPools[i];
|
||||||
if (rows > SPECTER_TABLE_MAX_ROWS) {
|
if (rows > SPECTER_TABLE_MAX_ROWS) {
|
||||||
for (int p = 0; p < 2; ++p)
|
for (int p = 0; p < 2; ++p) {
|
||||||
for (ViewChild<std::unique_ptr<CellView>>& cv : cp[p])
|
for (ViewChild<std::unique_ptr<CellView>>& cv : cp[p]) {
|
||||||
if (!cv.m_view)
|
if (cv.m_view == nullptr) {
|
||||||
cv.m_view.reset(new CellView(*this, res));
|
cv.m_view = std::make_unique<CellView>(*this, res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
size_t r = 0;
|
size_t r = 0;
|
||||||
for (ViewChild<std::unique_ptr<CellView>>& cv : cp[0]) {
|
for (ViewChild<std::unique_ptr<CellView>>& cv : cp[0]) {
|
||||||
if (!cv.m_view)
|
if (cv.m_view == nullptr) {
|
||||||
cv.m_view.reset(new CellView(*this, res));
|
cv.m_view = std::make_unique<CellView>(*this, res);
|
||||||
|
}
|
||||||
++r;
|
++r;
|
||||||
if (r >= rows)
|
if (r >= rows) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -579,10 +585,12 @@ void Table::_updateData() {
|
||||||
|
|
||||||
for (size_t c = 0; c < m_columns; ++c) {
|
for (size_t c = 0; c < m_columns; ++c) {
|
||||||
std::unique_ptr<CellView>& cv = m_headerViews[c].m_view;
|
std::unique_ptr<CellView>& cv = m_headerViews[c].m_view;
|
||||||
if (!cv)
|
if (cv == nullptr) {
|
||||||
cv.reset(new CellView(*this, res));
|
cv = std::make_unique<CellView>(*this, res);
|
||||||
if (cv->reset(c))
|
}
|
||||||
|
if (cv->reset(c)) {
|
||||||
m_header = true;
|
m_header = true;
|
||||||
|
}
|
||||||
|
|
||||||
ColumnPool& col = m_cellPools[c];
|
ColumnPool& col = m_cellPools[c];
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,10 @@ TextField::TextField(ViewResources& res, View& parentView, IStringBinding* strBi
|
||||||
setInactive();
|
setInactive();
|
||||||
m_vertsBinding.load<decltype(m_verts)>(m_verts);
|
m_vertsBinding.load<decltype(m_verts)>(m_verts);
|
||||||
|
|
||||||
m_text.reset(new TextView(res, *this, res.m_mainFont, TextView::Alignment::Left, 1024));
|
m_text = std::make_unique<TextView>(res, *this, res.m_mainFont, TextView::Alignment::Left, 1024);
|
||||||
if (strBind)
|
if (strBind != nullptr) {
|
||||||
setText(strBind->getDefault(this));
|
setText(strBind->getDefault(this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField::~TextField() = default;
|
TextField::~TextField() = default;
|
||||||
|
@ -605,7 +606,7 @@ void TextField::setErrorState(std::string_view message) {
|
||||||
clearSelectionRange();
|
clearSelectionRange();
|
||||||
refreshBg();
|
refreshBg();
|
||||||
|
|
||||||
m_errText.reset(new TextView(rootView().viewRes(), *this, rootView().viewRes().m_mainFont));
|
m_errText = std::make_unique<TextView>(rootView().viewRes(), *this, rootView().viewRes().m_mainFont);
|
||||||
m_errText->typesetGlyphs(message, rootView().themeData().uiText());
|
m_errText->typesetGlyphs(message, rootView().themeData().uiText());
|
||||||
|
|
||||||
updateSize();
|
updateSize();
|
||||||
|
|
|
@ -24,8 +24,8 @@ Tooltip::Tooltip(ViewResources& res, View& parentView, std::string_view title, s
|
||||||
});
|
});
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
m_cornersOutline[i].reset(new TextView(res, *this, res.m_curveFont, TextView::Alignment::Left, 1));
|
m_cornersOutline[i] = std::make_unique<TextView>(res, *this, res.m_curveFont, TextView::Alignment::Left, 1);
|
||||||
m_cornersFilled[i].reset(new TextView(res, *this, res.m_curveFont, TextView::Alignment::Left, 1));
|
m_cornersFilled[i] = std::make_unique<TextView>(res, *this, res.m_curveFont, TextView::Alignment::Left, 1);
|
||||||
}
|
}
|
||||||
m_cornersOutline[0]->typesetGlyphs(L"\xF4F0");
|
m_cornersOutline[0]->typesetGlyphs(L"\xF4F0");
|
||||||
m_cornersFilled[0]->typesetGlyphs(L"\xF4F1", res.themeData().tooltipBackground());
|
m_cornersFilled[0]->typesetGlyphs(L"\xF4F1", res.themeData().tooltipBackground());
|
||||||
|
@ -36,9 +36,9 @@ Tooltip::Tooltip(ViewResources& res, View& parentView, std::string_view title, s
|
||||||
m_cornersOutline[3]->typesetGlyphs(L"\xF4F6");
|
m_cornersOutline[3]->typesetGlyphs(L"\xF4F6");
|
||||||
m_cornersFilled[3]->typesetGlyphs(L"\xF4F7", res.themeData().tooltipBackground());
|
m_cornersFilled[3]->typesetGlyphs(L"\xF4F7", res.themeData().tooltipBackground());
|
||||||
|
|
||||||
m_title.reset(new TextView(res, *this, res.m_heading14));
|
m_title = std::make_unique<TextView>(res, *this, res.m_heading14);
|
||||||
m_title->typesetGlyphs(m_titleStr);
|
m_title->typesetGlyphs(m_titleStr);
|
||||||
m_message.reset(new MultiLineTextView(res, *this, res.m_mainFont));
|
m_message = std::make_unique<MultiLineTextView>(res, *this, res.m_mainFont);
|
||||||
m_message->typesetGlyphs(m_messageStr, zeus::skWhite, int(TOOLTIP_MAX_TEXT_WIDTH * res.pixelFactor()));
|
m_message->typesetGlyphs(m_messageStr, zeus::skWhite, int(TOOLTIP_MAX_TEXT_WIDTH * res.pixelFactor()));
|
||||||
|
|
||||||
float pf = res.pixelFactor();
|
float pf = res.pixelFactor();
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 63ecd3181380726d7e3fefbad6a7de33dc53e3c2
|
Subproject commit 9f0c1e8218076503e7bf899350403d019be5c244
|
Loading…
Reference in New Issue