diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-11-20 00:19:31 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-11-20 00:19:31 +0000 |
| commit | 492bc5579d950e08847750ee1fba1187ba00d3c3 (patch) | |
| tree | 90a0b8edc7264408e373dfaf27ac868ff531cd9a /src | |
| parent | 2daf0bd6bcbbf2937af2427726e9b15353bf0398 (diff) | |
Add button to restore image subtitle colours.
Diffstat (limited to 'src')
| -rw-r--r-- | src/wx/image_subtitle_colour_dialog.cc | 13 | ||||
| -rw-r--r-- | src/wx/image_subtitle_colour_dialog.h | 2 | ||||
| -rw-r--r-- | src/wx/rgba_colour_picker.cc | 7 | ||||
| -rw-r--r-- | src/wx/rgba_colour_picker.h | 1 |
4 files changed, 23 insertions, 0 deletions
diff --git a/src/wx/image_subtitle_colour_dialog.cc b/src/wx/image_subtitle_colour_dialog.cc index 59c8bc50c..0d102f239 100644 --- a/src/wx/image_subtitle_colour_dialog.cc +++ b/src/wx/image_subtitle_colour_dialog.cc @@ -27,6 +27,7 @@ using std::map; using std::cout; using boost::shared_ptr; +using boost::bind; ImageSubtitleColourDialog::ImageSubtitleColourDialog (wxWindow* parent, shared_ptr<FFmpegContent> content, shared_ptr<FFmpegSubtitleStream> stream) : wxDialog (parent, wxID_ANY, _("Subtitle colours")) @@ -66,6 +67,10 @@ ImageSubtitleColourDialog::ImageSubtitleColourDialog (wxWindow* parent, shared_p overall_sizer->Add (colours_panel, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); + wxButton* restore = new wxButton (this, wxID_ANY, _("Restore to original colours")); + restore->Bind (wxEVT_BUTTON, bind (&ImageSubtitleColourDialog::restore, this)); + overall_sizer->Add (restore, 0, wxALL, DCPOMATIC_SIZER_X_GAP); + wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL); if (buttons) { overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder()); @@ -81,3 +86,11 @@ ImageSubtitleColourDialog::apply () _content->signal_subtitle_stream_changed (); } + +void +ImageSubtitleColourDialog::restore () +{ + for (map<RGBA, RGBAColourPicker*>::const_iterator i = _pickers.begin(); i != _pickers.end(); ++i) { + i->second->set (i->first); + } +} diff --git a/src/wx/image_subtitle_colour_dialog.h b/src/wx/image_subtitle_colour_dialog.h index f04b40b52..133c3b22b 100644 --- a/src/wx/image_subtitle_colour_dialog.h +++ b/src/wx/image_subtitle_colour_dialog.h @@ -34,6 +34,8 @@ public: void apply (); private: + void restore (); + boost::shared_ptr<FFmpegContent> _content; boost::shared_ptr<FFmpegSubtitleStream> _stream; std::map<RGBA, RGBAColourPicker*> _pickers; diff --git a/src/wx/rgba_colour_picker.cc b/src/wx/rgba_colour_picker.cc index 041c78de9..038bf97e4 100644 --- a/src/wx/rgba_colour_picker.cc +++ b/src/wx/rgba_colour_picker.cc @@ -44,3 +44,10 @@ RGBAColourPicker::colour () const wxColour const c = _picker->GetColour (); return RGBA (c.Red(), c.Green(), c.Blue(), _alpha->GetValue()); } + +void +RGBAColourPicker::set (RGBA colour) +{ + _picker->SetColour (wxColour (colour.r, colour.g, colour.b)); + _alpha->SetValue (colour.a); +} diff --git a/src/wx/rgba_colour_picker.h b/src/wx/rgba_colour_picker.h index 8e1fab2cd..c7972d4b3 100644 --- a/src/wx/rgba_colour_picker.h +++ b/src/wx/rgba_colour_picker.h @@ -30,6 +30,7 @@ public: RGBAColourPicker (wxWindow* parent, RGBA colour); RGBA colour () const; + void set (RGBA colour); private: wxColourPickerCtrl* _picker; |
