diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-02-21 18:37:00 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-02-21 18:37:00 +0000 |
commit | cdf37e613b773c5b64e82697f36a489d6bd40771 (patch) | |
tree | 8d9eff90fca9f487a87c099fd13aa148844c6ee0 | |
parent | 280ade047c5fc2f8ae7a9ed004810f144e4be096 (diff) |
fix deadlock in playlist::partition(); new first idle model, including message about loading visual data; make h-faders use scroll up/down and be scalable-clickable; new track menu stuff (waveform scaling/shape); fix up ordering of ruler menus; fix initial sensitivity of region menu operations
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3097 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/ardour-sae.menus | 42 | ||||
-rw-r--r-- | gtk2_ardour/ardour.menus | 6 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 5 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_dialogs.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/audio_region_view.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/audio_streamview.h | 14 | ||||
-rw-r--r-- | gtk2_ardour/audio_time_axis.cc | 9 | ||||
-rw-r--r-- | gtk2_ardour/audio_time_axis.h | 6 | ||||
-rw-r--r-- | gtk2_ardour/editing.h | 23 | ||||
-rw-r--r-- | gtk2_ardour/editing_syms.h | 8 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 30 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 5 | ||||
-rw-r--r-- | gtk2_ardour/editor_actions.cc | 52 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 18 | ||||
-rw-r--r-- | gtk2_ardour/editor_rulers.cc | 10 | ||||
-rw-r--r-- | gtk2_ardour/editor_selection.cc | 21 | ||||
-rw-r--r-- | gtk2_ardour/enums.cc | 10 | ||||
-rw-r--r-- | gtk2_ardour/enums.h | 11 | ||||
-rw-r--r-- | gtk2_ardour/gain_meter.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/level_meter.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/public_editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.h | 6 | ||||
-rw-r--r-- | libs/ardour/playlist.cc | 236 | ||||
-rw-r--r-- | libs/gtkmm2ext/pixfader.cc | 19 |
25 files changed, 353 insertions, 191 deletions
diff --git a/gtk2_ardour/ardour-sae.menus b/gtk2_ardour/ardour-sae.menus index c4939f037a..1d207bc56c 100644 --- a/gtk2_ardour/ardour-sae.menus +++ b/gtk2_ardour/ardour-sae.menus @@ -11,7 +11,6 @@ <menuitem action='Snapshot'/> <menuitem action='SaveTemplate'/> <separator/> - <menuitem action='AddTrackBus'/> <menu name='Files' action='Files'> <menuitem action='addExistingAudioFiles'/> @@ -171,6 +170,7 @@ </menu> <menu action='TrackMenu'> + <menuitem action='AddTrackBus'/> <menu action='TrackHeightMenu'> <menuitem action='track-height-largest'/> <menuitem action='track-height-large'/> @@ -179,11 +179,16 @@ <menuitem action='track-height-smaller'/> <menuitem action='track-height-small'/> </menu> + <menu action='WaveformMenu'> + <menuitem action='toggle-waveform-visible'/> + <menuitem action='linear-waveforms'/> + <menuitem action='logarithmic-waveforms'/> + </menu> <menuitem action='toggle-track-active'/> <menuitem action='remove-track'/> </menu> - <menu action='Regions'> + <menu action='RegionMenu'> <menuitem action='insert-region'/> <menuitem action='rename-region'/> <menuitem action='auto-rename-region'/> @@ -225,16 +230,15 @@ <menuitem action="secondary-clock-off"/> </menu> <menu action="RulerMenu"> - <menuitem action="toggle-bbt-ruler"/> <menuitem action="toggle-minsec-ruler"/> <menuitem action="toggle-samples-ruler"/> + <menuitem action="toggle-bbt-ruler"/> <separator/> <menuitem action="toggle-meter-ruler"/> <menuitem action="toggle-tempo-ruler"/> - <menuitem action="toggle-range-ruler"/> - <menuitem action="toggle-marker-ruler"/> - <menuitem action="toggle-cd-marker-ruler"/> <menuitem action="toggle-loop-punch-ruler"/> + <menuitem action="toggle-cd-marker-ruler"/> + <menuitem action="toggle-marker-ruler"/> </menu> <menu action="ZoomMenu"> <menuitem action='temporal-zoom-in'/> @@ -250,17 +254,18 @@ <menuitem action='scroll-backward'/> </menu> <separator/> - <menu action="Windows"> - <menuitem action='goto-editor'/> - <menuitem action='goto-mixer'/> - <menuitem action='ToggleLocations'/> - <menuitem action='ToggleKeyEditor'/> - <menuitem action='ToggleThemeManager'/> - <menuitem action='ToggleBigClock'/> - <menuitem action='toggle-rhythm-ferret'/> - </menu> </menu> + <menu action="WindowMenu"> + <menuitem action='goto-editor'/> + <menuitem action='goto-mixer'/> + <menuitem action='ToggleLocations'/> + <menuitem action='ToggleKeyEditor'/> + <menuitem action='ToggleThemeManager'/> + <menuitem action='ToggleBigClock'/> + <menuitem action='toggle-rhythm-ferret'/> + </menu> + <menu name='Options' action='Options'> <menu action='Monitoring'> <menuitem action='UseSoftwareMonitoring'/> @@ -312,16 +317,15 @@ </menubar> <popup action="RulerMenuPopup"> - <menuitem action="toggle-bbt-ruler"/> <menuitem action="toggle-minsec-ruler"/> <menuitem action="toggle-samples-ruler"/> + <menuitem action="toggle-bbt-ruler"/> <separator/> <menuitem action="toggle-meter-ruler"/> <menuitem action="toggle-tempo-ruler"/> - <menuitem action="toggle-range-ruler"/> - <menuitem action="toggle-marker-ruler"/> - <menuitem action="toggle-cd-marker-ruler"/> <menuitem action="toggle-loop-punch-ruler"/> + <menuitem action="toggle-cd-marker-ruler"/> + <menuitem action="toggle-marker-ruler"/> </popup> <popup name='redirectmenu'> diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index 399743939c..ca3628f879 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -168,7 +168,7 @@ <menuitem action='select-next-route'/> <menuitem action='select-prev-route'/> </menu> - <menu name='Regions' action='Regions'> + <menu action='RegionMenu'> <menuitem action='split-region-at-transients'/> <menuitem action='crop'/> <menuitem action='duplicate-region'/> @@ -274,7 +274,7 @@ <menuitem action='scroll-playhead-forward'/> <menuitem action='scroll-playhead-backward'/> <separator/> - <menuitem action='ToggleWaveformVisibility'/> + <menuitem action='toggle-waveform-visible'/> <menuitem action='ToggleWaveformsWhileRecording'/> <menuitem action='ToggleMeasureVisibility'/> <separator/> @@ -296,7 +296,7 @@ <menuitem action='JACKLatency8192'/> </menu> </menu> - <menu name='Windows' action = 'Windows'> + <menu action = 'WindowMenu'> <menuitem action='ToggleMaximalEditor'/> <separator/> <menuitem action='goto-editor'/> diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 3a1f23000f..31e42b49e1 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -3171,6 +3171,11 @@ ARDOUR_UI::first_idle () if (session) { session->allow_auto_play (true); } + + if (editor) { + editor->first_idle(); + } + Keyboard::set_can_save_keybindings (true); return false; } diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 1fe21b7cb1..80921f09d3 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -79,7 +79,6 @@ ARDOUR_UI::connect_to_session (Session *s) /* there are never any selections on startup */ - ActionManager::set_sensitive (ActionManager::region_selection_sensitive_actions, false); ActionManager::set_sensitive (ActionManager::time_selection_sensitive_actions, false); ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, false); ActionManager::set_sensitive (ActionManager::line_selection_sensitive_actions, false); diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index ec58aca063..c215157ef1 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -86,7 +86,6 @@ ARDOUR_UI::install_actions () ActionManager::register_action (main_actions, X_("Session"), _("Session")); ActionManager::register_action (main_actions, X_("Files"), _("Import/Export")); - ActionManager::register_action (main_actions, X_("Regions"), _("Regions")); ActionManager::register_action (main_actions, X_("Cleanup"), _("Cleanup")); ActionManager::register_action (main_actions, X_("Sync"), _("Sync")); ActionManager::register_action (main_actions, X_("Options"), _("Options")); @@ -192,7 +191,7 @@ ARDOUR_UI::install_actions () /* these actions are intended to be shared across all windows */ common_actions = ActionGroup::create (X_("Common")); - ActionManager::register_action (main_actions, X_("Windows"), _("Windows")); + ActionManager::register_action (main_actions, X_("WindowMenu"), _("Window")); ActionManager::register_action (common_actions, X_("Quit"), _("Quit"), (mem_fun(*this, &ARDOUR_UI::finish))); /* windows visibility actions */ diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h index adeb2bb78b..d6c1d266c7 100644 --- a/gtk2_ardour/audio_region_view.h +++ b/gtk2_ardour/audio_region_view.h @@ -72,8 +72,8 @@ class AudioRegionView : public RegionView void set_envelope_visible (bool); void set_waveform_visible (bool yn); - void set_waveform_shape (WaveformShape); - void set_waveform_scale (WaveformScale); + void set_waveform_shape (Editing::WaveformShape); + void set_waveform_scale (Editing::WaveformScale); bool waveform_rectified() const { return _flags & WaveformRectified; } bool waveform_logscaled() const { return _flags & WaveformLogScaled; } diff --git a/gtk2_ardour/audio_streamview.h b/gtk2_ardour/audio_streamview.h index d7bd4de2ef..91f5c88fe1 100644 --- a/gtk2_ardour/audio_streamview.h +++ b/gtk2_ardour/audio_streamview.h @@ -26,7 +26,7 @@ #include <boost/weak_ptr.hpp> #include <ardour/location.h> -#include "enums.h" +#include "editing.h" #include "simplerect.h" #include "streamview.h" @@ -57,10 +57,10 @@ class AudioStreamView : public StreamView AudioStreamView (AudioTimeAxisView&); ~AudioStreamView (); - void set_waveform_shape (WaveformShape); - WaveformShape get_waveform_shape () const { return _waveform_shape; } - void set_waveform_scale (WaveformScale); - WaveformScale get_waveform_scale () const { return _waveform_scale; } + void set_waveform_shape (Editing::WaveformShape); + Editing::WaveformShape get_waveform_shape () const { return _waveform_shape; } + void set_waveform_scale (Editing::WaveformScale); + Editing::WaveformScale get_waveform_scale () const { return _waveform_scale; } int set_height (gdouble h); int set_samples_per_unit (gdouble spp); @@ -109,8 +109,8 @@ class AudioStreamView : public StreamView nframes_t last_rec_peak_frame; map<boost::shared_ptr<ARDOUR::Source>, bool> rec_peak_ready_map; - WaveformShape _waveform_shape; - WaveformScale _waveform_scale; + Editing::WaveformShape _waveform_shape; + Editing::WaveformScale _waveform_scale; }; #endif /* __ardour_audio_streamview_h__ */ diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index a6bcabc197..f451fdc514 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -75,12 +75,6 @@ using namespace PBD; using namespace Gtk; using namespace Editing; -static gboolean __idler (gpointer arg) -{ - ((AudioTimeAxisView*)arg)->first_idle (); - return FALSE; -} - AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas) : AxisView(sess) , RouteTimeAxisView(ed, sess, rt, canvas) @@ -119,7 +113,8 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, boost::sh /* ask for notifications of any new RegionViews */ _view->RegionViewAdded.connect (mem_fun(*this, &AudioTimeAxisView::region_view_added)); - g_idle_add (__idler, this); + /* first idle will do the rest */ + } else { post_construct (); } diff --git a/gtk2_ardour/audio_time_axis.h b/gtk2_ardour/audio_time_axis.h index e02bd4d325..30507b8ef6 100644 --- a/gtk2_ardour/audio_time_axis.h +++ b/gtk2_ardour/audio_time_axis.h @@ -36,6 +36,7 @@ #include "ardour_dialog.h" #include "route_ui.h" #include "enums.h" +#include "editing.h" #include "route_time_axis.h" #include "canvas.h" @@ -86,6 +87,9 @@ class AudioTimeAxisView : public RouteTimeAxisView void first_idle (); + void set_waveform_shape (Editing::WaveformShape); + void set_waveform_scale (Editing::WaveformScale); + private: friend class AudioStreamView; friend class AudioRegionView; @@ -96,9 +100,7 @@ class AudioTimeAxisView : public RouteTimeAxisView void append_extra_display_menu_items (); void toggle_show_waveforms (); - void set_waveform_shape (WaveformShape); void toggle_waveforms (); - void set_waveform_scale (WaveformScale); void show_all_automation (); void show_existing_automation (); diff --git a/gtk2_ardour/editing.h b/gtk2_ardour/editing.h index bfb9b49ee6..bdd8e92f10 100644 --- a/gtk2_ardour/editing.h +++ b/gtk2_ardour/editing.h @@ -36,6 +36,8 @@ #define IMPORTPOSITION(a) /*empty*/ #define IMPORTDISPOSITION(a) /*empty*/ #define EDITPOINT(a) /*empty*/ +#define WAVEFORMSCALE(a) /*empty*/ +#define WAVEFORMSHAPE(a) /*empty*/ namespace Editing { @@ -163,6 +165,27 @@ enum EditPoint { #undef EDITPOINT #define EDITPOINT(a) /*empty*/ +// WAVEFORMSCALE +#undef WAVEFORMSCALE +#define WAVEFORMSCALE(a) a, +enum WaveformScale { + #include "editing_syms.h" +}; + +#undef WAVEFORMSCALE +#define WAVEFORMSCALE(a) /*empty*/ + + +// WAVEFORMSHAPE +#undef WAVEFORMSHAPE +#define WAVEFORMSHAPE(a) a, +enum WaveformShape { + #include "editing_syms.h" +}; + +#undef WAVEFORMSHAPE +#define WAVEFORMSHAPE(a) /*empty*/ + ///////////////////// // These don't need their state saved. yet... enum CutCopyOp { diff --git a/gtk2_ardour/editing_syms.h b/gtk2_ardour/editing_syms.h index c324136502..6820b16b12 100644 --- a/gtk2_ardour/editing_syms.h +++ b/gtk2_ardour/editing_syms.h @@ -94,3 +94,11 @@ IMPORTDISPOSITION(ImportDistinctChannels=3) EDITPOINT(EditAtPlayhead) EDITPOINT(EditAtSelectedMarker) EDITPOINT(EditAtMouse) + +WAVEFORMSCALE(LinearWaveform) +WAVEFORMSCALE(LogWaveform) + +WAVEFORMSHAPE(Traditional) +WAVEFORMSHAPE(Rectified) + + diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 5dc5842f4c..3878325c27 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -1120,6 +1120,10 @@ Editor::connect_to_session (Session *t) { session = t; + /* there are never any selected regions at startup */ + + sensitize_the_right_region_actions (false); + XMLNode* node = ARDOUR_UI::instance()->editor_settings(); set_state (*node); @@ -2277,7 +2281,7 @@ Editor::set_state (const XMLNode& node) if ((prop = node.property ("show-waveforms"))) { bool yn = (prop->value() == "yes"); _show_waveforms = !yn; - RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformVisibility")); + RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-waveform-visible")); if (act) { RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act); /* do it twice to force the change */ @@ -4489,3 +4493,27 @@ Editor::show_rhythm_ferret () rhythm_ferret->show (); rhythm_ferret->present (); } + +void +Editor::first_idle () +{ + MessageDialog* dialog = 0; + + if (track_views.size() > 1) { + dialog = new MessageDialog (*this, + _("Please wait while Ardour loads visual data"), + true, + Gtk::MESSAGE_INFO, + Gtk::BUTTONS_NONE); + dialog->present (); + ARDOUR_UI::instance()->flush_pending (); + } + + for (TrackViewList::iterator t = track_views.begin(); t != track_views.end(); ++t) { + (*t)->first_idle(); + } + + if (dialog) { + delete dialog; + } +} diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 1a11082b4e..1b39b173d9 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -130,6 +130,7 @@ class Editor : public PublicEditor void connect_to_session (ARDOUR::Session *); ARDOUR::Session* current_session() const { return session; } + void first_idle (); nframes_t leftmost_position() const { return leftmost_frame; } nframes_t current_page_frames() const { @@ -171,6 +172,8 @@ class Editor : public PublicEditor void set_show_waveforms (bool yn); bool show_waveforms() const { return _show_waveforms; } + void set_waveform_scale (Editing::WaveformScale); + void set_show_waveforms_recording (bool yn); bool show_waveforms_recording() const { return _show_waveforms_recording; } @@ -1541,6 +1544,7 @@ public: void time_selection_changed (); void track_selection_changed (); void region_selection_changed (); + void sensitize_the_right_region_actions (bool have_selected_regions); void point_selection_changed (); void marker_selection_changed (); @@ -2105,6 +2109,7 @@ public: void remove_tracks (); void toggle_tracks_active (); + void waveform_scale_chosen (Editing::WaveformScale); }; #endif /* __ardour_editor_h__ */ diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index b0cbab3092..68a9684887 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -68,6 +68,7 @@ Editor::register_actions () ActionManager::register_action (editor_actions, X_("PlayMenu"), _("Play")); ActionManager::register_action (editor_actions, X_("PrimaryClockMenu"), _("Primary Clock")); ActionManager::register_action (editor_actions, X_("Pullup"), _("Pullup / Pulldown")); + ActionManager::register_action (editor_actions, X_("RegionMenu"), _("Region")); ActionManager::register_action (editor_actions, X_("RegionEditOps"), _("Region operations")); ActionManager::register_action (editor_actions, X_("RegionGainMenu"), _("Gain")); ActionManager::register_action (editor_actions, X_("RulerMenu"), _("Rulers")); @@ -83,10 +84,11 @@ Editor::register_actions () ActionManager::register_action (editor_actions, X_("TempoMenu"), _("Tempo")); ActionManager::register_action (editor_actions, X_("Timecode"), _("Timecode fps")); ActionManager::register_action (editor_actions, X_("TrackHeightMenu"), _("Height")); - ActionManager::register_action (editor_actions, X_("TrackMenu"), _("Tracks")); + ActionManager::register_action (editor_actions, X_("TrackMenu"), _("Track")); ActionManager::register_action (editor_actions, X_("Tools"), _("Tools")); ActionManager::register_action (editor_actions, X_("TrimMenu"), _("Trim")); ActionManager::register_action (editor_actions, X_("View"), _("View")); + ActionManager::register_action (editor_actions, X_("WaveformMenu"), _("Waveforms")); ActionManager::register_action (editor_actions, X_("ZoomFocus"), _("Zoom")); ActionManager::register_action (editor_actions, X_("ZoomMenu"), _("Zoom")); ActionManager::register_action (editor_actions, X_("ZoomFocusMenu"), _("Zoom Focus")); @@ -504,21 +506,30 @@ Editor::register_actions () act = ActionManager::register_action (editor_actions, "toggle-track-active", _("Toggle Active"), (mem_fun(*this, &Editor::toggle_tracks_active))); ActionManager::session_sensitive_actions.push_back (act); + ActionManager::track_selection_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "remove-track", _("Remove"), (mem_fun(*this, &Editor::remove_tracks))); ActionManager::session_sensitive_actions.push_back (act); + ActionManager::track_selection_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "track-height-largest", _("Largest"), (mem_fun(*this, &Editor::set_track_height_largest))); ActionManager::session_sensitive_actions.push_back (act); + ActionManager::track_selection_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "track-height-larger", _("Larger"), (mem_fun(*this, &Editor::set_track_height_large))); ActionManager::session_sensitive_actions.push_back (act); + ActionManager::track_selection_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "track-height-large", _("Large"), (mem_fun(*this, &Editor::set_track_height_larger))); ActionManager::session_sensitive_actions.push_back (act); + ActionManager::track_selection_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "track-height-normal", _("Normal"), (mem_fun(*this, &Editor::set_track_height_normal))); ActionManager::session_sensitive_actions.push_back (act); + ActionManager::track_selection_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "track-height-small", _("Small"), (mem_fun(*this, &Editor::set_track_height_smaller))); + ActionManager::track_selection_sensitive_actions.push_back (act); ActionManager::session_sensitive_actions.push_back (act); + ActionManager::track_selection_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "track-height-smaller", _("Smaller"), (mem_fun(*this, &Editor::set_track_height_small))); ActionManager::session_sensitive_actions.push_back (act); + ActionManager::track_selection_sensitive_actions.push_back (act); Glib::RefPtr<ActionGroup> zoom_actions = ActionGroup::create (X_("Zoom")); RadioAction::Group zoom_group; @@ -680,10 +691,18 @@ Editor::register_actions () act = ActionManager::register_action (editor_actions, X_("addExternalAudioToRegionList"), _("Add External Audio"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsRegion)); ActionManager::session_sensitive_actions.push_back (act); - ActionManager::register_toggle_action (editor_actions, X_("ToggleWaveformVisibility"), _("Show Waveforms"), mem_fun (*this, &Editor::toggle_waveform_visibility)); + ActionManager::register_toggle_action (editor_actions, X_("toggle-waveform-visible"), _("Show Waveforms"), mem_fun (*this, &Editor::toggle_waveform_visibility)); + ActionManager::track_selection_sensitive_actions.push_back (act); ActionManager::register_toggle_action (editor_actions, X_("ToggleWaveformsWhileRecording"), _("Show Waveforms While Recording"), mem_fun (*this, &Editor::toggle_waveforms_while_recording)); ActionManager::register_toggle_action (editor_actions, X_("ToggleMeasureVisibility"), _("Show Measures"), mem_fun (*this, &Editor::toggle_measure_visibility)); + + RadioAction::Group waveform_scale_group; + act = ActionManager::register_radio_action (editor_actions, waveform_scale_group, X_("linear-waveforms"), _("Linear"), bind (mem_fun (*this, &Editor::waveform_scale_chosen), Editing::LinearWaveform)); + ActionManager::track_selection_sensitive_actions.push_back (act); + act = ActionManager::register_radio_action (editor_actions, waveform_scale_group, X_("logarithmic-waveforms"), _("Logarithmic"), bind (mem_fun (*this, &Editor::waveform_scale_chosen), Editing::LogWaveform)); + ActionManager::track_selection_sensitive_actions.push_back (act); + /* if there is a logo in the editor canvas, its always visible at startup */ act = ActionManager::register_toggle_action (editor_actions, X_("ToggleLogoVisibility"), _("Show Logo"), mem_fun (*this, &Editor::toggle_logo_visibility)); @@ -789,7 +808,7 @@ Editor::toggle_ruler_visibility (RulerType rt) void Editor::toggle_waveform_visibility () { - Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformVisibility")); + Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-waveform-visible")); if (act) { Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act); set_show_waveforms (tact->get_active()); @@ -834,6 +853,33 @@ Editor::toggle_logo_visibility () } void +Editor::waveform_scale_chosen (Editing::WaveformScale ws) +{ + RefPtr<Action> act; + + /* this is driven by a toggle on a radio group, and so is invoked twice, + once for the item that became inactive and once for the one that became + active. + */ + + switch (ws) { + case LinearWaveform: + act = ActionManager::get_action (X_("Editor"), X_("linear-waveforms")); + break; + case LogWaveform: + act = ActionManager::get_action (X_("Editor"), X_("logarithmic-waveforms")); + break; + } + + if (act) { + RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act); + if (ract && ract->get_active()) { + set_waveform_scale (ws); + } + } +} + +void Editor::set_crossfade_model (CrossfadeModel model) { RefPtr<Action> act; diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index bba155d94e..2843a9d794 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -5610,3 +5610,21 @@ Editor::remove_tracks () session->remove_route (*x); } } + +void +Editor::set_waveform_scale (WaveformScale ws) +{ + TrackSelection& ts (selection->tracks); + + if (ts.empty()) { + return; + } + + for (TrackSelection::iterator x = ts.begin(); x != ts.end(); ++x) { + AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*> (*x); + if (atv) { + atv->set_waveform_scale (ws); + } + } +} + diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index f75a180335..120c57025c 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -415,21 +415,21 @@ Editor::popup_ruler_menu (nframes_t where, ItemType t) if (action) { ruler_items.push_back (MenuElem (*action->create_menu_item())); } - action = ActionManager::get_action ("Rulers", "toggle-marker-ruler"); - if (action) { - ruler_items.push_back (MenuElem (*action->create_menu_item())); - } if (!Profile->get_sae()) { action = ActionManager::get_action ("Rulers", "toggle-range-ruler"); if (action) { ruler_items.push_back (MenuElem (*action->create_menu_item())); } } + action = ActionManager::get_action ("Rulers", "toggle-loop-punch-ruler"); + if (action) { + ruler_items.push_back (MenuElem (*action->create_menu_item())); + } action = ActionManager::get_action ("Rulers", "toggle-cd-marker-ruler"); if (action) { ruler_items.push_back (MenuElem (*action->create_menu_item())); } - action = ActionManager::get_action ("Rulers", "toggle-loop-punch-ruler"); + action = ActionManager::get_action ("Rulers", "toggle-marker-ruler"); if (action) { ruler_items.push_back (MenuElem (*action->create_menu_item())); } diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index ba12ca0a33..86ab115536 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -764,6 +764,8 @@ Editor::track_selection_changed () (*i)->set_selected (false); } } + + ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, !selection->tracks.empty()); } void @@ -796,14 +798,8 @@ Editor::time_selection_changed () } void -Editor::region_selection_changed () +Editor::sensitize_the_right_region_actions (bool have_selected_regions) { - for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { - (*i)->set_selected_regionviews (selection->regions); - } - - bool have_selected_regions = !selection->regions.empty(); - for (vector<Glib::RefPtr<Action> >::iterator x = ActionManager::region_selection_sensitive_actions.begin(); x != ActionManager::region_selection_sensitive_actions.end(); ++x) { @@ -822,6 +818,17 @@ Editor::region_selection_changed () (*x)->set_sensitive (have_selected_regions); } } +} + + +void +Editor::region_selection_changed () +{ + for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { + (*i)->set_selected_regionviews (selection->regions); + } + + sensitize_the_right_region_actions (!selection->regions.empty()); zoomed_to_region = false; } diff --git a/gtk2_ardour/enums.cc b/gtk2_ardour/enums.cc index f626bfb968..9ed5bdfd8c 100644 --- a/gtk2_ardour/enums.cc +++ b/gtk2_ardour/enums.cc @@ -39,6 +39,8 @@ setup_gtk_ardour_enums () Width width; ImportMode import_mode; EditPoint edit_point; + WaveformScale waveform_scale; + WaveformShape waveform_shape; #define REGISTER(e) enum_writer.register_distinct (typeid(e).name(), i, s); i.clear(); s.clear() #define REGISTER_BITS(e) enum_writer.register_bits (typeid(e).name(), i, s); i.clear(); s.clear() @@ -66,4 +68,12 @@ setup_gtk_ardour_enums () REGISTER_ENUM (EditAtMouse); REGISTER_ENUM (EditAtSelectedMarker); REGISTER (edit_point); + + REGISTER_ENUM (LinearWaveform); + REGISTER_ENUM (LogWaveform); + REGISTER (waveform_scale); + + REGISTER_ENUM (Traditional); + REGISTER_ENUM (Rectified); + REGISTER (waveform_shape); } diff --git a/gtk2_ardour/enums.h b/gtk2_ardour/enums.h index d345b30bf8..bc293803b4 100644 --- a/gtk2_ardour/enums.h +++ b/gtk2_ardour/enums.h @@ -22,17 +22,6 @@ #include <ardour/types.h> -enum WaveformShape { - Traditional, - Rectified -}; - -enum WaveformScale { - LinearWaveform=0, - LogWaveform, -}; - - enum Width { Wide, Narrow, diff --git a/gtk2_ardour/gain_meter.h b/gtk2_ardour/gain_meter.h index f48b34b7ff..00254b627a 100644 --- a/gtk2_ardour/gain_meter.h +++ b/gtk2_ardour/gain_meter.h @@ -117,7 +117,7 @@ class GainMeter : public Gtk::VBox std::string short_astyle_string (ARDOUR::AutoStyle); std::string _astyle_string (ARDOUR::AutoStyle, bool); - Width _width; + Width _width; static std::map<std::string,Glib::RefPtr<Gdk::Pixmap> > metric_pixmaps; static Glib::RefPtr<Gdk::Pixmap> render_metrics (Gtk::Widget&); diff --git a/gtk2_ardour/level_meter.h b/gtk2_ardour/level_meter.h index dfae72a576..240cc4b785 100644 --- a/gtk2_ardour/level_meter.h +++ b/gtk2_ardour/level_meter.h @@ -73,7 +73,7 @@ class LevelMeter : public Gtk::HBox boost::shared_ptr<ARDOUR::IO> _io; ARDOUR::Session& _session; - Width _width; + Width _width; struct MeterInfo { Gtkmm2ext::FastMeter *meter; diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 787cdcbdc3..82b26db296 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -84,6 +84,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway virtual void connect_to_session (ARDOUR::Session*) = 0; virtual ARDOUR::Session* current_session() const = 0; + virtual void first_idle() = 0; virtual void set_snap_to (Editing::SnapType) = 0; virtual void set_snap_mode (Editing::SnapMode) = 0; virtual void set_snap_threshold (double) = 0; diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index 848521f430..b966f2b59e 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -206,6 +206,12 @@ class TimeAxisView : public virtual AxisView virtual void get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& results); virtual void get_inverted_selectables (Selection&, list<Selectable *>& results); + /* called at load time when first GUI idle occurs. put + expensive data loading/redisplay code in here. + */ + + virtual void first_idle () {} + /* state/serialization management */ void set_parent (TimeAxisView& p); diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 9ed103b67c..55b30b6c70 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -669,53 +669,55 @@ Playlist::partition (nframes_t start, nframes_t end, bool just_top_level) void Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, RegionList& thawlist) { - RegionLock rlock (this); - boost::shared_ptr<Region> region; - boost::shared_ptr<Region> current; - string new_name; - RegionList::iterator tmp; - OverlapType overlap; - nframes_t pos1, pos2, pos3, pos4; RegionList new_regions; - in_partition = true; - - /* need to work from a copy, because otherwise the regions we add during the process - get operated on as well. - */ - - RegionList copy = regions; - - for (RegionList::iterator i = copy.begin(); i != copy.end(); i = tmp) { + { + RegionLock rlock (this); + boost::shared_ptr<Region> region; + boost::shared_ptr<Region> current; + string new_name; + RegionList::iterator tmp; + OverlapType overlap; + nframes_t pos1, pos2, pos3, pos4; - tmp = i; - ++tmp; - - current = *i; + in_partition = true; - if (current->first_frame() == start && current->last_frame() == end) { - if (cutting) { - remove_region_internal (current); - } - continue; - } + /* need to work from a copy, because otherwise the regions we add during the process + get operated on as well. + */ - if ((overlap = current->coverage (start, end)) == OverlapNone) { - continue; - } + RegionList copy = regions; - pos1 = current->position(); - pos2 = start; - pos3 = end; - pos4 = current->last_frame(); - - if (overlap == OverlapInternal) { + for (RegionList::iterator i = copy.begin(); i != copy.end(); i = tmp) { - /* split: we need 3 new regions, the front, middle and end. - cut: we need 2 regions, the front and end. - */ + tmp = i; + ++tmp; + + current = *i; + + if (current->first_frame() == start && current->last_frame() == end) { + if (cutting) { + remove_region_internal (current); + } + continue; + } + + if ((overlap = current->coverage (start, end)) == OverlapNone) { + continue; + } + + pos1 = current->position(); + pos2 = start; + pos3 = end; + pos4 = current->last_frame(); - /* + if (overlap == OverlapInternal) { + + /* split: we need 3 new regions, the front, middle and end. + cut: we need 2 regions, the front and end. + */ + + /* start end ---------------*************************------------ P1 P2 P3 P4 @@ -724,37 +726,37 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi CUT ---------------*****----------------====------------ - */ + */ - if (!cutting) { + if (!cutting) { - /* "middle" ++++++ */ + /* "middle" ++++++ */ + + _session.region_name (new_name, current->name(), false); + region = RegionFactory::create (current, pos2 - pos1, pos3 - pos2, new_name, + regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::LeftOfSplit|Region::RightOfSplit)); + add_region_internal (region, start); + new_regions.push_back (region); + } + /* "end" ====== */ + _session.region_name (new_name, current->name(), false); - region = RegionFactory::create (current, pos2 - pos1, pos3 - pos2, new_name, - regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::LeftOfSplit|Region::RightOfSplit)); - add_region_internal (region, start); + region = RegionFactory::create (current, pos3 - pos1, pos4 - pos3, new_name, + regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::RightOfSplit)); + + add_region_internal (region, end); new_regions.push_back (region); - } - - /* "end" ====== */ - - _session.region_name (new_name, current->name(), false); - region = RegionFactory::create (current, pos3 - pos1, pos4 - pos3, new_name, - regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::RightOfSplit)); - - add_region_internal (region, end); - new_regions.push_back (region); - - /* "front" ***** */ - current->freeze (); - thawlist.push_back (current); - current->trim_end (pos2, this); - - } else if (overlap == OverlapEnd) { - - /* + /* "front" ***** */ + + current->freeze (); + thawlist.push_back (current); + current->trim_end (pos2, this); + + } else if (overlap == OverlapEnd) { + + /* start end ---------------*************************------------ P1 P2 P4 P3 @@ -762,33 +764,32 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi ---------------**************+++++++++++------------ CUT: ---------------**************----------------------- - - */ - - if (!cutting) { + */ - /* end +++++ */ + if (!cutting) { + + /* end +++++ */ + + _session.region_name (new_name, current->name(), false); + region = RegionFactory::create (current, pos2 - pos1, pos4 - pos2, new_name, (layer_t) regions.size(), + Region::Flag(current->flags()|Region::Automatic|Region::LeftOfSplit)); + add_region_internal (region, start); + new_regions.push_back (region); + } - _session.region_name (new_name, current->name(), false); - region = RegionFactory::create (current, pos2 - pos1, pos4 - pos2, new_name, (layer_t) regions.size(), - Region::Flag(current->flags()|Region::Automatic|Region::LeftOfSplit)); - add_region_internal (region, start); - new_regions.push_back (region); - } - - /* front ****** */ - - current->freeze (); - thawlist.push_back (current); - current->trim_end (pos2, this); - - } else if (overlap == OverlapStart) { - - /* split: we need 2 regions: the front and the end. - cut: just trim current to skip the cut area - */ + /* front ****** */ + + current->freeze (); + thawlist.push_back (current); + current->trim_end (pos2, this); + + } else if (overlap == OverlapStart) { + + /* split: we need 2 regions: the front and the end. + cut: just trim current to skip the cut area + */ - /* + /* start end ---------------*************************------------ P2 P1 P3 P4 @@ -798,31 +799,31 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi CUT: -------------------*********************------------ - */ + */ - if (!cutting) { + if (!cutting) { - /* front **** */ - _session.region_name (new_name, current->name(), false); - region = RegionFactory::create (current, 0, pos3 - pos1, new_name, - regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::RightOfSplit)); - add_region_internal (region, pos1); - new_regions.push_back (region); - } - - /* end */ - - current->freeze (); - thawlist.push_back (current); - current->trim_front (pos3, this); - - } else if (overlap == OverlapExternal) { - - /* split: no split required. - cut: remove the region. - */ + /* front **** */ + _session.region_name (new_name, current->name(), false); + region = RegionFactory::create (current, 0, pos3 - pos1, new_name, + regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::RightOfSplit)); + add_region_internal (region, pos1); + new_regions.push_back (region); + } + + /* end */ + + current->freeze (); + thawlist.push_back (current); + current->trim_front (pos3, this); + + } else if (overlap == OverlapExternal) { - /* + /* split: no split required. + cut: remove the region. + */ + + /* start end ---------------*************************------------ P2 P1 P3 P4 @@ -832,16 +833,17 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi CUT: ---------------------------------------------------- - */ - - if (cutting) { - remove_region_internal (current); + */ + + if (cutting) { + remove_region_internal (current); + } + new_regions.push_back (current); } - new_regions.push_back (current); } - } - in_partition = false; + in_partition = false; + } for (RegionList::iterator i = new_regions.begin(); i != new_regions.end(); ++i) { check_dependents (*i, false); diff --git a/libs/gtkmm2ext/pixfader.cc b/libs/gtkmm2ext/pixfader.cc index 41203afb69..c138d13371 100644 --- a/libs/gtkmm2ext/pixfader.cc +++ b/libs/gtkmm2ext/pixfader.cc @@ -138,7 +138,7 @@ PixFader::on_button_release_event (GdkEventButton* ev) { double fract, ev_pos; - ev_pos = (_orien == VERT) ? ev->y : 0; // Don't step if we are horizontal + ev_pos = (_orien == VERT) ? ev->y : ev->x; switch (ev->button) { case 1: @@ -190,6 +190,7 @@ bool PixFader::on_scroll_event (GdkEventScroll* ev) { double scale; + bool ret = false; if (ev->state & fine_scale_modifier) { if (ev->state & extra_fine_scale_modifier) { @@ -202,35 +203,49 @@ PixFader::on_scroll_event (GdkEventScroll* ev) } if (_orien == VERT) { + + /* should left/right scroll affect vertical faders ? */ + switch (ev->direction) { case GDK_SCROLL_UP: /* wheel up */ adjustment.set_value (adjustment.get_value() + (adjustment.get_page_increment() * scale)); + ret = true; break; case GDK_SCROLL_DOWN: /* wheel down */ adjustment.set_value (adjustment.get_value() - (adjustment.get_page_increment() * scale)); + ret = true; break; default: break; } } else { + + /* up/down scrolls should definitely affect horizontal faders + because they are so much easier to use + */ + switch (ev->direction) { case GDK_SCROLL_RIGHT: + case GDK_SCROLL_UP: /* wheel right */ adjustment.set_value (adjustment.get_value() + (adjustment.get_page_increment() * scale)); + ret = true; break; case GDK_SCROLL_LEFT: + case GDK_SCROLL_DOWN: /* wheel left */ adjustment.set_value (adjustment.get_value() - (adjustment.get_page_increment() * scale)); + ret = true; break; default: break; } } - return false; + return ret; } bool |