mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-31 07:59:27 +02:00
TrackPanelCellIterator is no longer needed
This commit is contained in:
parent
005abb06d6
commit
39fc20c5ee
@ -205,7 +205,6 @@ src/TrackPanel.h
|
||||
src/TrackPanelAx.cpp
|
||||
src/TrackPanelAx.h
|
||||
src/TrackPanelCell.h
|
||||
src/TrackPanelCellIterator.h
|
||||
src/TrackPanelDrawingContext.h
|
||||
src/TrackPanelListener.h
|
||||
src/TrackPanelMouseEvent.h
|
||||
|
@ -3167,7 +3167,6 @@
|
||||
5E73966F1DAFDB9D00BA0A4D /* SelectHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectHandle.cpp; sourceTree = "<group>"; };
|
||||
5E7396701DAFDB9D00BA0A4D /* SelectHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectHandle.h; sourceTree = "<group>"; };
|
||||
5E74D2D91CC4427B00D88B0B /* TrackPanelCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackPanelCell.h; sourceTree = "<group>"; };
|
||||
5E74D2DA1CC4427B00D88B0B /* TrackPanelCellIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackPanelCellIterator.h; sourceTree = "<group>"; };
|
||||
5E74D2DD1CC4429700D88B0B /* EditCursorOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EditCursorOverlay.cpp; sourceTree = "<group>"; };
|
||||
5E74D2DE1CC4429700D88B0B /* EditCursorOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditCursorOverlay.h; sourceTree = "<group>"; };
|
||||
5E74D2DF1CC4429700D88B0B /* PlayIndicatorOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlayIndicatorOverlay.cpp; sourceTree = "<group>"; };
|
||||
@ -4273,7 +4272,6 @@
|
||||
1790B0ED09883BFD008A330A /* TrackPanel.h */,
|
||||
1790B0EF09883BFD008A330A /* TrackPanelAx.h */,
|
||||
5E74D2D91CC4427B00D88B0B /* TrackPanelCell.h */,
|
||||
5E74D2DA1CC4427B00D88B0B /* TrackPanelCellIterator.h */,
|
||||
5E52335F1EFDD57D001E4BB8 /* TrackPanelDrawingContext.h */,
|
||||
2803C8B619F35AA000278526 /* TrackPanelListener.h */,
|
||||
5E15123A1DB000C000702E29 /* TrackPanelMouseEvent.h */,
|
||||
|
@ -251,7 +251,6 @@ audacity_SOURCES = \
|
||||
TrackPanelAx.cpp \
|
||||
TrackPanelAx.h \
|
||||
TrackPanelCell.h \
|
||||
TrackPanelCellIterator.h \
|
||||
TrackPanelDrawingContext.h \
|
||||
TrackPanelListener.h \
|
||||
TrackPanelMouseEvent.h \
|
||||
|
@ -330,12 +330,12 @@ am__audacity_SOURCES_DIST = BlockFile.cpp BlockFile.h DirManager.cpp \
|
||||
TimerRecordDialog.cpp TimerRecordDialog.h TimeTrack.cpp \
|
||||
TimeTrack.h Track.cpp Track.h TrackArtist.cpp TrackArtist.h \
|
||||
TrackPanel.cpp TrackPanel.h TrackPanelAx.cpp TrackPanelAx.h \
|
||||
TrackPanelCell.h TrackPanelCellIterator.h \
|
||||
TrackPanelDrawingContext.h TrackPanelListener.h \
|
||||
TrackPanelMouseEvent.h TrackPanelResizeHandle.cpp \
|
||||
TrackPanelResizeHandle.h TrackPanelResizerCell.cpp \
|
||||
TrackPanelResizerCell.h TranslatableStringArray.h UIHandle.h \
|
||||
UIHandle.cpp UndoManager.cpp UndoManager.h UserException.cpp \
|
||||
TrackPanelCell.h TrackPanelDrawingContext.h \
|
||||
TrackPanelListener.h TrackPanelMouseEvent.h \
|
||||
TrackPanelResizeHandle.cpp TrackPanelResizeHandle.h \
|
||||
TrackPanelResizerCell.cpp TrackPanelResizerCell.h \
|
||||
TranslatableStringArray.h UIHandle.h UIHandle.cpp \
|
||||
UndoManager.cpp UndoManager.h UserException.cpp \
|
||||
UserException.h ViewInfo.cpp ViewInfo.h VoiceKey.cpp \
|
||||
VoiceKey.h WaveClip.cpp WaveClip.h WaveTrack.cpp WaveTrack.h \
|
||||
WaveTrackLocation.h WrappedType.cpp WrappedType.h \
|
||||
@ -1378,12 +1378,12 @@ audacity_SOURCES = $(libaudacity_la_SOURCES) AboutDialog.cpp \
|
||||
TimerRecordDialog.cpp TimerRecordDialog.h TimeTrack.cpp \
|
||||
TimeTrack.h Track.cpp Track.h TrackArtist.cpp TrackArtist.h \
|
||||
TrackPanel.cpp TrackPanel.h TrackPanelAx.cpp TrackPanelAx.h \
|
||||
TrackPanelCell.h TrackPanelCellIterator.h \
|
||||
TrackPanelDrawingContext.h TrackPanelListener.h \
|
||||
TrackPanelMouseEvent.h TrackPanelResizeHandle.cpp \
|
||||
TrackPanelResizeHandle.h TrackPanelResizerCell.cpp \
|
||||
TrackPanelResizerCell.h TranslatableStringArray.h UIHandle.h \
|
||||
UIHandle.cpp UndoManager.cpp UndoManager.h UserException.cpp \
|
||||
TrackPanelCell.h TrackPanelDrawingContext.h \
|
||||
TrackPanelListener.h TrackPanelMouseEvent.h \
|
||||
TrackPanelResizeHandle.cpp TrackPanelResizeHandle.h \
|
||||
TrackPanelResizerCell.cpp TrackPanelResizerCell.h \
|
||||
TranslatableStringArray.h UIHandle.h UIHandle.cpp \
|
||||
UndoManager.cpp UndoManager.h UserException.cpp \
|
||||
UserException.h ViewInfo.cpp ViewInfo.h VoiceKey.cpp \
|
||||
VoiceKey.h WaveClip.cpp WaveClip.h WaveTrack.cpp WaveTrack.h \
|
||||
WaveTrackLocation.h WrappedType.cpp WrappedType.h \
|
||||
|
@ -71,7 +71,6 @@ is time to refresh some aspect of the screen.
|
||||
#include "Experimental.h"
|
||||
#include "TrackPanel.h"
|
||||
#include "Project.h"
|
||||
#include "TrackPanelCellIterator.h"
|
||||
#include "TrackPanelMouseEvent.h"
|
||||
#include "TrackPanelResizeHandle.h"
|
||||
//#define DEBUG_DRAW_TIMING 1
|
||||
@ -2634,164 +2633,6 @@ void TrackInfo::UpdatePrefs()
|
||||
} while (textWidth >= allowableWidth);
|
||||
}
|
||||
|
||||
IteratorRange< TrackPanelCellIterator > TrackPanel::Cells()
|
||||
{
|
||||
return {
|
||||
TrackPanelCellIterator( this, true ),
|
||||
TrackPanelCellIterator( this, false )
|
||||
};
|
||||
}
|
||||
|
||||
TrackPanelCellIterator::TrackPanelCellIterator(TrackPanel *trackPanel, bool begin)
|
||||
: mPanel{ trackPanel }
|
||||
, mIter{
|
||||
trackPanel->GetTracks()->Any().begin()
|
||||
.Filter( IsVisibleTrack( trackPanel->GetProject() ) )
|
||||
}
|
||||
{
|
||||
if (begin) {
|
||||
mpTrack = Track::Pointer( *mIter );
|
||||
if (mpTrack)
|
||||
mpCell = mpTrack;
|
||||
else
|
||||
mpCell = trackPanel->GetBackgroundCell();
|
||||
}
|
||||
else
|
||||
mDidBackground = true;
|
||||
|
||||
const auto size = mPanel->GetSize();
|
||||
mRect = { 0, 0, size.x, size.y };
|
||||
UpdateRect();
|
||||
}
|
||||
|
||||
TrackPanelCellIterator &TrackPanelCellIterator::operator++ ()
|
||||
{
|
||||
if ( mpTrack ) {
|
||||
if ( ++ mType == CellType::Background )
|
||||
mType = CellType::Track, mpTrack = Track::Pointer( * ++ mIter );
|
||||
}
|
||||
if ( mpTrack ) {
|
||||
if ( mType == CellType::Label &&
|
||||
!mpTrack->IsLeader() )
|
||||
// Visit label of stereo track only once
|
||||
++mType;
|
||||
switch ( mType ) {
|
||||
case CellType::Track:
|
||||
mpCell = mpTrack;
|
||||
break;
|
||||
case CellType::Label:
|
||||
mpCell = mpTrack->GetTrackControl();
|
||||
break;
|
||||
case CellType::VRuler:
|
||||
mpCell = mpTrack->GetVRulerControl();
|
||||
break;
|
||||
case CellType::Resizer: {
|
||||
mpCell = mpTrack->GetResizer();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// should not happen
|
||||
mpCell.reset();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ( !mDidBackground )
|
||||
mpCell = mPanel->GetBackgroundCell(), mDidBackground = true;
|
||||
else
|
||||
mpCell.reset();
|
||||
|
||||
UpdateRect();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
TrackPanelCellIterator TrackPanelCellIterator::operator++ (int)
|
||||
{
|
||||
TrackPanelCellIterator copy(*this);
|
||||
++ *this;
|
||||
return copy;
|
||||
}
|
||||
|
||||
auto TrackPanelCellIterator::operator* () const -> value_type
|
||||
{
|
||||
return { mpCell, mRect };
|
||||
}
|
||||
|
||||
void TrackPanelCellIterator::UpdateRect()
|
||||
{
|
||||
const auto size = mPanel->GetSize();
|
||||
if ( mpTrack ) {
|
||||
mRect = {
|
||||
0,
|
||||
mpTrack->GetY() - mPanel->GetViewInfo()->vpos,
|
||||
size.x,
|
||||
mpTrack->GetHeight()
|
||||
};
|
||||
switch ( mType ) {
|
||||
case CellType::Track:
|
||||
mRect.x = mPanel->GetLeftOffset();
|
||||
mRect.width -= (mRect.x + kRightMargin);
|
||||
mRect.y += kTopMargin;
|
||||
mRect.height -= (kBottomMargin + kTopMargin);
|
||||
break;
|
||||
case CellType::Label: {
|
||||
mRect.x = kLeftMargin;
|
||||
mRect.width = kTrackInfoWidth - mRect.x;
|
||||
mRect.y += kTopMargin;
|
||||
mRect.height =
|
||||
TrackList::Channels(mpTrack.get())
|
||||
.sum( &Track::GetHeight );
|
||||
mRect.height -= (kBottomMargin + kTopMargin);
|
||||
break;
|
||||
}
|
||||
case CellType::VRuler:
|
||||
{
|
||||
mRect.x = kTrackInfoWidth;
|
||||
// Right edge of the VRuler is inactive.
|
||||
mRect.width = mPanel->GetLeftOffset() - mRect.x;
|
||||
mRect.y += kTopMargin;
|
||||
mRect.height -= (kBottomMargin + kTopMargin);
|
||||
}
|
||||
break;
|
||||
case CellType::Resizer: {
|
||||
// The resizer region encompasses the bottom margin proper to this
|
||||
// track, plus the top margin of the next track (or, an equally
|
||||
// tall zone below, in case there is no next track)
|
||||
if ( mpTrack.get() ==
|
||||
*TrackList::Channels(mpTrack.get()).rbegin() )
|
||||
// Last channel has a resizer extending farther leftward
|
||||
mRect.x = kLeftMargin;
|
||||
else
|
||||
mRect.x = kTrackInfoWidth;
|
||||
mRect.width -= (mRect.x + kRightMargin);
|
||||
mRect.y += (mRect.height - kBottomMargin);
|
||||
mRect.height = (kBottomMargin + kTopMargin);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// should not happen
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ( mpCell ) {
|
||||
// Find a disjoint, maybe empty, rectangle
|
||||
// for the empty space appearing at bottom
|
||||
|
||||
mRect.x = kLeftMargin;
|
||||
mRect.width = size.x - (mRect.x + kRightMargin);
|
||||
|
||||
// Use previous value of the bottom, either the whole area if
|
||||
// there were no tracks, or else the resizer of the last track
|
||||
mRect.y =
|
||||
std::min( size.y,
|
||||
std::max( 0,
|
||||
mRect.y + mRect.height ) );
|
||||
mRect.height = size.y - mRect.y;
|
||||
}
|
||||
else
|
||||
mRect = {};
|
||||
}
|
||||
|
||||
static TrackPanel * TrackPanelFactory(wxWindow * parent,
|
||||
wxWindowID id,
|
||||
const wxPoint & pos,
|
||||
|
@ -44,7 +44,6 @@ class ControlToolBar; //Needed because state of controls can affect what gets dr
|
||||
class ToolsToolBar; //Needed because state of controls can affect what gets drawn.
|
||||
|
||||
class TrackPanelAx;
|
||||
class TrackPanelCellIterator;
|
||||
|
||||
class NoteTrack;
|
||||
class WaveTrack;
|
||||
@ -248,8 +247,6 @@ class AUDACITY_DLL_API TrackPanel final : public CellularPanel {
|
||||
|
||||
virtual ~ TrackPanel();
|
||||
|
||||
IteratorRange< TrackPanelCellIterator > Cells();
|
||||
|
||||
void UpdatePrefs();
|
||||
void ApplyUpdatedTheme();
|
||||
|
||||
|
@ -1,76 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
TrackPanelCellIterator.h
|
||||
|
||||
Paul Licameli
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_TRACK_PANEL_CELL_ITERATOR__
|
||||
#define __AUDACITY_TRACK_PANEL_CELL_ITERATOR__
|
||||
|
||||
#include "Track.h"
|
||||
#include <wx/gdicmn.h>
|
||||
#include <iterator>
|
||||
#include "MemoryX.h"
|
||||
|
||||
class Track;
|
||||
class TrackPanelCell;
|
||||
|
||||
class TrackPanel;
|
||||
|
||||
// A class that allows iteration over the rectangles of visible cells.
|
||||
class TrackPanelCellIterator
|
||||
: public std::iterator<
|
||||
std::forward_iterator_tag,
|
||||
const std::pair< std::shared_ptr< TrackPanelCell >, wxRect>
|
||||
>
|
||||
{
|
||||
public:
|
||||
enum class CellType {
|
||||
Track, Label, VRuler, Resizer, Background
|
||||
};
|
||||
|
||||
TrackPanelCellIterator(TrackPanel *trackPanel, bool begin);
|
||||
|
||||
// implement the STL iterator idiom
|
||||
|
||||
TrackPanelCellIterator &operator++ ();
|
||||
TrackPanelCellIterator operator++ (int);
|
||||
|
||||
friend inline bool operator==
|
||||
(const TrackPanelCellIterator &lhs, const TrackPanelCellIterator &rhs)
|
||||
{
|
||||
return lhs.mpCell == rhs.mpCell &&
|
||||
lhs.mDidBackground == rhs.mDidBackground;
|
||||
}
|
||||
|
||||
value_type operator * () const;
|
||||
|
||||
private:
|
||||
void UpdateRect();
|
||||
|
||||
TrackPanel *mPanel;
|
||||
TrackIter<Track> mIter;
|
||||
std::shared_ptr<Track> mpTrack;
|
||||
std::shared_ptr<TrackPanelCell> mpCell;
|
||||
CellType mType{ CellType::Track };
|
||||
bool mDidBackground{ false };
|
||||
wxRect mRect;
|
||||
};
|
||||
|
||||
inline TrackPanelCellIterator::CellType &operator++
|
||||
( TrackPanelCellIterator::CellType &type )
|
||||
{
|
||||
type = TrackPanelCellIterator::CellType( 1 + int( type ) );
|
||||
return type;
|
||||
}
|
||||
|
||||
inline bool operator !=
|
||||
(const TrackPanelCellIterator &lhs, const TrackPanelCellIterator &rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
#endif
|
@ -545,7 +545,6 @@
|
||||
<ClInclude Include="..\..\..\src\toolbars\SpectralSelectionBar.h" />
|
||||
<ClInclude Include="..\..\..\src\toolbars\SpectralSelectionBarListener.h" />
|
||||
<ClInclude Include="..\..\..\src\TrackPanelCell.h" />
|
||||
<ClInclude Include="..\..\..\src\TrackPanelCellIterator.h" />
|
||||
<ClInclude Include="..\..\..\src\TrackPanelDrawingContext.h" />
|
||||
<ClInclude Include="..\..\..\src\TrackPanelListener.h" />
|
||||
<ClInclude Include="..\..\..\src\TrackPanelMouseEvent.h" />
|
||||
|
@ -1978,9 +1978,6 @@
|
||||
<ClInclude Include="..\..\..\src\tracks\ui\Scrubbing.h">
|
||||
<Filter>src\tracks\ui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\TrackPanelCellIterator.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\commands\CommandFunctors.h">
|
||||
<Filter>src\commands</Filter>
|
||||
</ClInclude>
|
||||
|
Loading…
x
Reference in New Issue
Block a user