Table includes draw function for Midi controls

This commit is contained in:
Paul Licameli 2017-06-12 15:51:06 -04:00
parent 86763341af
commit 329aa8393e
4 changed files with 23 additions and 9 deletions

View File

@ -250,7 +250,8 @@ void NoteTrack::WarpAndTransposeNotes(double t0, double t1,
// Draws the midi channel toggle buttons within the given rect.
// The rect should be evenly divisible by 4 on both axis.
void NoteTrack::DrawLabelControls(wxDC & dc, const wxRect &rect)
void NoteTrack::DrawLabelControls
( const NoteTrack *pTrack, wxDC & dc, const wxRect &rect )
{
wxASSERT_MSG(rect.width % 4 == 0, "Midi channel control rect width must be divisible by 4");
wxASSERT_MSG(rect.height % 4 == 0, "Midi channel control rect height must be divisible by 4");
@ -270,7 +271,8 @@ void NoteTrack::DrawLabelControls(wxDC & dc, const wxRect &rect)
box.width = cellWidth;
box.height = cellHeight;
if (IsVisibleChan(chanName - 1)) {
bool visible = pTrack ? pTrack->IsVisibleChan(chanName - 1) : true;
if (visible) {
AColor::MIDIChannel(&dc, chanName);
dc.DrawRectangle(box);
// two choices: channel is enabled (to see and play) when button is in

View File

@ -82,7 +82,8 @@ class AUDACITY_DLL_API NoteTrack final
void WarpAndTransposeNotes(double t0, double t1,
const TimeWarper &warper, double semitones);
void DrawLabelControls(wxDC & dc, const wxRect &rect);
static void DrawLabelControls
( const NoteTrack *pTrack, wxDC & dc, const wxRect &rect );
bool LabelClick(const wxRect &rect, int x, int y, bool right);
void SetSequence(std::unique_ptr<Alg_seq> &&seq);

View File

@ -5120,7 +5120,8 @@ const TrackInfo::TCPLine noteTrackTCPLines[] = {
COMMON_ITEMS
#ifdef EXPERIMENTAL_MIDI_OUT
MUTE_SOLO_ITEMS(0)
{ kItemMidiControlsRect, kMidiCellHeight * 4, 0, nullptr },
{ kItemMidiControlsRect, kMidiCellHeight * 4, 0,
&TrackInfo::MidiControlsDrawFunction },
{ kItemVelocity, kTrackInfoSliderHeight, kTrackInfoSliderExtra, nullptr },
#endif
{ 0, 0, 0, nullptr }
@ -7444,6 +7445,17 @@ void TrackInfo::MinimizeSyncLockDrawFunction
}
}
void TrackInfo::MidiControlsDrawFunction
( wxDC *dc, const wxRect &rect, const Track *pTrack, int, bool )
{
#ifdef EXPERIMENTAL_MIDI_OUT
wxRect midiRect = rect;
GetMidiControlsHorizontalBounds(rect, midiRect);
NoteTrack::DrawLabelControls
( static_cast<const NoteTrack *>(pTrack), *dc, midiRect );
#endif // EXPERIMENTAL_MIDI_OUT
}
void TrackPanel::DrawOutside(Track * t, wxDC * dc, const wxRect & rec)
{
bool bIsWave = (t->GetKind() == Track::Wave);
@ -7528,11 +7540,6 @@ void TrackPanel::DrawOutside(Track * t, wxDC * dc, const wxRect & rec)
#ifdef EXPERIMENTAL_MIDI_OUT
else if (bIsNote) {
wxRect midiRect;
mTrackInfo.GetMidiControlsRect(rect, midiRect);
if ( !TrackInfo::HideTopItem( rect, midiRect ) )
static_cast<NoteTrack *>(t)->DrawLabelControls(*dc, midiRect);
mTrackInfo.DrawMuteSolo(dc, rect, t,
(captured && mMouseCapture == IsMuting), false, HasSoloButton());
mTrackInfo.DrawMuteSolo(dc, rect, t,

View File

@ -103,6 +103,10 @@ public:
( wxDC *dc, const wxRect &rect, const Track *pTrack, int pressed,
bool captured );
static void MidiControlsDrawFunction
( wxDC *dc, const wxRect &rect, const Track *pTrack, int pressed,
bool captured );
private:
int GetTrackInfoWidth() const;
static void SetTrackInfoFont(wxDC *dc);