summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-07-13 22:43:56 +0200
committerCarl Hetherington <cth@carlh.net>2025-09-27 22:41:38 +0200
commit4e6e9f6303a0ea00c2bbc2978bde6f9284f6e02f (patch)
treeb4c134cd038e9aa79761a6eebbe18cd8f298699c /src/wx
parent492c0d0597230e680e7b59800d4f6e26d6a82e5e (diff)
White space: markers_panel.{cc,h}
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/markers_panel.cc94
-rw-r--r--src/wx/markers_panel.h28
2 files changed, 61 insertions, 61 deletions
diff --git a/src/wx/markers_panel.cc b/src/wx/markers_panel.cc
index 3ce9cd5a5..3a5e8c30b 100644
--- a/src/wx/markers_panel.cc
+++ b/src/wx/markers_panel.cc
@@ -56,29 +56,29 @@ static constexpr auto line_to_label_gap = 2;
MarkersPanel::MarkersPanel(wxWindow* parent, FilmViewer& viewer)
- : wxPanel (parent, wxID_ANY, wxDefaultPosition, wxSize(-1, 16))
- , _viewer (viewer)
+ : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(-1, 16))
+ , _viewer(viewer)
{
- Bind (wxEVT_PAINT, boost::bind(&MarkersPanel::paint, this));
- Bind (wxEVT_MOTION, boost::bind(&MarkersPanel::mouse_moved, this, _1));
+ Bind(wxEVT_PAINT, boost::bind(&MarkersPanel::paint, this));
+ Bind(wxEVT_MOTION, boost::bind(&MarkersPanel::mouse_moved, this, _1));
- Bind (wxEVT_LEFT_DOWN, boost::bind(&MarkersPanel::mouse_left_down, this));
- Bind (wxEVT_RIGHT_DOWN, boost::bind(&MarkersPanel::mouse_right_down, this, _1));
+ Bind(wxEVT_LEFT_DOWN, boost::bind(&MarkersPanel::mouse_left_down, this));
+ Bind(wxEVT_RIGHT_DOWN, boost::bind(&MarkersPanel::mouse_right_down, this, _1));
- Bind (wxEVT_MENU, boost::bind(&MarkersPanel::move_marker_to_current_position, this), ID_move_marker_to_current_position);
- Bind (wxEVT_MENU, boost::bind(&MarkersPanel::remove_marker, this), ID_remove_marker);
+ Bind(wxEVT_MENU, boost::bind(&MarkersPanel::move_marker_to_current_position, this), ID_move_marker_to_current_position);
+ Bind(wxEVT_MENU, boost::bind(&MarkersPanel::remove_marker, this), ID_remove_marker);
Bind(wxEVT_MENU, boost::bind(&MarkersPanel::add_marker, this, _1), ID_add_base, ID_add_base + all_editable_markers().size() + uneditable_markers);
}
void
-MarkersPanel::set_film (weak_ptr<Film> weak_film)
+MarkersPanel::set_film(weak_ptr<Film> weak_film)
{
_film = weak_film;
- auto film = weak_film.lock ();
+ auto film = weak_film.lock();
if (film) {
- film->Change.connect (boost::bind(&MarkersPanel::film_changed, this, _1, _2));
- update_from_film (film);
+ film->Change.connect(boost::bind(&MarkersPanel::film_changed, this, _1, _2));
+ update_from_film(film);
}
}
@@ -96,15 +96,15 @@ MarkersPanel::film_changed(ChangeType type, FilmProperty property)
}
if (property == FilmProperty::MARKERS || property == FilmProperty::CONTENT || property == FilmProperty::CONTENT_ORDER || property == FilmProperty::VIDEO_FRAME_RATE) {
- update_from_film (film);
+ update_from_film(film);
}
}
void
-MarkersPanel::update_from_film (shared_ptr<Film> film)
+MarkersPanel::update_from_film(shared_ptr<Film> film)
{
- _markers.clear ();
+ _markers.clear();
for (auto const& marker: film->markers()) {
_markers[marker.first] = Marker(
marker.second,
@@ -116,12 +116,12 @@ MarkersPanel::update_from_film (shared_ptr<Film> film)
);
}
- Refresh ();
+ Refresh();
}
int
-MarkersPanel::position (dcpomatic::DCPTime time, int width) const
+MarkersPanel::position(dcpomatic::DCPTime time, int width) const
{
#ifdef DCPOMATIC_LINUX
/* Number of pixels between the left/right bounding box edge of a wxSlider
@@ -131,7 +131,7 @@ MarkersPanel::position (dcpomatic::DCPTime time, int width) const
#else
auto constexpr end_gap = 0;
#endif
- auto film = _film.lock ();
+ auto film = _film.lock();
if (!film) {
return 0;
}
@@ -141,11 +141,11 @@ MarkersPanel::position (dcpomatic::DCPTime time, int width) const
void
-MarkersPanel::mouse_moved (wxMouseEvent& ev)
+MarkersPanel::mouse_moved(wxMouseEvent& ev)
{
_over = boost::none;
- auto film = _film.lock ();
+ auto film = _film.lock();
if (!film) {
return;
}
@@ -167,13 +167,13 @@ MarkersPanel::mouse_moved (wxMouseEvent& ev)
/* Tooltips flicker really badly on Wayland for some reason, so only do this on Windows/macOS for now */
#if !defined(DCPOMATIC_LINUX)
if (!_tip) {
- auto mouse = ClientToScreen (ev.GetPosition());
+ auto mouse = ClientToScreen(ev.GetPosition());
auto rect = wxRect(mouse.x, mouse.y, width * factor, panel_height * factor);
auto hmsf = marker.second.time.split(film->video_frame_rate());
char timecode_buffer[64];
- snprintf (timecode_buffer, sizeof(timecode_buffer), " %02d:%02d:%02d:%02d", hmsf.h, hmsf.m, hmsf.s, hmsf.f);
+ snprintf(timecode_buffer, sizeof(timecode_buffer), " %02d:%02d:%02d:%02d", hmsf.h, hmsf.m, hmsf.s, hmsf.f);
auto tip_text = dcp::marker_to_string(marker.first) + std::string(timecode_buffer);
- _tip = new wxTipWindow (this, std_to_wx(tip_text), 100, &_tip, &rect);
+ _tip = new wxTipWindow(this, std_to_wx(tip_text), 100, &_tip, &rect);
}
#endif
}
@@ -182,18 +182,18 @@ MarkersPanel::mouse_moved (wxMouseEvent& ev)
void
-MarkersPanel::paint ()
+MarkersPanel::paint()
{
- wxPaintDC dc (this);
+ wxPaintDC dc(this);
std::unique_ptr<wxGraphicsContext> gc(wxGraphicsContext::Create(dc));
if (!gc) {
return;
}
- gc->SetAntialiasMode (wxANTIALIAS_DEFAULT);
- gc->SetPen (wxPen(wxColour(200, 0, 0)));
- gc->SetFont (gc->CreateFont(*wxSMALL_FONT, wxColour(200, 0, 0)));
+ gc->SetAntialiasMode(wxANTIALIAS_DEFAULT);
+ gc->SetPen(wxPen(wxColour(200, 0, 0)));
+ gc->SetFont(gc->CreateFont(*wxSMALL_FONT, wxColour(200, 0, 0)));
auto const panel_width = GetSize().GetWidth();
auto const panel_height = GetSize().GetHeight();
@@ -203,14 +203,14 @@ MarkersPanel::paint ()
if (marker.second.width == 0) {
/* We don't know the width of this marker label yet, so calculate it now */
wxDouble width, height, descent, external_leading;
- gc->GetTextExtent (label, &width, &height, &descent, &external_leading);
+ gc->GetTextExtent(label, &width, &height, &descent, &external_leading);
marker.second.width = width;
}
- auto line = gc->CreatePath ();
+ auto line = gc->CreatePath();
auto const pos = position(marker.second.time, panel_width);
- line.MoveToPoint (pos, 0);
- line.AddLineToPoint (pos, panel_height);
- gc->StrokePath (line);
+ line.MoveToPoint(pos, 0);
+ line.AddLineToPoint(pos, panel_height);
+ gc->StrokePath(line);
auto label_x = 0;
@@ -233,7 +233,7 @@ MarkersPanel::paint ()
void
-MarkersPanel::mouse_left_down ()
+MarkersPanel::mouse_left_down()
{
if (_over) {
_viewer.seek(_markers[*_over].time, true);
@@ -242,29 +242,29 @@ MarkersPanel::mouse_left_down ()
void
-MarkersPanel::mouse_right_down (wxMouseEvent& ev)
+MarkersPanel::mouse_right_down(wxMouseEvent& ev)
{
wxMenu menu;
if (_over) {
- menu.Append (ID_move_marker_to_current_position, wxString::Format(_("Move %s marker to current position"), std_to_wx(dcp::marker_to_string(*_over))));
- menu.Append (ID_remove_marker, wxString::Format(_("Remove %s marker"), std_to_wx(dcp::marker_to_string(*_over))));
+ menu.Append(ID_move_marker_to_current_position, wxString::Format(_("Move %s marker to current position"), std_to_wx(dcp::marker_to_string(*_over))));
+ menu.Append(ID_remove_marker, wxString::Format(_("Remove %s marker"), std_to_wx(dcp::marker_to_string(*_over))));
}
- auto add_marker = new wxMenu ();
+ auto add_marker = new wxMenu();
for (auto const& marker: all_editable_markers()) {
- add_marker->Append (static_cast<int>(ID_add_base) + static_cast<int>(marker.second), marker.first);
+ add_marker->Append(static_cast<int>(ID_add_base) + static_cast<int>(marker.second), marker.first);
}
- menu.Append (ID_add_marker, _("Add or move marker to current position"), add_marker);
+ menu.Append(ID_add_marker, _("Add or move marker to current position"), add_marker);
_menu_marker = _over;
- PopupMenu (&menu, ev.GetPosition());
+ PopupMenu(&menu, ev.GetPosition());
}
void
-MarkersPanel::move_marker_to_current_position ()
+MarkersPanel::move_marker_to_current_position()
{
- auto film = _film.lock ();
+ auto film = _film.lock();
if (!film || !_menu_marker) {
return;
}
@@ -274,9 +274,9 @@ MarkersPanel::move_marker_to_current_position ()
void
-MarkersPanel::remove_marker ()
+MarkersPanel::remove_marker()
{
- auto film = _film.lock ();
+ auto film = _film.lock();
if (!film || !_menu_marker) {
return;
}
@@ -286,9 +286,9 @@ MarkersPanel::remove_marker ()
void
-MarkersPanel::add_marker (wxCommandEvent& ev)
+MarkersPanel::add_marker(wxCommandEvent& ev)
{
- auto film = _film.lock ();
+ auto film = _film.lock();
if (!film) {
return;
}
diff --git a/src/wx/markers_panel.h b/src/wx/markers_panel.h
index 3f43ee7d2..45caf9c4e 100644
--- a/src/wx/markers_panel.h
+++ b/src/wx/markers_panel.h
@@ -36,29 +36,29 @@ class MarkersPanel : public wxPanel
public:
MarkersPanel(wxWindow* parent, FilmViewer& viewer);
- void set_film (std::weak_ptr<Film> film);
+ void set_film(std::weak_ptr<Film> film);
private:
- void paint ();
- void mouse_moved (wxMouseEvent& ev);
- void mouse_left_down ();
- void mouse_right_down (wxMouseEvent& ev);
- int position (dcpomatic::DCPTime time, int width) const;
- void move_marker_to_current_position ();
- void remove_marker ();
- void add_marker (wxCommandEvent& ev);
+ void paint();
+ void mouse_moved(wxMouseEvent& ev);
+ void mouse_left_down();
+ void mouse_right_down(wxMouseEvent& ev);
+ int position(dcpomatic::DCPTime time, int width) const;
+ void move_marker_to_current_position();
+ void remove_marker();
+ void add_marker(wxCommandEvent& ev);
void film_changed(ChangeType type, FilmProperty property);
- void update_from_film (std::shared_ptr<Film> film);
+ void update_from_film(std::shared_ptr<Film> film);
wxTipWindow* _tip = nullptr;
class Marker {
public:
- Marker () {}
+ Marker() {}
- Marker (dcpomatic::DCPTime t, bool b)
- : time (t)
- , line_before_label (b)
+ Marker(dcpomatic::DCPTime t, bool b)
+ : time(t)
+ , line_before_label(b)
{}
dcpomatic::DCPTime time;