MCPcopy Create free account
hub / github.com/audacity/audacity / OnPaint

Method OnPaint

src/effects/DynamicRangeProcessorHistoryPanel.cpp:329–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327}
328
329void DynamicRangeProcessorHistoryPanel::OnPaint(wxPaintEvent& evt)
330{
331 wxPaintDC dc(this);
332
333 using namespace DynamicRangeProcessorPanel;
334
335 const auto gc = MakeGraphicsContext(dc);
336 const auto rect = DynamicRangeProcessorPanel::GetPanelRect(*this);
337 const auto x = rect.GetX();
338 const auto y = rect.GetY();
339 const auto width = rect.GetWidth();
340 const auto height = rect.GetHeight();
341
342 gc->SetBrush(GetGraphBackgroundBrush(*gc, height));
343 gc->SetPen(wxTransparentColor);
344 gc->DrawRectangle(x, y, width, height);
345
346 Finally Do { [&] {
347 // The legend is causing problems color-wise, and in the end it may not be
348 // so useful since the different elements of the graph can be toggled.
349 // Keep it up our sleeve for now, though. (Anyone still sees this in the
350 // not-so-near future, feel free to clean up.)
351 constexpr auto drawLegend = false;
352 if (drawLegend)
353 DrawLegend(height, dc, *gc);
354 gc->SetBrush(*wxTRANSPARENT_BRUSH);
355 gc->SetPen(lineColor);
356 gc->DrawRectangle(x, y, width, height);
357 } };
358
359 if (!mHistory || !mSync)
360 {
361 if (!mPlaybackAboutToStart)
362 {
363 const auto text = XO("awaiting playback");
364 const wxDCFontChanger changer { dc,
365 { 16, wxFONTFAMILY_DEFAULT,
366 wxFONTSTYLE_NORMAL,
367 wxFONTWEIGHT_NORMAL } };
368 const auto textWidth = dc.GetTextExtent(text.Translation()).GetWidth();
369 const auto textHeight =
370 dc.GetTextExtent(text.Translation()).GetHeight();
371 dc.SetTextForeground(wxColor { 128, 128, 128 });
372 dc.DrawText(
373 text.Translation(), (width - textWidth) / 2,
374 (height - textHeight) / 2);
375 }
376 return;
377 }
378
379 const auto& segments = mHistory->GetSegments();
380 const auto elapsedTimeSinceFirstPacket =
381 std::chrono::duration<float>(mSync->now - mSync->start).count();
382 const auto rangeDb = DynamicRangeProcessorPanel::GetGraphDbRange(height);
383 const auto dbPerPixel = rangeDb / height;
384
385 for (const auto& segment : segments)
386 {

Callers

nothing calls this directly

Calls 15

MakeGraphicsContextFunction · 0.85
GetPanelRectFunction · 0.85
GetGraphBackgroundBrushFunction · 0.85
DrawLegendFunction · 0.85
GetGraphDbRangeFunction · 0.85
GetDisplayPixelFunction · 0.85
FillUpToFunction · 0.85
MayUsePenGradientsFunction · 0.85
InsertCrossingsFunction · 0.85
GetColorMixFunction · 0.85
GetHeightMethod · 0.80

Tested by

no test coverage detected