#include "audio_gain_dialog.h"
#include "lib/audio_mapping.h"
#include "lib/util.h"
-#include "lib/locale_convert.h"
+#include <dcp/locale_convert.h>
#include <dcp/types.h>
#include <wx/wx.h>
#include <wx/renderer.h>
using std::pair;
using std::make_pair;
using boost::shared_ptr;
+using dcp::locale_convert;
#define INDICATOR_SIZE 16
#define LEFT_WIDTH 48
Bind (wxEVT_GRID_CELL_LEFT_CLICK, boost::bind (&AudioMappingView::left_click, this, _1));
Bind (wxEVT_GRID_CELL_RIGHT_CLICK, boost::bind (&AudioMappingView::right_click, this, _1));
_grid->GetGridWindow()->Bind (wxEVT_MOTION, boost::bind (&AudioMappingView::mouse_moved_grid, this, _1));
+ _grid->Bind (wxEVT_SCROLLWIN_TOP, boost::bind (&AudioMappingView::grid_scrolled, this));
+ _grid->Bind (wxEVT_SCROLLWIN_BOTTOM, boost::bind (&AudioMappingView::grid_scrolled, this));
+ _grid->Bind (wxEVT_SCROLLWIN_LINEUP, boost::bind (&AudioMappingView::grid_scrolled, this));
+ _grid->Bind (wxEVT_SCROLLWIN_LINEDOWN, boost::bind (&AudioMappingView::grid_scrolled, this));
+ _grid->Bind (wxEVT_SCROLLWIN_PAGEUP, boost::bind (&AudioMappingView::grid_scrolled, this));
+ _grid->Bind (wxEVT_SCROLLWIN_PAGEDOWN, boost::bind (&AudioMappingView::grid_scrolled, this));
+ _grid->Bind (wxEVT_SCROLLWIN_THUMBTRACK, boost::bind (&AudioMappingView::grid_scrolled, this));
+ _grid->Bind (wxEVT_SCROLLWIN_THUMBRELEASE, boost::bind (&AudioMappingView::grid_scrolled, this));
Bind (wxEVT_SIZE, boost::bind (&AudioMappingView::sized, this, _1));
_menu = new wxMenu;
_menu->Append (ID_minus6dB, _("-6dB"));
_menu->Append (ID_edit, _("Edit..."));
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&AudioMappingView::off, this), ID_off);
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&AudioMappingView::full, this), ID_full);
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&AudioMappingView::minus6dB, this), ID_minus6dB);
- Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&AudioMappingView::edit, this), ID_edit);
+ Bind (wxEVT_MENU, boost::bind (&AudioMappingView::off, this), ID_off);
+ Bind (wxEVT_MENU, boost::bind (&AudioMappingView::full, this), ID_full);
+ Bind (wxEVT_MENU, boost::bind (&AudioMappingView::minus6dB, this), ID_minus6dB);
+ Bind (wxEVT_MENU, boost::bind (&AudioMappingView::edit, this), ID_edit);
_left_labels->Bind (wxEVT_MOTION, bind (&AudioMappingView::mouse_moved_left_labels, this, _1));
}
_grid->AutoSize ();
_left_labels->SetMinSize (wxSize (LEFT_WIDTH, _grid->GetSize().GetHeight()));
_top_labels->SetMinSize (wxSize (_grid->GetSize().GetWidth() + LEFT_WIDTH, top_height));
- /* Try to make the _top_labels 'actua' size respect the minimum we just set */
+ /* Try to make the _top_labels 'actual' size respect the minimum we just set */
_top_labels->Fit ();
_left_labels->Refresh ();
_top_labels->Refresh ();
return;
}
+ int sx, sy;
+ _grid->CalcUnscrolledPosition (0, 0, &sx, &sy);
+ gc->Translate (0, -sy);
+
wxSize const size = dc.GetSize();
int const half = size.GetWidth() / 2;
dc.DrawRotatedText (
j->name,
half + (half - label_height) / 2,
- min (i->second, (i->second + i->first + label_width) / 2),
+ min (i->second, (i->second + i->first + label_width) / 2) - sy,
90
);
dc.DrawRotatedText (
_("Content"),
(half - overall_label_height) / 2,
- min (size.GetHeight(), (size.GetHeight() + _grid->GetColLabelSize() + overall_label_width) / 2),
+ min (size.GetHeight(), (size.GetHeight() + _grid->GetColLabelSize() + overall_label_width) / 2 - sy),
90
);
return;
}
+ int sx, sy;
+ _grid->CalcUnscrolledPosition (0, 0, &sx, &sy);
+ gc->Translate (-sx, 0);
+
wxSize const size = dc.GetSize();
gc->SetAntialiasMode (wxANTIALIAS_DEFAULT);
wxCoord label_height;
dc.GetTextExtent (_("DCP"), &label_width, &label_height);
- dc.DrawText (_("DCP"), (size.GetWidth() + _grid->GetColSize(0) + LEFT_WIDTH - label_width) / 2, (size.GetHeight() - label_height) / 2);
+ dc.DrawText (_("DCP"), (size.GetWidth() + _grid->GetColSize(0) + LEFT_WIDTH - label_width) / 2 - sx, (size.GetHeight() - label_height) / 2);
gc->SetPen (wxPen (wxColour (0, 0, 0)));
wxGraphicsPath lines = gc->CreatePath();
void
AudioMappingView::set_input_groups (vector<Group> const & groups)
{
+ if (_grid->GetNumberRows() == 0) {
+ return;
+ }
+
_input_groups = groups;
_input_group_positions.clear ();
_left_labels->SetToolTip ("");
}
}
+
+void
+AudioMappingView::grid_scrolled ()
+{
+ _left_labels->Refresh ();
+ _left_labels->Update ();
+ _top_labels->Refresh ();
+ _top_labels->Update ();
+}