Audacity 3.2.0
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
AdornedRulerPanel.cpp File Reference
#include "AdornedRulerPanel.h"
#include <wx/app.h>
#include <wx/setup.h>
#include <wx/tooltip.h>
#include "AColor.h"
#include "AllThemeResources.h"
#include "AudioIO.h"
#include "widgets/BasicMenu.h"
#include "Beats.h"
#include "CellularPanel.h"
#include "../images/Cursors.h"
#include "HitTestResult.h"
#include "Prefs.h"
#include "Project.h"
#include "ProjectAudioIO.h"
#include "ProjectAudioManager.h"
#include "ProjectWindows.h"
#include "ProjectStatus.h"
#include "ProjectTimeSignature.h"
#include "ProjectWindow.h"
#include "RefreshCode.h"
#include "SelectUtilities.h"
#include "Snap.h"
#include "Track.h"
#include "TrackPanelMouseEvent.h"
#include "UIHandle.h"
#include "ViewInfo.h"
#include "prefs/TracksPrefs.h"
#include "prefs/ThemePrefs.h"
#include "toolbars/ToolBar.h"
#include "toolbars/ToolManager.h"
#include "tracks/ui/Scrubbing.h"
#include "tracks/ui/TrackView.h"
#include "widgets/AButton.h"
#include "AudacityMessageBox.h"
#include "widgets/Grabber.h"
#include "widgets/LinearUpdater.h"
#include "widgets/BeatsFormat.h"
#include "widgets/TimeFormat.h"
#include "wxWidgetsWindowPlacement.h"
#include <wx/dcclient.h>
#include <wx/menu.h>
#include "commands/CommandContext.h"
#include "commands/CommandManager.h"
#include "CommonCommandFlags.h"
Include dependency graph for AdornedRulerPanel.cpp:

Go to the source code of this file.

Classes

class  AdornedRulerPanel::CommonRulerHandle
 
class  AdornedRulerPanel::PlayRegionAdjustingHandle
 
class  AdornedRulerPanel::ScrubbingRulerOverlay
 
class  AdornedRulerPanel::TrackPanelGuidelineOverlay
 
class  AdornedRulerPanel::CommonCell
 
class  AdornedRulerPanel::MovePlayRegionHandle
 
class  AdornedRulerPanel::ResizePlayRegionHandle
 
class  AdornedRulerPanel::NewPlayRegionHandle
 
class  anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle
 
class  AdornedRulerPanel::QPCell
 
class  AdornedRulerPanel::ScrubbingHandle
 
class  AdornedRulerPanel::ScrubbingCell
 
struct  AdornedRulerPanel::Subgroup
 
struct  AdornedRulerPanel::MainGroup
 

Namespaces

namespace  anonymous_namespace{AdornedRulerPanel.cpp}
 

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
 

Typedefs

using ColorId = decltype(clrTrackInfo)
 
using anonymous_namespace{AdornedRulerPanel.cpp}::Options = CommandManager::Options
 

Enumerations

enum  : int {
  IndicatorSmallWidth = 9 , IndicatorMediumWidth = 13 , IndicatorOffset = 1 , TopMargin = 1 ,
  BottomMargin = 2 , LeftMargin = 1 , RightMargin = 1
}
 
enum  { ScrubHeight = 14 , ProperRulerHeight = 29 }
 
enum  {
  OnMinutesAndSecondsID = 7000 , OnBeatsAndMeasuresID , OnSyncQuickPlaySelID , OnAutoScrollID ,
  OnTogglePlayRegionID , OnClearPlayRegionID , OnSetPlayRegionToSelectionID , OnTogglePinnedStateID
}
 

Functions

int IndicatorHeightForWidth (int width)
 
int IndicatorWidthForHeight (int height)
 
int IndicatorBigHeight ()
 
int IndicatorBigWidth ()
 
 EVT_MENU (OnSetPlayRegionToSelectionID, AdornedRulerPanel::OnSetPlayRegionToSelection) EVT_COMMAND(OnTogglePinnedStateID
 
wxCoord anonymous_namespace{AdornedRulerPanel.cpp}::GetPlayHeadX (const AudacityProject *pProject)
 
double anonymous_namespace{AdornedRulerPanel.cpp}::GetPlayHeadFraction (const AudacityProject *pProject, wxCoord xx)
 
const TranslatableString anonymous_namespace{AdornedRulerPanel.cpp}::StartScrubbingMessage (const Scrubber &)
 
const TranslatableString anonymous_namespace{AdornedRulerPanel.cpp}::ContinueScrubbingMessage (const Scrubber &scrubber, bool clicked)
 
const TranslatableString anonymous_namespace{AdornedRulerPanel.cpp}::ScrubbingMessage (const Scrubber &scrubber, bool clicked)
 
ColorId TimelineBackgroundColor ()
 
ColorId TimelineTextColor ()
 
ColorId TimelineLimitsColor ()
 
ColorId TimelineLoopRegionColor (bool isActive)
 
static wxColour AlphaBlend (ColorId fg, ColorId bg, double alpha)
 
void anonymous_namespace{AdornedRulerPanel.cpp}::OnTogglePinnedHead (const CommandContext &context)
 

Variables

EnumSetting< AdornedRulerPanel::RulerTypeValuesRulerPanelViewPreference
 
 wxEVT_COMMAND_BUTTON_CLICKED
 
static auto handOpenCursor
 
AttachedWindows::RegisteredFactory anonymous_namespace{AdornedRulerPanel.cpp}::sKey
 
constexpr double SelectionOpacity = 0.2
 
AttachedItem anonymous_namespace{AdornedRulerPanel.cpp}::sAttachment
 

Macro Definition Documentation

◆ PLAY_REGION_GLOBAL_OFFSET_Y

#define PLAY_REGION_GLOBAL_OFFSET_Y   7

Definition at line 78 of file AdornedRulerPanel.cpp.

◆ PLAY_REGION_RECT_HEIGHT

#define PLAY_REGION_RECT_HEIGHT   3

Definition at line 77 of file AdornedRulerPanel.cpp.

◆ PLAY_REGION_RECT_WIDTH

#define PLAY_REGION_RECT_WIDTH   1

Definition at line 76 of file AdornedRulerPanel.cpp.

◆ PLAY_REGION_TRIANGLE_SIZE

#define PLAY_REGION_TRIANGLE_SIZE   6

Definition at line 75 of file AdornedRulerPanel.cpp.

◆ SELECT_TOLERANCE_PIXEL

#define SELECT_TOLERANCE_PIXEL   4

Definition at line 73 of file AdornedRulerPanel.cpp.

Typedef Documentation

◆ ColorId

using ColorId = decltype(clrTrackInfo)

Definition at line 2480 of file AdornedRulerPanel.cpp.

Enumeration Type Documentation

◆ anonymous enum

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

Definition at line 80 of file AdornedRulerPanel.cpp.

80 : int {
84
85 TopMargin = 1,
86 BottomMargin = 2, // for bottom bevel and bottom line
87 LeftMargin = 1,
88
89 RightMargin = 1,
90};
@ IndicatorOffset
@ IndicatorSmallWidth
@ LeftMargin
@ RightMargin
@ TopMargin
@ IndicatorMediumWidth
@ BottomMargin

◆ anonymous enum

anonymous enum
Enumerator
ScrubHeight 
ProperRulerHeight 

Definition at line 92 of file AdornedRulerPanel.cpp.

92 {
93 ScrubHeight = 14,
95};
@ ProperRulerHeight
@ ScrubHeight

◆ anonymous enum

anonymous enum
Enumerator
OnMinutesAndSecondsID 
OnBeatsAndMeasuresID 
OnSyncQuickPlaySelID 
OnAutoScrollID 
OnTogglePlayRegionID 
OnClearPlayRegionID 
OnSetPlayRegionToSelectionID 
OnTogglePinnedStateID 

Definition at line 687 of file AdornedRulerPanel.cpp.

687 {
696};
@ OnTogglePinnedStateID
@ OnBeatsAndMeasuresID
@ OnSetPlayRegionToSelectionID
@ OnClearPlayRegionID
@ OnAutoScrollID
@ OnTogglePlayRegionID
@ OnMinutesAndSecondsID
@ OnSyncQuickPlaySelID

Function Documentation

◆ AlphaBlend()

static wxColour AlphaBlend ( ColorId  fg,
ColorId  bg,
double  alpha 
)
inlinestatic

Definition at line 2502 of file AdornedRulerPanel.cpp.

2503{
2504 const auto &fgc = theTheme.Colour(fg);
2505 const auto &bgc = theTheme.Colour(bg);
2506 return wxColour{
2507 wxColour::AlphaBlend(fgc.Red(), bgc.Red(), alpha),
2508 wxColour::AlphaBlend(fgc.Green(), bgc.Green(), alpha),
2509 wxColour::AlphaBlend(fgc.Blue(), bgc.Blue(), alpha)
2510 };
2511}
static wxColour AlphaBlend(ColorId fg, ColorId bg, double alpha)
THEME_API Theme theTheme
Definition: Theme.cpp:82
wxColour & Colour(int iIndex)

References AlphaBlend(), ThemeBase::Colour(), and theTheme.

Referenced by AlphaBlend(), AdornedRulerPanel::DoDrawOverlap(), and AdornedRulerPanel::DoDrawSelection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EVT_MENU()

◆ IndicatorBigHeight()

int IndicatorBigHeight ( )
inline

Definition at line 124 of file AdornedRulerPanel.cpp.

125{
126 return std::max((int)(ScrubHeight - TopMargin),
127 (int)(IndicatorMediumWidth));
128}

References IndicatorMediumWidth, ScrubHeight, and TopMargin.

Referenced by IndicatorBigWidth().

Here is the caller graph for this function:

◆ IndicatorBigWidth()

int IndicatorBigWidth ( )
inline

Definition at line 130 of file AdornedRulerPanel.cpp.

131{
133}
int IndicatorBigHeight()
int IndicatorWidthForHeight(int height)

References IndicatorBigHeight(), and IndicatorWidthForHeight().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IndicatorHeightForWidth()

int IndicatorHeightForWidth ( int  width)
inline

Definition at line 111 of file AdornedRulerPanel.cpp.

112{
113 return ((width / 2) * 3) / 2;
114}

Referenced by AdornedRulerPanel::DoDrawScrubIndicator().

Here is the caller graph for this function:

◆ IndicatorWidthForHeight()

int IndicatorWidthForHeight ( int  height)
inline

Definition at line 116 of file AdornedRulerPanel.cpp.

117{
118 // Not an exact inverse of the above, with rounding, but good enough
119 return std::max(static_cast<int>(IndicatorSmallWidth),
120 (((height) * 2) / 3) * 2
121 );
122}

References IndicatorSmallWidth.

Referenced by IndicatorBigWidth().

Here is the caller graph for this function:

◆ TimelineBackgroundColor()

ColorId TimelineBackgroundColor ( )
inline

Definition at line 2482 of file AdornedRulerPanel.cpp.

2483{
2484 return clrTrackInfo;
2485}

Referenced by AdornedRulerPanel::DoDrawBackground(), and AdornedRulerPanel::DoDrawSelection().

Here is the caller graph for this function:

◆ TimelineLimitsColor()

ColorId TimelineLimitsColor ( )
inline

Definition at line 2492 of file AdornedRulerPanel.cpp.

2493{
2494 return TimelineTextColor();
2495}
ColorId TimelineTextColor()

References TimelineTextColor().

Referenced by AdornedRulerPanel::DoDrawOverlap(), AdornedRulerPanel::DoDrawPlayRegionLimits(), and AdornedRulerPanel::DoDrawSelection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TimelineLoopRegionColor()

ColorId TimelineLoopRegionColor ( bool  isActive)
inline

Definition at line 2497 of file AdornedRulerPanel.cpp.

2498{
2499 return isActive ? clrRulerBackground : clrClipAffordanceInactiveBrush;
2500}

Referenced by AdornedRulerPanel::DoDrawOverlap(), and AdornedRulerPanel::DoDrawPlayRegion().

Here is the caller graph for this function:

◆ TimelineTextColor()

ColorId TimelineTextColor ( )
inline

Definition at line 2487 of file AdornedRulerPanel.cpp.

2488{
2489 return clrTrackPanelText;
2490}

Referenced by AdornedRulerPanel::DoDrawBackground(), AdornedRulerPanel::DoDrawMarks(), and TimelineLimitsColor().

Here is the caller graph for this function:

Variable Documentation

◆ handOpenCursor

auto handOpenCursor
static
Initial value:
=
MakeCursor(wxCURSOR_HAND, RearrangeCursorXpm, 16, 16)
std::unique_ptr< wxCursor > MakeCursor(int WXUNUSED(CursorId), const char *const pXpm[36], int HotX, int HotY)
Definition: TrackPanel.cpp:186

Definition at line 793 of file AdornedRulerPanel.cpp.

Referenced by AffordanceHandle::HitPreview(), and LabelGlyphHandle::Preview().

◆ RulerPanelViewPreference

Initial value:
{
L"/GUI/RulerType",
{
{ wxT("MinutesAndSeconds"), XO("Minutes and Seconds") },
{ wxT("BeatsAndMeasures"), XO("Beats and Measures") },
},
0,
{
}
}
wxT("CloseDown"))
XO("Cut/Copy/Paste")

Definition at line 97 of file AdornedRulerPanel.cpp.

Referenced by AdornedRulerPanel::AdornedRulerPanel(), AdornedRulerPanel::OnTimelineFormatChange(), AdornedRulerPanel::SetRulerType(), and AdornedRulerPanel::UpdatePrefs().

◆ SelectionOpacity

constexpr double SelectionOpacity = 0.2
constexpr

◆ wxEVT_COMMAND_BUTTON_CLICKED

wxEVT_COMMAND_BUTTON_CLICKED