mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-19 17:40:15 +02:00
kTrackInfoWidth was misleadingly named...
... keep the name, but change the value to be what it really says: the proper width of the track control panel, agreeing with the hit-test area, NOT including the left margin And change places where the constant was used, adding the margin back again.
This commit is contained in:
parent
4c76e598d5
commit
c4994ae9c2
@ -111,9 +111,8 @@ left channel, are used for the channel separator.
|
||||
"Margin" is a term used for inset plus border (top and left) or inset plus
|
||||
shadow plus border (right and bottom).
|
||||
|
||||
TrackInfo::GetTrackInfoWidth() == GetVRulerOffset()
|
||||
counts columns from the left edge up to and including controls, and is a
|
||||
constant.
|
||||
GetVRulerOffset() counts columns from the left edge up to and including
|
||||
controls, and is a constant.
|
||||
|
||||
GetVRulerWidth() is variable -- all tracks have the same ruler width at any
|
||||
time, but that width may be adjusted when tracks change their vertical scales.
|
||||
@ -1664,7 +1663,7 @@ void TrackPanel::DrawOutside
|
||||
}
|
||||
|
||||
// Draw things within the track control panel
|
||||
rect.width = kTrackInfoWidth - kLeftMargin;
|
||||
rect.width = kTrackInfoWidth;
|
||||
TrackInfo::DrawItems( context, rect, *t );
|
||||
|
||||
//mTrackInfo.DrawBordersWithin( dc, rect, *t );
|
||||
@ -2067,7 +2066,7 @@ struct LabeledChannelGroup final : TrackPanelGroup {
|
||||
Subdivision Children( const wxRect &rect ) override
|
||||
{ return { Axis::X, Refinement{
|
||||
{ rect.GetLeft(), mpTrack->GetTrackControl() },
|
||||
{ kTrackInfoWidth,
|
||||
{ rect.GetLeft() + kTrackInfoWidth,
|
||||
std::make_shared< ChannelGroup >( mpTrack, mLeftOffset ) }
|
||||
} }; }
|
||||
std::shared_ptr< Track > mpTrack;
|
||||
@ -2313,11 +2312,6 @@ void TrackInfo::ReCreateSliders( wxWindow *pParent ){
|
||||
|
||||
}
|
||||
|
||||
int TrackInfo::GetTrackInfoWidth()
|
||||
{
|
||||
return kTrackInfoWidth;
|
||||
}
|
||||
|
||||
void TrackInfo::GetCloseBoxHorizontalBounds( const wxRect & rect, wxRect &dest )
|
||||
{
|
||||
dest.x = rect.x;
|
||||
@ -2670,7 +2664,10 @@ void TrackInfo::UpdatePrefs( wxWindow *pParent )
|
||||
int fontSize = 10;
|
||||
gFont.Create(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
|
||||
|
||||
int allowableWidth = GetTrackInfoWidth() - 2; // 2 to allow for left/right borders
|
||||
int allowableWidth =
|
||||
// PRL: was it correct to include the margin?
|
||||
( kTrackInfoWidth + kLeftMargin )
|
||||
- 2; // 2 to allow for left/right borders
|
||||
int textWidth, textHeight;
|
||||
do {
|
||||
gFont.SetPointSize(fontSize);
|
||||
|
@ -143,7 +143,6 @@ namespace TrackInfo
|
||||
( TrackPanelDrawingContext &context,
|
||||
const wxRect &rect, const Track *pTrack );
|
||||
|
||||
int GetTrackInfoWidth();
|
||||
void SetTrackInfoFont(wxDC *dc);
|
||||
|
||||
|
||||
@ -216,6 +215,37 @@ namespace TrackInfo
|
||||
const int DragThreshold = 3;// Anything over 3 pixels is a drag, else a click.
|
||||
|
||||
|
||||
// See big pictorial comment in TrackPanel for explanation of these numbers
|
||||
enum : int {
|
||||
kLeftInset = 4,
|
||||
kRightInset = kLeftInset,
|
||||
kTopInset = 4,
|
||||
kShadowThickness = 1,
|
||||
kBorderThickness = 1,
|
||||
kTopMargin = kTopInset + kBorderThickness,
|
||||
kBottomMargin = kShadowThickness + kBorderThickness,
|
||||
kLeftMargin = kLeftInset + kBorderThickness,
|
||||
kRightMargin = kRightInset + kShadowThickness + kBorderThickness,
|
||||
kSeparatorThickness = kBottomMargin + kTopMargin,
|
||||
};
|
||||
|
||||
enum : int {
|
||||
kTrackInfoWidth = 100 - kLeftMargin,
|
||||
kTrackInfoBtnSize = 18, // widely used dimension, usually height
|
||||
kTrackInfoSliderHeight = 25,
|
||||
kTrackInfoSliderWidth = 84,
|
||||
kTrackInfoSliderAllowance = 5,
|
||||
kTrackInfoSliderExtra = 5,
|
||||
};
|
||||
|
||||
#ifdef USE_MIDI
|
||||
enum : int {
|
||||
// PRL: was it correct to include the margin?
|
||||
kMidiCellWidth = ( ( kTrackInfoWidth + kLeftMargin ) / 4) - 2,
|
||||
kMidiCellHeight = kTrackInfoBtnSize
|
||||
};
|
||||
#endif
|
||||
|
||||
class AUDACITY_DLL_API TrackPanel final : public CellularPanel {
|
||||
|
||||
public:
|
||||
@ -322,11 +352,11 @@ protected:
|
||||
std::shared_ptr<TrackPanelNode> Root() override;
|
||||
|
||||
int GetVRulerWidth() const;
|
||||
int GetVRulerOffset() const { return TrackInfo::GetTrackInfoWidth(); }
|
||||
int GetVRulerOffset() const { return kTrackInfoWidth + kLeftMargin; }
|
||||
|
||||
public:
|
||||
int GetLabelWidth() const
|
||||
{ return TrackInfo::GetTrackInfoWidth() + GetVRulerWidth(); }
|
||||
{ return GetVRulerOffset() + GetVRulerWidth(); }
|
||||
|
||||
// JKC Nov-2011: These four functions only used from within a dll such as mod-track-panel
|
||||
// They work around some messy problems with constructors.
|
||||
@ -476,34 +506,4 @@ struct IsVisibleTrack
|
||||
wxRect mPanelRect;
|
||||
};
|
||||
|
||||
// See big pictorial comment in TrackPanel for explanation of these numbers
|
||||
enum : int {
|
||||
kLeftInset = 4,
|
||||
kRightInset = kLeftInset,
|
||||
kTopInset = 4,
|
||||
kShadowThickness = 1,
|
||||
kBorderThickness = 1,
|
||||
kTopMargin = kTopInset + kBorderThickness,
|
||||
kBottomMargin = kShadowThickness + kBorderThickness,
|
||||
kLeftMargin = kLeftInset + kBorderThickness,
|
||||
kRightMargin = kRightInset + kShadowThickness + kBorderThickness,
|
||||
kSeparatorThickness = kBottomMargin + kTopMargin,
|
||||
};
|
||||
|
||||
enum : int {
|
||||
kTrackInfoWidth = 100,
|
||||
kTrackInfoBtnSize = 18, // widely used dimension, usually height
|
||||
kTrackInfoSliderHeight = 25,
|
||||
kTrackInfoSliderWidth = 84,
|
||||
kTrackInfoSliderAllowance = 5,
|
||||
kTrackInfoSliderExtra = 5,
|
||||
};
|
||||
|
||||
#ifdef USE_MIDI
|
||||
enum : int {
|
||||
kMidiCellWidth = (kTrackInfoWidth / 4) - 2,
|
||||
kMidiCellHeight = kTrackInfoBtnSize
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user