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();
158 const wxMouseEvent &
event = evt.
event;
167 if (view.GetMinimized()) {
169 for (
auto pChannel : channels) {
171 channelView.SetExpandedHeight(channelView.GetHeight());
172 channelView.SetMinimized(
false);
175 if (channels.size() > 1) {
185 auto doResizeBelow = [&] (
Channel *prev) {
193 int newTrackHeight =
static_cast < int >
196 int newUpperTrackHeight =
static_cast < int >
200 if (newTrackHeight < view.GetMinimizedHeight())
201 newTrackHeight = view.GetMinimizedHeight();
202 if (newUpperTrackHeight < prevView.GetMinimizedHeight())
203 newUpperTrackHeight = prevView.GetMinimizedHeight();
205 view.SetExpandedHeight(newTrackHeight);
206 prevView.SetExpandedHeight(newUpperTrackHeight);
209 auto doResizeBetween = [&] (
Channel *next) {
217 if (newTrackHeight < nextView.GetMinimizedHeight()) {
218 newTrackHeight = nextView.GetMinimizedHeight();
219 newUpperTrackHeight =
222 if (newUpperTrackHeight < view.GetMinimizedHeight()) {
223 newUpperTrackHeight = view.GetMinimizedHeight();
228 view.SetExpandedHeight(newUpperTrackHeight);
229 nextView.SetExpandedHeight(newTrackHeight);
232 auto doResize = [&] {
234 if (newTrackHeight < view.GetMinimizedHeight())
235 newTrackHeight = view.GetMinimizedHeight();
236 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)
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
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< const Channel > FindChannel() const override
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) 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)
Namespace containing an enum 'what to do on a refresh?'.