Text for icons in the about dialog

This commit is contained in:
redtide 2021-04-05 21:14:37 +02:00
parent c2be936b7e
commit d87863ba9c
5 changed files with 60 additions and 36 deletions

View file

@ -4,47 +4,47 @@ header_name {.h}
code_name {.cxx}
widget_class aboutView {
label {About sfizz} open selected
xywh {536 183 800 475} type Double visible
xywh {527 165 800 475} type Double visible
} {
Fl_Box {} {
image {../resources/logo_orange.png} xywh {200 80 400 180}
class Logo
Fl_Box lblHover_ {
xywh {200 80 400 25} labelsize 10
class HoverBox
}
Fl_Button {} {
comment {tag=kTagButtonSfztools}
xywh {235 45 50 50} labelsize 30
xywh {235 45 35 35} labelsize 30
class ButtonSfztools
}
Fl_Button {} {
comment {tag=kTagButtonGithub}
xywh {305 45 50 50} labelsize 30
xywh {305 45 35 35} labelsize 30
class ButtonGithub
}
Fl_Button {} {
comment {tag=kTagButtonDiscord}
xywh {375 45 50 50} labelsize 30
xywh {375 45 35 35} labelsize 30
class ButtonDiscord
}
Fl_Button {} {
comment {tag=kTagButtonOpencollective}
xywh {445 45 50 50} labelsize 30
xywh {445 45 35 35} labelsize 30
class ButtonOpencollective
}
Fl_Button {} {
comment {tag=kTagButtonSfzformat}
xywh {515 45 50 50} labelsize 30
xywh {515 45 35 35} labelsize 30
class ButtonSfzformat
}
Fl_Box {} {
xywh {260 260 280 80}
image {../resources/logo_orange.png} xywh {200 90 400 180}
class Logo
}
Fl_Box {} {
xywh {260 270 280 80}
class InfoBox
}
Fl_Box {} {
xywh {200 350 400 100}
class DescriptionBox
}
Fl_Box lblHover_ {
xywh {320 10 160 25}
class HoverBox
}
}

View file

@ -67,9 +67,10 @@ SAboutDialog::SAboutDialog(const CRect& bounds)
lbl->setBackColor(CColor(0x00, 0x00, 0x00, 0x00));
lbl->setHoriAlign(align);
lbl->setText(absl::StrCat(
u8"Maintainers: Paul Ferrand, Jean-Pierre Cimalando\n"""
u8"Maintainers: Paul Ferrand, Jean-Pierre Cimalando\n"
u8"Contributors: Andrea Zanellato, Alexander Mitchell, Michael Willis,\n"
u8"Tobiasz \"unfa\" Karoń, Kinwie, Atsushi Eno, Dominique Würtz et al."));
u8"Tobiasz \"unfa\" Karoń, Kinwie, Atsushi Eno, Dominique Würtz,\n"
u8"Even Brenden et al."));
return lbl;
};
@ -95,20 +96,35 @@ SAboutDialog::SAboutDialog(const CRect& bounds)
btn->setGradientHighlighted(nullptr);
return btn;
};
auto createButtonSfztools = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
return createGlyphButton(u8"\ue000", bounds, tag, fontsize);
auto createButtonSfztools = [this, &createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
STextButton* btn = createGlyphButton(u8"\ue000", bounds, tag, fontsize);
btn->OnHoverEnter = [this]() { lblHover_->setText("SFZTools Website"); };
btn->OnHoverLeave = [this]() { lblHover_->setText(""); };
return btn;
};
auto createButtonGithub = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
return createGlyphButton(u8"\ue001", bounds, tag, fontsize);
auto createButtonGithub = [this, &createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
STextButton* btn = createGlyphButton(u8"\ue001", bounds, tag, fontsize);
btn->OnHoverEnter = [this]() { lblHover_->setText("GitHub Repository"); };
btn->OnHoverLeave = [this]() { lblHover_->setText(""); };
return btn;
};
auto createButtonDiscord = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
return createGlyphButton(u8"\ue002", bounds, tag, fontsize);
auto createButtonDiscord = [this, &createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
STextButton* btn = createGlyphButton(u8"\ue002", bounds, tag, fontsize);
btn->OnHoverEnter = [this]() { lblHover_->setText("Discord Chat"); };
btn->OnHoverLeave = [this]() { lblHover_->setText(""); };
return btn;
};
auto createButtonOpencollective = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
return createGlyphButton(u8"\ue003", bounds, tag, fontsize);
auto createButtonOpencollective = [this, &createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
STextButton* btn = createGlyphButton(u8"\ue003", bounds, tag, fontsize);
btn->OnHoverEnter = [this]() { lblHover_->setText("Support Us"); };
btn->OnHoverLeave = [this]() { lblHover_->setText(""); };
return btn;
};
auto createButtonSfzformat = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
return createGlyphButton(u8"\ue004", bounds, tag, fontsize);
auto createButtonSfzformat = [this, &createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
STextButton* btn = createGlyphButton(u8"\ue004", bounds, tag, fontsize);
btn->OnHoverEnter = [this]() { lblHover_->setText("SFZFormat Documentation"); };
btn->OnHoverLeave = [this]() { lblHover_->setText(""); };
return btn;
};
#include "layout/about.hpp"

