summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-09-19 03:29:16 +0000
committerDavid Robillard <d@drobilla.net>2006-09-19 03:29:16 +0000
commit7bd41538d951c3e476655df741adfbebbb990bde (patch)
treef9988f959571c75535341ab1de463b7cfc5209e3 /gtk2_ardour
parentc7307c09b8584b15610f0b29a40f839d9183419a (diff)
Merged with trunk R920.
git-svn-id: svn://localhost/ardour2/branches/midi@921 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/actions.cc8
-rwxr-xr-xgtk2_ardour/ardev2
-rw-r--r--gtk2_ardour/ardour.menus24
-rw-r--r--gtk2_ardour/ardour_ui.cc144
-rw-r--r--gtk2_ardour/ardour_ui_dependents.cc4
-rw-r--r--gtk2_ardour/ardour_ui_dialogs.cc4
-rw-r--r--gtk2_ardour/ardour_ui_options.cc2
-rw-r--r--gtk2_ardour/audio_streamview.cc23
-rw-r--r--gtk2_ardour/automation_line.h3
-rw-r--r--gtk2_ardour/canvas-simplerect.c54
-rw-r--r--gtk2_ardour/editing_syms.h9
-rw-r--r--gtk2_ardour/editor.cc129
-rw-r--r--gtk2_ardour/editor.h23
-rw-r--r--gtk2_ardour/editor_actions.cc171
-rw-r--r--gtk2_ardour/editor_audio_import.cc2
-rw-r--r--gtk2_ardour/editor_canvas.cc56
-rw-r--r--gtk2_ardour/editor_export_audio.cc4
-rw-r--r--gtk2_ardour/editor_ops.cc16
-rw-r--r--gtk2_ardour/editor_rulers.cc166
-rw-r--r--gtk2_ardour/editor_tempodisplay.cc126
-rw-r--r--gtk2_ardour/midi_streamview.cc13
-rw-r--r--gtk2_ardour/new_session_dialog.cc8
-rw-r--r--gtk2_ardour/option_editor.cc57
-rw-r--r--gtk2_ardour/option_editor.h2
-rw-r--r--gtk2_ardour/region_gain_line.h4
-rw-r--r--gtk2_ardour/route_time_axis.cc51
-rw-r--r--gtk2_ardour/route_time_axis.h3
-rw-r--r--gtk2_ardour/route_ui.cc14
-rw-r--r--gtk2_ardour/route_ui.h10
-rw-r--r--gtk2_ardour/sfdb_ui.cc19
-rw-r--r--gtk2_ardour/streamview.cc3
-rw-r--r--gtk2_ardour/streamview.h2
32 files changed, 704 insertions, 452 deletions
diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc
index 2197d4dc00..b2408620a5 100644
--- a/gtk2_ardour/actions.cc
+++ b/gtk2_ardour/actions.cc
@@ -73,13 +73,13 @@ ActionManager::init ()
ui_manager->add_ui_from_file (ui_file);
loaded = true;
} catch (Glib::MarkupError& err) {
- error << "badly formatted UI definition file" << endmsg;
+ error << _("badly formatted UI definition file") << endmsg;
} catch (...) {
- error << "Ardour menu definition file not found" << endmsg;
+ error << _("Ardour menu definition file not found") << endmsg;
}
if (!loaded) {
- error << "ardour will not work without a valid ardour.menus file" << endmsg;
+ error << _("ardour will not work without a valid ardour.menus file") << endmsg;
exit(1);
}
}
@@ -277,7 +277,7 @@ ActionManager::uncheck_toggleaction (const char * name)
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
tact->set_active (false);
} else {
- error << "Unknown action name: " << name << endmsg;
+ error << string_compose (_("Unknown action name: %1"), name) << endmsg;
}
delete [] group_name;
diff --git a/gtk2_ardour/ardev b/gtk2_ardour/ardev
index 751557d634..d3d44e55fe 100755
--- a/gtk2_ardour/ardev
+++ b/gtk2_ardour/ardev
@@ -1,3 +1,3 @@
#!/bin/sh
source `dirname "$0"`/ardev_common.sh
-exec gtk2_ardour/ardour.bin --novst "$*"
+exec gtk2_ardour/ardour.bin --novst $*
diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus
index 0f1f741c30..d213b4a53c 100644
--- a/gtk2_ardour/ardour.menus
+++ b/gtk2_ardour/ardour.menus
@@ -214,6 +214,30 @@
<menuitem action='FileHeaderFormatCAF'/>
</menu>
</menu>
+ <menu action='SMPTE'>
+ <menuitem action='Smpte23976'/>
+ <menuitem action='Smpte24'/>
+ <menuitem action='Smpte24976'/>
+ <menuitem action='Smpte25'/>
+ <menuitem action='Smpte2997drop'/>
+ <menuitem action='Smpte2997'/>
+ <menuitem action='Smpte30drop'/>
+ <menuitem action='Smpte30'/>
+ <menuitem action='Smpte5994'/>
+ <menuitem action='Smpte60'/>
+ </menu>
+ <menu action='Pullup'>
+ <menuitem action='PullupPlus4Plus1'/>
+ <menuitem action='PullupPlus4'/>
+ <menuitem action='PullupPlus4Minus1'/>
+ <menuitem action='PullupPlus1'/>
+ <menuitem action='PullupNone'/>
+ <menuitem action='PullupMinus1'/>
+ <menuitem action='PullupMinus4Plus1'/>
+ <menuitem action='PullupMinus4'/>
+ <menuitem action='PullupMinus4Minus1'/>
+ </menu>
+ <separator/>
<menu action='Autoconnect'>
<menuitem action='AutoConnectNewTrackInputsToHardware'/>
<separator/>
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index dae6c9f751..f0848e6f89 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -1651,6 +1651,9 @@ ARDOUR_UI::save_template ()
void
ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
{
+ string session_name;
+ string session_path;
+
int response = Gtk::RESPONSE_NONE;
new_session_dialog->set_modal(true);
@@ -1672,14 +1675,28 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
new_session_dialog->reset();
} else if (response == Gtk::RESPONSE_YES) {
- /* YES == OPEN, but there's no enum for that */
- std::string session_name = new_session_dialog->session_name();
- std::string session_path = new_session_dialog->session_folder();
- load_session (session_path, session_name);
+ /* YES == OPEN, but there's no enum for that */
+ session_name = new_session_dialog->session_name();
+
+ if (session_name.empty()) {
+ response = Gtk::RESPONSE_NONE;
+ cerr << "session name is empty\n";
+ continue;
+ }
+
+ if (session_name[0] == '/' ||
+ (session_name.length() > 2 && session_name[0] == '.' && session_name[1] == '/') ||
+ (session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == '/')) {
+ load_session (Glib::path_get_dirname (session_name), session_name);
+ } else {
+ session_path = new_session_dialog->session_folder();
+ load_session (session_path, session_name);
+ }
} else if (response == Gtk::RESPONSE_OK) {
+
if (new_session_dialog->get_current_page() == 1) {
/* XXX this is a bit of a hack..
@@ -1687,93 +1704,121 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
if we're on page 1 (the load page)
Unfortunately i can't see how atm..
*/
-
- std::string session_name = new_session_dialog->session_name();
- std::string session_path = new_session_dialog->session_folder();
- load_session (session_path, session_name);
-
+
+ if (session_name.empty()) {
+ response = Gtk::RESPONSE_NONE;
+ cerr << "session name is empty 2\n";
+ continue;
+ }
+
+ if (session_name[0] == '/' ||
+ (session_name.length() > 2 && session_name[0] == '.' && session_name[1] == '/') ||
+ (session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == '/')) {
+ load_session (Glib::path_get_dirname (session_name), session_name);
+ } else {
+ session_path = new_session_dialog->session_folder();
+ load_session (session_path, session_name);
+ }
+
} else {
_session_is_new = true;
- std::string session_name = new_session_dialog->session_name();
- std::string session_path = new_session_dialog->session_folder();
+ session_name = new_session_dialog->session_name();
+ if (session_name.empty()) {
+ response = Gtk::RESPONSE_NONE;
+ cerr << "session name is empty 3\n";
+ continue;
+ }
+
+ if (session_name[0] == '/' ||
+ (session_name.length() > 2 && session_name[0] == '.' && session_name[1] == '/') ||
+ (session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == '/')) {
+
+ session_path = Glib::path_get_dirname (session_name);
+ session_name = Glib::path_get_basename (session_name);
+
+ } else {
+
+ std::string session_path = new_session_dialog->session_folder();
+
+ }
//XXX This is needed because session constructor wants a
//non-existant path. hopefully this will be fixed at some point.
-
- session_path = Glib::build_filename(session_path, session_name);
-
+
+ session_path = Glib::build_filename (session_path, session_name);
+
std::string template_name = new_session_dialog->session_template_name();
-
+
if (new_session_dialog->use_session_template()) {
-
- load_session (session_path, session_name, &template_name);
+
+ load_session (session_path, session_name, &template_name);
} else {
-
- uint32_t cchns;
+
+ uint32_t cchns;
uint32_t mchns;
Session::AutoConnectOption iconnect;
Session::AutoConnectOption oconnect;
-
+
if (new_session_dialog->create_control_bus()) {
- cchns = (uint32_t) new_session_dialog->control_channel_count();
+ cchns = (uint32_t) new_session_dialog->control_channel_count();
} else {
- cchns = 0;
+ cchns = 0;
}
-
+
if (new_session_dialog->create_master_bus()) {
- mchns = (uint32_t) new_session_dialog->master_channel_count();
+ mchns = (uint32_t) new_session_dialog->master_channel_count();
} else {
- mchns = 0;
+ mchns = 0;
}
-
+
if (new_session_dialog->connect_inputs()) {
- iconnect = Session::AutoConnectPhysical;
+ iconnect = Session::AutoConnectPhysical;
} else {
- iconnect = Session::AutoConnectOption (0);
+ iconnect = Session::AutoConnectOption (0);
}
-
+
/// @todo some minor tweaks.
-
+
if (new_session_dialog->connect_outs_to_master()) {
- oconnect = Session::AutoConnectMaster;
+ oconnect = Session::AutoConnectMaster;
} else if (new_session_dialog->connect_outs_to_physical()) {
- oconnect = Session::AutoConnectPhysical;
+ oconnect = Session::AutoConnectPhysical;
} else {
- oconnect = Session::AutoConnectOption (0);
+ oconnect = Session::AutoConnectOption (0);
}
-
+
uint32_t nphysin = (uint32_t) new_session_dialog->input_limit_count();
uint32_t nphysout = (uint32_t) new_session_dialog->output_limit_count();
-
+
build_session (session_path,
- session_name,
- cchns,
- mchns,
- iconnect,
- oconnect,
- nphysin,
- nphysout,
- engine->frame_rate() * 60 * 5);
+ session_name,
+ cchns,
+ mchns,
+ iconnect,
+ oconnect,
+ nphysin,
+ nphysout,
+ engine->frame_rate() * 60 * 5);
}
- }
+ }
}
} while (response == Gtk::RESPONSE_NONE);
+
show();
new_session_dialog->get_window()->set_cursor();
-
new_session_dialog->hide();
}
void
ARDOUR_UI::close_session()
{
- unload_session();
- new_session ();
+ unload_session();
+ new_session ();
}
int
@@ -1873,6 +1918,11 @@ ARDOUR_UI::show ()
{
if (editor) {
editor->show_window ();
+
+ if (!shown_flag) {
+ editor->present ();
+ }
+
shown_flag = true;
}
diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc
index 0603fc6baa..bf096f86c1 100644
--- a/gtk2_ardour/ardour_ui_dependents.cc
+++ b/gtk2_ardour/ardour_ui_dependents.cc
@@ -79,6 +79,10 @@ ARDOUR_UI::connect_dependents_to_session (ARDOUR::Session *s)
{
editor->connect_to_session (s);
mixer->connect_to_session (s);
+
+ /* its safe to do this now */
+
+ s->restore_history (s->snap_name());
}
void
diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc
index c90480c1dd..fe5963c535 100644
--- a/gtk2_ardour/ardour_ui_dialogs.cc
+++ b/gtk2_ardour/ardour_ui_dialogs.cc
@@ -131,10 +131,6 @@ ARDOUR_UI::connect_to_session (Session *s)
start_clocking ();
start_blinking ();
- if (editor) {
- editor->present();
- }
-
transport_stopped ();
second_connection = Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::every_second), 1000);
diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc
index 205180a344..21afbcde21 100644
--- a/gtk2_ardour/ardour_ui_options.cc
+++ b/gtk2_ardour/ardour_ui_options.cc
@@ -463,6 +463,7 @@ ARDOUR_UI::setup_session_options ()
session_control_changed (Session::AutoReturn);
session_control_changed (Session::AutoInput);
session_control_changed (Session::Clicking);
+ session_control_changed (Session::SmpteMode);
session->ControlChanged.connect (mem_fun (*this, &ARDOUR_UI::queue_session_control_changed));
}
@@ -555,7 +556,6 @@ ARDOUR_UI::session_control_changed (Session::ControlType t)
case Session::CrossfadingModel:
break;
-
case Session::AutoPlay:
map_some_session_state ("Transport", "ToggleAutoPlay", &Session::get_auto_play);
break;
diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc
index 2b9cd23567..85ba517f8e 100644
--- a/gtk2_ardour/audio_streamview.cc
+++ b/gtk2_ardour/audio_streamview.cc
@@ -68,6 +68,7 @@ AudioStreamView::AudioStreamView (AudioTimeAxisView& tv)
_amplitude_above_axis = 1.0;
use_rec_regions = tv.editor.show_waveforms_recording ();
+
}
AudioStreamView::~AudioStreamView ()
@@ -215,9 +216,7 @@ AudioStreamView::playlist_modified ()
StreamView::playlist_modified();
- /* if the playlist is modified, make sure xfades are on top and all the regionviews are stacked
- correctly.
- */
+ /* make sure xfades are on top and all the regionviews are stacked correctly. */
for (list<CrossfadeView *>::iterator i = crossfade_views.begin(); i != crossfade_views.end(); ++i) {
(*i)->get_canvas_group()->raise_to_top();
@@ -419,10 +418,11 @@ AudioStreamView::setup_rec_box ()
boost::shared_ptr<AudioRegion> region (boost::dynamic_pointer_cast<AudioRegion>
(RegionFactory::create (sources, start, 1 , "", 0, (Region::Flag)(Region::DefaultFlags | Region::DoNotSaveState), false)));
+ assert(region);
region->set_position (_trackview.session().transport_frame(), this);
rec_regions.push_back (region);
- /* catch it if it goes away */
- region->GoingAway.connect (bind (mem_fun (*this, &AudioStreamView::remove_rec_region), region));
+
+ // rec regions are destroyed in setup_rec_box
/* we add the region later */
}
@@ -504,6 +504,14 @@ AudioStreamView::setup_rec_box ()
/* remove temp regions */
+ for (list<boost::shared_ptr<Region> >::iterator iter = rec_regions.begin(); iter != rec_regions.end();) {
+ list<boost::shared_ptr<Region> >::iterator tmp;
+ tmp = iter;
+ ++tmp;
+ (*iter)->drop_references ();
+ iter = tmp;
+ }
+
rec_regions.clear();
// cerr << "\tclear " << rec_rects.size() << " rec rects\n";
@@ -567,9 +575,10 @@ AudioStreamView::update_rec_regions ()
continue;
}
- // FIXME
boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion>(*iter);
- assert(region);
+ if (!region) {
+ continue;
+ }
jack_nframes_t origlen = region->length();
diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h
index f8262d2a2d..8311025b02 100644
--- a/gtk2_ardour/automation_line.h
+++ b/gtk2_ardour/automation_line.h
@@ -163,9 +163,8 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible
XMLNode& get_state (void);
int set_state (const XMLNode&);
- PBD::ID id() { return _id; }
protected:
- PBD::ID _id;
+
string _name;
guint32 _height;
uint32_t _line_color;
diff --git a/gtk2_ardour/canvas-simplerect.c b/gtk2_ardour/canvas-simplerect.c
index abddf5756b..d59096e68b 100644
--- a/gtk2_ardour/canvas-simplerect.c
+++ b/gtk2_ardour/canvas-simplerect.c
@@ -263,7 +263,7 @@ gnome_canvas_simplerect_reset_bounds (GnomeCanvasItem *item)
GnomeCanvasSimpleRect* simplerect;
double x1, x2, y1, y2;
double old_x1, old_x2, old_y1, old_y2;
- double a, b;
+ double a, b, c, d;
old_x1 = item->x1;
old_y1 = item->y1;
@@ -287,42 +287,24 @@ gnome_canvas_simplerect_reset_bounds (GnomeCanvasItem *item)
gnome_canvas_w2c (GNOME_CANVAS(item->canvas), x2, y2, &simplerect->bbox_lrx, &simplerect->bbox_lry);
/* now queue redraws for changed areas */
-
- if (item->x1 != old_x1) {
-
- /* left edge changed. redraw the area that altered */
a = MIN(item->x1, old_x1);
b = MAX(item->x1, old_x1);
- gnome_canvas_request_redraw (item->canvas, a - 1, item->y1, b + 1, item->y2);
- }
-
- if (item->x2 != old_x2) {
-
- /* right edge changed. redraw the area that altered */
-
- a = MIN(item->x2, old_x2);
- b = MAX(item->x2, old_x2);
- gnome_canvas_request_redraw (item->canvas, a - 1, item->y1, b + 1, item->y2);
- }
-
- if (item->y1 != old_y1) {
-
- /* top edge changed. redraw the area that altered */
-
- a = MIN(item->y1, old_y1);
- b = MAX(item->y1, old_y1);
- gnome_canvas_request_redraw (item->canvas, item->x1, a - 1, item->x2, b + 1);
- }
-
- if (item->y2 != old_y2) {
-
- /* lower edge changed. redraw the area that altered */
-
- a = MIN(item->y2, old_y2);
- b = MAX(item->y2, old_y2);
- gnome_canvas_request_redraw (item->canvas, item->x1, a - 1, item->x2, b + 1);
- }
+
+ a = MIN(a, item->x2);
+ a = MIN(a, old_x2);
+ b = MAX(b, item->x2);
+ b = MAX(b, old_x2);
+
+ c = MIN(item->y1, old_y1);
+ d = MAX(item->y1, old_y1);
+
+ c = MIN(c,item->y2);
+ c = MIN(c, old_y2);
+ d = MAX(d,item->y2);
+ d = MAX(d, old_y2);
+
+ gnome_canvas_request_redraw (item->canvas, a, c, b + 0.5, d + 0.5);
}
/*
@@ -494,8 +476,8 @@ gnome_canvas_simplerect_update (GnomeCanvasItem *item, double *affine, ArtSVP *c
gnome_canvas_request_redraw (item->canvas,
simplerect->bbox_ulx,
simplerect->bbox_uly,
- simplerect->bbox_lrx+1,
- simplerect->bbox_lry+1);
+ simplerect->bbox_lrx+0.5,
+ simplerect->bbox_lry+0.5);
simplerect->full_draw_on_update = FALSE;
}
diff --git a/gtk2_ardour/editing_syms.h b/gtk2_ardour/editing_syms.h
index 654ddc8852..3a503e2cb5 100644
--- a/gtk2_ardour/editing_syms.h
+++ b/gtk2_ardour/editing_syms.h
@@ -54,7 +54,8 @@ DISPLAYCONTROL(ShowMeasures)
DISPLAYCONTROL(ShowWaveforms)
DISPLAYCONTROL(ShowWaveformsRecording)
-IMPORTMODE(ImportAsRegion)
-IMPORTMODE(ImportAsTrack)
-IMPORTMODE(ImportAsTapeTrack)
-IMPORTMODE(ImportToTrack)
+// if this is changed, remember to update the string table in sfdb_ui.cc
+IMPORTMODE(ImportAsRegion=0)
+IMPORTMODE(ImportToTrack=1)
+IMPORTMODE(ImportAsTrack=2)
+IMPORTMODE(ImportAsTapeTrack=3)
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 933db72bab..0fc9810c70 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -643,7 +643,7 @@ Editor::Editor (AudioEngine& eng)
edit_pane.pack1 (edit_packer, true, true);
edit_pane.pack2 (the_notebook, false, true);
- edit_pane.signal_size_allocate().connect_notify (bind (mem_fun(*this, &Editor::pane_allocation_handler), static_cast<Paned*> (&edit_pane)));
+ edit_pane.signal_size_allocate().connect (bind (mem_fun(*this, &Editor::pane_allocation_handler), static_cast<Paned*> (&edit_pane)));
top_hbox.pack_start (toolbar_frame, true, true);
@@ -700,6 +700,7 @@ Editor::Editor (AudioEngine& eng)
ControlProtocol::ZoomIn.connect (bind (mem_fun (*this, &Editor::temporal_zoom_step), false));
ControlProtocol::ZoomOut.connect (bind (mem_fun (*this, &Editor::temporal_zoom_step), true));
ControlProtocol::ScrollTimeline.connect (mem_fun (*this, &Editor::control_scroll));
+
constructed = true;
instant_save ();
@@ -882,6 +883,9 @@ Editor::reposition_x_origin (jack_nframes_t frame)
}
horizontal_adjustment.set_value (frame/frames_per_unit);
+ } else {
+ update_fixed_rulers();
+ tempo_map_changed (Change (0));
}
}
@@ -965,20 +969,10 @@ void
Editor::canvas_horizontally_scrolled ()
{
- Glib::signal_idle().connect (mem_fun(*this, &Editor::lazy_canvas_horizontally_scrolled));
-
-}
-
-bool
-Editor::lazy_canvas_horizontally_scrolled ()
-{
-
- leftmost_frame = (jack_nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
-
+ leftmost_frame = (jack_nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
update_fixed_rulers ();
tempo_map_changed (Change (0));
- return false;
}
void
@@ -996,7 +990,6 @@ Editor::deferred_reposition_and_zoom (jack_nframes_t frame, double nfpu)
set_frames_per_unit (nfpu);
reposition_x_origin (frame);
-
repos_zoom_queued = false;
return FALSE;
@@ -1033,6 +1026,10 @@ Editor::session_control_changed (Session::ControlType t)
update_layering_model ();
break;
+ case Session::SmpteMode:
+ update_smpte_mode ();
+ break;
+
default:
break;
}
@@ -1179,6 +1176,9 @@ Editor::connect_to_session (Session *t)
session_connections.push_back (session->SMPTEOffsetChanged.connect (mem_fun(*this, &Editor::update_just_smpte)));
session_connections.push_back (session->SMPTETypeChanged.connect (mem_fun(*this, &Editor::update_just_smpte)));
+ session_connections.push_back (session->SMPTETypeChanged.connect (mem_fun(*this, &Editor::update_smpte_mode)));
+ session_connections.push_back (session->PullupChanged.connect (mem_fun(*this, &Editor::update_video_pullup)));
+
session_connections.push_back (session->tempo_map().StateChanged.connect (mem_fun(*this, &Editor::tempo_map_changed)));
edit_groups_changed ();
@@ -1266,9 +1266,12 @@ Editor::connect_to_session (Session *t)
}
/* xfade visibility state set from editor::set_state() */
-
- update_crossfade_model ();
- update_layering_model ();
+
+ update_crossfade_model();
+ update_layering_model();
+
+ update_smpte_mode();
+ update_video_pullup();
handle_new_duration ();
@@ -1292,7 +1295,7 @@ Editor::connect_to_session (Session *t)
horizontal_adjustment.set_value (0);
restore_ruler_visibility ();
- tempo_map_changed (Change (0));
+ //tempo_map_changed (Change (0));
session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
edit_cursor->set_position (0);
@@ -1328,6 +1331,7 @@ Editor::connect_to_session (Session *t)
}
/* register for undo history */
+
session->register_with_memento_command_factory(_id, this);
}
@@ -2110,6 +2114,9 @@ Editor::set_state (const XMLNode& node)
int x, y, xoff, yoff;
Gdk::Geometry g;
+ if ((prop = node.property ("id")) != 0) {
+ _id = prop->value ();
+ }
if ((geometry = find_named_node (node, "geometry")) == 0) {
@@ -2241,6 +2248,9 @@ Editor::get_state ()
XMLNode* node = new XMLNode ("Editor");
char buf[32];
+ _id.print (buf);
+ node->add_property ("id", buf);
+
if (is_realized()) {
Glib::RefPtr<Gdk::Window> win = get_window();
@@ -2250,7 +2260,7 @@ Editor::get_state ()
win->get_size(width, height);
XMLNode* geometry = new XMLNode ("geometry");
- char buf[32];
+
snprintf(buf, sizeof(buf), "%d", width);
geometry->add_property("x_size", string(buf));
snprintf(buf, sizeof(buf), "%d", height);
@@ -4085,6 +4095,7 @@ Editor::restore_editing_space ()
{
mouse_mode_tearoff->set_visible (true);
tools_tearoff->set_visible (true);
+
edit_pane.set_position (pre_maximal_pane_position);
unfullscreen();
@@ -4139,6 +4150,87 @@ Editor::on_key_press_event (GdkEventKey* ev)
}
void
+Editor::update_smpte_mode ()
+{
+ ENSURE_GUI_THREAD(mem_fun(*this, &Editor::update_smpte_mode));
+
+ RefPtr<Action> act;
+
+ float frames = session->smpte_frames_per_second;
+ bool drop = session->smpte_drop_frames;
+
+ if ((frames < 23.976 * 1.0005) && !drop)
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte23976"));
+ else if ((frames < 24 * 1.0005) && !drop)
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte24"));
+ else if ((frames < 24.976 * 1.0005) && !drop)
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte24976"));
+ else if ((frames < 25 * 1.0005) && !drop)
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte25"));
+ else if ((frames < 29.97 * 1.0005) && !drop)
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte2997"));
+ else if ((frames < 29.97 * 1.0005) && drop)
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte2997drop"));
+ else if ((frames < 30 * 1.0005) && !drop)
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte30"));
+ else if ((frames < 30 * 1.0005) && drop)
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte30drop"));
+ else if ((frames < 59.94 * 1.0005) && !drop)
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte5994"));
+ else if ((frames < 60 * 1.0005) && !drop)
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte60"));
+ else
+ cerr << "Unexpected SMPTE value (" << frames << (drop ? "drop" : "") << ") in update_smpte_mode. Menu is probably wrong\n" << endl;
+
+
+ if (act) {
+ RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
+ if (ract && !ract->get_active()) {
+ ract->set_active (true);
+ }
+ }
+}
+
+void
+Editor::update_video_pullup ()
+{
+ ENSURE_GUI_THREAD (mem_fun(*this, &Editor::update_video_pullup));
+
+ RefPtr<Action> act;
+
+ float pullup = session->video_pullup;
+
+ if ( pullup < (-4.1667 - 0.1) * 0.99) {
+ act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4Minus1"));
+ } else if ( pullup < (-4.1667) * 0.99 ) {
+ act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4"));
+ } else if ( pullup < (-4.1667 + 0.1) * 0.99 ) {
+ act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4Plus1"));
+ } else if ( pullup < (-0.1) * 0.99 ) {
+ act = ActionManager::get_action (X_("Editor"), X_("PullupMinus1"));
+ } else if (pullup > (4.1667 + 0.1) * 0.99 ) {
+ act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4Plus1"));
+ } else if ( pullup > (4.1667) * 0.99 ) {
+ act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4"));
+ } else if ( pullup > (4.1667 - 0.1) * 0.99) {
+ act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4Minus1"));
+ } else if ( pullup > (0.1) * 0.99 ) {
+ act = ActionManager::get_action (X_("Editor"), X_("PullupPlus1"));
+ } else
+ act = ActionManager::get_action (X_("Editor"), X_("PullupNone"));
+
+
+ if (act) {
+ RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
+ if (ract && !ract->get_active()) {
+ ract->set_active (true);
+ }
+ }
+
+}
+
+
+void
Editor::update_layering_model ()
{
RefPtr<Action> act;
@@ -4163,7 +4255,6 @@ Editor::update_layering_model ()
}
}
-
void
Editor::update_crossfade_model ()
{
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 239bd6307d..fe5d47df0c 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -143,8 +143,6 @@ class Editor : public PublicEditor
XMLNode& get_state ();
int set_state (const XMLNode& );
- PBD::ID id() { return _id; }
-
void set_mouse_mode (Editing::MouseMode, bool force=true);
void step_mouse_mode (bool next);
Editing::MouseMode current_mouse_mode () { return mouse_mode; }
@@ -231,6 +229,7 @@ class Editor : public PublicEditor
void set_show_measures (bool yn);
bool show_measures () const { return _show_measures; }
+ bool initial_ruler_update_required;
#ifdef FFT_ANALYSIS
/* analysis window */
@@ -302,6 +301,14 @@ class Editor : public PublicEditor
void set_meter_falloff (int);
void set_meter_hold (int32_t);
+ /* SMPTE timecode & video sync */
+
+ void smpte_fps_chosen (ARDOUR::Session::SmpteFormat format);
+ void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
+
+ void update_smpte_mode();
+ void update_video_pullup();
+
/* xfades */
void toggle_auto_xfade ();
@@ -311,8 +318,8 @@ class Editor : public PublicEditor
void update_crossfade_model ();
void set_crossfade_model (ARDOUR::CrossfadeModel);
- /* layers */
+ /* layers */
void set_layer_model (ARDOUR::Session::LayerModel);
void update_layering_model ();
@@ -349,8 +356,6 @@ class Editor : public PublicEditor
ARDOUR::AudioEngine& engine;
bool constructed;
- PBD::ID _id;
-
PlaylistSelector* _playlist_selector;
void set_frames_per_unit (double);
@@ -683,7 +688,7 @@ class Editor : public PublicEditor
void tie_vertical_scrolling ();
void canvas_horizontally_scrolled ();
- bool lazy_canvas_horizontally_scrolled ();
+
void reposition_and_zoom (jack_nframes_t sample, double fpu);
gint deferred_reposition_and_zoom (jack_nframes_t sample, double fpu);
void end_location_changed (ARDOUR::Location*);
@@ -1185,8 +1190,6 @@ class Editor : public PublicEditor
bool _follow_playhead;
bool _show_waveforms_recording;
- void add_bbt_marks (ARDOUR::TempoMap::BBTPointList&);
-
ARDOUR::TempoMap::BBTPointList *current_bbt_points;
typedef vector<ArdourCanvas::SimpleLine*> TimeLineList;
@@ -1197,7 +1200,7 @@ class Editor : public PublicEditor
ArdourCanvas::SimpleLine* get_time_line ();
void hide_measures ();
void draw_measures ();
- void draw_time_bars ();
+ bool lazy_hide_and_draw_measures ();
void new_tempo_section ();
@@ -1506,7 +1509,7 @@ class Editor : public PublicEditor
jack_nframes_t autoscroll_distance;
static gint _autoscroll_canvas (void *);
- gint autoscroll_canvas ();
+ bool autoscroll_canvas ();
void start_canvas_autoscroll (int direction);
void stop_canvas_autoscroll ();
void maybe_autoscroll (GdkEvent*);
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index 65195ca822..f1b9ef4b83 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -39,6 +39,8 @@ Editor::register_actions ()
ActionManager::register_action (editor_actions, X_("Monitoring"), _("Monitoring"));
ActionManager::register_action (editor_actions, X_("Autoconnect"), _("Autoconnect"));
ActionManager::register_action (editor_actions, X_("Layering"), _("Layering"));
+ ActionManager::register_action (editor_actions, X_("SMPTE"), _("SMPTE fps"));
+ ActionManager::register_action (editor_actions, X_("Pullup"), _("Pullup / Pulldown"));
ActionManager::register_action (editor_actions, X_("Metering"), _("Metering"));
ActionManager::register_action (editor_actions, X_("MeteringFallOffRate"), _("Fall off rate"));
ActionManager::register_action (editor_actions, X_("MeteringHoldTime"), _("Hold Time"));
@@ -393,6 +395,31 @@ Editor::register_actions ()
ActionManager::register_radio_action (editor_actions, layer_model_group, X_("LayerMoveAddHigher"), _("Most Recently Moved/Added is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), Session::MoveAddHigher));
ActionManager::register_radio_action (editor_actions, layer_model_group, X_("LayerAddHigher"), _("Most Recently Added is Higher"), bind (mem_fun (*this, &Editor::set_layer_model), Session::AddHigher));
+ RadioAction::Group smpte_group;
+
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte23976"), _("23.976"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_23976));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte24"), _("24"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_24));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte24976"), _("24.976"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_24976));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte25"), _("25"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_25));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte2997"), _("29.97"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_2997));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte2997drop"), _("29.97 drop"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_2997drop));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte30"), _("30"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_30));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte30drop"), _("30 drop"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_30drop));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte5994"), _("59.94"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_5994));
+ ActionManager::register_radio_action (editor_actions, smpte_group, X_("Smpte60"), _("60"), bind (mem_fun (*this, &Editor::smpte_fps_chosen), Session::smpte_60));
+
+ RadioAction::Group pullup_group;
+
+ ActionManager::register_radio_action (editor_actions, pullup_group, X_("PullupPlus4Plus1"), _("+4.1667% + 0.1%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Plus4Plus1));
+ ActionManager::register_radio_action (editor_actions, pullup_group, X_("PullupPlus4"), _("+4.1667%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Plus4));
+ ActionManager::register_radio_action (editor_actions, pullup_group, X_("PullupPlus4Minus1"), _("+4.1667% - 0.1%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Plus4Minus1));
+ ActionManager::register_radio_action (editor_actions, pullup_group, X_("PullupPlus1"), _("+ 0.1%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Plus1));
+ ActionManager::register_radio_action (editor_actions, pullup_group, X_("PullupNone"), _("None"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_None));
+ ActionManager::register_radio_action (editor_actions, pullup_group, X_("PullupMinus1"), _("- 0.1%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Minus1));
+ ActionManager::register_radio_action (editor_actions, pullup_group, X_("PullupMinus4Plus1"), _("-4.1667% + 0.1%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Minus4Plus1));
+ ActionManager::register_radio_action (editor_actions, pullup_group, X_("PullupMinus4"), _("-4.1667%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Minus4));
+ ActionManager::register_radio_action (editor_actions, pullup_group, X_("PullupMinus4Minus1"), _("-4.1667% - 0.1%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Minus4Minus1));
+
ActionManager::add_action_group (rl_actions);
ActionManager::add_action_group (zoom_actions);
ActionManager::add_action_group (mouse_mode_actions);
@@ -493,6 +520,150 @@ Editor::set_layer_model (Session::LayerModel model)
}
void
+Editor::smpte_fps_chosen (Session::SmpteFormat format)
+{
+ /* 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.
+ */
+
+ if (session) {
+
+ float fps = 10;
+ bool drop = false;
+
+ RefPtr<Action> act;
+
+ switch (format) {
+ case Session::smpte_23976: {
+ fps=23.976;
+ drop = false;
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte23976"));
+ } break;
+ case Session::smpte_24: {
+ fps=24;
+ drop = false;
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte24"));
+ } break;
+ case Session::smpte_24976: {
+ fps=24.976;
+ drop = false;
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte24976"));
+ } break;
+ case Session::smpte_25: {
+ fps=25;
+ drop = false;
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte25"));
+ } break;
+ case Session::smpte_2997: {
+ fps=29.97;
+ drop = false;
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte2997"));
+ } break;
+ case Session::smpte_2997drop: {
+ fps=29.97;
+ drop = true;
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte2997drop"));
+ } break;
+ case Session::smpte_30: {
+ fps=30;
+ drop = false;
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte30"));
+ } break;
+ case Session::smpte_30drop: {
+ fps=30;
+ drop = true;
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte30drop"));
+ } break;
+ case Session::smpte_5994: {
+ fps=59.94;
+ drop = false;
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte5994"));
+ } break;
+ case Session::smpte_60: {
+ fps=60;
+ drop = false;
+ act = ActionManager::get_action (X_("Editor"), X_("Smpte60"));
+ } break;
+ default:
+ cerr << "Editor received unexpected smpte type" << endl;
+ }
+
+ if (act) {
+ RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
+ if (ract && ract->get_active()) {
+ session->set_smpte_type (fps, drop);
+ }
+ }
+ }
+}
+
+void
+Editor::video_pullup_chosen (Session::PullupFormat pullup)
+{
+ /* 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.
+ */
+
+ if (session) {
+
+ RefPtr<Action> act;
+
+ float pull = 0.0;
+
+ switch (pullup) {
+ case Session::pullup_Plus4Plus1:{
+ pull = 4.1667 + 0.1;
+ act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4Plus1"));
+ } break;
+ case Session::pullup_Plus4:{
+ pull = 4.1667;
+ act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4"));
+ } break;
+ case Session::pullup_Plus4Minus1:{
+ pull = 4.1667 - 0.1;
+ act = ActionManager::get_action (X_("Editor"), X_("PullupPlus4Minus1"));
+ } break;
+ case Session::pullup_Plus1:{
+ pull = 0.1;
+ act = ActionManager::get_action (X_("Editor"), X_("PullupPlus1"));
+ } break;
+ case Session::pullup_None:{
+ pull = 0.0;
+ act = ActionManager::get_action (X_("Editor"), X_("PullupNone"));
+ } break;
+ case Session::pullup_Minus1:{
+ pull = -0.1;
+ act = ActionManager::get_action (X_("Editor"), X_("PullupMinus1"));
+ } break;
+ case Session::pullup_Minus4Plus1:{
+ pull = -4.1667 + 0.1;
+ act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4Plus1"));
+ } break;
+ case Session::pullup_Minus4:{
+ pull = -4.1667;
+ act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4"));
+ } break;
+ case Session::pullup_Minus4Minus1:{
+ pull = -4.1667 - 0.1;
+ act = ActionManager::get_action (X_("Editor"), X_("PullupMinus4Minus1"));
+ } break;
+ default:
+ cerr << "Session received unexpected pullup type" << endl;
+ }
+
+ if (act) {
+ RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
+ if (ract && ract->get_active()) {
+ session->set_video_pullup ( pull );
+ }
+ } else cerr << "Editor::video_pullup_chosen could not find action to match pullup." << endl;
+ }
+}
+
+
+void
Editor::set_crossfade_model (CrossfadeModel model)
{
RefPtr<Action> act;
diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc
index fdd680beb2..e38dee5953 100644
--- a/gtk2_ardour/editor_audio_import.cc
+++ b/gtk2_ardour/editor_audio_import.cc
@@ -270,7 +270,7 @@ Editor::embed_sndfile (Glib::ustring path, bool split, bool multiple_files, bool
idspec += string_compose(":%1", n);
try {
- source = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable (DataType::AUDIO, idspec, (mode == ImportAsTrack ? AudioFileSource::Destructive : AudioFileSource::Flag (0))));
+ source = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable (DataType::AUDIO, *session, idspec, (mode == ImportAsTrack ? AudioFileSource::Destructive : AudioFileSource::Flag (0))));
sources.push_back(source);
}
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index d8eebf1c4b..e2e04326ca 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -266,14 +266,15 @@ Editor::initialize_canvas ()
edit_cursor = new Cursor (*this, "blue", &Editor::canvas_edit_cursor_event);
playhead_cursor = new Cursor (*this, "red", &Editor::canvas_playhead_cursor_event);
-
+
+ initial_ruler_update_required = true;
track_canvas.signal_size_allocate().connect (mem_fun(*this, &Editor::track_canvas_allocate));
+
}
void
Editor::track_canvas_allocate (Gtk::Allocation alloc)
{
- static bool first_time = true;
canvas_width = alloc.get_width();
canvas_height = alloc.get_height();
@@ -318,14 +319,16 @@ Editor::track_canvas_allocate (Gtk::Allocation alloc)
transport_punchout_line->property_y2() = canvas_height;
}
- update_fixed_rulers ();
-
- if (is_visible() && first_time) {
+ if (is_visible() && initial_ruler_update_required) {
+ /*
+ this is really dumb, but signal_size_allocate() gets emitted intermittently
+ depending on whether the canvas contents are visible or not.
+ we only want to do this once
+ */
+ update_fixed_rulers();
tempo_map_changed (Change (0));
- first_time = false;
- } else {
- redisplay_tempo ();
- }
+ initial_ruler_update_required = false;
+ }
Resized (); /* EMIT_SIGNAL */
}
@@ -414,6 +417,8 @@ Editor::track_canvas_drag_data_received (const RefPtr<Gdk::DragContext>& context
const SelectionData& data,
guint info, guint time)
{
+ cerr << "dropping, target = " << data.get_target() << endl;
+
if (data.get_target() == "regions") {
drop_regions (context, x, y, data, info, time);
} else {
@@ -528,7 +533,7 @@ Editor::maybe_autoscroll (GdkEvent* event)
}
- if (autoscroll_direction != last_autoscroll_direction) {
+ if ((autoscroll_direction != last_autoscroll_direction) || (leftmost_frame < frame < rightmost_frame)) {
stop_canvas_autoscroll ();
}
@@ -542,14 +547,13 @@ Editor::maybe_autoscroll (GdkEvent* event)
gint
Editor::_autoscroll_canvas (void *arg)
{
- return ((Editor *) arg)->autoscroll_canvas ();
+ return ((Editor *) arg)->autoscroll_canvas ();
}
-gint
+bool
Editor::autoscroll_canvas ()
{
jack_nframes_t new_frame;
- bool keep_calling = true;
jack_nframes_t limit = max_frames - current_page_frames();
GdkEventMotion ev;
jack_nframes_t target_frame;
@@ -570,10 +574,6 @@ Editor::autoscroll_canvas ()
target_frame = drag_info.current_pointer_frame + autoscroll_distance;
}
- if (new_frame != leftmost_frame) {
- reposition_x_origin (new_frame);
- }
-
/* now fake a motion event to get the object that is being dragged to move too */
ev.type = GDK_MOTION_NOTIFY;
@@ -593,20 +593,26 @@ Editor::autoscroll_canvas ()
/* connect the timeout so that we get called repeatedly */
- autoscroll_timeout_tag = g_timeout_add (20, _autoscroll_canvas, this);
- keep_calling = false;
+ autoscroll_timeout_tag = g_idle_add ( _autoscroll_canvas, this);
+ return false;
+
+ }
- } else if (autoscroll_cnt == 50) { /* 0.5 seconds */
+ if (new_frame != leftmost_frame) {
+ reposition_x_origin (new_frame);
+ }
+
+ if (autoscroll_cnt == 50) { /* 0.5 seconds */
/* after about a while, speed up a bit by changing the timeout interval */
- autoscroll_distance = (jack_nframes_t) floor (current_page_frames()/50.0f);
+ autoscroll_distance = (jack_nframes_t) floor (current_page_frames()/30.0f);
- } else if (autoscroll_cnt == 75) { /* 1.0 seconds */
+ } else if (autoscroll_cnt == 150) { /* 1.0 seconds */
autoscroll_distance = (jack_nframes_t) floor (current_page_frames()/20.0f);
- } else if (autoscroll_cnt == 100) { /* 1.5 seconds */
+ } else if (autoscroll_cnt == 300) { /* 1.5 seconds */
/* after about another while, speed up by increasing the shift per callback */
@@ -614,7 +620,7 @@ Editor::autoscroll_canvas ()
}
- return keep_calling;
+ return true;
}
void
@@ -631,7 +637,7 @@ Editor::start_canvas_autoscroll (int dir)
autoscroll_cnt = 0;
/* do it right now, which will start the repeated callbacks */
-
+
autoscroll_canvas ();
}
diff --git a/gtk2_ardour/editor_export_audio.cc b/gtk2_ardour/editor_export_audio.cc
index 6c67a8fb0e..1b0308b080 100644
--- a/gtk2_ardour/editor_export_audio.cc
+++ b/gtk2_ardour/editor_export_audio.cc
@@ -210,7 +210,7 @@ Editor::write_region (string path, boost::shared_ptr<AudioRegion> region)
try {
- fs = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable (DataType::AUDIO, path, AudioFileSource::Flag (0)));
+ fs = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable (DataType::AUDIO, *session, path, AudioFileSource::Flag (0)));
}
catch (failed_constructor& err) {
@@ -343,7 +343,7 @@ Editor::write_audio_range (AudioPlaylist& playlist, const ChanCount& count, list
path = s;
try {
- fs = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable (DataType::AUDIO, path, AudioFileSource::Flag (0)));
+ fs = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable (DataType::AUDIO, *session, path, AudioFileSource::Flag (0)));
}
catch (failed_constructor& err) {
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 7d262503f8..f44b433caa 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -1110,9 +1110,9 @@ Editor::temporal_zoom_step (bool coarser)
nfpu = frames_per_unit;
if (coarser) {
- nfpu *= 2.0;
+ nfpu *= 1.61803399;
} else {
- nfpu = max(1.0,(nfpu/2.0));
+ nfpu = max(1.0,(nfpu/1.61803399));
}
temporal_zoom (nfpu);
@@ -1251,22 +1251,22 @@ Editor::temporal_zoom_to_frame (bool coarser, jack_nframes_t frame)
{
if (!session) return;
- jack_nframes_t range_before = frame - leftmost_frame;
+ double range_before = frame - leftmost_frame;
double new_fpu;
new_fpu = frames_per_unit;
if (coarser) {
- new_fpu *= 2.0;
- range_before *= 2;
+ new_fpu *= 1.61803399;
+ range_before *= 1.61803399;
} else {
- new_fpu = max(1.0,(new_fpu/2.0));
- range_before /= 2;
+ new_fpu = max(1.0,(new_fpu/1.61803399));
+ range_before /= 1.61803399;
}
if (new_fpu == frames_per_unit) return;
- jack_nframes_t new_leftmost = frame - range_before;
+ jack_nframes_t new_leftmost = frame - (jack_nframes_t)range_before;
if (new_leftmost > frame) new_leftmost = 0;
diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc
index 47641655e7..224e779bf9 100644
--- a/gtk2_ardour/editor_rulers.cc
+++ b/gtk2_ardour/editor_rulers.cc
@@ -819,9 +819,9 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp
if (lower > (spacer = (jack_nframes_t)(128 * Editor::get_current_zoom ()))) {
lower = lower - spacer;
} else {
- upper = upper + spacer - lower;
lower = 0;
}
+ upper = upper + spacer;
range = (jack_nframes_t) floor (upper - lower);
if (range < (2 * session->frames_per_smpte_frame())) { /* 0 - 2 frames */
@@ -1035,114 +1035,87 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper
return 0;
}
- TempoMap::BBTPointList::iterator i;
- TempoMap::BBTPointList *zoomed_bbt_points;
+ TempoMap::BBTPointList::iterator i;
+
uint32_t beats = 0;
uint32_t bars = 0;
- uint32_t tick = 0;
- uint32_t skip;
- uint32_t t;
- uint32_t zoomed_beats = 0;
- uint32_t zoomed_bars = 0;
uint32_t desirable_marks;
uint32_t magic_accent_number = 1;
gint nmarks;
char buf[64];
gint n;
jack_nframes_t pos;
- jack_nframes_t frame_one_beats_worth;
- jack_nframes_t frame_skip;
- double frame_skip_error;
- double accumulated_error;
- bool bar_helper_on = true;
-
+ bool bar_helper_on = true;
- BBT_Time previous_beat;
BBT_Time next_beat;
jack_nframes_t next_beat_pos;
jack_nframes_t ilower = (jack_nframes_t) floor (lower);
- jack_nframes_t iupper = (jack_nframes_t) floor (upper);
- if ((desirable_marks = maxchars / 6) == 0) {
+ if ((desirable_marks = maxchars / 7) == 0) {
return 0;
}
/* align the tick marks to whatever we're snapping to... */
-
- if (snap_type == SnapToAThirdBeat) {
+
+ switch (snap_type) {
+ case SnapToAThirdBeat:
bbt_beat_subdivision = 3;
- } else if (snap_type == SnapToAQuarterBeat) {
+ break;
+ case SnapToAQuarterBeat:
bbt_beat_subdivision = 4;
- } else if (snap_type == SnapToAEighthBeat) {
+ break;
+ case SnapToAEighthBeat:
bbt_beat_subdivision = 8;
magic_accent_number = 2;
- } else if (snap_type == SnapToASixteenthBeat) {
+ break;
+ case SnapToASixteenthBeat:
bbt_beat_subdivision = 16;
magic_accent_number = 4;
- } else if (snap_type == SnapToAThirtysecondBeat) {
+ break;
+ case SnapToAThirtysecondBeat:
bbt_beat_subdivision = 32;
magic_accent_number = 8;
- } else {
+ break;
+ default:
bbt_beat_subdivision = 4;
+ break;
}
- /* First find what a beat's distance is, so we can start plotting stuff before the beginning of the ruler */
-
- session->bbt_time(ilower,previous_beat);
- previous_beat.ticks = 0;
- next_beat = previous_beat;
-
- if (session->tempo_map().meter_at(ilower).beats_per_bar() < (next_beat.beats + 1)) {
- next_beat.bars += 1;
- next_beat.beats = 1;
- } else {
- next_beat.beats += 1;
- }
-
- frame_one_beats_worth = session->tempo_map().frame_time(next_beat) - session->tempo_map().frame_time(previous_beat);
-
-
- zoomed_bbt_points = session->tempo_map().get_points((ilower >= frame_one_beats_worth) ? ilower - frame_one_beats_worth : 0, iupper);
-
- if (current_bbt_points == 0 || zoomed_bbt_points == 0 || zoomed_bbt_points->empty()) {
+ if (current_bbt_points == 0 || current_bbt_points->empty()) {
return 0;
}
- for (i = current_bbt_points->begin(); i != current_bbt_points->end(); i++) {
- if ((*i).type == TempoMap::Beat) {
- beats++;
- } else if ((*i).type == TempoMap::Bar) {
- bars++;
- }
- }
+ i = current_bbt_points->end();
+ i--;
+ bars = (*i).bar - (*current_bbt_points->begin()).bar;
+ beats = current_bbt_points->size() - bars;
+
/*Only show the bar helper if there aren't many bars on the screen */
- if (bars > 1) {
+ if (bars > 2) {
bar_helper_on = false;
}
- for (i = zoomed_bbt_points->begin(); i != zoomed_bbt_points->end(); i++) {
- if ((*i).type == TempoMap::Beat) {
- zoomed_beats++;
- } else if ((*i).type == TempoMap::Bar) {
- zoomed_bars++;
- }
- }
-
if (desirable_marks > (beats / 4)) {
/* we're in beat land...*/
+ uint32_t tick = 0;
+ uint32_t skip;
+ uint32_t t;
+ jack_nframes_t frame_skip;
+ double frame_skip_error;
+ double accumulated_error;
double position_of_helper;
bool i_am_accented = false;
bool we_need_ticks = false;
position_of_helper = ilower + (30 * Editor::get_current_zoom ());
- if (desirable_marks >= (beats * 2)) {
- nmarks = (zoomed_beats * bbt_beat_subdivision) + 1;
+ if (desirable_marks >= (beats)) {
+ nmarks = ((beats + 1) * bbt_beat_subdivision) + 1;
we_need_ticks = true;
} else {
- nmarks = zoomed_beats + 1;
+ nmarks = beats + 1;
}
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
@@ -1151,17 +1124,14 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper
(*marks)[0].position = ilower;
(*marks)[0].style = GtkCustomRulerMarkMicro;
- for (n = 1, i = zoomed_bbt_points->begin(); i != zoomed_bbt_points->end() && n < nmarks; ++i) {
-
- if ((*i).frame <= ilower && (bar_helper_on)) {
-
+ for (n = 1, i = current_bbt_points->begin(); n < nmarks && i != current_bbt_points->end(); i++) {
+
+ if ((*i).frame < ilower && (bar_helper_on)) {
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
(*marks)[0].label = g_strdup (buf);
} else {
-
if ((*i).type == TempoMap::Bar) {
- tick = 0;
(((*i).frame < position_of_helper) && bar_helper_on) ?
snprintf (buf, sizeof(buf), " ") : snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
(*marks)[n].label = g_strdup (buf);
@@ -1170,7 +1140,6 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper
n++;
} else if (((*i).type == TempoMap::Beat) && ((*i).beat > 1)) {
- tick = 0;
((((*i).frame < position_of_helper) && bar_helper_on) || !we_need_ticks) ?
snprintf (buf, sizeof(buf), " ") : snprintf (buf, sizeof(buf), "%" PRIu32, (*i).beat);
if (((*i).beat % 2 == 1) || we_need_ticks) {
@@ -1184,33 +1153,36 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper
}
}
- /* Find the next beat */
-
- session->bbt_time((*i).frame, next_beat);
- if (session->tempo_map().meter_at((*i).frame).beats_per_bar() > (next_beat.beats + 1)) {
- next_beat.beats += 1;
- } else {
- next_beat.bars += 1;
- next_beat.beats = 1;
- }
-
- next_beat_pos = session->tempo_map().frame_time(next_beat);
/* Add the tick marks */
- if (we_need_ticks) {
+ if (we_need_ticks && (*i).type != TempoMap::Bar) {
+
+ /* Find the next beat */
+
+ next_beat.beats = (*i).beat;
+ next_beat.bars = (*i).bar;
+
+ if ((*i).meter->beats_per_bar() > (next_beat.beats + 1)) {
+ next_beat.beats += 1;
+ } else {
+ next_beat.bars += 1;
+ next_beat.beats = 1;
+ }
+
+ next_beat_pos = session->tempo_map().frame_time(next_beat);
- frame_skip = (jack_nframes_t) floor ((session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
- frame_skip_error = ((session->frame_rate() * 60.0f) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute())) - frame_skip;
+ frame_skip = (jack_nframes_t) floor (frame_skip_error = (session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute()));
+ frame_skip_error -= frame_skip;
skip = (uint32_t) (Meter::ticks_per_beat / bbt_beat_subdivision);
pos = (*i).frame + frame_skip;
accumulated_error = frame_skip_error;
- tick += skip;
+ tick = skip;
- for (t = 0; tick < Meter::ticks_per_beat && pos <= next_beat_pos ; pos += frame_skip, tick += skip, ++t) {
+ for (t = 0; (tick < Meter::ticks_per_beat) && (n < nmarks) && (pos < next_beat_pos) ; pos += frame_skip, tick += skip, ++t) {
if (t % magic_accent_number == (magic_accent_number - 1)) {
i_am_accented = true;
@@ -1247,23 +1219,22 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper
}
}
}
- delete zoomed_bbt_points;
return n; //return the actual number of marks made, since we might have skipped some fro fractional time signatures
} else {
/* we're in bar land */
- if (desirable_marks < (uint32_t) (zoomed_bars / 256)) {
+ if (desirable_marks < (uint32_t) (bars / 256)) {
nmarks = 1;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
- snprintf (buf, sizeof(buf), "too many bars... (currently %" PRIu32 ")", zoomed_bars );
+ snprintf (buf, sizeof(buf), "too many bars... (currently %" PRIu32 ")", bars );
(*marks)[0].style = GtkCustomRulerMarkMajor;
(*marks)[0].label = g_strdup (buf);
(*marks)[0].position = ilower;
- } else if (desirable_marks < (uint32_t) (nmarks = (gint) (zoomed_bars / 64))) {
+ } else if (desirable_marks < (uint32_t) (nmarks = (gint) (bars / 64))) {
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
- for (n = 0, i = zoomed_bbt_points->begin(); i != zoomed_bbt_points->end() && n < nmarks; i++) {
+ for (n = 0, i = current_bbt_points->begin(); i != current_bbt_points->end() && n < nmarks; i++) {
if ((*i).type == TempoMap::Bar) {
if ((*i).bar % 64 == 1) {
if ((*i).bar % 256 == 1) {
@@ -1283,9 +1254,9 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper
}
}
}
- } else if (desirable_marks < (uint32_t) (nmarks = (gint)(zoomed_bars / 16))) {
+ } else if (desirable_marks < (uint32_t) (nmarks = (gint)(bars / 16))) {
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
- for (n = 0, i = zoomed_bbt_points->begin(); i != zoomed_bbt_points->end() && n < nmarks; i++) {
+ for (n = 0, i = current_bbt_points->begin(); i != current_bbt_points->end() && n < nmarks; i++) {
if ((*i).type == TempoMap::Bar) {
if ((*i).bar % 16 == 1) {
if ((*i).bar % 64 == 1) {
@@ -1305,9 +1276,9 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper
}
}
}
- } else if (desirable_marks < (uint32_t) (nmarks = (gint)(zoomed_bars / 4))){
+ } else if (desirable_marks < (uint32_t) (nmarks = (gint)(bars / 4))){
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
- for (n = 0, i = zoomed_bbt_points->begin(); i != zoomed_bbt_points->end() && n < nmarks; ++i) {
+ for (n = 0, i = current_bbt_points->begin(); i != current_bbt_points->end() && n < nmarks; ++i) {
if ((*i).type == TempoMap::Bar) {
if ((*i).bar % 4 == 1) {
if ((*i).bar % 16 == 1) {
@@ -1328,9 +1299,9 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper
}
}
} else {
- nmarks = zoomed_bars;
+ nmarks = bars;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks);
- for (n = 0, i = zoomed_bbt_points->begin(); i != zoomed_bbt_points->end() && n < nmarks; i++) {
+ for (n = 0, i = current_bbt_points->begin(); i != current_bbt_points->end() && n < nmarks; i++) {
if ((*i).type == TempoMap::Bar) {
if ((*i).bar % 4 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
@@ -1349,7 +1320,6 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper
}
}
}
- delete zoomed_bbt_points;
return nmarks;
}
}
@@ -1448,9 +1418,9 @@ Editor::metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble up
if (lower > (spacer = (jack_nframes_t)(128 * Editor::get_current_zoom ()))) {
lower = lower - spacer;
} else {
- upper = upper + spacer;
lower = 0;
}
+ upper = upper + spacer;
range = iupper - ilower;
if (range < (fr / 50)) {
diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc
index db1ee5e34e..e101da196f 100644
--- a/gtk2_ardour/editor_tempodisplay.cc
+++ b/gtk2_ardour/editor_tempodisplay.cc
@@ -96,14 +96,36 @@ void
Editor::tempo_map_changed (Change ignored)
{
ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::tempo_map_changed), ignored));
-
+
+ BBT_Time previous_beat, next_beat; // the beats previous to the leftmost frame and after the rightmost frame
+
+ session->bbt_time(leftmost_frame, previous_beat);
+ session->bbt_time(leftmost_frame + current_page_frames(), next_beat);
+
+ if (previous_beat.beats > 1) {
+ previous_beat.beats -= 1;
+ } else if (previous_beat.bars > 1) {
+ previous_beat.bars--;
+ previous_beat.beats += 1;
+ }
+ previous_beat.ticks = 0;
+
+ if (session->tempo_map().meter_at(leftmost_frame + current_page_frames()).beats_per_bar () > next_beat.beats + 1) {
+ next_beat.beats += 1;
+ } else {
+ next_beat.bars += 1;
+ next_beat.beats = 1;
+ }
+ next_beat.ticks = 0;
+
if (current_bbt_points) {
- delete current_bbt_points;
+ delete current_bbt_points;
current_bbt_points = 0;
}
if (session) {
- current_bbt_points = session->tempo_map().get_points (leftmost_frame, leftmost_frame + current_page_frames());
+ current_bbt_points = session->tempo_map().get_points (session->tempo_map().frame_time (previous_beat), session->tempo_map().frame_time (next_beat));
+ update_tempo_based_rulers ();
} else {
current_bbt_points = 0;
}
@@ -114,11 +136,11 @@ Editor::tempo_map_changed (Change ignored)
void
Editor::redisplay_tempo ()
{
- hide_measures ();
if (session && current_bbt_points) {
- draw_measures ();
- update_tempo_based_rulers ();
+ Glib::signal_idle().connect (mem_fun (*this, &Editor::lazy_hide_and_draw_measures));
+ } else {
+ hide_measures ();
}
}
@@ -126,7 +148,7 @@ void
Editor::hide_measures ()
{
for (TimeLineList::iterator i = used_measure_lines.begin(); i != used_measure_lines.end(); ++i) {
- (*i)->hide();
+ (*i)->hide();
free_measure_lines.push_back (*i);
}
used_measure_lines.clear ();
@@ -149,6 +171,14 @@ Editor::get_time_line ()
return line;
}
+bool
+Editor::lazy_hide_and_draw_measures ()
+{
+ hide_measures ();
+ draw_measures ();
+ return false;
+}
+
void
Editor::draw_measures ()
{
@@ -156,86 +186,63 @@ Editor::draw_measures ()
return;
}
- TempoMap::BBTPointList::iterator i = current_bbt_points->begin();
- TempoMap::BBTPoint& p = (*i);
+ TempoMap::BBTPointList::iterator i;
ArdourCanvas::SimpleLine *line;
- gdouble xpos, last_xpos;
- uint32_t cnt;
+ gdouble xpos;
+ double x1, x2, y1, y2, beat_density;
+
+ uint32_t beats = 0;
+ uint32_t bars = 0;
uint32_t color;
if (current_bbt_points == 0 || current_bbt_points->empty()) {
return;
}
- cnt = 0;
- last_xpos = 0;
+ track_canvas.get_scroll_region (x1, y1, x2, y2);
/* get the first bar spacing */
- gdouble last_beat = DBL_MAX;
- gdouble beat_spacing = 0;
-
- for (i = current_bbt_points->begin(); i != current_bbt_points->end() && beat_spacing == 0; ++i) {
- TempoMap::BBTPoint& p = (*i);
+ i = current_bbt_points->end();
+ i--;
+ bars = (*i).bar - (*current_bbt_points->begin()).bar;
+ beats = current_bbt_points->size() - bars;
- switch (p.type) {
- case TempoMap::Bar:
- break;
+ beat_density = (beats * 10.0f) / track_canvas.get_width ();
- case TempoMap::Beat:
- xpos = frame_to_unit (p.frame);
- if (last_beat < xpos) {
- beat_spacing = xpos - last_beat;
- }
- last_beat = xpos;
- }
- }
-
- if (beat_spacing < 3.0) {
- /* if the lines are too close together, they become useless */
+ if (beat_density > 2.0f) {
+ /* if the lines are too close together, they become useless */
return;
}
-
- double x1, x2, y1, y2;
- track_canvas.get_scroll_region (x1, y1, x2, y2);
- y2 = 1000000000.0f;
-
+
for (i = current_bbt_points->begin(); i != current_bbt_points->end(); ++i) {
- p = (*i);
-
- switch (p.type) {
+ switch ((*i).type) {
case TempoMap::Bar:
break;
case TempoMap::Beat:
- xpos = frame_to_unit (p.frame);
- if (p.beat == 1) {
+ if ((*i).beat == 1) {
color = color_map[cMeasureLineBeat];
} else {
color = color_map[cMeasureLineBar];
- /* only draw beat lines if the gaps between beats
- are large.
- */
+ /* only draw beat lines if the gaps between beats are large. */
- if (beat_spacing < 4.0) {
- break;
+ if (beat_density > 0.25) {
+ break;
}
}
-
- if (cnt == 0 || xpos - last_xpos > 4.0) {
- line = get_time_line ();
- line->property_x1() = xpos;
- line->property_x2() = xpos;
- line->property_y2() = y2;
- line->property_color_rgba() = color;
- line->raise_to_top();
- line->show();
- last_xpos = xpos;
- ++cnt;
- }
+
+ xpos = frame_to_unit ((*i).frame);
+ line = get_time_line ();
+ line->property_x1() = xpos;
+ line->property_x2() = xpos;
+ line->property_y2() = y2;
+ line->property_color_rgba() = color;
+ //line->raise_to_top();
+ line->show();
break;
}
}
@@ -244,6 +251,7 @@ Editor::draw_measures ()
cursor_group->raise_to_top();
time_line_group->lower_to_bottom();
+ return;
}
void
diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc
index 94d2a397cf..d718cc9802 100644
--- a/gtk2_ardour/midi_streamview.cc
+++ b/gtk2_ardour/midi_streamview.cc
@@ -183,8 +183,8 @@ MidiStreamView::setup_rec_box ()
assert(region);
region->set_position (_trackview.session().transport_frame(), this);
rec_regions.push_back (region);
- /* catch it if it goes away */
- region->GoingAway.connect (bind (mem_fun (*this, &MidiStreamView::remove_rec_region), region));
+
+ // rec regions are destroyed in setup_rec_box
/* we add the region later */
}
@@ -252,6 +252,15 @@ MidiStreamView::setup_rec_box ()
last_rec_data_frame = 0;
/* remove temp regions */
+
+ for (list<boost::shared_ptr<Region> >::iterator iter = rec_regions.begin(); iter != rec_regions.end();) {
+ list<boost::shared_ptr<Region> >::iterator tmp;
+ tmp = iter;
+ ++tmp;
+ (*iter)->drop_references ();
+ iter = tmp;
+ }
+
rec_regions.clear();
// cerr << "\tclear " << rec_rects.size() << " rec rects\n";
diff --git a/gtk2_ardour/new_session_dialog.cc b/gtk2_ardour/new_session_dialog.cc
index 462fb57711..4a533137a6 100644
--- a/gtk2_ardour/new_session_dialog.cc
+++ b/gtk2_ardour/new_session_dialog.cc
@@ -657,8 +657,8 @@ NewSessionDialog::reset_template()
void
NewSessionDialog::reset_recent()
{
- /* Shamelessly ripped from ardour_ui.cc */
- std::vector<string *> *sessions;
+ /* Shamelessly ripped from ardour_ui.cc */
+ std::vector<string *> *sessions;
std::vector<string *>::iterator i;
RecentSessionsSorter cmp;
@@ -677,7 +677,7 @@ NewSessionDialog::reset_recent()
for (i = sessions->begin(); i != sessions->end(); ++i) {
- std::vector<std::string*>* states;
+ std::vector<std::string*>* states;
std::vector<const gchar*> item;
std::string fullpath = *(*i);
@@ -699,7 +699,7 @@ NewSessionDialog::reset_recent()
row[recent_columns.visible_name] = Glib::path_get_basename (fullpath);
row[recent_columns.fullpath] = fullpath;
- if (states->size() > 1) {
+ if (states->size()) {
/* add the children */
diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc
index b7fc7e746e..013761a86a 100644
--- a/gtk2_ardour/option_editor.cc
+++ b/gtk2_ardour/option_editor.cc
@@ -152,7 +152,6 @@ OptionEditor::set_session (Session *s)
click_emphasis_path_entry.set_sensitive (false);
session_raid_entry.set_sensitive (false);
- smpte_fps_combo.set_sensitive (false);
short_xfade_slider.set_sensitive (false);
smpte_offset_negative_button.set_sensitive (false);
@@ -165,28 +164,9 @@ OptionEditor::set_session (Session *s)
click_path_entry.set_sensitive (true);
click_emphasis_path_entry.set_sensitive (true);
session_raid_entry.set_sensitive (true);
- smpte_fps_combo.set_sensitive (true);
short_xfade_slider.set_sensitive (true);
smpte_offset_negative_button.set_sensitive (true);
- if (!s->smpte_drop_frames) {
- // non-drop frames
- if (s->smpte_frames_per_second == 24.0)
- smpte_fps_combo.set_active_text (_("24 FPS"));
- else if (s->smpte_frames_per_second == 25.0)
- smpte_fps_combo.set_active_text (_("25 FPS"));
- else if (s->smpte_frames_per_second == 30.0)
- smpte_fps_combo.set_active_text (_("30 FPS"));
- else
- smpte_fps_combo.set_active_text (_("???"));
- } else {
- // drop frames
- if (floor(s->smpte_frames_per_second) == 29.0)
- smpte_fps_combo.set_active_text (_("30 FPS drop"));
- else
- smpte_fps_combo.set_active_text (_("???"));
- }
-
smpte_offset_clock.set_session (s);
smpte_offset_clock.set (s->smpte_offset (), true);
@@ -352,15 +332,6 @@ OptionEditor::setup_sync_options ()
HBox* hbox;
vector<string> dumb;
- dumb.clear ();
- dumb.push_back (X_("24 FPS"));
- dumb.push_back (X_("25 FPS"));
- dumb.push_back (X_("30 FPS drop"));
- dumb.push_back (X_("30 FPS non-drop"));
-
- set_popdown_strings (smpte_fps_combo, dumb);
- smpte_fps_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::smpte_fps_chosen));
-
smpte_offset_clock.set_mode (AudioClock::SMPTE);
smpte_offset_clock.ValueChanged.connect (mem_fun(*this, &OptionEditor::smpte_offset_chosen));
@@ -368,22 +339,12 @@ OptionEditor::setup_sync_options ()
smpte_offset_negative_button.unset_flags (Gtk::CAN_FOCUS);
- Label *smpte_fps_label = manage (new Label (_("SMPTE Frames/second")));
Label *smpte_offset_label = manage (new Label (_("SMPTE Offset")));
- smpte_fps_label->set_name("OptionsLabel");
smpte_offset_label->set_name("OptionsLabel");
hbox = manage (new HBox);
hbox->set_border_width (5);
hbox->set_spacing (10);
- hbox->pack_start (*smpte_fps_label, false, false);
- hbox->pack_start (smpte_fps_combo, false, false);
-
- sync_packer.pack_start (*hbox, false, false);
-
- hbox = manage (new HBox);
- hbox->set_border_width (5);
- hbox->set_spacing (10);
hbox->pack_start (*smpte_offset_label, false, false);
hbox->pack_start (smpte_offset_clock, false, false);
hbox->pack_start (smpte_offset_negative_button, false, false);
@@ -402,24 +363,6 @@ OptionEditor::smpte_offset_negative_clicked ()
}
void
-OptionEditor::smpte_fps_chosen ()
-{
- if (session) {
- string str = smpte_fps_combo.get_active_text();
-
- if (str == X_("24 FPS")) {
- session->set_smpte_type (24.0, false);
- } else if (str == X_("25 FPS")) {
- session->set_smpte_type (25.0, false);
- } else if (str == X_("30 FPS drop")) {
- session->set_smpte_type (29.97, true);
- } else if (str == X_("30 FPS non-drop")) {
- session->set_smpte_type (30.0, false);
- }
- }
-}
-
-void
OptionEditor::smpte_offset_chosen()
{
if (session) {
diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h
index 1331d3126e..d3235164a6 100644
--- a/gtk2_ardour/option_editor.h
+++ b/gtk2_ardour/option_editor.h
@@ -100,13 +100,11 @@ class OptionEditor : public Gtk::Dialog
Gtk::VBox sync_packer;
Gtk::ComboBoxText slave_type_combo;
- Gtk::ComboBoxText smpte_fps_combo;
AudioClock smpte_offset_clock;
Gtk::CheckButton smpte_offset_negative_button;
void setup_sync_options ();
- void smpte_fps_chosen ();
void smpte_offset_chosen ();
void smpte_offset_negative_clicked ();
diff --git a/gtk2_ardour/region_gain_line.h b/gtk2_ardour/region_gain_line.h
index 02340c8bae..3781fe60bb 100644
--- a/gtk2_ardour/region_gain_line.h
+++ b/gtk2_ardour/region_gain_line.h
@@ -26,16 +26,12 @@ class AudioRegionGainLine : public AutomationLine
void remove_point (ControlPoint&);
- PBD::ID id() { return _id; }
-
private:
ARDOUR::Session& session;
AudioRegionView& rv;
UndoAction get_memento();
-
- PBD::ID _id;
};
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index 27d1739fd4..470a6d0b88 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -118,18 +118,6 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
hide_button.add (*(manage (new Image (get_xpm("small_x.xpm")))));
- solo_button->signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
- mute_button->signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
- playlist_button.signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
- automation_button.signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
- size_button.signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
- visual_button.signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
- hide_button.signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
-
- solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
- solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
- mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
- mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
edit_group_button.signal_button_release_event().connect (mem_fun(*this, &RouteTimeAxisView::edit_click), false);
playlist_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::playlist_click));
automation_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::automation_click));
@@ -137,10 +125,14 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
visual_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::visual_click));
hide_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::hide_click));
+ solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
+ solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
+ mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
+ mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
+
if (is_track()) {
rec_enable_button->set_active (false);
rec_enable_button->set_name ("TrackRecordEnableButton");
- rec_enable_button->signal_button_press_event().connect (mem_fun (*this, &RouteTimeAxisView::select_me), false);
rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press));
controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
ARDOUR_UI::instance()->tooltips().set_tip(*rec_enable_button, _("Record"));
@@ -197,6 +189,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
_route->name_changed.connect (mem_fun(*this, &RouteTimeAxisView::route_name_changed));
_route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
+
if (is_track()) {
track()->FreezeChange.connect (mem_fun(*this, &RouteTimeAxisView::map_frozen));
@@ -215,6 +208,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
editor.ZoomChanged.connect (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
ColorChanged.connect (mem_fun (*this, &RouteTimeAxisView::color_handler));
+
}
RouteTimeAxisView::~RouteTimeAxisView ()
@@ -605,19 +599,19 @@ RouteTimeAxisView::set_height (TrackHeight h)
show_name_entry ();
hide_name_label ();
- mute_button->show_all();
- solo_button->show_all();
+ mute_button->show();
+ solo_button->show();
if (rec_enable_button)
- rec_enable_button->show_all();
+ rec_enable_button->show();
- edit_group_button.show_all();
- hide_button.show_all();
- visual_button.show_all();
- size_button.show_all();
- automation_button.show_all();
+ edit_group_button.show();
+ hide_button.show();
+ visual_button.show();
+ size_button.show();
+ automation_button.show();
if (is_track() && track()->mode() == ARDOUR::Normal) {
- playlist_button.show_all();
+ playlist_button.show();
}
break;
@@ -625,10 +619,10 @@ RouteTimeAxisView::set_height (TrackHeight h)
show_name_entry ();
hide_name_label ();
- mute_button->show_all();
- solo_button->show_all();
+ mute_button->show();
+ solo_button->show();
if (rec_enable_button)
- rec_enable_button->show_all();
+ rec_enable_button->show();
edit_group_button.hide ();
hide_button.hide ();
@@ -1193,13 +1187,6 @@ RouteTimeAxisView::color_handler (ColorID id, uint32_t val)
}
}
-bool
-RouteTimeAxisView::select_me (GdkEventButton* ev)
-{
- editor.get_selection().add (this);
- return false;
-}
-
void
RouteTimeAxisView::show_all_automation ()
{
diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h
index f3643de68b..7489dc84fe 100644
--- a/gtk2_ardour/route_time_axis.h
+++ b/gtk2_ardour/route_time_axis.h
@@ -214,8 +214,7 @@ protected:
void map_frozen ();
void color_handler (ColorID, uint32_t);
- bool select_me (GdkEventButton*);
-
+
void region_view_added (RegionView*);
void add_ghost_to_redirect (RegionView*, AutomationTimeAxisView*);
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc
index 3ede0bc1c7..040dac6e0e 100644
--- a/gtk2_ardour/route_ui.cc
+++ b/gtk2_ardour/route_ui.cc
@@ -86,10 +86,10 @@ RouteUI::RouteUI (boost::shared_ptr<ARDOUR::Route> rt, ARDOUR::Session& sess, co
update_rec_display ();
}
-
+
mute_button->unset_flags (Gtk::CAN_FOCUS);
solo_button->unset_flags (Gtk::CAN_FOCUS);
-
+
/* map the current state */
map_frozen ();
@@ -100,7 +100,7 @@ RouteUI::~RouteUI()
delete mute_menu;
}
-gint
+bool
RouteUI::mute_press(GdkEventButton* ev)
{
if (!ignore_toggle) {
@@ -161,7 +161,7 @@ RouteUI::mute_press(GdkEventButton* ev)
return true;
}
-gint
+bool
RouteUI::mute_release(GdkEventButton* ev)
{
if (!ignore_toggle) {
@@ -175,7 +175,7 @@ RouteUI::mute_release(GdkEventButton* ev)
return true;
}
-gint
+bool
RouteUI::solo_press(GdkEventButton* ev)
{
if (!ignore_toggle) {
@@ -255,7 +255,7 @@ RouteUI::solo_press(GdkEventButton* ev)
return true;
}
-gint
+bool
RouteUI::solo_release(GdkEventButton* ev)
{
if (!ignore_toggle) {
@@ -271,7 +271,7 @@ RouteUI::solo_release(GdkEventButton* ev)
return true;
}
-gint
+bool
RouteUI::rec_enable_press(GdkEventButton* ev)
{
if (!ignore_toggle && is_track() && rec_enable_button) {
diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h
index b01d7d41cb..00b3e0a313 100644
--- a/gtk2_ardour/route_ui.h
+++ b/gtk2_ardour/route_ui.h
@@ -90,11 +90,11 @@ class RouteUI : public virtual AxisView
XMLNode* get_child_xml_node (const string & childname);
- gint mute_press(GdkEventButton*);
- gint mute_release(GdkEventButton*);
- gint solo_press(GdkEventButton*);
- gint solo_release(GdkEventButton*);
- gint rec_enable_press(GdkEventButton*);
+ bool mute_press(GdkEventButton*);
+ bool mute_release(GdkEventButton*);
+ bool solo_press(GdkEventButton*);
+ bool solo_release(GdkEventButton*);
+ bool rec_enable_press(GdkEventButton*);
void solo_changed(void*);
void mute_changed(void*);
diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc
index b0601704c8..f434463500 100644
--- a/gtk2_ardour/sfdb_ui.cc
+++ b/gtk2_ardour/sfdb_ui.cc
@@ -36,6 +36,7 @@
#include <ardour/source_factory.h>
#include "ardour_ui.h"
+#include "editing.h"
#include "gui_thread.h"
#include "prompter.h"
#include "sfdb_ui.h"
@@ -197,7 +198,7 @@ SoundFileBox::play_btn_clicked ()
for (int n = 0; n < sf_info.channels; ++n) {
try {
- afs = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable (DataType::AUDIO, path+":"+string_compose("%1", n), AudioFileSource::Flag (0)));
+ afs = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable (DataType::AUDIO, *_session, path+":"+string_compose("%1", n), AudioFileSource::Flag (0)));
srclist.push_back(afs);
} catch (failed_constructor& err) {
@@ -305,6 +306,15 @@ SoundFileBox::field_selected ()
}
}
+// this needs to be kept in sync with the ImportMode enum defined in editing.h and editing_syms.h.
+static const char *import_mode_strings[] = {
+ X_("Add to Region list"),
+ X_("Add to selected Track(s)"),
+ X_("Add as new Track(s)"),
+ X_("Add as new Tape Track(s)"),
+ 0
+};
+
SoundFileBrowser::SoundFileBrowser (string title, ARDOUR::Session* s)
: ArdourDialog (title, false),
chooser (Gtk::FILE_CHOOSER_ACTION_OPEN)
@@ -339,13 +349,6 @@ SoundFileChooser::SoundFileChooser (string title, ARDOUR::Session* s)
show_all ();
}
-static const char *import_mode_strings[] = {
- X_("Add to Region list"),
- X_("Add as new Track(s)"),
- X_("Add to selected Track(s)"),
- 0
-};
-
vector<string> SoundFileOmega::mode_strings;
SoundFileOmega::SoundFileOmega (string title, ARDOUR::Session* s)
diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc
index 3a1237f882..3a15d84982 100644
--- a/gtk2_ardour/streamview.cc
+++ b/gtk2_ardour/streamview.cc
@@ -178,6 +178,8 @@ StreamView::remove_region_view (boost::shared_ptr<Region> r)
}
}
+#if 0
+(unused)
void
StreamView::remove_rec_region (boost::shared_ptr<Region> r)
{
@@ -195,6 +197,7 @@ StreamView::remove_rec_region (boost::shared_ptr<Region> r)
}
}
}
+#endif
void
StreamView::undisplay_diskstream ()
diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h
index 6f5e37869a..e965fc7c94 100644
--- a/gtk2_ardour/streamview.h
+++ b/gtk2_ardour/streamview.h
@@ -109,7 +109,7 @@ protected:
virtual void add_region_view_internal (boost::shared_ptr<ARDOUR::Region>, bool wait_for_waves) = 0;
virtual void remove_region_view (boost::shared_ptr<ARDOUR::Region> );
- void remove_rec_region (boost::shared_ptr<ARDOUR::Region>);
+ //void remove_rec_region (boost::shared_ptr<ARDOUR::Region>); (unused)
void display_diskstream (boost::shared_ptr<ARDOUR::Diskstream>);
virtual void undisplay_diskstream ();