Scroll image subtitle colour dialogue.
authorCarl Hetherington <cth@carlh.net>
Sun, 20 Nov 2016 00:07:47 +0000 (00:07 +0000)
committerCarl Hetherington <cth@carlh.net>
Sun, 20 Nov 2016 00:07:47 +0000 (00:07 +0000)
src/wx/image_subtitle_colour_dialog.cc
src/wx/image_subtitle_colour_dialog.h

index d8018844cc632b65e3867a9b57c98b3963bcb300..59c8bc50cc136608b9256261b05753fdd6f10bd6 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "image_subtitle_colour_dialog.h"
 #include "rgba_colour_picker.h"
+#include "wx_util.h"
 #include "lib/ffmpeg_subtitle_stream.h"
 #include "lib/ffmpeg_content.h"
 
@@ -28,29 +29,47 @@ using std::cout;
 using boost::shared_ptr;
 
 ImageSubtitleColourDialog::ImageSubtitleColourDialog (wxWindow* parent, shared_ptr<FFmpegContent> content, shared_ptr<FFmpegSubtitleStream> stream)
-       : TableDialog (parent, _("Subtitle colours"), 2, 1, true)
+       : wxDialog (parent, wxID_ANY, _("Subtitle colours"))
        , _content (content)
        , _stream (stream)
 {
+       wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
+       SetSizer (overall_sizer);
+
+       wxScrolled<wxPanel>* colours_panel = new wxScrolled<wxPanel> (this);
+       colours_panel->EnableScrolling (false, true);
+       colours_panel->ShowScrollbars (wxSHOW_SB_NEVER, wxSHOW_SB_ALWAYS);
+       colours_panel->SetScrollRate (0, 16);
+
+       wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+       table->AddGrowableCol (1, 1);
+
        map<RGBA, RGBA> colours = _stream->colours ();
 
-       wxStaticText* t = new wxStaticText (this, wxID_ANY, "");
+       wxStaticText* t = new wxStaticText (colours_panel, wxID_ANY, "");
        t->SetLabelMarkup (_("<b>Original colour</b>"));
-       add (t);
-       t = new wxStaticText (this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL);
+       table->Add (t, 1, wxEXPAND);
+       t = new wxStaticText (colours_panel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL);
        t->SetLabelMarkup (_("<b>New colour</b>"));
-       add (t, 1, wxALIGN_CENTER);
+       table->Add (t, 1, wxALIGN_CENTER);
 
        for (map<RGBA, RGBA>::const_iterator i = colours.begin(); i != colours.end(); ++i) {
-               wxPanel* from = new wxPanel (this, wxID_ANY);
+               wxPanel* from = new wxPanel (colours_panel, wxID_ANY);
                from->SetBackgroundColour (wxColour (i->first.r, i->first.g, i->first.b, i->first.a));
-               add (from);
-               RGBAColourPicker* to = new RGBAColourPicker (this, i->second);
-               add (to);
+               table->Add (from, 1, wxEXPAND);
+               RGBAColourPicker* to = new RGBAColourPicker (colours_panel, i->second);
+               table->Add (to, 1, wxEXPAND);
                _pickers[i->first] = to;
        }
 
-       layout ();
+       colours_panel->SetSizer (table);
+
+       overall_sizer->Add (colours_panel, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
+
+       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
+       if (buttons) {
+               overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
+       }
 }
 
 void
index d6d9443a821ac24155226661bb30f1dcf8cae416..f04b40b52eefcf2958d9eb52b233eca735f757b3 100644 (file)
@@ -26,7 +26,7 @@ class RGBAColourPicker;
 class FFmpegContent;
 class FFmpegSubtitleStream;
 
-class ImageSubtitleColourDialog : public TableDialog
+class ImageSubtitleColourDialog : public wxDialog
 {
 public:
        ImageSubtitleColourDialog (wxWindow* parent, boost::shared_ptr<FFmpegContent> content, boost::shared_ptr<FFmpegSubtitleStream> stream);