View file

@ -448,6 +448,8 @@ void STextButton::draw(CDrawContext* context)
CMouseEventResult STextButton::onMouseEntered (CPoint& where, const CButtonState& buttons)
{
hovered_ = true;
if (OnHoverEnter)
OnHoverEnter();
invalid();
return CTextButton::onMouseEntered(where, buttons);
}
@ -455,6 +457,8 @@ CMouseEventResult STextButton::onMouseEntered (CPoint& where, const CButtonState
CMouseEventResult STextButton::onMouseExited (CPoint& where, const CButtonState& buttons)
{
hovered_ = false;
if (OnHoverLeave)
OnHoverLeave();
invalid();
return CTextButton::onMouseExited(where, buttons);
}

View file

@ -196,6 +196,10 @@ public:
CMouseEventResult onMouseEntered (CPoint& where, const CButtonState& buttons) override;
CMouseEventResult onMouseExited (CPoint& where, const CButtonState& buttons) override;
void draw(CDrawContext* context) override;
std::function<void()> OnHoverEnter;
std::function<void()> OnHoverLeave;
private:
CColor hoverColor_;
bool hovered_ { false };

View file

@ -1,22 +1,22 @@
/* This file is generated by the layout maker tool. */
auto* const view__0 = createaboutView(CRect(0, 0, 800, 475), -1, "About sfizz", kCenterText, 14);
aboutView = view__0;
auto* const view__1 = createLogo(CRect(200, 80, 600, 260), -1, "", kCenterText, 14);
auto* const view__1 = createHoverBox(CRect(200, 80, 600, 105), -1, "", kCenterText, 10);
lblHover_ = view__1;
view__0->addView(view__1);
auto* const view__2 = createButtonSfztools(CRect(235, 45, 285, 95), kTagButtonSfztools, "", kCenterText, 30);
auto* const view__2 = createButtonSfztools(CRect(235, 45, 270, 80), kTagButtonSfztools, "", kCenterText, 30);
view__0->addView(view__2);
auto* const view__3 = createButtonGithub(CRect(305, 45, 355, 95), kTagButtonGithub, "", kCenterText, 30);
auto* const view__3 = createButtonGithub(CRect(305, 45, 340, 80), kTagButtonGithub, "", kCenterText, 30);
view__0->addView(view__3);
auto* const view__4 = createButtonDiscord(CRect(375, 45, 425, 95), kTagButtonDiscord, "", kCenterText, 30);
auto* const view__4 = createButtonDiscord(CRect(375, 45, 410, 80), kTagButtonDiscord, "", kCenterText, 30);
view__0->addView(view__4);
auto* const view__5 = createButtonOpencollective(CRect(445, 45, 495, 95), kTagButtonOpencollective, "", kCenterText, 30);
auto* const view__5 = createButtonOpencollective(CRect(445, 45, 480, 80), kTagButtonOpencollective, "", kCenterText, 30);
view__0->addView(view__5);
auto* const view__6 = createButtonSfzformat(CRect(515, 45, 565, 95), kTagButtonSfzformat, "", kCenterText, 30);
auto* const view__6 = createButtonSfzformat(CRect(515, 45, 550, 80), kTagButtonSfzformat, "", kCenterText, 30);
view__0->addView(view__6);
auto* const view__7 = createInfoBox(CRect(260, 260, 540, 340), -1, "", kCenterText, 14);
auto* const view__7 = createLogo(CRect(200, 90, 600, 270), -1, "", kCenterText, 14);
view__0->addView(view__7);
auto* const view__8 = createDescriptionBox(CRect(200, 350, 600, 450), -1, "", kCenterText, 14);
auto* const view__8 = createInfoBox(CRect(260, 270, 540, 350), -1, "", kCenterText, 14);
view__0->addView(view__8);
auto* const view__9 = createHoverBox(CRect(320, 10, 480, 35), -1, "", kCenterText, 14);
lblHover_ = view__9;
auto* const view__9 = createDescriptionBox(CRect(200, 350, 600, 450), -1, "", kCenterText, 14);
view__0->addView(view__9);