nick m's fix for markers etc ; several tweaks for mute/solo ; rename run_in_place...
[ardour.git] / libs / gtkmm2ext / tearoff.cc
index 3df70ad54b85840863ad012ae42206c7c13cbef9..be3bfe4113fbdedfb01f11d4829ab88ce8bae541 100644 (file)
@@ -36,6 +36,7 @@ TearOff::TearOff (Widget& c, bool allow_resize)
 {
        dragging = false;
        _visible = true;
+       _can_be_torn_off = true;
 
        tearoff_event_box.add (tearoff_arrow);
        tearoff_event_box.set_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK);
@@ -51,7 +52,7 @@ TearOff::TearOff (Widget& c, bool allow_resize)
        
        VBox* box1;
        box1 = manage (new VBox);
-       box1->pack_start (close_event_box, false, false, 5);
+       box1->pack_start (close_event_box, false, false, 2);
        
        window_box.pack_end (*box1, false, false, 2);
        own_window.add (window_box);
@@ -67,7 +68,7 @@ TearOff::TearOff (Widget& c, bool allow_resize)
 
        VBox* box2;
        box2 = manage (new VBox);
-       box2->pack_start (tearoff_event_box, false, false, 5);
+       box2->pack_start (tearoff_event_box, false, false, 2);
 
        pack_start (contents);
        pack_start (*box2, false, false, 2);
@@ -78,6 +79,21 @@ TearOff::~TearOff ()
 {
 }
 
+void
+TearOff::set_can_be_torn_off (bool yn)
+{
+       if (yn != _can_be_torn_off) {
+               if (yn) {
+                       tearoff_arrow.set_no_show_all (false);
+                       tearoff_arrow.show ();
+               } else {
+                       tearoff_arrow.set_no_show_all (true);
+                       tearoff_arrow.hide ();
+               }
+               _can_be_torn_off = yn;
+       }
+}
+
 void
 TearOff::set_visible (bool yn)
 {
@@ -102,13 +118,16 @@ TearOff::set_visible (bool yn)
 gint
 TearOff::tearoff_click (GdkEventButton* ev)
 {
-       remove (contents);
-       window_box.pack_start (contents);
-       own_window.set_name (get_name());
-       close_event_box.set_name (get_name());
-       own_window.show_all ();
-       hide ();
-       Detach ();
+       if (_can_be_torn_off) {
+               remove (contents);
+               window_box.pack_start (contents);
+               own_window.set_name (get_name());
+               close_event_box.set_name (get_name());
+               own_window.show_all ();
+               hide ();
+               Detach ();
+       }
+
        return true;
 }