Merge branch 'v2.15.x' of ssh://main.carlh.net/home/carl/git/dcpomatic into v2.15.x
[dcpomatic.git] / src / wx / content_widget.h
index 49dceef8ef9e4ae556ffa19f1528e4a0002aec9f..c4ae4d591aaa5d97a472953d4e06626e0236019e 100644 (file)
@@ -1,19 +1,20 @@
 /*
     Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
 
-    This program is free software; you can redistribute it and/or modify
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    This program is distributed in the hope that it will be useful,
+    DCP-o-matic is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 
@@ -48,8 +49,11 @@ public:
        /** @param parent Parent window.
         *  @param wrapped Control widget that we are wrapping.
         *  @param property ContentProperty that the widget is handling.
+        *  @param part Part of Content that the property is in (e.g. &Content::video)
         *  @param model_getter Function on the Content to get the value.
         *  @param model_setter Function on the Content to set the value.
+        *  @param view_to_model Function to convert a view value to a model value.
+        *  @param model_to_view Function to convert a model value to a view value.
         */
        ContentWidget (
                wxWindow* parent,
@@ -101,7 +105,7 @@ public:
                update_from_model ();
 
                for (typename List::iterator i = _content.begin(); i != _content.end(); ++i) {
-                       _connections.push_back ((*i)->Changed.connect (boost::bind (&ContentWidget::model_changed, this, _2)));
+                       _connections.push_back ((*i)->Change.connect (boost::bind (&ContentWidget::model_changed, this, _1, _3)));
                }
        }
 
@@ -145,11 +149,16 @@ public:
                _ignore_model_changes = false;
        }
 
+       void show (bool s)
+       {
+               _wrapped->Show (s);
+       }
+
 private:
 
        void set_single ()
        {
-               if (_wrapped->IsShown ()) {
+               if (_wrapped->IsShown() || !_sizer) {
                        return;
                }
 
@@ -162,7 +171,7 @@ private:
 
        void set_multiple ()
        {
-               if (_button->IsShown ()) {
+               if (_button->IsShown() || !_sizer) {
                        return;
                }
 
@@ -181,9 +190,9 @@ private:
                }
        }
 
-       void model_changed (int property)
+       void model_changed (ChangeType type, int property)
        {
-               if (property == _property && !_ignore_model_changes) {
+               if (type == CHANGE_TYPE_DONE && property == _property && !_ignore_model_changes) {
                        update_from_model ();
                }
        }