mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-30 07:08:39 +02:00
Merge branch 'master' into deletes
This commit is contained in:
commit
c373f4d859
8817
src/ThemeAsCeeCode.h
8817
src/ThemeAsCeeCode.h
File diff suppressed because it is too large
Load Diff
@ -103,7 +103,7 @@ void TracksPrefs::PopulateOrExchange(ShuttleGui & S)
|
||||
|
||||
S.StartStatic(_("Display"));
|
||||
{
|
||||
S.TieCheckBox(_("&Update display while when Recording/Playback head unpinned"),
|
||||
S.TieCheckBox(_("&Update display when Recording/Playback head unpinned"),
|
||||
wxT("/GUI/AutoScroll"),
|
||||
true);
|
||||
|
||||
|
@ -251,4 +251,5 @@ void ScrubbingToolBar::EnableDisableButtons()
|
||||
else
|
||||
barButton->PopUp();
|
||||
RegenerateTooltips();
|
||||
scrubber.CheckMenuItems();
|
||||
}
|
||||
|
@ -748,8 +748,9 @@ AButton * ToolBar::MakeButton(wxWindow *parent,
|
||||
bool processdownevents,
|
||||
wxSize size)
|
||||
{
|
||||
int xoff = (size.GetWidth() - theTheme.Image(eStandardUp).GetWidth())/2;
|
||||
int yoff = (size.GetHeight() - theTheme.Image(eStandardUp).GetHeight())/2;
|
||||
// wxMax to cater for case of image being bigger than the button.
|
||||
int xoff = wxMax( 0, (size.GetWidth() - theTheme.Image(eStandardUp).GetWidth())/2);
|
||||
int yoff = wxMax( 0, (size.GetHeight() - theTheme.Image(eStandardUp).GetHeight())/2);
|
||||
|
||||
typedef std::unique_ptr<wxImage> wxImagePtr;
|
||||
wxImagePtr up2 (OverlayImage(eUp, eStandardUp, xoff, yoff));
|
||||
@ -774,8 +775,9 @@ void ToolBar::MakeAlternateImages(AButton &button, int idx,
|
||||
teBmps eDisabled,
|
||||
wxSize size)
|
||||
{
|
||||
int xoff = (size.GetWidth() - theTheme.Image(eStandardUp).GetWidth())/2;
|
||||
int yoff = (size.GetHeight() - theTheme.Image(eStandardUp).GetHeight())/2;
|
||||
// wxMax to cater for case of image being bigger than the button.
|
||||
int xoff = wxMax( 0, (size.GetWidth() - theTheme.Image(eStandardUp).GetWidth())/2);
|
||||
int yoff = wxMax( 0, (size.GetHeight() - theTheme.Image(eStandardUp).GetHeight())/2);
|
||||
|
||||
typedef std::unique_ptr<wxImage> wxImagePtr;
|
||||
wxImagePtr up (OverlayImage(eUp, eStandardUp, xoff, yoff));
|
||||
|
@ -281,6 +281,7 @@ void Scrubber::MarkScrubStart(
|
||||
mProject->SetAudioIOToken(0);
|
||||
|
||||
mSeeking = seek;
|
||||
CheckMenuItems();
|
||||
|
||||
ctb->SetPlay(true, ControlToolBar::PlayAppearance::Straight );
|
||||
// Commented out for Bug 1421
|
||||
@ -291,7 +292,6 @@ void Scrubber::MarkScrubStart(
|
||||
mScrubStartPosition = xx;
|
||||
ctb->UpdateStatusBar(mProject);
|
||||
mOptions.startClockTimeMillis = ::wxGetLocalTimeMillis();
|
||||
|
||||
mCancelled = false;
|
||||
}
|
||||
|
||||
@ -891,6 +891,7 @@ void Scrubber::OnScrubOrSeek(bool seek)
|
||||
}
|
||||
|
||||
mSeeking = seek;
|
||||
CheckMenuItems();
|
||||
|
||||
auto ruler = mProject->GetRulerPanel();
|
||||
if (ruler)
|
||||
|
@ -136,11 +136,11 @@ public:
|
||||
|
||||
void Pause(bool paused);
|
||||
bool IsPaused() const;
|
||||
void CheckMenuItems();
|
||||
|
||||
private:
|
||||
void DoScrub(bool seek);
|
||||
void OnActivateOrDeactivateApp(wxActivateEvent & event);
|
||||
void CheckMenuItems();
|
||||
|
||||
// I need this because I can't push the scrubber as an event handler
|
||||
// in two places at once.
|
||||
|
@ -59,6 +59,7 @@ Grabber::Grabber(wxWindow * parent, wxWindowID id)
|
||||
{
|
||||
mOver = false;
|
||||
mPressed = false;
|
||||
mAsSpacer = false;
|
||||
|
||||
/* i18n-hint: A 'Grabber' is a region you can click and drag on
|
||||
It's used to drag a track around (when in multi-tool mode) rather
|
||||
@ -99,6 +100,10 @@ void Grabber::SendEvent(wxEventType type, const wxPoint & pos, bool escaping)
|
||||
void Grabber::DrawGrabber( wxDC & dc )
|
||||
{
|
||||
wxRect r = GetRect();
|
||||
// PaintDC positions are relative to the grabber, not the parent window.
|
||||
// So use 0,0 as origin for draw, so that the grabber draws right if
|
||||
// positioned in its parent at some non zero position.
|
||||
r.SetPosition( wxPoint(0,0) );
|
||||
int y, left, right, top, bottom;
|
||||
|
||||
#ifndef EXPERIMENTAL_THEMING
|
||||
@ -132,6 +137,9 @@ void Grabber::DrawGrabber( wxDC & dc )
|
||||
|
||||
#endif
|
||||
|
||||
// No bumps in a spacer grabber.
|
||||
if( mAsSpacer )
|
||||
return;
|
||||
// Calculate the bump rectangle
|
||||
r.Deflate(3, 3);
|
||||
if ((r.GetHeight() % 4) < 2) {
|
||||
@ -174,6 +182,8 @@ void Grabber::DrawGrabber( wxDC & dc )
|
||||
//
|
||||
void Grabber::PushButton(bool state )
|
||||
{
|
||||
if( mAsSpacer )
|
||||
return;
|
||||
wxRect r = GetRect();
|
||||
mOver = r.Contains(ScreenToClient(wxGetMousePosition()));
|
||||
|
||||
@ -207,6 +217,9 @@ void Grabber::OnEnter(wxMouseEvent & WXUNUSED(event))
|
||||
UnsetToolTip();
|
||||
SetToolTip(text);
|
||||
|
||||
if( mAsSpacer )
|
||||
return;
|
||||
|
||||
// Redraw highlighted
|
||||
mOver = true;
|
||||
Refresh(false);
|
||||
|
@ -111,6 +111,7 @@ class Grabber final : public wxWindow
|
||||
bool AcceptsFocusFromKeyboard() const override {return false;}
|
||||
|
||||
void PushButton(bool state);
|
||||
void SetAsSpacer( bool bIsSpacer ) { mAsSpacer = bIsSpacer;};
|
||||
|
||||
protected:
|
||||
|
||||
@ -127,6 +128,7 @@ class Grabber final : public wxWindow
|
||||
|
||||
bool mOver;
|
||||
bool mPressed;
|
||||
bool mAsSpacer;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -85,6 +85,7 @@ array of Ruler::Label.
|
||||
#include "../tracks/ui/Scrubbing.h"
|
||||
#include "../prefs/PlaybackPrefs.h"
|
||||
#include "../prefs/TracksPrefs.h"
|
||||
#include "../widgets/Grabber.h"
|
||||
|
||||
//#define SCRUB_ABOVE
|
||||
|
||||
@ -1663,7 +1664,7 @@ enum : int {
|
||||
|
||||
enum {
|
||||
ScrubHeight = 14,
|
||||
ProperRulerHeight = 28
|
||||
ProperRulerHeight = 29
|
||||
};
|
||||
|
||||
inline int IndicatorHeightForWidth(int width)
|
||||
@ -2056,10 +2057,20 @@ void AdornedRulerPanel::ReCreateButtons()
|
||||
button = nullptr;
|
||||
}
|
||||
|
||||
size_t iButton = 0;
|
||||
// Make the short row of time ruler pushbottons.
|
||||
// Don't bother with sizers. Their sizes and positions are fixed.
|
||||
wxPoint position{ 1 + LeftMargin, 0 };
|
||||
size_t iButton = 0;
|
||||
// Add a grabber converted to a spacer.
|
||||
// This makes it visually clearer that the button is a button.
|
||||
|
||||
wxPoint position( 1, 0 );
|
||||
Grabber * pGrabber = safenew Grabber(this, this->GetId());
|
||||
pGrabber->SetAsSpacer( true );
|
||||
//pGrabber->SetSize( 10, 27 ); // default is 10,27
|
||||
pGrabber->SetPosition( position );
|
||||
|
||||
position.x = 12;
|
||||
|
||||
auto size = theTheme.ImageSize( bmpRecoloredUpSmall );
|
||||
size.y = std::min(size.y, GetRulerHeight(false));
|
||||
|
||||
@ -2078,7 +2089,7 @@ void AdornedRulerPanel::ReCreateButtons()
|
||||
mButtons[iButton++] = button;
|
||||
return button;
|
||||
};
|
||||
auto button = buttonMaker(OnTogglePinnedStateID, bmpPinnedPlayHead, false);
|
||||
auto button = buttonMaker(OnTogglePinnedStateID, bmpPinnedPlayHead, true);
|
||||
ToolBar::MakeAlternateImages(
|
||||
*button, 1,
|
||||
bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
|
||||
@ -2360,6 +2371,12 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
||||
if (evt.RightDown() )
|
||||
// Fall through to context menu handling
|
||||
;
|
||||
else if ( evt.LeftUp() && inScrubZone)
|
||||
// Fall through to seeking changes to scrubbing
|
||||
;
|
||||
// else if ( evt.LeftDown() && inScrubZone)
|
||||
// // Fall through to ready to seek
|
||||
// ;
|
||||
else {
|
||||
bool switchToQP = (zone == StatusChoice::EnteringQP && mQuickPlayEnabled);
|
||||
if (switchToQP && evt.LeftDown()) {
|
||||
@ -2429,13 +2446,26 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
||||
&position);
|
||||
return;
|
||||
}
|
||||
else if (!HasCapture() && inScrubZone) {
|
||||
if (evt.LeftDown()) {
|
||||
else if( !HasCapture() && evt.LeftUp() && inScrubZone ) {
|
||||
//wxLogDebug("up");
|
||||
// mouse going up => we shift to scrubbing.
|
||||
scrubber.MarkScrubStart(evt.m_x,
|
||||
TracksPrefs::GetPinnedHeadPreference(), false);
|
||||
UpdateStatusBarAndTooltips(StatusChoice::EnteringScrubZone);
|
||||
// repaint_all so that the indicator changes shape.
|
||||
bool repaint_all = true;
|
||||
ShowQuickPlayIndicator(repaint_all);
|
||||
return;
|
||||
}
|
||||
else if ( !HasCapture() && inScrubZone) {
|
||||
// mouse going down => we are (probably) seeking
|
||||
if (evt.LeftDown()) {
|
||||
//wxLogDebug("down");
|
||||
scrubber.MarkScrubStart(evt.m_x,
|
||||
TracksPrefs::GetPinnedHeadPreference(), false);
|
||||
UpdateStatusBarAndTooltips(StatusChoice::EnteringScrubZone);
|
||||
ShowQuickPlayIndicator();
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if ( mQuickPlayEnabled) {
|
||||
@ -2790,7 +2820,10 @@ void AdornedRulerPanel::UpdateButtonStates()
|
||||
{
|
||||
bool state = TracksPrefs::GetPinnedHeadPreference();
|
||||
auto pinButton = static_cast<AButton*>(FindWindow(OnTogglePinnedStateID));
|
||||
if( !state )
|
||||
pinButton->PopUp();
|
||||
else
|
||||
pinButton->PushDown();
|
||||
pinButton->SetAlternateIdx(state ? 0 : 1);
|
||||
const auto label = state
|
||||
// Label descibes the present state, not what the click does
|
||||
@ -3170,6 +3203,21 @@ void AdornedRulerPanel::DoDrawIndicator
|
||||
dc->DrawPolygon( 3, tri );
|
||||
}
|
||||
else {
|
||||
// synonyms... (makes compatibility with DarkAudacity easier).
|
||||
#define bmpPlayPointerPinned bmpPinnedPlayHead
|
||||
#define bmpPlayPointer bmpUnpinnedPlayHead
|
||||
#define bmpRecordPointerPinned bmpPinnedRecordHead
|
||||
#define bmpRecordPointer bmpUnpinnedRecordHead
|
||||
|
||||
bool pinned = TracksPrefs::GetPinnedHeadPreference();
|
||||
wxBitmap & bmp = theTheme.Bitmap( pinned ?
|
||||
(playing ? bmpPlayPointerPinned : bmpRecordPointerPinned) :
|
||||
(playing ? bmpPlayPointer : bmpRecordPointer)
|
||||
);
|
||||
const int IndicatorHalfWidth = bmp.GetWidth() / 2;
|
||||
dc->DrawBitmap( bmp, xx - IndicatorHalfWidth -1, mInner.y );
|
||||
#if 0
|
||||
|
||||
// Down pointing triangle
|
||||
auto height = IndicatorHeightForWidth(width);
|
||||
const int IndicatorHalfWidth = width / 2;
|
||||
@ -3180,6 +3228,7 @@ void AdornedRulerPanel::DoDrawIndicator
|
||||
tri[ 2 ].x = xx;
|
||||
tri[ 2 ].y = mInner.y + height;
|
||||
dc->DrawPolygon( 3, tri );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -3191,18 +3240,18 @@ QuickPlayIndicatorOverlay *AdornedRulerPanel::GetOverlay()
|
||||
return mOverlay.get();
|
||||
}
|
||||
|
||||
void AdornedRulerPanel::ShowQuickPlayIndicator()
|
||||
void AdornedRulerPanel::ShowQuickPlayIndicator( bool repaint_all)
|
||||
{
|
||||
ShowOrHideQuickPlayIndicator(true);
|
||||
ShowOrHideQuickPlayIndicator(true, repaint_all);
|
||||
}
|
||||
|
||||
void AdornedRulerPanel::HideQuickPlayIndicator()
|
||||
void AdornedRulerPanel::HideQuickPlayIndicator(bool repaint_all)
|
||||
{
|
||||
ShowOrHideQuickPlayIndicator(false);
|
||||
ShowOrHideQuickPlayIndicator(false, repaint_all);
|
||||
}
|
||||
|
||||
// Draws the vertical line and green triangle indicating the Quick Play cursor position.
|
||||
void AdornedRulerPanel::ShowOrHideQuickPlayIndicator(bool show)
|
||||
void AdornedRulerPanel::ShowOrHideQuickPlayIndicator(bool show, bool repaint_all)
|
||||
{
|
||||
double latestEnd = std::max(mTracks->GetEndTime(), mProject->GetSel1());
|
||||
if (!show || (mQuickPlayPos >= latestEnd)) {
|
||||
@ -3216,8 +3265,8 @@ void AdornedRulerPanel::ShowOrHideQuickPlayIndicator(bool show)
|
||||
GetOverlay()->Update(x, mIsSnapped, previewScrub);
|
||||
}
|
||||
|
||||
mProject->GetTrackPanel()->DrawOverlays(false);
|
||||
DrawOverlays(false);
|
||||
mProject->GetTrackPanel()->DrawOverlays(repaint_all);
|
||||
DrawOverlays(repaint_all);
|
||||
}
|
||||
|
||||
void AdornedRulerPanel::SetPlayRegion(double playRegionStart,
|
||||
|
@ -325,8 +325,8 @@ public:
|
||||
|
||||
void RegenerateTooltips(StatusChoice choice);
|
||||
|
||||
void ShowQuickPlayIndicator();
|
||||
void HideQuickPlayIndicator();
|
||||
void ShowQuickPlayIndicator( bool repaint_all=false);
|
||||
void HideQuickPlayIndicator( bool repaint_all=false);
|
||||
void UpdateQuickPlayPos(wxCoord &mousPosX);
|
||||
|
||||
bool ShowingScrubBar() const { return mShowScrubbing; }
|
||||
@ -366,7 +366,7 @@ public:
|
||||
|
||||
private:
|
||||
QuickPlayIndicatorOverlay *GetOverlay();
|
||||
void ShowOrHideQuickPlayIndicator(bool show);
|
||||
void ShowOrHideQuickPlayIndicator(bool show, bool repaint_all=false);
|
||||
void DoDrawPlayRegion(wxDC * dc);
|
||||
|
||||
enum class MenuChoice { QuickPlay, Scrub };
|
||||
|
Loading…
x
Reference in New Issue
Block a user