mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-04 14:48:40 +02:00
static SelectionState::Get()...
... not member functions of AudacityProject
This commit is contained in:
parent
c1c0030013
commit
68e25f3b7d
@ -120,6 +120,7 @@ scroll information. It also has some status flags.
|
|||||||
#include "NoteTrack.h"
|
#include "NoteTrack.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
#include "ProjectFSCK.h"
|
#include "ProjectFSCK.h"
|
||||||
|
#include "SelectionState.h"
|
||||||
#include "Sequence.h"
|
#include "Sequence.h"
|
||||||
#include "Snap.h"
|
#include "Snap.h"
|
||||||
#include "Tags.h"
|
#include "Tags.h"
|
||||||
@ -4162,7 +4163,7 @@ bool AudacityProject::SaveCopyWaveTracks(const FilePath & strProjectPathName,
|
|||||||
wxFileName uniqueTrackFileName;
|
wxFileName uniqueTrackFileName;
|
||||||
for (auto pTrack : (trackRange + &Track::IsLeader))
|
for (auto pTrack : (trackRange + &Track::IsLeader))
|
||||||
{
|
{
|
||||||
SelectionStateChanger changer{ GetSelectionState(), tracks };
|
SelectionStateChanger changer{ SelectionState::Get( project ), tracks };
|
||||||
auto channels = TrackList::Channels(pTrack);
|
auto channels = TrackList::Channels(pTrack);
|
||||||
|
|
||||||
for (auto channel : channels)
|
for (auto channel : channels)
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
#include "ClientData.h"
|
#include "ClientData.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
#include "SelectionState.h"
|
|
||||||
#include "commands/CommandManagerWindowClasses.h"
|
#include "commands/CommandManagerWindowClasses.h"
|
||||||
|
|
||||||
#include "TrackPanelListener.h"
|
#include "TrackPanelListener.h"
|
||||||
@ -304,7 +303,6 @@ public:
|
|||||||
wxPanel *GetTopPanel() { return mTopPanel; }
|
wxPanel *GetTopPanel() { return mTopPanel; }
|
||||||
TrackPanel * GetTrackPanel() {return mTrackPanel;}
|
TrackPanel * GetTrackPanel() {return mTrackPanel;}
|
||||||
const TrackPanel * GetTrackPanel() const {return mTrackPanel;}
|
const TrackPanel * GetTrackPanel() const {return mTrackPanel;}
|
||||||
SelectionState &GetSelectionState() { return mSelectionState; }
|
|
||||||
|
|
||||||
bool GetTracksFitVerticallyZoomed() { return mTracksFitVerticallyZoomed; } //lda
|
bool GetTracksFitVerticallyZoomed() { return mTracksFitVerticallyZoomed; } //lda
|
||||||
void SetTracksFitVerticallyZoomed(bool flag) { mTracksFitVerticallyZoomed = flag; } //lda
|
void SetTracksFitVerticallyZoomed(bool flag) { mTracksFitVerticallyZoomed = flag; } //lda
|
||||||
@ -557,7 +555,6 @@ private:
|
|||||||
AdornedRulerPanel *mRuler{};
|
AdornedRulerPanel *mRuler{};
|
||||||
wxPanel *mTopPanel{};
|
wxPanel *mTopPanel{};
|
||||||
TrackPanel *mTrackPanel{};
|
TrackPanel *mTrackPanel{};
|
||||||
SelectionState mSelectionState{};
|
|
||||||
wxWindow * mMainPage;
|
wxWindow * mMainPage;
|
||||||
wxPanel * mMainPanel;
|
wxPanel * mMainPanel;
|
||||||
wxScrollBar *mHsbar;
|
wxScrollBar *mHsbar;
|
||||||
|
@ -11,6 +11,21 @@
|
|||||||
|
|
||||||
#include "ViewInfo.h"
|
#include "ViewInfo.h"
|
||||||
#include "Track.h"
|
#include "Track.h"
|
||||||
|
#include "Project.h"
|
||||||
|
|
||||||
|
static const AudacityProject::AttachedObjects::RegisteredFactory key{
|
||||||
|
[](AudacityProject &){ return std::make_shared< SelectionState >(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
SelectionState &SelectionState::Get( AudacityProject &project )
|
||||||
|
{
|
||||||
|
return project.AttachedObjects::Get< SelectionState >( key );
|
||||||
|
}
|
||||||
|
|
||||||
|
const SelectionState &SelectionState::Get( const AudacityProject &project )
|
||||||
|
{
|
||||||
|
return Get( const_cast< AudacityProject & >( project ) );
|
||||||
|
}
|
||||||
|
|
||||||
// Set selection length to the length of a track -- but if sync-lock is turned
|
// Set selection length to the length of a track -- but if sync-lock is turned
|
||||||
// on, use the largest possible selection in the sync-lock group.
|
// on, use the largest possible selection in the sync-lock group.
|
||||||
|
@ -9,16 +9,22 @@
|
|||||||
#ifndef __AUDACITY_SELECTION_STATE__
|
#ifndef __AUDACITY_SELECTION_STATE__
|
||||||
#define __AUDACITY_SELECTION_STATE__
|
#define __AUDACITY_SELECTION_STATE__
|
||||||
|
|
||||||
|
class AudacityProject;
|
||||||
class Track;
|
class Track;
|
||||||
class TrackList;
|
class TrackList;
|
||||||
class ViewInfo;
|
class ViewInfo;
|
||||||
|
#include "ClientData.h"
|
||||||
#include "MemoryX.h"
|
#include "MemoryX.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// State relating to the set of selected tracks
|
// State relating to the set of selected tracks
|
||||||
class SelectionState
|
class SelectionState final
|
||||||
|
: public ClientData::Base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static SelectionState &Get( AudacityProject &project );
|
||||||
|
static const SelectionState &Get( const AudacityProject &project );
|
||||||
|
|
||||||
static void SelectTrackLength
|
static void SelectTrackLength
|
||||||
( ViewInfo &viewInfo, Track &track, bool syncLocked );
|
( ViewInfo &viewInfo, Track &track, bool syncLocked );
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#include "../LabelTrack.h"
|
#include "../LabelTrack.h"
|
||||||
#include "../Project.h"
|
#include "../Project.h"
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
|
#include "../SelectionState.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
#include "../Tags.h"
|
#include "../Tags.h"
|
||||||
#include "../WaveTrack.h"
|
#include "../WaveTrack.h"
|
||||||
@ -127,7 +128,7 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
ExportMultiple::ExportMultiple(AudacityProject *project)
|
ExportMultiple::ExportMultiple(AudacityProject *project)
|
||||||
: wxDialogWrapper(project, wxID_ANY, wxString(_("Export Multiple")))
|
: wxDialogWrapper(project, wxID_ANY, wxString(_("Export Multiple")))
|
||||||
, mSelectionState{ project->GetSelectionState() }
|
, mSelectionState{ SelectionState::Get( *project ) }
|
||||||
{
|
{
|
||||||
SetName(GetTitle());
|
SetName(GetTitle());
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
#include "../Project.h"
|
#include "../Project.h"
|
||||||
#include "../Track.h"
|
#include "../Track.h"
|
||||||
|
#include "../SelectionState.h"
|
||||||
#include "../TrackPanel.h"
|
#include "../TrackPanel.h"
|
||||||
#include "../TrackPanelAx.h"
|
#include "../TrackPanelAx.h"
|
||||||
#include "../commands/CommandContext.h"
|
#include "../commands/CommandContext.h"
|
||||||
@ -85,7 +86,7 @@ void DoPrevTrack(
|
|||||||
{
|
{
|
||||||
auto trackPanel = project.GetTrackPanel();
|
auto trackPanel = project.GetTrackPanel();
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &selectionState = project.GetSelectionState();
|
auto &selectionState = SelectionState::Get( project );
|
||||||
|
|
||||||
Track* t = trackPanel->GetFocusedTrack();
|
Track* t = trackPanel->GetFocusedTrack();
|
||||||
if( t == NULL ) // if there isn't one, focus on last
|
if( t == NULL ) // if there isn't one, focus on last
|
||||||
@ -195,7 +196,7 @@ void DoNextTrack(
|
|||||||
{
|
{
|
||||||
auto trackPanel = project.GetTrackPanel();
|
auto trackPanel = project.GetTrackPanel();
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto &selectionState = project.GetSelectionState();
|
auto &selectionState = SelectionState::Get( project );
|
||||||
|
|
||||||
auto t = trackPanel->GetFocusedTrack(); // Get currently focused track
|
auto t = trackPanel->GetFocusedTrack(); // Get currently focused track
|
||||||
if( t == NULL ) // if there isn't one, focus on first
|
if( t == NULL ) // if there isn't one, focus on first
|
||||||
@ -507,7 +508,7 @@ void OnToggle(const CommandContext &context)
|
|||||||
{
|
{
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
auto trackPanel = project.GetTrackPanel();
|
auto trackPanel = project.GetTrackPanel();
|
||||||
auto &selectionState = project.GetSelectionState();
|
auto &selectionState = SelectionState::Get( project );
|
||||||
|
|
||||||
Track *t;
|
Track *t;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "../Menus.h" // for PrefsListener
|
#include "../Menus.h" // for PrefsListener
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
#include "../Project.h"
|
#include "../Project.h"
|
||||||
|
#include "../SelectionState.h"
|
||||||
#include "../TimeDialog.h"
|
#include "../TimeDialog.h"
|
||||||
#include "../TrackPanel.h"
|
#include "../TrackPanel.h"
|
||||||
#include "../ViewInfo.h"
|
#include "../ViewInfo.h"
|
||||||
@ -509,7 +510,7 @@ void DoListSelection
|
|||||||
{
|
{
|
||||||
auto &tracks = TrackList::Get( project );
|
auto &tracks = TrackList::Get( project );
|
||||||
auto trackPanel = project.GetTrackPanel();
|
auto trackPanel = project.GetTrackPanel();
|
||||||
auto &selectionState = project.GetSelectionState();
|
auto &selectionState = SelectionState::Get( project );
|
||||||
auto &viewInfo = ViewInfo::Get( project );
|
auto &viewInfo = ViewInfo::Get( project );
|
||||||
auto isSyncLocked = project.IsSyncLocked();
|
auto isSyncLocked = project.IsSyncLocked();
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
#include "../../../LabelTrack.h"
|
#include "../../../LabelTrack.h"
|
||||||
#include "../../../Project.h"
|
#include "../../../Project.h"
|
||||||
#include "../../../RefreshCode.h"
|
#include "../../../RefreshCode.h"
|
||||||
|
#include "../../../SelectionState.h"
|
||||||
#include "../../../TrackPanelMouseEvent.h"
|
#include "../../../TrackPanelMouseEvent.h"
|
||||||
#include "../../../ViewInfo.h"
|
#include "../../../ViewInfo.h"
|
||||||
#include "../../../images/Cursors.h"
|
#include "../../../images/Cursors.h"
|
||||||
@ -74,7 +75,7 @@ UIHandle::Result LabelTextHandle::Click
|
|||||||
|
|
||||||
auto result = LabelDefaultClickHandle::Click( evt, pProject );
|
auto result = LabelDefaultClickHandle::Click( evt, pProject );
|
||||||
|
|
||||||
auto &selectionState = pProject->GetSelectionState();
|
auto &selectionState = SelectionState::Get( *pProject );
|
||||||
auto &tracks = TrackList::Get( *pProject );
|
auto &tracks = TrackList::Get( *pProject );
|
||||||
mChanger =
|
mChanger =
|
||||||
std::make_shared< SelectionStateChanger >( selectionState, tracks );
|
std::make_shared< SelectionStateChanger >( selectionState, tracks );
|
||||||
|
@ -12,8 +12,8 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
#include "BackgroundCell.h"
|
#include "BackgroundCell.h"
|
||||||
|
|
||||||
#include "../../HitTestResult.h"
|
#include "../../HitTestResult.h"
|
||||||
#include "../../Project.h"
|
|
||||||
#include "../../RefreshCode.h"
|
#include "../../RefreshCode.h"
|
||||||
|
#include "../../SelectionState.h"
|
||||||
#include "../../Track.h"
|
#include "../../Track.h"
|
||||||
#include "../../TrackPanelMouseEvent.h"
|
#include "../../TrackPanelMouseEvent.h"
|
||||||
#include "../../UIHandle.h"
|
#include "../../UIHandle.h"
|
||||||
@ -51,7 +51,7 @@ public:
|
|||||||
// AS: If the user clicked outside all tracks, make nothing
|
// AS: If the user clicked outside all tracks, make nothing
|
||||||
// selected.
|
// selected.
|
||||||
if ((event.ButtonDown() || event.ButtonDClick())) {
|
if ((event.ButtonDown() || event.ButtonDClick())) {
|
||||||
pProject->GetSelectionState().SelectNone(
|
SelectionState::Get( *pProject ).SelectNone(
|
||||||
TrackList::Get( *pProject ) );
|
TrackList::Get( *pProject ) );
|
||||||
result |= RefreshAll;
|
result |= RefreshAll;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
#include "../../NumberScale.h"
|
#include "../../NumberScale.h"
|
||||||
#include "../../Project.h"
|
#include "../../Project.h"
|
||||||
#include "../../RefreshCode.h"
|
#include "../../RefreshCode.h"
|
||||||
|
#include "../../SelectionState.h"
|
||||||
#include "../../TrackPanel.h"
|
#include "../../TrackPanel.h"
|
||||||
#include "../../TrackPanelMouseEvent.h"
|
#include "../../TrackPanelMouseEvent.h"
|
||||||
#include "../../ViewInfo.h"
|
#include "../../ViewInfo.h"
|
||||||
@ -552,7 +553,7 @@ UIHandle::Result SelectHandle::Click
|
|||||||
// Do not start a drag
|
// Do not start a drag
|
||||||
return RefreshAll | Cancelled;
|
return RefreshAll | Cancelled;
|
||||||
|
|
||||||
auto &selectionState = pProject->GetSelectionState();
|
auto &selectionState = SelectionState::Get( *pProject );
|
||||||
if (event.LeftDClick() && !event.ShiftDown()) {
|
if (event.LeftDClick() && !event.ShiftDown()) {
|
||||||
auto &trackList = TrackList::Get( *pProject );
|
auto &trackList = TrackList::Get( *pProject );
|
||||||
|
|
||||||
@ -835,7 +836,7 @@ UIHandle::Result SelectHandle::Drag
|
|||||||
Track *eTrack = clickedTrack.get();
|
Track *eTrack = clickedTrack.get();
|
||||||
auto &trackList = TrackList::Get( *pProject );
|
auto &trackList = TrackList::Get( *pProject );
|
||||||
if ( sTrack && eTrack && !event.ControlDown() ) {
|
if ( sTrack && eTrack && !event.ControlDown() ) {
|
||||||
auto &selectionState = pProject->GetSelectionState();
|
auto &selectionState = SelectionState::Get( *pProject );
|
||||||
selectionState.SelectRangeOfTracks( trackList, *sTrack, *eTrack );
|
selectionState.SelectRangeOfTracks( trackList, *sTrack, *eTrack );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user