13
0

make MementoCommand inherit from sigc::trackable so that we don't double-call its object-going-away handler; make big clock float ; do not use shared_ptr<T> in session region signalhandlers, just weak_ptr<T>

git-svn-id: svn://localhost/ardour2/trunk@976 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2006-10-11 19:50:15 +00:00
parent 7cdca2efdb
commit 360a903069
14 changed files with 65 additions and 45 deletions

View File

@ -451,23 +451,6 @@ ARDOUR_UI::setup_transport ()
transport_tearoff_hbox.pack_start (alert_box, false, false);
}
void
ARDOUR_UI::setup_clock ()
{
ARDOUR_UI::Clock.connect (bind (mem_fun (big_clock, &AudioClock::set), false));
big_clock_window = new Window (WINDOW_TOPLEVEL);
big_clock_window->set_border_width (0);
big_clock_window->add (big_clock);
big_clock_window->set_title (_("ardour: clock"));
big_clock_window->set_type_hint (Gdk::WINDOW_TYPE_HINT_MENU);
big_clock_window->signal_realize().connect (bind (sigc::ptr_fun (set_decoration), big_clock_window, (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH)));
big_clock_window->signal_unmap().connect (bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleBigClock")));
manage_window (*big_clock_window);
}
void
ARDOUR_UI::manage_window (Window& win)
{

View File

@ -26,6 +26,8 @@
#include <pbd/pathscanner.h>
#include <gtkmm2ext/utils.h>
#include "ardour_ui.h"
#include "public_editor.h"
#include "audio_clock.h"
@ -39,10 +41,12 @@
#include "i18n.h"
using namespace std;
using namespace ARDOUR;
using namespace PBD;
using namespace Gtk;
using namespace Gtkmm2ext;
using namespace Gtk;
using namespace Glib;
using namespace sigc;
int
@ -558,3 +562,24 @@ ARDOUR_UI::build_menu_bar ()
menu_bar_base.set_name ("MainMenuBar");
menu_bar_base.add (menu_hbox);
}
void
ARDOUR_UI::setup_clock ()
{
ARDOUR_UI::Clock.connect (bind (mem_fun (big_clock, &AudioClock::set), false));
big_clock_window = new Window (WINDOW_TOPLEVEL);
big_clock_window->set_border_width (0);
big_clock_window->add (big_clock);
big_clock_window->set_title (_("ardour: clock"));
big_clock_window->set_type_hint (Gdk::WINDOW_TYPE_HINT_MENU);
big_clock_window->signal_realize().connect (bind (sigc::ptr_fun (set_decoration), big_clock_window, (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH)));
big_clock_window->signal_unmap().connect (bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleBigClock")));
if (editor) {
editor->ensure_float (*big_clock_window);
}
manage_window (*big_clock_window);
}

View File

@ -96,7 +96,7 @@ class ControlPoint
ShapeType _shape;
};
class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible
class AutomationLine : public PBD::StatefulDestructible
{
public:
AutomationLine (const string & name, TimeAxisView&, ArdourCanvas::Group&, ARDOUR::AutomationList&);

View File

@ -54,7 +54,7 @@ class Session;
class Playlist;
class IO;
class Diskstream : public sigc::trackable, public PBD::StatefulDestructible
class Diskstream : public PBD::StatefulDestructible
{
public:
enum Flag {

View File

@ -42,7 +42,7 @@ using std::string;
namespace ARDOUR {
class Location : public sigc::trackable, public PBD::StatefulDestructible
class Location : public PBD::StatefulDestructible
{
public:
enum Flags {

View File

@ -77,7 +77,7 @@ class PluginInfo {
typedef boost::shared_ptr<PluginInfo> PluginInfoPtr;
typedef std::list<PluginInfoPtr> PluginInfoList;
class Plugin : public PBD::StatefulDestructible, public sigc::trackable
class Plugin : public PBD::StatefulDestructible
{
public:
Plugin (ARDOUR::AudioEngine&, ARDOUR::Session&);

View File

@ -103,7 +103,7 @@ using std::string;
using std::map;
using std::set;
class Session : public sigc::trackable, public PBD::StatefulDestructible
class Session : public PBD::StatefulDestructible
{
private:
@ -1434,10 +1434,9 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible
typedef map<PBD::ID,boost::shared_ptr<AudioRegion> > AudioRegionList;
AudioRegionList audio_regions;
void region_renamed (boost::shared_ptr<Region>);
void region_changed (Change, boost::shared_ptr<Region>);
void add_region (boost::shared_ptr<Region>);
void remove_region (boost::shared_ptr<Region>);
void region_changed (Change, boost::weak_ptr<Region>);
void remove_region (boost::weak_ptr<Region>);
int load_regions (const XMLNode& node);

View File

@ -33,7 +33,7 @@ namespace ARDOUR {
class Session;
class Source : public PBD::StatefulDestructible, public sigc::trackable
class Source : public PBD::StatefulDestructible
{
public:
Source (Session&, std::string name);

View File

@ -13,7 +13,7 @@ namespace ARDOUR {
typedef uint32_t state_id_t;
class StateManager : public sigc::trackable
class StateManager : public virtual sigc::trackable
{
public:
struct State {

View File

@ -31,6 +31,7 @@
#include <pbd/basename.h>
#include <pbd/xml++.h>
#include <pbd/stacktrace.h>
#include <ardour/audioregion.h>
#include <ardour/session.h>
@ -325,6 +326,7 @@ AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node)
AudioRegion::~AudioRegion ()
{
notify_callbacks ();
GoingAway (); /* EMIT SIGNAL */
}

View File

@ -147,9 +147,7 @@ Region::Region (const XMLNode& node)
Region::~Region ()
{
notify_callbacks ();
/* derived classes must emit GoingAway */
/* derived classes must call notify_callbacks() and then emit GoingAway */
}
void

View File

@ -463,8 +463,15 @@ Session::~Session ()
cerr << "delete audio regions\n";
#endif /* TRACK_DESTRUCTION */
for (AudioRegionList::iterator i = audio_regions.begin(); i != audio_regions.end(); ++i) {
for (AudioRegionList::iterator i = audio_regions.begin(); i != audio_regions.end(); ) {
AudioRegionList::iterator tmp;
tmp = i;
++tmp;
i->second->drop_references ();
i = tmp;
}
audio_regions.clear ();
@ -2447,15 +2454,21 @@ Session::add_region (boost::shared_ptr<Region> region)
set_dirty();
if (added) {
region->GoingAway.connect (sigc::bind (mem_fun (*this, &Session::remove_region), region));
region->StateChanged.connect (sigc::bind (mem_fun (*this, &Session::region_changed), region));
region->GoingAway.connect (sigc::bind (mem_fun (*this, &Session::remove_region), boost::weak_ptr<Region>(region)));
region->StateChanged.connect (sigc::bind (mem_fun (*this, &Session::region_changed), boost::weak_ptr<Region>(region)));
AudioRegionAdded (ar); /* EMIT SIGNAL */
}
}
void
Session::region_changed (Change what_changed, boost::shared_ptr<Region> region)
Session::region_changed (Change what_changed, boost::weak_ptr<Region> weak_region)
{
boost::shared_ptr<Region> region (weak_region.lock ());
if (!region) {
return;
}
if (what_changed & Region::HiddenChanged) {
/* relay hidden changes */
RegionHiddenChange (region);
@ -2463,15 +2476,15 @@ Session::region_changed (Change what_changed, boost::shared_ptr<Region> region)
}
void
Session::region_renamed (boost::shared_ptr<Region> region)
{
add_region (region);
}
void
Session::remove_region (boost::shared_ptr<Region> region)
Session::remove_region (boost::weak_ptr<Region> weak_region)
{
AudioRegionList::iterator i;
boost::shared_ptr<Region> region (weak_region.lock ());
if (!region) {
return;
}
boost::shared_ptr<AudioRegion> ar;
bool removed = false;
@ -2482,7 +2495,6 @@ Session::remove_region (boost::shared_ptr<Region> region)
if ((i = audio_regions.find (region->id())) != audio_regions.end()) {
audio_regions.erase (i);
removed = true;
cerr << "done\n";
}
} else {

View File

@ -253,7 +253,8 @@ static bool idle_quit ()
void
UI::do_quit ()
{
Glib::signal_idle().connect (sigc::ptr_fun (idle_quit));
Gtk::Main::quit ();
// Glib::signal_idle().connect (sigc::ptr_fun (idle_quit));
}
void

View File

@ -5,7 +5,7 @@
namespace PBD {
class Destructible {
class Destructible : public virtual sigc::trackable {
public:
Destructible() {}
virtual ~Destructible () {}