Audacity  2.2.2
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
TrackInfo Class Reference

The TrackInfo is shown to the side of a track It has the menus, pan and gain controls displayed in it. So "Info" is somewhat a misnomer. Should possibly be "TrackControls". More...

#include <TrackPanel.h>

Classes

struct  TCPLine
 

Public Member Functions

 TrackInfo (TrackPanel *pParentIn)
 
 ~TrackInfo ()
 
void ReCreateSliders ()
 
int GetTrackInfoWidth () const
 
void DrawBackground (wxDC *dc, const wxRect &rect, bool bSelected, bool bHasMuteSolo, const int labelw, const int vrul) const
 
void DrawBordersWithin (wxDC *dc, const wxRect &rect, const Track &track) const
 

Static Public Member Functions

static unsigned MinimumTrackHeight ()
 
static void DrawItems (TrackPanelDrawingContext &context, const wxRect &rect, const Track &track)
 
static void DrawItems (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack, const std::vector< TCPLine > &topLines, const std::vector< TCPLine > &bottomLines)
 
static void CloseTitleDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
static void MinimizeSyncLockDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
static void MidiControlsDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
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, bool highlight)
 
static void PanSliderDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
static void GainSliderDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
static void MuteOrSoloDrawFunction (wxDC *dc, const wxRect &rect, const Track *pTrack, bool down, bool captured, bool solo, bool hit)
 
static void WideMuteDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
static void WideSoloDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
static void MuteAndSoloDrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
static void StatusDrawFunction (const wxString &string, wxDC *dc, const wxRect &rect)
 
static void Status1DrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
static void Status2DrawFunction (TrackPanelDrawingContext &context, const wxRect &rect, const Track *pTrack)
 
static void SetTrackInfoFont (wxDC *dc)
 
