mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-26 09:28:07 +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
|
"Margin" is a term used for inset plus border (top and left) or inset plus
|
||||||
shadow plus border (right and bottom).
|
shadow plus border (right and bottom).
|
||||||
|
|
||||||
TrackInfo::GetTrackInfoWidth() == GetVRulerOffset()
|
GetVRulerOffset() counts columns from the left edge up to and including
|
||||||
counts columns from the left edge up to and including controls, and is a
|
controls, and is a constant.
|
||||||
constant.
|
|
||||||
|
|
||||||
GetVRulerWidth() is variable -- all tracks have the same ruler width at any
|
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.
|
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
|
// Draw things within the track control panel
|
||||||
rect.width = kTrackInfoWidth - kLeftMargin;
|
rect.width = kTrackInfoWidth;
|
||||||
TrackInfo::DrawItems( context, rect, *t );
|
TrackInfo::DrawItems( context, rect, *t );
|
||||||
|
|
||||||
//mTrackInfo.DrawBordersWithin( dc, rect, *t );
|
//mTrackInfo.DrawBordersWithin( dc, rect, *t );
|
||||||
@ -2067,7 +2066,7 @@ struct LabeledChannelGroup final : TrackPanelGroup {
|
|||||||
Subdivision Children( const wxRect &rect ) override
|
Subdivision Children( const wxRect &rect ) override
|
||||||
{ return { Axis::X, Refinement{
|
{ return { Axis::X, Refinement{
|
||||||
{ rect.GetLeft(), mpTrack->GetTrackControl() },
|
{ rect.GetLeft(), mpTrack->GetTrackControl() },
|
||||||
{ kTrackInfoWidth,
|
{ rect.GetLeft() + kTrackInfoWidth,
|
||||||
std::make_shared< ChannelGroup >( mpTrack, mLeftOffset ) }
|
std::make_shared< ChannelGroup >( mpTrack, mLeftOffset ) }
|
||||||
} }; }
|
} }; }
|
||||||
std::shared_ptr< Track > mpTrack;
|
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 )
|
void TrackInfo::GetCloseBoxHorizontalBounds( const wxRect & rect, wxRect &dest )
|
||||||
{
|
{
|
||||||
dest.x = rect.x;
|
dest.x = rect.x;
|
||||||
@ -2670,7 +2664,10 @@ void TrackInfo::UpdatePrefs( wxWindow *pParent )
|
|||||||
int fontSize = 10;
|
int fontSize = 10;
|
||||||
gFont.Create(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
|
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;
|
int textWidth, textHeight;
|
||||||
do {
|
do {
|
||||||
gFont.SetPointSize(fontSize);
|
gFont.SetPointSize(fontSize);
|
||||||
|
@ -143,7 +143,6 @@ namespace TrackInfo
|
|||||||
( TrackPanelDrawingContext &context,
|
( TrackPanelDrawingContext &context,
|
||||||
const wxRect &rect, const Track *pTrack );
|
const wxRect &rect, const Track *pTrack );
|
||||||
|
|
||||||
int GetTrackInfoWidth();
|
|
||||||
void SetTrackInfoFont(wxDC *dc);
|
void SetTrackInfoFont(wxDC *dc);
|
||||||
|
|
||||||
|
|
||||||
@ -216,6 +215,37 @@ namespace TrackInfo
|
|||||||
const int DragThreshold = 3;// Anything over 3 pixels is a drag, else a click.
|
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 {
|
class AUDACITY_DLL_API TrackPanel final : public CellularPanel {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -322,11 +352,11 @@ protected:
|
|||||||
std::shared_ptr<TrackPanelNode> Root() override;
|
std::shared_ptr<TrackPanelNode> Root() override;
|
||||||
|
|
||||||
int GetVRulerWidth() const;
|
int GetVRulerWidth() const;
|
||||||
int GetVRulerOffset() const { return TrackInfo::GetTrackInfoWidth(); }
|
int GetVRulerOffset() const { return kTrackInfoWidth + kLeftMargin; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int GetLabelWidth() const
|
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
|
// 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.
|
// They work around some messy problems with constructors.
|
||||||
@ -476,34 +506,4 @@ struct IsVisibleTrack
|
|||||||
wxRect mPanelRect;
|
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
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user