mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-22 07:10:06 +02:00
Move drawing code specific to Wave or to Note track controls...
... making cycles of some TrackControls subclasses with their handles, which perhaps means those files should be fused, but that's for later
This commit is contained in:
parent
52844d9200
commit
627213cb74
@ -81,71 +81,8 @@ const TCPLines &CommonTrackControls::StaticTCPLines()
|
|||||||
return commonTrackTCPLines();
|
return commonTrackTCPLines();
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "tracks/playabletrack/wavetrack/ui/WaveTrackControls.h"
|
|
||||||
#include "tracks/playabletrack/notetrack/ui/NoteTrackControls.h"
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
static const struct WaveTrackTCPLines : TCPLines { WaveTrackTCPLines() {
|
|
||||||
(TCPLines&)*this = CommonTrackControls::StaticTCPLines();
|
|
||||||
insert( end(), {
|
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_DA
|
|
||||||
// DA: Has Mute and Solo on separate lines.
|
|
||||||
{ TCPLine::kItemMute, kTrackInfoBtnSize + 1, 1,
|
|
||||||
&TrackInfo::WideMuteDrawFunction },
|
|
||||||
{ TCPLine::kItemSolo, kTrackInfoBtnSize + 1, 2,
|
|
||||||
&TrackInfo::WideSoloDrawFunction },
|
|
||||||
#else
|
|
||||||
{ TCPLine::kItemMute | TCPLine::kItemSolo, kTrackInfoBtnSize + 1, 2,
|
|
||||||
&TrackInfo::MuteAndSoloDrawFunction },
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{ TCPLine::kItemGain, kTrackInfoSliderHeight, kTrackInfoSliderExtra,
|
|
||||||
&TrackInfo::GainSliderDrawFunction },
|
|
||||||
{ TCPLine::kItemPan, kTrackInfoSliderHeight, kTrackInfoSliderExtra,
|
|
||||||
&TrackInfo::PanSliderDrawFunction },
|
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_DA
|
|
||||||
// DA: Does not have status information for a track.
|
|
||||||
#else
|
|
||||||
{ TCPLine::kItemStatusInfo1, 12, 0,
|
|
||||||
&TrackInfo::Status1DrawFunction },
|
|
||||||
{ TCPLine::kItemStatusInfo2, 12, 0,
|
|
||||||
&TrackInfo::Status2DrawFunction },
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} );
|
|
||||||
} } waveTrackTCPLines;
|
|
||||||
|
|
||||||
#ifdef USE_MIDI
|
|
||||||
enum : int {
|
|
||||||
// PRL: was it correct to include the margin?
|
|
||||||
kMidiCellWidth = ( ( kTrackInfoWidth + kLeftMargin ) / 4) - 2,
|
|
||||||
kMidiCellHeight = kTrackInfoBtnSize
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const struct NoteTrackTCPLines : TCPLines { NoteTrackTCPLines() {
|
|
||||||
(TCPLines&)*this = CommonTrackControls::StaticTCPLines();
|
|
||||||
insert( end(), {
|
|
||||||
#ifdef EXPERIMENTAL_DA
|
|
||||||
// DA: Has Mute and Solo on separate lines.
|
|
||||||
{ TCPLine::kItemMute, kTrackInfoBtnSize + 1, 1,
|
|
||||||
&TrackInfo::WideMuteDrawFunction },
|
|
||||||
{ TCPLine::kItemSolo, kTrackInfoBtnSize + 1, 0,
|
|
||||||
&TrackInfo::WideSoloDrawFunction },
|
|
||||||
#else
|
|
||||||
{ TCPLine::kItemMute | TCPLine::kItemSolo, kTrackInfoBtnSize + 1, 0,
|
|
||||||
&TrackInfo::MuteAndSoloDrawFunction },
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{ TCPLine::kItemMidiControlsRect, kMidiCellHeight * 4, 0,
|
|
||||||
&TrackInfo::MidiControlsDrawFunction },
|
|
||||||
{ TCPLine::kItemVelocity, kTrackInfoSliderHeight, kTrackInfoSliderExtra,
|
|
||||||
&TrackInfo::VelocitySliderDrawFunction },
|
|
||||||
} );
|
|
||||||
} } noteTrackTCPLines;
|
|
||||||
|
|
||||||
int totalTCPLines( const TCPLines &lines, bool omitLastExtra )
|
int totalTCPLines( const TCPLines &lines, bool omitLastExtra )
|
||||||
{
|
{
|
||||||
int total = 0;
|
int total = 0;
|
||||||
@ -212,16 +149,6 @@ const TCPLines &CommonTrackControls::GetTCPLines() const
|
|||||||
return commonTrackTCPLines();
|
return commonTrackTCPLines();
|
||||||
}
|
}
|
||||||
|
|
||||||
const TCPLines &NoteTrackControls::GetTCPLines() const
|
|
||||||
{
|
|
||||||
return noteTrackTCPLines;
|
|
||||||
};
|
|
||||||
|
|
||||||
const TCPLines &WaveTrackControls::GetTCPLines() const
|
|
||||||
{
|
|
||||||
return waveTrackTCPLines;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned TrackInfo::MinimumTrackHeight()
|
unsigned TrackInfo::MinimumTrackHeight()
|
||||||
{
|
{
|
||||||
unsigned height = 0;
|
unsigned height = 0;
|
||||||
@ -475,78 +402,6 @@ void TrackInfo::MinimizeSyncLockDrawFunction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "tracks/playabletrack/notetrack/ui/NoteTrackButtonHandle.h"
|
|
||||||
void TrackInfo::MidiControlsDrawFunction
|
|
||||||
( TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect, const Track *pTrack )
|
|
||||||
{
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
|
||||||
auto target = dynamic_cast<NoteTrackButtonHandle*>( context.target.get() );
|
|
||||||
bool hit = target && target->GetTrack().get() == pTrack;
|
|
||||||
auto channel = hit ? target->GetChannel() : -1;
|
|
||||||
auto &dc = context.dc;
|
|
||||||
wxRect midiRect = rect;
|
|
||||||
GetMidiControlsHorizontalBounds(rect, midiRect);
|
|
||||||
NoteTrack::DrawLabelControls
|
|
||||||
( static_cast<const NoteTrack *>(pTrack), dc, midiRect, channel );
|
|
||||||
#endif // EXPERIMENTAL_MIDI_OUT
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename TrackClass>
|
|
||||||
void TrackInfo::SliderDrawFunction
|
|
||||||
( LWSlider *(*Selector)
|
|
||||||
(const wxRect &sliderRect, const TrackClass *t, bool captured, wxWindow*),
|
|
||||||
wxDC *dc, const wxRect &rect, const Track *pTrack,
|
|
||||||
bool captured, bool highlight )
|
|
||||||
{
|
|
||||||
wxRect sliderRect = rect;
|
|
||||||
TrackInfo::GetSliderHorizontalBounds( rect.GetTopLeft(), sliderRect );
|
|
||||||
auto wt = static_cast<const TrackClass*>( pTrack );
|
|
||||||
Selector( sliderRect, wt, captured, nullptr )->OnPaint(*dc, highlight);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "tracks/playabletrack/wavetrack/ui/WaveTrackSliderHandles.h"
|
|
||||||
void TrackInfo::PanSliderDrawFunction
|
|
||||||
( TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect, const Track *pTrack )
|
|
||||||
{
|
|
||||||
auto target = dynamic_cast<PanSliderHandle*>( context.target.get() );
|
|
||||||
auto dc = &context.dc;
|
|
||||||
bool hit = target && target->GetTrack().get() == pTrack;
|
|
||||||
bool captured = hit && target->IsClicked();
|
|
||||||
SliderDrawFunction<WaveTrack>
|
|
||||||
( &TrackInfo::PanSlider, dc, rect, pTrack, captured, hit);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrackInfo::GainSliderDrawFunction
|
|
||||||
( TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect, const Track *pTrack )
|
|
||||||
{
|
|
||||||
auto target = dynamic_cast<GainSliderHandle*>( context.target.get() );
|
|
||||||
auto dc = &context.dc;
|
|
||||||
bool hit = target && target->GetTrack().get() == pTrack;
|
|
||||||
if( hit )
|
|
||||||
hit=hit;
|
|
||||||
bool captured = hit && target->IsClicked();
|
|
||||||
SliderDrawFunction<WaveTrack>
|
|
||||||
( &TrackInfo::GainSlider, dc, rect, pTrack, captured, hit);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
|
||||||
#include "tracks/playabletrack/notetrack/ui/NoteTrackSliderHandles.h"
|
|
||||||
void TrackInfo::VelocitySliderDrawFunction
|
|
||||||
( TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect, const Track *pTrack )
|
|
||||||
{
|
|
||||||
auto dc = &context.dc;
|
|
||||||
auto target = dynamic_cast<VelocitySliderHandle*>( context.target.get() );
|
|
||||||
bool hit = target && target->GetTrack().get() == pTrack;
|
|
||||||
bool captured = hit && target->IsClicked();
|
|
||||||
SliderDrawFunction<NoteTrack>
|
|
||||||
( &TrackInfo::VelocitySlider, dc, rect, pTrack, captured, hit);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void TrackInfo::MuteOrSoloDrawFunction
|
void TrackInfo::MuteOrSoloDrawFunction
|
||||||
( wxDC *dc, const wxRect &bev, const Track *pTrack, bool down,
|
( wxDC *dc, const wxRect &bev, const Track *pTrack, bool down,
|
||||||
bool WXUNUSED(captured),
|
bool WXUNUSED(captured),
|
||||||
@ -660,53 +515,6 @@ void TrackInfo::MuteAndSoloDrawFunction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackInfo::StatusDrawFunction
|
|
||||||
( const wxString &string, wxDC *dc, const wxRect &rect )
|
|
||||||
{
|
|
||||||
static const int offset = 3;
|
|
||||||
dc->DrawText(string, rect.x + offset, rect.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrackInfo::Status1DrawFunction
|
|
||||||
( TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect, const Track *pTrack )
|
|
||||||
{
|
|
||||||
auto dc = &context.dc;
|
|
||||||
auto wt = static_cast<const WaveTrack*>(pTrack);
|
|
||||||
|
|
||||||
/// Returns the string to be displayed in the track label
|
|
||||||
/// indicating whether the track is mono, left, right, or
|
|
||||||
/// stereo and what sample rate it's using.
|
|
||||||
auto rate = wt ? wt->GetRate() : 44100.0;
|
|
||||||
wxString s;
|
|
||||||
if (!pTrack || TrackList::Channels(pTrack).size() > 1)
|
|
||||||
// TODO: more-than-two-channels-message
|
|
||||||
// more appropriate strings
|
|
||||||
s = _("Stereo, %dHz");
|
|
||||||
else {
|
|
||||||
if (wt->GetChannel() == Track::MonoChannel)
|
|
||||||
s = _("Mono, %dHz");
|
|
||||||
else if (wt->GetChannel() == Track::LeftChannel)
|
|
||||||
s = _("Left, %dHz");
|
|
||||||
else if (wt->GetChannel() == Track::RightChannel)
|
|
||||||
s = _("Right, %dHz");
|
|
||||||
}
|
|
||||||
s = wxString::Format( s, (int) (rate + 0.5) );
|
|
||||||
|
|
||||||
StatusDrawFunction( s, dc, rect );
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrackInfo::Status2DrawFunction
|
|
||||||
( TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect, const Track *pTrack )
|
|
||||||
{
|
|
||||||
auto dc = &context.dc;
|
|
||||||
auto wt = static_cast<const WaveTrack*>(pTrack);
|
|
||||||
auto format = wt ? wt->GetSampleFormat() : floatSample;
|
|
||||||
auto s = GetSampleFormatStr(format);
|
|
||||||
StatusDrawFunction( s, dc, rect );
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
wxFont gFont;
|
wxFont gFont;
|
||||||
@ -724,10 +532,12 @@ std::unique_ptr<LWSlider>
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "tracks/playabletrack/notetrack/ui/NoteTrackControls.h"
|
||||||
|
#include "tracks/playabletrack/wavetrack/ui/WaveTrackControls.h"
|
||||||
void TrackInfo::ReCreateSliders(){
|
void TrackInfo::ReCreateSliders(){
|
||||||
const wxPoint point{ 0, 0 };
|
const wxPoint point{ 0, 0 };
|
||||||
wxRect sliderRect;
|
wxRect sliderRect;
|
||||||
GetGainRect(point, sliderRect);
|
WaveTrackControls::GetGainRect(point, sliderRect);
|
||||||
|
|
||||||
float defPos = 1.0;
|
float defPos = 1.0;
|
||||||
/* i18n-hint: Title of the Gain slider, used to adjust the volume */
|
/* i18n-hint: Title of the Gain slider, used to adjust the volume */
|
||||||
@ -743,7 +553,7 @@ void TrackInfo::ReCreateSliders(){
|
|||||||
DB_SLIDER);
|
DB_SLIDER);
|
||||||
gGainCaptured->SetDefaultValue(defPos);
|
gGainCaptured->SetDefaultValue(defPos);
|
||||||
|
|
||||||
GetPanRect(point, sliderRect);
|
WaveTrackControls::GetPanRect(point, sliderRect);
|
||||||
|
|
||||||
defPos = 0.0;
|
defPos = 0.0;
|
||||||
/* i18n-hint: Title of the Pan slider, used to move the sound left or right */
|
/* i18n-hint: Title of the Pan slider, used to move the sound left or right */
|
||||||
@ -760,7 +570,7 @@ void TrackInfo::ReCreateSliders(){
|
|||||||
gPanCaptured->SetDefaultValue(defPos);
|
gPanCaptured->SetDefaultValue(defPos);
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
GetVelocityRect(point, sliderRect);
|
NoteTrackControls::GetVelocityRect(point, sliderRect);
|
||||||
|
|
||||||
/* i18n-hint: Title of the Velocity slider, used to adjust the volume of note tracks */
|
/* i18n-hint: Title of the Velocity slider, used to adjust the volume of note tracks */
|
||||||
gVelocity = std::make_unique<LWSlider>(nullptr, _("Velocity"),
|
gVelocity = std::make_unique<LWSlider>(nullptr, _("Velocity"),
|
||||||
@ -871,31 +681,6 @@ void TrackInfo::GetSliderHorizontalBounds( const wxPoint &topleft, wxRect &dest
|
|||||||
dest.width = kTrackInfoSliderWidth;
|
dest.width = kTrackInfoSliderWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackInfo::GetGainRect(const wxPoint &topleft, wxRect & dest)
|
|
||||||
{
|
|
||||||
GetSliderHorizontalBounds( topleft, dest );
|
|
||||||
auto results = CalcItemY( waveTrackTCPLines, TCPLine::kItemGain );
|
|
||||||
dest.y = topleft.y + results.first;
|
|
||||||
dest.height = results.second;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrackInfo::GetPanRect(const wxPoint &topleft, wxRect & dest)
|
|
||||||
{
|
|
||||||
GetGainRect( topleft, dest );
|
|
||||||
auto results = CalcItemY( waveTrackTCPLines, TCPLine::kItemPan );
|
|
||||||
dest.y = topleft.y + results.first;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
|
||||||
void TrackInfo::GetVelocityRect(const wxPoint &topleft, wxRect & dest)
|
|
||||||
{
|
|
||||||
GetSliderHorizontalBounds( topleft, dest );
|
|
||||||
auto results = CalcItemY( noteTrackTCPLines, TCPLine::kItemVelocity );
|
|
||||||
dest.y = topleft.y + results.first;
|
|
||||||
dest.height = results.second;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void TrackInfo::GetMinimizeHorizontalBounds( const wxRect &rect, wxRect &dest )
|
void TrackInfo::GetMinimizeHorizontalBounds( const wxRect &rect, wxRect &dest )
|
||||||
{
|
{
|
||||||
const int space = 0;// was 3.
|
const int space = 0;// was 3.
|
||||||
@ -960,27 +745,6 @@ void TrackInfo::GetSyncLockIconRect(const wxRect & rect, wxRect &dest)
|
|||||||
dest.height = results.second;
|
dest.height = results.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_MIDI
|
|
||||||
void TrackInfo::GetMidiControlsHorizontalBounds
|
|
||||||
( const wxRect &rect, wxRect &dest )
|
|
||||||
{
|
|
||||||
dest.x = rect.x + 1; // To center slightly
|
|
||||||
// PRL: TODO: kMidiCellWidth is defined in terms of the other constant
|
|
||||||
// kTrackInfoWidth but I am trying to avoid use of that constant.
|
|
||||||
// Can cell width be computed from dest.width instead?
|
|
||||||
dest.width = kMidiCellWidth * 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrackInfo::GetMidiControlsRect(const wxRect & rect, wxRect & dest)
|
|
||||||
{
|
|
||||||
GetMidiControlsHorizontalBounds( rect, dest );
|
|
||||||
auto results = CalcItemY( noteTrackTCPLines, TCPLine::kItemMidiControlsRect );
|
|
||||||
dest.y = rect.y + results.first;
|
|
||||||
dest.height = results.second;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// \todo Probably should move to 'Utils.cpp'.
|
/// \todo Probably should move to 'Utils.cpp'.
|
||||||
void TrackInfo::SetTrackInfoFont(wxDC * dc)
|
void TrackInfo::SetTrackInfoFont(wxDC * dc)
|
||||||
{
|
{
|
||||||
@ -1088,16 +852,6 @@ unsigned TrackInfo::DefaultTrackHeight( const TCPLines &topLines )
|
|||||||
return (unsigned) std::max( needed, (int) TrackView::DefaultHeight );
|
return (unsigned) std::max( needed, (int) TrackView::DefaultHeight );
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned TrackInfo::DefaultNoteTrackHeight()
|
|
||||||
{
|
|
||||||
return DefaultTrackHeight( noteTrackTCPLines );
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned TrackInfo::DefaultWaveTrackHeight()
|
|
||||||
{
|
|
||||||
return DefaultTrackHeight( waveTrackTCPLines );
|
|
||||||
}
|
|
||||||
|
|
||||||
LWSlider * TrackInfo::GainSlider
|
LWSlider * TrackInfo::GainSlider
|
||||||
(const wxRect &sliderRect, const WaveTrack *t, bool captured, wxWindow *pParent)
|
(const wxRect &sliderRect, const WaveTrack *t, bool captured, wxWindow *pParent)
|
||||||
{
|
{
|
||||||
|
@ -89,32 +89,6 @@ namespace TrackInfo
|
|||||||
( TrackPanelDrawingContext &context,
|
( TrackPanelDrawingContext &context,
|
||||||
const wxRect &rect, const Track *pTrack );
|
const wxRect &rect, const Track *pTrack );
|
||||||
|
|
||||||
void MidiControlsDrawFunction
|
|
||||||
( TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect, const Track *pTrack );
|
|
||||||
|
|
||||||
template<typename TrackClass>
|
|
||||||
void SliderDrawFunction
|
|
||||||
( LWSlider *(*Selector)
|
|
||||||
(const wxRect &sliderRect, const TrackClass *t, bool captured,
|
|
||||||
wxWindow*),
|
|
||||||
wxDC *dc, const wxRect &rect, const Track *pTrack,
|
|
||||||
bool captured, bool highlight );
|
|
||||||
|
|
||||||
void PanSliderDrawFunction
|
|
||||||
( TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect, const Track *pTrack );
|
|
||||||
|
|
||||||
void GainSliderDrawFunction
|
|
||||||
( TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect, const Track *pTrack );
|
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
|
||||||
void VelocitySliderDrawFunction
|
|
||||||
( TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect, const Track *pTrack );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void MuteOrSoloDrawFunction
|
void MuteOrSoloDrawFunction
|
||||||
( wxDC *dc, const wxRect &rect, const Track *pTrack, bool down,
|
( wxDC *dc, const wxRect &rect, const Track *pTrack, bool down,
|
||||||
bool captured, bool solo, bool hit );
|
bool captured, bool solo, bool hit );
|
||||||
@ -131,17 +105,6 @@ namespace TrackInfo
|
|||||||
( TrackPanelDrawingContext &context,
|
( TrackPanelDrawingContext &context,
|
||||||
const wxRect &rect, const Track *pTrack );
|
const wxRect &rect, const Track *pTrack );
|
||||||
|
|
||||||
void StatusDrawFunction
|
|
||||||
( const wxString &string, wxDC *dc, const wxRect &rect );
|
|
||||||
|
|
||||||
void Status1DrawFunction
|
|
||||||
( TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect, const Track *pTrack );
|
|
||||||
|
|
||||||
void Status2DrawFunction
|
|
||||||
( TrackPanelDrawingContext &context,
|
|
||||||
const wxRect &rect, const Track *pTrack );
|
|
||||||
|
|
||||||
void SetTrackInfoFont(wxDC *dc);
|
void SetTrackInfoFont(wxDC *dc);
|
||||||
|
|
||||||
|
|
||||||
@ -168,14 +131,6 @@ namespace TrackInfo
|
|||||||
|
|
||||||
void GetSliderHorizontalBounds( const wxPoint &topleft, wxRect &dest );
|
void GetSliderHorizontalBounds( const wxPoint &topleft, wxRect &dest );
|
||||||
|
|
||||||
void GetGainRect(const wxPoint & topLeft, wxRect &dest);
|
|
||||||
|
|
||||||
void GetPanRect(const wxPoint & topLeft, wxRect &dest);
|
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
|
||||||
void GetVelocityRect(const wxPoint & topLeft, wxRect &dest);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void GetMinimizeHorizontalBounds( const wxRect &rect, wxRect &dest );
|
void GetMinimizeHorizontalBounds( const wxRect &rect, wxRect &dest );
|
||||||
void GetMinimizeRect(const wxRect & rect, wxRect &dest);
|
void GetMinimizeRect(const wxRect & rect, wxRect &dest);
|
||||||
|
|
||||||
@ -185,18 +140,9 @@ namespace TrackInfo
|
|||||||
void GetSyncLockHorizontalBounds( const wxRect &rect, wxRect &dest );
|
void GetSyncLockHorizontalBounds( const wxRect &rect, wxRect &dest );
|
||||||
void GetSyncLockIconRect(const wxRect & rect, wxRect &dest);
|
void GetSyncLockIconRect(const wxRect & rect, wxRect &dest);
|
||||||
|
|
||||||
#ifdef USE_MIDI
|
|
||||||
void GetMidiControlsHorizontalBounds
|
|
||||||
( const wxRect &rect, wxRect &dest );
|
|
||||||
void GetMidiControlsRect(const wxRect & rect, wxRect &dest);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool HideTopItem( const wxRect &rect, const wxRect &subRect,
|
bool HideTopItem( const wxRect &rect, const wxRect &subRect,
|
||||||
int allowance = 0 );
|
int allowance = 0 );
|
||||||
|
|
||||||
unsigned DefaultNoteTrackHeight();
|
|
||||||
unsigned DefaultWaveTrackHeight();
|
|
||||||
|
|
||||||
LWSlider * GainSlider
|
LWSlider * GainSlider
|
||||||
(const wxRect &sliderRect, const WaveTrack *t, bool captured,
|
(const wxRect &sliderRect, const WaveTrack *t, bool captured,
|
||||||
wxWindow *pParent);
|
wxWindow *pParent);
|
||||||
|
@ -73,8 +73,10 @@ is time to refresh some aspect of the screen.
|
|||||||
#include "TrackInfo.h"
|
#include "TrackInfo.h"
|
||||||
#include "TrackPanelAx.h"
|
#include "TrackPanelAx.h"
|
||||||
#include "WaveTrack.h"
|
#include "WaveTrack.h"
|
||||||
|
#include "tracks/playabletrack/wavetrack/ui/WaveTrackControls.h"
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
#include "NoteTrack.h"
|
#include "NoteTrack.h"
|
||||||
|
#include "tracks/playabletrack/notetrack/ui/NoteTrackControls.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ondemand/ODManager.h"
|
#include "ondemand/ODManager.h"
|
||||||
@ -325,7 +327,7 @@ LWSlider *TrackPanel::GainSlider( const WaveTrack *wt )
|
|||||||
auto pControls = &TrackControls::Get( *wt );
|
auto pControls = &TrackControls::Get( *wt );
|
||||||
auto rect = FindRect( *pControls );
|
auto rect = FindRect( *pControls );
|
||||||
wxRect sliderRect;
|
wxRect sliderRect;
|
||||||
TrackInfo::GetGainRect( rect.GetTopLeft(), sliderRect );
|
WaveTrackControls::GetGainRect( rect.GetTopLeft(), sliderRect );
|
||||||
return TrackInfo::GainSlider(sliderRect, wt, false, this);
|
return TrackInfo::GainSlider(sliderRect, wt, false, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +336,7 @@ LWSlider *TrackPanel::PanSlider( const WaveTrack *wt )
|
|||||||
auto pControls = &TrackControls::Get( *wt );
|
auto pControls = &TrackControls::Get( *wt );
|
||||||
auto rect = FindRect( *pControls );
|
auto rect = FindRect( *pControls );
|
||||||
wxRect sliderRect;
|
wxRect sliderRect;
|
||||||
TrackInfo::GetPanRect( rect.GetTopLeft(), sliderRect );
|
WaveTrackControls::GetPanRect( rect.GetTopLeft(), sliderRect );
|
||||||
return TrackInfo::PanSlider(sliderRect, wt, false, this);
|
return TrackInfo::PanSlider(sliderRect, wt, false, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,7 +346,7 @@ LWSlider *TrackPanel::VelocitySlider( const NoteTrack *nt )
|
|||||||
auto pControls = &TrackControls::Get( *nt );
|
auto pControls = &TrackControls::Get( *nt );
|
||||||
auto rect = FindRect( *pControls );
|
auto rect = FindRect( *pControls );
|
||||||
wxRect sliderRect;
|
wxRect sliderRect;
|
||||||
TrackInfo::GetVelocityRect( rect.GetTopLeft(), sliderRect );
|
NoteTrackControls::GetVelocityRect( rect.GetTopLeft(), sliderRect );
|
||||||
return TrackInfo::VelocitySlider(sliderRect, nt, false, this);
|
return TrackInfo::VelocitySlider(sliderRect, nt, false, this);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3124,3 +3124,4 @@ void WaveTrack::DoZoom
|
|||||||
if( pProject )
|
if( pProject )
|
||||||
ProjectHistory::Get( *pProject ).ModifyState(true);
|
ProjectHistory::Get( *pProject ).ModifyState(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
#ifdef USE_MIDI
|
#ifdef USE_MIDI
|
||||||
#include "NoteTrackButtonHandle.h"
|
#include "NoteTrackButtonHandle.h"
|
||||||
|
|
||||||
|
#include "NoteTrackControls.h"
|
||||||
#include "../../../../TrackPanelMouseEvent.h"
|
#include "../../../../TrackPanelMouseEvent.h"
|
||||||
#include "../../../../NoteTrack.h"
|
#include "../../../../NoteTrack.h"
|
||||||
#include "../../../../ProjectHistory.h"
|
#include "../../../../ProjectHistory.h"
|
||||||
@ -53,7 +54,7 @@ UIHandlePtr NoteTrackButtonHandle::HitTest
|
|||||||
const std::shared_ptr<NoteTrack> &pTrack)
|
const std::shared_ptr<NoteTrack> &pTrack)
|
||||||
{
|
{
|
||||||
wxRect midiRect;
|
wxRect midiRect;
|
||||||
TrackInfo::GetMidiControlsRect(rect, midiRect);
|
NoteTrackControls::GetMidiControlsRect(rect, midiRect);
|
||||||
if ( TrackInfo::HideTopItem( rect, midiRect ) )
|
if ( TrackInfo::HideTopItem( rect, midiRect ) )
|
||||||
return {};
|
return {};
|
||||||
if (midiRect.Contains(state.m_x, state.m_y)) {
|
if (midiRect.Contains(state.m_x, state.m_y)) {
|
||||||
|
@ -137,4 +137,122 @@ PopupMenuTable *NoteTrackControls::GetMenuExtension(Track *)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// drawing related
|
||||||
|
#include "../../../../widgets/ASlider.h"
|
||||||
|
#include "../../../../TrackInfo.h"
|
||||||
|
#include "../../../../TrackPanelDrawingContext.h"
|
||||||
|
#include "../../../../ViewInfo.h"
|
||||||
|
|
||||||
|
using TCPLine = TrackInfo::TCPLine;
|
||||||
|
|
||||||
|
#ifdef USE_MIDI
|
||||||
|
enum : int {
|
||||||
|
// PRL: was it correct to include the margin?
|
||||||
|
kMidiCellWidth = ( ( kTrackInfoWidth + kLeftMargin ) / 4) - 2,
|
||||||
|
kMidiCellHeight = kTrackInfoBtnSize
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "tracks/playabletrack/notetrack/ui/NoteTrackButtonHandle.h"
|
||||||
|
#include "tracks/playabletrack/notetrack/ui/NoteTrackSliderHandles.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
void GetMidiControlsHorizontalBounds( const wxRect &rect, wxRect &dest )
|
||||||
|
{
|
||||||
|
dest.x = rect.x + 1; // To center slightly
|
||||||
|
// PRL: TODO: kMidiCellWidth is defined in terms of the other constant
|
||||||
|
// kTrackInfoWidth but I am trying to avoid use of that constant.
|
||||||
|
// Can cell width be computed from dest.width instead?
|
||||||
|
dest.width = kMidiCellWidth * 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SliderDrawFunction
|
||||||
|
( LWSlider *(*Selector)
|
||||||
|
(const wxRect &sliderRect, const NoteTrack *t, bool captured, wxWindow*),
|
||||||
|
wxDC *dc, const wxRect &rect, const Track *pTrack,
|
||||||
|
bool captured, bool highlight )
|
||||||
|
{
|
||||||
|
wxRect sliderRect = rect;
|
||||||
|
TrackInfo::GetSliderHorizontalBounds( rect.GetTopLeft(), sliderRect );
|
||||||
|
auto nt = static_cast<const NoteTrack*>( pTrack );
|
||||||
|
Selector( sliderRect, nt, captured, nullptr )->OnPaint(*dc, highlight);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VelocitySliderDrawFunction
|
||||||
|
( TrackPanelDrawingContext &context,
|
||||||
|
const wxRect &rect, const Track *pTrack )
|
||||||
|
{
|
||||||
|
auto dc = &context.dc;
|
||||||
|
auto target = dynamic_cast<VelocitySliderHandle*>( context.target.get() );
|
||||||
|
bool hit = target && target->GetTrack().get() == pTrack;
|
||||||
|
bool captured = hit && target->IsClicked();
|
||||||
|
SliderDrawFunction(
|
||||||
|
&TrackInfo::VelocitySlider, dc, rect, pTrack, captured, hit);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MidiControlsDrawFunction
|
||||||
|
( TrackPanelDrawingContext &context,
|
||||||
|
const wxRect &rect, const Track *pTrack )
|
||||||
|
{
|
||||||
|
auto target = dynamic_cast<NoteTrackButtonHandle*>( context.target.get() );
|
||||||
|
bool hit = target && target->GetTrack().get() == pTrack;
|
||||||
|
auto channel = hit ? target->GetChannel() : -1;
|
||||||
|
auto &dc = context.dc;
|
||||||
|
wxRect midiRect = rect;
|
||||||
|
GetMidiControlsHorizontalBounds(rect, midiRect);
|
||||||
|
NoteTrack::DrawLabelControls
|
||||||
|
( static_cast<const NoteTrack *>(pTrack), dc, midiRect, channel );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct NoteTrackTCPLines
|
||||||
|
: TCPLines { NoteTrackTCPLines() {
|
||||||
|
(TCPLines&)*this =
|
||||||
|
CommonTrackControls::StaticTCPLines();
|
||||||
|
insert( end(), {
|
||||||
|
#ifdef EXPERIMENTAL_DA
|
||||||
|
// DA: Has Mute and Solo on separate lines.
|
||||||
|
{ TCPLine::kItemMute, kTrackInfoBtnSize + 1, 1,
|
||||||
|
TrackInfo::WideMuteDrawFunction },
|
||||||
|
{ TCPLine::kItemSolo, kTrackInfoBtnSize + 1, 0,
|
||||||
|
TrackInfo::WideSoloDrawFunction },
|
||||||
|
#else
|
||||||
|
{ TCPLine::kItemMute | TCPLine::kItemSolo, kTrackInfoBtnSize + 1, 0,
|
||||||
|
TrackInfo::MuteAndSoloDrawFunction },
|
||||||
|
#endif
|
||||||
|
|
||||||
|
{ TCPLine::kItemMidiControlsRect, kMidiCellHeight * 4, 0,
|
||||||
|
MidiControlsDrawFunction },
|
||||||
|
{ TCPLine::kItemVelocity, kTrackInfoSliderHeight, kTrackInfoSliderExtra,
|
||||||
|
VelocitySliderDrawFunction },
|
||||||
|
} );
|
||||||
|
} } noteTrackTCPLines;
|
||||||
|
|
||||||
|
void NoteTrackControls::GetVelocityRect(const wxPoint &topleft, wxRect & dest)
|
||||||
|
{
|
||||||
|
TrackInfo::GetSliderHorizontalBounds( topleft, dest );
|
||||||
|
auto results = CalcItemY( noteTrackTCPLines, TCPLine::kItemVelocity );
|
||||||
|
dest.y = topleft.y + results.first;
|
||||||
|
dest.height = results.second;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NoteTrackControls::GetMidiControlsRect(const wxRect & rect, wxRect & dest)
|
||||||
|
{
|
||||||
|
GetMidiControlsHorizontalBounds( rect, dest );
|
||||||
|
auto results = TrackInfo::CalcItemY(
|
||||||
|
noteTrackTCPLines, TCPLine::kItemMidiControlsRect );
|
||||||
|
dest.y = rect.y + results.first;
|
||||||
|
dest.height = results.second;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned NoteTrackControls::DefaultNoteTrackHeight()
|
||||||
|
{
|
||||||
|
return TrackInfo::DefaultTrackHeight( noteTrackTCPLines );
|
||||||
|
}
|
||||||
|
|
||||||
|
const TCPLines &NoteTrackControls::GetTCPLines() const
|
||||||
|
{
|
||||||
|
return noteTrackTCPLines;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -42,6 +42,10 @@ public:
|
|||||||
PopupMenuTable *GetMenuExtension(Track *pTrack) override;
|
PopupMenuTable *GetMenuExtension(Track *pTrack) override;
|
||||||
|
|
||||||
const TCPLines& GetTCPLines() const override;
|
const TCPLines& GetTCPLines() const override;
|
||||||
|
|
||||||
|
static unsigned DefaultNoteTrackHeight();
|
||||||
|
static void GetMidiControlsRect(const wxRect & rect, wxRect & dest);
|
||||||
|
static void GetVelocityRect(const wxPoint &topleft, wxRect & dest);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
|
|
||||||
|
#include "NoteTrackControls.h"
|
||||||
#include "../../../../ProjectHistory.h"
|
#include "../../../../ProjectHistory.h"
|
||||||
#include "../../../../RefreshCode.h"
|
#include "../../../../RefreshCode.h"
|
||||||
#include "../../../../TrackInfo.h"
|
#include "../../../../TrackInfo.h"
|
||||||
@ -79,7 +80,7 @@ UIHandlePtr VelocitySliderHandle::HitTest
|
|||||||
return {};
|
return {};
|
||||||
|
|
||||||
wxRect sliderRect;
|
wxRect sliderRect;
|
||||||
TrackInfo::GetVelocityRect(rect.GetTopLeft(), sliderRect);
|
NoteTrackControls::GetVelocityRect(rect.GetTopLeft(), sliderRect);
|
||||||
if ( TrackInfo::HideTopItem( rect, sliderRect, kTrackInfoSliderAllowance ) )
|
if ( TrackInfo::HideTopItem( rect, sliderRect, kTrackInfoSliderAllowance ) )
|
||||||
return {};
|
return {};
|
||||||
if (sliderRect.Contains(state.m_x, state.m_y)) {
|
if (sliderRect.Contains(state.m_x, state.m_y)) {
|
||||||
|
@ -23,12 +23,11 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
#include "../../../../TrackPanelMouseEvent.h"
|
#include "../../../../TrackPanelMouseEvent.h"
|
||||||
#include "../../../ui/SelectHandle.h"
|
#include "../../../ui/SelectHandle.h"
|
||||||
#include "StretchHandle.h"
|
#include "StretchHandle.h"
|
||||||
#include "../../../../TrackInfo.h"
|
|
||||||
|
|
||||||
NoteTrackView::NoteTrackView( const std::shared_ptr<Track> &pTrack )
|
NoteTrackView::NoteTrackView( const std::shared_ptr<Track> &pTrack )
|
||||||
: CommonTrackView{ pTrack }
|
: CommonTrackView{ pTrack }
|
||||||
{
|
{
|
||||||
DoSetHeight( TrackInfo::DefaultNoteTrackHeight() );
|
DoSetHeight( NoteTrackControls::DefaultNoteTrackHeight() );
|
||||||
}
|
}
|
||||||
|
|
||||||
NoteTrackView::~NoteTrackView()
|
NoteTrackView::~NoteTrackView()
|
||||||
|
@ -1011,3 +1011,160 @@ PopupMenuTable *WaveTrackControls::GetMenuExtension(Track * pTrack)
|
|||||||
WaveTrackMenuTable & result = WaveTrackMenuTable::Instance( pTrack );
|
WaveTrackMenuTable & result = WaveTrackMenuTable::Instance( pTrack );
|
||||||
return &result;
|
return &result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// drawing related
|
||||||
|
#include "../../../../widgets/ASlider.h"
|
||||||
|
#include "../../../../TrackInfo.h"
|
||||||
|
#include "../../../../TrackPanelDrawingContext.h"
|
||||||
|
#include "../../../../ViewInfo.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
void SliderDrawFunction
|
||||||
|
( LWSlider *(*Selector)
|
||||||
|
(const wxRect &sliderRect, const WaveTrack *t, bool captured, wxWindow*),
|
||||||
|
wxDC *dc, const wxRect &rect, const Track *pTrack,
|
||||||
|
bool captured, bool highlight )
|
||||||
|
{
|
||||||
|
wxRect sliderRect = rect;
|
||||||
|
TrackInfo::GetSliderHorizontalBounds( rect.GetTopLeft(), sliderRect );
|
||||||
|
auto wt = static_cast<const WaveTrack*>( pTrack );
|
||||||
|
Selector( sliderRect, wt, captured, nullptr )->OnPaint(*dc, highlight);
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "tracks/playabletrack/wavetrack/ui/WaveTrackSliderHandles.h"
|
||||||
|
void PanSliderDrawFunction
|
||||||
|
( TrackPanelDrawingContext &context,
|
||||||
|
const wxRect &rect, const Track *pTrack )
|
||||||
|
{
|
||||||
|
auto target = dynamic_cast<PanSliderHandle*>( context.target.get() );
|
||||||
|
auto dc = &context.dc;
|
||||||
|
bool hit = target && target->GetTrack().get() == pTrack;
|
||||||
|
bool captured = hit && target->IsClicked();
|
||||||
|
SliderDrawFunction
|
||||||
|
( &TrackInfo::PanSlider, dc, rect, pTrack, captured, hit);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GainSliderDrawFunction
|
||||||
|
( TrackPanelDrawingContext &context,
|
||||||
|
const wxRect &rect, const Track *pTrack )
|
||||||
|
{
|
||||||
|
auto target = dynamic_cast<GainSliderHandle*>( context.target.get() );
|
||||||
|
auto dc = &context.dc;
|
||||||
|
bool hit = target && target->GetTrack().get() == pTrack;
|
||||||
|
if( hit )
|
||||||
|
hit=hit;
|
||||||
|
bool captured = hit && target->IsClicked();
|
||||||
|
SliderDrawFunction
|
||||||
|
( &TrackInfo::GainSlider, dc, rect, pTrack, captured, hit);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatusDrawFunction
|
||||||
|
( const wxString &string, wxDC *dc, const wxRect &rect )
|
||||||
|
{
|
||||||
|
static const int offset = 3;
|
||||||
|
dc->DrawText(string, rect.x + offset, rect.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Status1DrawFunction
|
||||||
|
( TrackPanelDrawingContext &context,
|
||||||
|
const wxRect &rect, const Track *pTrack )
|
||||||
|
{
|
||||||
|
auto dc = &context.dc;
|
||||||
|
auto wt = static_cast<const WaveTrack*>(pTrack);
|
||||||
|
|
||||||
|
/// Returns the string to be displayed in the track label
|
||||||
|
/// indicating whether the track is mono, left, right, or
|
||||||
|
/// stereo and what sample rate it's using.
|
||||||
|
auto rate = wt ? wt->GetRate() : 44100.0;
|
||||||
|
wxString s;
|
||||||
|
if (!pTrack || TrackList::Channels(pTrack).size() > 1)
|
||||||
|
// TODO: more-than-two-channels-message
|
||||||
|
// more appropriate strings
|
||||||
|
s = _("Stereo, %dHz");
|
||||||
|
else {
|
||||||
|
if (wt->GetChannel() == Track::MonoChannel)
|
||||||
|
s = _("Mono, %dHz");
|
||||||
|
else if (wt->GetChannel() == Track::LeftChannel)
|
||||||
|
s = _("Left, %dHz");
|
||||||
|
else if (wt->GetChannel() == Track::RightChannel)
|
||||||
|
s = _("Right, %dHz");
|
||||||
|
}
|
||||||
|
s = wxString::Format( s, (int) (rate + 0.5) );
|
||||||
|
|
||||||
|
StatusDrawFunction( s, dc, rect );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Status2DrawFunction
|
||||||
|
( TrackPanelDrawingContext &context,
|
||||||
|
const wxRect &rect, const Track *pTrack )
|
||||||
|
{
|
||||||
|
auto dc = &context.dc;
|
||||||
|
auto wt = static_cast<const WaveTrack*>(pTrack);
|
||||||
|
auto format = wt ? wt->GetSampleFormat() : floatSample;
|
||||||
|
auto s = GetSampleFormatStr(format);
|
||||||
|
StatusDrawFunction( s, dc, rect );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
using TCPLine = TrackInfo::TCPLine;
|
||||||
|
|
||||||
|
static const struct WaveTrackTCPLines
|
||||||
|
: TCPLines { WaveTrackTCPLines() {
|
||||||
|
(TCPLines&)*this =
|
||||||
|
CommonTrackControls::StaticTCPLines();
|
||||||
|
insert( end(), {
|
||||||
|
|
||||||
|
#ifdef EXPERIMENTAL_DA
|
||||||
|
// DA: Has Mute and Solo on separate lines.
|
||||||
|
{ TCPLine::kItemMute, kTrackInfoBtnSize + 1, 1,
|
||||||
|
TrackInfo::WideMuteDrawFunction },
|
||||||
|
{ TCPLine::kItemSolo, kTrackInfoBtnSize + 1, 2,
|
||||||
|
TrackInfo::WideSoloDrawFunction },
|
||||||
|
#else
|
||||||
|
{ TCPLine::kItemMute | TCPLine::kItemSolo, kTrackInfoBtnSize + 1, 2,
|
||||||
|
TrackInfo::MuteAndSoloDrawFunction },
|
||||||
|
#endif
|
||||||
|
|
||||||
|
{ TCPLine::kItemGain, kTrackInfoSliderHeight, kTrackInfoSliderExtra,
|
||||||
|
GainSliderDrawFunction },
|
||||||
|
{ TCPLine::kItemPan, kTrackInfoSliderHeight, kTrackInfoSliderExtra,
|
||||||
|
PanSliderDrawFunction },
|
||||||
|
|
||||||
|
#ifdef EXPERIMENTAL_DA
|
||||||
|
// DA: Does not have status information for a track.
|
||||||
|
#else
|
||||||
|
{ TCPLine::kItemStatusInfo1, 12, 0,
|
||||||
|
Status1DrawFunction },
|
||||||
|
{ TCPLine::kItemStatusInfo2, 12, 0,
|
||||||
|
Status2DrawFunction },
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} );
|
||||||
|
} } waveTrackTCPLines;
|
||||||
|
|
||||||
|
void WaveTrackControls::GetGainRect(const wxPoint &topleft, wxRect & dest)
|
||||||
|
{
|
||||||
|
TrackInfo::GetSliderHorizontalBounds( topleft, dest );
|
||||||
|
auto results = CalcItemY( waveTrackTCPLines, TCPLine::kItemGain );
|
||||||
|
dest.y = topleft.y + results.first;
|
||||||
|
dest.height = results.second;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WaveTrackControls::GetPanRect(const wxPoint &topleft, wxRect & dest)
|
||||||
|
{
|
||||||
|
GetGainRect( topleft, dest );
|
||||||
|
auto results = CalcItemY( waveTrackTCPLines, TCPLine::kItemPan );
|
||||||
|
dest.y = topleft.y + results.first;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned WaveTrackControls::DefaultWaveTrackHeight()
|
||||||
|
{
|
||||||
|
return TrackInfo::DefaultTrackHeight( waveTrackTCPLines );
|
||||||
|
}
|
||||||
|
|
||||||
|
const TCPLines &WaveTrackControls::GetTCPLines() const
|
||||||
|
{
|
||||||
|
return waveTrackTCPLines;
|
||||||
|
}
|
||||||
|
@ -37,6 +37,10 @@ public:
|
|||||||
|
|
||||||
const TCPLines& GetTCPLines() const override;
|
const TCPLines& GetTCPLines() const override;
|
||||||
|
|
||||||
|
static unsigned DefaultWaveTrackHeight();
|
||||||
|
static void GetGainRect(const wxPoint & topLeft, wxRect &dest);
|
||||||
|
static void GetPanRect(const wxPoint & topLeft, wxRect &dest);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::weak_ptr<MuteButtonHandle> mMuteHandle;
|
std::weak_ptr<MuteButtonHandle> mMuteHandle;
|
||||||
std::weak_ptr<SoloButtonHandle> mSoloHandle;
|
std::weak_ptr<SoloButtonHandle> mSoloHandle;
|
||||||
|
@ -11,6 +11,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
#include "../../../../Audacity.h"
|
#include "../../../../Audacity.h"
|
||||||
#include "WaveTrackSliderHandles.h"
|
#include "WaveTrackSliderHandles.h"
|
||||||
|
|
||||||
|
#include "WaveTrackControls.h"
|
||||||
#include "../../../../ProjectHistory.h"
|
#include "../../../../ProjectHistory.h"
|
||||||
#include "../../../../RefreshCode.h"
|
#include "../../../../RefreshCode.h"
|
||||||
#include "../../../../TrackInfo.h"
|
#include "../../../../TrackInfo.h"
|
||||||
@ -72,12 +73,12 @@ UIHandlePtr GainSliderHandle::HitTest
|
|||||||
return {};
|
return {};
|
||||||
|
|
||||||
wxRect sliderRect;
|
wxRect sliderRect;
|
||||||
TrackInfo::GetGainRect(rect.GetTopLeft(), sliderRect);
|
WaveTrackControls::GetGainRect(rect.GetTopLeft(), sliderRect);
|
||||||
if ( TrackInfo::HideTopItem( rect, sliderRect))
|
if ( TrackInfo::HideTopItem( rect, sliderRect))
|
||||||
return {};
|
return {};
|
||||||
if (sliderRect.Contains(state.m_x, state.m_y)) {
|
if (sliderRect.Contains(state.m_x, state.m_y)) {
|
||||||
wxRect sliderRect2;
|
wxRect sliderRect2;
|
||||||
TrackInfo::GetGainRect(rect.GetTopLeft(), sliderRect2);
|
WaveTrackControls::GetGainRect(rect.GetTopLeft(), sliderRect2);
|
||||||
auto sliderFn =
|
auto sliderFn =
|
||||||
[]( AudacityProject *pProject, const wxRect &sliderRect, Track *pTrack ) {
|
[]( AudacityProject *pProject, const wxRect &sliderRect, Track *pTrack ) {
|
||||||
return TrackInfo::GainSlider
|
return TrackInfo::GainSlider
|
||||||
@ -151,7 +152,7 @@ UIHandlePtr PanSliderHandle::HitTest
|
|||||||
return {};
|
return {};
|
||||||
|
|
||||||
wxRect sliderRect;
|
wxRect sliderRect;
|
||||||
TrackInfo::GetPanRect(rect.GetTopLeft(), sliderRect);
|
WaveTrackControls::GetPanRect(rect.GetTopLeft(), sliderRect);
|
||||||
if ( TrackInfo::HideTopItem( rect, sliderRect))
|
if ( TrackInfo::HideTopItem( rect, sliderRect))
|
||||||
return {};
|
return {};
|
||||||
if (sliderRect.Contains(state.m_x, state.m_y)) {
|
if (sliderRect.Contains(state.m_x, state.m_y)) {
|
||||||
|
@ -33,7 +33,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
WaveTrackView::WaveTrackView( const std::shared_ptr<Track> &pTrack )
|
WaveTrackView::WaveTrackView( const std::shared_ptr<Track> &pTrack )
|
||||||
: CommonTrackView{ pTrack }
|
: CommonTrackView{ pTrack }
|
||||||
{
|
{
|
||||||
DoSetHeight( TrackInfo::DefaultWaveTrackHeight() );
|
DoSetHeight( WaveTrackControls::DefaultWaveTrackHeight() );
|
||||||
}
|
}
|
||||||
|
|
||||||
WaveTrackView::~WaveTrackView()
|
WaveTrackView::~WaveTrackView()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user