Fix CheckOption crash on session-reload
[ardour.git] / gtk2_ardour / option_editor.h
index 93e217f7e7b3f88789fe9f911f771e5376eaf1a0..749df8f90c70e5631770da0e315b19fa44c71ca2 100644 (file)
 #ifndef __gtk_ardour_option_editor_h__
 #define __gtk_ardour_option_editor_h__
 
-#include <gtkmm/notebook.h>
 #include <gtkmm/checkbutton.h>
 #include <gtkmm/comboboxtext.h>
+#include <gtkmm/filechooserbutton.h>
+#include <gtkmm/label.h>
+#include <gtkmm/notebook.h>
+#include <gtkmm/scale.h>
 #include <gtkmm/spinbutton.h>
 #include <gtkmm/table.h>
+#include <gtkmm/treestore.h>
+#include <gtkmm/treeview.h>
 #include <gtkmm/window.h>
 
-#include "gtkmm2ext/slider_controller.h"
+#include "widgets/slider_controller.h"
 
+#include "actions.h"
 #include "ardour_window.h"
 #include "audio_clock.h"
 #include "ardour/types.h"
@@ -182,6 +188,36 @@ protected:
        std::string _name;
 };
 
+/** Just a Gtk Checkbutton, masquerading as an option component */
+class CheckOption : public OptionEditorComponent , public Gtkmm2ext::Activatable
+{
+public:
+       CheckOption (std::string const &, std::string const &, Glib::RefPtr<Gtk::Action> act );
+       virtual ~CheckOption ();
+       void set_state_from_config () {}
+       void parameter_changed (std::string const &) {}
+       void add_to_page (OptionEditorPage*);
+
+       void set_sensitive (bool yn) {
+               _button->set_sensitive (yn);
+       }
+
+       Gtk::Widget& tip_widget() { return *_button; }
+
+protected:
+       void action_toggled ();
+       void action_sensitivity_changed () {}
+       void action_visibility_changed () {}
+
+       virtual void toggled ();
+
+       Gtk::CheckButton*      _button; ///< UI button
+       Gtk::Label*            _label; ///< label for button, so we can use markup
+
+private:
+       sigc::connection       _callback_connection;
+};
+
 /** Component which provides the UI to handle a boolean option using a GTK CheckButton */
 class BoolOption : public Option
 {
@@ -544,7 +580,7 @@ private:
        bool on_key_press (GdkEventKey* ev);
 
        Gtk::Adjustment _db_adjustment;
-       Gtkmm2ext::HSliderController* _db_slider;
+       ArdourWidgets::HSliderController* _db_slider;
        Gtk::Entry _db_display;
        Gtk::Label _label;
        Gtk::HBox _box;
@@ -553,6 +589,21 @@ private:
        sigc::slot<bool, ARDOUR::gain_t> _set;
 };
 
+class WidgetOption : public Option
+{
+  public:
+       WidgetOption (std::string const & i, std::string const & n, Gtk::Widget& w);
+
+       void add_to_page (OptionEditorPage*);
+       void parameter_changed (std::string const &) {}
+       void set_state_from_config () {}
+
+       Gtk::Widget& tip_widget() { return *_widget; }
+
+  private:
+       Gtk::Widget* _widget;
+};
+
 class ClockOption : public Option
 {
 public: