summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-03-31 16:16:20 +0100
committerCarl Hetherington <cth@carlh.net>2013-03-31 16:16:20 +0100
commit42e66495a93a04804e9a5373cf673dc8c7a438a6 (patch)
tree4927e64693f67efc2e4dfe92328622002c2200fd /src
parenta054c067ab2cbf6c5abc5df4caa08ffaac206f0b (diff)
Content button sensitivity.
Diffstat (limited to 'src')
-rw-r--r--src/wx/film_editor.cc23
-rw-r--r--src/wx/film_editor.h3
2 files changed, 22 insertions, 4 deletions
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index f9a91f8fa..100d3a93d 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -203,6 +203,7 @@ FilmEditor::connect_to_widgets ()
_edit_dci_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::edit_dci_button_clicked), 0, this);
_format->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::format_changed), 0, this);
_trust_content_header->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::trust_content_header_changed), 0, this);
+ _content->Connect (wxID_ANY, wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler (FilmEditor::content_item_selected), 0, this);
_content_add->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::content_add_clicked), 0, this);
_content_remove->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::content_add_clicked), 0, this);
_content_earlier->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::content_add_clicked), 0, this);
@@ -842,10 +843,6 @@ FilmEditor::set_things_sensitive (bool s)
_content->Enable (s);
_trust_content_header->Enable (s);
_content->Enable (s);
- _content_add->Enable (s);
- _content_remove->Enable (s);
- _content_earlier->Enable (s);
- _content_later->Enable (s);
_left_crop->Enable (s);
_right_crop->Enable (s);
_top_crop->Enable (s);
@@ -867,6 +864,7 @@ FilmEditor::set_things_sensitive (bool s)
setup_subtitle_control_sensitivity ();
setup_show_audio_sensitivity ();
+ setup_content_button_sensitivity ();
}
/** Called when the `Edit filters' button has been clicked */
@@ -1202,3 +1200,20 @@ FilmEditor::content_later_clicked (wxCommandEvent &)
{
}
+
+void
+FilmEditor::content_item_selected (wxListEvent &)
+{
+ setup_content_button_sensitivity ();
+}
+
+void
+FilmEditor::setup_content_button_sensitivity ()
+{
+ _content_add->Enable (_generally_sensitive);
+
+ bool const have_selection = _content->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED) != -1;
+ _content_remove->Enable (have_selection && _generally_sensitive);
+ _content_earlier->Enable (have_selection && _generally_sensitive);
+ _content_later->Enable (have_selection && _generally_sensitive);
+}
diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h
index 52854b894..4048cd587 100644
--- a/src/wx/film_editor.h
+++ b/src/wx/film_editor.h
@@ -30,6 +30,7 @@
class wxNotebook;
class wxListCtrl;
+class wxListEvent;
class Film;
class AudioDialog;
@@ -62,6 +63,7 @@ private:
void top_crop_changed (wxCommandEvent &);
void bottom_crop_changed (wxCommandEvent &);
void trust_content_header_changed (wxCommandEvent &);
+ void content_item_selected (wxListEvent &);
void content_add_clicked (wxCommandEvent &);
void content_remove_clicked (wxCommandEvent &);
void content_earlier_clicked (wxCommandEvent &);
@@ -100,6 +102,7 @@ private:
void setup_dcp_name ();
void setup_show_audio_sensitivity ();
void setup_content ();
+ void setup_content_button_sensitivity ();
void active_jobs_changed (bool);