1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-29 23:29:41 +02:00

Rename "Actual" to "Expanded" height which explains purpose better

(cherry picked from audacity commit 579038e341a7fa58ca049754accf84f3212e4749)

Signed-off-by: akleja <storspov@gmail.com>
This commit is contained in:
Paul Licameli 2021-08-08 10:36:14 -04:00 committed by akleja
parent ce2bc7f60e
commit e8fb7b2803
8 changed files with 40 additions and 30 deletions

View File

@ -791,7 +791,7 @@ void ScreenshotBigDialog::SizeTracks(int h)
auto nChannels = channels.size();
auto height = nChannels == 1 ? 2 * h : h;
for (auto channel : channels)
TrackView::Get( *channel ).SetHeight(height);
TrackView::Get( *channel ).SetExpandedHeight(height);
}
ProjectWindow::Get( mContext.project ).RedrawProject();
}
@ -800,7 +800,7 @@ void ScreenshotBigDialog::OnShortTracks(wxCommandEvent & WXUNUSED(event))
{
for (auto t : TrackList::Get( mContext.project ).Any<WaveTrack>()) {
auto &view = TrackView::Get( *t );
view.SetHeight( view.GetMinimizedHeight() );
view.SetExpandedHeight( view.GetMinimizedHeight() );
}
ProjectWindow::Get( mContext.project ).RedrawProject();

View File

@ -69,7 +69,7 @@ UIHandle::Result TrackPanelResizeHandle::Click(
int coord = 0;
for ( const auto channel : range ) {
int newCoord = ((double)ii++ /size) * height;
TrackView::Get(*channel).SetHeight( newCoord - coord );
TrackView::Get(*channel).SetExpandedHeight( newCoord - coord );
coord = newCoord;
}
ProjectHistory::Get( *pProject ).ModifyState(false);
@ -92,7 +92,7 @@ TrackPanelResizeHandle::TrackPanelResizeHandle
auto last = *channels.rbegin();
auto &lastView = TrackView::Get( *last );
mInitialTrackHeight = lastView.GetHeight();
mInitialActualHeight = lastView.GetActualHeight();
mInitialExpandedHeight = lastView.GetExpandedHeight();
mInitialMinimized = lastView.GetMinimized();
if (channels.size() > 1) {
@ -100,7 +100,7 @@ TrackPanelResizeHandle::TrackPanelResizeHandle
auto &firstView = TrackView::Get( *first );
mInitialUpperTrackHeight = firstView.GetHeight();
mInitialUpperActualHeight = firstView.GetActualHeight();
mInitialUpperExpandedHeight = firstView.GetExpandedHeight();
if (track.get() == *channels.rbegin())
// capturedTrack is the lowest track
@ -137,7 +137,7 @@ UIHandle::Result TrackPanelResizeHandle::Drag
auto channels = TrackList::Channels( pTrack.get() );
for (auto channel : channels) {
auto &channelView = TrackView::Get( *channel );
channelView.SetHeight(channelView.GetHeight());
channelView.SetExpandedHeight(channelView.GetHeight());
channelView.SetMinimized( false );
}
@ -171,8 +171,8 @@ UIHandle::Result TrackPanelResizeHandle::Drag
if (newUpperTrackHeight < prevView.GetMinimizedHeight())
newUpperTrackHeight = prevView.GetMinimizedHeight();
view.SetHeight(newTrackHeight);
prevView.SetHeight(newUpperTrackHeight);
view.SetExpandedHeight(newTrackHeight);
prevView.SetExpandedHeight(newUpperTrackHeight);
};
auto doResizeBetween = [&] (Track *next, bool WXUNUSED(vStereo)) {
@ -194,15 +194,15 @@ UIHandle::Result TrackPanelResizeHandle::Drag
mInitialUpperTrackHeight + mInitialTrackHeight - view.GetMinimizedHeight();
}
view.SetHeight(newUpperTrackHeight);
nextView.SetHeight(newTrackHeight);
view.SetExpandedHeight(newUpperTrackHeight);
nextView.SetExpandedHeight(newTrackHeight);
};
auto doResize = [&] {
int newTrackHeight = mInitialTrackHeight + delta;
if (newTrackHeight < view.GetMinimizedHeight())
newTrackHeight = view.GetMinimizedHeight();
view.SetHeight(newTrackHeight);
view.SetExpandedHeight(newTrackHeight);
};
//STM: We may be dragging one or two (stereo) tracks.
@ -268,7 +268,7 @@ UIHandle::Result TrackPanelResizeHandle::Cancel(AudacityProject *pProject)
case IsResizing:
{
auto &view = TrackView::Get( *pTrack );
view.SetHeight(mInitialActualHeight);
view.SetExpandedHeight(mInitialExpandedHeight);
view.SetMinimized( mInitialMinimized );
}
break;
@ -277,9 +277,9 @@ UIHandle::Result TrackPanelResizeHandle::Cancel(AudacityProject *pProject)
Track *const next = * ++ tracks.Find(pTrack.get());
auto
&view = TrackView::Get( *pTrack ), &nextView = TrackView::Get( *next );
view.SetHeight(mInitialUpperActualHeight);
view.SetExpandedHeight(mInitialUpperExpandedHeight);
view.SetMinimized( mInitialMinimized );
nextView.SetHeight(mInitialActualHeight);
nextView.SetExpandedHeight(mInitialExpandedHeight);
nextView.SetMinimized( mInitialMinimized );
}
break;
@ -288,9 +288,9 @@ UIHandle::Result TrackPanelResizeHandle::Cancel(AudacityProject *pProject)
Track *const prev = * -- tracks.Find(pTrack.get());
auto
&view = TrackView::Get( *pTrack ), &prevView = TrackView::Get( *prev );
view.SetHeight(mInitialActualHeight);
view.SetExpandedHeight(mInitialExpandedHeight);
view.SetMinimized( mInitialMinimized );
prevView.SetHeight(mInitialUpperActualHeight);
prevView.SetExpandedHeight(mInitialUpperExpandedHeight);
prevView.SetMinimized(mInitialMinimized);
}
break;

