2 Copyright (C) 2023 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
22 #include "dcp_timeline_reel_marker_view.h"
23 LIBDCP_DISABLE_WARNINGS
24 #include <wx/graphics.h>
25 LIBDCP_ENABLE_WARNINGS
29 using namespace dcpomatic;
32 DCPTimelineReelMarkerView::DCPTimelineReelMarkerView(DCPTimeline& timeline, int y_pos)
33 : DCPTimelineView(timeline)
41 DCPTimelineReelMarkerView::x_pos() const
43 /* Nudge it over slightly so that the full line width is drawn on the left hand side */
44 return time_x(_time) + 2;
49 DCPTimelineReelMarkerView::do_paint(wxGraphicsContext* gc)
51 wxColour const outline = _active ? wxColour(0, 0, 0) : wxColour(128, 128, 128);
52 wxColour const fill = _active ? wxColour(255, 0, 0) : wxColour(192, 192, 192);
53 gc->SetPen(*wxThePenList->FindOrCreatePen(outline, 2, wxPENSTYLE_SOLID));
54 gc->SetBrush(*wxTheBrushList->FindOrCreateBrush(fill, wxBRUSHSTYLE_SOLID));
56 gc->DrawRectangle(x_pos(), _y_pos, HEAD_SIZE, HEAD_SIZE);
58 auto path = gc->CreatePath();
59 path.MoveToPoint(x_pos(), _y_pos + HEAD_SIZE + TAIL_LENGTH);
60 path.AddLineToPoint(x_pos(), _y_pos);
67 DCPTimelineReelMarkerView::bbox() const
69 return { x_pos(), _y_pos, HEAD_SIZE, HEAD_SIZE + TAIL_LENGTH };