16#include <wx/translation.h>
29 static wxCursor resizeCursor{ wxCURSOR_SIZENS };
40"Click and drag to adjust relative size of stereo tracks, double-click to make heights equal"),
46 XO(
"Click and drag to resize the track."),
62 auto pTrack = tracks.Lock(
mpTrack);
66 auto size = range.size();
67 auto height = range.sum( [](
const Track *pTrack){
71 for (
const auto channel : range ) {
72 int newCoord = ((double)ii++ /
size) * height;
85(
const std::shared_ptr<Track> &track,
int y )
93 auto last = *channels.rbegin();
99 if (channels.size() > 1) {
100 auto first = *channels.begin();
106 if (track.get() == *channels.rbegin())
121 auto pTrack = tracks.Lock(
mpTrack);
127 const wxMouseEvent &
event = evt.
event;
137 if (data.GetMinimized()) {
139 for (
auto channel : channels) {
141 channelView.SetExpandedHeight(channelView.GetHeight());
142 channelView.SetMinimized(
false );
145 if (channels.size() > 1) {
155 auto doResizeBelow = [&] (
Track *prev,
bool WXUNUSED(vStereo)) {
163 int newTrackHeight =
static_cast < int >
166 int newUpperTrackHeight =
static_cast < int >
170 if (newTrackHeight < view.GetMinimizedHeight())
171 newTrackHeight = view.GetMinimizedHeight();
172 if (newUpperTrackHeight < prevView.GetMinimizedHeight())
173 newUpperTrackHeight = prevView.GetMinimizedHeight();
175 view.SetExpandedHeight(newTrackHeight);
176 prevView.SetExpandedHeight(newUpperTrackHeight);
179 auto doResizeBetween = [&] (
Track *next,
bool WXUNUSED(vStereo)) {
187 if (newTrackHeight < nextView.GetMinimizedHeight()) {
188 newTrackHeight = nextView.GetMinimizedHeight();
189 newUpperTrackHeight =
192 if (newUpperTrackHeight < view.GetMinimizedHeight()) {
193 newUpperTrackHeight = view.GetMinimizedHeight();
198 view.SetExpandedHeight(newUpperTrackHeight);
199 nextView.SetExpandedHeight(newTrackHeight);
202 auto doResize = [&] {
204 if (newTrackHeight < view.GetMinimizedHeight())
205 newTrackHeight = view.GetMinimizedHeight();
206 view.SetExpandedHeight(newTrackHeight);
217 auto prev = * -- tracks.
Find(pTrack.get());
218 doResizeBelow(prev,
false);
223 auto next = * ++ tracks.
Find(pTrack.get());
224 doResizeBetween(next,
false);
263 auto pTrack = tracks.Lock(
mpTrack);
278 Track *
const next = * ++ tracks.
Find(pTrack.get());
289 Track *
const prev = * -- tracks.
Find(pTrack.get());
declares abstract base class Track, TrackList, and iterators over TrackList
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Subclass * Find(const RegisteredFactory &key)
Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand...
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
Abstract base class for an object holding data associated with points on a time axis.
static TrackList & Get(AudacityProject &project)
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
int mInitialUpperExpandedHeight
@ IsResizingBelowLinkedTracks
@ IsResizingBetweenLinkedTracks
TrackPanelResizeHandle(const TrackPanelResizeHandle &)=delete
static HitTestPreview HitPreview(bool bLinked)
std::weak_ptr< Track > mpTrack
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Result Cancel(AudacityProject *pProject) override
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
int mInitialExpandedHeight
virtual ~TrackPanelResizeHandle()
int mInitialUpperTrackHeight
bool GetMinimized() const
void SetExpandedHeight(int height)
static TrackView & Get(Track &)
Namespace containing an enum 'what to do on a refresh?'.