mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 00:19:27 +02:00
TCP layout tables include draw functions...
... There is some duplication with the older draw functions, but these are soon to be removed. The draw functions may even be called without a TrackPanel or Track object, displaying default values. This ability is not yet used.
This commit is contained in:
commit
23e3aeba35
@ -3657,7 +3657,7 @@ void AudacityProject::OnTrackPan()
|
|||||||
}
|
}
|
||||||
const auto wt = static_cast<WaveTrack*>(track);
|
const auto wt = static_cast<WaveTrack*>(track);
|
||||||
|
|
||||||
LWSlider *slider = mTrackPanel->GetTrackInfo()->PanSlider(wt);
|
LWSlider *slider = mTrackPanel->PanSlider(wt);
|
||||||
if (slider->ShowDialog()) {
|
if (slider->ShowDialog()) {
|
||||||
SetTrackPan(wt, slider);
|
SetTrackPan(wt, slider);
|
||||||
}
|
}
|
||||||
@ -3671,7 +3671,7 @@ void AudacityProject::OnTrackPanLeft()
|
|||||||
}
|
}
|
||||||
const auto wt = static_cast<WaveTrack*>(track);
|
const auto wt = static_cast<WaveTrack*>(track);
|
||||||
|
|
||||||
LWSlider *slider = mTrackPanel->GetTrackInfo()->PanSlider(wt);
|
LWSlider *slider = mTrackPanel->PanSlider(wt);
|
||||||
slider->Decrease(1);
|
slider->Decrease(1);
|
||||||
SetTrackPan(wt, slider);
|
SetTrackPan(wt, slider);
|
||||||
}
|
}
|
||||||
@ -3684,7 +3684,7 @@ void AudacityProject::OnTrackPanRight()
|
|||||||
}
|
}
|
||||||
const auto wt = static_cast<WaveTrack*>(track);
|
const auto wt = static_cast<WaveTrack*>(track);
|
||||||
|
|
||||||
LWSlider *slider = mTrackPanel->GetTrackInfo()->PanSlider(wt);
|
LWSlider *slider = mTrackPanel->PanSlider(wt);
|
||||||
slider->Increase(1);
|
slider->Increase(1);
|
||||||
SetTrackPan(wt, slider);
|
SetTrackPan(wt, slider);
|
||||||
}
|
}
|
||||||
@ -3698,7 +3698,7 @@ void AudacityProject::OnTrackGain()
|
|||||||
}
|
}
|
||||||
const auto wt = static_cast<WaveTrack*>(track);
|
const auto wt = static_cast<WaveTrack*>(track);
|
||||||
|
|
||||||
LWSlider *slider = mTrackPanel->GetTrackInfo()->GainSlider(wt);
|
LWSlider *slider = mTrackPanel->GainSlider(wt);
|
||||||
if (slider->ShowDialog()) {
|
if (slider->ShowDialog()) {
|
||||||
SetTrackGain(wt, slider);
|
SetTrackGain(wt, slider);
|
||||||
}
|
}
|
||||||
@ -3712,7 +3712,7 @@ void AudacityProject::OnTrackGainInc()
|
|||||||
}
|
}
|
||||||
const auto wt = static_cast<WaveTrack*>(track);
|
const auto wt = static_cast<WaveTrack*>(track);
|
||||||
|
|
||||||
LWSlider *slider = mTrackPanel->GetTrackInfo()->GainSlider(wt);
|
LWSlider *slider = mTrackPanel->GainSlider(wt);
|
||||||
slider->Increase(1);
|
slider->Increase(1);
|
||||||
SetTrackGain(wt, slider);
|
SetTrackGain(wt, slider);
|
||||||
}
|
}
|
||||||
@ -3725,7 +3725,7 @@ void AudacityProject::OnTrackGainDec()
|
|||||||
}
|
}
|
||||||
const auto wt = static_cast<WaveTrack*>(track);
|
const auto wt = static_cast<WaveTrack*>(track);
|
||||||
|
|
||||||
LWSlider *slider = mTrackPanel->GetTrackInfo()->GainSlider(wt);
|
LWSlider *slider = mTrackPanel->GainSlider(wt);
|
||||||
slider->Decrease(1);
|
slider->Decrease(1);
|
||||||
SetTrackGain(wt, slider);
|
SetTrackGain(wt, slider);
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,8 @@ void NoteTrack::WarpAndTransposeNotes(double t0, double t1,
|
|||||||
|
|
||||||
// Draws the midi channel toggle buttons within the given rect.
|
// Draws the midi channel toggle buttons within the given rect.
|
||||||
// The rect should be evenly divisible by 4 on both axis.
|
// 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.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");
|
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.width = cellWidth;
|
||||||
box.height = cellHeight;
|
box.height = cellHeight;
|
||||||
|
|
||||||
if (IsVisibleChan(chanName - 1)) {
|
bool visible = pTrack ? pTrack->IsVisibleChan(chanName - 1) : true;
|
||||||
|
if (visible) {
|
||||||
AColor::MIDIChannel(&dc, chanName);
|
AColor::MIDIChannel(&dc, chanName);
|
||||||
dc.DrawRectangle(box);
|
dc.DrawRectangle(box);
|
||||||
// two choices: channel is enabled (to see and play) when button is in
|
// two choices: channel is enabled (to see and play) when button is in
|
||||||
|
@ -82,7 +82,8 @@ class AUDACITY_DLL_API NoteTrack final
|
|||||||
void WarpAndTransposeNotes(double t0, double t1,
|
void WarpAndTransposeNotes(double t0, double t1,
|
||||||
const TimeWarper &warper, double semitones);
|
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);
|
bool LabelClick(const wxRect &rect, int x, int y, bool right);
|
||||||
|
|
||||||
void SetSequence(std::unique_ptr<Alg_seq> &&seq);
|
void SetSequence(std::unique_ptr<Alg_seq> &&seq);
|
||||||
|
File diff suppressed because it is too large
Load Diff
155
src/TrackPanel.h
155
src/TrackPanel.h
@ -76,6 +76,7 @@ enum {
|
|||||||
kTimerInterval = 50, // milliseconds
|
kTimerInterval = 50, // milliseconds
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class AUDACITY_DLL_API TrackInfo
|
class AUDACITY_DLL_API TrackInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -83,9 +84,81 @@ public:
|
|||||||
~TrackInfo();
|
~TrackInfo();
|
||||||
void ReCreateSliders();
|
void ReCreateSliders();
|
||||||
|
|
||||||
|
struct TCPLine;
|
||||||
|
|
||||||
|
static void DrawItems
|
||||||
|
( wxDC *dc, const wxRect &rect, const Track &track, int mouseCapture,
|
||||||
|
bool captured );
|
||||||
|
|
||||||
|
static void DrawItems
|
||||||
|
( wxDC *dc, const wxRect &rect, const Track *pTrack,
|
||||||
|
const std::vector<TCPLine> &topLines,
|
||||||
|
const std::vector<TCPLine> &bottomLines,
|
||||||
|
int mouseCapture, bool captured );
|
||||||
|
|
||||||
|
static void CloseTitleDrawFunction
|
||||||
|
( wxDC *dc, const wxRect &rect, const Track *pTrack, int pressed,
|
||||||
|
bool captured );
|
||||||
|
|
||||||
|
static void MinimizeSyncLockDrawFunction
|
||||||
|
( 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 );
|
||||||
|
|
||||||
|
template<typename TrackClass>
|
||||||
|
static void SliderDrawFunction
|
||||||
|
( LWSlider *(*Selector)
|
||||||
|
(const wxRect &sliderRect, const TrackClass *t, bool captured,
|
||||||
|
wxWindow*),
|
||||||
|
wxDC *dc, const wxRect &rect, const Track *pTrack, bool captured );
|
||||||
|
|
||||||
|
static void PanSliderDrawFunction
|
||||||
|
( wxDC *dc, const wxRect &rect, const Track *pTrack, int pressed,
|
||||||
|
bool captured );
|
||||||
|
|
||||||
|
static void GainSliderDrawFunction
|
||||||
|
( wxDC *dc, const wxRect &rect, const Track *pTrack, int pressed,
|
||||||
|
bool captured );
|
||||||
|
|
||||||
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
|
static void VelocitySliderDrawFunction
|
||||||
|
( wxDC *dc, const wxRect &rect, const Track *pTrack, int pressed,
|
||||||
|
bool captured );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void MuteOrSoloDrawFunction
|
||||||
|
( wxDC *dc, const wxRect &rect, const Track *pTrack, int pressed,
|
||||||
|
bool captured, bool solo );
|
||||||
|
|
||||||
|
static void WideMuteDrawFunction
|
||||||
|
( wxDC *dc, const wxRect &rect, const Track *pTrack, int pressed,
|
||||||
|
bool captured );
|
||||||
|
|
||||||
|
static void WideSoloDrawFunction
|
||||||
|
( wxDC *dc, const wxRect &rect, const Track *pTrack, int pressed,
|
||||||
|
bool captured );
|
||||||
|
|
||||||
|
static void MuteAndSoloDrawFunction
|
||||||
|
( wxDC *dc, const wxRect &rect, const Track *pTrack, int pressed,
|
||||||
|
bool captured );
|
||||||
|
|
||||||
|
static void StatusDrawFunction
|
||||||
|
( const wxString &string, wxDC *dc, const wxRect &rect );
|
||||||
|
|
||||||
|
static void Status1DrawFunction
|
||||||
|
( wxDC *dc, const wxRect &rect, const Track *pTrack, int pressed,
|
||||||
|
bool captured );
|
||||||
|
|
||||||
|
static void Status2DrawFunction
|
||||||
|
( wxDC *dc, const wxRect &rect, const Track *pTrack, int pressed,
|
||||||
|
bool captured );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int GetTrackInfoWidth() const;
|
int GetTrackInfoWidth() const;
|
||||||
void SetTrackInfoFont(wxDC *dc) const;
|
static void SetTrackInfoFont(wxDC *dc);
|
||||||
|
|
||||||
|
|
||||||
void DrawBackground(wxDC * dc, const wxRect & rect, bool bSelected, bool bHasMuteSolo, const int labelw, const int vrul) const;
|
void DrawBackground(wxDC * dc, const wxRect & rect, bool bSelected, bool bHasMuteSolo, const int labelw, const int vrul) const;
|
||||||
@ -94,26 +167,45 @@ private:
|
|||||||
void DrawTitleBar(wxDC * dc, const wxRect & rect, Track * t, bool down) const;
|
void DrawTitleBar(wxDC * dc, const wxRect & rect, Track * t, bool down) const;
|
||||||
void DrawMuteSolo(wxDC * dc, const wxRect & rect, Track * t, bool down, bool solo, bool bHasSoloButton) const;
|
void DrawMuteSolo(wxDC * dc, const wxRect & rect, Track * t, bool down, bool solo, bool bHasSoloButton) const;
|
||||||
void DrawVRuler(wxDC * dc, const wxRect & rect, Track * t) const;
|
void DrawVRuler(wxDC * dc, const wxRect & rect, Track * t) const;
|
||||||
void DrawSliders(wxDC * dc, WaveTrack *t, wxRect rect, bool captured) const;
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
|
||||||
void DrawVelocitySlider(wxDC * dc, NoteTrack *t, wxRect rect, bool captured) const;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Draw the minimize button *and* the sync-lock track icon, if necessary.
|
// Draw the minimize button *and* the sync-lock track icon, if necessary.
|
||||||
void DrawMinimize(wxDC * dc, const wxRect & rect, Track * t, bool down) const;
|
void DrawMinimize(wxDC * dc, const wxRect & rect, Track * t, bool down) const;
|
||||||
|
|
||||||
|
static void GetCloseBoxHorizontalBounds( const wxRect & rect, wxRect &dest );
|
||||||
static void GetCloseBoxRect(const wxRect & rect, wxRect &dest);
|
static void GetCloseBoxRect(const wxRect & rect, wxRect &dest);
|
||||||
|
|
||||||
|
static void GetTitleBarHorizontalBounds( const wxRect & rect, wxRect &dest );
|
||||||
static void GetTitleBarRect(const wxRect & rect, wxRect &dest);
|
static void GetTitleBarRect(const wxRect & rect, wxRect &dest);
|
||||||
static void GetMuteSoloRect(const wxRect & rect, wxRect &dest, bool solo, bool bHasSoloButton,
|
|
||||||
const Track *pTrack);
|
static void GetNarrowMuteHorizontalBounds
|
||||||
|
( const wxRect & rect, wxRect &dest );
|
||||||
|
static void GetNarrowSoloHorizontalBounds
|
||||||
|
( const wxRect & rect, wxRect &dest );
|
||||||
|
static void GetWideMuteSoloHorizontalBounds
|
||||||
|
( const wxRect & rect, wxRect &dest );
|
||||||
|
static void GetMuteSoloRect
|
||||||
|
(const wxRect & rect, wxRect &dest, bool solo, bool bHasSoloButton,
|
||||||
|
const Track *pTrack);
|
||||||
|
|
||||||
|
static void GetSliderHorizontalBounds( const wxPoint &topleft, wxRect &dest );
|
||||||
|
|
||||||
static void GetGainRect(const wxPoint & topLeft, wxRect &dest);
|
static void GetGainRect(const wxPoint & topLeft, wxRect &dest);
|
||||||
|
|
||||||
static void GetPanRect(const wxPoint & topLeft, wxRect &dest);
|
static void GetPanRect(const wxPoint & topLeft, wxRect &dest);
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
static void GetVelocityRect(const wxPoint & topLeft, wxRect &dest);
|
static void GetVelocityRect(const wxPoint & topLeft, wxRect &dest);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void GetMinimizeHorizontalBounds( const wxRect &rect, wxRect &dest );
|
||||||
static void GetMinimizeRect(const wxRect & rect, wxRect &dest);
|
static void GetMinimizeRect(const wxRect & rect, wxRect &dest);
|
||||||
|
|
||||||
|
static void GetSyncLockHorizontalBounds( const wxRect &rect, wxRect &dest );
|
||||||
static void GetSyncLockIconRect(const wxRect & rect, wxRect &dest);
|
static void GetSyncLockIconRect(const wxRect & rect, wxRect &dest);
|
||||||
|
|
||||||
#ifdef USE_MIDI
|
#ifdef USE_MIDI
|
||||||
|
static void GetMidiControlsHorizontalBounds
|
||||||
|
( const wxRect &rect, wxRect &dest );
|
||||||
static void GetMidiControlsRect(const wxRect & rect, wxRect &dest);
|
static void GetMidiControlsRect(const wxRect & rect, wxRect &dest);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -124,22 +216,28 @@ public:
|
|||||||
static unsigned DefaultNoteTrackHeight();
|
static unsigned DefaultNoteTrackHeight();
|
||||||
static unsigned DefaultWaveTrackHeight();
|
static unsigned DefaultWaveTrackHeight();
|
||||||
|
|
||||||
LWSlider * GainSlider(WaveTrack *t, bool captured = false) const;
|
static LWSlider * GainSlider
|
||||||
LWSlider * PanSlider(WaveTrack *t, bool captured = false) const;
|
(const wxRect &sliderRect, const WaveTrack *t, bool captured,
|
||||||
|
wxWindow *pParent);
|
||||||
|
static LWSlider * PanSlider
|
||||||
|
(const wxRect &sliderRect, const WaveTrack *t, bool captured,
|
||||||
|
wxWindow *pParent);
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
LWSlider * VelocitySlider(NoteTrack *t, bool captured = false) const;
|
static LWSlider * VelocitySlider
|
||||||
|
(const wxRect &sliderRect, const NoteTrack *t, bool captured,
|
||||||
|
wxWindow *pParent);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void UpdatePrefs();
|
void UpdatePrefs();
|
||||||
|
|
||||||
TrackPanel * pParent;
|
TrackPanel * pParent;
|
||||||
wxFont mFont;
|
static wxFont gFont;
|
||||||
std::unique_ptr<LWSlider>
|
static std::unique_ptr<LWSlider>
|
||||||
mGainCaptured, mPanCaptured, mGain, mPan;
|
gGainCaptured, gPanCaptured, gGain, gPan;
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
std::unique_ptr<LWSlider> mVelocityCaptured, mVelocity;
|
static std::unique_ptr<LWSlider> gVelocityCaptured, gVelocity;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
friend class TrackPanel;
|
friend class TrackPanel;
|
||||||
@ -538,7 +636,7 @@ protected:
|
|||||||
// If label, rectangle includes track control panel only.
|
// If label, rectangle includes track control panel only.
|
||||||
// If !label, rectangle includes all of that, and the vertical ruler, and
|
// If !label, rectangle includes all of that, and the vertical ruler, and
|
||||||
// the proper track area.
|
// the proper track area.
|
||||||
virtual wxRect FindTrackRect(Track * target, bool label);
|
virtual wxRect FindTrackRect( const Track * target, bool label );
|
||||||
|
|
||||||
virtual int GetVRulerWidth() const;
|
virtual int GetVRulerWidth() const;
|
||||||
virtual int GetVRulerOffset() const { return mTrackInfo.GetTrackInfoWidth(); }
|
virtual int GetVRulerOffset() const { return mTrackInfo.GetTrackInfoWidth(); }
|
||||||
@ -583,19 +681,28 @@ protected:
|
|||||||
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
||||||
void UpdateVirtualStereoOrder();
|
void UpdateVirtualStereoOrder();
|
||||||
#endif
|
#endif
|
||||||
// Accessors...
|
|
||||||
virtual bool HasSoloButton(){ return mSoloPref!=wxT("None");}
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Accessors...
|
||||||
|
static bool HasSoloButton(){ return gSoloPref!=wxT("None");}
|
||||||
|
|
||||||
|
protected:
|
||||||
//JKC: These two belong in the label track.
|
//JKC: These two belong in the label track.
|
||||||
int mLabelTrackStartXPos;
|
int mLabelTrackStartXPos;
|
||||||
int mLabelTrackStartYPos;
|
int mLabelTrackStartYPos;
|
||||||
|
|
||||||
virtual wxString TrackSubText(WaveTrack *t);
|
|
||||||
|
|
||||||
TrackInfo mTrackInfo;
|
TrackInfo mTrackInfo;
|
||||||
public:
|
|
||||||
TrackInfo *GetTrackInfo() { return &mTrackInfo; }
|
public:
|
||||||
const TrackInfo *GetTrackInfo() const { return &mTrackInfo; }
|
|
||||||
|
LWSlider *GainSlider( const WaveTrack *wt );
|
||||||
|
LWSlider *PanSlider( const WaveTrack *wt );
|
||||||
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
|
LWSlider *VelocitySlider( const NoteTrack *nt );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TrackInfo *GetTrackInfo() { return &mTrackInfo; }
|
||||||
|
const TrackInfo *GetTrackInfo() const { return &mTrackInfo; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TrackPanelListener *mListener;
|
TrackPanelListener *mListener;
|
||||||
@ -757,6 +864,7 @@ protected:
|
|||||||
int mInitialUpperActualHeight;
|
int mInitialUpperActualHeight;
|
||||||
bool mAutoScrolling;
|
bool mAutoScrolling;
|
||||||
|
|
||||||
|
public:
|
||||||
enum MouseCaptureEnum
|
enum MouseCaptureEnum
|
||||||
{
|
{
|
||||||
IsUncaptured=0, // This is the normal state for the mouse
|
IsUncaptured=0, // This is the normal state for the mouse
|
||||||
@ -786,6 +894,7 @@ protected:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
enum MouseCaptureEnum mMouseCapture;
|
enum MouseCaptureEnum mMouseCapture;
|
||||||
virtual void SetCapturedTrack( Track * t, enum MouseCaptureEnum MouseCapture=IsUncaptured );
|
virtual void SetCapturedTrack( Track * t, enum MouseCaptureEnum MouseCapture=IsUncaptured );
|
||||||
|
|
||||||
@ -839,7 +948,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
wxString mSoloPref;
|
static wxString gSoloPref;
|
||||||
|
|
||||||
// Keeps track of extra fractional vertical scroll steps
|
// Keeps track of extra fractional vertical scroll steps
|
||||||
double mVertScrollRemainder;
|
double mVertScrollRemainder;
|
||||||
|
@ -156,6 +156,8 @@ class LWSlider
|
|||||||
|
|
||||||
static void DeleteSharedTipPanel();
|
static void DeleteSharedTipPanel();
|
||||||
|
|
||||||
|
void SetParent(wxWindow *parent) { mParent = parent; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
wxString GetTip(float value) const;
|
wxString GetTip(float value) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user