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."),
76 if (!view.GetMinimized()) {
78 auto size = range.size();
79 auto height = range.sum( [](
auto pChannel){
83 for (
const auto pChannel : range) {
84 int newCoord = ((double)ii++ /
size) * height;
97 const std::shared_ptr<Channel> &pChannel,
int y
98) : mwChannel{ pChannel }
105 auto last = *channels.rbegin();
111 if (channels.size() > 1) {
112 auto first = *channels.begin();
118 if (pChannel == *channels.rbegin())
137 return &**channels.begin();
145 return &**channels.rbegin();
161 const wxMouseEvent &
event = evt.
event;
170 if (view.GetMinimized()) {
172 for (
auto pChannel : channels) {
174 channelView.SetExpandedHeight(channelView.GetHeight());
175 channelView.SetMinimized(
false);
178 if (channels.size() > 1) {
188 auto doResizeBelow = [&] (
Channel *prev) {
196 int newTrackHeight =
static_cast < int >
199 int newUpperTrackHeight =
static_cast < int >
203 if (newTrackHeight < view.GetMinimizedHeight())
204 newTrackHeight = view.GetMinimizedHeight();
205 if (newUpperTrackHeight < prevView.GetMinimizedHeight())
206 newUpperTrackHeight = prevView.GetMinimizedHeight();
208 view.SetExpandedHeight(newTrackHeight);
209 prevView.SetExpandedHeight(newUpperTrackHeight);
212 auto doResizeBetween = [&] (
Channel *next) {
220 if (newTrackHeight < nextView.GetMinimizedHeight()) {
221 newTrackHeight = nextView.GetMinimizedHeight();
222 newUpperTrackHeight =
225 if (newUpperTrackHeight < view.GetMinimizedHeight()) {
226 newUpperTrackHeight = view.GetMinimizedHeight();
231 view.SetExpandedHeight(newUpperTrackHeight);
232 nextView.SetExpandedHeight(newTrackHeight);
235 auto doResize = [&] {
237 if (newTrackHeight < view.GetMinimizedHeight())
238 newTrackHeight = view.GetMinimizedHeight();
239 view.SetExpandedHeight(newTrackHeight);
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...
IteratorRange< ChannelIterator< ChannelType > > Channels()
Get range of channels with mutative access.
ChannelGroup & GetChannelGroup()
Channel object's lifetime is assumed to be nested in its Track's.
static ChannelView & Get(Channel &channel)
void SetExpandedHeight(int height)
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)
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
std::weak_ptr< Channel > mwChannel
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
int mInitialUpperExpandedHeight
Channel * PrevChannel(Channel &channel)
@ IsResizingBelowLinkedTracks
@ IsResizingBetweenLinkedTracks
TrackPanelResizeHandle(const TrackPanelResizeHandle &)=delete
static HitTestPreview HitPreview(bool bLinked)
std::shared_ptr< Channel > FindChannel()
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
std::shared_ptr< const Track > FindTrack() const override
Result Cancel(AudacityProject *pProject) override
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
static Track & GetTrack(Channel &channel)
int mInitialExpandedHeight
virtual ~TrackPanelResizeHandle()
int mInitialUpperTrackHeight
Channel * NextChannel(Channel &channel)
static std::shared_ptr< const Track > TrackFromChannel(const std::shared_ptr< const Channel > &pChannel)
A frequent convenience in the definition of UIHandles.
Namespace containing an enum 'what to do on a refresh?'.