1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-29 23:29:41 +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.

(cherry picked from audacity commit fba2ef009ebff6c1c43101faca6d2cb07efb83df)

Signed-off-by: akleja <storspov@gmail.com>
This commit is contained in:
Paul Licameli 2021-08-07 13:32:39 -04:00 committed by akleja
parent cfc1bf35e7
commit 1f242372c9
5 changed files with 35 additions and 12 deletions

View File

@ -298,6 +298,7 @@ list( APPEND SOURCES PRIVATE
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"
@ -91,6 +92,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
@ -1366,7 +1369,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(),
@ -1375,7 +1378,7 @@ struct ChannelGroup final : TrackPanelGroup {
if ( channel != pLast ) {
yy += height;
refinement.emplace_back(
yy - kSeparatorThickness,
yy - kChannelSeparatorThickness,
TrackPanelResizerCell::Get( *channel ).shared_from_this() );
}
}
@ -1473,7 +1476,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"