static void GetCloseBoxHorizontalBounds (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 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 GetPanRect (const wxPoint &topLeft, wxRect &dest)
 
static void GetMinimizeHorizontalBounds (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 bool HideTopItem (const wxRect &rect, const wxRect &subRect, int allowance=0)
 
static unsigned DefaultNoteTrackHeight ()
 
static unsigned DefaultWaveTrackHeight ()
 
static LWSliderGainSlider (const wxRect &sliderRect, const WaveTrack *t, bool captured, wxWindow *pParent)
 
static LWSliderPanSlider (const wxRect &sliderRect, const WaveTrack *t, bool captured, wxWindow *pParent)
 

Private Member Functions

void UpdatePrefs ()
 

Private Attributes

TrackPanelpParent
 

Static Private Attributes

static wxFont gFont
 
static std::unique_ptr< LWSlidergGainCaptured
 
static std::unique_ptr< LWSlidergPanCaptured
 
static std::unique_ptr< LWSlidergGain
 
static std::unique_ptr< LWSlidergPan
 

Friends

class TrackPanel
 

Detailed Description

The TrackInfo is shown to the side of a track It has the menus, pan and gain controls displayed in it. So "Info" is somewhat a misnomer. Should possibly be "TrackControls".

TrackPanel and not TrackInfo takes care of the functionality for each of the buttons in that panel.

In its current implementation TrackInfo is not derived from a wxWindow. Following the original coding style, it has been coded as a 'flyweight' class, which is passed state as needed, except for the array of gains and pans.

If we'd instead coded it as a wxWindow, we would have an instance of this class for each instance displayed.

Definition at line 76 of file TrackPanel.h.

Constructor & Destructor Documentation

TrackInfo::TrackInfo ( TrackPanel pParentIn)

Definition at line 2891 of file TrackPanel.cpp.

References pParent, ReCreateSliders(), and UpdatePrefs().

2892 {
2893  pParent = pParentIn;
2894 
2895  ReCreateSliders();
2896 
2897  UpdatePrefs();
2898 }
void ReCreateSliders()
void UpdatePrefs()
TrackPanel * pParent
Definition: TrackPanel.h:226
TrackInfo::~TrackInfo ( )

Definition at line 2900 of file TrackPanel.cpp.

2901 {
2902 }

Member Function Documentation

void TrackInfo::CloseTitleDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)
static

Definition at line 2000 of file TrackPanel.cpp.

References _(), AColor::Arrow(), AColor::Bevel2(), ThemeBase::Colour(), TrackPanelDrawingContext::dc, Track::GetName(), Track::GetSelected(), ButtonHandle::GetTrack(), TrackPanelDrawingContext::lastState, AColor::Line(), TrackPanelDrawingContext::target, and theTheme.

2002 {
2003  auto dc = &context.dc;
2004  bool selected = pTrack ? pTrack->GetSelected() : true;
2005  {
2006  wxRect bev = rect;
2007  GetCloseBoxHorizontalBounds( rect, bev );
2008  auto target = dynamic_cast<CloseButtonHandle*>( context.target.get() );
2009  bool hit = target && target->GetTrack().get() == pTrack;
2010  bool captured = hit && target->IsClicked();
2011  bool down = captured && bev.Contains( context.lastState.GetPosition());
2012  AColor::Bevel2(*dc, !down, bev, selected, hit );
2013 
2014 #ifdef EXPERIMENTAL_THEMING
2015  wxPen pen( theTheme.Colour( clrTrackPanelText ));
2016  dc->SetPen( pen );
2017 #else
2018  dc->SetPen(*wxBLACK_PEN);
2019 #endif
2020  bev.Inflate( -1, -1 );
2021  // Draw the "X"
2022  const int s = 6;
2023 
2024  int ls = bev.x + ((bev.width - s) / 2);
2025  int ts = bev.y + ((bev.height - s) / 2);
2026  int rs = ls + s;
2027  int bs = ts + s;
2028 
2029  AColor::Line(*dc, ls, ts, rs, bs);
2030  AColor::Line(*dc, ls + 1, ts, rs + 1, bs);
2031  AColor::Line(*dc, rs, ts, ls, bs);
2032  AColor::Line(*dc, rs + 1, ts, ls + 1, bs);
2033 
2034  // bev.Inflate(-1, -1);
2035  }
2036 
2037  {
2038  wxRect bev = rect;
2039  GetTitleBarHorizontalBounds( rect, bev );
2040  auto target = dynamic_cast<MenuButtonHandle*>( context.target.get() );
2041  bool hit = target && target->GetTrack().get() == pTrack;
2042  bool captured = hit && target->IsClicked();
2043  bool down = captured && bev.Contains( context.lastState.GetPosition());
2044  wxString titleStr =
2045  pTrack ? pTrack->GetName() : _("Name");
2046 
2047  //bev.Inflate(-1, -1);
2048  AColor::Bevel2(*dc, !down, bev, selected, hit);
2049 
2050  // Draw title text
2051  SetTrackInfoFont(dc);
2052 
2053  // Bug 1660 The 'k' of 'Audio Track' was being truncated.
2054  // Constant of 32 found by counting pixels on a windows machine.
2055  // I believe it's the size of the X close button + the size of the
2056  // drop down arrow.
2057  int allowableWidth = rect.width - 32;
2058 
2059  wxCoord textWidth, textHeight;
2060  dc->GetTextExtent(titleStr, &textWidth, &textHeight);
2061  while (textWidth > allowableWidth) {
2062  titleStr = titleStr.Left(titleStr.Length() - 1);
2063  dc->GetTextExtent(titleStr, &textWidth, &textHeight);
2064  }
2065 
2066  // Pop-up triangle
2067  #ifdef EXPERIMENTAL_THEMING
2068  wxColour c = theTheme.Colour( clrTrackPanelText );
2069  #else
2070  wxColour c = *wxBLACK;
2071  #endif
2072 
2073  // wxGTK leaves little scraps (antialiasing?) of the
2074  // characters if they are repeatedly drawn. This
2075  // happens when holding down mouse button and moving
2076  // in and out of the title bar. So clear it first.
2077  // AColor::MediumTrackInfo(dc, t->GetSelected());
2078  // dc->DrawRectangle(bev);
2079 
2080  dc->SetTextForeground( c );
2081  dc->SetTextBackground( wxTRANSPARENT );
2082  dc->DrawText(titleStr, bev.x + 2, bev.y + (bev.height - textHeight) / 2);
2083 
2084 
2085 
2086  dc->SetPen(c);
2087  dc->SetBrush(c);
2088 
2089  int s = 10; // Width of dropdown arrow...height is half of width
2090  AColor::Arrow(*dc,
2091  bev.GetRight() - s - 3, // 3 to offset from right border
2092  bev.y + ((bev.height - (s / 2)) / 2),
2093  s);
2094 
2095  }
2096 }
static void SetTrackInfoFont(wxDC *dc)
static void GetCloseBoxHorizontalBounds(const wxRect &rect, wxRect &dest)
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
bool GetSelected() const
Definition: Track.h:276
static void Arrow(wxDC &dc, wxCoord x, wxCoord y, int width, bool down=true)
Definition: AColor.cpp:96
static void Bevel2(wxDC &dc, bool up, const wxRect &r, bool bSel=false, bool bHighlight=false)
Definition: AColor.cpp:222
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:28
static void GetTitleBarHorizontalBounds(const wxRect &rect, wxRect &dest)
wxString GetName() const
Definition: Track.h:271
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:122
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1225
unsigned TrackInfo::DefaultNoteTrackHeight ( )
static

Definition at line 3248 of file TrackPanel.cpp.

3249 {
3250  return DefaultTrackHeight( noteTrackTCPLines );
3251 }
unsigned TrackInfo::DefaultWaveTrackHeight ( )
static

Definition at line 3253 of file TrackPanel.cpp.

Referenced by WaveTrack::WaveTrack().

3254 {
3255  return DefaultTrackHeight( waveTrackTCPLines );
3256 }
void TrackInfo::DrawBackground ( wxDC *  dc,
const wxRect &  rect,
bool  bSelected,
bool  bHasMuteSolo,
const int  labelw,
const int  vrul 
) const

Definition at line 3199 of file TrackPanel.cpp.

References AColor::BevelTrackInfo(), and AColor::MediumTrackInfo().

3201 {
3202  //compiler food.
3203  static_cast<void>(bHasMuteSolo);
3204  static_cast<void>(vrul);
3205 
3206  // fill in label
3207  wxRect fill = rect;
3208  fill.width = labelw-4;
3209  AColor::MediumTrackInfo(dc, bSelected);
3210  dc->DrawRectangle(fill);
3211 
3212 #ifdef USE_BEVELS
3213  // This branch is not now used
3214  // PRL: todo: banish magic numbers
3215  if( bHasMuteSolo )
3216  {
3217  int ylast = rect.height-20;
3218  int ybutton = wxMin(32,ylast-17);
3219  int ybuttonEnd = 67;
3220 
3221  fill=wxRect( rect.x+1, rect.y+17, vrul-6, ybutton);
3222  AColor::BevelTrackInfo( *dc, true, fill );
3223 
3224  if( ybuttonEnd < ylast ){
3225  fill=wxRect( rect.x+1, rect.y+ybuttonEnd, fill.width, ylast - ybuttonEnd);
3226  AColor::BevelTrackInfo( *dc, true, fill );
3227  }
3228  }
3229  else
3230  {
3231  fill=wxRect( rect.x+1, rect.y+17, vrul-6, rect.height-37);
3232  AColor::BevelTrackInfo( *dc, true, fill );
3233  }
3234 #endif
3235 }
static void MediumTrackInfo(wxDC *dc, bool selected)
Definition: AColor.cpp:328
static void BevelTrackInfo(wxDC &dc, bool up, const wxRect &r, bool highlight=false)
Definition: AColor.cpp:262
void TrackInfo::DrawBordersWithin ( wxDC *  dc,
const wxRect &  rect,
const Track track 
) const

Definition at line 3146 of file TrackPanel.cpp.

References AColor::Dark(), HideTopItem(), and AColor::Line().

3147 {
3148  AColor::Dark(dc, false); // same color as border of toolbars (ToolBar::OnPaint())
3149 
3150  // below close box and title bar
3151  wxRect buttonRect;
3152  GetTitleBarRect( rect, buttonRect );
3153  AColor::Line
3154  (*dc, rect.x, buttonRect.y + buttonRect.height,
3155  rect.width - 1, buttonRect.y + buttonRect.height);
3156 
3157  // between close box and title bar
3158  AColor::Line
3159  (*dc, buttonRect.x, buttonRect.y,
3160  buttonRect.x, buttonRect.y + buttonRect.height - 1);
3161 
3162  GetMuteSoloRect( rect, buttonRect, false, true, &track );
3163 
3164  bool bHasMuteSolo = dynamic_cast<const PlayableTrack*>( &track ) != NULL;
3165  if( bHasMuteSolo && !TrackInfo::HideTopItem( rect, buttonRect ) )
3166  {
3167  // above mute/solo
3168  AColor::Line
3169  (*dc, rect.x, buttonRect.y,
3170  rect.width - 1, buttonRect.y);
3171 
3172  // between mute/solo
3173  // Draw this little line; if there is no solo, wide mute button will
3174  // overpaint it later:
3175  AColor::Line
3176  (*dc, buttonRect.x + buttonRect.width, buttonRect.y,
3177  buttonRect.x + buttonRect.width, buttonRect.y + buttonRect.height - 1);
3178 
3179  // below mute/solo
3180  AColor::Line
3181  (*dc, rect.x, buttonRect.y + buttonRect.height,
3182  rect.width - 1, buttonRect.y + buttonRect.height);
3183  }
3184 
3185  // left of and above minimize button
3186  wxRect minimizeRect;
3187  this->GetMinimizeRect(rect, minimizeRect);
3188  AColor::Line
3189  (*dc, minimizeRect.x - 1, minimizeRect.y,
3190  minimizeRect.x - 1, minimizeRect.y + minimizeRect.height - 1);
3191  AColor::Line
3192  (*dc, minimizeRect.x, minimizeRect.y - 1,
3193  minimizeRect.x + minimizeRect.width - 1, minimizeRect.y - 1);
3194 }
static void Dark(wxDC *dc, bool selected, bool highlight=false)
Definition: AColor.cpp:338
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:122
An AudioTrack that can be played and stopped.
Definition: Track.h:376
static void GetMinimizeRect(const wxRect &rect, wxRect &dest)
static bool HideTopItem(const wxRect &rect, const wxRect &subRect, int allowance=0)
static void GetTitleBarRect(const wxRect &rect, wxRect &dest)
static void GetMuteSoloRect(const wxRect &rect, wxRect &dest, bool solo, bool bHasSoloButton, const Track *pTrack)
void TrackInfo::DrawItems ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track track 
)
static

