list<string> why_not;
bool const can_reference = dcp && dcp->can_reference_audio (why_not);
- _reference->Enable (can_reference);
-
- wxString s;
- if (!can_reference) {
- s = _("Cannot reference this DCP. ");
- BOOST_FOREACH (string i, why_not) {
- s += std_to_wx(i) + wxT(" ");
- }
- }
- _reference->SetToolTip (s);
+ setup_refer_button (_reference, dcp, can_reference, why_not);
if (_reference->GetValue ()) {
_gain->wrapped()->Enable (false);
*/
-#include <wx/notebook.h>
#include "content_sub_panel.h"
#include "content_panel.h"
+#include "wx_util.h"
+#include <wx/notebook.h>
+#include <boost/foreach.hpp>
+using std::list;
+using std::string;
using boost::shared_ptr;
ContentSubPanel::ContentSubPanel (ContentPanel* p, wxString name)
SetSizer (_sizer);
}
+void
+ContentSubPanel::setup_refer_button (wxCheckBox* button, shared_ptr<DCPContent> dcp, bool can_reference, list<string> why_not) const
+{
+ button->Enable (can_reference);
+
+ wxString s;
+ if (!dcp) {
+ s = _("No DCP selected.");
+ } else if (!can_reference) {
+ s = _("Cannot reference this DCP. ");
+ BOOST_FOREACH (string i, why_not) {
+ s += std_to_wx(i) + wxT(" ");
+ }
+ }
+ button->SetToolTip (s);
+}
class ContentPanel;
class Content;
+class DCPContent;
class ContentSubPanel : public wxPanel
{
virtual void content_selection_changed () = 0;
protected:
+
+ void setup_refer_button (wxCheckBox* button, boost::shared_ptr<DCPContent> dcp, bool can_reference, std::list<std::string> why_not) const;
+
ContentPanel* _parent;
wxSizer* _sizer;
};
list<string> why_not;
bool const can_reference = dcp && dcp->can_reference_subtitle (why_not);
- _reference->Enable (can_reference);
-
- wxString s;
- if (!can_reference) {
- s = _("Cannot reference this DCP. ");
- BOOST_FOREACH (string i, why_not) {
- s += std_to_wx(i) + wxT(" ");
- }
- }
- _reference->SetToolTip (s);
+ setup_refer_button (_reference, dcp, can_reference, why_not);
bool const reference = _reference->GetValue ();
}
list<string> why_not;
- bool const can_reference = dcp && dcp->can_reference_video(why_not);
- _reference->Enable (can_reference);
-
- wxString s;
- if (!can_reference) {
- s = _("Cannot reference this DCP. ");
- BOOST_FOREACH (string i, why_not) {
- s += std_to_wx(i) + wxT(" ");
- }
- }
- _reference->SetToolTip (s);
+ bool const can_reference = dcp && dcp->can_reference_video (why_not);
+ setup_refer_button (_reference, dcp, can_reference, why_not);
if (_reference->GetValue ()) {
_frame_type->wrapped()->Enable (false);