13
0

make window-manager session-aware

This commit is contained in:
Robin Gareus 2013-07-07 17:44:00 +02:00
parent cb6f16ac2d
commit a22e20133d
2 changed files with 38 additions and 8 deletions

View File

@ -52,6 +52,10 @@ Manager::Manager ()
{
}
Manager::~Manager ()
{
}
void
Manager::register_window (ProxyBase* info)
{
@ -120,11 +124,9 @@ Manager::add_state (XMLNode& root) const
void
Manager::set_session (ARDOUR::Session* s)
{
SessionHandlePtr::set_session (s);
for (Windows::const_iterator i = _windows.begin(); i != _windows.end(); ++i) {
ARDOUR::SessionHandlePtr* sp = (*i)->session_handle ();
if (sp) {
sp->set_session (s);
}
(*i)->set_session(s);
}
}
@ -358,6 +360,7 @@ ProxyBase::setup ()
if (_x_off != -1 && _y_off != -1) {
_window->move (_x_off, _y_off);
}
set_session(_session);
}
void
@ -404,6 +407,13 @@ ProxyBase::hide ()
}
}
bool
ProxyBase::handle_win_event (GdkEventAny *ev)
{
save_pos_and_size();
return 0;
}
void
ProxyBase::save_pos_and_size ()
{
@ -422,6 +432,7 @@ ProxyTemporary::~ProxyTemporary ()
{
}
ARDOUR::SessionHandlePtr*
ProxyTemporary::session_handle()
{

View File

@ -47,7 +47,7 @@ namespace WM {
class ProxyBase;
class Manager
class Manager : public ARDOUR::SessionHandlePtr
{
public:
static Manager& instance();
@ -75,7 +75,7 @@ class Manager
static Manager* _instance;
};
class ProxyBase : public sigc::trackable {
class ProxyBase : public ARDOUR::SessionHandlePtr, public sigc::trackable {
public:
ProxyBase (const std::string& name, const std::string& menu_name);
ProxyBase (const std::string& name, const std::string& menu_name, const XMLNode&);
@ -122,6 +122,7 @@ class ProxyBase : public sigc::trackable {
Gtkmm2ext::VisibilityTracker* vistracker;
void save_pos_and_size ();
bool handle_win_event (GdkEventAny *ev);
void setup ();
};
@ -177,6 +178,15 @@ class ProxyWithConstructor: public ProxyBase {
return dynamic_cast<T*> (_window);
}
void set_session(ARDOUR::Session *s) {
SessionHandlePtr::set_session (s);
ARDOUR::SessionHandlePtr* sp = session_handle ();
if (sp) {
sp->set_session (s);
dynamic_cast<T*>(_window)->set_session(s);
}
}
private:
boost::function<T*()> creator;
};
@ -215,6 +225,15 @@ class Proxy : public ProxyBase {
return dynamic_cast<T*> (_window);
}
void set_session(ARDOUR::Session *s) {
SessionHandlePtr::set_session (s);
ARDOUR::SessionHandlePtr* sp = session_handle ();
if (sp) {
sp->set_session (s);
dynamic_cast<T*>(_window)->set_session(s);
}
}
private:
boost::function<T*()> creator;
};