Tidying up.
authorCarl Hetherington <cth@carlh.net>
Sun, 11 Apr 2021 23:10:03 +0000 (01:10 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 11 Apr 2021 23:10:03 +0000 (01:10 +0200)
src/wx/audio_mapping_view.cc
src/wx/audio_mapping_view.h

index f561f29e57c7440c86e093f70c70530466af4626..7c12a16462d52eacad9e9e0e810c65d017ceb345 100644 (file)
 
 */
 
+
 /** @file  src/wx/audio_mapping_view.cc
  *  @brief AudioMappingView class and helpers.
  */
 
+
 #include "audio_mapping_view.h"
 #include "wx_util.h"
 #include "audio_gain_dialog.h"
@@ -38,6 +40,7 @@ DCPOMATIC_DISABLE_WARNINGS
 DCPOMATIC_ENABLE_WARNINGS
 #include <iostream>
 
+
 using std::cout;
 using std::list;
 using std::string;
@@ -53,6 +56,7 @@ using namespace boost::placeholders;
 #endif
 using dcp::locale_convert;
 
+
 static constexpr auto INDICATOR_SIZE = 20;
 static constexpr auto ROW_HEIGHT = 32;
 static constexpr auto MINIMUM_COLUMN_WIDTH = 32;
@@ -61,6 +65,7 @@ static constexpr auto TOP_HEIGHT = ROW_HEIGHT * 2;
 static constexpr auto COLUMN_PADDING = 16;
 static constexpr auto HORIZONTAL_PAGE_SIZE = 32;
 
+
 enum {
        ID_off = 1,
        ID_minus6dB = 2,
@@ -69,6 +74,7 @@ enum {
        ID_edit = 5
 };
 
+
 AudioMappingView::AudioMappingView (wxWindow* parent, wxString left_label, wxString from, wxString top_label, wxString to)
        : wxPanel (parent, wxID_ANY)
        , _menu_input (0)
@@ -122,6 +128,7 @@ AudioMappingView::AudioMappingView (wxWindow* parent, wxString left_label, wxStr
        _horizontal_scroll->Bind (wxEVT_SCROLL_THUMBRELEASE, boost::bind(&AudioMappingView::scroll, this));
 }
 
+
 void
 AudioMappingView::size (wxSizeEvent& ev)
 {
@@ -129,6 +136,7 @@ AudioMappingView::size (wxSizeEvent& ev)
        ev.Skip ();
 }
 
+
 void
 AudioMappingView::setup ()
 {
@@ -176,12 +184,14 @@ AudioMappingView::setup ()
                true);
 }
 
+
 void
 AudioMappingView::scroll ()
 {
        Refresh ();
 }
 
+
 void
 AudioMappingView::paint_static (wxDC& dc)
 {
@@ -203,6 +213,7 @@ AudioMappingView::paint_static (wxDC& dc)
        dc.SetFont (*wxSWISS_FONT);
 }
 
+
 void
 AudioMappingView::paint_column_labels (wxDC& dc)
 {
@@ -220,6 +231,7 @@ AudioMappingView::paint_column_labels (wxDC& dc)
        dc.DrawLine(wxPoint(LEFT_WIDTH, ROW_HEIGHT * 2), wxPoint(LEFT_WIDTH + _column_widths_total, ROW_HEIGHT * 2));
 }
 
+
 void
 AudioMappingView::paint_column_lines (wxDC& dc)
 {
@@ -238,6 +250,7 @@ AudioMappingView::paint_column_lines (wxDC& dc)
                );
 }
 
+
 void
 AudioMappingView::paint_row_labels (wxDC& dc)
 {
@@ -298,6 +311,7 @@ AudioMappingView::paint_row_labels (wxDC& dc)
        }
 }
 
+
 void
 AudioMappingView::paint_row_lines (wxDC& dc)
 {
@@ -313,6 +327,7 @@ AudioMappingView::paint_row_lines (wxDC& dc)
                );
 }
 
+
 void
 AudioMappingView::paint_indicators (wxDC& dc)
 {
@@ -354,17 +369,6 @@ AudioMappingView::paint_indicators (wxDC& dc)
        }
 }
 
-static
-void clip (wxDC& dc, int x, int y, int w, int h)
-{
-       dc.SetClippingRegion (x, y, w, h);
-}
-
-static
-void translate (wxDC& dc, int x, int y)
-{
-       dc.SetLogicalOrigin (x, y);
-}
 
 static
 void restore (wxDC& dc)
