Removed the text labeled button for displaying the About dialog
It was added because the logo button didn't react visually to mouse events. Now when you hover over the logo, it gets highlighted and also shows a tooltip like the other glyph buttons.
This commit is contained in:
parent
e39277f6a5
commit
2bead3abeb
9 changed files with 319 additions and 25 deletions
|
|
@ -19,6 +19,8 @@ set(EDITOR_RESOURCES
|
|||
logo_text_shaded@2x.png
|
||||
background.png
|
||||
background@2x.png
|
||||
background_button_about.png
|
||||
background_button_about@2x.png
|
||||
icon_white.png
|
||||
icon_white@2x.png
|
||||
knob48.png
|
||||
|
|
|
|||
|
|
@ -430,12 +430,6 @@ widget_class mainView {open
|
|||
xywh {695 310 60 25} labelsize 12
|
||||
class TextEdit
|
||||
}
|
||||
Fl_Button settingsAboutButton_ {
|
||||
label {About sfizz}
|
||||
comment {tag=kTagAbout}
|
||||
xywh {610 205 115 25} labelsize 12
|
||||
class ValueButton
|
||||
}
|
||||
Fl_Box {} {
|
||||
label {... when freewheeling}
|
||||
xywh {290 220 145 25} labelsize 12 align 20
|
||||
|
|
|
|||
BIN
plugins/editor/resources/background_button_about.png
Normal file
BIN
plugins/editor/resources/background_button_about.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
BIN
plugins/editor/resources/background_button_about@2x.png
Normal file
BIN
plugins/editor/resources/background_button_about@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
246
plugins/editor/resources/logo_shaded.svg
Normal file
246
plugins/editor/resources/logo_shaded.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 16 KiB |
|
|
@ -127,7 +127,6 @@ struct Editor::Impl : EditorController::Receiver,
|
|||
CTextLabel* scalaRootKeyLabel_ = nullptr;
|
||||
SValueMenu* tuningFrequencyDropdown_ = nullptr;
|
||||
CTextEdit* tuningFrequencyEdit_ = nullptr;
|
||||
STextButton *settingsAboutButton_ = nullptr;
|
||||
CTextLabel* tuningFrequencyLabel_ = nullptr;
|
||||
CControl *stretchedTuningSlider_ = nullptr;
|
||||
CTextLabel* stretchedTuningLabel_ = nullptr;
|
||||
|
|
@ -701,9 +700,11 @@ void Editor::Impl::createFrameContents()
|
|||
CViewContainer* mainView;
|
||||
Theme* theme;
|
||||
|
||||
SharedPointer<CBitmap> iconShaded = owned(new CBitmap("logo_text_shaded.png"));
|
||||
SharedPointer<CBitmap> backgroundAbout = owned(new CBitmap("background_button_about.png"));
|
||||
SharedPointer<CBitmap> background = owned(new CBitmap("background.png"));
|
||||
SharedPointer<CBitmap> knob48 = owned(new CBitmap("knob48.png"));
|
||||
|
||||
// TODO: is this used somewhere?
|
||||
SharedPointer<CBitmap> logoText = owned(new CBitmap("logo_text.png"));
|
||||
|
||||
defaultBackgroundBitmap_ = background;
|
||||
|
|
@ -749,8 +750,12 @@ void Editor::Impl::createFrameContents()
|
|||
return box;
|
||||
};
|
||||
#endif
|
||||
auto createAboutButton = [this, &iconShaded](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) {
|
||||
return new CKickButton(bounds, this, tag, 0.0f, iconShaded);
|
||||
auto createAboutButton = [this, &backgroundAbout](
|
||||
const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) {
|
||||
SHoverButton* btn = new SHoverButton(bounds, this, tag, backgroundAbout);
|
||||
btn->OnHoverEnter = [this, btn]() { buttonHoverEnter(btn, "About sfizz..."); };
|
||||
btn->OnHoverLeave = [this, btn]() { buttonHoverLeave(btn); };
|
||||
return btn;
|
||||
};
|
||||
auto createLabel = [this, &palette](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) {
|
||||
CTextLabel* lbl = new CTextLabel(bounds, label);
|
||||
|
|
|
|||
|
|
@ -415,6 +415,33 @@ void SActionMenu::onItemClicked(int32_t index)
|
|||
listener->valueChanged(this);
|
||||
}
|
||||
|
||||
///
|
||||
CMouseEventResult SHoverButton::onMouseEntered(CPoint& where, const CButtonState& buttons) {
|
||||
hovered_ = true;
|
||||
if (OnHoverEnter)
|
||||
OnHoverEnter();
|
||||
invalid();
|
||||
return CKickButton::onMouseEntered(where, buttons);
|
||||
}
|
||||
|
||||
CMouseEventResult SHoverButton::onMouseExited(CPoint& where, const CButtonState& buttons) {
|
||||
hovered_ = false;
|
||||
if (OnHoverLeave)
|
||||
OnHoverLeave();
|
||||
invalid();
|
||||
return CKickButton::onMouseExited(where, buttons);
|
||||
}
|
||||
|
||||
void SHoverButton::draw(CDrawContext* dc) {
|
||||
CPoint where(offset.x, offset.y);
|
||||
bounceValue();
|
||||
if (hovered_)
|
||||
where.y += heightOfOneImage;
|
||||
if (getDrawBackground())
|
||||
getDrawBackground()->draw(dc, getViewSize(), where);
|
||||
setDirty(false);
|
||||
}
|
||||
|
||||
///
|
||||
void STextButton::setHighlightColor(const CColor& color)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -182,6 +182,29 @@ private:
|
|||
};
|
||||
};
|
||||
|
||||
///
|
||||
class SHoverButton : public CKickButton {
|
||||
public:
|
||||
SHoverButton(
|
||||
const CRect& size,
|
||||
IControlListener* listener,
|
||||
int32_t tag,
|
||||
CBitmap* background,
|
||||
const CPoint& offset = CPoint (0, 0))
|
||||
: CKickButton(size, listener, tag, background, offset)
|
||||
{}
|
||||
|
||||
CMouseEventResult onMouseEntered(CPoint&, const CButtonState&) override;
|
||||
CMouseEventResult onMouseExited(CPoint&, const CButtonState&) override;
|
||||
void draw(CDrawContext*) override;
|
||||
|
||||
std::function<void()> OnHoverEnter;
|
||||
std::function<void()> OnHoverLeave;
|
||||
|
||||
private:
|
||||
bool hovered_ { false };
|
||||
};
|
||||
|
||||
///
|
||||
class STextButton: public CTextButton {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -223,24 +223,21 @@ view__49->addView(view__85);
|
|||
auto* const view__86 = createTextEdit(CRect(690, 200, 750, 225), kTagSetTuningFrequency, "", kCenterText, 12);
|
||||
tuningFrequencyEdit_ = view__86;
|
||||
view__49->addView(view__86);
|
||||
auto* const view__87 = createValueButton(CRect(605, 95, 720, 120), kTagAbout, "About sfizz", kCenterText, 12);
|
||||
settingsAboutButton_ = view__87;
|
||||
auto* const view__87 = createLabel(CRect(285, 110, 430, 135), -1, "... when freewheeling", kLeftText, 12);
|
||||
view__49->addView(view__87);
|
||||
auto* const view__88 = createLabel(CRect(285, 110, 430, 135), -1, "... when freewheeling", kLeftText, 12);
|
||||
auto* const view__88 = createValueMenu(CRect(430, 110, 510, 135), kTagSetFreewheelingOscillatorQuality, "", kCenterText, 12);
|
||||
freewheelingOscillatorQualitySlider_ = view__88;
|
||||
view__49->addView(view__88);
|
||||
auto* const view__89 = createValueMenu(CRect(430, 110, 510, 135), kTagSetFreewheelingOscillatorQuality, "", kCenterText, 12);
|
||||
freewheelingOscillatorQualitySlider_ = view__89;
|
||||
view__49->addView(view__89);
|
||||
auto* const view__90 = createPiano(CRect(5, 400, 795, 470), -1, "", kCenterText, 12);
|
||||
piano_ = view__90;
|
||||
auto* const view__89 = createPiano(CRect(5, 400, 795, 470), -1, "", kCenterText, 12);
|
||||
piano_ = view__89;
|
||||
view__0->addView(view__89);
|
||||
auto* const view__90 = createLogicalGroup(CRect(5, 110, 795, 395), -1, "", kCenterText, 14);
|
||||
subPanels_[kPanelGeneral] = view__90;
|
||||
view__0->addView(view__90);
|
||||
auto* const view__91 = createLogicalGroup(CRect(5, 110, 795, 395), -1, "", kCenterText, 14);
|
||||
subPanels_[kPanelGeneral] = view__91;
|
||||
view__90->setVisible(false);
|
||||
enterPalette(invertedPalette);
|
||||
auto* const view__91 = createHoverBox(CRect(5, 105, 175, 130), -1, "", kCenterText, 12);
|
||||
lblHover_ = view__91;
|
||||
view__0->addView(view__91);
|
||||
view__91->setVisible(false);
|
||||
enterPalette(invertedPalette);
|
||||
auto* const view__92 = createHoverBox(CRect(5, 105, 175, 130), -1, "", kCenterText, 12);
|
||||
lblHover_ = view__92;
|
||||
view__0->addView(view__92);
|
||||
view__92->setVisible(false);
|
||||
enterPalette(defaultPalette);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue