Audacity 3.2.0
Functions
LowlitClipButton::Detail Namespace Reference

Functions

std::optional< wxRect > GetButtonRectangle (ClipButtonId buttonId, const RectangleArgs &args)
 
std::optional< wxRect > GetButtonInnerRectangle (ClipButtonId buttonId, const RectangleArgs &args)
 

Function Documentation

◆ GetButtonInnerRectangle()

std::optional< wxRect > LowlitClipButton::Detail::GetButtonInnerRectangle ( ClipButtonId  buttonId,
const RectangleArgs args 
)

Definition at line 68 of file LowlitClipButton.cpp.

70{
71 const auto outerRect = GetButtonRectangle(buttonId, args);
72 if (!outerRect.has_value())
73 return {};
74 const auto rightMargin = buttonId == ClipButtonId::Overflow ? 5 : 2;
75 return wxRect { outerRect->x + leftMargin, outerRect->y + topMargin,
76 outerRect->width - leftMargin - rightMargin,
77 outerRect->height - topMargin - bottomMargin };
78}
std::optional< wxRect > GetButtonRectangle(ClipButtonId buttonId, const RectangleArgs &args)

References anonymous_namespace{LowlitClipButton.cpp}::bottomMargin, GetButtonRectangle(), anonymous_namespace{LowlitClipButton.cpp}::leftMargin, Overflow, and anonymous_namespace{LowlitClipButton.cpp}::topMargin.

Referenced by HighlitClipButtonHandle::Draw(), and LowlitClipButton::DrawOnClip().

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

◆ GetButtonRectangle()

std::optional< wxRect > LowlitClipButton::Detail::GetButtonRectangle ( ClipButtonId  buttonId,
const RectangleArgs args 
)

Definition at line 37 of file LowlitClipButton.cpp.

39{
40 const auto clipRect = ClipParameters::GetClipRect(
41 args.clip, args.zoomInfo, args.trackAffordanceRect);
42 const auto rect =
43 RemoveSpaceReservedForTitle(clipRect.Intersect(args.trackAffordanceRect));
44
45 // In this order, from left to right: pitch (maybe), speed (maybe), overflow.
46 auto offset = 0;
47 if (buttonId != ClipButtonId::Overflow)
48 {
49 offset +=
51 if (
52 buttonId == ClipButtonId::Pitch &&
54 args.clip))
55 {
56 offset +=
58 }
59 }
60
61 const auto buttonWidth = GetButtonWidth(buttonId, args.clip);
62 if (rect.width < buttonWidth + offset)
63 return {};
64 const auto x = rect.x + rect.width - offset - buttonWidth;
65 return std::make_optional<wxRect>(x, rect.y, buttonWidth, rect.height);
66}
wxRect RemoveSpaceReservedForTitle(const wxRect &rect)
int GetButtonWidth(ClipButtonId buttonId, const ClipInterface &clip)
static int GetWidth(const ClipInterface &clip)
static wxRect GetClipRect(const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect, bool *outShowSamples=nullptr)

References LowlitClipButton::RectangleArgs::clip, anonymous_namespace{LowlitClipButton.cpp}::GetButtonWidth(), ClipParameters::GetClipRect(), ClipButtonSpecializations< id >::GetWidth(), Overflow, Pitch, anonymous_namespace{LowlitClipButton.cpp}::RemoveSpaceReservedForTitle(), LowlitClipButton::RectangleArgs::trackAffordanceRect, and LowlitClipButton::RectangleArgs::zoomInfo.

Referenced by HighlitClipButtonHandle::Drag(), GetButtonInnerRectangle(), and LowlitClipButton::HitTest().

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