summaryrefslogtreecommitdiff
path: root/src/wx/dcp_range_dialog.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/wx/dcp_range_dialog.cc')
-rw-r--r--src/wx/dcp_range_dialog.cc119
1 files changed, 68 insertions, 51 deletions
diff --git a/src/wx/dcp_range_dialog.cc b/src/wx/dcp_range_dialog.cc
index d1fef0e8b..1397eb536 100644
--- a/src/wx/dcp_range_dialog.cc
+++ b/src/wx/dcp_range_dialog.cc
@@ -17,64 +17,80 @@
*/
-#include "dcp_range_dialog.h"
#include "lib/film.h"
+#include "dcp_range_dialog.h"
+#include "wx_util.h"
-DCPRangeDialog::DCPRangeDialog (Film* f)
- : _film (f)
- , _whole ("Whole film")
- , _first ("First")
- , _cut ("Cut remainder")
- , _black_out ("Black-out remainder")
+DCPRangeDialog::DCPRangeDialog (wxWindow* p, Film* f)
+ : wxDialog (p, wxID_ANY, _("DCP Range"))
+ , _film (f)
{
- set_title ("DCP range");
-
- Gtk::Table* table = Gtk::manage (new Gtk::Table ());
- table->set_border_width (6);
- table->set_row_spacings (6);
- table->set_col_spacings (6);
- table->attach (_whole, 0, 4, 0, 1);
- table->attach (_first, 0, 1, 1, 2);
- table->attach (_n_frames, 1, 2, 1, 2);
- table->attach (*manage (new Gtk::Label ("frames")), 2, 3, 1, 2);
- table->attach (_cut, 1, 2, 2, 3);
- table->attach (_black_out, 1, 2, 3, 4);
-
- Gtk::RadioButtonGroup g = _whole.get_group ();
- _first.set_group (g);
-
- g = _black_out.get_group ();
- _cut.set_group (g);
-
- _n_frames.set_range (1, INT_MAX - 1);
- _n_frames.set_increments (24, 24 * 60);
+ wxFlexGridSizer* table = new wxFlexGridSizer (2, 6, 6);
+
+ _whole = new wxRadioButton (this, wxID_ANY, _("Whole film"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
+ table->Add (_whole, 1);
+ table->AddSpacer (0);
+
+ _first = new wxRadioButton (this, wxID_ANY, _("First"));
+ table->Add (_first);
+ {
+ wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ _n_frames = new wxSpinCtrl (this, wxID_ANY);
+ s->Add (_n_frames);
+ add_label_to_sizer (s, this, "frames");
+ table->Add (s);
+ }
+
+ table->AddSpacer (0);
+ _cut = new wxRadioButton (this, wxID_ANY, _("Cut remainder"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
+ table->Add (_cut);
+
+ table->AddSpacer (0);
+ _black_out = new wxRadioButton (this, wxID_ANY, _("Black-out remainder"));
+ table->Add (_black_out);
+
+ _n_frames->SetRange (1, INT_MAX - 1);
if (_film->dcp_frames() > 0) {
- _whole.set_active (false);
- _first.set_active (true);
- _n_frames.set_value (_film->dcp_frames ());
+ _whole->SetValue (false);
+ _first->SetValue (true);
+ _n_frames->SetValue (_film->dcp_frames ());
} else {
- _whole.set_active (true);
- _first.set_active (false);
- _n_frames.set_value (24);
+ _whole->SetValue (true);
+ _first->SetValue (false);
+ _n_frames->SetValue (24);
}
- _black_out.set_active (_film->dcp_trim_action() == BLACK_OUT);
- _cut.set_active (_film->dcp_trim_action() == CUT);
+ _black_out->Enable (_film->dcp_trim_action() == BLACK_OUT);
+ _cut->Enable (_film->dcp_trim_action() == CUT);
+
+ _whole->Connect (wxID_ANY, wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler (DCPRangeDialog::whole_toggled), 0, this);
+ _first->Connect (wxID_ANY, wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler (DCPRangeDialog::first_toggled), 0, this);
+ _cut->Connect (wxID_ANY, wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler (DCPRangeDialog::cut_toggled), 0, this);
+ _n_frames->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (DCPRangeDialog::n_frames_changed), 0, this);
- _whole.signal_toggled().connect (sigc::mem_fun (*this, &DCPRangeDialog::whole_toggled));
- _cut.signal_toggled().connect (sigc::mem_fun (*this, &DCPRangeDialog::cut_toggled));
- _n_frames.signal_value_changed().connect (sigc::mem_fun (*this, &DCPRangeDialog::n_frames_changed));
+ wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
+ overall_sizer->Add (table);
+
+ wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
+ if (buttons) {
+ overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
+ }
- get_vbox()->pack_start (*table);
+ SetSizer (overall_sizer);
+ overall_sizer->SetSizeHints (this);
- add_button ("Close", Gtk::RESPONSE_CLOSE);
- show_all_children ();
+ set_sensitivity ();
+}
+void
+DCPRangeDialog::whole_toggled (wxCommandEvent &)
+{
set_sensitivity ();
+ emit_changed ();
}
void
-DCPRangeDialog::whole_toggled ()
+DCPRangeDialog::first_toggled (wxCommandEvent &)
{
set_sensitivity ();
emit_changed ();
@@ -83,19 +99,20 @@ DCPRangeDialog::whole_toggled ()
void
DCPRangeDialog::set_sensitivity ()
{
- _n_frames.set_sensitive (_first.get_active ());
- _black_out.set_sensitive (_first.get_active ());
- _cut.set_sensitive (_first.get_active ());
+ _n_frames->Enable (_first->GetValue ());
+ _black_out->Enable (_first->GetValue ());
+ _cut->Enable (_first->GetValue ());
}
void
-DCPRangeDialog::cut_toggled ()
+DCPRangeDialog::cut_toggled (wxCommandEvent &)
{
+ set_sensitivity ();
emit_changed ();
}
void
-DCPRangeDialog::n_frames_changed ()
+DCPRangeDialog::n_frames_changed (wxCommandEvent &)
{
emit_changed ();
}
@@ -104,12 +121,12 @@ void
DCPRangeDialog::emit_changed ()
{
int frames = 0;
- if (!_whole.get_active ()) {
- frames = _n_frames.get_value_as_int ();
+ if (!_whole->GetValue ()) {
+ frames = _n_frames->GetValue ();
}
TrimAction action = CUT;
- if (_black_out.get_active ()) {
+ if (_black_out->GetValue ()) {
action = BLACK_OUT;
}