Definition at line 1952 of file TrackPanel.cpp.

Referenced by TrackPanel::DrawOutside().

1954 {
1955  const auto topLines = getTCPLines( track );
1956  const auto bottomLines = commonTrackTCPBottomLines;
1957  DrawItems
1958  ( context, rect, &track, topLines, bottomLines );
1959 }
static void DrawItems(TrackPanelDrawingContext &context, const wxRect &rect, const Track &track)
void TrackInfo::DrawItems ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack,
const std::vector< TCPLine > &  topLines,
const std::vector< TCPLine > &  bottomLines 
)
static

Definition at line 1962 of file TrackPanel.cpp.

References ThemeBase::Colour(), TrackPanelDrawingContext::dc, HideTopItem(), SetTrackInfoFont(), and theTheme.

1965 {
1966  auto dc = &context.dc;
1968  dc->SetTextForeground(theTheme.Colour(clrTrackPanelText));
1969 
1970  {
1971  int yy = 0;
1972  for ( const auto &line : topLines ) {
1973  wxRect itemRect{
1974  rect.x, rect.y + yy,
1975  rect.width, line.height
1976  };
1977  if ( !TrackInfo::HideTopItem( rect, itemRect ) &&
1978  line.drawFunction )
1979  line.drawFunction( context, itemRect, pTrack );
1980  yy += line.height + line.extraSpace;
1981  }
1982  }
1983  {
1984  int yy = rect.height;
1985  for ( const auto &line : bottomLines ) {
1986  yy -= line.height + line.extraSpace;
1987  if ( line.drawFunction ) {
1988  wxRect itemRect{
1989  rect.x, rect.y + yy,
1990  rect.width, line.height
1991  };
1992  line.drawFunction( context, itemRect, pTrack );
1993  }
1994  }
1995  }
1996 }
static void SetTrackInfoFont(wxDC *dc)
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
static bool HideTopItem(const wxRect &rect, const wxRect &subRect, int allowance=0)
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1225
LWSlider * TrackInfo::GainSlider ( const wxRect &  sliderRect,
const WaveTrack t,
bool  captured,
wxWindow *  pParent 
)
static

Definition at line 3270 of file TrackPanel.cpp.

References GetActiveProject(), and WaveTrack::GetGain().

Referenced by TrackPanel::GainSlider(), GainSliderDrawFunction(), and GainSliderHandle::HitTest().

3271 {
3272  wxPoint pos = sliderRect.GetPosition();
3273  float gain = t ? t->GetGain() : 1.0;
3274 
3275  gGain->Move(pos);
3276  gGain->Set(gain);
3277  gGainCaptured->Move(pos);
3278  gGainCaptured->Set(gain);
3279 
3280  auto slider = (captured ? gGainCaptured : gGain).get();
3281  slider->SetParent( pParent ? pParent : ::GetActiveProject() );
3282  return slider;
3283 }
TrackPanel * pParent
Definition: TrackPanel.h:226
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:308
float GetGain() const
Definition: WaveTrack.cpp:415
static std::unique_ptr< LWSlider > gGain
Definition: TrackPanel.h:231
static std::unique_ptr< LWSlider > gGainCaptured
Definition: TrackPanel.h:229
void TrackInfo::GainSliderDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)
static

Definition at line 2194 of file TrackPanel.cpp.

References TrackPanelDrawingContext::dc, GainSlider(), and TrackPanelDrawingContext::target.

2196 {
2197  auto target = dynamic_cast<GainSliderHandle*>( context.target.get() );
2198  auto dc = &context.dc;
2199  bool hit = target && target->GetTrack().get() == pTrack;
2200  if( hit )
2201  hit=hit;
2202  bool captured = hit && target->IsClicked();
2203  SliderDrawFunction<WaveTrack>
2204  ( &TrackInfo::GainSlider, dc, rect, pTrack, captured, hit);
2205 }
static LWSlider * GainSlider(const wxRect &sliderRect, const WaveTrack *t, bool captured, wxWindow *pParent)
void TrackInfo::GetCloseBoxHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)
static

Definition at line 2962 of file TrackPanel.cpp.

References kTrackInfoBtnSize.

Referenced by GetCloseBoxRect(), and GetTitleBarHorizontalBounds().

2963 {
2964  dest.x = rect.x;
2965  dest.width = kTrackInfoBtnSize;
2966 }
void TrackInfo::GetCloseBoxRect ( const wxRect &  rect,
wxRect &  dest 
)
static

Definition at line 2968 of file TrackPanel.cpp.

References GetCloseBoxHorizontalBounds().

Referenced by CloseButtonHandle::HitTest().

2969 {
2970  GetCloseBoxHorizontalBounds( rect, dest );
2971  auto results = CalcItemY( commonTrackTCPLines, kItemBarButtons );
2972  dest.y = rect.y + results.first;
2973  dest.height = results.second;
2974 }
static void GetCloseBoxHorizontalBounds(const wxRect &rect, wxRect &dest)
void TrackInfo::GetGainRect ( const wxPoint &  topLeft,
wxRect &  dest 
)
static

Definition at line 3055 of file TrackPanel.cpp.

References GetSliderHorizontalBounds().

Referenced by TrackPanel::GainSlider(), GetPanRect(), GainSliderHandle::HitTest(), and ReCreateSliders().

