1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-19 09:01:15 +02:00

Move some numbers out of ViewInfo.h ...

... Move them to new header TrackPanelConstants.h, to be used only by TrackPanel
and some closely cooperating classes, but not known to the track view, controls,
vertical ruler, or affordance classes.

Also distinguish track from channel separator thickness though these remain
equal.
This commit is contained in:
Paul Licameli
2021-08-07 13:32:39 -04:00
parent 1a9b4d16e7
commit fba2ef009e
5 changed files with 36 additions and 13 deletions

View File

@@ -276,6 +276,7 @@ list( APPEND SOURCES
TrackPanelAx.h
TrackPanelCell.cpp
TrackPanelCell.h
TrackPanelConstants.h
TrackPanelDrawable.cpp
TrackPanelDrawable.h
TrackPanelDrawingContext.h

View File

@@ -45,6 +45,7 @@ is time to refresh some aspect of the screen.
#include "TrackPanel.h"
#include "TrackPanelConstants.h"
#include <wx/app.h>
#include <wx/setup.h> // for wxUSE_* macros
@@ -90,6 +91,8 @@ is time to refresh some aspect of the screen.
#include <wx/dcclient.h>
#include <wx/graphics.h>
static_assert( kVerticalPadding == kTopMargin + kBottomMargin );
/**
\class TrackPanel
@@ -1363,7 +1366,7 @@ struct ChannelGroup final : TrackPanelGroup {
auto height = view.GetHeight();
rect.SetTop( yy );
rect.SetHeight( height - kSeparatorThickness );
rect.SetHeight( height - kChannelSeparatorThickness );
refinement.emplace_back( yy,
std::make_shared< VRulersAndChannels >(
channel->shared_from_this(),
@@ -1372,7 +1375,7 @@ struct ChannelGroup final : TrackPanelGroup {
if ( channel != pLast ) {
yy += height;
refinement.emplace_back(
yy - kSeparatorThickness,
yy - kChannelSeparatorThickness,
TrackPanelResizerCell::Get( *channel ).shared_from_this() );
}
}
@@ -1400,7 +1403,7 @@ struct ChannelGroup final : TrackPanelGroup {
mLeftOffset,
yy,
rect.GetRight() - mLeftOffset,
height - kSeparatorThickness);
height - kChannelSeparatorThickness);
TrackArt::DrawCursor(context, trackRect, mpTrack.get());
yy += height;
}
@@ -1520,7 +1523,7 @@ struct ResizingChannelGroup final : TrackPanelGroup {
{ return { Axis::Y, Refinement{
{ rect.GetTop(),
std::make_shared< LabeledChannelGroup >( mpTrack, mLeftOffset ) },
{ rect.GetTop() + rect.GetHeight() - kSeparatorThickness,
{ rect.GetTop() + rect.GetHeight() - kTrackSeparatorThickness,
TrackPanelResizerCell::Get(
**TrackList::Channels( mpTrack.get() ).rbegin() ).shared_from_this()
}

27
src/TrackPanelConstants.h Normal file
View File

@@ -0,0 +1,27 @@
/*!********************************************************************
Audacity: A Digital Audio Editor
TrackPanelConstants.h
Paul Licameli split from ViewInfo.h
**********************************************************************/
#ifndef __AUDACITY_TRACK_PANEL_CONSTANTS__
#define __AUDACITY_TRACK_PANEL_CONSTANTS__
#include "ZoomInfo.h"
// See big pictorial comment in TrackPanel.cpp for explanation of these numbers
//! constants related to y coordinates in the track panel
enum : int {
kAffordancesAreaHeight = 20,
kTopInset = 4,
kTopMargin = kTopInset + kBorderThickness,
kBottomMargin = kShadowThickness + kBorderThickness,
kTrackSeparatorThickness = kBottomMargin + kTopMargin,
kChannelSeparatorThickness = kTrackSeparatorThickness,
};
#endif

View File

@@ -98,19 +98,10 @@ private:
SelectedRegion mRegion;
};
// See big pictorial comment in TrackPanel.cpp for explanation of these numbers
//! constants related to y coordinates in the track panel
enum : int {
kVerticalPadding = 7, /*!< Width of padding below each channel group */
kAffordancesAreaHeight = 20,
kTopInset = 4,
kTopMargin = kTopInset + kBorderThickness,
kBottomMargin = kShadowThickness + kBorderThickness,
kSeparatorThickness = kBottomMargin + kTopMargin,
};
static_assert( kVerticalPadding == kTopMargin + kBottomMargin );
enum : int {
kTrackInfoBtnSize = 18, // widely used dimension, usually height
kTrackInfoSliderHeight = 25,

View File

@@ -19,6 +19,7 @@ Paul Licameli split from TrackPanel.cpp
#include "../../Track.h"
#include "../../TrackArtist.h"
#include "../../TrackPanel.h"
#include "../../TrackPanelConstants.h"
#include "../../TrackPanelDrawingContext.h"
#include "../../TrackPanelMouseEvent.h"
#include "../../UIHandle.h"