*/
+
/** @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"
DCPOMATIC_ENABLE_WARNINGS
#include <iostream>
+
using std::cout;
using std::list;
using std::string;
#endif
using dcp::locale_convert;
+
static constexpr auto INDICATOR_SIZE = 20;
static constexpr auto ROW_HEIGHT = 32;
static constexpr auto MINIMUM_COLUMN_WIDTH = 32;
static constexpr auto COLUMN_PADDING = 16;
static constexpr auto HORIZONTAL_PAGE_SIZE = 32;
+
enum {
ID_off = 1,
ID_minus6dB = 2,
ID_edit = 5
};
+
AudioMappingView::AudioMappingView (wxWindow* parent, wxString left_label, wxString from, wxString top_label, wxString to)
: wxPanel (parent, wxID_ANY)
, _menu_input (0)
_horizontal_scroll->Bind (wxEVT_SCROLL_THUMBRELEASE, boost::bind(&AudioMappingView::scroll, this));
}
+
void
AudioMappingView::size (wxSizeEvent& ev)
{
ev.Skip ();
}
+
void
AudioMappingView::setup ()
{
true);
}
+
void
AudioMappingView::scroll ()
{
Refresh ();
}
+
void
AudioMappingView::paint_static (wxDC& dc)
{
dc.SetFont (*wxSWISS_FONT);
}
+
void
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)
{
);
}
+
void
AudioMappingView::paint_row_labels (wxDC& dc)
{
}
}
+
void
AudioMappingView::paint_row_lines (wxDC& dc)
{
);
}
+
void
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)
dc.DestroyClippingRegion ();
}
+
void
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)
+ 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
{