3056 {
3057  GetSliderHorizontalBounds( topleft, dest );
3058  auto results = CalcItemY( waveTrackTCPLines, kItemGain );
3059  dest.y = topleft.y + results.first;
3060  dest.height = results.second;
3061 }
static void GetSliderHorizontalBounds(const wxPoint &topleft, wxRect &dest)
void TrackInfo::GetMinimizeHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)
static

Definition at line 3080 of file TrackPanel.cpp.

References GetSyncLockHorizontalBounds().

Referenced by GetMinimizeRect().

3081 {
3082  const int space = 0;// was 3.
3083  dest.x = rect.x + space;
3084 
3085  wxRect syncLockRect;
3086  GetSyncLockHorizontalBounds( rect, syncLockRect );
3087 
3088  // Width is rect.width less space on left for track select
3089  // and on right for sync-lock icon.
3090  dest.width = rect.width - (space + syncLockRect.width);
3091 }
static void GetSyncLockHorizontalBounds(const wxRect &rect, wxRect &dest)
void TrackInfo::GetMinimizeRect ( const wxRect &  rect,
wxRect &  dest 
)
static

Definition at line 3093 of file TrackPanel.cpp.

References GetMinimizeHorizontalBounds().

Referenced by MinimizeButtonHandle::HitTest().

3094 {
3095  GetMinimizeHorizontalBounds( rect, dest );
3096  auto results = CalcBottomItemY
3097  ( commonTrackTCPBottomLines, kItemMinimize, rect.height);
3098  dest.y = rect.y + results.first;
3099  dest.height = results.second;
3100 }
static void GetMinimizeHorizontalBounds(const wxRect &rect, wxRect &dest)
void TrackInfo::GetMuteSoloRect ( const wxRect &  rect,
wxRect &  dest,
bool  solo,
bool  bHasSoloButton,
const Track pTrack 
)
static

Definition at line 3018 of file TrackPanel.cpp.

Referenced by MuteButtonHandle::HitTest(), and SoloButtonHandle::HitTest().

3020 {
3021 
3022  auto resultsM = CalcItemY( getTCPLines( *pTrack ), kItemMute );
3023  auto resultsS = CalcItemY( getTCPLines( *pTrack ), kItemSolo );
3024  dest.height = resultsS.second;
3025 
3026  int yMute = resultsM.first;
3027  int ySolo = resultsS.first;
3028 
3029  bool bSameRow = ( yMute == ySolo );
3030  bool bNarrow = bSameRow && bHasSoloButton;
3031 
3032  if( bNarrow )
3033  {
3034  if( solo )
3035  GetNarrowSoloHorizontalBounds( rect, dest );
3036  else
3037  GetNarrowMuteHorizontalBounds( rect, dest );
3038  }
3039  else
3040  GetWideMuteSoloHorizontalBounds( rect, dest );
3041 
3042  if( bSameRow || !solo )
3043  dest.y = rect.y + yMute;
3044  else
3045  dest.y = rect.y + ySolo;
3046 
3047 }
static void GetWideMuteSoloHorizontalBounds(const wxRect &rect, wxRect &dest)
static void GetNarrowSoloHorizontalBounds(const wxRect &rect, wxRect &dest)
static void GetNarrowMuteHorizontalBounds(const wxRect &rect, wxRect &dest)
void TrackInfo::GetNarrowMuteHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)
static

Definition at line 2995 of file TrackPanel.cpp.

Referenced by GetNarrowSoloHorizontalBounds().

2996 {
2997  dest.x = rect.x;
2998  dest.width = rect.width / 2 + 1;
2999 }
void TrackInfo::GetNarrowSoloHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)
static

Definition at line 3001 of file TrackPanel.cpp.

References GetNarrowMuteHorizontalBounds(), and TitleSoloBorderOverlap.

3002 {
3003  wxRect muteRect;
3004  GetNarrowMuteHorizontalBounds( rect, muteRect );
3005  dest.x = rect.x + muteRect.width;
3006  dest.width = rect.width - muteRect.width + TitleSoloBorderOverlap;
3007 }
static const int TitleSoloBorderOverlap
static void GetNarrowMuteHorizontalBounds(const wxRect &rect, wxRect &dest)
void TrackInfo::GetPanRect ( const wxPoint &  topLeft,
wxRect &  dest 
)
static

Definition at line 3063 of file TrackPanel.cpp.

References GetGainRect().

Referenced by PanSliderHandle::HitTest(), TrackPanel::PanSlider(), and ReCreateSliders().

3064 {
3065  GetGainRect( topleft, dest );
3066  auto results = CalcItemY( waveTrackTCPLines, kItemPan );
3067  dest.y = topleft.y + results.first;
3068 }
static void GetGainRect(const wxPoint &topLeft, wxRect &dest)
void TrackInfo::GetSliderHorizontalBounds ( const wxPoint &  topleft,
wxRect &  dest 
)
static

Definition at line 3049 of file TrackPanel.cpp.

References kTrackInfoSliderWidth.

Referenced by GetGainRect(), and SliderDrawFunction().

3050 {
3051  dest.x = topleft.x + 6;
3052  dest.width = kTrackInfoSliderWidth;
3053 }
void TrackInfo::GetSyncLockHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)
static

Definition at line 3102 of file TrackPanel.cpp.

References kTrackInfoBtnSize.

Referenced by GetMinimizeHorizontalBounds(), and GetSyncLockIconRect().

3103 {
3104  dest.width = kTrackInfoBtnSize;
3105  dest.x = rect.x + rect.width - dest.width;
3106 }
void TrackInfo::GetSyncLockIconRect ( const wxRect &  rect,
wxRect &  dest 
)
static

Definition at line 3108 of file TrackPanel.cpp.

References GetSyncLockHorizontalBounds().

3109 {
3110  GetSyncLockHorizontalBounds( rect, dest );
3111  auto results = CalcBottomItemY
3112  ( commonTrackTCPBottomLines, kItemSyncLock, rect.height);
3113  dest.y = rect.y + results.first;
3114  dest.height = results.second;
3115 }
static void GetSyncLockHorizontalBounds(const wxRect &rect, wxRect &dest)
void TrackInfo::GetTitleBarHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)
static

Definition at line 2978 of file TrackPanel.cpp.

References GetCloseBoxHorizontalBounds(), and TitleSoloBorderOverlap.

Referenced by GetTitleBarRect().

