mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-26 17:18:41 +02:00
Move some constants and GetVRulerOffset() out of TrackPanel.h
This commit is contained in:
parent
98f322d685
commit
4c5b65d7f6
@ -84,7 +84,6 @@ audio tracks.
|
|||||||
#include "prefs/TracksPrefs.h"
|
#include "prefs/TracksPrefs.h"
|
||||||
#include "prefs/WaveformSettings.h"
|
#include "prefs/WaveformSettings.h"
|
||||||
#include "Spectrum.h"
|
#include "Spectrum.h"
|
||||||
#include "TrackPanel.h"
|
|
||||||
#include "ViewInfo.h"
|
#include "ViewInfo.h"
|
||||||
#include "widgets/Ruler.h"
|
#include "widgets/Ruler.h"
|
||||||
#include "AllThemeResources.h"
|
#include "AllThemeResources.h"
|
||||||
|
@ -915,6 +915,14 @@ const TrackInfo::TCPLine defaultWaveTrackTCPLines[] = {
|
|||||||
};
|
};
|
||||||
TCPLines waveTrackTCPLines{ RANGE(defaultWaveTrackTCPLines) };
|
TCPLines waveTrackTCPLines{ RANGE(defaultWaveTrackTCPLines) };
|
||||||
|
|
||||||
|
#ifdef USE_MIDI
|
||||||
|
enum : int {
|
||||||
|
// PRL: was it correct to include the margin?
|
||||||
|
kMidiCellWidth = ( ( kTrackInfoWidth + kLeftMargin ) / 4) - 2,
|
||||||
|
kMidiCellHeight = kTrackInfoBtnSize
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
const TrackInfo::TCPLine defaultNoteTrackTCPLines[] = {
|
const TrackInfo::TCPLine defaultNoteTrackTCPLines[] = {
|
||||||
COMMON_ITEMS
|
COMMON_ITEMS
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
@ -1245,7 +1253,7 @@ void TrackPanel::DrawEverythingElse(TrackPanelDrawingContext &context,
|
|||||||
if (region.Contains(
|
if (region.Contains(
|
||||||
0, trackRect.y, GetLeftOffset(), trackRect.height)) {
|
0, trackRect.y, GetLeftOffset(), trackRect.height)) {
|
||||||
wxRect rect{
|
wxRect rect{
|
||||||
GetVRulerOffset(),
|
mViewInfo->GetVRulerOffset(),
|
||||||
trackRect.y,
|
trackRect.y,
|
||||||
GetVRulerWidth() + 1,
|
GetVRulerWidth() + 1,
|
||||||
trackRect.height - kSeparatorThickness
|
trackRect.height - kSeparatorThickness
|
||||||
@ -1764,7 +1772,7 @@ void TrackPanel::DrawOutside
|
|||||||
rect.height -= kSeparatorThickness;
|
rect.height -= kSeparatorThickness;
|
||||||
|
|
||||||
int labelw = GetLabelWidth();
|
int labelw = GetLabelWidth();
|
||||||
int vrul = GetVRulerOffset();
|
int vrul = mViewInfo->GetVRulerOffset();
|
||||||
|
|
||||||
TrackInfo::DrawBackground( dc, rect, t->GetSelected(), vrul );
|
TrackInfo::DrawBackground( dc, rect, t->GetSelected(), vrul );
|
||||||
|
|
||||||
@ -1772,7 +1780,7 @@ void TrackPanel::DrawOutside
|
|||||||
// Draw sync-lock tiles in ruler area.
|
// Draw sync-lock tiles in ruler area.
|
||||||
//if (t->IsSyncLockSelected()) {
|
//if (t->IsSyncLockSelected()) {
|
||||||
// wxRect tileFill = rect;
|
// wxRect tileFill = rect;
|
||||||
// tileFill.x = GetVRulerOffset();
|
// tileFill.x = mViewInfo->GetVRulerOffset();
|
||||||
// tileFill.width = GetVRulerWidth();
|
// tileFill.width = GetVRulerWidth();
|
||||||
// TrackArt::DrawSyncLockTiles(dc, tileFill);
|
// TrackArt::DrawSyncLockTiles(dc, tileFill);
|
||||||
//}
|
//}
|
||||||
@ -1962,7 +1970,7 @@ void TrackPanel::UpdateTrackVRuler(const Track *t)
|
|||||||
if (!t)
|
if (!t)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxRect rect(GetVRulerOffset(),
|
wxRect rect(mViewInfo->GetVRulerOffset(),
|
||||||
kTopMargin,
|
kTopMargin,
|
||||||
GetVRulerWidth(),
|
GetVRulerWidth(),
|
||||||
0);
|
0);
|
||||||
@ -2336,6 +2344,11 @@ int TrackPanel::GetVRulerWidth() const
|
|||||||
return vrulerSize.x;
|
return vrulerSize.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TrackPanel::GetLabelWidth() const
|
||||||
|
{
|
||||||
|
return mViewInfo->GetVRulerOffset() + GetVRulerWidth();
|
||||||
|
}
|
||||||
|
|
||||||
/// Displays the bounds of the selection in the status bar.
|
/// Displays the bounds of the selection in the status bar.
|
||||||
void TrackPanel::DisplaySelection()
|
void TrackPanel::DisplaySelection()
|
||||||
{
|
{
|
||||||
|
@ -216,38 +216,6 @@ 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
|
class AUDACITY_DLL_API TrackPanel final
|
||||||
: public CellularPanel
|
: public CellularPanel
|
||||||
, public NonKeystrokeInterceptingWindow
|
, public NonKeystrokeInterceptingWindow
|
||||||
@ -361,11 +329,9 @@ protected:
|
|||||||
std::shared_ptr<TrackPanelNode> Root() override;
|
std::shared_ptr<TrackPanelNode> Root() override;
|
||||||
|
|
||||||
int GetVRulerWidth() const;
|
int GetVRulerWidth() const;
|
||||||
int GetVRulerOffset() const { return kTrackInfoWidth + kLeftMargin; }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int GetLabelWidth() const
|
int GetLabelWidth() const;
|
||||||
{ 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.
|
||||||
|
@ -28,6 +28,29 @@
|
|||||||
|
|
||||||
class AudacityProject;
|
class AudacityProject;
|
||||||
|
|
||||||
|
// See big pictorial comment in TrackPanel.cpp 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,
|
||||||
|
};
|
||||||
|
|
||||||
// The subset of ViewInfo information (other than selection)
|
// The subset of ViewInfo information (other than selection)
|
||||||
// that is sufficient for purposes of TrackArtist,
|
// that is sufficient for purposes of TrackArtist,
|
||||||
// and for computing conversions between track times and pixel positions.
|
// and for computing conversions between track times and pixel positions.
|
||||||
@ -209,6 +232,8 @@ public:
|
|||||||
|
|
||||||
ViewInfo(double start, double screenDuration, double pixelsPerSecond);
|
ViewInfo(double start, double screenDuration, double pixelsPerSecond);
|
||||||
|
|
||||||
|
int GetVRulerOffset() const { return kTrackInfoWidth + kLeftMargin; }
|
||||||
|
|
||||||
static int UpdateScrollPrefsID();
|
static int UpdateScrollPrefsID();
|
||||||
void UpdatePrefs() override;
|
void UpdatePrefs() override;
|
||||||
void UpdateSelectedPrefs( int id ) override;
|
void UpdateSelectedPrefs( int id ) override;
|
||||||
|
@ -717,11 +717,12 @@ void GetInfoCommand::ExploreTrackPanel( const CommandContext &context,
|
|||||||
{
|
{
|
||||||
AudacityProject * pProj = &context.project;
|
AudacityProject * pProj = &context.project;
|
||||||
auto &tp = TrackPanel::Get( *pProj );
|
auto &tp = TrackPanel::Get( *pProj );
|
||||||
|
auto &viewInfo = *tp.mViewInfo;
|
||||||
|
|
||||||
wxRect trackRect = pWin->GetRect();
|
wxRect trackRect = pWin->GetRect();
|
||||||
|
|
||||||
for ( auto t : TrackList::Get( *pProj ).Any() + IsVisibleTrack{ pProj } ) {
|
for ( auto t : TrackList::Get( *pProj ).Any() + IsVisibleTrack{ pProj } ) {
|
||||||
trackRect.y = t->GetY() - tp.mViewInfo->vpos;
|
trackRect.y = t->GetY() - viewInfo.vpos;
|
||||||
trackRect.height = t->GetHeight();
|
trackRect.height = t->GetHeight();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -760,7 +761,7 @@ void GetInfoCommand::ExploreTrackPanel( const CommandContext &context,
|
|||||||
R.height -= kTopInset;
|
R.height -= kTopInset;
|
||||||
|
|
||||||
int labelw = pTP->GetLabelWidth();
|
int labelw = pTP->GetLabelWidth();
|
||||||
int vrul = pTP->GetVRulerOffset();
|
//int vrul = viewInfo.GetVRulerOffset();
|
||||||
bool bIsWave = true;
|
bool bIsWave = true;
|
||||||
//mTrackInfo.DrawBackground(dc, R, t->GetSelected(), bIsWave, labelw, vrul);
|
//mTrackInfo.DrawBackground(dc, R, t->GetSelected(), bIsWave, labelw, vrul);
|
||||||
|
|
||||||
@ -776,7 +777,7 @@ void GetInfoCommand::ExploreTrackPanel( const CommandContext &context,
|
|||||||
// The VRuler.
|
// The VRuler.
|
||||||
{
|
{
|
||||||
wxRect R = trackRect;
|
wxRect R = trackRect;
|
||||||
R.x += tp.GetVRulerOffset();
|
R.x += viewInfo.GetVRulerOffset();
|
||||||
R.y += kTopMargin;
|
R.y += kTopMargin;
|
||||||
R.width = tp.GetVRulerWidth();
|
R.width = tp.GetVRulerWidth();
|
||||||
R.height -= (kTopMargin + kBottomMargin);
|
R.height -= (kTopMargin + kBottomMargin);
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "../../../../TrackPanel.h" // for TrackInfo
|
#include "../../../../TrackPanel.h" // for TrackInfo
|
||||||
#include "../../../../UndoManager.h"
|
#include "../../../../UndoManager.h"
|
||||||
#include "../../../../NoteTrack.h"
|
#include "../../../../NoteTrack.h"
|
||||||
|
#include "../../../../ViewInfo.h"
|
||||||
|
|
||||||
VelocitySliderHandle::VelocitySliderHandle
|
VelocitySliderHandle::VelocitySliderHandle
|
||||||
( SliderFn sliderFn, const wxRect &rect,
|
( SliderFn sliderFn, const wxRect &rect,
|
||||||
|
@ -11,10 +11,11 @@ Paul Licameli split from TrackPanel.cpp
|
|||||||
#include "../../Audacity.h"
|
#include "../../Audacity.h"
|
||||||
#include "TrackVRulerControls.h"
|
#include "TrackVRulerControls.h"
|
||||||
|
|
||||||
#include "../../TrackPanel.h"
|
|
||||||
#include "../../Track.h"
|
#include "../../Track.h"
|
||||||
|
#include "../../ViewInfo.h"
|
||||||
|
|
||||||
#include <wx/cursor.h>
|
#include <wx/cursor.h>
|
||||||
|
#include <wx/dc.h>
|
||||||
#include <wx/translation.h>
|
#include <wx/translation.h>
|
||||||
|
|
||||||
TrackVRulerControls::TrackVRulerControls( std::shared_ptr<Track> pTrack )
|
TrackVRulerControls::TrackVRulerControls( std::shared_ptr<Track> pTrack )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user