1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 00:29:41 +02:00

Add Hover-Over-Down State for Button

Previously hovering over a down button made no difference.
Also tweaked the appearance of hover-over thumbs on dark theme sliders.
Also tweaked hover images and colours generally.

Classic retains the old style.
Hi Contrast does not distinguish between hover-up and hover-down.
This commit is contained in:
James Crook 2017-12-14 14:39:56 +00:00
parent 3379b4e499
commit 41ac4cd47a
16 changed files with 5652 additions and 5543 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -266,13 +266,15 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
safenew AButton(this, ID_TOGGLEBUTTON_MUTE,
ctrlPos, ctrlSize,
*(mMixerBoard->mImageMuteUp), *(mMixerBoard->mImageMuteOver),
*(mMixerBoard->mImageMuteDown), *(mMixerBoard->mImageMuteDisabled),
*(mMixerBoard->mImageMuteDown), *(mMixerBoard->mImageMuteDown),
*(mMixerBoard->mImageMuteDisabled),
true); // toggle button
mToggleButton_Mute->SetName(_("Mute"));
mToggleButton_Mute->SetAlternateImages(
1,
*(mMixerBoard->mImageMuteUp), *(mMixerBoard->mImageMuteOver),
*(mMixerBoard->mImageMuteDown), *(mMixerBoard->mImageMuteDisabled));
*(mMixerBoard->mImageMuteDown), *(mMixerBoard->mImageMuteDown),
*(mMixerBoard->mImageMuteDisabled));
this->UpdateMute();
ctrlPos.y += MUTE_SOLO_HEIGHT;
@ -280,7 +282,8 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
safenew AButton(this, ID_TOGGLEBUTTON_SOLO,
ctrlPos, ctrlSize,
*(mMixerBoard->mImageSoloUp), *(mMixerBoard->mImageSoloOver),
*(mMixerBoard->mImageSoloDown), *(mMixerBoard->mImageSoloDisabled),
*(mMixerBoard->mImageSoloDown), *(mMixerBoard->mImageSoloDown),
*(mMixerBoard->mImageSoloDisabled),
true); // toggle button
mToggleButton_Solo->SetName(_("Solo"));
this->UpdateSolo();

View File