2979 {
2980  // to right of CloseBoxRect, plus a little more
2981  wxRect closeRect;
2982  GetCloseBoxHorizontalBounds( rect, closeRect );
2983  dest.x = rect.x + closeRect.width + 1;
2984  dest.width = rect.x + rect.width - dest.x + TitleSoloBorderOverlap;
2985 }
static void GetCloseBoxHorizontalBounds(const wxRect &rect, wxRect &dest)
static const int TitleSoloBorderOverlap
void TrackInfo::GetTitleBarRect ( const wxRect &  rect,
wxRect &  dest 
)
static

Definition at line 2987 of file TrackPanel.cpp.

References GetTitleBarHorizontalBounds().

Referenced by TrackControls::DoContextMenu(), and MenuButtonHandle::HitTest().

2988 {
2989  GetTitleBarHorizontalBounds( rect, dest );
2990  auto results = CalcItemY( commonTrackTCPLines, kItemBarButtons );
2991  dest.y = rect.y + results.first;
2992  dest.height = results.second;
2993 }
static void GetTitleBarHorizontalBounds(const wxRect &rect, wxRect &dest)
int TrackInfo::GetTrackInfoWidth ( ) const

Definition at line 2957 of file TrackPanel.cpp.

References kTrackInfoWidth.

Referenced by UpdatePrefs().

2958 {
2959  return kTrackInfoWidth;
2960 }
void TrackInfo::GetWideMuteSoloHorizontalBounds ( const wxRect &  rect,
wxRect &  dest 
)
static

Definition at line 3009 of file TrackPanel.cpp.

References kTrackInfoBtnSize.

3010 {
3011  // Larger button, symmetrically placed intended.
3012  // On windows this gives 15 pixels each side.
3013  dest.width = rect.width - 2 * kTrackInfoBtnSize + 6;
3014  dest.x = rect.x + kTrackInfoBtnSize -3;
3015 }
bool TrackInfo::HideTopItem ( const wxRect &  rect,
const wxRect &  subRect,
int  allowance = 0 
)
static

Definition at line 1320 of file TrackPanel.cpp.

Referenced by DrawBordersWithin(), DrawItems(), MuteButtonHandle::HitTest(), GainSliderHandle::HitTest(), SoloButtonHandle::HitTest(), and PanSliderHandle::HitTest().

1321  {
1322  auto limit = CalcBottomItemY
1323  ( commonTrackTCPBottomLines, kHighestBottomItem, rect.height).first;
1324  // Return true if the rectangle is even touching the limit
1325  // without an overlap. That was the behavior as of 2.1.3.
1326  return subRect.y + subRect.height - allowance >= rect.y + limit;
1327 }
void TrackInfo::MidiControlsDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)
static

Definition at line 2152 of file TrackPanel.cpp.

References TrackPanelDrawingContext::dc, Track::GetChannel(), NoteTrackButtonHandle::GetTrack(), and TrackPanelDrawingContext::target.

2154 {
2155 #ifdef EXPERIMENTAL_MIDI_OUT
2156  auto target = dynamic_cast<NoteTrackButtonHandle*>( context.target.get() );
2157  bool hit = target && target->GetTrack().get() == pTrack;
2158  auto channel = hit ? target->GetChannel() : -1;
2159  auto &dc = context.dc;
2160  wxRect midiRect = rect;
2161  GetMidiControlsHorizontalBounds(rect, midiRect);
2162  NoteTrack::DrawLabelControls
2163  ( static_cast<const NoteTrack *>(pTrack), dc, midiRect, channel );
2164 #endif // EXPERIMENTAL_MIDI_OUT
2165 }
virtual int GetChannel() const
Definition: Track.h:286
std::shared_ptr< NoteTrack > GetTrack() const
void TrackInfo::MinimizeSyncLockDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)
static

Definition at line 2099 of file TrackPanel.cpp.

References AColor::Arrow(), AColor::Bevel2(), ThemeBase::Colour(), AColor::Dark(), TrackPanelDrawingContext::dc, Track::GetMinimized(), Track::GetSelected(), ButtonHandle::GetTrack(), ThemeBase::Image(), Track::IsSyncLockSelected(), TrackPanelDrawingContext::lastState, TrackPanelDrawingContext::target, and theTheme.

2101 {
2102  auto dc = &context.dc;
2103  bool selected = pTrack ? pTrack->GetSelected() : true;
2104  bool syncLockSelected = pTrack ? pTrack->IsSyncLockSelected() : true;
2105  bool minimized = pTrack ? pTrack->GetMinimized() : false;
2106  {
2107  wxRect bev = rect;
2108  GetMinimizeHorizontalBounds(rect, bev);
2109  auto target = dynamic_cast<MinimizeButtonHandle*>( context.target.get() );
2110  bool hit = target && target->GetTrack().get() == pTrack;
2111  bool captured = hit && target->IsClicked();
2112  bool down = captured && bev.Contains( context.lastState.GetPosition());
2113 
2114  // Clear background to get rid of previous arrow
2115  //AColor::MediumTrackInfo(dc, t->GetSelected());
2116  //dc->DrawRectangle(bev);
2117 
2118  AColor::Bevel2(*dc, !down, bev, selected, hit);
2119 
2120 #ifdef EXPERIMENTAL_THEMING
2121  wxColour c = theTheme.Colour(clrTrackPanelText);
2122  dc->SetBrush(c);
2123  dc->SetPen(c);
2124 #else
2125  AColor::Dark(dc, selected);
2126 #endif
2127 
2128  AColor::Arrow(*dc,
2129  bev.x - 5 + bev.width / 2,
2130  bev.y - 2 + bev.height / 2,
2131  10,
2132  minimized);
2133  }
2134 
2135  // Draw the sync-lock indicator if this track is in a sync-lock selected group.
2136  if (syncLockSelected)
2137  {
2138  wxRect syncLockIconRect = rect;
2139 
2140  GetSyncLockHorizontalBounds( rect, syncLockIconRect );
2141  wxBitmap syncLockBitmap(theTheme.Image(bmpSyncLockIcon));
2142  // Icon is 12x12 and syncLockIconRect is 16x16.
2143  dc->DrawBitmap(syncLockBitmap,
2144  syncLockIconRect.x + 3,
2145  syncLockIconRect.y + 2,
2146  true);
2147  }
2148 }
AUDACITY_DLL_API Theme theTheme
Definition: Theme.cpp:209
bool GetSelected() const
Definition: Track.h:276
static void Arrow(wxDC &dc, wxCoord x, wxCoord y, int width, bool down=true)
Definition: AColor.cpp:96
static void Bevel2(wxDC &dc, bool up, const wxRect &r, bool bSel=false, bool bHighlight=false)
Definition: AColor.cpp:222
bool IsSyncLockSelected() const
Definition: Track.cpp:295
bool GetMinimized() const
Definition: Track.cpp:214
static void Dark(wxDC *dc, bool selected, bool highlight=false)
Definition: AColor.cpp:338
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:28
wxImage & Image(int iIndex)
Definition: Theme.cpp:1251
static void GetMinimizeHorizontalBounds(const wxRect &rect, wxRect &dest)
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1225
static void GetSyncLockHorizontalBounds(const wxRect &rect, wxRect &dest)
unsigned TrackInfo::MinimumTrackHeight ( )
static

