mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 16:46:35 +01:00
make window-manager session-aware
This commit is contained in:
parent
cb6f16ac2d
commit
a22e20133d
2 changed files with 38 additions and 8 deletions
|
|
@ -52,6 +52,10 @@ Manager::Manager ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Manager::~Manager ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Manager::register_window (ProxyBase* info)
|
Manager::register_window (ProxyBase* info)
|
||||||
{
|
{
|
||||||
|
|
@ -120,11 +124,9 @@ Manager::add_state (XMLNode& root) const
|
||||||
void
|
void
|
||||||
Manager::set_session (ARDOUR::Session* s)
|
Manager::set_session (ARDOUR::Session* s)
|
||||||
{
|
{
|
||||||
|
SessionHandlePtr::set_session (s);
|
||||||
for (Windows::const_iterator i = _windows.begin(); i != _windows.end(); ++i) {
|
for (Windows::const_iterator i = _windows.begin(); i != _windows.end(); ++i) {
|
||||||
ARDOUR::SessionHandlePtr* sp = (*i)->session_handle ();
|
(*i)->set_session(s);
|
||||||
if (sp) {
|
|
||||||
sp->set_session (s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -358,6 +360,7 @@ ProxyBase::setup ()
|
||||||
if (_x_off != -1 && _y_off != -1) {
|
if (_x_off != -1 && _y_off != -1) {
|
||||||
_window->move (_x_off, _y_off);
|
_window->move (_x_off, _y_off);
|
||||||
}
|
}
|
||||||
|
set_session(_session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -404,6 +407,13 @@ ProxyBase::hide ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ProxyBase::handle_win_event (GdkEventAny *ev)
|
||||||
|
{
|
||||||
|
save_pos_and_size();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ProxyBase::save_pos_and_size ()
|
ProxyBase::save_pos_and_size ()
|
||||||
{
|
{
|
||||||
|
|
@ -422,6 +432,7 @@ ProxyTemporary::~ProxyTemporary ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ARDOUR::SessionHandlePtr*
|
ARDOUR::SessionHandlePtr*
|
||||||
ProxyTemporary::session_handle()
|
ProxyTemporary::session_handle()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ namespace WM {
|
||||||
|
|
||||||
class ProxyBase;
|
class ProxyBase;
|
||||||
|
|
||||||
class Manager
|
class Manager : public ARDOUR::SessionHandlePtr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static Manager& instance();
|
static Manager& instance();
|
||||||
|
|
@ -75,7 +75,7 @@ class Manager
|
||||||
static Manager* _instance;
|
static Manager* _instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ProxyBase : public sigc::trackable {
|
class ProxyBase : public ARDOUR::SessionHandlePtr, public sigc::trackable {
|
||||||
public:
|
public:
|
||||||
ProxyBase (const std::string& name, const std::string& menu_name);
|
ProxyBase (const std::string& name, const std::string& menu_name);
|
||||||
ProxyBase (const std::string& name, const std::string& menu_name, const XMLNode&);
|
ProxyBase (const std::string& name, const std::string& menu_name, const XMLNode&);
|
||||||
|
|
@ -122,6 +122,7 @@ class ProxyBase : public sigc::trackable {
|
||||||
Gtkmm2ext::VisibilityTracker* vistracker;
|
Gtkmm2ext::VisibilityTracker* vistracker;
|
||||||
|
|
||||||
void save_pos_and_size ();
|
void save_pos_and_size ();
|
||||||
|
bool handle_win_event (GdkEventAny *ev);
|
||||||
|
|
||||||
void setup ();
|
void setup ();
|
||||||
};
|
};
|
||||||
|
|
@ -177,6 +178,15 @@ class ProxyWithConstructor: public ProxyBase {
|
||||||
return dynamic_cast<T*> (_window);
|
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:
|
private:
|
||||||
boost::function<T*()> creator;
|
boost::function<T*()> creator;
|
||||||
};
|
};
|
||||||
|
|
@ -215,6 +225,15 @@ class Proxy : public ProxyBase {
|
||||||
return dynamic_cast<T*> (_window);
|
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:
|
private:
|
||||||
boost::function<T*()> creator;
|
boost::function<T*()> creator;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue