mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Fix missing QP indicator on wxGTK/GTK3 combo.
This commit is contained in:
parent
b1a3d2313b
commit
3dec7153a3
@ -1685,6 +1685,9 @@ AdornedRulerPanel::AdornedRulerPanel(AudacityProject* parent,
|
|||||||
SetName(GetLabel());
|
SetName(GetLabel());
|
||||||
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
|
|
||||||
|
mBack = new wxBitmap(1, 1);
|
||||||
|
mBackDC.SelectObject(*mBack);
|
||||||
|
|
||||||
mCursorDefault = wxCursor(wxCURSOR_DEFAULT);
|
mCursorDefault = wxCursor(wxCURSOR_DEFAULT);
|
||||||
mCursorHand = wxCursor(wxCURSOR_HAND);
|
mCursorHand = wxCursor(wxCURSOR_HAND);
|
||||||
mCursorSizeWE = wxCursor(wxCURSOR_SIZEWE);
|
mCursorSizeWE = wxCursor(wxCURSOR_SIZEWE);
|
||||||
@ -1694,6 +1697,7 @@ AdornedRulerPanel::AdornedRulerPanel(AudacityProject* parent,
|
|||||||
mIndTime = -1;
|
mIndTime = -1;
|
||||||
mIndType = -1;
|
mIndType = -1;
|
||||||
mQuickPlayInd = false;
|
mQuickPlayInd = false;
|
||||||
|
mLastQuickPlayX = -1;
|
||||||
mPlayRegionStart = -1;
|
mPlayRegionStart = -1;
|
||||||
mPlayRegionLock = false;
|
mPlayRegionLock = false;
|
||||||
mPlayRegionEnd = -1;
|
mPlayRegionEnd = -1;
|
||||||
@ -1816,37 +1820,46 @@ void AdornedRulerPanel::OnCapture(wxCommandEvent & evt)
|
|||||||
|
|
||||||
void AdornedRulerPanel::OnPaint(wxPaintEvent & WXUNUSED(evt))
|
void AdornedRulerPanel::OnPaint(wxPaintEvent & WXUNUSED(evt))
|
||||||
{
|
{
|
||||||
wxSize sz = GetClientSize();
|
wxPaintDC dc(this);
|
||||||
wxPaintDC pdc(this);
|
|
||||||
wxBitmap buffer;
|
|
||||||
buffer.Create(sz.x, sz.y, pdc);
|
|
||||||
wxBufferedDC dc(&pdc, buffer);
|
|
||||||
|
|
||||||
DoDrawBorder(&dc);
|
if (mBack)
|
||||||
|
{
|
||||||
|
mBackDC.SelectObject(wxNullBitmap);
|
||||||
|
delete mBack;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxSize sz = GetClientSize();
|
||||||
|
mBack = new wxBitmap();
|
||||||
|
mBack->Create(sz.x, sz.y, dc);
|
||||||
|
mBackDC.SelectObject(*mBack);
|
||||||
|
|
||||||
|
DoDrawBorder(&mBackDC);
|
||||||
|
|
||||||
if (!mViewInfo->selectedRegion.isPoint())
|
if (!mViewInfo->selectedRegion.isPoint())
|
||||||
{
|
{
|
||||||
DoDrawSelection(&dc);
|
DoDrawSelection(&mBackDC);
|
||||||
}
|
}
|
||||||
|
|
||||||
DoDrawMarks(&dc, true);
|
DoDrawMarks(&mBackDC, true);
|
||||||
|
|
||||||
if (mIndType >= 0)
|
if (mIndType >= 0)
|
||||||
{
|
{
|
||||||
DoDrawIndicator(&dc);
|
DoDrawIndicator(&mBackDC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mViewInfo->selectedRegion.isPoint())
|
||||||
|
{
|
||||||
|
DoDrawCursor(&mBackDC);
|
||||||
|
}
|
||||||
|
|
||||||
|
DoDrawPlayRegion(&mBackDC);
|
||||||
|
|
||||||
|
dc.Blit(0, 0, mBack->GetWidth(), mBack->GetHeight(), &mBackDC, 0, 0);
|
||||||
|
|
||||||
if (mQuickPlayInd)
|
if (mQuickPlayInd)
|
||||||
{
|
{
|
||||||
DrawQuickPlayIndicator(&dc);
|
DrawQuickPlayIndicator(&dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mViewInfo->selectedRegion.isPoint())
|
|
||||||
{
|
|
||||||
DoDrawCursor(&dc);
|
|
||||||
}
|
|
||||||
|
|
||||||
DoDrawPlayRegion(&dc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdornedRulerPanel::OnSize(wxSizeEvent & WXUNUSED(evt))
|
void AdornedRulerPanel::OnSize(wxSizeEvent & WXUNUSED(evt))
|
||||||
@ -1947,29 +1960,13 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
|||||||
delete mSnapManager;
|
delete mSnapManager;
|
||||||
mSnapManager = NULL;
|
mSnapManager = NULL;
|
||||||
}
|
}
|
||||||
}
|
return;
|
||||||
else if (mQuickPlayEnabled) {
|
|
||||||
mQuickPlayInd = true;
|
|
||||||
Refresh();
|
|
||||||
|
|
||||||
if (isWithinStart || isWithinEnd) {
|
|
||||||
if (!mIsWE) {
|
|
||||||
SetCursor(mCursorSizeWE);
|
|
||||||
mIsWE = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (mIsWE) {
|
|
||||||
SetCursor(mCursorHand);
|
|
||||||
mIsWE = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (evt.Entering()) {
|
else if (evt.Entering()) {
|
||||||
SetCursor(mCursorHand);
|
SetCursor(mCursorHand);
|
||||||
mQuickPlayInd = false;
|
mQuickPlayInd = false;
|
||||||
DrawQuickPlayIndicator(NULL);
|
DrawQuickPlayIndicator(NULL);
|
||||||
Refresh();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evt.RightDown() && !(evt.LeftIsDown())) {
|
if (evt.RightDown() && !(evt.LeftIsDown())) {
|
||||||
@ -1981,8 +1978,25 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
|||||||
if (!mQuickPlayEnabled)
|
if (!mQuickPlayEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (isWithinStart || isWithinEnd) {
|
||||||
|
if (!mIsWE) {
|
||||||
|
SetCursor(mCursorSizeWE);
|
||||||
|
mIsWE = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (mIsWE) {
|
||||||
|
SetCursor(mCursorHand);
|
||||||
|
mIsWE = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HandleSnapping();
|
HandleSnapping();
|
||||||
|
|
||||||
|
mQuickPlayInd = true;
|
||||||
|
wxClientDC dc(this);
|
||||||
|
DrawQuickPlayIndicator(&dc);
|
||||||
|
|
||||||
if (evt.LeftDown())
|
if (evt.LeftDown())
|
||||||
{
|
{
|
||||||
// Temporarily unlock locked play region
|
// Temporarily unlock locked play region
|
||||||
@ -2027,6 +2041,8 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
|||||||
case mesNone:
|
case mesNone:
|
||||||
// If close to either end of play region, snap to closest
|
// If close to either end of play region, snap to closest
|
||||||
if (isWithinStart || isWithinEnd) {
|
if (isWithinStart || isWithinEnd) {
|
||||||
|
DrawQuickPlayIndicator(NULL);
|
||||||
|
|
||||||
if (fabs(mQuickPlayPos - mOldPlayRegionStart) < fabs(mQuickPlayPos - mOldPlayRegionEnd))
|
if (fabs(mQuickPlayPos - mOldPlayRegionStart) < fabs(mQuickPlayPos - mOldPlayRegionEnd))
|
||||||
mQuickPlayPos = mOldPlayRegionStart;
|
mQuickPlayPos = mOldPlayRegionStart;
|
||||||
else
|
else
|
||||||
@ -2034,6 +2050,8 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mesDraggingPlayRegionStart:
|
case mesDraggingPlayRegionStart:
|
||||||
|
DrawQuickPlayIndicator(NULL);
|
||||||
|
|
||||||
// Don't start dragging until beyond tollerance initial playback start
|
// Don't start dragging until beyond tollerance initial playback start
|
||||||
if (!mIsDragging && isWithinStart)
|
if (!mIsDragging && isWithinStart)
|
||||||
mQuickPlayPos = mOldPlayRegionStart;
|
mQuickPlayPos = mOldPlayRegionStart;
|
||||||
@ -2048,20 +2066,29 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mesDraggingPlayRegionEnd:
|
case mesDraggingPlayRegionEnd:
|
||||||
if (!mIsDragging && isWithinEnd)
|
if (!mIsDragging && isWithinEnd) {
|
||||||
|
DrawQuickPlayIndicator(NULL);
|
||||||
|
|
||||||
mQuickPlayPos = mOldPlayRegionEnd;
|
mQuickPlayPos = mOldPlayRegionEnd;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
mIsDragging = true;
|
mIsDragging = true;
|
||||||
if (isWithinStart)
|
if (isWithinStart) {
|
||||||
|
DrawQuickPlayIndicator(NULL);
|
||||||
|
|
||||||
mQuickPlayPos = mOldPlayRegionStart;
|
mQuickPlayPos = mOldPlayRegionStart;
|
||||||
|
}
|
||||||
mPlayRegionEnd = mQuickPlayPos;
|
mPlayRegionEnd = mQuickPlayPos;
|
||||||
if (canDragSel) {
|
if (canDragSel) {
|
||||||
DragSelection();
|
DragSelection();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mesSelectingPlayRegionClick:
|
case mesSelectingPlayRegionClick:
|
||||||
|
|
||||||
// Don't start dragging until mouse is beyond tollerance of initial click.
|
// Don't start dragging until mouse is beyond tollerance of initial click.
|
||||||
if (isWithinClick || mLeftDownClick == -1) {
|
if (isWithinClick || mLeftDownClick == -1) {
|
||||||
|
DrawQuickPlayIndicator(NULL);
|
||||||
|
|
||||||
mQuickPlayPos = mLeftDownClick;
|
mQuickPlayPos = mLeftDownClick;
|
||||||
mPlayRegionStart = mLeftDownClick;
|
mPlayRegionStart = mLeftDownClick;
|
||||||
mPlayRegionEnd = mLeftDownClick;
|
mPlayRegionEnd = mLeftDownClick;
|
||||||
@ -2072,6 +2099,8 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
|||||||
break;
|
break;
|
||||||
case mesSelectingPlayRegionRange:
|
case mesSelectingPlayRegionRange:
|
||||||
if (isWithinClick) {
|
if (isWithinClick) {
|
||||||
|
DrawQuickPlayIndicator(NULL);
|
||||||
|
|
||||||
mQuickPlayPos = mLeftDownClick;
|
mQuickPlayPos = mLeftDownClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2088,6 +2117,8 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Refresh();
|
||||||
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evt.LeftUp())
|
if (evt.LeftUp())
|
||||||
@ -2240,6 +2271,8 @@ void AdornedRulerPanel::ShowMenu(const wxPoint & pos)
|
|||||||
// dismiss and clear Quick-Play indicator
|
// dismiss and clear Quick-Play indicator
|
||||||
mQuickPlayInd = false;
|
mQuickPlayInd = false;
|
||||||
DrawQuickPlayIndicator(NULL);
|
DrawQuickPlayIndicator(NULL);
|
||||||
|
|
||||||
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdornedRulerPanel::OnToggleQuickPlay(wxCommandEvent&)
|
void AdornedRulerPanel::OnToggleQuickPlay(wxCommandEvent&)
|
||||||
@ -2494,12 +2527,26 @@ void AdornedRulerPanel::DrawQuickPlayIndicator(wxDC * dc)
|
|||||||
double latestEnd = std::max(mTracks->GetEndTime(), mProject->GetSel1());
|
double latestEnd = std::max(mTracks->GetEndTime(), mProject->GetSel1());
|
||||||
if (dc == NULL || (mQuickPlayPos >= latestEnd)) {
|
if (dc == NULL || (mQuickPlayPos >= latestEnd)) {
|
||||||
tp->DrawQuickPlayIndicator(-1);
|
tp->DrawQuickPlayIndicator(-1);
|
||||||
|
mLastQuickPlayX = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int indsize = 4;
|
int indsize = 4;
|
||||||
int x = Time2Pos(mQuickPlayPos);
|
int x = Time2Pos(mQuickPlayPos);
|
||||||
|
|
||||||
|
if (mLastQuickPlayX >= 0) {
|
||||||
|
// Restore the background, but make it a little oversized to make
|
||||||
|
// it happy OSX.
|
||||||
|
dc->Blit(mLastQuickPlayX - indsize - 1,
|
||||||
|
0,
|
||||||
|
indsize * 2 + 1 + 2,
|
||||||
|
(indsize * 3) / 2 + 1 + 2,
|
||||||
|
&mBackDC,
|
||||||
|
mLastQuickPlayX - indsize - 1,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
mLastQuickPlayX = x;
|
||||||
|
|
||||||
wxPoint tri[3];
|
wxPoint tri[3];
|
||||||
tri[0].x = -indsize;
|
tri[0].x = -indsize;
|
||||||
tri[0].y = 1;
|
tri[0].y = 1;
|
||||||
@ -2526,7 +2573,6 @@ void AdornedRulerPanel::SetPlayRegion(double playRegionStart,
|
|||||||
mPlayRegionStart = playRegionStart;
|
mPlayRegionStart = playRegionStart;
|
||||||
mPlayRegionEnd = playRegionEnd;
|
mPlayRegionEnd = playRegionEnd;
|
||||||
|
|
||||||
// Must use Refresh()
|
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2539,7 +2585,6 @@ void AdornedRulerPanel::ClearPlayRegion()
|
|||||||
mPlayRegionEnd = -1;
|
mPlayRegionEnd = -1;
|
||||||
mQuickPlayInd = false;
|
mQuickPlayInd = false;
|
||||||
|
|
||||||
// Must use Refresh()
|
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
#ifndef __AUDACITY_RULER__
|
#ifndef __AUDACITY_RULER__
|
||||||
#define __AUDACITY_RULER__
|
#define __AUDACITY_RULER__
|
||||||
|
|
||||||
|
#include <wx/bitmap.h>
|
||||||
#include <wx/dc.h>
|
#include <wx/dc.h>
|
||||||
|
#include <wx/dcmemory.h>
|
||||||
#include <wx/event.h>
|
#include <wx/event.h>
|
||||||
#include <wx/font.h>
|
#include <wx/font.h>
|
||||||
#include <wx/panel.h>
|
#include <wx/panel.h>
|
||||||
@ -333,6 +335,9 @@ private:
|
|||||||
AudacityProject *mProject;
|
AudacityProject *mProject;
|
||||||
TrackList *mTracks;
|
TrackList *mTracks;
|
||||||
|
|
||||||
|
wxBitmap *mBack;
|
||||||
|
wxMemoryDC mBackDC;
|
||||||
|
|
||||||
wxRect mOuter;
|
wxRect mOuter;
|
||||||
wxRect mInner;
|
wxRect mInner;
|
||||||
|
|
||||||
@ -345,6 +350,7 @@ private:
|
|||||||
double mIndTime;
|
double mIndTime;
|
||||||
bool mQuickPlayInd;
|
bool mQuickPlayInd;
|
||||||
double mQuickPlayPos;
|
double mQuickPlayPos;
|
||||||
|
double mLastQuickPlayX;
|
||||||
|
|
||||||
SnapManager *mSnapManager;
|
SnapManager *mSnapManager;
|
||||||
bool mIsSnapped;
|
bool mIsSnapped;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user