Audacity  2.2.2
Classes | Macros | Enumerations | Functions | Variables
Ruler.cpp File Reference
#include "../Audacity.h"
#include "Ruler.h"
#include <math.h>
#include <wx/app.h>
#include <wx/dcscreen.h>
#include <wx/dcmemory.h>
#include <wx/dcbuffer.h>
#include <wx/settings.h>
#include <wx/menu.h>
#include <wx/menuitem.h>
#include <wx/tooltip.h>
#include "AButton.h"
#include "../AColor.h"
#include "../AudioIO.h"
#include "../Internat.h"
#include "../Project.h"
#include "../toolbars/ControlToolBar.h"
#include "../Theme.h"
#include "../AllThemeResources.h"
#include "../Experimental.h"
#include "../TimeTrack.h"
#include "../TrackPanel.h"
#include "../TrackPanelCellIterator.h"
#include "../NumberScale.h"
#include "../Prefs.h"
#include "../Snap.h"
#include "../UIHandle.h"
#include "../tracks/ui/Scrubbing.h"
#include "../prefs/PlaybackPrefs.h"
#include "../prefs/TracksPrefs.h"
#include "../prefs/TracksBehaviorsPrefs.h"
#include "../widgets/Grabber.h"
#include "../commands/CommandContext.h"
#include "../ViewInfo.h"
#include "../RefreshCode.h"
#include "../TrackPanelMouseEvent.h"

Go to the source code of this file.

Classes

class  AdornedRulerPanel::QuickPlayRulerOverlay
 
class  AdornedRulerPanel::QuickPlayIndicatorOverlay
 
class  AdornedRulerPanel::CommonRulerHandle
 
class  AdornedRulerPanel::QPHandle
 
class  AdornedRulerPanel::QPCell
 
class  AdornedRulerPanel::ScrubbingHandle
 
class  AdornedRulerPanel::ScrubbingCell
 

Macros

#define SELECT_TOLERANCE_PIXEL   4
 
#define PLAY_REGION_TRIANGLE_SIZE   6
 
#define PLAY_REGION_RECT_WIDTH   1
 
#define PLAY_REGION_RECT_HEIGHT   3
 
#define PLAY_REGION_GLOBAL_OFFSET_Y   7
 

Enumerations

enum  : int {
  IndicatorSmallWidth = 9, IndicatorMediumWidth = 13, IndicatorOffset = 1, TopMargin = 1,
  BottomMargin = 2, LeftMargin = 1, RightMargin = 1
}
 
enum  { ScrubHeight = 14, ProperRulerHeight = 29 }
 
enum  {
  OnToggleQuickPlayID = 7000, OnSyncQuickPlaySelID, OnTimelineToolTipID, OnAutoScrollID,
  OnLockPlayRegionID, OnScrubRulerID, OnTogglePinnedStateID
}
 

Functions

int IndicatorHeightForWidth (int width)
 
int IndicatorWidthForHeight (int height)
 
int IndicatorBigHeight ()
 
int IndicatorBigWidth ()
 
 EVT_COMMAND (OnTogglePinnedStateID, wxEVT_COMMAND_BUTTON_CLICKED, AdornedRulerPanel::OnTogglePinnedState) class AdornedRulerPanel
 
HitTestPreview DefaultPreview (const TrackPanelMouseState &state, const AudacityProject *pProject) override
 
unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, wxPoint *pPosition) finaloverride
 

Variables

AdornedRulerPanelmParent
 
const MenuChoice mMenuChoice
 

Macro Definition Documentation

#define PLAY_REGION_GLOBAL_OFFSET_Y   7

Definition at line 113 of file Ruler.cpp.

Referenced by AdornedRulerPanel::DoDrawPlayRegion().

#define PLAY_REGION_RECT_HEIGHT   3

Definition at line 112 of file Ruler.cpp.

Referenced by AdornedRulerPanel::DoDrawPlayRegion().

#define PLAY_REGION_RECT_WIDTH   1

Definition at line 111 of file Ruler.cpp.

Referenced by AdornedRulerPanel::DoDrawPlayRegion().

#define PLAY_REGION_TRIANGLE_SIZE   6

Definition at line 110 of file Ruler.cpp.

Referenced by AdornedRulerPanel::DoDrawPlayRegion().

#define SELECT_TOLERANCE_PIXEL   4

Definition at line 108 of file Ruler.cpp.

Referenced by AdornedRulerPanel::IsWithinMarker().

Enumeration Type Documentation

anonymous enum : int
Enumerator
IndicatorSmallWidth 
IndicatorMediumWidth 
IndicatorOffset 
TopMargin 
BottomMargin 
LeftMargin 
RightMargin 

Definition at line 1708 of file Ruler.cpp.

