MCPcopy Create free account
hub / github.com/TypesettingTools/Aegisub / PaintTrackCursor

Method PaintTrackCursor

src/audio_display.cpp:944–986  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

942}
943
944void AudioDisplay::PaintTrackCursor(wxDC &dc) {
945 wxDCPenChanger penchanger(dc, wxPen(*wxWHITE));
946 dc.DrawLine(track_cursor_pos-scroll_left, audio_top, track_cursor_pos-scroll_left, audio_top+audio_height);
947
948 if (track_cursor_label.empty()) return;
949
950 wxDCFontChanger fc(dc);
951 wxFont font = dc.GetFont();
952 wxString face_name = FontFace("Audio/Track Cursor");
953 if (!face_name.empty())
954 font.SetFaceName(face_name);
955 font.SetWeight(wxFONTWEIGHT_BOLD);
956 fc.Set(font);
957
958 wxSize label_size(dc.GetTextExtent(track_cursor_label));
959 wxPoint label_pos(track_cursor_pos - scroll_left - label_size.x/2, audio_top + 2);
960 label_pos.x = mid(2, label_pos.x, GetClientSize().GetWidth() - label_size.x - 2);
961
962 int old_bg_mode = dc.GetBackgroundMode();
963 dc.SetBackgroundMode(wxTRANSPARENT);
964
965 // Draw border
966 dc.SetTextForeground(wxColour(64, 64, 64));
967 dc.DrawText(track_cursor_label, label_pos.x+1, label_pos.y+1);
968 dc.DrawText(track_cursor_label, label_pos.x+1, label_pos.y-1);
969 dc.DrawText(track_cursor_label, label_pos.x-1, label_pos.y+1);
970 dc.DrawText(track_cursor_label, label_pos.x-1, label_pos.y-1);
971
972 // Draw fill
973 dc.SetTextForeground(*wxWHITE);
974 dc.DrawText(track_cursor_label, label_pos.x, label_pos.y);
975 dc.SetBackgroundMode(old_bg_mode);
976
977 label_pos.x -= 2;
978 label_pos.y -= 2;
979 label_size.IncBy(4, 4);
980 // If the rendered text changes size we have to draw it an extra time to make sure the entire thing was drawn
981 bool need_extra_redraw = track_cursor_label_rect.GetSize() != label_size;
982 track_cursor_label_rect.SetPosition(label_pos);
983 track_cursor_label_rect.SetSize(label_size);
984 if (need_extra_redraw)
985 RefreshRect(track_cursor_label_rect, false);
986}
987
988void AudioDisplay::SetDraggedObject(AudioDisplayInteractionObject *new_obj)
989{

Callers

nothing calls this directly

Calls 11

wxPenClass · 0.85
FontFaceFunction · 0.85
wxColourClass · 0.85
DrawLineMethod · 0.80
GetFontMethod · 0.80
SetSizeMethod · 0.80
midFunction · 0.70
SetMethod · 0.45
GetWidthMethod · 0.45
GetSizeMethod · 0.45
SetPositionMethod · 0.45

Tested by

no test coverage detected