Definition at line 1308 of file TrackPanel.cpp.

References kBottomMargin, and kTopMargin.

Referenced by AudacityProject::DoZoomFitV(), and Track::GetMinimizedHeight().

1309 {
1310  unsigned height = 0;
1311  if (!commonTrackTCPLines.empty())
1312  height += commonTrackTCPLines.front().height;
1313  if (!commonTrackTCPBottomLines.empty())
1314  height += commonTrackTCPBottomLines.front().height;
1315  // + 1 prevents the top item from disappearing for want of enough space,
1316  // according to the rules in HideTopItem.
1317  return height + kTopMargin + kBottomMargin + 1;
1318 }
void TrackInfo::MuteAndSoloDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)
static

Definition at line 2303 of file TrackPanel.cpp.

References TrackPanelDrawingContext::dc, ButtonHandle::GetTrack(), TrackPanel::HasSoloButton(), TrackPanelDrawingContext::lastState, and TrackPanelDrawingContext::target.

2305 {
2306  auto dc = &context.dc;
2307  bool bHasSoloButton = TrackPanel::HasSoloButton();
2308 
2309  wxRect bev = rect;
2310  if ( bHasSoloButton )
2311  GetNarrowMuteHorizontalBounds( rect, bev );
2312  else
2313  GetWideMuteSoloHorizontalBounds( rect, bev );
2314  {
2315  auto target = dynamic_cast<MuteButtonHandle*>( context.target.get() );
2316  bool hit = target && target->GetTrack().get() == pTrack;
2317  bool captured = hit && target->IsClicked();
2318  bool down = captured && bev.Contains( context.lastState.GetPosition());
2319  MuteOrSoloDrawFunction( dc, bev, pTrack, down, captured, false, hit );
2320  }
2321 
2322  if( !bHasSoloButton )
2323  return;
2324 
2325  GetNarrowSoloHorizontalBounds( rect, bev );
2326  {
2327  auto target = dynamic_cast<SoloButtonHandle*>( context.target.get() );
2328  bool hit = target && target->GetTrack().get() == pTrack;
2329  bool captured = hit && target->IsClicked();
2330  bool down = captured && bev.Contains( context.lastState.GetPosition());
2331  MuteOrSoloDrawFunction( dc, bev, pTrack, down, captured, true, hit );
2332  }
2333 }
static void GetWideMuteSoloHorizontalBounds(const wxRect &rect, wxRect &dest)
static void GetNarrowSoloHorizontalBounds(const wxRect &rect, wxRect &dest)
static void MuteOrSoloDrawFunction(wxDC *dc, const wxRect &rect, const Track *pTrack, bool down, bool captured, bool solo, bool hit)
static bool HasSoloButton()
Definition: TrackPanel.h:430
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:28
static void GetNarrowMuteHorizontalBounds(const wxRect &rect, wxRect &dest)
void TrackInfo::MuteOrSoloDrawFunction ( wxDC *  dc,
const wxRect &  rect,
const Track pTrack,
bool  down,
bool  captured,
bool  solo,
bool  hit 
)
static

Definition at line 2223 of file TrackPanel.cpp.

References _(), AColor::Bevel2(), Track::GetSelected(), AColor::MediumTrackInfo(), AColor::Mute(), and AColor::Solo().

2226 {
2227  //bev.Inflate(-1, -1);
2228  bool selected = pTrack ? pTrack->GetSelected() : true;
2229  auto pt = dynamic_cast<const PlayableTrack *>(pTrack);
2230  bool value = pt ? (solo ? pt->GetSolo() : pt->GetMute()) : false;
2231 
2232 #if 0
2233  AColor::MediumTrackInfo( dc, t->GetSelected());
2234  if( solo )
2235  {
2236  if( pt && pt->GetSolo() )
2237  {
2238  AColor::Solo(dc, pt->GetSolo(), t->GetSelected());
2239  }
2240  }
2241  else
2242  {
2243  if( pt && pt->GetMute() )
2244  {
2245  AColor::Mute(dc, pt->GetMute(), t->GetSelected(), pt->GetSolo());
2246  }
2247  }
2248  //(solo) ? AColor::Solo(dc, t->GetSolo(), t->GetSelected()) :
2249  // AColor::Mute(dc, t->GetMute(), t->GetSelected(), t->GetSolo());
2250  dc->SetPen( *wxTRANSPARENT_PEN );//No border!
2251  dc->DrawRectangle(bev);
2252 #endif
2253 
2254  wxCoord textWidth, textHeight;
2255  wxString str = (solo) ?
2256  /* i18n-hint: This is on a button that will silence all the other tracks.*/
2257  _("Solo") :
2258  /* i18n-hint: This is on a button that will silence this track.*/
2259  _("Mute");
2260 
2262  *dc,
2263  value == down,
2264  bev,
2265  selected, hit
2266  );
2267 
2268  SetTrackInfoFont(dc);
2269  dc->GetTextExtent(str, &textWidth, &textHeight);
2270  dc->DrawText(str, bev.x + (bev.width - textWidth) / 2, bev.y + (bev.height - textHeight) / 2);
2271 }
static void SetTrackInfoFont(wxDC *dc)
bool GetSelected() const
Definition: Track.h:276
static void Bevel2(wxDC &dc, bool up, const wxRect &r, bool bSel=false, bool bHighlight=false)
Definition: AColor.cpp:222
static void MediumTrackInfo(wxDC *dc, bool selected)
Definition: AColor.cpp:328
static void Mute(wxDC *dc, bool on, bool selected, bool soloing)
Definition: AColor.cpp:398
static void Solo(wxDC *dc, bool on, bool selected)
Definition: AColor.cpp:413
An AudioTrack that can be played and stopped.
Definition: Track.h:376
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
LWSlider * TrackInfo::PanSlider ( const wxRect &  sliderRect,
const WaveTrack t,
bool  captured,
wxWindow *  pParent 
)
static

Definition at line 3286 of file TrackPanel.cpp.

References GetActiveProject(), and WaveTrack::GetPan().

Referenced by PanSliderHandle::HitTest(), TrackPanel::PanSlider(), and PanSliderDrawFunction().

