From 38575cd8056d0c983558525f5ee6137b4fe238c2 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 1 Apr 2010 02:29:13 +0000 Subject: fix save+restore of Gtkmm2ext::Tearoff state; a few cerr cleanups git-svn-id: svn://localhost/ardour2/branches/3.0@6823 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/session.cc | 2 -- libs/gtkmm2ext/gtkmm2ext/tearoff.h | 1 + libs/gtkmm2ext/tearoff.cc | 32 ++++++++++++++++++-------------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 2c5c12f6a2..ad04552820 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -3288,8 +3288,6 @@ Session::next_return_id () void Session::mark_send_id (uint32_t id) { - cerr << "Marking send ID " << id << " in use\n"; - if (id >= send_bitset.size()) { send_bitset.resize (id+16, false); } diff --git a/libs/gtkmm2ext/gtkmm2ext/tearoff.h b/libs/gtkmm2ext/gtkmm2ext/tearoff.h index 9aff73fbb1..051217aedb 100644 --- a/libs/gtkmm2ext/gtkmm2ext/tearoff.h +++ b/libs/gtkmm2ext/gtkmm2ext/tearoff.h @@ -65,6 +65,7 @@ class TearOff : public Gtk::HBox double drag_y; bool dragging; bool _visible; + bool _torn; bool _can_be_torn_off; int own_window_width; int own_window_height; diff --git a/libs/gtkmm2ext/tearoff.cc b/libs/gtkmm2ext/tearoff.cc index 32f440f379..e59a610aa2 100644 --- a/libs/gtkmm2ext/tearoff.cc +++ b/libs/gtkmm2ext/tearoff.cc @@ -35,14 +35,16 @@ using namespace Glib; using namespace std; TearOff::TearOff (Widget& c, bool allow_resize) - : contents (c), - own_window (Gtk::WINDOW_TOPLEVEL), - tearoff_arrow (ARROW_DOWN, SHADOW_OUT), - close_arrow (ARROW_UP, SHADOW_OUT) + : contents (c) + , own_window (Gtk::WINDOW_TOPLEVEL) + , tearoff_arrow (ARROW_DOWN, SHADOW_OUT) + , close_arrow (ARROW_UP, SHADOW_OUT) + , dragging (false) + , _visible (true) + , _torn (false) + , _can_be_torn_off (true) + { - dragging = false; - _visible = true; - _can_be_torn_off = true; own_window_width = 0; own_window_height = 0; own_window_xpos = 0; @@ -111,7 +113,7 @@ TearOff::set_visible (bool yn) { /* don't change visibility if torn off */ - if (own_window.is_visible()) { + if (_torn) { return; } @@ -152,6 +154,9 @@ TearOff::tear_it_off () own_window.show_all (); own_window.present (); hide (); + + _torn = true; + Detach (); } @@ -174,6 +179,9 @@ TearOff::put_it_back () reorder_child (contents, 0); own_window.hide (); show_all (); + + _torn = false; + Attach (); } @@ -246,13 +254,13 @@ TearOff::window_motion (GdkEventMotion* ev) bool TearOff::torn_off() const { - return own_window.is_visible(); + return _torn; } void TearOff::add_state (XMLNode& node) const { - node.add_property ("tornoff", (own_window.is_visible() ? "yes" : "no")); + node.add_property ("tornoff", (_torn ? "yes" : "no")); if (own_window_width > 0) { char buf[32]; @@ -279,10 +287,8 @@ TearOff::set_state (const XMLNode& node) } if (prop->value() == "yes") { - cerr << "Tearing off " << node.name() << endl; tear_it_off (); } else { - cerr << "Putting back " << node.name() << endl; put_it_back (); } @@ -309,8 +315,6 @@ TearOff::set_state (const XMLNode& node) void TearOff::own_window_realized () { - cerr << "tearoff realized\n"; - own_window.get_window()->set_decorations (WMDecoration (DECOR_BORDER|DECOR_RESIZEH)); if (own_window_width > 0) { -- cgit v1.2.3