15#include <unordered_map>
21#include <wx/hyperlink.h>
24#include <wx/stattext.h>
34 return position + length;
39 : mMessage(
std::move(message))
47 std::move(placeholder),
61 std::move(placeholder),
81 std::unique_ptr<wxHyperlinkCtrl> tempHyperlink
82 = std::make_unique<wxHyperlinkCtrl>(
S.GetParent(), wxID_ANY,
wxT(
"temp"), wxString());
84 const wxColour hyperlinkColour = tempHyperlink->GetNormalColour();
86 tempHyperlink.reset();
91 std::vector<ProcessedArgument> processedArguments =
94 if (processedArguments.empty())
102 S.StartHorizontalLay(wxEXPAND);
107 S.StartWrapLay(wxEXPAND, 1);
119 const size_t substrLength =
122 S.Prop(0).AddFixedText(
132 wxHyperlinkCtrl* hyperlink =
safenew wxHyperlinkCtrl(
139 url = argument->
TargetURL](wxHyperlinkEvent& evt)
143 else if (!url.empty())
144 BasicUI::OpenInDefaultBrowser(url);
149 S.AddWindow(hyperlink, wxALIGN_TOP | wxALIGN_LEFT);
152 wxStaticText* hyperlink =
S.AddVariableText(argument->
Value);
154 hyperlink->SetFont(hyperlink->GetFont().Underlined());
155 hyperlink->SetForegroundColour(hyperlinkColour);
156 hyperlink->SetCursor(wxCURSOR_HAND);
161 else if (!url.empty())
162 BasicUI::OpenInDefaultBrowser(url);
169 processedArgument.PlaceholderPosition,
181 S.EndHorizontalLay();
186std::vector<AccessibleLinksFormatter::ProcessedArgument>
189 std::vector<ProcessedArgument> result;
193 std::unordered_map<wxString, size_t> knownPlaceholderPosition;
197 auto it = knownPlaceholderPosition.find(argument.Placeholder);
199 const size_t startingPosition =
200 it != knownPlaceholderPosition.end() ?
204 const size_t placeholderPosition =
207 translatedMessage.find(argument.Placeholder, startingPosition);
209 knownPlaceholderPosition[argument.Placeholder] = placeholderPosition;
219 result.begin(), result.end(),
221 return lhs.PlaceholderPosition < rhs.PlaceholderPosition;
Toolkit-neutral facade for basic user interface services.
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const
constexpr size_t npos(-1)
constexpr auto borderSize
AuthorizationHandler handler