mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-17 09:07:41 +02:00
Default MIDI track height is enough to display velocity slider...
... It is computed from the layout table, and in fact comes to 158 pixels, versus 150 for other tracks.
This commit is contained in:
parent
0204cd80c5
commit
f0c149b890
@ -36,6 +36,8 @@
|
||||
|
||||
#include "InconsistencyException.h"
|
||||
|
||||
#include "TrackPanel.h" // For TrackInfo
|
||||
|
||||
#ifdef SONIFY
|
||||
#include "../lib-src/portmidi/pm_common/portmidi.h"
|
||||
|
||||
@ -110,6 +112,8 @@ NoteTrack::NoteTrack(const std::shared_ptr<DirManager> &projDirManager)
|
||||
SetDefaultName(_("Note Track"));
|
||||
SetName(GetDefaultName());
|
||||
|
||||
SetHeight( TrackInfo::DefaultNoteTrackHeight() );
|
||||
|
||||
mSeq = NULL;
|
||||
mSerializationLength = 0;
|
||||
|
||||
|
@ -52,7 +52,7 @@ Track::Track(const std::shared_ptr<DirManager> &projDirManager)
|
||||
mLinked = false;
|
||||
|
||||
mY = 0;
|
||||
mHeight = 150;
|
||||
mHeight = DefaultHeight;
|
||||
mIndex = 0;
|
||||
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
||||
mYv = mHeight;
|
||||
|
@ -167,6 +167,8 @@ class AUDACITY_DLL_API Track /* not final */ : public XMLTagHandler
|
||||
All
|
||||
};
|
||||
|
||||
enum : unsigned { DefaultHeight = 150 };
|
||||
|
||||
Track(const std::shared_ptr<DirManager> &projDirManager);
|
||||
Track(const Track &orig);
|
||||
|
||||
|
@ -5246,8 +5246,8 @@ const TCPLine waveTrackTCPLines[] = {
|
||||
COMMON_ITEMS(2)
|
||||
STATUS_ITEMS
|
||||
MUTE_SOLO_ITEMS(2)
|
||||
{ kItemGain, kTrackInfoSliderHeight, 5 },
|
||||
{ kItemPan, kTrackInfoSliderHeight, 5 },
|
||||
{ kItemGain, kTrackInfoSliderHeight, kTrackInfoSliderExtra },
|
||||
{ kItemPan, kTrackInfoSliderHeight, kTrackInfoSliderExtra },
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
@ -5256,11 +5256,21 @@ const TCPLine noteTrackTCPLines[] = {
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
MUTE_SOLO_ITEMS(0)
|
||||
{ kItemMidiControlsRect, kMidiCellHeight * 4, 0 },
|
||||
{ kItemVelocity, kTrackInfoSliderHeight, 5 },
|
||||
{ kItemVelocity, kTrackInfoSliderHeight, kTrackInfoSliderExtra },
|
||||
#endif
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
int totalTCPLines( const TCPLine *pLines )
|
||||
{
|
||||
int total = 0;
|
||||
while ( pLines->items ) {
|
||||
total += pLines->height + pLines->extraSpace;
|
||||
++pLines;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
const TCPLine *getTCPLines( const Track &track )
|
||||
{
|
||||
#ifdef USE_MIDI
|
||||
@ -5557,7 +5567,7 @@ bool TrackPanel::VelocityFunc(Track * t, wxRect rect, wxMouseEvent &event,
|
||||
{
|
||||
wxRect sliderRect;
|
||||
mTrackInfo.GetVelocityRect(rect.GetTopLeft(), sliderRect);
|
||||
if ( HideTopItem( rect, sliderRect ) )
|
||||
if ( HideTopItem( rect, sliderRect, kTrackInfoSliderAllowance ) )
|
||||
return false;
|
||||
if (!sliderRect.Contains(x, y))
|
||||
return false;
|
||||
@ -9762,13 +9772,25 @@ void TrackInfo::DrawVelocitySlider(wxDC *dc, NoteTrack *t, wxRect rect, bool cap
|
||||
{
|
||||
wxRect sliderRect;
|
||||
|
||||
GetVelocityRect(rect.GetTopLeft(), sliderRect);
|
||||
if ( !HideTopItem( rect, sliderRect ) ) {
|
||||
GetVelocityRect( rect.GetTopLeft(), sliderRect );
|
||||
if ( !HideTopItem( rect, sliderRect, kTrackInfoSliderAllowance ) ) {
|
||||
VelocitySlider(t, captured)->OnPaint(*dc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned TrackInfo::DefaultNoteTrackHeight()
|
||||
{
|
||||
// Just high enough that the velocity slider is just above the Minimize
|
||||
// button, as for default sized Wave track
|
||||
int needed =
|
||||
kTopMargin + kBottomMargin +
|
||||
totalTCPLines( noteTrackTCPLines ) +
|
||||
totalTCPLines( commonTrackTCPBottomLines ) -
|
||||
kTrackInfoSliderExtra;
|
||||
return (unsigned) std::max( needed, (int) Track::DefaultHeight );
|
||||
}
|
||||
|
||||
LWSlider * TrackInfo::GainSlider(WaveTrack *t, bool captured) const
|
||||
{
|
||||
wxPoint topLeft{
|
||||
|
@ -118,6 +118,8 @@ private:
|
||||
#endif
|
||||
|
||||
public:
|
||||
static unsigned DefaultNoteTrackHeight();
|
||||
|
||||
LWSlider * GainSlider(WaveTrack *t, bool captured = false) const;
|
||||
LWSlider * PanSlider(WaveTrack *t, bool captured = false) const;
|
||||
|
||||
@ -920,6 +922,7 @@ enum : int {
|
||||
kTrackInfoSliderHeight = 25,
|
||||
kTrackInfoSliderWidth = 84,
|
||||
kTrackInfoSliderAllowance = 5,
|
||||
kTrackInfoSliderExtra = 5,
|
||||
};
|
||||
|
||||
#ifdef USE_MIDI
|
||||
|
Loading…
x
Reference in New Issue
Block a user