View File

@ -58,9 +58,9 @@ private:
bool mInitialMinimized{};
int mInitialTrackHeight{};
int mInitialActualHeight{};
int mInitialExpandedHeight{};
int mInitialUpperTrackHeight{};
int mInitialUpperActualHeight{};
int mInitialUpperExpandedHeight{};
int mMouseClickY{};
};

View File

@ -383,7 +383,7 @@ bool SetTrackVisualsCommand::ApplyInner(const CommandContext & context, Track *
wt->SetWaveColorIndex( mColour );
if( t && bHasHeight )
TrackView::Get( *t ).SetHeight( mHeight );
TrackView::Get( *t ).SetExpandedHeight( mHeight );
if( wt && bHasDisplayType ) {
auto &view = WaveTrackView::Get( *wt );

View File

@ -154,7 +154,7 @@ void DoZoomFitV(AudacityProject &project)
height = std::max( (int)TrackInfo::MinimumTrackHeight(), height );
for (auto t : range)
TrackView::Get( *t ).SetHeight(height);
TrackView::Get( *t ).SetExpandedHeight(height);
}
}

View File

@ -843,8 +843,8 @@ void WaveTrackMenuTable::OnMergeStereo(wxCommandEvent &)
view.SetMinimized(false);
partnerView.SetMinimized(false);
int AverageHeight = (view.GetHeight() + partnerView.GetHeight()) / 2;
view.SetHeight(AverageHeight);
partnerView.SetHeight(AverageHeight);
view.SetExpandedHeight(AverageHeight);
partnerView.SetExpandedHeight(AverageHeight);
view.SetMinimized(bBothMinimizedp);
partnerView.SetMinimized(bBothMinimizedp);
@ -879,7 +879,7 @@ void WaveTrackMenuTable::SplitStereo(bool stereo)
//make sure no channel is smaller than its minimum height
if (view.GetHeight() < view.GetMinimizedHeight())
view.SetHeight(view.GetMinimizedHeight());
view.SetExpandedHeight(view.GetMinimizedHeight());
totalHeight += view.GetHeight();
++nChannels;
}
@ -889,7 +889,7 @@ void WaveTrackMenuTable::SplitStereo(bool stereo)
for (auto channel : channels)
// Make tracks the same height
TrackView::Get( *channel ).SetHeight( averageHeight );
TrackView::Get( *channel ).SetExpandedHeight( averageHeight );
}
/// Swap the left and right channels of a stero track...

View File

@ -87,7 +87,7 @@ void TrackView::SetMinimized(bool isMinimized)
void TrackView::WriteXMLAttributes( XMLWriter &xmlFile ) const
{
xmlFile.WriteAttr(wxT("height"), GetActualHeight());
xmlFile.WriteAttr(wxT("height"), GetExpandedHeight());
xmlFile.WriteAttr(wxT("minimized"), GetMinimized());
}
@ -101,7 +101,7 @@ bool TrackView::HandleXMLAttribute( const wxChar *attr, const wxChar *value )
// will stall Audacity as it tries to create an enormous vertical ruler.
// So clamp to reasonable values.
nValue = std::max( 40l, std::min( nValue, 1000l ));
SetHeight(nValue);
SetExpandedHeight(nValue);
return true;
}
else if (!wxStrcmp(attr, wxT("minimized")) &&
@ -161,7 +161,7 @@ int TrackView::GetHeight() const
return mHeight;
}
void TrackView::SetHeight(int h)
void TrackView::SetExpandedHeight(int h)
{
DoSetHeight(h);
FindTrack()->AdjustPositions();

View File

@ -50,12 +50,20 @@ public:
void SetMinimized( bool minimized );
int GetY() const { return mY; }
int GetActualHeight() const { return mHeight; }
//! @return height of the track when expanded
int GetExpandedHeight() const { return mHeight; }
//! @return height of the track when collapsed
virtual int GetMinimizedHeight() const = 0;
int GetHeight() const;
void SetY(int y) { DoSetY( y ); }
void SetHeight(int height);
/*! Sets height for expanded state.
Does not expand a track if it is now collapsed.
*/
void SetExpandedHeight(int height);
// Return another, associated TrackPanelCell object that implements the
// mouse actions for the vertical ruler
@ -81,13 +89,15 @@ public:
virtual void DoSetMinimized( bool isMinimized );
protected:
private:
// No need yet to make this virtual
void DoSetY(int y);
void DoSetHeight(int h);
protected:
// Private factory to make appropriate object; class TrackView handles
// memory management thereafter
virtual std::shared_ptr<TrackVRulerControls> DoGetVRulerControls() = 0;