diff options
author | David Robillard <d@drobilla.net> | 2008-02-02 03:57:35 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-02-02 03:57:35 +0000 |
commit | 9f63ab9931e6478472853bdda58da47ea29ac125 (patch) | |
tree | 7edfb1d16f580e93501c24fa9f9648fe415f3745 /gtk2_ardour | |
parent | 85ea9028b52eefb34184deb0fbd4d3c7632a2c38 (diff) |
Merge with trunk R2978.
git-svn-id: svn://localhost/ardour2/branches/3.0@2988 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
36 files changed, 1139 insertions, 290 deletions
diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript index 22ef8bdd66..6adf0ee8ae 100644 --- a/gtk2_ardour/SConscript +++ b/gtk2_ardour/SConscript @@ -24,7 +24,7 @@ gtkardour.Append(CPPPATH="#/") # for top level svn_revision.h gtkardour.Append(PACKAGE=domain) gtkardour.Append(POTFILE=domain + '.pot') -if gtkardour['DIST_TARGET'] == 'panther' or gtkardour['DIST_TARGET'] == 'tiger': +if gtkardour['IS_OSX']: gtkardour.Append (LINKFLAGS="-Xlinker -headerpad -Xlinker 2048") gtkardour.Merge ([ @@ -50,6 +50,10 @@ gtkardour.Merge ([ libraries['xml'], libraries['xslt'], libraries['samplerate'], + libraries['vamp'], + libraries['vamphost'], + libraries['fftw3f'], + libraries['fftw3'], libraries['jack'], libraries['cairomm'], libraries['asound'] @@ -77,7 +81,7 @@ if gtkardour['FFT_ANALYSIS']: gtkardour.Append(CCFLAGS='-DFFT_ANALYSIS') if gtkardour['RUBBERBAND']: - gtkardour.Merge ([ libraries['rubberband'], libraries['vamp'], libraries['fftw3f'], libraries['fftw3'] ]) + gtkardour.Merge ([ libraries['rubberband'] ]) else: gtkardour.Merge ([ libraries['soundtouch'] ]) @@ -101,50 +105,44 @@ x11.cc gtkardour_files=Split(""" about.cc actions.cc -add_route_dialog.cc add_midi_cc_track_dialog.cc +add_route_dialog.cc ardour_dialog.cc -ardour_ui.cc ardour_ui2.cc +ardour_ui.cc ardour_ui_dependents.cc ardour_ui_dialogs.cc ardour_ui_ed.cc ardour_ui_mixer.cc ardour_ui_options.cc audio_clock.cc -audio_time_axis.cc audio_region_editor.cc -control_point.cc -automation_line.cc -automation_time_axis.cc -automation_streamview.cc +audio_region_view.cc +audio_streamview.cc +audio_time_axis.cc automation_controller.cc +automation_line.cc automation_region_view.cc -bundle_manager.cc -midi_port_dialog.cc -midi_time_axis.cc -midi_scroomer.cc -midi_streamview.cc +automation_streamview.cc +automation_time_axis.cc axis_view.cc +bundle_manager.cc +canvas-midi-event.cc canvas-simpleline.c -simpleline.cc canvas-simplerect.c -simplerect.cc -lineset.cc canvas-waveview.c -diamond.cc -canvas-midi-event.cc +control_point.cc crossfade_edit.cc crossfade_view.cc curvetest.cc -enums.cc +diamond.cc editing.cc -editor.cc editor_actions.cc editor_audio_import.cc editor_audiotrack.cc editor_canvas.cc editor_canvas_events.cc +editor.cc editor_cursors.cc editor_edit_groups.cc editor_export_audio.cc @@ -165,66 +163,72 @@ editor_selection_list.cc editor_tempodisplay.cc editor_timefx.cc engine_dialog.cc +enums.cc export_dialog.cc -export_session_dialog.cc -export_region_dialog.cc export_range_markers_dialog.cc +export_region_dialog.cc +export_session_dialog.cc gain_meter.cc generic_pluginui.cc ghostregion.cc gtk-custom-hruler.c gtk-custom-ruler.c io_selector.cc -port_matrix.cc keyboard.cc keyeditor.cc latency_gui.cc level_meter.cc +lineset.cc location_ui.cc main.cc marker.cc +midi_port_dialog.cc +midi_region_view.cc +midi_scroomer.cc +midi_streamview.cc +midi_time_axis.cc mixer_strip.cc mixer_ui.cc new_session_dialog.cc option_editor.cc opts.cc - -panner.cc panner2d.cc +panner.cc panner_ui.cc piano_roll_header.cc playlist_selector.cc plugin_selector.cc plugin_ui.cc +port_matrix.cc +processor_box.cc prompter.cc public_editor.cc -processor_box.cc region_gain_line.cc region_selection.cc region_view.cc -audio_region_view.cc -midi_region_view.cc -tape_region_view.cc +rhythm_ferret.cc route_params_ui.cc route_processor_selection.cc +route_time_axis.cc route_ui.cc selection.cc -sfdb_ui.cc send_ui.cc +sfdb_ui.cc +simpleline.cc +simplerect.cc splash.cc streamview.cc -audio_streamview.cc +tape_region_view.cc tempo_dialog.cc +tempo_lines.cc theme_manager.cc time_axis_view.cc time_axis_view_item.cc -route_time_axis.cc time_selection.cc ui_config.cc utils.cc version.cc waveview.cc -tempo_lines.cc """) fft_analysis_files=Split(""" @@ -315,7 +319,7 @@ tt = gtkmmtests.Program(target = 'tt', source = tt_files) my_font_dict = { } -if gtkardour['DIST_TARGET'] == 'panther' or gtkardour['DIST_TARGET'] == 'tiger': +if gtkardour['IS_OSX']: # # OS X font rendering is different even with X11 # diff --git a/gtk2_ardour/ardev_common.sh.in b/gtk2_ardour/ardev_common.sh.in index d93f108143..b259eb3087 100644 --- a/gtk2_ardour/ardev_common.sh.in +++ b/gtk2_ardour/ardev_common.sh.in @@ -4,7 +4,7 @@ cd `dirname "$0"`/.. export ARDOUR_PATH=gtk2_ardour/icons:gtk2_ardour/pixmaps:gtk2_ardour:. export GTK_PATH=libs/clearlooks - +export VAMP_PATH=libs/vamp-plugins:$VAMP_PATH export LD_LIBRARY_PATH=libs/vamp-sdk:libs/surfaces/control_protocol:libs/ardour:libs/midi++2:libs/pbd:libs/rubberband:libs/soundtouch:libs/gtkmm2ext:libs/sigc++2:libs/glibmm2:libs/gtkmm2/atk:libs/gtkmm2/pango:libs/gtkmm2/gdk:libs/gtkmm2/gtk:libs/libgnomecanvasmm:libs/libsndfile:libs/appleutility:libs/cairomm:$LD_LIBRARY_PATH diff --git a/gtk2_ardour/ardour-sae-de.bindings.in b/gtk2_ardour/ardour-sae-de.bindings.in index 7feaed247b..68f9b13b0b 100644 --- a/gtk2_ardour/ardour-sae-de.bindings.in +++ b/gtk2_ardour/ardour-sae-de.bindings.in @@ -335,6 +335,8 @@ (gtk_accel_path "<Actions>/Editor/goto-mark-9" "KP_9") (gtk_accel_path "<Actions>/Transport/ToggleClick" "5") (gtk_accel_path "<Actions>/Transport/ToggleAutoReturn" "4") +(gtk_accel_path "<Actions>/Editor/set-tempo-from-region" "9") +(gtk_accel_path "<Actions>/Editor/set-tempo-from-edit-range" "0") (gtk_accel_path "<Actions>/Transport/focus-on-clock" "KP_Divide") (gtk_accel_path "<Actions>/Editor/set-loop-from-edit-range" "bracketright") (gtk_accel_path "<Actions>/Editor/set-punch-from-edit-range" "bracketleft") diff --git a/gtk2_ardour/ardour-sae.menus b/gtk2_ardour/ardour-sae.menus index e3efc7a849..d9c4f1798f 100644 --- a/gtk2_ardour/ardour-sae.menus +++ b/gtk2_ardour/ardour-sae.menus @@ -133,6 +133,9 @@ <menuitem action='cycle-edit-point'/> <menuitem action='cycle-edit-point-with-marker'/> <menuitem action='toggle-edit-mode'/> + <separator/> + <menuitem action='boost-region-gain'/> + <menuitem action='cut-region-gain'/> </menu> </menu> <menu name='Regions' action='Regions'> @@ -164,6 +167,8 @@ <menuitem action='trim-region-to-punch'/> <separator/> <menuitem action='pitch-shift-region'/> + <menuitem action='set-tempo-from-region'/> + <menuitem action='set-tempo-from-edit-range'/> </menu> <menu name='View' action = 'View'> <menuitem action='ToggleMaximalEditor'/> diff --git a/gtk2_ardour/ardour.bindings.in b/gtk2_ardour/ardour.bindings.in index 1efdb1cdd4..3d488c1ec4 100644 --- a/gtk2_ardour/ardour.bindings.in +++ b/gtk2_ardour/ardour.bindings.in @@ -10,6 +10,7 @@ (gtk_accel_path "<Actions>/Editor/edit-cursor-to-previous-region-sync" "apostrophe") (gtk_accel_path "<Actions>/Editor/edit-cursor-to-next-region-sync" "semicolon") (gtk_accel_path "<Actions>/Editor/cycle-edit-point" "grave") +(gtk_accel_path "<Actions>/Editor/cycle-edit-point-with-marker" "<%PRIMARY%>asciicircum") (gtk_accel_path "<Actions>/Editor/playhead-to-next-region-boundary" "period") (gtk_accel_path "<Actions>/Editor/playhead-to-next-region-sync" "<%PRIMARY%>period") @@ -38,6 +39,9 @@ (gtk_accel_path "<Actions>/Editor/set-punch-from-edit-range" "bracketleft") (gtk_accel_path "<Actions>/Editor/set-punch-from-region" "<%SECONDARY%>bracketleft") +(gtk_accel_path "<Actions>/Editor/boost-region-gain" "asciicircum") +(gtk_accel_path "<Actions>/Editor/cut-region-gain" "ampersand") + ;; letters ;; TOP ROW @@ -50,6 +54,7 @@ (gtk_accel_path "<Actions>/Editor/select-all-before-edit-cursor" "<%PRIMARY%>e") (gtk_accel_path "<Actions>/Editor/show-editor-mixer" "<%TERTIARY%>e") (gtk_accel_path "<Actions>/Common/goto-editor" "<%WINDOW%>e") +(gtk_accel_path "<Actions>/Editor/select-all-after-edit-cursor" "<%TERTIARY%><%PRIMARY%>e") (gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-range" "r") (gtk_accel_path "<Actions>/Editor/redo" "<%PRIMARY%>r") (gtk_accel_path "<Actions>/Transport/Record" "<%TERTIARY%>r") @@ -62,22 +67,19 @@ (gtk_accel_path "<Actions>/Common/ToggleOptionsEditor" "<%WINDOW%>o") (gtk_accel_path "<Actions>/Editor/set-playhead" "p") (gtk_accel_path "<Actions>/Editor/select-all-before-playhead" "<%PRIMARY%>p") +(gtk_accel_path "<Actions>/Editor/select-all-after-playhead" "<%TERTIARY%><%PRIMARY%>p") ;; MIDDLE ROW (gtk_accel_path "<Actions>/Editor/align-regions-sync-relative" "a") -(gtk_accel_path "<Actions>/Editor/align-regions-start-relative" "<%PRIMARY%>a") +(gtk_accel_path "<Actions>/Editor/select-all" "<%PRIMARY%>a") (gtk_accel_path "<Actions>/Editor/align-regions-end" "<%SECONDARY%>a") (gtk_accel_path "<Actions>/Editor/align-regions-sync" "<%TERTIARY%>a") +(gtk_accel_path "<Actions>/Editor/align-regions-start-relative" "<%LEVEL4%>a") (gtk_accel_path "<Actions>/Editor/split-region" "s") (gtk_accel_path "<Actions>/Common/Save" "<%PRIMARY%>s") (gtk_accel_path "<Actions>/Editor/duplicate-region" "d") (gtk_accel_path "<Actions>/Editor/select-all-in-punch-range" "<%PRIMARY%>d") - -(gtk_accel_path "<Actions>/Editor/select-all" "<%PRIMARY%>a") -(gtk_accel_path "<Actions>/Editor/select-all-after-playhead" "<%TERTIARY%><%PRIMARY%>p") -(gtk_accel_path "<Actions>/Editor/select-all-after-edit-cursor" "<%TERTIARY%><%PRIMARY%>e") - (gtk_accel_path "<Actions>/Editor/toggle-follow-playhead" "f") (gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-gain" "g") (gtk_accel_path "<Actions>/Editor/play-selected-regions" "h") @@ -180,6 +182,8 @@ (gtk_accel_path "<Actions>/Editor/cycle-snap-choice" "3") (gtk_accel_path "<Actions>/Transport/ToggleAutoReturn" "4") (gtk_accel_path "<Actions>/Transport/ToggleClick" "5") +(gtk_accel_path "<Actions>/Editor/set-tempo-from-region" "9") +(gtk_accel_path "<Actions>/Editor/set-tempo-from-edit-range" "0") ;; ;; unbound actions diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index 40432d5381..4c5439b68c 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -44,6 +44,9 @@ <menuitem action='GotoStart'/> <menuitem action='GotoEnd'/> <separator/> + <menuitem action='tab-to-transient-forwards'/> + <menuitem action='tab-to-transient-backwards'/> + <separator/> <menuitem action='Record'/> <separator/> <menuitem action='TransitionToRoll'/> @@ -161,6 +164,7 @@ <menuitem action='select-prev-route'/> </menu> <menu name='Regions' action='Regions'> + <menuitem action='split-region-at-transients'/> <menuitem action='crop'/> <menuitem action='duplicate-region'/> <menuitem action='multi-duplicate-region'/> @@ -194,6 +198,8 @@ <menuitem action='trim-region-to-punch'/> <separator/> <menuitem action='pitch-shift-region'/> + <menuitem action='set-tempo-from-region'/> + <menuitem action='set-tempo-from-edit-range'/> </menu> <menu name='View' action = 'View'> <menu name='ZoomFocus' action='ZoomFocus'> @@ -302,6 +308,7 @@ <menuitem action='ToggleThemeManager'/> <menuitem action='ToggleBigClock'/> <menuitem action='ToggleBundleManager'/> + <menuitem action='toggle-rhythm-ferret'/> <separator/> </menu> <menu name='Options' action='Options'> diff --git a/gtk2_ardour/ardour3_ui_default.conf b/gtk2_ardour/ardour3_ui_default.conf index bfcb616a93..b64296ae02 100644 --- a/gtk2_ardour/ardour3_ui_default.conf +++ b/gtk2_ardour/ardour3_ui_default.conf @@ -4,11 +4,11 @@ <Option name="ui-rc-file" value="ardour3_ui_dark.rc"/> </UI> <Canvas> - <Option name="waveform" value="000000d6"/> - <Option name="waveform fill" value="0b225a78"/> + <Option name="waveform outline" value="0f0f0fcc"/> + <Option name="waveform fill" value="3d475378"/> <Option name="clipped waveform" value="ff0000e5"/> - <Option name="region base" value="b2bcd3aa"/> - <Option name="selected region base" value="565693a6"/> + <Option name="region base" value="99a7b5aa"/> + <Option name="selected region base" value="b591a8ff"/> <Option name="midi frame base" value="698f9d6d"/> <Option name="audio track base" value="c6d3d868"/> <Option name="audio bus base" value="dbd1ea68"/> diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 90d0e77adc..b563fc4186 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -610,8 +610,6 @@ Please consider the possibilities, and perhaps (re)start JACK.")); win.show_all (); win.set_position (Gtk::WIN_POS_CENTER); - hide_splash (); - /* we just don't care about the result, but we want to block */ win.run (); @@ -2208,6 +2206,7 @@ ARDOUR_UI::end_loading_messages () void ARDOUR_UI::loading_message (const std::string& msg) { + cerr << "say: " << msg << endl; show_splash (); splash->message (msg); flush_pending (); @@ -2254,10 +2253,6 @@ ARDOUR_UI::get_session_parameters (bool backend_audio_is_running, bool should_be new_session_dialog->set_existing_session (existing_session); new_session_dialog->reset_recent(); - /* get this out of the way */ - - hide_splash (); - do { new_session_dialog->set_have_engine (backend_audio_is_running); new_session_dialog->present (); @@ -2622,6 +2617,7 @@ ARDOUR_UI::show_splash () } splash->show (); + splash->present (); splash->queue_draw (); splash->get_window()->process_updates (true); flush_pending (); diff --git a/gtk2_ardour/au_pluginui.h b/gtk2_ardour/au_pluginui.h index e15d48b922..1ca5dca485 100644 --- a/gtk2_ardour/au_pluginui.h +++ b/gtk2_ardour/au_pluginui.h @@ -3,6 +3,7 @@ #include <AppKit/AppKit.h> #include <Carbon/Carbon.h> +#include <AudioUnit/AudioUnitCarbonView.h> #include <AudioUnit/AudioUnit.h> /* fix up stupid apple macros */ diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 89644a4ab3..efd1bdd503 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -796,20 +796,21 @@ AudioRegionView::set_envelope_visible (bool yn) void AudioRegionView::create_waves () { + //cerr << "AudioRegionView::create_waves() called on " << this << endl;//DEBUG RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&trackview))); // ick if (!atv.get_diskstream()) { return; } - uint32_t nchans = atv.get_diskstream()->n_channels().n_audio(); + ChanCount nchans = atv.get_diskstream()->n_channels(); /* in tmp_waves, set up null pointers for each channel so the vector is allocated */ - for (uint32_t n = 0; n < nchans; ++n) { + for (uint32_t n = 0; n < nchans.n_audio(); ++n) { tmp_waves.push_back (0); } - for (uint32_t n = 0; n < nchans; ++n) { + for (uint32_t n = 0; n < nchans.n_audio(); ++n) { if (n >= audio_region()->n_channels()) { break; @@ -818,21 +819,16 @@ AudioRegionView::create_waves () wave_caches.push_back (WaveView::create_cache ()); if (wait_for_data) { - if (audio_region()->audio_source(n)->peaks_ready (bind (mem_fun(*this, &AudioRegionView::peaks_ready_handler), n), data_ready_connection)) { - create_one_wave (n, true); - } else { - // we'll get a PeaksReady signal from the source in the future - // and will call create_one_wave(n) then. - } - } else { create_one_wave (n, true); } + } } void AudioRegionView::create_one_wave (uint32_t which, bool direct) { + //cerr << "AudioRegionView::create_one_wave() called which: " << which << " this: " << this << endl;//DEBUG RouteTimeAxisView& atv (*(dynamic_cast<RouteTimeAxisView*>(&trackview))); // ick uint32_t nchans = atv.get_diskstream()->n_channels().n_audio(); uint32_t n; @@ -862,6 +858,7 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct) wave->property_samples_per_unit() = samples_per_unit; wave->property_amplitude_above_axis() = _amplitude_above_axis; wave->property_wave_color() = _region->muted() ? UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA) : ARDOUR_UI::config()->canvasvar_WaveForm.get(); + wave->property_fill_color() = ARDOUR_UI::config()->canvasvar_WaveFormFill.get(); wave->property_clip_color() = ARDOUR_UI::config()->canvasvar_WaveFormClip.get(); wave->property_zero_color() = ARDOUR_UI::config()->canvasvar_ZeroLine.get(); wave->property_region_start() = _region->start(); @@ -916,7 +913,8 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct) void AudioRegionView::peaks_ready_handler (uint32_t which) { - Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun(*this, &AudioRegionView::create_one_wave), which, false)); + //Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun(*this, &AudioRegionView::create_one_wave), which, false)); + cerr << "AudioRegionView::peaks_ready_handler() called on " << which << " this: " << this << endl; } void @@ -1110,6 +1108,7 @@ AudioRegionView::add_ghost (AutomationTimeAxisView& atv) wave->property_samples_per_unit() = samples_per_unit; wave->property_amplitude_above_axis() = _amplitude_above_axis; wave->property_wave_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWave.get(); + wave->property_fill_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWave.get(); wave->property_clip_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWaveClip.get(); wave->property_zero_color() = ARDOUR_UI::config()->canvasvar_GhostTrackZeroLine.get(); wave->property_region_start() = _region->start(); diff --git a/gtk2_ardour/canvas-waveview.c b/gtk2_ardour/canvas-waveview.c index 05d5c84b32..2f721dc8d6 100644 --- a/gtk2_ardour/canvas-waveview.c +++ b/gtk2_ardour/canvas-waveview.c @@ -368,10 +368,10 @@ gnome_canvas_waveview_init (GnomeCanvasWaveView *waveview) waveview->screen_width = gdk_screen_width (); waveview->reload_cache_in_render = FALSE; - waveview->wave_color = RGBA_TO_UINT(44,35,126,255); - waveview->clip_color = RGBA_TO_UINT(44,0,0,100); - waveview->zero_color = RGBA_TO_UINT(44,0,128,100); - waveview->fill_color = RGBA_TO_UINT(44,35,126,128); + waveview->wave_color = 0; + waveview->clip_color = 0; + waveview->zero_color = 0; + waveview->fill_color = 0; } static void diff --git a/gtk2_ardour/canvas_vars.h b/gtk2_ardour/canvas_vars.h index f79515cd28..354618e176 100644 --- a/gtk2_ardour/canvas_vars.h +++ b/gtk2_ardour/canvas_vars.h @@ -1,4 +1,4 @@ -CANVAS_VARIABLE(canvasvar_WaveForm, "waveform") +CANVAS_VARIABLE(canvasvar_WaveForm, "waveform outline") CANVAS_VARIABLE(canvasvar_WaveFormFill, "waveform fill") CANVAS_VARIABLE(canvasvar_WaveFormClip, "clipped waveform") CANVAS_VARIABLE(canvasvar_FrameBase, "region base") diff --git a/gtk2_ardour/cocoacarbon.mm b/gtk2_ardour/cocoacarbon.mm index b60352eb47..6317cec6c6 100644 --- a/gtk2_ardour/cocoacarbon.mm +++ b/gtk2_ardour/cocoacarbon.mm @@ -18,6 +18,8 @@ #include <Carbon/Carbon.h> #undef check // stupid, stupid carbon +#undef YES // stupid, stupid gtkmm and/or NSObjC +#undef NO // ditto #include "ardour_ui.h" #include "actions.h" @@ -117,6 +119,6 @@ ARDOUR_UI::platform_setup () /* if invoked from the command line, make sure we're visible */ - [NSApp activateIgnoringOtherApps:YES]; + [NSApp activateIgnoringOtherApps:1]; } } diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc index b5aebdfb8d..03d03c3d10 100644 --- a/gtk2_ardour/crossfade_edit.cc +++ b/gtk2_ardour/crossfade_edit.cc @@ -982,10 +982,12 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf) for (vector<ArdourCanvas::WaveView*>::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) { (*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get(); + (*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get(); } for (vector<ArdourCanvas::WaveView*>::iterator i = fade[Out].waves.begin(); i != fade[Out].waves.end(); ++i) { (*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get(); + (*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get(); } fade[In].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorLine.get(); @@ -1005,10 +1007,12 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf) for (vector<ArdourCanvas::WaveView*>::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) { (*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get(); + (*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get(); } for (vector<ArdourCanvas::WaveView*>::iterator i = fade[Out].waves.begin(); i != fade[Out].waves.end(); ++i) { (*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get(); + (*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get(); } fade[Out].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorLine.get(); @@ -1084,6 +1088,7 @@ CrossfadeEditor::make_waves (boost::shared_ptr<AudioRegion> region, WhichFade wh waveview->property_samples_per_unit() = spu; waveview->property_amplitude_above_axis() = 2.0; waveview->property_wave_color() = color; + waveview->property_fill_color() = color; if (which==In) waveview->property_region_start() = region->start(); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 5fe95f013b..5c93877e07 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -83,6 +83,7 @@ #include "sfdb_ui.h" #include "gui_thread.h" #include "simpleline.h" +#include "rhythm_ferret.h" #ifdef FFT_ANALYSIS #include "analysis_window.h" @@ -341,6 +342,7 @@ Editor::Editor () _dragging_hscrollbar = false; select_new_marker = false; zoomed_to_region = false; + rhythm_ferret = 0; scrubbing_direction = 0; @@ -1190,6 +1192,10 @@ Editor::connect_to_session (Session *t) _playlist_selector->set_session (session); nudge_clock.set_session (session); + if (rhythm_ferret) { + rhythm_ferret->set_session (session); + } + #ifdef FFT_ANALYSIS if (analysis_window != 0) analysis_window->set_session (session); @@ -3297,26 +3303,32 @@ Editor::duplicate_dialog (bool with_dialog) if (with_dialog) { - ArdourDialog win ("duplicate dialog"); - Label label (_("Duplicate how many times?")); + ArdourDialog win ("Duplication Dialog"); + Label label (_("Number of Duplications:")); Adjustment adjustment (1.0, 1.0, 1000000.0, 1.0, 5.0); - SpinButton spinner (adjustment); + SpinButton spinner (adjustment, 0.0, 1); + HBox hbox; win.get_vbox()->set_spacing (12); - win.get_vbox()->pack_start (label); + win.get_vbox()->pack_start (hbox); + hbox.set_border_width (6); + hbox.pack_start (label, PACK_EXPAND_PADDING, 12); /* dialogs have ::add_action_widget() but that puts the spinner in the wrong place, visually. so do this by hand. */ - win.get_vbox()->pack_start (spinner); + hbox.pack_start (spinner, PACK_EXPAND_PADDING, 12); spinner.signal_activate().connect (sigc::bind (mem_fun (win, &ArdourDialog::response), RESPONSE_ACCEPT)); - + spinner.grab_focus(); + + hbox.show (); label.show (); spinner.show (); - win.add_button (Stock::OK, RESPONSE_ACCEPT); win.add_button (Stock::CANCEL, RESPONSE_CANCEL); + win.add_button (_("Duplicate"), RESPONSE_ACCEPT); + win.set_default_response (RESPONSE_ACCEPT); win.set_position (WIN_POS_MOUSE); @@ -4587,3 +4599,15 @@ Editor::get_regions_corresponding_to (boost::shared_ptr<Region> region, vector<R } } } + +void +Editor::show_rhythm_ferret () +{ + if (rhythm_ferret == 0) { + rhythm_ferret = new RhythmFerret(*this); + } + + rhythm_ferret->set_session (session); + rhythm_ferret->show (); + rhythm_ferret->present (); +} diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index c8e9589c02..56b0077b99 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -107,6 +107,7 @@ class StreamView; class AudioStreamView; class ControlPoint; class SoundFileOmega; +class RhythmFerret; #ifdef FFT_ANALYSIS class AnalysisWindow; #endif @@ -371,6 +372,8 @@ class Editor : public PublicEditor void toggle_meter_updating(); + void show_rhythm_ferret(); + protected: void map_transport_state (); void map_position_change (nframes_t); @@ -1024,6 +1027,8 @@ class Editor : public PublicEditor void split_region (); void split_region_at (nframes_t); void split_regions_at (nframes_t, RegionSelection&); + void split_region_at_transients (); + void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, std::vector<nframes64_t>&); void crop_region_to_selection (); void crop_region_to (nframes_t start, nframes_t end); void set_sync_point (nframes64_t, const RegionSelection&); @@ -1051,6 +1056,13 @@ class Editor : public PublicEditor void adjust_region_scale_amplitude (bool up); void quantize_region (); + void tab_to_transient (bool forward); + + void use_region_as_bar (); + void use_range_as_bar (); + + void define_one_bar (nframes64_t start, nframes64_t end); + void audition_region_from_region_list (); void hide_region_from_region_list (); void remove_region_from_region_list (); @@ -2164,6 +2176,8 @@ class Editor : public PublicEditor void select_next_route (); void select_prev_route (); + + RhythmFerret* rhythm_ferret; }; #endif /* __ardour_editor_h__ */ diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 2009b36f93..51752fb6bb 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -356,13 +356,30 @@ Editor::register_actions () ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "normalize-region", _("Normalize Region"), mem_fun(*this, &Editor::normalize_region)); ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "boost-region-gain", _("Boost Region Gain"), bind (mem_fun(*this, &Editor::adjust_region_scale_amplitude), true)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "cut-region-gain", _("Cut Region Gain"), bind (mem_fun(*this, &Editor::adjust_region_scale_amplitude), false)); ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "quantize-region", _("Quantize Region"), mem_fun(*this, &Editor::quantize_region)); ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "set-tempo-from-region", _("Set Tempo from Region=Bar"), mem_fun(*this, &Editor::use_region_as_bar)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "set-tempo-from-edit-range", _("Set Tempo from Edit Range=Bar"), mem_fun(*this, &Editor::use_range_as_bar)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (editor_actions, "split-region-at-transients", _("Split Regions At Percussion Onsets"), mem_fun(*this, &Editor::split_region_at_transients)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "toggle-rhythm-ferret", _("Rhythm Ferret"), mem_fun(*this, &Editor::show_rhythm_ferret)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (editor_actions, "tab-to-transient-forwards", _("Move Forward to Transient"), bind (mem_fun(*this, &Editor::tab_to_transient), true)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "tab-to-transient-backwards", _("Move Forward to Transient"), bind (mem_fun(*this, &Editor::tab_to_transient), false)); + ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (editor_actions, "crop", _("Crop"), mem_fun(*this, &Editor::crop_region_to_selection)); ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "insert-chunk", _("Insert Chunk"), bind (mem_fun(*this, &Editor::paste_named_selection), 1.0f)); diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 98451c6b0a..aeff20f0bc 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -453,6 +453,8 @@ Editor::track_canvas_drag_data_received (const RefPtr<Gdk::DragContext>& context const SelectionData& data, guint info, guint time) { + cerr << "drop on canvas, target = " << data.get_target() << endl; + if (data.get_target() == "regions") { drop_regions (context, x, y, data, info, time); } else { diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 33a0e6920c..1f833e8337 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -45,10 +45,12 @@ #include <ardour/location.h> #include <ardour/named_selection.h> #include <ardour/audio_track.h> +#include <ardour/audiofilesource.h> #include <ardour/audioplaylist.h> #include <ardour/region_factory.h> #include <ardour/playlist_factory.h> #include <ardour/reverse.h> +#include <ardour/transient_detector.h> #include <ardour/dB.h> #include <ardour/quantize.h> @@ -3042,9 +3044,9 @@ Editor::align_selection_relative (RegionPoint point, nframes_t position, const R return; } - nframes_t distance; + nframes_t distance = 0; nframes_t pos = 0; - int dir; + int dir = 0; list<RegionView*> sorted; rs.by_position (sorted); @@ -4148,7 +4150,7 @@ Editor::adjust_region_scale_amplitude (bool up) return; } - ExclusiveRegionSelection (*this, entered_regionview); + ExclusiveRegionSelection esr (*this, entered_regionview); if (selection->regions.empty()) { return; @@ -4164,10 +4166,6 @@ Editor::adjust_region_scale_amplitude (bool up) double fraction = gain_to_slider_position (arv->audio_region()->scale_amplitude ()); - cerr << "slider pos for " << arv->audio_region()->scale_amplitude () - << " = " << fraction - << endl; - if (up) { fraction += 0.05; fraction = min (fraction, 1.0); @@ -4180,16 +4178,14 @@ Editor::adjust_region_scale_amplitude (bool up) continue; } - if (up && fraction >= 1.0) { - continue; - } - fraction = slider_position_to_gain (fraction); fraction = coefficient_to_dB (fraction); fraction = dB_to_coefficient (fraction); - - cerr << "set scale amp for " << arv->audio_region()->name() << " to " << fraction << endl; + if (up && fraction >= 2.0) { + continue; + } + arv->audio_region()->set_scale_amplitude (fraction); session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state())); } @@ -4481,7 +4477,7 @@ Editor::toggle_fade_active (bool in) const char* cmd = (in ? _("toggle fade in active") : _("toggle fade out active")); bool have_switch = false; - bool yn; + bool yn = false; begin_reversible_command (cmd); @@ -4986,3 +4982,233 @@ Editor::pitch_shift_regions () pitch_shift (selection->regions, 1.2); } +void +Editor::use_region_as_bar () +{ + if (!session) { + return; + } + + ExclusiveRegionSelection esr (*this, entered_regionview); + + if (selection->regions.empty()) { + return; + } + + RegionView* rv = selection->regions.front(); + + define_one_bar (rv->region()->position(), rv->region()->last_frame() + 1); +} + +void +Editor::use_range_as_bar () +{ + nframes64_t start, end; + if (get_edit_op_range (start, end)) { + define_one_bar (start, end); + } +} + +void +Editor::define_one_bar (nframes64_t start, nframes64_t end) +{ + nframes64_t length = end - start; + + const Meter& m (session->tempo_map().meter_at (start)); + + /* region length = 1 bar */ + + /* 1 bar = how many beats per bar */ + + double beats_per_bar = m.beats_per_bar(); + + /* now we want frames per beat. + we have frames per bar, and beats per bar, so ... + */ + + double frames_per_beat = length / beats_per_bar; + + /* beats per minute = */ + + double beats_per_minute = (session->frame_rate() * 60.0) / frames_per_beat; + + const TempoSection& t (session->tempo_map().tempo_section_at (start)); + + begin_reversible_command (_("set tempo from region")); + XMLNode& before (session->tempo_map().get_state()); + + if (t.frame() == start) { + session->tempo_map().change_existing_tempo_at (start, beats_per_minute, t.note_type()); + } else { + session->tempo_map().add_tempo (Tempo (beats_per_minute, t.note_type()), start); + } + + XMLNode& after (session->tempo_map().get_state()); + + session->add_command (new MementoCommand<TempoMap>(session->tempo_map(), &before, &after)); + commit_reversible_command (); +} + +void +Editor::split_region_at_transients () +{ + vector<nframes64_t> positions; + + if (!session) { + return; + } + + ExclusiveRegionSelection esr (*this, entered_regionview); + + if (selection->regions.empty()) { + return; + } + + session->begin_reversible_command (_("split regions")); + + for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ) { + + RegionSelection::iterator tmp; + + tmp = i; + ++tmp; + + boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> ((*i)->region()); + + if (ar && (ar->get_transients (positions) == 0)) { + split_region_at_points ((*i)->region(), positions); + positions.clear (); + } + + i = tmp; + } + + session->commit_reversible_command (); + +} + +void +Editor::split_region_at_points (boost::shared_ptr<Region> r, vector<nframes64_t>& positions) +{ + boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (r); + + if (!ar) { + return; + } + + boost::shared_ptr<Playlist> pl = ar->playlist(); + + if (!pl) { + return; + } + + if (positions.empty()) { + return; + } + + vector<nframes64_t>::const_iterator x; + + nframes64_t pos = ar->position(); + + XMLNode& before (pl->get_state()); + + x = positions.begin(); + + while (x != positions.end()) { + if ((*x) > pos) { + break; + } + } + + if (x == positions.end()) { + return; + } + + pl->freeze (); + pl->remove_region (ar); + + do { + + /* file start = original start + how far we from the initial position ? + */ + + nframes64_t file_start = ar->start() + (pos - ar->position()); + + /* length = next position - current position + */ + + nframes64_t len = (*x) - pos; + + string new_name; + + if (session->region_name (new_name, ar->name())) { + continue; + } + + pl->add_region (RegionFactory::create (ar->sources(), file_start, len, new_name), pos); + + pos += len; + + ++x; + + } while (x != positions.end() && (*x) < ar->last_frame()); + + pl->thaw (); + + XMLNode& after (pl->get_state()); + + session->add_command (new MementoCommand<Playlist>(*pl, &before, &after)); +} + +void +Editor::tab_to_transient (bool forward) +{ + + vector<nframes64_t> positions; + + if (!session) { + return; + } + + ExclusiveRegionSelection esr (*this, entered_regionview); + + if (selection->regions.empty()) { + return; + } + + boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (selection->regions.front()->region()); + + if (!ar) { + return; + } + + ar->get_transients (positions); + nframes64_t pos = session->audible_frame (); + + if (forward) { + vector<nframes64_t>::iterator x; + + for (x = positions.begin(); x != positions.end(); ++x) { + if ((*x) > pos) { + break; + } + } + + if (x != positions.end ()) { + session->request_locate (*x); + } + + } else { + vector<nframes64_t>::reverse_iterator x; + + for (x = positions.rbegin(); x != positions.rend(); ++x) { + if ((*x) < pos) { + break; + } + } + + if (x != positions.rend ()) { + session->request_locate (*x); + } + } +} diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index f18392ce38..591c3d12fe 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -220,7 +220,8 @@ Editor::mouse_add_new_tempo_event (nframes_t frame) TempoDialog tempo_dialog (map, frame, _("add")); tempo_dialog.set_position (Gtk::WIN_POS_MOUSE); - tempo_dialog.signal_realize().connect (bind (sigc::ptr_fun (set_decoration), &tempo_dialog, Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH))); + //this causes compiz to display no border. + //tempo_dialog.signal_realize().connect (bind (sigc::ptr_fun (set_decoration), &tempo_dialog, Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH))); ensure_float (tempo_dialog); @@ -247,7 +248,7 @@ Editor::mouse_add_new_tempo_event (nframes_t frame) session->add_command(new MementoCommand<TempoMap>(map, &before, &after)); commit_reversible_command (); - map.dump (cerr); + //map.dump (cerr); } void @@ -262,7 +263,9 @@ Editor::mouse_add_new_meter_event (nframes_t frame) MeterDialog meter_dialog (map, frame, _("add")); meter_dialog.set_position (Gtk::WIN_POS_MOUSE); - meter_dialog.signal_realize().connect (bind (sigc::ptr_fun (set_decoration), &meter_dialog, Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH))); + + //this causes compiz to display no border.. + //meter_dialog.signal_realize().connect (bind (sigc::ptr_fun (set_decoration), &meter_dialog, Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH))); ensure_float (meter_dialog); @@ -278,16 +281,16 @@ Editor::mouse_add_new_meter_event (nframes_t frame) double note_type = meter_dialog.get_note_type (); BBT_Time requested; - + meter_dialog.get_bbt_time (requested); - + begin_reversible_command (_("add meter mark")); XMLNode &before = map.get_state(); map.add_meter (Meter (bpb, note_type), requested); session->add_command(new MementoCommand<TempoMap>(map, &before, &map.get_state())); commit_reversible_command (); - map.dump (cerr); + //map.dump (cerr); } void diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index f7f8d4a67b..9835901a24 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -373,7 +373,7 @@ EngineControl::build_command_line (vector<string>& cmd) str = timeout_combo.get_active_text (); if (str != _("Ignore")) { - double secs; + double secs = 0; uint32_t msecs; atof (str); msecs = (uint32_t) floor (secs * 1000.0); @@ -819,7 +819,7 @@ EngineControl::driver_changed () vector<string>& strings = devices[driver]; - if (strings.empty()) { + if (strings.empty() && driver != "FFADO") { error << string_compose (_("No devices found for driver \"%1\""), driver) << endmsg; return; } @@ -1096,7 +1096,7 @@ EngineControl::set_state (const XMLNode& root) XMLNodeList clist; XMLNodeConstIterator citer; XMLNode* child; - XMLProperty* prop; + XMLProperty* prop = NULL; bool using_dummy = false; int val; @@ -1112,7 +1112,8 @@ EngineControl::set_state (const XMLNode& root) clist = root.children(); for (citer = clist.begin(); citer != clist.end(); ++citer) { - + if ( prop && (prop->value() == "FFADO" )) + continue; child = *citer; prop = child->property ("val"); diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index 7ae3f45dfb..ed185c33bc 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -38,6 +38,7 @@ #include <ardour/plugin.h> #include <ardour/plugin_insert.h> #include <ardour/ladspa_plugin.h> +#include <ardour/lv2_plugin.h> #include <lrdf.h> @@ -384,6 +385,7 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat if (plugin->parameter_is_input (port_index)) { boost::shared_ptr<LadspaPlugin> lp; + boost::shared_ptr<LV2Plugin> lv2p; if ((lp = boost::dynamic_pointer_cast<LadspaPlugin>(plugin)) != 0) { @@ -406,6 +408,26 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat lrdf_free_setting_values(defaults); return control_ui; } + + } else if ((lv2p = boost::dynamic_pointer_cast<LV2Plugin>(plugin)) != 0) { + + SLV2Port port = lv2p->slv2_port(port_index); + SLV2ScalePoints points = slv2_port_get_scale_points(lv2p->slv2_plugin(), port); + + if (points) { + control_ui->combo = new Gtk::ComboBoxText; + //control_ui->combo->set_value_in_list(true, false); + set_popdown_strings (*control_ui->combo, setup_scale_values(port_index, control_ui)); + control_ui->combo->signal_changed().connect (bind (mem_fun(*this, &GenericPluginUI::control_combo_changed), control_ui)); + mcontrol->Changed.connect (bind (mem_fun (*this, &GenericPluginUI::parameter_changed), control_ui)); + control_ui->pack_start(control_ui->label, true, true); + control_ui->pack_start(*control_ui->combo, false, true); + + update_control_display(control_ui); + + slv2_scale_points_free(points); + return control_ui; + } } if (desc.toggled) { @@ -734,26 +756,49 @@ vector<string> GenericPluginUI::setup_scale_values(guint32 port_index, ControlUI* cui) { vector<string> enums; - boost::shared_ptr<LadspaPlugin> lp = boost::dynamic_pointer_cast<LadspaPlugin> (plugin); + boost::shared_ptr<LadspaPlugin> lp; + boost::shared_ptr<LV2Plugin> lv2p; + + if ((lp = boost::dynamic_pointer_cast<LadspaPlugin>(plugin)) != 0) { + // all LADPSA plugins have a numeric unique ID + uint32_t id = atol (lp->unique_id().c_str()); + + cui->combo_map = new std::map<string, float>; + lrdf_defaults* defaults = lrdf_get_scale_values(id, port_index); + if (defaults) { + for (uint32_t i = 0; i < defaults->count; ++i) { + enums.push_back(defaults->items[i].label); + pair<string, float> newpair; + newpair.first = defaults->items[i].label; + newpair.second = defaults->items[i].value; + cui->combo_map->insert(newpair); + } - cui->combo_map = new std::map<string, float>; - - // FIXME: not all plugins have a numeric unique ID - uint32_t id = atol (lp->unique_id().c_str()); - lrdf_defaults* defaults = lrdf_get_scale_values(id, port_index); - - if (defaults) { - for (uint32_t i = 0; i < defaults->count; ++i) { - enums.push_back(defaults->items[i].label); - pair<string, float> newpair; - newpair.first = defaults->items[i].label; - newpair.second = defaults->items[i].value; - cui->combo_map->insert(newpair); + lrdf_free_setting_values(defaults); + } + + } else if ((lv2p = boost::dynamic_pointer_cast<LV2Plugin>(plugin)) != 0) { + + SLV2Port port = lv2p->slv2_port(port_index); + SLV2ScalePoints points = slv2_port_get_scale_points(lv2p->slv2_plugin(), port); + cui->combo_map = new std::map<string, float>; + + for (unsigned i=0; i < slv2_scale_points_size(points); ++i) { + SLV2ScalePoint p = slv2_scale_points_get_at(points, i); + SLV2Value label = slv2_scale_point_get_label(p); + SLV2Value value = slv2_scale_point_get_value(p); + if (label && (slv2_value_is_float(value) || slv2_value_is_int(value))) { + enums.push_back(slv2_value_as_string(label)); + pair<string, float> newpair; + newpair.first = slv2_value_as_string(label); + newpair.second = slv2_value_as_float(value); + cui->combo_map->insert(newpair); + } } - lrdf_free_setting_values(defaults); + slv2_scale_points_free(points); } + return enums; } - diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc index 71bc8de694..b14872b357 100644 --- a/gtk2_ardour/ghostregion.cc +++ b/gtk2_ardour/ghostregion.cc @@ -98,6 +98,7 @@ GhostRegion::set_colors () for (uint32_t n=0; n < waves.size(); ++n) { waves[n]->property_wave_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWave.get(); + waves[n]->property_fill_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWave.get(); waves[n]->property_clip_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWaveClip.get(); waves[n]->property_zero_color() = ARDOUR_UI::config()->canvasvar_GhostTrackZeroLine.get(); diff --git a/gtk2_ardour/latency_gui.cc b/gtk2_ardour/latency_gui.cc index 0146bfdaa8..d03ad5b9f9 100644 --- a/gtk2_ardour/latency_gui.cc +++ b/gtk2_ardour/latency_gui.cc @@ -114,7 +114,7 @@ void LatencyGUI::change_latency_from_button (int dir) { Glib::ustring unitstr = units_combo.get_active_text(); - double shift; + double shift = 0.0; if (unitstr == unit_strings[0]) { shift = 1; diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 749c78dc50..f279f93c39 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -254,6 +254,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway virtual void restore_editing_space () = 0; virtual nframes64_t get_preferred_edit_position (bool ignore_playhead = false) = 0; virtual void toggle_meter_updating() = 0; + virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, std::vector<nframes64_t>&) = 0; #ifdef WITH_CMT virtual void add_imageframe_time_axis(const std::string & track_name, void*) = 0; diff --git a/gtk2_ardour/rhythm_ferret.cc b/gtk2_ardour/rhythm_ferret.cc new file mode 100644 index 0000000000..980b36e1d1 --- /dev/null +++ b/gtk2_ardour/rhythm_ferret.cc @@ -0,0 +1,305 @@ +#include <gtkmm/stock.h> +#include <gtkmm2ext/utils.h> + +#include <pbd/memento_command.h> + +#include <ardour/transient_detector.h> +#include <ardour/audiosource.h> +#include <ardour/audioregion.h> +#include <ardour/playlist.h> +#include <ardour/region_factory.h> +#include <ardour/session.h> + +#include "rhythm_ferret.h" +#include "audio_region_view.h" +#include "public_editor.h" + +#include "i18n.h" + +using namespace std; +using namespace Gtk; +using namespace Gdk; +using namespace PBD; +using namespace ARDOUR; + +/* order of these must match the AnalysisMode enums + in rhythm_ferret.h +*/ +static const gchar * _analysis_mode_strings[] = { + N_("Percussive Onset"), + N_("Note Onset"), + 0 +}; + +RhythmFerret::RhythmFerret (PublicEditor& e) + : ArdourDialog (_("Rhythm Ferret")) + , editor (e) + , operation_frame (_("Operation")) + , selection_frame (_("Selection")) + , ferret_frame (_("Analysis")) + , logo (0) + , region_split_button (operation_button_group, _("Split Region")) + , tempo_button (operation_button_group, _("Set Tempo Map")) + , region_conform_button (operation_button_group, _("Conform Region")) + , analysis_mode_label (_("Mode")) + , detection_threshold_adjustment (3, 0, 20, 1, 4) + , detection_threshold_scale (detection_threshold_adjustment) + , detection_threshold_label (_("Threshold")) + , sensitivity_adjustment (40, 0, 100, 1, 10) + , sensitivity_scale (sensitivity_adjustment) + , sensitivity_label (_("Sensitivity")) + , analyze_button (_("Analyze")) + , trigger_gap_adjustment (3, 0, 100, 1, 10) + , trigger_gap_spinner (trigger_gap_adjustment) + , trigger_gap_label (_("Trigger gap (msecs)")) + , action_button (Stock::APPLY) + +{ + upper_hpacker.set_spacing (6); + + upper_hpacker.pack_start (operation_frame, true, true); + upper_hpacker.pack_start (selection_frame, true, true); + upper_hpacker.pack_start (ferret_frame, true, true); + + op_packer.pack_start (region_split_button, false, false); + op_packer.pack_start (tempo_button, false, false); + op_packer.pack_start (region_conform_button, false, false); + + operation_frame.add (op_packer); + + HBox* box; + + ferret_packer.set_spacing (6); + ferret_packer.set_border_width (6); + + vector<string> strings; + + analysis_mode_strings = I18N (_analysis_mode_strings); + Gtkmm2ext::set_popdown_strings (analysis_mode_selector, analysis_mode_strings); + analysis_mode_selector.set_active_text (analysis_mode_strings.front()); + + box = manage (new HBox); + box->set_spacing (6); + box->pack_start (analysis_mode_label, false, false); + box->pack_start (analysis_mode_selector, true, true); + ferret_packer.pack_start (*box, false, false); + + box = manage (new HBox); + box->set_spacing (6); + box->pack_start (detection_threshold_label, false, false); + box->pack_start (detection_threshold_scale, true, true); + ferret_packer.pack_start (*box, false, false); + + box = manage (new HBox); + box->set_spacing (6); + box->pack_start (sensitivity_label, false, false); + box->pack_start (sensitivity_scale, true, true); + ferret_packer.pack_start (*box, false, false); + + box = manage (new HBox); + box->set_spacing (6); + box->pack_start (trigger_gap_label, false, false); + box->pack_start (trigger_gap_spinner, false, false); + ferret_packer.pack_start (*box, false, false); + + ferret_packer.pack_start (analyze_button, false, false); + + analyze_button.signal_clicked().connect (mem_fun (*this, &RhythmFerret::run_analysis)); + + ferret_frame.add (ferret_packer); + + // Glib::RefPtr<Pixbuf> logo_pixbuf ("somefile"); + + if (logo) { + lower_hpacker.pack_start (*logo, false, false); + } + + lower_hpacker.pack_start (operation_clarification_label, false, false); + lower_hpacker.pack_start (action_button, false, false); + + action_button.signal_clicked().connect (mem_fun (*this, &RhythmFerret::do_action)); + + get_vbox()->set_border_width (6); + get_vbox()->set_spacing (6); + get_vbox()->pack_start (upper_hpacker, true, true); + get_vbox()->pack_start (lower_hpacker, false, false); + + show_all (); +} + +RhythmFerret::~RhythmFerret() +{ + if (logo) { + delete logo; + } +} + +RhythmFerret::AnalysisMode +RhythmFerret::get_analysis_mode () const +{ + string str = analysis_mode_selector.get_active_text (); + + if (str == _(_analysis_mode_strings[(int) NoteOnset])) { + return NoteOnset; + } + + return PercussionOnset; +} + +RhythmFerret::Action +RhythmFerret::get_action () const +{ + if (tempo_button.get_active()) { + return DefineTempoMap; + } else if (region_conform_button.get_active()) { + return ConformRegion; + } + + return SplitRegion; +} + +void +RhythmFerret::run_analysis () +{ + if (!session) { + return; + } + + RegionSelection& regions (editor.get_selection().regions); + + current_results.clear (); + + if (regions.empty()) { + return; + } + + for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) { + + boost::shared_ptr<Readable> rd = boost::static_pointer_cast<AudioRegion> ((*i)->region()); + + switch (get_analysis_mode()) { + case PercussionOnset: + run_percussion_onset_analysis (rd, (*i)->region()->position(), current_results); + break; + default: + break; + } + + } + + for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) { + (*i)->get_time_axis_view().show_temporary_lines (current_results); + } + +} + +int +RhythmFerret::run_percussion_onset_analysis (boost::shared_ptr<Readable> readable, nframes64_t offset, vector<nframes64_t>& results) +{ + TransientDetector t (session->frame_rate()); + + for (uint32_t i = 0; i < readable->n_channels(); ++i) { + + vector<nframes64_t> these_results; + + t.reset (); + t.set_threshold (detection_threshold_adjustment.get_value()); + t.set_sensitivity (sensitivity_adjustment.get_value()); + + if (t.run ("", readable.get(), i, these_results)) { + continue; + } + + /* translate all transients to give absolute position */ + + for (vector<nframes64_t>::iterator i = these_results.begin(); i != these_results.end(); ++i) { + (*i) += offset; + } + + /* merge */ + + results.insert (results.end(), these_results.begin(), these_results.end()); + } + + if (!results.empty()) { + + /* now resort to bring transients from different channels together */ + + sort (results.begin(), results.end()); + + /* remove duplicates or other things that are too close */ + + vector<nframes64_t>::iterator i = results.begin(); + nframes64_t curr = (*i); + nframes64_t gap_frames = (nframes64_t) floor (trigger_gap_adjustment.get_value() * (session->frame_rate() / 1000.0)); + + ++i; + + while (i != results.end()) { + if (((*i) == curr) || (((*i) - curr) < gap_frames)) { + i = results.erase (i); + } else { + ++i; + curr = *i; + } + } + + } + + return 0; +} + +void +RhythmFerret::do_action () +{ + if (!session || current_results.empty()) { + return; + } + + switch (get_action()) { + case SplitRegion: + do_split_action (); + break; + + default: + break; + } +} + +void +RhythmFerret::do_split_action () +{ + /* this can/will change the current selection, so work with a copy */ + + RegionSelection& regions (editor.get_selection().regions); + + if (regions.empty()) { + return; + } + + session->begin_reversible_command (_("split regions (rhythm ferret)")); + + for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ) { + + RegionSelection::iterator tmp; + + tmp = i; + ++tmp; + + (*i)->get_time_axis_view().hide_temporary_lines (); + + editor.split_region_at_points ((*i)->region(), current_results); + + /* i is invalid at this point */ + + i = tmp; + } + +} + +void +RhythmFerret::set_session (Session* s) +{ + ArdourDialog::set_session (s); + current_results.clear (); +} diff --git a/gtk2_ardour/rhythm_ferret.h b/gtk2_ardour/rhythm_ferret.h new file mode 100644 index 0000000000..36d4450939 --- /dev/null +++ b/gtk2_ardour/rhythm_ferret.h @@ -0,0 +1,100 @@ +#ifndef __gtk2_ardour_rhythm_ferret_h__ +#define __gtk2_ardour_rhythm_ferret_h__ + +#include <gtkmm/box.h> +#include <gtkmm/scale.h> +#include <gtkmm/spinbutton.h> +#include <gtkmm/radiobutton.h> +#include <gtkmm/radiobuttongroup.h> +#include <gtkmm/frame.h> +#include <gtkmm/image.h> +#include <gtkmm/comboboxtext.h> +#include <gtkmm/button.h> +#include <gtkmm/label.h> + +#include "ardour_dialog.h" + +namespace ARDOUR { + class Readable; +} + +class PublicEditor; +class RegionView; + +class RhythmFerret : public ArdourDialog { + public: + /* order of these enums must match the _analyse_mode_strings + in rhythm_ferret.cc + */ + enum AnalysisMode { + PercussionOnset, + NoteOnset + }; + + enum Action { + SplitRegion, + DefineTempoMap, + ConformRegion + }; + + RhythmFerret (PublicEditor&); + ~RhythmFerret (); + + void set_session (ARDOUR::Session*); + + private: + PublicEditor& editor; + + Gtk::HBox upper_hpacker; + Gtk::HBox lower_hpacker; + + Gtk::Frame operation_frame; + Gtk::Frame selection_frame; + Gtk::Frame ferret_frame; + + Gtk::VBox op_logo_packer; + Gtk::Image* logo; + + /* operation frame */ + + Gtk::VBox op_packer; + Gtk::RadioButtonGroup operation_button_group; + Gtk::RadioButton region_split_button; + Gtk::RadioButton tempo_button; + Gtk::RadioButton region_conform_button; + + /* analysis frame */ + + Gtk::VBox ferret_packer; + Gtk::ComboBoxText analysis_mode_selector; + Gtk::Label analysis_mode_label; + Gtk::Adjustment detection_threshold_adjustment; + Gtk::HScale detection_threshold_scale; + Gtk::Label detection_threshold_label; + Gtk::Adjustment sensitivity_adjustment; + Gtk::HScale sensitivity_scale; + Gtk::Label sensitivity_label; + Gtk::Button analyze_button; + Gtk::Adjustment trigger_gap_adjustment; + Gtk::SpinButton trigger_gap_spinner; + Gtk::Label trigger_gap_label; + + Gtk::Label operation_clarification_label; + Gtk::Button action_button; + + std::vector<std::string> analysis_mode_strings; + + std::vector<nframes64_t> current_results; + + AnalysisMode get_analysis_mode () const; + Action get_action() const; + + void run_analysis (); + int run_percussion_onset_analysis (boost::shared_ptr<ARDOUR::Readable> region, nframes64_t offset, std::vector<nframes64_t>& results); + + void do_action (); + void do_split_action (); + void do_region_split (RegionView* rv, const std::vector<nframes64_t>&); +}; + +#endif /* __gtk2_ardour_rhythm_ferret_h__ */ diff --git a/gtk2_ardour/splash.cc b/gtk2_ardour/splash.cc index 404c5c64a0..9317ec1caa 100644 --- a/gtk2_ardour/splash.cc +++ b/gtk2_ardour/splash.cc @@ -29,14 +29,19 @@ Splash::Splash () catch (...) { throw failed_constructor(); } - + darea.set_size_request (pixbuf->get_width(), pixbuf->get_height()); - set_type_hint (Gdk::WINDOW_TYPE_HINT_SPLASHSCREEN); set_keep_above (true); set_position (WIN_POS_CENTER); darea.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); layout = create_pango_layout (""); + string str = "<b>"; + string i18n = _("Ardour loading ..."); + str += i18n; + str += "</b>"; + + layout->set_markup (str); darea.show (); darea.signal_expose_event().connect (mem_fun (*this, &Splash::expose)); @@ -48,6 +53,7 @@ void Splash::on_realize () { Window::on_realize (); + get_window()->set_decorations (Gdk::WMDecoration(0)); layout->set_font_description (get_style()->get_font()); } @@ -62,21 +68,19 @@ Splash::on_button_release_event (GdkEventButton* ev) bool Splash::expose (GdkEventExpose* ev) { -#if 0 RefPtr<Gdk::Window> window = darea.get_window(); - - Glib::RefPtr<Gtk::Style> style = darea.get_style(); - window->draw_pixbuf (darea.get_style()->get_bg_gc (STATE_NORMAL), pixbuf, + window->draw_pixbuf (get_style()->get_bg_gc (STATE_NORMAL), pixbuf, ev->area.x, ev->area.y, ev->area.x, ev->area.y, ev->area.width, ev->area.height, Gdk::RGB_DITHER_NONE, 0, 0); + Glib::RefPtr<Gtk::Style> style = darea.get_style(); Glib::RefPtr<Gdk::GC> white = style->get_white_gc(); window->draw_layout (white, 10, pixbuf->get_height() - 30, layout); -#endif + return true; } diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index 9d5ba926c5..0c99a4eeb0 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -36,12 +36,11 @@ TempoDialog::TempoDialog (TempoMap& map, nframes_t frame, const string & action) : ArdourDialog (_("edit tempo")), bpm_adjustment (60.0, 1.0, 999.9, 0.1, 1.0, 1.0), bpm_spinner (bpm_adjustment), - bpm_frame (_("Beats per minute")), - note_frame (_("BPM denominator")), + bpm_frame (_("Tempo")), ok_button (action), cancel_button (_("Cancel")), - when_bar_label (_("Bar")), - when_beat_label (_("Beat")), + when_bar_label (_("Bar"), ALIGN_LEFT, ALIGN_CENTER), + when_beat_label (_("Beat"), ALIGN_LEFT, ALIGN_CENTER), when_table (2, 2), when_frame (_("Location")) { @@ -56,11 +55,11 @@ TempoDialog::TempoDialog (TempoSection& section, const string & action) : ArdourDialog ("tempo dialog"), bpm_adjustment (60.0, 1.0, 999.9, 0.1, 1.0, 1.0), bpm_spinner (bpm_adjustment), - bpm_frame (_("Beats per minute")), + bpm_frame (_("Tempo")), ok_button (action), cancel_button (_("Cancel")), - when_bar_label (_("Bar")), - when_beat_label (_("Beat")), + when_bar_label (_("Bar"), ALIGN_LEFT, ALIGN_CENTER), + when_beat_label (_("Beat"), ALIGN_LEFT, ALIGN_CENTER), when_table (2, 2), when_frame (_("Location")) { @@ -108,18 +107,18 @@ TempoDialog::init (const BBT_Time& when, double bpm, double note_type, bool mova else note_types.set_active_text (_("quarter (4)")); - hspacer1.set_border_width (5); - hspacer1.pack_start (bpm_spinner, false, false); - vspacer1.set_border_width (5); - vspacer1.pack_start (hspacer1, false, false); + Label* bpm_label = manage(new Label(_("Beats Per Minute:"), ALIGN_LEFT, ALIGN_CENTER)); - hspacer2.set_border_width (5); - hspacer2.pack_start (note_types, false, false); - vspacer2.set_border_width (5); - vspacer2.pack_start (hspacer2, false, false); + hspacer1.set_border_width (6); + hspacer1.pack_end (bpm_spinner, PACK_EXPAND_PADDING); + hspacer1.pack_start (*bpm_label, PACK_EXPAND_PADDING); + vspacer1.set_border_width (6); + vspacer1.pack_start (hspacer1, PACK_EXPAND_PADDING); + + hspacer2.set_border_width (6); + hspacer2.pack_start (note_types, PACK_EXPAND_PADDING); bpm_frame.add (vspacer1); - note_frame.add (vspacer2); if (movable) { snprintf (buf, sizeof (buf), "%" PRIu32, when.bars); @@ -139,35 +138,40 @@ TempoDialog::init (const BBT_Time& when, double bpm, double note_type, bool mova when_table.set_homogeneous (true); when_table.set_row_spacings (2); when_table.set_col_spacings (2); - when_table.set_border_width (5); + when_table.set_border_width (6); - when_table.attach (when_bar_label, 0, 1, 0, 1, Gtk::AttachOptions(0), Gtk::FILL|Gtk::EXPAND); - when_table.attach (when_bar_entry, 0, 1, 1, 2, Gtk::AttachOptions(0), Gtk::FILL|Gtk::EXPAND); + when_table.attach (when_bar_label, 0, 1, 0, 1, AttachOptions(0), FILL|EXPAND); + when_table.attach (when_bar_entry, 1, 2, 0, 1, AttachOptions(0), FILL|EXPAND); - when_table.attach (when_beat_label, 1, 2, 0, 1, Gtk::AttachOptions(0), Gtk::AttachOptions(0)); - when_table.attach (when_beat_entry, 1, 2, 1, 2, Gtk::AttachOptions(0), Gtk::AttachOptions(0)); + when_table.attach (when_beat_label, 0, 1, 1, 2, AttachOptions(0), AttachOptions(0)); + when_table.attach (when_beat_entry, 1, 2, 1, 2, AttachOptions(0), AttachOptions(0)); + HBox* when_hbox = manage (new HBox()); + Label* when_label = manage(new Label(_("Tempo Begins at:"), ALIGN_LEFT, ALIGN_TOP)); + when_hbox->pack_end(when_table, PACK_EXPAND_PADDING, 6); + when_hbox->pack_start(*when_label, PACK_EXPAND_PADDING, 6); + when_frame.set_name ("MetricDialogFrame"); - when_frame.add (when_table); + when_frame.add (*when_hbox); + + get_vbox()->pack_end (when_frame, false, false); + when_frame.show_all(); - get_vbox()->pack_start (when_frame, false, false); } bpm_frame.set_name ("MetricDialogFrame"); bpm_spinner.set_name ("MetricEntry"); - note_frame.set_name ("MetricDialogFrame"); get_vbox()->set_border_width (12); - get_vbox()->pack_start (bpm_frame, false, false); - get_vbox()->pack_start (note_frame, false, false); + get_vbox()->pack_end (bpm_frame, false, false); add_button (Stock::CANCEL, RESPONSE_CANCEL); add_button (Stock::APPLY, RESPONSE_ACCEPT); - set_response_sensitive (Gtk::RESPONSE_ACCEPT, false); + set_response_sensitive (RESPONSE_ACCEPT, false); set_default_response (RESPONSE_ACCEPT); - get_vbox()->show_all(); - bpm_spinner.show(); + bpm_frame.show_all (); + bpm_spinner.show (); set_name ("MetricDialog"); @@ -188,7 +192,7 @@ TempoDialog::bpm_button_release (GdkEventButton* ev) { /* the value has been modified, accept should work now */ - set_response_sensitive (Gtk::RESPONSE_ACCEPT, true); + set_response_sensitive (RESPONSE_ACCEPT, true); return false; } @@ -209,6 +213,8 @@ TempoDialog::get_bbt_time (BBT_Time& requested) return false; } + requested.ticks = 0; + return true; } @@ -244,18 +250,17 @@ TempoDialog::get_note_type () void TempoDialog::note_types_change () { - set_response_sensitive (Gtk::RESPONSE_ACCEPT, true); + set_response_sensitive (RESPONSE_ACCEPT, true); } MeterDialog::MeterDialog (TempoMap& map, nframes_t frame, const string & action) : ArdourDialog ("meter dialog"), - note_frame (_("Meter denominator")), - bpb_frame (_("Beats per bar")), + bpb_frame (_("Meter")), ok_button (action), cancel_button (_("Cancel")), - when_bar_label (_("Bar")), - when_beat_label (_("Beat")), + when_bar_label (_("Bar"), ALIGN_LEFT, ALIGN_CENTER), + when_beat_label (_("Beat"), ALIGN_LEFT, ALIGN_CENTER), when_frame (_("Location")) { BBT_Time when; @@ -268,12 +273,11 @@ MeterDialog::MeterDialog (TempoMap& map, nframes_t frame, const string & action) MeterDialog::MeterDialog (MeterSection& section, const string & action) : ArdourDialog ("meter dialog"), - note_frame (_("Meter denominator")), - bpb_frame (_("Beats per bar")), + bpb_frame (_("Meter")), ok_button (action), cancel_button (_("Cancel")), - when_bar_label (_("Bar")), - when_beat_label (_("Beat")), + when_bar_label (_("Bar"), ALIGN_LEFT, ALIGN_CENTER), + when_beat_label (_("Beat"), ALIGN_LEFT, ALIGN_CENTER), when_frame (_("Location")) { init (section.start(), section.beats_per_bar(), section.note_divisor(), section.movable()); @@ -320,19 +324,16 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova note_types.set_active_text (_("thirty-second (32)")); else note_types.set_active_text (_("quarter (4)")); - - hspacer1.set_border_width (5); - hspacer1.pack_start (note_types, false, false); - vspacer1.set_border_width (5); - vspacer1.pack_start (hspacer1, false, false); - hspacer2.set_border_width (5); - hspacer2.pack_start (bpb_entry, false, false); - vspacer2.set_border_width (5); - vspacer2.pack_start (hspacer2, false, false); + Label* note_label = manage(new Label(_("Note Value:"), ALIGN_LEFT, ALIGN_CENTER)); + Label* bpb_label = manage(new Label(_("Beats Per Bar:"), ALIGN_LEFT, ALIGN_CENTER)); + Table* bpb_table = manage (new Table(2, 2)); - note_frame.add (vspacer1); - bpb_frame.add (vspacer2); + bpb_table->attach (*bpb_label, 0, 1, 0, 1, FILL|EXPAND, FILL|EXPAND, 6, 6); + bpb_table->attach (bpb_entry, 1, 2, 0, 1, FILL|EXPAND, FILL|EXPAND, 6, 6); + bpb_table->attach (*note_label, 0, 1, 1, 2, FILL|EXPAND, FILL|EXPAND, 6, 6); + bpb_table->attach (note_types, 1, 2, 1, 2, FILL|EXPAND, SHRINK, 6, 6); + bpb_frame.add (*bpb_table); if (movable) { snprintf (buf, sizeof (buf), "%" PRIu32, when.bars); @@ -352,26 +353,29 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova when_table.set_homogeneous (true); when_table.set_row_spacings (2); when_table.set_col_spacings (2); - when_table.set_border_width (5); + when_table.set_border_width (6); - when_table.attach (when_bar_label, 0, 1, 0, 1, Gtk::AttachOptions(0), Gtk::FILL|Gtk::EXPAND); - when_table.attach (when_bar_entry, 0, 1, 1, 2, Gtk::AttachOptions(0), Gtk::FILL|Gtk::EXPAND); - - when_table.attach (when_beat_label, 1, 2, 0, 1, Gtk::AttachOptions(0), Gtk::AttachOptions(0)); - when_table.attach (when_beat_entry, 1, 2, 1, 2, Gtk::AttachOptions(0), Gtk::AttachOptions(0)); + when_table.attach (when_bar_label, 0, 1, 0, 1, AttachOptions(0), FILL|EXPAND); + when_table.attach (when_bar_entry, 1, 2, 0, 1, AttachOptions(0), FILL|EXPAND); + when_table.attach (when_beat_label, 0, 1, 1, 2, AttachOptions(0), AttachOptions(0)); + when_table.attach (when_beat_entry, 1, 2, 1, 2, AttachOptions(0), AttachOptions(0)); + + HBox* when_hbox = manage (new HBox()); + Label* when_label = manage(new Label(_("Meter Begins at:"), ALIGN_LEFT, ALIGN_TOP)); + when_hbox->pack_end(when_table, PACK_EXPAND_PADDING, 6); + when_hbox->pack_start(*when_label, PACK_EXPAND_PADDING, 6); + when_frame.set_name ("MetricDialogFrame"); - when_frame.add (when_table); + when_frame.add (*when_hbox); - get_vbox()->pack_start (when_frame, false, false); + get_vbox()->pack_end (when_frame, false, false); } get_vbox()->set_border_width (12); get_vbox()->pack_start (bpb_frame, false, false); - get_vbox()->pack_start (note_frame, false, false); - + bpb_frame.set_name ("MetricDialogFrame"); - note_frame.set_name ("MetricDialogFrame"); bpb_entry.set_name ("MetricEntry"); add_button (Stock::CANCEL, RESPONSE_CANCEL); @@ -380,7 +384,6 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova set_default_response (RESPONSE_ACCEPT); get_vbox()->show_all (); - bpb_entry.show (); set_name ("MetricDialog"); bpb_entry.signal_activate().connect (bind (mem_fun (*this, &MeterDialog::response), RESPONSE_ACCEPT)); @@ -393,48 +396,48 @@ bool MeterDialog::bpb_key_press (GdkEventKey* ev) { -switch (ev->keyval) { - - case GDK_0: - case GDK_1: - case GDK_2: - case GDK_3: - case GDK_4: - case GDK_5: - case GDK_6: - case GDK_7: - case GDK_8: - case GDK_9: - case GDK_KP_0: - case GDK_KP_1: - case GDK_KP_2: - case GDK_KP_3: - case GDK_KP_4: - case GDK_KP_5: - case GDK_KP_6: - case GDK_KP_7: - case GDK_KP_8: - case GDK_KP_9: - case GDK_period: - case GDK_comma: - case GDK_KP_Delete: - case GDK_KP_Enter: - case GDK_Delete: - case GDK_BackSpace: - case GDK_Escape: - case GDK_Return: - case GDK_Home: - case GDK_End: - case GDK_Left: - case GDK_Right: - case GDK_Num_Lock: - case GDK_Tab: - return FALSE; - default: - break; - } - - return TRUE; + switch (ev->keyval) { + + case GDK_0: + case GDK_1: + case GDK_2: + case GDK_3: + case GDK_4: + case GDK_5: + case GDK_6: + case GDK_7: + case GDK_8: + case GDK_9: + case GDK_KP_0: + case GDK_KP_1: + case GDK_KP_2: + case GDK_KP_3: + case GDK_KP_4: + case GDK_KP_5: + case GDK_KP_6: + case GDK_KP_7: + case GDK_KP_8: + case GDK_KP_9: + case GDK_period: + case GDK_comma: + case GDK_KP_Delete: + case GDK_KP_Enter: + case GDK_Delete: + case GDK_BackSpace: + case GDK_Escape: + case GDK_Return: + case GDK_Home: + case GDK_End: + case GDK_Left: + case GDK_Right: + case GDK_Num_Lock: + case GDK_Tab: + return FALSE; + default: + break; + } + + return TRUE; } bool @@ -451,7 +454,7 @@ MeterDialog::bpb_key_release (GdkEventKey* ev) void MeterDialog::note_types_change () { - set_response_sensitive (Gtk::RESPONSE_ACCEPT, true); + set_response_sensitive (RESPONSE_ACCEPT, true); } double @@ -497,7 +500,6 @@ MeterDialog::get_note_type () bool MeterDialog::get_bbt_time (BBT_Time& requested) { - requested.ticks = 0; if (sscanf (when_bar_entry.get_text().c_str(), "%" PRIu32, &requested.bars) != 1) { return false; @@ -507,5 +509,7 @@ MeterDialog::get_bbt_time (BBT_Time& requested) return false; } + requested.ticks = 0; + return true; } diff --git a/gtk2_ardour/tempo_dialog.h b/gtk2_ardour/tempo_dialog.h index 47baa0cd42..c2053644a1 100644 --- a/gtk2_ardour/tempo_dialog.h +++ b/gtk2_ardour/tempo_dialog.h @@ -37,74 +37,66 @@ struct TempoDialog : public ArdourDialog { - Gtk::ComboBoxText note_types; - vector<string> strings; - Gtk::Adjustment bpm_adjustment; - Gtk::SpinButton bpm_spinner; - Gtk::Frame bpm_frame; - Gtk::Frame note_frame; - Gtk::VBox vpacker; - Gtk::Button ok_button; - Gtk::Button cancel_button; - Gtk::HBox button_box; - Gtk::HBox hspacer1, hspacer2; - Gtk::VBox vspacer1, vspacer2; - Gtk::Entry when_bar_entry; - Gtk::Entry when_beat_entry; - Gtk::Label when_bar_label; - Gtk::Label when_beat_label; - Gtk::Table when_table; - Gtk::Frame when_frame; - char buf[64]; + Gtk::ComboBoxText note_types; + vector<string> strings; + Gtk::Adjustment bpm_adjustment; + Gtk::SpinButton bpm_spinner; + Gtk::Frame bpm_frame; + Gtk::Button ok_button; + Gtk::Button cancel_button; + Gtk::HBox hspacer1, hspacer2; + Gtk::VBox vspacer1; + Gtk::Entry when_bar_entry; + Gtk::Entry when_beat_entry; + Gtk::Label when_bar_label; + Gtk::Label when_beat_label; + Gtk::Table when_table; + Gtk::Frame when_frame; + char buf[64]; - TempoDialog (ARDOUR::TempoMap&, nframes_t, const string & action); - TempoDialog (ARDOUR::TempoSection&, const string & action); + TempoDialog (ARDOUR::TempoMap&, nframes_t, const string & action); + TempoDialog (ARDOUR::TempoSection&, const string & action); - double get_bpm (); - double get_note_type (); - bool get_bbt_time (ARDOUR::BBT_Time&); + double get_bpm (); + double get_note_type (); + bool get_bbt_time (ARDOUR::BBT_Time&); - private: - void init (const ARDOUR::BBT_Time& start, double, double, bool); - void bpm_changed (); - bool bpm_button_press (GdkEventButton* ); - bool bpm_button_release (GdkEventButton* ); - void note_types_change (); +private: + void init (const ARDOUR::BBT_Time& start, double, double, bool); + void bpm_changed (); + bool bpm_button_press (GdkEventButton* ); + bool bpm_button_release (GdkEventButton* ); + void note_types_change (); }; struct MeterDialog : public ArdourDialog { - Gtk::Entry bpb_entry; - Gtk::ComboBoxText note_types; - vector<string> strings; - Gtk::Frame note_frame; - Gtk::Frame bpb_frame; - Gtk::VBox vpacker; - Gtk::Button ok_button; - Gtk::Button cancel_button; - Gtk::HBox button_box; - Gtk::HBox hspacer1, hspacer2; - Gtk::VBox vspacer1, vspacer2; - Gtk::Entry when_bar_entry; - Gtk::Entry when_beat_entry; - Gtk::Label when_bar_label; - Gtk::Label when_beat_label; - Gtk::Table when_table; - Gtk::Frame when_frame; - char buf[64]; + Gtk::Entry bpb_entry; + Gtk::ComboBoxText note_types; + vector<string> strings; + Gtk::Frame bpb_frame; + Gtk::Button ok_button; + Gtk::Button cancel_button; + Gtk::Entry when_bar_entry; + Gtk::Entry when_beat_entry; + Gtk::Label when_bar_label; + Gtk::Label when_beat_label; + Gtk::Table when_table; + Gtk::Frame when_frame; + char buf[64]; - MeterDialog (ARDOUR::TempoMap&, nframes_t, const string & action); - MeterDialog (ARDOUR::MeterSection&, const string & action); + MeterDialog (ARDOUR::TempoMap&, nframes_t, const string & action); + MeterDialog (ARDOUR::MeterSection&, const string & action); - double get_bpb (); - double get_note_type (); - bool get_bbt_time (ARDOUR::BBT_Time&); + double get_bpb (); + double get_note_type (); + bool get_bbt_time (ARDOUR::BBT_Time&); - private: - void init (const ARDOUR::BBT_Time&, double, double, bool); - bool bpb_key_press (GdkEventKey* ); - bool bpb_key_release (GdkEventKey* ); - void note_types_change (); +private: + void init (const ARDOUR::BBT_Time&, double, double, bool); + bool bpb_key_press (GdkEventKey* ); + bool bpb_key_release (GdkEventKey* ); + void note_types_change (); }; #endif /* __ardour_gtk_tempo_dialog_h__ */ diff --git a/gtk2_ardour/theme_manager.cc b/gtk2_ardour/theme_manager.cc index f529405878..9968fa9ea0 100644 --- a/gtk2_ardour/theme_manager.cc +++ b/gtk2_ardour/theme_manager.cc @@ -50,7 +50,8 @@ sigc::signal<void,uint32_t> ColorChanged; ThemeManager::ThemeManager() : ArdourDialog ("ThemeManager"), dark_button ("Dark Theme"), - light_button ("Light Theme") + light_button ("Light Theme"), + reset_button ("Restore Defaults") { Gtkmm2ext::WindowTitle title (Glib::get_application_name ()); title += _("Theme Manager"); @@ -81,6 +82,7 @@ ThemeManager::ThemeManager() get_vbox()->set_homogeneous(false); get_vbox()->pack_start (theme_selection_hbox, PACK_SHRINK); + get_vbox()->pack_start (reset_button, PACK_SHRINK); get_vbox()->pack_start (scroller); color_display.signal_button_press_event().connect (mem_fun (*this, &ThemeManager::button_press_event), false); @@ -92,6 +94,7 @@ ThemeManager::ThemeManager() color_dialog.get_cancel_button()->signal_clicked().connect (bind (mem_fun (color_dialog, &Gtk::Dialog::response), RESPONSE_CANCEL)); dark_button.signal_toggled().connect (mem_fun (*this, &ThemeManager::on_dark_theme_button_toggled)); light_button.signal_toggled().connect (mem_fun (*this, &ThemeManager::on_light_theme_button_toggled)); + reset_button.signal_clicked().connect (mem_fun (*this, &ThemeManager::reset_canvas_colors)); set_size_request (-1, 400); setup_theme (); @@ -226,6 +229,8 @@ void ThemeManager::setup_theme () { int r, g, b, a; + color_list->clear(); + for (std::vector<UIConfigVariable<uint32_t> *>::iterator i = ARDOUR_UI::config()->canvas_colors.begin(); i != ARDOUR_UI::config()->canvas_colors.end(); i++) { TreeModel::Row row = *(color_list->append()); @@ -262,3 +267,10 @@ ThemeManager::setup_theme () load_rc_file(rcfile, false); } +void +ThemeManager::reset_canvas_colors() +{ + ARDOUR_UI::config()->load_defaults(); + setup_theme (); +} + diff --git a/gtk2_ardour/theme_manager.h b/gtk2_ardour/theme_manager.h index 7ac3111b2a..3419cf0768 100644 --- a/gtk2_ardour/theme_manager.h +++ b/gtk2_ardour/theme_manager.h @@ -25,6 +25,7 @@ #include <gtkmm/scrolledwindow.h> #include <gtkmm/colorselection.h> #include <gtkmm/radiobutton.h> +#include <gtkmm/button.h> #include <gtkmm/rc.h> #include "ardour_dialog.h" #include "ui_config.h" @@ -37,6 +38,7 @@ class ThemeManager : public ArdourDialog int save (std::string path); void setup_theme (); + void reset_canvas_colors(); void on_dark_theme_button_toggled (); void on_light_theme_button_toggled (); @@ -66,6 +68,7 @@ class ThemeManager : public ArdourDialog Gtk::HBox theme_selection_hbox; Gtk::RadioButton dark_button; Gtk::RadioButton light_button; + Gtk::Button reset_button; bool button_press_event (GdkEventButton*); }; diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index a9956f554e..a3262baec5 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -43,6 +43,7 @@ #include "public_editor.h" #include "time_axis_view.h" #include "simplerect.h" +#include "simpleline.h" #include "selection.h" #include "keyboard.h" #include "rgb_macros.h" @@ -1101,3 +1102,37 @@ TimeAxisView::covers_y_position (double y) return 0; } + +void +TimeAxisView::show_temporary_lines (const vector<nframes64_t>& pos) +{ + while (temp_lines.size()< pos.size()) { + ArdourCanvas::SimpleLine* l = new ArdourCanvas::SimpleLine (*canvas_display); + l->property_color_rgba() = (guint) ARDOUR_UI::config()->canvasvar_ZeroLine.get(); + l->property_y1() = 0; + l->property_y2() = height; + temp_lines.push_back (l); + } + + while (temp_lines.size() > pos.size()) { + ArdourCanvas::SimpleLine *line = temp_lines.back(); + temp_lines.pop_back (); + delete line; + } + + vector<nframes64_t>::const_iterator i; + list<ArdourCanvas::SimpleLine*>::iterator l; + + for (i = pos.begin(), l = temp_lines.begin(); i != pos.end() && l != temp_lines.end(); ++i, ++l) { + (*l)->property_x1() = editor.frame_to_pixel (*i); + (*l)->property_x2() = editor.frame_to_pixel (*i); + } +} + +void +TimeAxisView::hide_temporary_lines () +{ + for (list<ArdourCanvas::SimpleLine*>::iterator l = temp_lines.begin(); l != temp_lines.end(); ++l) { + (*l)->hide (); + } +} diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index 24c91e7ba4..f3bdbec706 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -172,6 +172,9 @@ class TimeAxisView : public virtual AxisView virtual ARDOUR::RouteGroup* edit_group() const { return 0; } virtual boost::shared_ptr<ARDOUR::Playlist> playlist() const { return boost::shared_ptr<ARDOUR::Playlist> (); } + virtual void show_temporary_lines (const std::vector<nframes64_t>&); + virtual void hide_temporary_lines (); + virtual void set_samples_per_unit (double); virtual void show_selection (TimeSelection&); virtual void hide_selection (); @@ -309,6 +312,8 @@ class TimeAxisView : public virtual AxisView void set_height_pixels (uint32_t h); void color_handler (); + list<ArdourCanvas::SimpleLine*> temp_lines; + }; /* class TimeAxisView */ #endif /* __ardour_gtk_time_axis_h__ */ diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc index 80cd612ee7..6ebedaa129 100644 --- a/gtk2_ardour/ui_config.cc +++ b/gtk2_ardour/ui_config.cc @@ -57,10 +57,39 @@ UIConfiguration::~UIConfiguration () } int +UIConfiguration::load_defaults () +{ + int found = 0; + sys::path default_ui_rc_file; + + if ( find_file_in_search_path (ardour_search_path() + system_config_search_path(), + "ardour3_ui_default.conf", default_ui_rc_file) ) + { + XMLTree tree; + found = 1; + + string rcfile = default_ui_rc_file.to_string(); + + cerr << string_compose (_("loading default ui configuration file %1"), rcfile) << endl; + + if (!tree.read (rcfile.c_str())) { + error << string_compose(_("Ardour: cannot read default ui configuration file \"%1\""), rcfile) << endmsg; + return -1; + } + + if (set_state (*tree.root())) { + error << string_compose(_("Ardour: default ui configuration file \"%1\" not loaded successfully."), rcfile) << endmsg; + return -1; + } + } + return found; +} + +int UIConfiguration::load_state () { bool found = false; - + sys::path default_ui_rc_file; if ( find_file_in_search_path (ardour_search_path() + system_config_search_path(), diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h index 6e7946b32b..5d4b72056d 100644 --- a/gtk2_ardour/ui_config.h +++ b/gtk2_ardour/ui_config.h @@ -108,6 +108,7 @@ class UIConfiguration : public PBD::Stateful int load_state (); int save_state (); + int load_defaults (); int set_state (const XMLNode&); XMLNode& get_state (void); |