- delete vistracker;
-}
-
-void
-ProxyBase::set_state (const XMLNode& node)
-{
- XMLNodeList children = node.children ();
-
- XMLNodeList::const_iterator i = children.begin ();
-
- while (i != children.end()) {
- XMLProperty* prop = (*i)->property (X_("name"));
- if ((*i)->name() == X_("Window") && prop && prop->value() == _name) {
- break;
- }
-
- ++i;
- }
-
- if (i != children.end()) {
-
- XMLProperty* prop;
-
- if ((prop = (*i)->property (X_("visible"))) != 0) {
- _visible = PBD::string_is_affirmative (prop->value ());
- }
-
- if ((prop = (*i)->property (X_("x-off"))) != 0) {
- _x_off = atoi (prop->value());
- }
- if ((prop = (*i)->property (X_("y-off"))) != 0) {
- _y_off = atoi (prop->value());
- }
- if ((prop = (*i)->property (X_("x-size"))) != 0) {
- _width = atoi (prop->value());
- }
- if ((prop = (*i)->property (X_("y-size"))) != 0) {
- _height = atoi (prop->value());
- }
- }
-
- /* if we have a window already, reset its properties */
-
- if (_window) {
- setup ();
- }
-}
-
-void
-ProxyBase::set_action (Glib::RefPtr<Gtk::Action> act)
-{
- _action = act;
-}
-
-std::string
-ProxyBase::action_name() const
-{
- return string_compose (X_("toggle-%1"), _name);
-}
-
-void
-ProxyBase::toggle()
-{
- if (!_window) {
- (void) get (true);
- assert (_window);
- /* XXX this is a hack - the window object should really
- ensure its components are all visible. sigh.
- */
- _window->show_all();
- /* we'd like to just call this and nothing else */
- _window->present ();
- } else {
- vistracker->cycle_visibility ();
- }
-}
-
-XMLNode&
-ProxyBase::get_state () const
-{
- XMLNode* node = new XMLNode (X_("Window"));
- char buf[32];
-
- node->add_property (X_("name"), _name);
-
- if (_window && vistracker) {
-
- /* we have a window, so use current state */
-
- _visible = vistracker->partially_visible ();
- _window->get_position (_x_off, _y_off);
- _window->get_size (_width, _height);
- }
-
- node->add_property (X_("visible"), _visible? X_("yes") : X_("no"));
-
- snprintf (buf, sizeof (buf), "%d", _x_off);
- node->add_property (X_("x-off"), buf);
- snprintf (buf, sizeof (buf), "%d", _y_off);
- node->add_property (X_("y-off"), buf);
- snprintf (buf, sizeof (buf), "%d", _width);
- node->add_property (X_("x-size"), buf);
- snprintf (buf, sizeof (buf), "%d", _height);
- node->add_property (X_("y-size"), buf);
-
- return *node;
-}
-
-void
-ProxyBase::drop_window ()
-{
- if (_window) {
- _window->hide ();
- delete _window;
- _window = 0;
- delete vistracker;
- vistracker = 0;
- }
-}
-
-void
-ProxyBase::use_window (Gtk::Window& win)
-{
- drop_window ();
- _window = &win;
- setup ();