3287 {
3288  wxPoint pos = sliderRect.GetPosition();
3289  float pan = t ? t->GetPan() : 0.0;
3290 
3291  gPan->Move(pos);
3292  gPan->Set(pan);
3293  gPanCaptured->Move(pos);
3294  gPanCaptured->Set(pan);
3295 
3296  auto slider = (captured ? gPanCaptured : gPan).get();
3297  slider->SetParent( pParent ? pParent : ::GetActiveProject() );
3298  return slider;
3299 }
float GetPan() const
Definition: WaveTrack.cpp:425
static std::unique_ptr< LWSlider > gPanCaptured
Definition: TrackPanel.h:230
TrackPanel * pParent
Definition: TrackPanel.h:226
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:308
static std::unique_ptr< LWSlider > gPan
Definition: TrackPanel.h:232
void TrackInfo::PanSliderDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)
static

Definition at line 2182 of file TrackPanel.cpp.

References TrackPanelDrawingContext::dc, PanSlider(), and TrackPanelDrawingContext::target.

2184 {
2185  auto target = dynamic_cast<PanSliderHandle*>( context.target.get() );
2186  auto dc = &context.dc;
2187  bool hit = target && target->GetTrack().get() == pTrack;
2188  bool captured = hit && target->IsClicked();
2189  SliderDrawFunction<WaveTrack>
2190  ( &TrackInfo::PanSlider, dc, rect, pTrack, captured, hit);
2191 }
static LWSlider * PanSlider(const wxRect &sliderRect, const WaveTrack *t, bool captured, wxWindow *pParent)
void TrackInfo::ReCreateSliders ( )

Definition at line 2904 of file TrackPanel.cpp.

References _(), DB_SLIDER, GetGainRect(), GetPanRect(), gGain, gGainCaptured, gPan, gPanCaptured, PAN_SLIDER, pParent, and VEL_SLIDER.

Referenced by TrackPanel::ApplyUpdatedTheme(), and TrackInfo().

2904  {
2905  const wxPoint point{ 0, 0 };
2906  wxRect sliderRect;
2907  GetGainRect(point, sliderRect);
2908 
2909  float defPos = 1.0;
2910  /* i18n-hint: Title of the Gain slider, used to adjust the volume */
2911  gGain = std::make_unique<LWSlider>(pParent, _("Gain"),
2912  wxPoint(sliderRect.x, sliderRect.y),
2913  wxSize(sliderRect.width, sliderRect.height),
2914  DB_SLIDER);
2915  gGain->SetDefaultValue(defPos);
2916 
2917  gGainCaptured = std::make_unique<LWSlider>(pParent, _("Gain"),
2918  wxPoint(sliderRect.x, sliderRect.y),
2919  wxSize(sliderRect.width, sliderRect.height),
2920  DB_SLIDER);
2921  gGainCaptured->SetDefaultValue(defPos);
2922 
2923  GetPanRect(point, sliderRect);
2924 
2925  defPos = 0.0;
2926  /* i18n-hint: Title of the Pan slider, used to move the sound left or right */
2927  gPan = std::make_unique<LWSlider>(pParent, _("Pan"),
2928  wxPoint(sliderRect.x, sliderRect.y),
2929  wxSize(sliderRect.width, sliderRect.height),
2930  PAN_SLIDER);
2931  gPan->SetDefaultValue(defPos);
2932 
2933  gPanCaptured = std::make_unique<LWSlider>(pParent, _("Pan"),
2934  wxPoint(sliderRect.x, sliderRect.y),
2935  wxSize(sliderRect.width, sliderRect.height),
2936  PAN_SLIDER);
2937  gPanCaptured->SetDefaultValue(defPos);
2938 
2939 #ifdef EXPERIMENTAL_MIDI_OUT
2940  GetVelocityRect(point, sliderRect);
2941 
2942  /* i18n-hint: Title of the Velocity slider, used to adjust the volume of note tracks */
2943  gVelocity = std::make_unique<LWSlider>(pParent, _("Velocity"),
2944  wxPoint(sliderRect.x, sliderRect.y),
2945  wxSize(sliderRect.width, sliderRect.height),
2946  VEL_SLIDER);
2947  gVelocity->SetDefaultValue(0.0);
2948  gVelocityCaptured = std::make_unique<LWSlider>(pParent, _("Velocity"),
2949  wxPoint(sliderRect.x, sliderRect.y),
2950  wxSize(sliderRect.width, sliderRect.height),
2951  VEL_SLIDER);
2952  gVelocityCaptured->SetDefaultValue(0.0);
2953 #endif
2954 
2955 }
static std::unique_ptr< LWSlider > gPanCaptured
Definition: TrackPanel.h:230
#define PAN_SLIDER
Definition: ASlider.h:46
TrackPanel * pParent
Definition: TrackPanel.h:226
static void GetGainRect(const wxPoint &topLeft, wxRect &dest)
#define DB_SLIDER
Definition: ASlider.h:45
#define VEL_SLIDER
Definition: ASlider.h:49
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
static std::unique_ptr< LWSlider > gPan
Definition: TrackPanel.h:232
static void GetPanRect(const wxPoint &topLeft, wxRect &dest)
static std::unique_ptr< LWSlider > gGain
Definition: TrackPanel.h:231
static std::unique_ptr< LWSlider > gGainCaptured
Definition: TrackPanel.h:229
void TrackInfo::SetTrackInfoFont ( wxDC *  dc)
static
Todo:
Probably should move to 'Utils.cpp'.

Definition at line 3140 of file TrackPanel.cpp.

References gFont.

Referenced by DrawItems().

3141 {
3142  dc->SetFont(gFont);
3143 }
static wxFont gFont
Definition: TrackPanel.h:227
template<typename TrackClass >
void TrackInfo::SliderDrawFunction ( LWSlider *(*)(const wxRect &sliderRect, const TrackClass *t, bool captured, wxWindow *)  Selector,
wxDC *  dc,
const wxRect &  rect,
const Track pTrack,
bool  captured,
bool  highlight 
)
static

Definition at line 2169 of file TrackPanel.cpp.

References GetSliderHorizontalBounds().

2173 {
2174  wxRect sliderRect = rect;
2175  TrackInfo::GetSliderHorizontalBounds( rect.GetTopLeft(), sliderRect );
2176  auto wt = static_cast<const TrackClass*>( pTrack );
2177  Selector( sliderRect, wt, captured, nullptr )->OnPaint(*dc, highlight);
2178 }
void OnPaint(wxDC &dc, bool highlighted)
Definition: ASlider.cpp:551
static void GetSliderHorizontalBounds(const wxPoint &topleft, wxRect &dest)
void TrackInfo::Status1DrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)
static

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.

Definition at line 2343 of file TrackPanel.cpp.

References _(), TrackPanelDrawingContext::dc, WaveTrack::GetRate(), Track::LeftChannel, Track::MonoChannel, and Track::RightChannel.