1708  : int {
1709  IndicatorSmallWidth = 9,
1710  IndicatorMediumWidth = 13,
1711  IndicatorOffset = 1,
1712 
1713  TopMargin = 1,
1714  BottomMargin = 2, // for bottom bevel and bottom line
1715  LeftMargin = 1,
1716 
1717  RightMargin = 1,
1718 };
anonymous enum
Enumerator
ScrubHeight 
ProperRulerHeight 

Definition at line 1720 of file Ruler.cpp.

1720  {
1721  ScrubHeight = 14,
1722  ProperRulerHeight = 29
1723 };
anonymous enum
Enumerator
OnToggleQuickPlayID 
OnSyncQuickPlaySelID 
OnTimelineToolTipID 
OnAutoScrollID 
OnLockPlayRegionID 
OnScrubRulerID 
OnTogglePinnedStateID 

Definition at line 2011 of file Ruler.cpp.

Function Documentation

HitTestPreview DefaultPreview ( const TrackPanelMouseState state,
const AudacityProject pProject 
)
override

Definition at line 2050 of file Ruler.cpp.

References _(), mParent, and AdornedRulerPanel::mTimelineToolTip.

Referenced by EVT_COMMAND().

2052  {
2053  // May come here when recording is in progress, so hit tests are turned
2054  // off.
2055  wxString tooltip;
2057  tooltip = _("Timeline actions disabled during recording");
2058 
2059  static wxCursor cursor{ wxCURSOR_DEFAULT };
2060  return {
2061  {},
2062  &cursor,
2063  tooltip,
2064  };
2065  }
AdornedRulerPanel * mParent
Definition: Ruler.cpp:2076
_("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
bool mTimelineToolTip
Definition: Ruler.h:430
unsigned DoContextMenu ( const wxRect &  rect,
wxWindow *  pParent,
wxPoint *  pPosition 
)
finaloverride

Definition at line 2068 of file Ruler.cpp.

References mMenuChoice, mParent, and AdornedRulerPanel::ShowContextMenu().

2070  {
2071  mParent->ShowContextMenu(mMenuChoice, pPosition);
2072  return 0;
2073  }
void ShowContextMenu(MenuChoice choice, const wxPoint *pPosition)
Definition: Ruler.cpp:3517
AdornedRulerPanel * mParent
Definition: Ruler.cpp:2076
const MenuChoice mMenuChoice
Definition: Ruler.cpp:2077
EVT_COMMAND ( OnTogglePinnedStateID  ,
wxEVT_COMMAND_BUTTON_CLICKED  ,
AdornedRulerPanel::OnTogglePinnedState   
)

Definition at line 2034 of file Ruler.cpp.

References DefaultPreview(), mMenuChoice, and mParent.

2040  : public TrackPanelCell
2041 {
2042 public:
2043  explicit
2044  CommonCell( AdornedRulerPanel *parent, MenuChoice menuChoice )
2045  : mParent{ parent }
2046  , mMenuChoice{ menuChoice }
2047  {}
AdornedRulerPanel * mParent
Definition: Ruler.cpp:2076
const MenuChoice mMenuChoice
Definition: Ruler.cpp:2077
This is an Audacity Specific ruler panel which additionally has border, selection markers...
Definition: Ruler.h:313
int IndicatorBigHeight ( )
inline

Definition at line 1738 of file Ruler.cpp.

References IndicatorMediumWidth, ScrubHeight, and TopMargin.

Referenced by IndicatorBigWidth().

1739 {
1740  return std::max((int)(ScrubHeight - TopMargin),
1741  (int)(IndicatorMediumWidth));
1742 }
int IndicatorBigWidth ( )
inline

Definition at line 1744 of file Ruler.cpp.

References IndicatorBigHeight(), and IndicatorWidthForHeight().

Referenced by AdornedRulerPanel::QuickPlayRulerOverlay::DoGetRectangle(), and AdornedRulerPanel::QuickPlayRulerOverlay::Draw().

1745 {
1747 }
int IndicatorBigHeight()
Definition: Ruler.cpp:1738
int IndicatorWidthForHeight(int height)
Definition: Ruler.cpp:1730
int IndicatorHeightForWidth ( int  width)
inline

Definition at line 1725 of file Ruler.cpp.

Referenced by AdornedRulerPanel::DoDrawIndicator().

1726 {
1727  return ((width / 2) * 3) / 2;
1728 }
int IndicatorWidthForHeight ( int  height)
inline

Definition at line 1730 of file Ruler.cpp.

References IndicatorSmallWidth.

Referenced by IndicatorBigWidth().

1731 {
1732  // Not an exact inverse of the above, with rounding, but good enough
1733  return std::max(static_cast<int>(IndicatorSmallWidth),
1734  (((height) * 2) / 3) * 2
1735  );
1736 }

Variable Documentation

const MenuChoice mMenuChoice

Definition at line 2077 of file Ruler.cpp.

Referenced by DoContextMenu(), and EVT_COMMAND().