@@ -373,6 +377,7 @@ void restore (wxDC& dc)
        dc.DestroyClippingRegion ();
 }
 
+
 void
 AudioMappingView::paint ()
 {
@@ -383,62 +388,58 @@ AudioMappingView::paint ()
 
        paint_static (dc);
 
-       clip (
-               dc,
+       dc.SetClippingRegion (
                LEFT_WIDTH,
                0,
                _column_widths_total,
                ROW_HEIGHT * (2 + _input_channels.size())
-            );
-       translate (dc, hs, 0);
+               );
+       dc.SetLogicalOrigin (hs, 0);
        paint_column_labels (dc);
        restore (dc);
 
-       clip (
-               dc,
+       dc.SetClippingRegion(
                0,
                TOP_HEIGHT,
                LEFT_WIDTH,
                min(int(ROW_HEIGHT * _input_channels.size()), GetSize().GetHeight() - TOP_HEIGHT) + 1
             );
-       translate (dc, 0, vs);
+       dc.SetLogicalOrigin  (0, vs);
        paint_row_labels (dc);
        restore (dc);
 
-       clip (
-               dc,
+       dc.SetClippingRegion(
                MINIMUM_COLUMN_WIDTH * 2,
                TOP_HEIGHT,
                MINIMUM_COLUMN_WIDTH + _column_widths_total,
                min(int(ROW_HEIGHT * (2 + _input_channels.size())), GetSize().GetHeight() - TOP_HEIGHT)
             );
-       translate (dc, hs, vs);
+       dc.SetLogicalOrigin (hs, vs);
        paint_row_lines (dc);
        restore (dc);
 
-       clip (
-               dc,
+       dc.SetClippingRegion(
                LEFT_WIDTH,
                MINIMUM_COLUMN_WIDTH,
                MINIMUM_COLUMN_WIDTH + _column_widths_total,
                min(int(ROW_HEIGHT * (1 + _input_channels.size())), GetSize().GetHeight() - ROW_HEIGHT)
             );
-       translate (dc, hs, vs);
+       dc.SetLogicalOrigin(hs, vs);
        paint_column_lines (dc);
        restore (dc);
 
-       clip (
-               dc,
+       dc.SetClippingRegion (
                LEFT_WIDTH,
                TOP_HEIGHT,
                _column_widths_total,
                min(int(ROW_HEIGHT * _input_channels.size()), GetSize().GetHeight() - TOP_HEIGHT)
             );
-       translate (dc, hs, vs);
+       dc.SetLogicalOrigin(hs, vs);
        paint_indicators (dc);
        restore (dc);
 }
 
+
 optional<pair<NamedChannel, NamedChannel>>
 AudioMappingView::mouse_event_to_channels (wxMouseEvent& ev) const
 {
index 0e3cc0af8715bdf8e6cfc18bfb7b067a540d3432..aad152a622172be69fb25d9f82adc9e542ad468e 100644 (file)
 
 */
 
+
 /** @file  src/wx/audio_mapping_view.h
  *  @brief AudioMappingView class.
  *
  */
 
+
 #include "lib/audio_mapping.h"
 #include "lib/types.h"
 #include "lib/warnings.h"
@@ -31,6 +33,7 @@ DCPOMATIC_DISABLE_WARNINGS
 DCPOMATIC_ENABLE_WARNINGS
 #include <boost/signals2.hpp>
 
+
 /** @class AudioMappingView
  *  @brief This class displays the mapping of one set of audio channels to another,
  *  with gain values on each node of the map.
@@ -45,7 +48,6 @@ DCPOMATIC_ENABLE_WARNINGS
  *  hidden from view.  Thus input channels are never hidden but output channels
  *  might be.
  */
-
 class AudioMappingView : public wxPanel
 {
 public:
@@ -90,7 +92,7 @@ private:
        void right_down (wxMouseEvent &);
        void motion (wxMouseEvent &);
        void mouse_wheel (wxMouseEvent &);
-       boost::optional<std::pair<NamedChannel, NamedChannel> > mouse_event_to_channels (wxMouseEvent& ev) const;
+       boost::optional<std::pair<NamedChannel, NamedChannel>> mouse_event_to_channels (wxMouseEvent& ev) const;
        boost::optional<std::string> mouse_event_to_input_group_name (wxMouseEvent& ev) const;
        void setup ();
        wxString input_channel_name_with_group (NamedChannel const& n) const;