13
0

fix for erroneous use of a menu group; remove lots of cerr cruft; no playlist ops for destructive tracks

git-svn-id: svn://localhost/trunk/ardour2@359 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2006-03-08 15:37:39 +00:00
parent 0d2c8771a7
commit 10976e9a3b
10 changed files with 45 additions and 99 deletions

View File

@ -193,9 +193,8 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt
controls_table.attach (size_button, 2, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
controls_table.attach (automation_button, 3, 4, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
if (is_audio_track()) {
if (is_audio_track() && audio_track()->mode() == ARDOUR::Normal) {
controls_table.attach (playlist_button, 5, 6, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
}
/* remove focus from the buttons */
@ -338,29 +337,30 @@ AudioTimeAxisView::edit_click (GdkEventButton *ev)
using namespace Menu_Helpers;
MenuList& items = edit_group_menu.items ();
RadioMenuItem::Group group;
items.clear ();
items.push_back (RadioMenuElem (edit_group_menu_radio_group, _("No group"),
bind (mem_fun(*this, &AudioTimeAxisView::set_edit_group_from_menu), (RouteGroup *) 0)));
items.push_back (RadioMenuElem (group, _("No group"),
bind (mem_fun(*this, &AudioTimeAxisView::set_edit_group_from_menu), (RouteGroup *) 0)));
if (_route.edit_group() == 0) {
static_cast<RadioMenuItem*>(&items.back())->set_active ();
}
_session.foreach_edit_group (this, &AudioTimeAxisView::add_edit_group_menu_item);
_session.foreach_edit_group (bind (mem_fun (*this, &AudioTimeAxisView::add_edit_group_menu_item), &group));
edit_group_menu.popup (ev->button, ev->time);
return FALSE;
}
void
AudioTimeAxisView::add_edit_group_menu_item (RouteGroup *eg)
AudioTimeAxisView::add_edit_group_menu_item (RouteGroup *eg, RadioMenuItem::Group* group)
{
using namespace Menu_Helpers;
MenuList &items = edit_group_menu.items();
items.push_back (RadioMenuElem (edit_group_menu_radio_group,
eg->name(), bind (mem_fun(*this, &AudioTimeAxisView::set_edit_group_from_menu), eg)));
items.push_back (RadioMenuElem (*group, eg->name(), bind (mem_fun(*this, &AudioTimeAxisView::set_edit_group_from_menu), eg)));
if (_route.edit_group() == eg) {
static_cast<RadioMenuItem*>(&items.back())->set_active ();
}
@ -832,12 +832,7 @@ AudioTimeAxisView::rename_current_playlist ()
AudioPlaylist *pl;
DiskStream *ds;
/* neither conditions are supposed to be true at this
time, but to leave the design flexible, allow
them to be in the future without causing crashes
*/
if (((ds = get_diskstream()) == 0) ||((pl = ds->playlist()) == 0)) {
if (((ds = get_diskstream()) == 0) || ds->destructive() || ((pl = ds->playlist()) == 0)) {
return;
}
@ -864,12 +859,7 @@ AudioTimeAxisView::use_copy_playlist (bool prompt)
DiskStream *ds;
string name;
/* neither conditions are supposed to be true at this
time, but to leave the design flexible, allow
them to be in the future without causing crashes
*/
if (((ds = get_diskstream()) == 0) || ((pl = ds->playlist()) == 0)) {
if (((ds = get_diskstream()) == 0) || ds->destructive() || ((pl = ds->playlist()) == 0)) {
return;
}
@ -906,13 +896,8 @@ AudioTimeAxisView::use_new_playlist (bool prompt)
AudioPlaylist *pl;
DiskStream *ds;
string name;
/* neither conditions are supposed to be true at this
time, but to leave the design flexible, allow
them to be in the future without causing crashes
*/
if (((ds = get_diskstream()) == 0) || ((pl = ds->playlist()) == 0)) {
if (((ds = get_diskstream()) == 0) || ds->destructive() || ((pl = ds->playlist()) == 0)) {
return;
}

View File

@ -192,9 +192,8 @@ class AudioTimeAxisView : public RouteUI, public TimeAxisView
virtual void label_view ();
Gtk::Menu edit_group_menu;
Gtk::RadioMenuItem::Group edit_group_menu_radio_group;
void add_edit_group_menu_item (ARDOUR::RouteGroup *);
void add_edit_group_menu_item (ARDOUR::RouteGroup *, Gtk::RadioMenuItem::Group*);
void set_edit_group_from_menu (ARDOUR::RouteGroup *);
void reset_samples_per_unit ();

View File

@ -1195,7 +1195,7 @@ Editor::connect_to_session (Session *t)
session_connections.push_back (session->tempo_map().StateChanged.connect (mem_fun(*this, &Editor::tempo_map_changed)));
session->foreach_edit_group(this, &Editor::add_edit_group);
session->foreach_edit_group (mem_fun (*this, &Editor::add_edit_group));
edit_cursor_clock.set_session (session);
selection_start_clock.set_session (session);

View File

@ -1155,12 +1155,12 @@ MixerStrip::set_mix_group (RouteGroup *rg)
}
void
MixerStrip::add_mix_group_to_menu (RouteGroup *rg)
MixerStrip::add_mix_group_to_menu (RouteGroup *rg, RadioMenuItem::Group* group)
{
using namespace Menu_Helpers;
MenuList& items = group_menu->items();
items.push_back (MenuElem (rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
items.push_back (RadioMenuElem (*group, rg->name(), bind (mem_fun(*this, &MixerStrip::set_mix_group), rg)));
}
gint
@ -1171,9 +1171,11 @@ MixerStrip::select_mix_group (GdkEventButton *ev)
group_menu = new Menu;
group_menu->set_name ("ArdourContextMenu");
MenuList& items = group_menu->items();
RadioMenuItem::Group group;
items.push_back (RadioMenuElem (group, _("no group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
items.push_back (MenuElem (_("no group"), bind (mem_fun(*this, &MixerStrip::set_mix_group), (RouteGroup *) 0)));
_session.foreach_mix_group (this, &MixerStrip::add_mix_group_to_menu);
_session.foreach_mix_group (bind (mem_fun (*this, &MixerStrip::add_mix_group_to_menu), &group));
group_menu->popup (ev->button, 0);
return stop_signal (group_button, "button_press_event");

View File

@ -231,7 +231,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
bool ignore_comment_edit;
void set_mix_group (ARDOUR::RouteGroup *);
void add_mix_group_to_menu (ARDOUR::RouteGroup *);
void add_mix_group_to_menu (ARDOUR::RouteGroup *, Gtk::RadioMenuItem::Group*);
gint select_mix_group (GdkEventButton *);
void mix_group_changed (void *);

View File

@ -313,7 +313,7 @@ Mixer_UI::connect_to_session (Session* sess)
session->RouteAdded.connect (mem_fun(*this, &Mixer_UI::add_strip));
session->mix_group_added.connect (mem_fun(*this, &Mixer_UI::add_mix_group));
session->foreach_mix_group(this, &Mixer_UI::add_mix_group);
session->foreach_mix_group (mem_fun (*this, &Mixer_UI::add_mix_group));
_plugin_selector->set_session (session);

View File

@ -125,18 +125,6 @@ TapeAudioRegionView::update (uint32_t n)
ENSURE_GUI_THREAD (bind (mem_fun(*this, &TapeAudioRegionView::update), n));
cerr << "peaks ready for channel " << n << endl;
cerr << "tmp waves size = " << tmp_waves.size() << " waves size = " << waves.size() << endl;
for (uint32_t x = 0; x < waves.size(); ++x) {
cerr << "waves[" << x << "] = " << waves[x] << endl;
}
for (vector<WaveView*>::iterator i = waves.begin(); i != waves.end(); ++i) {
cerr << "iterator[" << distance (i, waves.begin()) << "] = " << (*i) << endl;
}
/* this triggers a cache invalidation and redraw in the waveview */
waves[n]->property_data_src() = &region;

View File

@ -511,17 +511,15 @@ class Session : public sigc::trackable, public Stateful
sigc::signal<void,RouteGroup*> edit_group_added;
sigc::signal<void,RouteGroup*> mix_group_added;
template<class T> void foreach_edit_group (T *obj, void (T::*func)(RouteGroup *)) {
list<RouteGroup *>::iterator i;
for (i = edit_groups.begin(); i != edit_groups.end(); i++) {
(obj->*func)(*i);
void foreach_edit_group (sigc::slot<void,RouteGroup*> sl) {
for (list<RouteGroup *>::iterator i = edit_groups.begin(); i != edit_groups.end(); i++) {
sl (*i);
}
}
template<class T> void foreach_mix_group (T *obj, void (T::*func)(RouteGroup *)) {
list<RouteGroup *>::iterator i;
for (i = mix_groups.begin(); i != mix_groups.end(); i++) {
(obj->*func)(*i);
void foreach_mix_group (sigc::slot<void,RouteGroup*> sl) {
for (list<RouteGroup *>::iterator i = mix_groups.begin(); i != mix_groups.end(); i++) {
sl (*i);
}
}

View File

@ -53,9 +53,6 @@ AudioTrack::AudioTrack (Session& sess, string name, Route::Flag flag, TrackMode
if (mode == Destructive) {
dflags = DiskStream::Flag (dflags | DiskStream::Destructive);
cerr << "Creating a new audio track, destructive mode\n";
} else {
cerr << "Creating a new audio track, NOT destructive mode\n";
}
DiskStream* ds = new DiskStream (_session, name, dflags);

View File

@ -406,6 +406,10 @@ DiskStream::use_new_playlist ()
string newname;
AudioPlaylist* playlist;
if (!in_set_state && destructive()) {
return 0;
}
if (_playlist) {
newname = Playlist::bump_name (_playlist->name(), _session);
} else {
@ -423,6 +427,10 @@ DiskStream::use_new_playlist ()
int
DiskStream::use_copy_playlist ()
{
if (destructive()) {
return 0;
}
if (_playlist == 0) {
error << string_compose(_("DiskStream %1: there is no existing playlist to make a copy of!"), _name) << endmsg;
return -1;
@ -663,8 +671,6 @@ DiskStream::check_record_status (jack_nframes_t transport_frame, jack_nframes_t
}
if (_flags & Recordable) {
cerr << "START RECORD @ " << capture_start_frame << endl;
for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
RingBufferNPT<CaptureTransition>::rw_vector transvec;
@ -677,7 +683,8 @@ DiskStream::check_record_status (jack_nframes_t transport_frame, jack_nframes_t
}
else {
// bad!
cerr << "capture_transition_buf is full on rec start! inconceivable!" << endl;
fatal << X_("programming error: capture_transition_buf is full on rec start! inconceivable!")
<< endmsg;
}
}
}
@ -1562,10 +1569,8 @@ DiskStream::do_flush (char * workbuf, bool force_flush)
if (captrans.type == CaptureStart) {
// by definition, the first data we got above represents the given capture pos
cerr << "DS " << name() << " got CaptureStart at " << captrans.capture_val << endl;
(*chan).write_source->mark_capture_start (captrans.capture_val);
(*chan).curr_capture_cnt = 0;
have_start = true;
@ -1576,18 +1581,8 @@ DiskStream::do_flush (char * workbuf, bool force_flush)
if (captrans.capture_val <= (*chan).curr_capture_cnt + to_write) {
cerr << "DS " << name() << " got CaptureEnd with " << captrans.capture_val << endl;
// shorten to make the write a perfect fit
uint32_t nto_write = (captrans.capture_val - (*chan).curr_capture_cnt);
if (have_start) {
// starts and ends within same chunk we're processing
cerr << "Starts and ends within same chunk: adjusting to_write from: "
<< to_write << " to: " << nto_write << endl;
}
else {
cerr << "Ends within chunk: adjusting to_write to: "
<< to_write << " to: " << nto_write << endl;
}
if (nto_write < to_write) {
ret = 1; // should we?
@ -1602,8 +1597,6 @@ DiskStream::do_flush (char * workbuf, bool force_flush)
}
else {
// actually ends just beyond this chunk, so force more work
cerr << "DS " << name() << " got CaptureEnd beyond our chunk, cnt of: "
<< captrans.capture_val << " leaving on queue" << endl;
ret = 1;
break;
}
@ -1856,8 +1849,7 @@ DiskStream::finish_capture (bool rec_monitors_input)
return;
}
if ((_flags & Recordable) && destructive()) {
cerr << "RECORD END @ " << capture_start_frame + capture_captured << endl;
if (recordable() && destructive()) {
for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
RingBufferNPT<CaptureTransition>::rw_vector transvec;
@ -1971,10 +1963,6 @@ DiskStream::get_state ()
char buf[64];
LocaleGuard lg (X_("POSIX"));
if (destructive()) {
node->add_property ("destructive", "true");
}
snprintf (buf, sizeof(buf), "%zd", channels.size());
node->add_property ("channels", buf);
@ -2049,12 +2037,6 @@ DiskStream::set_state (const XMLNode& node)
_name = prop->value();
}
if ((prop = node.property ("destructive")) != 0) {
if (prop->value() == "true") {
_flags |= Destructive;
}
}
if (deprecated_io_node) {
if ((prop = deprecated_io_node->property ("id")) != 0) {
sscanf (prop->value().c_str(), "%" PRIu64, &_id);
@ -2129,17 +2111,14 @@ DiskStream::set_state (const XMLNode& node)
in_set_state = false;
/* now that we're all done with playlist+channel set up,
go ahead and create write sources.
*/
/* make sure this is clear before we do anything else */
capturing_sources.clear ();
if (recordable() && !destructive()) {
/* destructive diskstreams get their sources set up elsewhere */
reset_write_sources (false);
}
/* write sources are handled elsewhere;
for destructive tracks: in {setup,use}_destructive_playlist()
for non-destructive: when we handle the input set up of the IO that owns this DS
*/
in_set_state = false;
@ -2184,8 +2163,6 @@ DiskStream::use_new_write_source (uint32_t n)
return -1;
}
cerr << _name << " using a new source " << chan.write_source << " for channel " << n << endl;
chan.write_source->use ();
return 0;