@ -135,7 +135,7 @@ AButton *ControlToolBar::MakeButton(teBmps eEnabledUp, teBmps eEnabledDown, teBm
const wxChar *label)
{
AButton *r = ToolBar::MakeButton(this,
bmpRecoloredUpLarge, bmpRecoloredDownLarge, bmpRecoloredHiliteLarge,
bmpRecoloredUpLarge, bmpRecoloredDownLarge, bmpRecoloredUpHiliteLarge, bmpRecoloredHiliteLarge,
eEnabledUp, eEnabledDown, eDisabled,
wxWindowID(id),
wxDefaultPosition, processdownevents,
@ -160,7 +160,7 @@ void ControlToolBar::MakeAlternateImages(AButton &button, int idx,
teBmps eDisabled)
{
ToolBar::MakeAlternateImages(button, idx,
bmpRecoloredUpLarge, bmpRecoloredDownLarge, bmpRecoloredHiliteLarge,
bmpRecoloredUpLarge, bmpRecoloredDownLarge, bmpRecoloredUpHiliteLarge, bmpRecoloredHiliteLarge,
eEnabledUp, eEnabledDown, eDisabled,
theTheme.ImageSize( bmpRecoloredUpLarge ));
}

View File

@ -106,7 +106,7 @@ AButton *EditToolBar::AddButton(
AButton *&r = mButtons[id];
r = ToolBar::MakeButton(this,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredUpHiliteSmall, bmpRecoloredHiliteSmall,
eEnabledUp, eEnabledDown, eDisabled,
wxWindowID(id),
wxDefaultPosition,

View File

@ -85,7 +85,7 @@ AButton *ScrubbingToolBar::AddButton
r = ToolBar::MakeButton
(this,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredUpHiliteSmall, bmpRecoloredHiliteSmall,
eEnabledUp, eEnabledDown, eDisabled,
wxWindowID(id),
wxDefaultPosition,

View File

@ -717,13 +717,15 @@ void ToolBar:: MakeButtonBackgroundsLarge()
#endif
if( bUseAqua ){
MakeMacRecoloredImage( bmpRecoloredUpLarge, bmpMacUpButton );
MakeMacRecoloredImage( bmpRecoloredDownLarge, bmpMacDownButton );
MakeMacRecoloredImage( bmpRecoloredHiliteLarge, bmpMacHiliteButton );
MakeMacRecoloredImage( bmpRecoloredUpLarge, bmpMacUpButton );
MakeMacRecoloredImage( bmpRecoloredDownLarge, bmpMacDownButton );
MakeMacRecoloredImage( bmpRecoloredUpHiliteLarge, bmpMacHiliteUpButton );
MakeMacRecoloredImage( bmpRecoloredHiliteLarge, bmpMacHiliteButton );
} else {
MakeRecoloredImage( bmpRecoloredUpLarge, bmpUpButtonLarge );
MakeRecoloredImage( bmpRecoloredDownLarge, bmpDownButtonLarge );
MakeRecoloredImage( bmpRecoloredHiliteLarge, bmpHiliteButtonLarge );
MakeRecoloredImage( bmpRecoloredUpLarge, bmpUpButtonLarge );
MakeRecoloredImage( bmpRecoloredDownLarge, bmpDownButtonLarge );
MakeRecoloredImage( bmpRecoloredUpHiliteLarge, bmpHiliteUpButtonLarge );
MakeRecoloredImage( bmpRecoloredHiliteLarge, bmpHiliteButtonLarge );
}
}
@ -741,13 +743,15 @@ void ToolBar::MakeButtonBackgroundsSmall()
#endif
if( bUseAqua ){
MakeMacRecoloredImage( bmpRecoloredUpSmall, bmpMacUpButtonSmall );
MakeMacRecoloredImage( bmpRecoloredDownSmall, bmpMacDownButtonSmall );
MakeMacRecoloredImage( bmpRecoloredHiliteSmall, bmpMacHiliteButtonSmall );
MakeMacRecoloredImage( bmpRecoloredUpSmall, bmpMacUpButtonSmall );
MakeMacRecoloredImage( bmpRecoloredDownSmall, bmpMacDownButtonSmall );
MakeMacRecoloredImage( bmpRecoloredUpHiliteSmall, bmpMacHiliteUpButtonSmall );
MakeMacRecoloredImage( bmpRecoloredHiliteSmall, bmpMacHiliteButtonSmall );
} else {
MakeRecoloredImage( bmpRecoloredUpSmall, bmpUpButtonSmall );
MakeRecoloredImage( bmpRecoloredDownSmall, bmpDownButtonSmall );
MakeRecoloredImage( bmpRecoloredHiliteSmall, bmpHiliteButtonSmall );
MakeRecoloredImage( bmpRecoloredUpSmall, bmpUpButtonSmall );
MakeRecoloredImage( bmpRecoloredDownSmall, bmpDownButtonSmall );
MakeRecoloredImage( bmpRecoloredUpHiliteSmall, bmpHiliteUpButtonSmall );
MakeRecoloredImage( bmpRecoloredHiliteSmall, bmpHiliteButtonSmall );
}
}
@ -767,6 +771,7 @@ AButton * ToolBar::MakeButton(wxWindow *parent,
teBmps eUp,
teBmps eDown,
teBmps eHilite,
teBmps eDownHi,
teBmps eStandardUp,
teBmps eStandardDown,
teBmps eDisabled,
@ -783,11 +788,12 @@ AButton * ToolBar::MakeButton(wxWindow *parent,
wxImagePtr up2 (OverlayImage(eUp, eStandardUp, xoff, yoff));
wxImagePtr hilite2 (OverlayImage(eHilite, eStandardUp, xoff, yoff));
wxImagePtr down2 (OverlayImage(eDown, eStandardDown, xoff + 1, yoff + 1));
wxImagePtr downHi2 (OverlayImage(eDownHi, eStandardDown, xoff + 1, yoff + 1));
wxImagePtr disable2 (OverlayImage(eUp, eDisabled, xoff, yoff));
wxASSERT(parent); // to justify safenew
AButton * button =
safenew AButton(parent, id, placement, size, *up2, *hilite2, *down2,
safenew AButton(parent, id, placement, size, *up2, *hilite2, *down2, *downHi2,
*disable2, processdownevents);
return button;
@ -798,6 +804,7 @@ void ToolBar::MakeAlternateImages(AButton &button, int idx,
teBmps eUp,
teBmps eDown,
teBmps eHilite,
teBmps eDownHi,
teBmps eStandardUp,
teBmps eStandardDown,
teBmps eDisabled,
@ -811,9 +818,10 @@ void ToolBar::MakeAlternateImages(AButton &button, int idx,
wxImagePtr up (OverlayImage(eUp, eStandardUp, xoff, yoff));
wxImagePtr hilite (OverlayImage(eHilite, eStandardUp, xoff, yoff));
wxImagePtr down (OverlayImage(eDown, eStandardDown, xoff + 1, yoff + 1));
wxImagePtr downHi (OverlayImage(eDownHi, eStandardDown, xoff + 1, yoff + 1));
wxImagePtr disable (OverlayImage(eUp, eDisabled, xoff, yoff));
button.SetAlternateImages(idx, *up, *hilite, *down, *disable);
button.SetAlternateImages(idx, *up, *hilite, *down, *downHi, *disable);
}
void ToolBar::SetButtonToolTip

View File

@ -136,6 +136,7 @@ class ToolBar /* not final */ : public wxPanelWrapper
teBmps eUp,
teBmps eDown,
teBmps eHilite,
teBmps eDownHi,
teBmps eStandardUp,
teBmps eStandardDown,
teBmps eDisabled,
@ -149,6 +150,7 @@ class ToolBar /* not final */ : public wxPanelWrapper
teBmps eUp,
teBmps eDown,
teBmps eHilite,
teBmps eDownHi,
teBmps eStandardUp,
teBmps eStandardDown,
teBmps eDisabled,

View File

@ -161,7 +161,10 @@ AButton * ToolsToolBar::MakeTool( teBmps eTool,
int id, const wxChar *label)
{
AButton *button = ToolBar::MakeButton(this,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
bmpRecoloredUpSmall,
bmpRecoloredDownSmall,
bmpRecoloredUpHiliteSmall,
bmpRecoloredDownSmall, // Not bmpRecoloredHiliteSmall as down is inactive.
eTool, eTool, eTool,
wxWindowID(id),
wxDefaultPosition, true,

View File

@ -144,7 +144,7 @@ AButton *TranscriptionToolBar::AddButton(
AButton *&r = mButtons[id];
r = ToolBar::MakeButton(this,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredUpHiliteSmall,bmpRecoloredHiliteSmall,
eFore, eFore, eDisabled,
wxWindowID(id),
wxDefaultPosition,
@ -165,7 +165,7 @@ void TranscriptionToolBar::MakeAlternateImages(
int id, unsigned altIdx)
{
ToolBar::MakeAlternateImages(*mButtons[id], altIdx,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredUpHiliteSmall,bmpRecoloredHiliteSmall,
eFore, eFore, eDisabled,
theTheme.ImageSize( bmpRecoloredUpSmall ));
}

View File

@ -118,13 +118,14 @@ AButton::AButton(wxWindow * parent,
wxImage up,
wxImage over,
wxImage down,
wxImage overDown,
wxImage dis,
bool toggle):
wxWindow()
{
Init(parent, id, pos, size,
ImageRoll(up), ImageRoll(over),
ImageRoll(down), ImageRoll(dis),
ImageRoll(down), ImageRoll(overDown), ImageRoll(dis),
toggle);
}
@ -135,12 +136,13 @@ AButton::AButton(wxWindow * parent,
ImageRoll up,
ImageRoll over,
ImageRoll down,
ImageRoll overDown,
ImageRoll dis,
bool toggle):
wxWindow()
{
Init(parent, id, pos, size,
up, over, down, dis,
up, over, down, overDown, dis,
toggle);
}
@ -157,6 +159,7 @@ void AButton::Init(wxWindow * parent,
ImageRoll up,
ImageRoll over,
ImageRoll down,
ImageRoll overDown,
ImageRoll dis,
bool toggle)
{
@ -179,7 +182,8 @@ void AButton::Init(wxWindow * parent,
mImages[0].mArr[0] = up;
mImages[0].mArr[1] = over;
mImages[0].mArr[2] = down;
mImages[0].mArr[3] = dis;
mImages[0].mArr[3] = overDown;
mImages[0].mArr[4] = dis;
mAlternateIdx = 0;
@ -213,6 +217,7 @@ void AButton::SetAlternateImages(unsigned idx,
wxImage up,
wxImage over,
wxImage down,
wxImage overDown,
wxImage dis)
{
if (1 + idx > mImages.size())
@ -220,13 +225,15 @@ void AButton::SetAlternateImages(unsigned idx,
mImages[idx].mArr[0] = ImageRoll(up);
mImages[idx].mArr[1] = ImageRoll(over);
mImages[idx].mArr[2] = ImageRoll(down);
mImages[idx].mArr[3] = ImageRoll(dis);
mImages[idx].mArr[3] = ImageRoll(overDown);
mImages[idx].mArr[4] = ImageRoll(dis);
}
void AButton::SetAlternateImages(unsigned idx,
ImageRoll up,
ImageRoll over,
ImageRoll down,
ImageRoll overDown,
ImageRoll dis)
{
if (1 + idx > mImages.size())
@ -234,7 +241,8 @@ void AButton::SetAlternateImages(unsigned idx,
mImages[idx].mArr[0] = up;
mImages[idx].mArr[1] = over;
mImages[idx].mArr[2] = down;
mImages[idx].mArr[3] = dis;
mImages[idx].mArr[3] = overDown;
mImages[idx].mArr[4] = dis;
}
void AButton::SetAlternateIdx(unsigned idx)
@ -271,11 +279,11 @@ AButton::AButtonState AButton::GetState()
if (mIsClicking) {
state = mButtonIsDown ? AButtonUp : AButtonDown;
if (mUseDisabledAsDownHiliteImage) {
state = mButtonIsDown ? AButtonOver : AButtonDis;
state = mButtonIsDown ? AButtonOverDown : AButtonDis;
}
}
else {
state = mButtonIsDown ? AButtonDown : AButtonOver;
state = mButtonIsDown ? AButtonOverDown : AButtonOver;
if (mUseDisabledAsDownHiliteImage) {
state = mButtonIsDown ? AButtonDis : AButtonOver;
}
@ -286,7 +294,7 @@ AButton::AButtonState AButton::GetState()
state = mButtonIsDown ? AButtonOver : AButtonDown;
}
else {
state = mButtonIsDown ? AButtonDown : AButtonOver;
state = mButtonIsDown ? AButtonOverDown : AButtonOver;
}
}
}
@ -338,11 +346,12 @@ bool AButton::HasAlternateImages(unsigned idx)
return false;
const ImageArr &images = mImages[idx];
const ImageRoll (&arr)[4] = images.mArr;
const ImageRoll (&arr)[5] = images.mArr;
return (arr[0].Ok() &&
arr[1].Ok() &&
arr[2].Ok() &&
arr[3].Ok());
arr[3].Ok() &&
arr[4].Ok());
}
void AButton::OnMouseEvent(wxMouseEvent & event)
@ -727,6 +736,11 @@ wxAccStatus AButtonAx::GetState(int WXUNUSED(childId), long* state)
*state = wxACC_STATE_SYSTEM_HOTTRACKED | wxACC_STATE_SYSTEM_FOCUSABLE;
break;
case AButton::AButtonOverDown:
*state = wxACC_STATE_SYSTEM_HOTTRACKED | wxACC_STATE_SYSTEM_PRESSED |
wxACC_STATE_SYSTEM_FOCUSABLE;
break;
case AButton::AButtonDis:
*state = wxACC_STATE_SYSTEM_UNAVAILABLE;
break;

View File

@ -39,6 +39,7 @@ class AButton final : public wxWindow {
ImageRoll up,
ImageRoll over,
ImageRoll down,
ImageRoll overDown,
ImageRoll dis,
bool toggle);
@ -51,6 +52,7 @@ class AButton final : public wxWindow {
wxImage up,
wxImage over,
wxImage down,
wxImage overDown,
wxImage dis,
bool toggle);
@ -67,6 +69,7 @@ class AButton final : public wxWindow {
ImageRoll up,
ImageRoll over,
ImageRoll down,
ImageRoll overDown,
ImageRoll dis);
// Associate a set of four images (button up, highlight, button down,
@ -75,6 +78,7 @@ class AButton final : public wxWindow {
wxImage up,
wxImage over,
wxImage down,
wxImage overDown,
wxImage dis);
// Choose state of the button
@ -134,6 +138,7 @@ class AButton final : public wxWindow {
AButtonUp,
AButtonOver,
AButtonDown,
AButtonOverDown,
AButtonDis
};
@ -160,6 +165,7 @@ class AButton final : public wxWindow {
ImageRoll up,
ImageRoll over,
ImageRoll down,
ImageRoll overDown,
ImageRoll dis,
bool toggle);
@ -181,7 +187,7 @@ class AButton final : public wxWindow {
bool mUseDisabledAsDownHiliteImage;
bool mIsDoubleClicked {};
struct ImageArr { ImageRoll mArr[4]; };
struct ImageArr { ImageRoll mArr[5]; };
std::vector<ImageArr> mImages;
wxRect mFocusRect;

View File

@ -463,7 +463,8 @@ void Meter::OnPaint(wxPaintEvent & WXUNUSED(event))
if (mStyle != MixerTrackCluster)
{
bool highlight = InIcon();
dc.DrawBitmap( theTheme.Bitmap( highlight ? bmpHiliteButtonSmall : bmpUpButtonSmall ),
dc.DrawBitmap( theTheme.Bitmap( highlight ?
bmpHiliteUpButtonSmall : bmpUpButtonSmall ),
mIconRect.GetPosition(), false );
dc.DrawBitmap(*mIcon, mIconRect.GetPosition(), true);

View File

@ -2097,7 +2097,8 @@ void AdornedRulerPanel::ReCreateButtons()
const auto button =
ToolBar::MakeButton(
this,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
bmpRecoloredUpSmall, bmpRecoloredDownSmall,
bmpRecoloredUpHiliteSmall, bmpRecoloredHiliteSmall,
bitmap, bitmap, bitmap,
id, position, toggle, size
);
@ -2109,7 +2110,8 @@ void AdornedRulerPanel::ReCreateButtons()
auto button = buttonMaker(OnTogglePinnedStateID, bmpPlayPointerPinned, true);
ToolBar::MakeAlternateImages(
*button, 1,
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
bmpRecoloredUpSmall, bmpRecoloredDownSmall,
bmpRecoloredUpHiliteSmall, bmpRecoloredHiliteSmall,
//bmpUnpinnedPlayHead, bmpUnpinnedPlayHead, bmpUnpinnedPlayHead,
bmpPlayPointer, bmpPlayPointer, bmpPlayPointer,
size);