2345 {
2346  auto dc = &context.dc;
2347  auto wt = static_cast<const WaveTrack*>(pTrack);
2348 
2352  auto rate = wt ? wt->GetRate() : 44100.0;
2353  wxString s;
2354  if (!wt || (wt->GetLinked()))
2355  s = _("Stereo, %dHz");
2356  else {
2357  if (wt->GetChannel() == Track::MonoChannel)
2358  s = _("Mono, %dHz");
2359  else if (wt->GetChannel() == Track::LeftChannel)
2360  s = _("Left, %dHz");
2361  else if (wt->GetChannel() == Track::RightChannel)
2362  s = _("Right, %dHz");
2363  }
2364  s = wxString::Format( s, (int) (rate + 0.5) );
2365 
2366  StatusDrawFunction( s, dc, rect );
2367 }
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
static void StatusDrawFunction(const wxString &string, wxDC *dc, const wxRect &rect)
double GetRate() const
Definition: WaveTrack.cpp:398
void TrackInfo::Status2DrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)
static

Definition at line 2370 of file TrackPanel.cpp.

References TrackPanelDrawingContext::dc, floatSample, format, and GetSampleFormatStr().

2372 {
2373  auto dc = &context.dc;
2374  auto wt = static_cast<const WaveTrack*>(pTrack);
2375  auto format = wt ? wt->GetSampleFormat() : floatSample;
2376  auto s = GetSampleFormatStr(format);
2377  StatusDrawFunction( s, dc, rect );
2378 }
int format
Definition: ExportPCM.cpp:56
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
const wxChar * GetSampleFormatStr(sampleFormat format)
static void StatusDrawFunction(const wxString &string, wxDC *dc, const wxRect &rect)
void TrackInfo::StatusDrawFunction ( const wxString &  string,
wxDC *  dc,
const wxRect &  rect 
)
static

Definition at line 2336 of file TrackPanel.cpp.

2337 {
2338  static const int offset = 3;
2339  dc->DrawText(string, rect.x + offset, rect.y);
2340 }
void TrackInfo::UpdatePrefs ( )
private

Definition at line 3319 of file TrackPanel.cpp.

References _(), GetTrackInfoWidth(), and gFont.

Referenced by TrackInfo(), and TrackPanel::UpdatePrefs().

3320 {
3321  // Calculation of best font size depends on language, so it should be redone in case
3322  // the language preference changed.
3323 
3324  int fontSize = 10;
3325  gFont.Create(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
3326 
3327  int allowableWidth = GetTrackInfoWidth() - 2; // 2 to allow for left/right borders
3328  int textWidth, textHeight;
3329  do {
3330  gFont.SetPointSize(fontSize);
3331  pParent->GetTextExtent(_("Stereo, 999999Hz"),
3332  &textWidth,
3333  &textHeight,
3334  NULL,
3335  NULL,
3336  &gFont);
3337  fontSize--;
3338  } while (textWidth >= allowableWidth);
3339 }
static wxFont gFont
Definition: TrackPanel.h:227
TrackPanel * pParent
Definition: TrackPanel.h:226
int GetTrackInfoWidth() const
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void TrackInfo::WideMuteDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)
static

Definition at line 2275 of file TrackPanel.cpp.

References TrackPanelDrawingContext::dc, ButtonHandle::GetTrack(), TrackPanelDrawingContext::lastState, and TrackPanelDrawingContext::target.

2277 {
2278  auto dc = &context.dc;
2279  wxRect bev = rect;
2280  GetWideMuteSoloHorizontalBounds( rect, bev );
2281  auto target = dynamic_cast<MuteButtonHandle*>( context.target.get() );
2282  bool hit = target && target->GetTrack().get() == pTrack;
2283  bool captured = hit && target->IsClicked();
2284  bool down = captured && bev.Contains( context.lastState.GetPosition());
2285  MuteOrSoloDrawFunction( dc, bev, pTrack, down, captured, false, hit );
2286 }
static void GetWideMuteSoloHorizontalBounds(const wxRect &rect, wxRect &dest)
static void MuteOrSoloDrawFunction(wxDC *dc, const wxRect &rect, const Track *pTrack, bool down, bool captured, bool solo, bool hit)
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:28
void TrackInfo::WideSoloDrawFunction ( TrackPanelDrawingContext context,
const wxRect &  rect,
const Track pTrack 
)
static

Definition at line 2289 of file TrackPanel.cpp.

References TrackPanelDrawingContext::dc, ButtonHandle::GetTrack(), TrackPanelDrawingContext::lastState, and TrackPanelDrawingContext::target.

2291 {
2292  auto dc = &context.dc;
2293  wxRect bev = rect;
2294  GetWideMuteSoloHorizontalBounds( rect, bev );
2295  auto target = dynamic_cast<SoloButtonHandle*>( context.target.get() );
2296  bool hit = target && target->GetTrack().get() == pTrack;
2297  bool captured = hit && target->IsClicked();
2298  bool down = captured && bev.Contains( context.lastState.GetPosition());
2299  MuteOrSoloDrawFunction( dc, bev, pTrack, down, captured, true, hit );
2300 }
static void GetWideMuteSoloHorizontalBounds(const wxRect &rect, wxRect &dest)
static void MuteOrSoloDrawFunction(wxDC *dc, const wxRect &rect, const Track *pTrack, bool down, bool captured, bool solo, bool hit)
std::shared_ptr< Track > GetTrack() const
Definition: ButtonHandle.h:28

Friends And Related Function Documentation

friend class TrackPanel
friend

Definition at line 238 of file TrackPanel.h.

Member Data Documentation

wxFont TrackInfo::gFont
staticprivate

Definition at line 227 of file TrackPanel.h.

Referenced by SetTrackInfoFont(), and UpdatePrefs().

std::unique_ptr< LWSlider > TrackInfo::gGain
staticprivate

Definition at line 231 of file TrackPanel.h.

Referenced by ReCreateSliders().

std::unique_ptr< LWSlider > TrackInfo::gGainCaptured
staticprivate

Definition at line 229 of file TrackPanel.h.

Referenced by ReCreateSliders().

std::unique_ptr< LWSlider > TrackInfo::gPan
staticprivate

Definition at line 232 of file TrackPanel.h.

Referenced by ReCreateSliders().

std::unique_ptr< LWSlider > TrackInfo::gPanCaptured
staticprivate

Definition at line 230 of file TrackPanel.h.

Referenced by ReCreateSliders().

TrackPanel* TrackInfo::pParent
private

Definition at line 226 of file TrackPanel.h.

Referenced by ReCreateSliders(), and TrackInfo().


The documentation for this class was generated from the following files: