Fix track mode options to appear only once on audio tracks rather than twice. Fix event handling logic for these options. HIG-ify some menu items.

git-svn-id: svn://localhost/ardour2/branches/3.0@6787 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-03-23 13:11:14 +00:00
parent b5c21e65fc
commit eb6ae56faf
4 changed files with 30 additions and 57 deletions

View File

@ -180,49 +180,11 @@ AudioTimeAxisView::append_extra_display_menu_items ()
// crossfade stuff
if (!Profile->get_sae()) {
items.push_back (MenuElem (_("Hide all crossfades"), sigc::mem_fun(*this, &AudioTimeAxisView::hide_all_xfades)));
items.push_back (MenuElem (_("Show all crossfades"), sigc::mem_fun(*this, &AudioTimeAxisView::show_all_xfades)));
items.push_back (MenuElem (_("Hide All Crossfades"), sigc::mem_fun(*this, &AudioTimeAxisView::hide_all_xfades)));
items.push_back (MenuElem (_("Show All Crossfades"), sigc::mem_fun(*this, &AudioTimeAxisView::show_all_xfades)));
}
}
Gtk::Menu*
AudioTimeAxisView::build_mode_menu()
{
using namespace Menu_Helpers;
Menu* mode_menu = manage (new Menu);
MenuList& items = mode_menu->items();
mode_menu->set_name ("ArdourContextMenu");
RadioMenuItem::Group mode_group;
items.push_back (RadioMenuElem (mode_group, _("Normal"),
sigc::bind (sigc::mem_fun (*this, &AudioTimeAxisView::set_track_mode), ARDOUR::Normal)));
normal_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
items.push_back (RadioMenuElem (mode_group, _("Non Overlapping"),
sigc::bind (sigc::mem_fun (*this, &AudioTimeAxisView::set_track_mode), ARDOUR::NonLayered)));
non_layered_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
items.push_back (RadioMenuElem (mode_group, _("Tape"),
sigc::bind (sigc::mem_fun (*this, &AudioTimeAxisView::set_track_mode), ARDOUR::Destructive)));
destructive_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
switch (track()->mode()) {
case ARDOUR::Destructive:
destructive_track_mode_item->set_active ();
break;
case ARDOUR::NonLayered:
non_layered_track_mode_item->set_active ();
break;
case ARDOUR::Normal:
normal_track_mode_item->set_active ();
break;
}
return mode_menu;
}
void
AudioTimeAxisView::set_show_waveforms_recording (bool yn)
{

View File

@ -114,6 +114,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, boost::sh
, automation_button (_("a"))
, visual_button (_("v"))
, gm (sess, slider, true, 115)
, _ignore_track_mode_change (false)
{
set_button_names ();
@ -428,13 +429,13 @@ RouteTimeAxisView::build_automation_action_menu ()
automation_action_menu->set_name ("ArdourContextMenu");
items.push_back (MenuElem (_("Show all automation"),
items.push_back (MenuElem (_("Show All Automation"),
sigc::mem_fun(*this, &RouteTimeAxisView::show_all_automation)));
items.push_back (MenuElem (_("Show existing automation"),
items.push_back (MenuElem (_("Show Existing Automation"),
sigc::mem_fun(*this, &RouteTimeAxisView::show_existing_automation)));
items.push_back (MenuElem (_("Hide all automation"),
items.push_back (MenuElem (_("Hide All Automation"),
sigc::mem_fun(*this, &RouteTimeAxisView::hide_all_automation)));
/* attach the plugin submenu. It may have previously been used elsewhere, so we detach it first. */
@ -501,39 +502,41 @@ RouteTimeAxisView::build_display_menu ()
RadioMenuItem::Group align_group;
alignment_items.push_back (RadioMenuElem (align_group, _("Align with existing material"),
alignment_items.push_back (RadioMenuElem (align_group, _("Align With Existing Material"),
sigc::bind (sigc::mem_fun(*this, &RouteTimeAxisView::set_align_style), ExistingMaterial)));
align_existing_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
if (get_diskstream()->alignment_style() == ExistingMaterial)
align_existing_item->set_active();
alignment_items.push_back (RadioMenuElem (align_group, _("Align with capture time"),
alignment_items.push_back (RadioMenuElem (align_group, _("Align With Capture Time"),
sigc::bind (sigc::mem_fun(*this, &RouteTimeAxisView::set_align_style), CaptureTime)));
align_capture_item = dynamic_cast<RadioMenuItem*>(&alignment_items.back());
if (get_diskstream()->alignment_style() == CaptureTime)
align_capture_item->set_active();
if (!Profile->get_sae()) {
items.push_back (MenuElem (_("Alignment"), *alignment_menu));
get_diskstream()->AlignmentStyleChanged.connect (route_connections, boost::bind (&RouteTimeAxisView::align_style_changed, this), gui_context());
RadioMenuItem::Group mode_group;
items.push_back (RadioMenuElem (mode_group, _("Normal mode"), sigc::bind (
items.push_back (RadioMenuElem (mode_group, _("Normal Mode"), sigc::bind (
sigc::mem_fun (*this, &RouteTimeAxisView::set_track_mode),
ARDOUR::Normal)));
normal_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
items.push_back (RadioMenuElem (mode_group, _("Tape mode"), sigc::bind (
items.push_back (RadioMenuElem (mode_group, _("Tape Mode"), sigc::bind (
sigc::mem_fun (*this, &RouteTimeAxisView::set_track_mode),
ARDOUR::Destructive)));
destructive_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
items.push_back (RadioMenuElem (mode_group, _("No layering mode"),
items.push_back (RadioMenuElem (mode_group, _("Non-Layered Mode"),
sigc::bind (sigc::mem_fun (*this, &RouteTimeAxisView::set_track_mode), ARDOUR::NonLayered)));
non_layered_track_mode_item = dynamic_cast<RadioMenuItem*>(&items.back());
_ignore_track_mode_change = true;
switch (track()->mode()) {
case ARDOUR::Destructive:
destructive_track_mode_item->set_active ();
@ -545,17 +548,16 @@ RouteTimeAxisView::build_display_menu ()
non_layered_track_mode_item->set_active ();
break;
}
_ignore_track_mode_change = false;
}
get_diskstream()->AlignmentStyleChanged.connect (route_connections, boost::bind (&RouteTimeAxisView::align_style_changed, this), gui_context());
mode_menu = build_mode_menu();
if (mode_menu)
items.push_back (MenuElem (_("Mode"), *mode_menu));
color_mode_menu = build_color_mode_menu();
if (color_mode_menu)
if (color_mode_menu) {
items.push_back (MenuElem (_("Color Mode"), *color_mode_menu));
}
items.push_back (SeparatorElem());
}
@ -584,6 +586,10 @@ static bool __reset_item (RadioMenuItem* item, RadioMenuItem* item_2)
void
RouteTimeAxisView::set_track_mode (TrackMode mode)
{
if (_ignore_track_mode_change) {
return;
}
RadioMenuItem* item;
RadioMenuItem* other_item;
RadioMenuItem* other_item_2;
@ -610,7 +616,7 @@ RouteTimeAxisView::set_track_mode (TrackMode mode)
return;
}
if (item && other_item && other_item_2 && item->get_active() && track()->mode() != mode) {
if (item && other_item && other_item_2 && track()->mode() != mode) {
_set_track_mode (track().get(), mode, other_item, other_item_2);
}
}
@ -628,6 +634,7 @@ RouteTimeAxisView::_set_track_mode (Track* track, TrackMode mode, RadioMenuItem*
return;
} else {
cerr << "would bounce this one\n";
/* XXX: radio menu item becomes inconsistent with track state in this case */
return;
}
}

View File

@ -291,7 +291,6 @@ protected:
Gtk::Menu* mode_menu;
Gtk::Menu* color_mode_menu;
virtual Gtk::Menu* build_mode_menu() { return 0; }
virtual Gtk::Menu* build_color_mode_menu() { return 0; }
void use_playlist (Gtk::RadioMenuItem *item, boost::weak_ptr<ARDOUR::Playlist> wpl);
@ -325,6 +324,8 @@ protected:
UnderlayList _underlay_streams;
typedef std::list<RouteTimeAxisView*> UnderlayMirrorList;
UnderlayMirrorList _underlay_mirrors;
bool _ignore_track_mode_change; ///< true to ignore track mode change signals
};
#endif /* __ardour_route_time_axis_h__ */

View File

@ -2299,7 +2299,10 @@ AudioDiskstream::can_become_destructive (bool& requires_bounce) const
}
boost::shared_ptr<Region> first = _playlist->find_next_region (_session.current_start_frame(), Start, 1);
assert (first);
if (!first) {
requires_bounce = false;
return true;
}
/* do the source(s) for the region cover the session start position ? */