NO-OP: whitespace

- remove trailing whitespace
- remove space after opening brackets and before closing brackets
- add space around operators
- do not use '//' for multi-line comments, do not use "//" on line-start
  to comment-out code breaking indenting (-Wmisleading-indent)
- do add a single space after comment-start /*{SPACE}... or //{SPACE}...
- reserve duplicate whitespace "  " for alignment, remove other duplicate
  whitespace
- use established "TODO" and "XXX" (highlighted keywords)
- remove equal-sign series "====" (those indicate merge conflicts)
This commit is contained in:
Robin Gareus 2018-02-24 13:54:15 +01:00
parent 75122af118
commit ceac42cc03
11 changed files with 426 additions and 425 deletions

View file

@ -89,7 +89,7 @@ AddRouteDialog::AddRouteDialog ()
if (builtin_types.empty()) { if (builtin_types.empty()) {
builtin_types.push_back ( builtin_types.push_back (
std::pair<string,string>(_("Audio Tracks"), _( " \ std::pair<string,string>(_("Audio Tracks"), _(" \
Use the settings, below, to create 1 or more new Audio tracks.\n \ Use the settings, below, to create 1 or more new Audio tracks.\n \
\n\n \ \n\n \
You may select:\n \ You may select:\n \
@ -185,17 +185,17 @@ You may select:\n \
strict_io_combo.append_text (_("Strict-I/O")); strict_io_combo.append_text (_("Strict-I/O"));
strict_io_combo.set_active (Config->get_strict_io () ? 1 : 0); strict_io_combo.set_active (Config->get_strict_io () ? 1 : 0);
//top-level VBox /* top-level VBox */
VBox* vbox = manage (new VBox); VBox* vbox = manage (new VBox);
get_vbox()->set_spacing (4); get_vbox()->set_spacing (4);
vbox->set_spacing (18); vbox->set_spacing (18);
vbox->set_border_width (5); vbox->set_border_width (5);
//this box contains the template chooser, and the template details /* this box contains the template chooser, and the template details */
HBox* template_hbox = manage (new HBox); HBox* template_hbox = manage (new HBox);
template_hbox->set_spacing (8); template_hbox->set_spacing (8);
//scrollbars for the template chooser and template descriptions.... /* scrollbars for the template chooser and template descriptions.... */
Gtk::ScrolledWindow *template_scroller = manage (new Gtk::ScrolledWindow()); Gtk::ScrolledWindow *template_scroller = manage (new Gtk::ScrolledWindow());
template_scroller->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); template_scroller->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
template_scroller->add (trk_template_chooser); template_scroller->add (trk_template_chooser);
@ -204,10 +204,10 @@ You may select:\n \
desc_scroller->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); desc_scroller->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
desc_scroller->add (trk_template_desc); desc_scroller->add (trk_template_desc);
//this is the outer sample that surrounds the description and the settings-table /* this is the outer sample that surrounds the description and the settings-table */
trk_template_outer_frame.set_name (X_("TextHighlightFrame")); trk_template_outer_frame.set_name (X_("TextHighlightFrame"));
//this is the "inner frame" that surrounds the description text /* this is the "inner frame" that surrounds the description text */
trk_template_desc_frame.set_name (X_("TextHighlightFrame")); trk_template_desc_frame.set_name (X_("TextHighlightFrame"));
trk_template_desc_frame.add (*desc_scroller); trk_template_desc_frame.add (*desc_scroller);
@ -250,7 +250,7 @@ You may select:\n \
vbox->pack_start (*template_hbox, true, true); vbox->pack_start (*template_hbox, true, true);
//Now pack the "settings table" with manual controls (these controls are sensitized by the left-side selection) /* Now pack the "settings table" with manual controls (these controls are sensitized by the left-side selection) */
int n = 0; int n = 0;
@ -262,7 +262,7 @@ You may select:\n \
++n; ++n;
// Number /* Number */
add_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER); add_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
settings_table->attach (add_label, 0, 1, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0); settings_table->attach (add_label, 0, 1, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0);
Gtk::Alignment *align = manage (new Alignment (0, .5, 0, 0)); Gtk::Alignment *align = manage (new Alignment (0, .5, 0, 0));
@ -271,31 +271,31 @@ You may select:\n \
++n; ++n;
// Name /* Name */
name_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER); name_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
settings_table->attach (name_label, 0, 1, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0); settings_table->attach (name_label, 0, 1, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0);
settings_table->attach (name_template_entry, 1, 3, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0); settings_table->attach (name_template_entry, 1, 3, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0);
// Route configuration /* Route configuration */
configuration_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER); configuration_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
settings_table->attach (configuration_label, 4, 5, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0); settings_table->attach (configuration_label, 4, 5, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0);
settings_table->attach (channel_combo, 5, 6, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0); settings_table->attach (channel_combo, 5, 6, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0);
++n; ++n;
// instrument choice (for MIDI) /* instrument choice (for MIDI) */
instrument_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER); instrument_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
settings_table->attach (instrument_label, 0, 1, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0); settings_table->attach (instrument_label, 0, 1, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0);
settings_table->attach (instrument_combo, 1, 3, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0); settings_table->attach (instrument_combo, 1, 3, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0);
// Group choice /* Group choice */
group_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER); group_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
settings_table->attach (group_label, 4, 5, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0); settings_table->attach (group_label, 4, 5, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0);
settings_table->attach (route_group_combo, 5, 6, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0); settings_table->attach (route_group_combo, 5, 6, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0);
++n; ++n;
// New Route's I/O is.. {strict/flexible} /* New Route's I/O is.. {strict/flexible} */
if (Profile->get_mixbus ()) { if (Profile->get_mixbus ()) {
strict_io_combo.set_active (1); strict_io_combo.set_active (1);
} else { } else {
@ -306,7 +306,7 @@ You may select:\n \
ArdourWidgets::set_tooltip (strict_io_combo, ArdourWidgets::set_tooltip (strict_io_combo,
_("With strict-i/o enabled, Effect Processors will not modify the number of channels on a track. The number of output channels will always match the number of input channels.")); _("With strict-i/o enabled, Effect Processors will not modify the number of channels on a track. The number of output channels will always match the number of input channels."));
// recording mode /* recording mode */
mode_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER); mode_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
settings_table->attach (mode_label, 4, 5, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0); settings_table->attach (mode_label, 4, 5, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0);
settings_table->attach (mode_combo, 5, 6, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0); settings_table->attach (mode_combo, 5, 6, n, n + 1, Gtk::FILL, Gtk::SHRINK, 0, 0);
@ -317,12 +317,12 @@ You may select:\n \
HBox* outer_box = manage (new HBox); HBox* outer_box = manage (new HBox);
outer_box->set_spacing (4); outer_box->set_spacing (4);
// New route will be inserted at.. /* New route will be inserted at.. */
insert_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER); insert_label.set_alignment (Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
outer_box->pack_start (insert_label, false, false); outer_box->pack_start (insert_label, false, false);
outer_box->pack_start (insert_at_combo, false, false); outer_box->pack_start (insert_at_combo, false, false);
//quick-add button (add item but don't close dialog) /* quick-add button (add item but don't close dialog) */
Gtk::Button* addnoclose_button = manage (new Gtk::Button(_("Add selected items (and leave dialog open)"))); Gtk::Button* addnoclose_button = manage (new Gtk::Button(_("Add selected items (and leave dialog open)")));
addnoclose_button->set_can_default (); addnoclose_button->set_can_default ();
addnoclose_button->signal_clicked ().connect (sigc::bind (sigc::mem_fun (*this, &Gtk::Dialog::response), Add)); addnoclose_button->signal_clicked ().connect (sigc::bind (sigc::mem_fun (*this, &Gtk::Dialog::response), Add));
@ -426,7 +426,6 @@ AddRouteDialog::trk_template_row_selected ()
name_template_entry.set_text (""); name_template_entry.set_text ("");
} }
if ((it = rs.find ("how_many")) != rs.end()) { if ((it = rs.find ("how_many")) != rs.end()) {
if (atoi (it->second.c_str()) > 0) { if (atoi (it->second.c_str()) > 0) {
routes_adjustment.set_value (atoi (it->second.c_str())); routes_adjustment.set_value (atoi (it->second.c_str()));
@ -540,7 +539,7 @@ AddRouteDialog::get_template_path ()
if (iter) { if (iter) {
string n = (*iter)[track_template_columns.name]; string n = (*iter)[track_template_columns.name];
if ( n != _("Manual Configuration") ) { if (n != _("Manual Configuration")) {
p = (*iter)[track_template_columns.path]; p = (*iter)[track_template_columns.path];
} }
} }
@ -941,8 +940,8 @@ AddRouteDialog::refill_channel_setups ()
continue; continue;
} }
TreeModel::Row row; TreeModel::Row row;
if ( (*s)->name == "Create Audio Tracks Interactively" && Profile->get_mixbus ()) { if ((*s)->name == "Create Audio Tracks Interactively" && Profile->get_mixbus ()) {
// somewhat-special, Ben says: "most-used template" /* somewhat-special, Ben says: "most-used template" */
row = *(trk_template_model->prepend ()); row = *(trk_template_model->prepend ());
} else { } else {
row = *(trk_template_model->append ()); row = *(trk_template_model->append ());

View file

@ -223,7 +223,7 @@ static const gchar *_rb_opt_strings[] = {
}; };
#endif #endif
//Robin says: this should be odd to accomodate cairo drawing offset ( width/2 rounds up to pixel boundary ) /* Robin says: this should be odd to accomodate cairo drawing offset (width/2 rounds up to pixel boundary) */
#ifdef __APPLE__ #ifdef __APPLE__
#define COMBO_TRIANGLE_WIDTH 19 // ArdourButton _diameter (11) + 2 * arrow-padding (2*2) + 2 * text-padding (2*5) #define COMBO_TRIANGLE_WIDTH 19 // ArdourButton _diameter (11) + 2 * arrow-padding (2*2) + 2 * text-padding (2*5)
#else #else
@ -611,7 +611,7 @@ Editor::Editor ()
pad_line_1->set_outline_color (0xFF0000FF); pad_line_1->set_outline_color (0xFF0000FF);
pad_line_1->show(); pad_line_1->show();
// CAIROCANVAS /* CAIROCANVAS */
time_pad->show(); time_pad->show();
edit_packer.set_col_spacings (0); edit_packer.set_col_spacings (0);
@ -625,7 +625,7 @@ Editor::Editor ()
time_bars_event_box.signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::ruler_label_button_release)); time_bars_event_box.signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::ruler_label_button_release));
ArdourWidgets::ArdourDropShadow *axis_view_shadow = manage (new (ArdourWidgets::ArdourDropShadow)); ArdourWidgets::ArdourDropShadow *axis_view_shadow = manage (new (ArdourWidgets::ArdourDropShadow));
axis_view_shadow->set_size_request( 4, -1 ); axis_view_shadow->set_size_request (4, -1);
axis_view_shadow->set_name("EditorWindow"); axis_view_shadow->set_name("EditorWindow");
axis_view_shadow->show(); axis_view_shadow->show();
@ -740,22 +740,22 @@ Editor::Editor ()
global_vpacker.set_spacing (0); global_vpacker.set_spacing (0);
global_vpacker.set_border_width (0); global_vpacker.set_border_width (0);
//the next three EventBoxes provide the ability for their child widgets to have a background color. That is all. /* the next three EventBoxes provide the ability for their child widgets to have a background color. That is all. */
Gtk::EventBox* ebox = manage (new Gtk::EventBox); //a themeable box Gtk::EventBox* ebox = manage (new Gtk::EventBox); // a themeable box
ebox->set_name("EditorWindow"); ebox->set_name("EditorWindow");
ebox->add (ebox_hpacker); ebox->add (ebox_hpacker);
Gtk::EventBox* epane_box = manage (new EventBoxExt); //a themeable box Gtk::EventBox* epane_box = manage (new EventBoxExt); // a themeable box
epane_box->set_name("EditorWindow"); epane_box->set_name("EditorWindow");
epane_box->add (edit_pane); epane_box->add (edit_pane);
Gtk::EventBox* epane_box2 = manage (new EventBoxExt); //a themeable box Gtk::EventBox* epane_box2 = manage (new EventBoxExt); // a themeable box
epane_box2->set_name("EditorWindow"); epane_box2->set_name("EditorWindow");
epane_box2->add (global_vpacker); epane_box2->add (global_vpacker);
ArdourWidgets::ArdourDropShadow *toolbar_shadow = manage (new (ArdourWidgets::ArdourDropShadow)); ArdourWidgets::ArdourDropShadow *toolbar_shadow = manage (new (ArdourWidgets::ArdourDropShadow));
toolbar_shadow->set_size_request( -1, 4 ); toolbar_shadow->set_size_request (-1, 4);
toolbar_shadow->set_mode(ArdourWidgets::ArdourDropShadow::DropShadowBoth); toolbar_shadow->set_mode(ArdourWidgets::ArdourDropShadow::DropShadowBoth);
toolbar_shadow->set_name("EditorWindow"); toolbar_shadow->set_name("EditorWindow");
toolbar_shadow->show(); toolbar_shadow->show();
@ -1132,7 +1132,7 @@ bool
Editor::deferred_control_scroll (samplepos_t /*target*/) Editor::deferred_control_scroll (samplepos_t /*target*/)
{ {
_session->request_locate (*_control_scroll_target, _session->transport_rolling()); _session->request_locate (*_control_scroll_target, _session->transport_rolling());
// reset for next stream /* reset for next stream */
_control_scroll_target = boost::none; _control_scroll_target = boost::none;
_dragging_playhead = false; _dragging_playhead = false;
return false; return false;
@ -1148,7 +1148,7 @@ Editor::access_action (const std::string& action_group, const std::string& actio
ENSURE_GUI_THREAD (*this, &Editor::access_action, action_group, action_item) ENSURE_GUI_THREAD (*this, &Editor::access_action, action_group, action_item)
RefPtr<Action> act; RefPtr<Action> act;
act = ActionManager::get_action( action_group.c_str(), action_item.c_str() ); act = ActionManager::get_action (action_group.c_str(), action_item.c_str());
if (act) { if (act) {
act->activate(); act->activate();
@ -1326,8 +1326,9 @@ Editor::set_session (Session *t)
return; return;
} }
//initialize _leftmost_sample to the extents of the session /* initialize _leftmost_sample to the extents of the session
//this prevents a bogus setting of leftmost = "0" if the summary view asks for the leftmost sample before the visible state has been loaded from instant.xml * this prevents a bogus setting of leftmost = "0" if the summary view asks for the leftmost sample
* before the visible state has been loaded from instant.xml */
_leftmost_sample = session_gui_extents().first; _leftmost_sample = session_gui_extents().first;
_playlist_selector->set_session (_session); _playlist_selector->set_session (_session);
@ -1364,15 +1365,15 @@ Editor::set_session (Session *t)
loc = _session->locations()->auto_punch_location(); loc = _session->locations()->auto_punch_location();
if (loc != 0) { if (loc != 0) {
// force name /* force name */
loc->set_name (_("Punch")); loc->set_name (_("Punch"));
} }
refresh_location_display (); refresh_location_display ();
/* This must happen after refresh_location_display(), as (amongst other things) we restore /* This must happen after refresh_location_display(), as (amongst other things) we restore
the selected Marker; this needs the LocationMarker list to be available. * the selected Marker; this needs the LocationMarker list to be available.
*/ */
XMLNode* node = ARDOUR_UI::instance()->editor_settings(); XMLNode* node = ARDOUR_UI::instance()->editor_settings();
set_state (*node, Stateful::loading_state_version); set_state (*node, Stateful::loading_state_version);
@ -2208,7 +2209,7 @@ Editor::snap_mode() const
void void
Editor::set_grid_to (GridType gt) Editor::set_grid_to (GridType gt)
{ {
if (_grid_type == gt) { //already set if (_grid_type == gt) { // already set
return; return;
} }
@ -2233,9 +2234,11 @@ Editor::set_grid_to (GridType gt)
grid_type_selector.set_text (str); grid_type_selector.set_text (str);
} }
//show appropriate rulers for this grid setting. (ToDo: perhaps make this optional) /* show appropriate rulers for this grid setting.
//Currently this is 'required' because the RULER calculates the grid_marks which will be used by grid_lines * TODO: perhaps make this optional.
if ( grid_musical() ) { * Currently this is 'required' because the RULER calculates the grid_marks which will be used by grid_lines
*/
if (grid_musical()) {
ruler_tempo_action->set_active(true); ruler_tempo_action->set_active(true);
ruler_meter_action->set_active(true); ruler_meter_action->set_active(true);
@ -2243,7 +2246,7 @@ Editor::set_grid_to (GridType gt)
ruler_timecode_action->set_active(false); ruler_timecode_action->set_active(false);
ruler_minsec_action->set_active(false); ruler_minsec_action->set_active(false);
ruler_samples_action->set_active(false); ruler_samples_action->set_active(false);
} else if (_grid_type == GridTypeSmpte ) { } else if (_grid_type == GridTypeSmpte) {
ruler_tempo_action->set_active(false); ruler_tempo_action->set_active(false);
ruler_meter_action->set_active(false); ruler_meter_action->set_active(false);
@ -2251,7 +2254,7 @@ Editor::set_grid_to (GridType gt)
ruler_timecode_action->set_active(true); ruler_timecode_action->set_active(true);
ruler_minsec_action->set_active(false); ruler_minsec_action->set_active(false);
ruler_samples_action->set_active(false); ruler_samples_action->set_active(false);
} else if (_grid_type == GridTypeMinSec ) { } else if (_grid_type == GridTypeMinSec) {
ruler_tempo_action->set_active(false); ruler_tempo_action->set_active(false);
ruler_meter_action->set_active(false); ruler_meter_action->set_active(false);
@ -2259,7 +2262,7 @@ Editor::set_grid_to (GridType gt)
ruler_timecode_action->set_active(false); ruler_timecode_action->set_active(false);
ruler_minsec_action->set_active(true); ruler_minsec_action->set_active(true);
ruler_samples_action->set_active(false); ruler_samples_action->set_active(false);
} else if (_grid_type == GridTypeSamples ) { } else if (_grid_type == GridTypeSamples) {
ruler_tempo_action->set_active(false); ruler_tempo_action->set_active(false);
ruler_meter_action->set_active(false); ruler_meter_action->set_active(false);
@ -2271,7 +2274,7 @@ Editor::set_grid_to (GridType gt)
instant_save (); instant_save ();
if ( grid_musical() ) { if (grid_musical()) {
compute_bbt_ruler_scale (_leftmost_sample, _leftmost_sample + current_page_samples()); compute_bbt_ruler_scale (_leftmost_sample, _leftmost_sample + current_page_samples());
update_tempo_based_rulers (); update_tempo_based_rulers ();
} }
@ -2294,7 +2297,7 @@ Editor::set_snap_mode (SnapMode mode)
_snap_mode = mode; _snap_mode = mode;
if (_snap_mode == SnapOff ) { if (_snap_mode == SnapOff) {
snap_mode_button.set_active_state (Gtkmm2ext::Off); snap_mode_button.set_active_state (Gtkmm2ext::Off);
} else { } else {
snap_mode_button.set_active_state (Gtkmm2ext::ExplicitActive); snap_mode_button.set_active_state (Gtkmm2ext::ExplicitActive);
@ -2651,7 +2654,7 @@ Editor::trackview_by_y_position (double y, bool trackview_relative_offset) const
} }
if (y < 0) { if (y < 0) {
return std::make_pair ( (TimeAxisView *) 0, 0); return std::make_pair ((TimeAxisView *) 0, 0);
} }
for (TrackViewList::const_iterator iter = track_views.begin(); iter != track_views.end(); ++iter) { for (TrackViewList::const_iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
@ -2663,13 +2666,13 @@ Editor::trackview_by_y_position (double y, bool trackview_relative_offset) const
} }
} }
return std::make_pair ( (TimeAxisView *) 0, 0); return std::make_pair ((TimeAxisView *) 0, 0);
} }
void void
Editor::set_snapped_cursor_position (samplepos_t pos) Editor::set_snapped_cursor_position (samplepos_t pos)
{ {
if ( _edit_point == EditAtMouse ) { if (_edit_point == EditAtMouse) {
snapped_cursor->set_position(pos); snapped_cursor->set_position(pos);
} }
} }
@ -2717,21 +2720,21 @@ Editor::snap_to (MusicSample& start, RoundMode direction, SnapPref pref, bool fo
} }
void void
check_best_snap ( samplepos_t presnap, samplepos_t &test, samplepos_t &dist, samplepos_t &best ) check_best_snap (samplepos_t presnap, samplepos_t &test, samplepos_t &dist, samplepos_t &best)
{ {
samplepos_t diff = abs( test - presnap ); samplepos_t diff = abs (test - presnap);
if ( diff < dist ) { if (diff < dist) {
dist = diff; dist = diff;
best = test; best = test;
} }
test = max_samplepos; //reset this so it doesn't get accidentally reused test = max_samplepos; // reset this so it doesn't get accidentally reused
} }
samplepos_t samplepos_t
Editor::snap_to_grid (vector<ArdourCanvas::Ruler::Mark> marks, samplepos_t presnap, RoundMode direction) Editor::snap_to_grid (vector<ArdourCanvas::Ruler::Mark> marks, samplepos_t presnap, RoundMode direction)
{ {
if (marks.empty() ) return presnap; if (marks.empty()) return presnap;
samplepos_t before; samplepos_t before;
samplepos_t after; samplepos_t after;
@ -2739,9 +2742,9 @@ Editor::snap_to_grid (vector<ArdourCanvas::Ruler::Mark> marks, samplepos_t presn
before = after = max_samplepos; before = after = max_samplepos;
//get marks to either side of presnap /* get marks to either side of presnap */
vector<ArdourCanvas::Ruler::Mark>::const_iterator m = marks.begin(); vector<ArdourCanvas::Ruler::Mark>::const_iterator m = marks.begin();
while ( m != marks.end() && (m->position < presnap) ) { while (m != marks.end() && (m->position < presnap)) {
++m; ++m;
} }
@ -2769,7 +2772,7 @@ Editor::snap_to_grid (vector<ArdourCanvas::Ruler::Mark> marks, samplepos_t presn
test = after; test = after;
else if ((direction == RoundDownMaybe || direction == RoundDownAlways)) else if ((direction == RoundDownMaybe || direction == RoundDownAlways))
test = before; test = before;
else if (direction == 0 ) { else if (direction == 0) {
if ((presnap - before) < (after - presnap)) { if ((presnap - before) < (after - presnap)) {
test = before; test = before;
} else { } else {
@ -2802,7 +2805,7 @@ Editor::marker_snap_to_internal (samplepos_t presnap, RoundMode direction)
test = after; test = after;
} else if ((direction == RoundDownMaybe || direction == RoundDownAlways)) { } else if ((direction == RoundDownMaybe || direction == RoundDownAlways)) {
test = before; test = before;
} else if (direction == 0 ) { } else if (direction == 0) {
if ((presnap - before) < (after - presnap)) { if ((presnap - before) < (after - presnap)) {
test = before; test = before;
} else { } else {
@ -2819,22 +2822,22 @@ Editor::snap_to_internal (MusicSample& start, RoundMode direction, SnapPref pref
{ {
const samplepos_t presnap = start.sample; const samplepos_t presnap = start.sample;
samplepos_t test = max_samplepos; //for each snap, we'll use this value samplepos_t test = max_samplepos; // for each snap, we'll use this value
samplepos_t dist = max_samplepos; //this records the distance of the best snap result we've found so far samplepos_t dist = max_samplepos; // this records the distance of the best snap result we've found so far
samplepos_t best = max_samplepos; //this records the best snap-result we've found so far samplepos_t best = max_samplepos; // this records the best snap-result we've found so far
//check snap-to-marker /* check snap-to-marker */
if ( UIConfiguration::instance().get_snap_to_marks() ) { if (UIConfiguration::instance().get_snap_to_marks()) {
if (for_mark) { if (for_mark) {
return; return;
} }
test = marker_snap_to_internal ( presnap, direction ); test = marker_snap_to_internal (presnap, direction);
check_best_snap(presnap, test, dist, best); check_best_snap(presnap, test, dist, best);
} }
//check snap-to-region-{start/end/sync} /* check snap-to-region-{start/end/sync} */
if ( UIConfiguration::instance().get_snap_to_region_start() || UIConfiguration::instance().get_snap_to_region_end() || UIConfiguration::instance().get_snap_to_region_sync() ) { if (UIConfiguration::instance().get_snap_to_region_start() || UIConfiguration::instance().get_snap_to_region_end() || UIConfiguration::instance().get_snap_to_region_sync()) {
if (!region_boundary_cache.empty()) { if (!region_boundary_cache.empty()) {
vector<samplepos_t>::iterator prev = region_boundary_cache.end (); vector<samplepos_t>::iterator prev = region_boundary_cache.end ();
@ -2864,20 +2867,21 @@ Editor::snap_to_internal (MusicSample& start, RoundMode direction, SnapPref pref
check_best_snap(presnap, test, dist, best); check_best_snap(presnap, test, dist, best);
} }
//check Grid /* check Grid */
if (UIConfiguration::instance().get_snap_to_grid() && (_grid_type != GridTypeNone) ) { if (UIConfiguration::instance().get_snap_to_grid() && (_grid_type != GridTypeNone)) {
//if SnapToGrid is selected, the user wants to prioritize the music grid /* if SnapToGrid is selected, the user wants to prioritize the music grid
//in this case we should reset the best distance, so Grid will prevail * in this case we should reset the best distance, so Grid will prevail */
dist = max_samplepos; dist = max_samplepos;
test = snap_to_grid (grid_marks, presnap, direction); test = snap_to_grid (grid_marks, presnap, direction);
check_best_snap(presnap, test, dist, best); check_best_snap(presnap, test, dist, best);
} }
//now check "magnetic" state: is the grid within reasonable on-screen distance to trigger a snap? /* now check "magnetic" state: is the grid within reasonable on-screen distance to trigger a snap?
//this also helps to avoid snapping to somewhere the user can't see. ( i.e.: I clicked on a region and it disappeared!! ) * this also helps to avoid snapping to somewhere the user can't see. (i.e.: I clicked on a region and it disappeared!!)
//ToDo: perhaps this should only occur if EditPointMouse? * ToDo: Perhaps this should only occur if EditPointMouse?
*/
int snap_threshold_s = pixel_to_sample(UIConfiguration::instance().get_snap_threshold()); int snap_threshold_s = pixel_to_sample(UIConfiguration::instance().get_snap_threshold());
if (ensure_snap) { if (ensure_snap) {
start.set (best, 0); start.set (best, 0);
@ -3081,13 +3085,13 @@ Editor::setup_toolbar ()
toolbar_hbox.set_border_width (2); toolbar_hbox.set_border_width (2);
ArdourWidgets::ArdourDropShadow *tool_shadow = manage (new (ArdourWidgets::ArdourDropShadow)); ArdourWidgets::ArdourDropShadow *tool_shadow = manage (new (ArdourWidgets::ArdourDropShadow));
tool_shadow->set_size_request( 4, -1 ); tool_shadow->set_size_request (4, -1);
tool_shadow->show(); tool_shadow->show();
ebox_hpacker.pack_start (*tool_shadow, false, false); ebox_hpacker.pack_start (*tool_shadow, false, false);
ebox_hpacker.pack_start(ebox_vpacker, true, true); ebox_hpacker.pack_start(ebox_vpacker, true, true);
Gtk::EventBox* spacer = manage (new Gtk::EventBox); //extra space under the mouse toolbar, for aesthetics Gtk::EventBox* spacer = manage (new Gtk::EventBox); // extra space under the mouse toolbar, for aesthetics
spacer->set_name("EditorWindow"); spacer->set_name("EditorWindow");
spacer->set_size_request(-1,4); spacer->set_size_request(-1,4);
spacer->show(); spacer->show();
@ -3108,8 +3112,6 @@ Editor::setup_toolbar ()
toolbar_hbox.pack_start (*nudge_box, false, false); toolbar_hbox.pack_start (*nudge_box, false, false);
//zoom tools on right ege
toolbar_hbox.pack_end (_zoom_box, false, false, 2); toolbar_hbox.pack_end (_zoom_box, false, false, 2);
toolbar_hbox.pack_end (*(manage (new ArdourVSpacer ())), false, false, 3); toolbar_hbox.pack_end (*(manage (new ArdourVSpacer ())), false, false, 3);
@ -3126,10 +3128,10 @@ Editor::build_edit_point_menu ()
{ {
using namespace Menu_Helpers; using namespace Menu_Helpers;
edit_point_selector.AddMenuElem (MenuElem ( edit_point_strings[(int)EditAtPlayhead], sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_selection_done), (EditPoint) EditAtPlayhead))); edit_point_selector.AddMenuElem (MenuElem (edit_point_strings[(int)EditAtPlayhead], sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_selection_done), (EditPoint) EditAtPlayhead)));
if(!Profile->get_mixbus()) if(!Profile->get_mixbus())
edit_point_selector.AddMenuElem (MenuElem ( edit_point_strings[(int)EditAtSelectedMarker], sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_selection_done), (EditPoint) EditAtSelectedMarker))); edit_point_selector.AddMenuElem (MenuElem (edit_point_strings[(int)EditAtSelectedMarker], sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_selection_done), (EditPoint) EditAtSelectedMarker)));
edit_point_selector.AddMenuElem (MenuElem ( edit_point_strings[(int)EditAtMouse], sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_selection_done), (EditPoint) EditAtMouse))); edit_point_selector.AddMenuElem (MenuElem (edit_point_strings[(int)EditAtMouse], sigc::bind (sigc::mem_fun(*this, &Editor::edit_point_selection_done), (EditPoint) EditAtMouse)));
set_size_request_to_display_given_text (edit_point_selector, edit_point_strings, COMBO_TRIANGLE_WIDTH, 2); set_size_request_to_display_given_text (edit_point_selector, edit_point_strings, COMBO_TRIANGLE_WIDTH, 2);
} }
@ -3139,10 +3141,10 @@ Editor::build_edit_mode_menu ()
{ {
using namespace Menu_Helpers; using namespace Menu_Helpers;
edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_strings[(int)Slide], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Slide))); edit_mode_selector.AddMenuElem (MenuElem (edit_mode_strings[(int)Slide], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Slide)));
// edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_strings[(int)Splice], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Splice))); edit_mode_selector.AddMenuElem (MenuElem (edit_mode_strings[(int)Ripple], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Ripple)));
edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_strings[(int)Ripple], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Ripple))); edit_mode_selector.AddMenuElem (MenuElem (edit_mode_strings[(int)Lock], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Lock)));
edit_mode_selector.AddMenuElem (MenuElem ( edit_mode_strings[(int)Lock], sigc::bind (sigc::mem_fun(*this, &Editor::edit_mode_selection_done), (EditMode) Lock))); /* Note: Splice was removed */
set_size_request_to_display_given_text (edit_mode_selector, edit_mode_strings, COMBO_TRIANGLE_WIDTH, 2); set_size_request_to_display_given_text (edit_mode_selector, edit_mode_strings, COMBO_TRIANGLE_WIDTH, 2);
} }
@ -3152,54 +3154,54 @@ Editor::build_grid_type_menu ()
{ {
using namespace Menu_Helpers; using namespace Menu_Helpers;
//main grid: bars, quarter-notes, etc /* main grid: bars, quarter-notes, etc */
grid_type_selector.AddMenuElem (MenuElem ( grid_type_strings[(int)GridTypeNone], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeNone))); grid_type_selector.AddMenuElem (MenuElem (grid_type_strings[(int)GridTypeNone], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeNone)));
grid_type_selector.AddMenuElem (MenuElem ( grid_type_strings[(int)GridTypeBar], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBar))); grid_type_selector.AddMenuElem (MenuElem (grid_type_strings[(int)GridTypeBar], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBar)));
grid_type_selector.AddMenuElem (MenuElem ( grid_type_strings[(int)GridTypeBeat], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeat))); grid_type_selector.AddMenuElem (MenuElem (grid_type_strings[(int)GridTypeBeat], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeat)));
grid_type_selector.AddMenuElem (MenuElem ( grid_type_strings[(int)GridTypeBeatDiv2], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv2))); grid_type_selector.AddMenuElem (MenuElem (grid_type_strings[(int)GridTypeBeatDiv2], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv2)));
grid_type_selector.AddMenuElem (MenuElem ( grid_type_strings[(int)GridTypeBeatDiv4], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv4))); grid_type_selector.AddMenuElem (MenuElem (grid_type_strings[(int)GridTypeBeatDiv4], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv4)));
grid_type_selector.AddMenuElem (MenuElem ( grid_type_strings[(int)GridTypeBeatDiv8], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv8))); grid_type_selector.AddMenuElem (MenuElem (grid_type_strings[(int)GridTypeBeatDiv8], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv8)));
grid_type_selector.AddMenuElem (MenuElem ( grid_type_strings[(int)GridTypeBeatDiv16], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv16))); grid_type_selector.AddMenuElem (MenuElem (grid_type_strings[(int)GridTypeBeatDiv16], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv16)));
grid_type_selector.AddMenuElem (MenuElem ( grid_type_strings[(int)GridTypeBeatDiv32], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv32))); grid_type_selector.AddMenuElem (MenuElem (grid_type_strings[(int)GridTypeBeatDiv32], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv32)));
//triplet grid /* triplet grid */
grid_type_selector.AddMenuElem(SeparatorElem()); grid_type_selector.AddMenuElem(SeparatorElem());
Gtk::Menu *_triplet_menu = manage (new Menu); Gtk::Menu *_triplet_menu = manage (new Menu);
MenuList& triplet_items (_triplet_menu->items()); MenuList& triplet_items (_triplet_menu->items());
{ {
triplet_items.push_back( MenuElem( grid_type_strings[(int)GridTypeBeatDiv3], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv3) )); triplet_items.push_back (MenuElem (grid_type_strings[(int)GridTypeBeatDiv3], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv3)));
triplet_items.push_back( MenuElem( grid_type_strings[(int)GridTypeBeatDiv6], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv6) )); triplet_items.push_back (MenuElem (grid_type_strings[(int)GridTypeBeatDiv6], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv6)));
triplet_items.push_back( MenuElem( grid_type_strings[(int)GridTypeBeatDiv12], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv12) )); triplet_items.push_back (MenuElem (grid_type_strings[(int)GridTypeBeatDiv12], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv12)));
triplet_items.push_back( MenuElem( grid_type_strings[(int)GridTypeBeatDiv24], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv24) )); triplet_items.push_back (MenuElem (grid_type_strings[(int)GridTypeBeatDiv24], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv24)));
} }
grid_type_selector.AddMenuElem (Menu_Helpers::MenuElem (_("Triplets"), *_triplet_menu)); grid_type_selector.AddMenuElem (Menu_Helpers::MenuElem (_("Triplets"), *_triplet_menu));
//quintuplet grid /* quintuplet grid */
Gtk::Menu *_quintuplet_menu = manage (new Menu); Gtk::Menu *_quintuplet_menu = manage (new Menu);
MenuList& quintuplet_items (_quintuplet_menu->items()); MenuList& quintuplet_items (_quintuplet_menu->items());
{ {
quintuplet_items.push_back( MenuElem( grid_type_strings[(int)GridTypeBeatDiv5], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv5) )); quintuplet_items.push_back (MenuElem (grid_type_strings[(int)GridTypeBeatDiv5], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv5)));
quintuplet_items.push_back( MenuElem( grid_type_strings[(int)GridTypeBeatDiv10], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv10) )); quintuplet_items.push_back (MenuElem (grid_type_strings[(int)GridTypeBeatDiv10], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv10)));
quintuplet_items.push_back( MenuElem( grid_type_strings[(int)GridTypeBeatDiv20], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv20) )); quintuplet_items.push_back (MenuElem (grid_type_strings[(int)GridTypeBeatDiv20], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv20)));
} }
grid_type_selector.AddMenuElem (Menu_Helpers::MenuElem (_("Quintuplets"), *_quintuplet_menu)); grid_type_selector.AddMenuElem (Menu_Helpers::MenuElem (_("Quintuplets"), *_quintuplet_menu));
//septuplet grid /* septuplet grid */
Gtk::Menu *_septuplet_menu = manage (new Menu); Gtk::Menu *_septuplet_menu = manage (new Menu);
MenuList& septuplet_items (_septuplet_menu->items()); MenuList& septuplet_items (_septuplet_menu->items());
{ {
septuplet_items.push_back( MenuElem( grid_type_strings[(int)GridTypeBeatDiv7], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv7) )); septuplet_items.push_back (MenuElem (grid_type_strings[(int)GridTypeBeatDiv7], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv7)));
septuplet_items.push_back( MenuElem( grid_type_strings[(int)GridTypeBeatDiv14], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv14) )); septuplet_items.push_back (MenuElem (grid_type_strings[(int)GridTypeBeatDiv14], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv14)));
septuplet_items.push_back( MenuElem( grid_type_strings[(int)GridTypeBeatDiv28], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv28) )); septuplet_items.push_back (MenuElem (grid_type_strings[(int)GridTypeBeatDiv28], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeBeatDiv28)));
} }
grid_type_selector.AddMenuElem (Menu_Helpers::MenuElem (_("Septuplets"), *_septuplet_menu)); grid_type_selector.AddMenuElem (Menu_Helpers::MenuElem (_("Septuplets"), *_septuplet_menu));
grid_type_selector.AddMenuElem(SeparatorElem()); grid_type_selector.AddMenuElem(SeparatorElem());
grid_type_selector.AddMenuElem (MenuElem ( grid_type_strings[(int)GridTypeSmpte], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeSmpte))); grid_type_selector.AddMenuElem (MenuElem (grid_type_strings[(int)GridTypeSmpte], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeSmpte)));
grid_type_selector.AddMenuElem (MenuElem ( grid_type_strings[(int)GridTypeMinSec], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeMinSec))); grid_type_selector.AddMenuElem (MenuElem (grid_type_strings[(int)GridTypeMinSec], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeMinSec)));
grid_type_selector.AddMenuElem (MenuElem ( grid_type_strings[(int)GridTypeSamples], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeSamples))); grid_type_selector.AddMenuElem (MenuElem (grid_type_strings[(int)GridTypeSamples], sigc::bind (sigc::mem_fun(*this, &Editor::grid_type_selection_done), (GridType) GridTypeSamples)));
set_size_request_to_display_given_text (grid_type_selector, _("Long Grid"), COMBO_TRIANGLE_WIDTH, 2); //problem: some of the rarely-used grid names are very long. Just do something arbitary, translators: rename this if needed set_size_request_to_display_given_text (grid_type_selector, _("Long Grid"), COMBO_TRIANGLE_WIDTH, 2); // problem: some of the rarely-used grid names are very long. Just do something arbitary, translators: rename this if needed
} }
void void
@ -3377,16 +3379,15 @@ Editor::commit_reversible_selection_op ()
if (selection_op_cmd_depth == 1) { if (selection_op_cmd_depth == 1) {
if (selection_op_history_it > 0 && selection_op_history_it < selection_op_history.size()) { if (selection_op_history_it > 0 && selection_op_history_it < selection_op_history.size()) {
/** /* The user has undone some selection ops and then made a new one,
The user has undone some selection ops and then made a new one, * making anything earlier in the list invalid.
making anything earlier in the list invalid. */
*/
list<XMLNode *>::iterator it = selection_op_history.begin(); list<XMLNode *>::iterator it = selection_op_history.begin();
list<XMLNode *>::iterator e_it = it; list<XMLNode *>::iterator e_it = it;
advance (e_it, selection_op_history_it); advance (e_it, selection_op_history_it);
for ( ; it != e_it; ++it) { for (; it != e_it; ++it) {
delete *it; delete *it;
} }
selection_op_history.erase (selection_op_history.begin(), e_it); selection_op_history.erase (selection_op_history.begin(), e_it);
@ -3531,7 +3532,7 @@ Editor::duplicate_range (bool with_dialog)
RegionSelection rs = get_regions_from_selection_and_entered (); RegionSelection rs = get_regions_from_selection_and_entered ();
if ( selection->time.length() == 0 && rs.empty()) { if (selection->time.length() == 0 && rs.empty()) {
return; return;
} }
@ -3614,9 +3615,9 @@ Editor::cycle_edit_mode ()
} }
void void
Editor::edit_mode_selection_done ( EditMode m ) Editor::edit_mode_selection_done (EditMode m)
{ {
Config->set_edit_mode ( m ); Config->set_edit_mode (m);
} }
void void
@ -3664,7 +3665,7 @@ Editor::cycle_edit_point (bool with_marker)
void void
Editor::edit_point_selection_done (EditPoint ep) Editor::edit_point_selection_done (EditPoint ep)
{ {
set_edit_point_preference ( ep ); set_edit_point_preference (ep);
} }
void void
@ -3672,18 +3673,18 @@ Editor::build_zoom_focus_menu ()
{ {
using namespace Menu_Helpers; using namespace Menu_Helpers;
zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusLeft], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusLeft))); zoom_focus_selector.AddMenuElem (MenuElem (zoom_focus_strings[(int)ZoomFocusLeft], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusLeft)));
zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusRight], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusRight))); zoom_focus_selector.AddMenuElem (MenuElem (zoom_focus_strings[(int)ZoomFocusRight], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusRight)));
zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusCenter], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusCenter))); zoom_focus_selector.AddMenuElem (MenuElem (zoom_focus_strings[(int)ZoomFocusCenter], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusCenter)));
zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusPlayhead], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusPlayhead))); zoom_focus_selector.AddMenuElem (MenuElem (zoom_focus_strings[(int)ZoomFocusPlayhead], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusPlayhead)));
zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusMouse], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusMouse))); zoom_focus_selector.AddMenuElem (MenuElem (zoom_focus_strings[(int)ZoomFocusMouse], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusMouse)));
zoom_focus_selector.AddMenuElem (MenuElem ( zoom_focus_strings[(int)ZoomFocusEdit], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusEdit))); zoom_focus_selector.AddMenuElem (MenuElem (zoom_focus_strings[(int)ZoomFocusEdit], sigc::bind (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done), (ZoomFocus) ZoomFocusEdit)));
set_size_request_to_display_given_text (zoom_focus_selector, zoom_focus_strings, COMBO_TRIANGLE_WIDTH, 2); set_size_request_to_display_given_text (zoom_focus_selector, zoom_focus_strings, COMBO_TRIANGLE_WIDTH, 2);
} }
void void
Editor::zoom_focus_selection_done ( ZoomFocus f ) Editor::zoom_focus_selection_done (ZoomFocus f)
{ {
RefPtr<RadioAction> ract = zoom_focus_action (f); RefPtr<RadioAction> ract = zoom_focus_action (f);
if (ract) { if (ract) {
@ -3740,13 +3741,13 @@ Editor::build_track_count_menu ()
void void
Editor::set_zoom_preset (int64_t ms) Editor::set_zoom_preset (int64_t ms)
{ {
if ( ms <= 0 ) { if (ms <= 0) {
temporal_zoom_session(); temporal_zoom_session();
return; return;
} }
ARDOUR::samplecnt_t const sample_rate = ARDOUR::AudioEngine::instance()->sample_rate(); ARDOUR::samplecnt_t const sample_rate = ARDOUR::AudioEngine::instance()->sample_rate();
temporal_zoom( (sample_rate * ms / 1000) / _visible_canvas_width ); temporal_zoom ((sample_rate * ms / 1000) / _visible_canvas_width);
} }
void void
@ -3813,7 +3814,7 @@ void
Editor::override_visible_track_count () Editor::override_visible_track_count ()
{ {
_visible_track_count = -1; _visible_track_count = -1;
visible_tracks_selector.set_text ( _("*") ); visible_tracks_selector.set_text (_("*"));
} }
bool bool
@ -3883,13 +3884,13 @@ Editor::cycle_zoom_focus ()
void void
Editor::update_grid () Editor::update_grid ()
{ {
if ( grid_musical() ) { if (grid_musical()) {
std::vector<TempoMap::BBTPoint> grid; std::vector<TempoMap::BBTPoint> grid;
if (bbt_ruler_scale != bbt_show_many) { if (bbt_ruler_scale != bbt_show_many) {
compute_current_bbt_points (grid, _leftmost_sample, _leftmost_sample + current_page_samples()); compute_current_bbt_points (grid, _leftmost_sample, _leftmost_sample + current_page_samples());
} }
maybe_draw_grid_lines (); maybe_draw_grid_lines ();
} else if ( grid_nonmusical() ) { } else if (grid_nonmusical()) {
maybe_draw_grid_lines (); maybe_draw_grid_lines ();
} else { } else {
hide_grid_lines (); hide_grid_lines ();
@ -3936,8 +3937,7 @@ Editor::set_stationary_playhead (bool yn)
{ {
if (_stationary_playhead != yn) { if (_stationary_playhead != yn) {
if ((_stationary_playhead = yn) == true) { if ((_stationary_playhead = yn) == true) {
/* catch up */ /* catch up -- FIXME need a 3.0 equivalent of this 2.X call */
// FIXME need a 3.0 equivalent of this 2.X call
// update_current_screen (); // update_current_screen ();
} }
instant_save (); instant_save ();
@ -4099,7 +4099,7 @@ Editor::playlist_deletion_dialog (boost::shared_ptr<Playlist> pl)
dialog.add_button (_("Keep Remaining"), RESPONSE_NO); // ditto dialog.add_button (_("Keep Remaining"), RESPONSE_NO); // ditto
dialog.add_button (_("Cancel"), RESPONSE_CANCEL); dialog.add_button (_("Cancel"), RESPONSE_CANCEL);
// by default gtk uses the left most button /* by default gtk uses the left most button */
keep->grab_focus (); keep->grab_focus ();
switch (dialog.run ()) { switch (dialog.run ()) {
@ -4397,8 +4397,7 @@ Editor::redo_visual_state ()
VisualState* vs = redo_visual_stack.back(); VisualState* vs = redo_visual_stack.back();
redo_visual_stack.pop_back(); redo_visual_stack.pop_back();
// can 'vs' really be 0? Is there a place that puts NULL pointers onto the stack? /* XXX: can 'vs' really be 0? Is there a place that puts NULL pointers onto the stack? */
// why do we check here?
undo_visual_stack.push_back (current_visual_state (vs ? (vs->gui_state != 0) : false)); undo_visual_stack.push_back (current_visual_state (vs ? (vs->gui_state != 0) : false));
if (vs) { if (vs) {
@ -4513,7 +4512,7 @@ void
Editor::ensure_visual_change_idle_handler () Editor::ensure_visual_change_idle_handler ()
{ {
if (pending_visual_change.idle_handler_id < 0) { if (pending_visual_change.idle_handler_id < 0) {
// see comment in add_to_idle_resize above. /* see comment in add_to_idle_resize above. */
pending_visual_change.idle_handler_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE + 10, _idle_visual_changer, this, NULL); pending_visual_change.idle_handler_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE + 10, _idle_visual_changer, this, NULL);
pending_visual_change.being_handled = false; pending_visual_change.being_handled = false;
} }
@ -4608,16 +4607,14 @@ Editor::visual_changer (const VisualChange& vc)
} }
if (!(vc.pending & VisualChange::ZoomLevel)) { if (!(vc.pending & VisualChange::ZoomLevel)) {
/** /* If the canvas is not being zoomed then the canvas items will not change
* If the canvas is not being zoomed then the canvas items will not change
* and cause Item::prepare_for_render to be called so do it here manually. * and cause Item::prepare_for_render to be called so do it here manually.
*
* Not ideal, but I can't think of a better solution atm. * Not ideal, but I can't think of a better solution atm.
*/ */
_track_canvas->prepare_for_render(); _track_canvas->prepare_for_render();
} }
// If we are only scrolling vertically there is no need to update these /* If we are only scrolling vertically there is no need to update these */
if (vc.pending != VisualChange::YOrigin) { if (vc.pending != VisualChange::YOrigin) {
update_fixed_rulers (); update_fixed_rulers ();
redisplay_grid (true); redisplay_grid (true);
@ -4668,11 +4665,11 @@ Editor::get_preferred_edit_position (EditIgnoreOption ignore, bool from_context_
return entered_marker->position(); return entered_marker->position();
} }
if ( (ignore==EDIT_IGNORE_PHEAD) && ep == EditAtPlayhead) { if ((ignore == EDIT_IGNORE_PHEAD) && ep == EditAtPlayhead) {
ep = EditAtSelectedMarker; ep = EditAtSelectedMarker;
} }
if ( (ignore==EDIT_IGNORE_MOUSE) && ep == EditAtMouse) { if ((ignore == EDIT_IGNORE_MOUSE) && ep == EditAtMouse) {
ep = EditAtPlayhead; ep = EditAtPlayhead;
} }
@ -4864,13 +4861,13 @@ Editor::get_regions_from_selection_and_edit_point (EditIgnoreOption ignore, bool
{ {
RegionSelection regions; RegionSelection regions;
if (_edit_point == EditAtMouse && entered_regionview && selection->tracks.empty() && selection->regions.empty() ) { if (_edit_point == EditAtMouse && entered_regionview && selection->tracks.empty() && selection->regions.empty()) {
regions.add (entered_regionview); regions.add (entered_regionview);
} else { } else {
regions = selection->regions; regions = selection->regions;
} }
if ( regions.empty() ) { if (regions.empty()) {
TrackViewList tracks = selection->tracks; TrackViewList tracks = selection->tracks;
if (!tracks.empty()) { if (!tracks.empty()) {
@ -4901,13 +4898,13 @@ Editor::get_regions_from_selection_and_mouse (samplepos_t pos)
{ {
RegionSelection regions; RegionSelection regions;
if (entered_regionview && selection->tracks.empty() && selection->regions.empty() ) { if (entered_regionview && selection->tracks.empty() && selection->regions.empty()) {
regions.add (entered_regionview); regions.add (entered_regionview);
} else { } else {
regions = selection->regions; regions = selection->regions;
} }
if ( regions.empty() ) { if (regions.empty()) {
TrackViewList tracks = selection->tracks; TrackViewList tracks = selection->tracks;
if (!tracks.empty()) { if (!tracks.empty()) {
@ -5093,7 +5090,7 @@ Editor::first_idle ()
selection->set (rs); selection->set (rs);
// first idle adds route children (automation tracks), so we need to redisplay here /* first idle adds route children (automation tracks), so we need to redisplay here */
_routes->redisplay (); _routes->redisplay ();
delete dialog; delete dialog;
@ -5464,7 +5461,7 @@ Editor::hide_track_in_display (TimeAxisView* tv, bool apply_to_selection)
PresentationInfo::ChangeSuspender cs; PresentationInfo::ChangeSuspender cs;
if (apply_to_selection) { if (apply_to_selection) {
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ) { for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end();) {
TrackSelection::iterator j = i; TrackSelection::iterator j = i;
++j; ++j;
@ -5477,7 +5474,7 @@ Editor::hide_track_in_display (TimeAxisView* tv, bool apply_to_selection)
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv); RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
if (rtv && current_mixer_strip && (rtv->route() == current_mixer_strip->route())) { if (rtv && current_mixer_strip && (rtv->route() == current_mixer_strip->route())) {
// this will hide the mixer strip /* this will hide the mixer strip */
set_selected_mixer_strip (*tv); set_selected_mixer_strip (*tv);
} }
@ -5792,27 +5789,28 @@ Editor::super_rapid_screen_update ()
_last_update_time = now; _last_update_time = now;
} }
//snapped cursor stuff ( the snapped_cursor shows where an operation is going to occur ) /* snapped cursor stuff (the snapped_cursor shows where an operation is going to occur) */
bool ignored; bool ignored;
MusicSample where (sample, 0); MusicSample where (sample, 0);
if ( !UIConfiguration::instance().get_show_snapped_cursor() ) { if (!UIConfiguration::instance().get_show_snapped_cursor()) {
snapped_cursor->hide (); snapped_cursor->hide ();
} else if ( _edit_point == EditAtPlayhead && !_dragging_playhead) { } else if (_edit_point == EditAtPlayhead && !_dragging_playhead) {
snap_to (where); // can't use snap_to_with_modifier? snap_to (where); // can't use snap_to_with_modifier?
snapped_cursor->set_position (where.sample); snapped_cursor->set_position (where.sample);
snapped_cursor->show (); snapped_cursor->show ();
} else if ( _edit_point == EditAtSelectedMarker ) { } else if (_edit_point == EditAtSelectedMarker) {
//NOTE: I don't think EditAtSelectedMarker should snap. they are what they are. /* NOTE: I don't think EditAtSelectedMarker should snap. They are what they are.
//however, the current editing code -does- snap so I'll draw it that way for now. * however, the current editing code -does- snap so I'll draw it that way for now.
if ( !selection->markers.empty() ) { */
if (!selection->markers.empty()) {
MusicSample ms (selection->markers.front()->position(), 0); MusicSample ms (selection->markers.front()->position(), 0);
snap_to (ms); // should use snap_to_with_modifier? snap_to (ms); // should use snap_to_with_modifier?
snapped_cursor->set_position ( ms.sample ); snapped_cursor->set_position (ms.sample);
snapped_cursor->show (); snapped_cursor->show ();
} }
} else if (mouse_sample (where.sample, ignored)) { //cursor is in the editing canvas. show it. } else if (mouse_sample (where.sample, ignored)) { // cursor is in the editing canvas. show it.
snapped_cursor->show (); snapped_cursor->show ();
} else { //mouse is out of the editing canvas. hide the snapped_cursor } else { // mouse is out of the editing canvas. hide the snapped_cursor
snapped_cursor->hide (); snapped_cursor->hide ();
} }
@ -5865,7 +5863,7 @@ Editor::super_rapid_screen_update ()
if (target <= 0.0) { if (target <= 0.0) {
target = 0.0; target = 0.0;
} }
// compare to EditorCursor::set_position() /* compare to EditorCursor::set_position() */
double const old_pos = sample_to_pixel_unrounded (_leftmost_sample); double const old_pos = sample_to_pixel_unrounded (_leftmost_sample);
double const new_pos = sample_to_pixel_unrounded (target); double const new_pos = sample_to_pixel_unrounded (target);
if (rint (new_pos) != rint (old_pos)) { if (rint (new_pos) != rint (old_pos)) {

View file

@ -584,7 +584,7 @@ Editor::autoscroll_active () const
} }
std::pair <samplepos_t,samplepos_t> std::pair <samplepos_t,samplepos_t>
Editor::session_gui_extents ( bool use_extra ) const Editor::session_gui_extents (bool use_extra) const
{ {
if (!_session) { if (!_session) {
return std::pair <samplepos_t,samplepos_t>(max_samplepos,0); return std::pair <samplepos_t,samplepos_t>(max_samplepos,0);
@ -593,15 +593,16 @@ Editor::session_gui_extents ( bool use_extra ) const
samplecnt_t session_extent_start = _session->current_start_sample(); samplecnt_t session_extent_start = _session->current_start_sample();
samplecnt_t session_extent_end = _session->current_end_sample(); samplecnt_t session_extent_end = _session->current_end_sample();
//calculate the extents of all regions in every playlist /* calculate the extents of all regions in every playlist
//NOTE: we should listen to playlists, and cache these values so we don't calculate them every time. * NOTE: we should listen to playlists, and cache these values so we don't calculate them every time.
*/
{ {
boost::shared_ptr<RouteList> rl = _session->get_routes(); boost::shared_ptr<RouteList> rl = _session->get_routes();
for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) { for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*r); boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*r);
if (tr) { if (tr) {
boost::shared_ptr<Playlist> pl = tr->playlist(); boost::shared_ptr<Playlist> pl = tr->playlist();
if ( pl && !pl->all_regions_empty() ) { if (pl && !pl->all_regions_empty()) {
pair<samplepos_t, samplepos_t> e; pair<samplepos_t, samplepos_t> e;
e = pl->get_extent(); e = pl->get_extent();
if (e.first < session_extent_start) { if (e.first < session_extent_start) {
@ -615,16 +616,16 @@ Editor::session_gui_extents ( bool use_extra ) const
} }
} }
//ToDo: also incorporate automation regions (in case the session has no audio/midi but is just used for automating plugins or the like) /* ToDo: also incorporate automation regions (in case the session has no audio/midi but is just used for automating plugins or the like) */
//add additional time to the ui extents ( user-defined in config ) /* add additional time to the ui extents (user-defined in config) */
if (use_extra) { if (use_extra) {
samplecnt_t const extra = UIConfiguration::instance().get_extra_ui_extents_time() * 60 * _session->nominal_sample_rate(); samplecnt_t const extra = UIConfiguration::instance().get_extra_ui_extents_time() * 60 * _session->nominal_sample_rate();
session_extent_end += extra; session_extent_end += extra;
session_extent_start -= extra; session_extent_start -= extra;
} }
//range-check /* range-check */
if (session_extent_end > max_samplepos) { if (session_extent_end > max_samplepos) {
session_extent_end = max_samplepos; session_extent_end = max_samplepos;
} }
@ -1336,13 +1337,13 @@ Editor::which_canvas_cursor(ItemType type) const
cursor = _cursors->cross_hair; cursor = _cursors->cross_hair;
break; break;
case LeftFrameHandle: case LeftFrameHandle:
if ( effective_mouse_mode() == MouseObject ) // (smart mode): if the user is in the btm half, show the trim cursor if (effective_mouse_mode() == MouseObject) // (smart mode): if the user is in the btm half, show the trim cursor
cursor = which_trim_cursor (true); cursor = which_trim_cursor (true);
else else
cursor = _cursors->selector; // (smart mode): in the top half, just show the selection (range) cursor cursor = _cursors->selector; // (smart mode): in the top half, just show the selection (range) cursor
break; break;
case RightFrameHandle: case RightFrameHandle:
if ( effective_mouse_mode() == MouseObject ) //see above if (effective_mouse_mode() == MouseObject) // see above
cursor = which_trim_cursor (false); cursor = which_trim_cursor (false);
else else
cursor = _cursors->selector; cursor = _cursors->selector;

View file

@ -215,7 +215,7 @@ Editor::mouse_mode_object_range_toggled()
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act); Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
assert (tact); assert (tact);
set_mouse_mode(m, true); //call this so the button styles can get updated set_mouse_mode (m, true); // call this so the button styles can get updated
} }
bool bool
@ -227,7 +227,7 @@ Editor::snap_mode_button_clicked (GdkEventButton* ev)
} }
RCOptionEditor* rc_option_editor = ARDOUR_UI::instance()->get_rc_option_editor(); RCOptionEditor* rc_option_editor = ARDOUR_UI::instance()->get_rc_option_editor();
if ( rc_option_editor ) { if (rc_option_editor) {
ARDOUR_UI::instance()->show_tabbable (rc_option_editor); ARDOUR_UI::instance()->show_tabbable (rc_option_editor);
rc_option_editor->set_current_page (_("Editor/Snap")); rc_option_editor->set_current_page (_("Editor/Snap"));
} }
@ -271,8 +271,8 @@ Editor::set_mouse_mode (MouseMode m, bool force)
} }
if (ARDOUR::Profile->get_mixbus()) { if (ARDOUR::Profile->get_mixbus()) {
if ( m == MouseCut) m = MouseObject; if (m == MouseCut) m = MouseObject;
if ( m == MouseAudition) m = MouseRange; if (m == MouseAudition) m = MouseRange;
} }
Glib::RefPtr<Action> act = get_mouse_mode_action(m); Glib::RefPtr<Action> act = get_mouse_mode_action(m);
@ -282,15 +282,15 @@ Editor::set_mouse_mode (MouseMode m, bool force)
tact->set_active (false); tact->set_active (false);
tact->set_active (true); tact->set_active (true);
//NOTE: this will result in a call to mouse_mode_toggled which does the heavy lifting /* NOTE: this will result in a call to mouse_mode_toggled which does the heavy lifting */
} }
void void
Editor::mouse_mode_toggled (MouseMode m) Editor::mouse_mode_toggled (MouseMode m)
{ {
if (ARDOUR::Profile->get_mixbus()) { if (ARDOUR::Profile->get_mixbus()) {
if ( m == MouseCut) m = MouseObject; if (m == MouseCut) m = MouseObject;
if ( m == MouseAudition) m = MouseRange; if (m == MouseAudition) m = MouseRange;
} }
Glib::RefPtr<Action> act = get_mouse_mode_action(m); Glib::RefPtr<Action> act = get_mouse_mode_action(m);
@ -932,7 +932,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
break; break;
case StreamItem: case StreamItem:
//in the past, we created a new midi region here, but perhaps that is best left to the Draw mode /* in the past, we created a new midi region here, but perhaps that is best left to the Draw mode */
break; break;
case AutomationTrackItem: case AutomationTrackItem:
@ -977,11 +977,14 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case StartCrossFadeItem: case StartCrossFadeItem:
case EndCrossFadeItem: case EndCrossFadeItem:
/* we might allow user to grab inside the fade to trim a region with preserve_fade_anchor. for not this is not fully implemented */ /* we might allow user to grab inside the fade to trim a region with preserve_fade_anchor.
// if (!clicked_regionview->region()->locked()) { * For not this is not fully implemented */
// _drags->set (new TrimDrag (this, item, clicked_regionview, selection->regions.by_layer(), true), event); #if 0
// return true; if (!clicked_regionview->region()->locked()) {
// } _drags->set (new TrimDrag (this, item, clicked_regionview, selection->regions.by_layer(), true), event);
return true;
}
#endif
break; break;
case FeatureLineItem: case FeatureLineItem:
@ -1127,7 +1130,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
pair<TimeAxisView*, int> tvp = trackview_by_y_position (y, false); pair<TimeAxisView*, int> tvp = trackview_by_y_position (y, false);
if (tvp.first) { if (tvp.first) {
AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (tvp.first); AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (tvp.first);
if ( atv) { if (atv) {
/* smart "join" mode: drag automation */ /* smart "join" mode: drag automation */
_drags->set (new AutomationRangeDrag (this, atv, selection->time), event, _cursors->up_down); _drags->set (new AutomationRangeDrag (this, atv, selection->time), event, _cursors->up_down);
} }
@ -1600,7 +1603,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case CdMarkerBarItem: case CdMarkerBarItem:
if (!_dragging_playhead) { if (!_dragging_playhead) {
// if we get here then a dragged range wasn't done /* if we get here then a dragged range wasn't done */
snap_to_with_modifier (where, event, RoundNearest, SnapToAny, true); snap_to_with_modifier (where, event, RoundNearest, SnapToAny, true);
mouse_add_new_marker (where.sample, true); mouse_add_new_marker (where.sample, true);
} }
@ -1702,7 +1705,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
} else if (Keyboard::modifier_state_equals (event->button.state, Keyboard::ModifierMask (Keyboard::TertiaryModifier|Keyboard::SecondaryModifier))) { } else if (Keyboard::modifier_state_equals (event->button.state, Keyboard::ModifierMask (Keyboard::TertiaryModifier|Keyboard::SecondaryModifier))) {
lower_region (); lower_region ();
} else { } else {
// Button2 click is unused /* Button2 click is unused */
} }
return true; return true;
@ -2100,7 +2103,7 @@ Editor::motion_handler (ArdourCanvas::Item* /*item*/, GdkEvent* event, bool from
update_join_object_range_location (event->motion.y); update_join_object_range_location (event->motion.y);
//snapped_cursor stuff ( the snapped_cursor shows where an operation is going to occur ) /* snapped_cursor stuff (the snapped_cursor shows where an operation is going to occur) */
bool ignored; bool ignored;
MusicSample where (0, 0); MusicSample where (0, 0);
if (mouse_sample (where.sample, ignored)) { if (mouse_sample (where.sample, ignored)) {
@ -2108,7 +2111,7 @@ Editor::motion_handler (ArdourCanvas::Item* /*item*/, GdkEvent* event, bool from
set_snapped_cursor_position (where.sample); set_snapped_cursor_position (where.sample);
} }
//drags might also change the snapped_cursor location, because we are snapping the thing being dragged, not the actual mouse cursor /* drags might also change the snapped_cursor location, because we are snapping the thing being dragged, not the actual mouse cursor */
if (_drags->active ()) { if (_drags->active ()) {
return _drags->motion_handler (event, from_autoscroll); return _drags->motion_handler (event, from_autoscroll);
} }
@ -2421,7 +2424,7 @@ Editor::mouse_brush_insert_region (RegionView* rv, samplepos_t pos)
playlist->add_region (new_region, pos); playlist->add_region (new_region, pos);
_session->add_command (new StatefulDiffCommand (playlist)); _session->add_command (new StatefulDiffCommand (playlist));
// playlist is frozen, so we have to update manually XXX this is disgusting /* playlist is frozen, so we have to update manually XXX this is disgusting */
//playlist->RegionAdded (new_region); /* EMIT SIGNAL */ //playlist->RegionAdded (new_region); /* EMIT SIGNAL */
} }
@ -2559,16 +2562,15 @@ Editor::escape ()
} else { } else {
selection->clear (); selection->clear ();
//if session is playing a range, cancel that /* if session is playing a range, cancel that */
if (_session->get_play_range()) { if (_session->get_play_range()) {
_session->request_cancel_play_range(); _session->request_cancel_play_range();
} }
if ( _session->solo_selection_active() ) { if (_session->solo_selection_active()) {
StripableList sl; StripableList sl;
_session->solo_selection( sl, false ); _session->solo_selection (sl, false);
} }
} }
ARDOUR_UI::instance()->reset_focus (&contents()); ARDOUR_UI::instance()->reset_focus (&contents());
@ -2596,9 +2598,10 @@ Editor::update_join_object_range_location (double y)
if (entered_regionview) { if (entered_regionview) {
//ToDo: there is currently a bug here(?) /* TODO: there is currently a bug here(?)
//when we are inside a region fade handle, it acts as though we are in range mode because it is in the top half of the region * when we are inside a region fade handle, it acts as though we are in range mode because it is in the top half of the region
//can it be fixed here? * can it be fixed here?
*/
ArdourCanvas::Duple const item_space = entered_regionview->get_canvas_group()->canvas_to_item (ArdourCanvas::Duple (0, y)); ArdourCanvas::Duple const item_space = entered_regionview->get_canvas_group()->canvas_to_item (ArdourCanvas::Duple (0, y));
double const c = item_space.y / entered_regionview->height(); double const c = item_space.y / entered_regionview->height();

View file

@ -711,7 +711,7 @@ Editor::build_region_boundary_cache ()
//ToDo: maybe set a timer so we don't recalutate when lots of changes are coming in //ToDo: maybe set a timer so we don't recalutate when lots of changes are coming in
//ToDo: maybe somehow defer this until session is fully loaded. //ToDo: maybe somehow defer this until session is fully loaded.
if ( !_region_boundary_cache_dirty ) if (!_region_boundary_cache_dirty)
return; return;
samplepos_t pos = 0; samplepos_t pos = 0;
@ -728,16 +728,16 @@ Editor::build_region_boundary_cache ()
bool maybe_first_sample = false; bool maybe_first_sample = false;
if ( UIConfiguration::instance().get_snap_to_region_start() ) { if (UIConfiguration::instance().get_snap_to_region_start()) {
interesting_points.push_back (Start); interesting_points.push_back (Start);
maybe_first_sample = true; maybe_first_sample = true;
} }
if ( UIConfiguration::instance().get_snap_to_region_end() ) { if (UIConfiguration::instance().get_snap_to_region_end()) {
interesting_points.push_back (End); interesting_points.push_back (End);
} }
if ( UIConfiguration::instance().get_snap_to_region_sync() ) { if (UIConfiguration::instance().get_snap_to_region_sync()) {
interesting_points.push_back (SyncPoint); interesting_points.push_back (SyncPoint);
} }
@ -1963,12 +1963,12 @@ Editor::temporal_zoom_selection (Editing::ZoomAxis axes)
{ {
if (!selection) return; if (!selection) return;
if ( selection->regions.empty() && selection->time.empty() ) { if (selection->regions.empty() && selection->time.empty()) {
if (axes == Horizontal || axes == Both) { if (axes == Horizontal || axes == Both) {
temporal_zoom_step(true); temporal_zoom_step(true);
} }
if (axes == Vertical || axes == Both) { if (axes == Vertical || axes == Both) {
if ( !track_views.empty() ) { if (!track_views.empty()) {
TrackViewList tvl; TrackViewList tvl;
@ -1977,7 +1977,7 @@ Editor::temporal_zoom_selection (Editing::ZoomAxis axes)
const double btm = top + _visible_canvas_height + 10; const double btm = top + _visible_canvas_height + 10;
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) { for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
if ( (*iter)->covered_by_y_range (top, btm) ) { if ((*iter)->covered_by_y_range (top, btm)) {
tvl.push_back(*iter); tvl.push_back(*iter);
} }
} }
@ -5891,7 +5891,7 @@ Editor::toggle_record_enable ()
} }
StripableList StripableList
tracklist_to_stripables( TrackViewList list ) tracklist_to_stripables (TrackViewList list)
{ {
StripableList ret; StripableList ret;
@ -5899,7 +5899,7 @@ tracklist_to_stripables( TrackViewList list )
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> ((*i)); RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> ((*i));
if (rtv && rtv->is_track()) { if (rtv && rtv->is_track()) {
ret.push_back( rtv->track() ); ret.push_back (rtv->track());
} }
} }
@ -5911,25 +5911,25 @@ Editor::play_solo_selection (bool restart)
{ {
//note: session::solo_selection takes care of invalidating the region playlist //note: session::solo_selection takes care of invalidating the region playlist
if ( (!selection->tracks.empty()) && selection->time.length() > 0 ) { //a range is selected; solo the tracks and roll if ((!selection->tracks.empty()) && selection->time.length() > 0) { //a range is selected; solo the tracks and roll
StripableList sl = tracklist_to_stripables (selection->tracks); StripableList sl = tracklist_to_stripables (selection->tracks);
_session->solo_selection( sl, true ); _session->solo_selection (sl, true);
if ( restart ) { if (restart) {
samplepos_t start = selection->time.start(); samplepos_t start = selection->time.start();
samplepos_t end = selection->time.end_sample(); samplepos_t end = selection->time.end_sample();
_session->request_bounded_roll (start, end); _session->request_bounded_roll (start, end);
} }
} else if ( ! selection->tracks.empty() ) { //no range is selected, but tracks are selected; solo the tracks and roll } else if (! selection->tracks.empty()) { //no range is selected, but tracks are selected; solo the tracks and roll
StripableList sl = tracklist_to_stripables (selection->tracks); StripableList sl = tracklist_to_stripables (selection->tracks);
_session->solo_selection( sl, true ); _session->solo_selection (sl, true);
_session->request_cancel_play_range(); _session->request_cancel_play_range();
transition_to_rolling (true); transition_to_rolling (true);
} else if ( ! selection->regions.empty() ) { //solo any tracks with selected regions, and roll } else if (! selection->regions.empty()) { //solo any tracks with selected regions, and roll
StripableList sl = tracklist_to_stripables ( get_tracks_for_range_action() ); StripableList sl = tracklist_to_stripables (get_tracks_for_range_action());
_session->solo_selection( sl, true ); _session->solo_selection (sl, true);
_session->request_cancel_play_range(); _session->request_cancel_play_range();
transition_to_rolling (true); transition_to_rolling (true);
} else { } else {
@ -6621,7 +6621,7 @@ Editor::set_punch_start_from_edit_point ()
snap_to(start); snap_to(start);
//if there's not already a sensible selection endpoint, go "forever" //if there's not already a sensible selection endpoint, go "forever"
if (start.sample > end ) { if (start.sample > end) {
end = max_samplepos; end = max_samplepos;
} }
@ -6682,7 +6682,7 @@ Editor::set_loop_start_from_edit_point ()
snap_to (start); snap_to (start);
//if there's not already a sensible selection endpoint, go "forever" //if there's not already a sensible selection endpoint, go "forever"
if (start.sample > end ) { if (start.sample > end) {
end = max_samplepos; end = max_samplepos;
} }
@ -7132,7 +7132,7 @@ Editor::snap_regions_to_grid ()
(*r)->region()->clear_changes (); (*r)->region()->clear_changes ();
MusicSample start ((*r)->region()->first_sample (), 0); MusicSample start ((*r)->region()->first_sample (), 0);
snap_to (start, RoundNearest, SnapToGrid ); snap_to (start, RoundNearest, SnapToGrid);
(*r)->region()->set_position (start.sample, start.division); (*r)->region()->set_position (start.sample, start.division);
_session->add_command(new StatefulDiffCommand ((*r)->region())); _session->add_command(new StatefulDiffCommand ((*r)->region()));
} }
@ -7549,7 +7549,7 @@ edit your ardour.rc file to set the\n\
/* Route deletion calls Editor::timeaxisview_deleted() iteratively (for each deleted /* Route deletion calls Editor::timeaxisview_deleted() iteratively (for each deleted
* route). If the deleted route is currently displayed in the Editor-Mixer (highly * route). If the deleted route is currently displayed in the Editor-Mixer (highly
* likely because deletion requires selection) this will call * likely because deletion requires selection) this will call
* Editor::set_selected_mixer_strip () which is expensive ( MixerStrip::set_route() ). * Editor::set_selected_mixer_strip () which is expensive (MixerStrip::set_route()).
* It's likewise likely that the route that has just been displayed in the * It's likewise likely that the route that has just been displayed in the
* Editor-Mixer will be next in line for deletion. * Editor-Mixer will be next in line for deletion.
* *

View file

@ -209,7 +209,7 @@ Editor::popup_ruler_menu (samplepos_t where, ItemType t)
switch (t) { switch (t) {
case MarkerBarItem: case MarkerBarItem:
ruler_items.push_back (MenuElem (_("New location marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, false))); ruler_items.push_back (MenuElem (_("New location marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, false)));
ruler_items.push_back (MenuElem (_("Clear all locations"), sigc::mem_fun(*this, &Editor::clear_markers))); ruler_items.push_back (MenuElem (_("Clear all locations"), sigc::mem_fun(*this, &Editor::clear_markers)));
ruler_items.push_back (MenuElem (_("Unhide locations"), sigc::mem_fun(*this, &Editor::unhide_markers))); ruler_items.push_back (MenuElem (_("Unhide locations"), sigc::mem_fun(*this, &Editor::unhide_markers)));
break; break;
@ -227,15 +227,15 @@ Editor::popup_ruler_menu (samplepos_t where, ItemType t)
case CdMarkerBarItem: case CdMarkerBarItem:
// TODO // TODO
ruler_items.push_back (MenuElem (_("New CD track marker"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, true))); ruler_items.push_back (MenuElem (_("New CD track marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, true)));
break; break;
case TempoBarItem: case TempoBarItem:
ruler_items.push_back (MenuElem (_("New Tempo"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_tempo_event), where))); ruler_items.push_back (MenuElem (_("New Tempo"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_tempo_event), where)));
break; break;
case MeterBarItem: case MeterBarItem:
ruler_items.push_back (MenuElem (_("New Meter"), sigc::bind ( sigc::mem_fun(*this, &Editor::mouse_add_new_meter_event), where))); ruler_items.push_back (MenuElem (_("New Meter"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_meter_event), where)));
break; break;
case VideoBarItem: case VideoBarItem:
@ -245,11 +245,11 @@ Editor::popup_ruler_menu (samplepos_t where, ItemType t)
*/ */
//ruler_items.push_back (MenuElem (_("Timeline height"))); // heading //ruler_items.push_back (MenuElem (_("Timeline height"))); // heading
//static_cast<MenuItem*>(&ruler_items.back())->set_sensitive(false); //static_cast<MenuItem*>(&ruler_items.back())->set_sensitive(false);
ruler_items.push_back (CheckMenuElem (_("Large"), sigc::bind ( sigc::mem_fun(*this, &Editor::set_video_timeline_height), 6))); ruler_items.push_back (CheckMenuElem (_("Large"), sigc::bind (sigc::mem_fun(*this, &Editor::set_video_timeline_height), 6)));
if (videotl_bar_height == 6) { static_cast<Gtk::CheckMenuItem*>(&ruler_items.back())->set_active(true);} if (videotl_bar_height == 6) { static_cast<Gtk::CheckMenuItem*>(&ruler_items.back())->set_active(true);}
ruler_items.push_back (CheckMenuElem (_("Normal"), sigc::bind ( sigc::mem_fun(*this, &Editor::set_video_timeline_height), 4))); ruler_items.push_back (CheckMenuElem (_("Normal"), sigc::bind (sigc::mem_fun(*this, &Editor::set_video_timeline_height), 4)));
if (videotl_bar_height == 4) { static_cast<Gtk::CheckMenuItem*>(&ruler_items.back())->set_active(true);} if (videotl_bar_height == 4) { static_cast<Gtk::CheckMenuItem*>(&ruler_items.back())->set_active(true);}
ruler_items.push_back (CheckMenuElem (_("Small"), sigc::bind ( sigc::mem_fun(*this, &Editor::set_video_timeline_height), 3))); ruler_items.push_back (CheckMenuElem (_("Small"), sigc::bind (sigc::mem_fun(*this, &Editor::set_video_timeline_height), 3)));
if (videotl_bar_height == 3) { static_cast<Gtk::CheckMenuItem*>(&ruler_items.back())->set_active(true);} if (videotl_bar_height == 3) { static_cast<Gtk::CheckMenuItem*>(&ruler_items.back())->set_active(true);}
ruler_items.push_back (SeparatorElem ()); ruler_items.push_back (SeparatorElem ());
@ -815,9 +815,9 @@ Editor::metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdou
switch (timecode_ruler_scale) { switch (timecode_ruler_scale) {
case timecode_show_bits: case timecode_show_bits:
// Find timecode time of this sample (pos) with subframe accuracy // Find timecode time of this sample (pos) with subframe accuracy
_session->sample_to_timecode(pos, timecode, true /* use_offset */, true /* use_subframes */ ); _session->sample_to_timecode(pos, timecode, true /* use_offset */, true /* use_subframes */);
for (n = 0; n < timecode_nmarks; n++) { for (n = 0; n < timecode_nmarks; n++) {
_session->timecode_to_sample(timecode, pos, true /* use_offset */, true /* use_subframes */ ); _session->timecode_to_sample(timecode, pos, true /* use_offset */, true /* use_subframes */);
if ((timecode.subframes % timecode_mark_modulo) == 0) { if ((timecode.subframes % timecode_mark_modulo) == 0) {
if (timecode.subframes == 0) { if (timecode.subframes == 0) {
mark.style = ArdourCanvas::Ruler::Mark::Major; mark.style = ArdourCanvas::Ruler::Mark::Major;
@ -834,17 +834,17 @@ Editor::metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdou
mark.position = pos; mark.position = pos;
marks.push_back (mark); marks.push_back (mark);
// Increment subframes by one // Increment subframes by one
Timecode::increment_subframes( timecode, _session->config.get_subframes_per_frame() ); Timecode::increment_subframes (timecode, _session->config.get_subframes_per_frame());
} }
break; break;
case timecode_show_samples: case timecode_show_samples:
// Find timecode time of this sample (pos) // Find timecode time of this sample (pos)
_session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ ); _session->sample_to_timecode (pos, timecode, true /* use_offset */, false /* use_subframes */);
// Go to next whole sample down // Go to next whole sample down
Timecode::frames_floot( timecode ); Timecode::frames_floot (timecode);
for (n = 0; n < timecode_nmarks; n++) { for (n = 0; n < timecode_nmarks; n++) {
_session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ ); _session->timecode_to_sample (timecode, pos, true /* use_offset */, false /* use_subframes */);
if ((timecode.frames % timecode_mark_modulo) == 0) { if ((timecode.frames % timecode_mark_modulo) == 0) {
if (timecode.frames == 0) { if (timecode.frames == 0) {
mark.style = ArdourCanvas::Ruler::Mark::Major; mark.style = ArdourCanvas::Ruler::Mark::Major;
@ -860,17 +860,17 @@ Editor::metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdou
} }
mark.label = buf; mark.label = buf;
marks.push_back (mark); marks.push_back (mark);
Timecode::increment( timecode, _session->config.get_subframes_per_frame() ); Timecode::increment (timecode, _session->config.get_subframes_per_frame());
} }
break; break;
case timecode_show_seconds: case timecode_show_seconds:
// Find timecode time of this sample (pos) // Find timecode time of this sample (pos)
_session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ ); _session->sample_to_timecode (pos, timecode, true /* use_offset */, false /* use_subframes */);
// Go to next whole second down // Go to next whole second down
Timecode::seconds_floor( timecode ); Timecode::seconds_floor (timecode);
for (n = 0; n < timecode_nmarks; n++) { for (n = 0; n < timecode_nmarks; n++) {
_session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ ); _session->timecode_to_sample (timecode, pos, true /* use_offset */, false /* use_subframes */);
if ((timecode.seconds % timecode_mark_modulo) == 0) { if ((timecode.seconds % timecode_mark_modulo) == 0) {
if (timecode.seconds == 0) { if (timecode.seconds == 0) {
mark.style = ArdourCanvas::Ruler::Mark::Major; mark.style = ArdourCanvas::Ruler::Mark::Major;
@ -887,17 +887,17 @@ Editor::metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdou
} }
mark.label = buf; mark.label = buf;
marks.push_back (mark); marks.push_back (mark);
Timecode::increment_seconds( timecode, _session->config.get_subframes_per_frame() ); Timecode::increment_seconds (timecode, _session->config.get_subframes_per_frame());
} }
break; break;
case timecode_show_minutes: case timecode_show_minutes:
//Find timecode time of this sample (pos) //Find timecode time of this sample (pos)
_session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ ); _session->sample_to_timecode (pos, timecode, true /* use_offset */, false /* use_subframes */);
// Go to next whole minute down // Go to next whole minute down
Timecode::minutes_floor( timecode ); Timecode::minutes_floor (timecode);
for (n = 0; n < timecode_nmarks; n++) { for (n = 0; n < timecode_nmarks; n++) {
_session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ ); _session->timecode_to_sample (timecode, pos, true /* use_offset */, false /* use_subframes */);
if ((timecode.minutes % timecode_mark_modulo) == 0) { if ((timecode.minutes % timecode_mark_modulo) == 0) {
if (timecode.minutes == 0) { if (timecode.minutes == 0) {
mark.style = ArdourCanvas::Ruler::Mark::Major; mark.style = ArdourCanvas::Ruler::Mark::Major;
@ -912,16 +912,16 @@ Editor::metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdou
mark.label = buf; mark.label = buf;
mark.position = pos; mark.position = pos;
marks.push_back (mark); marks.push_back (mark);
Timecode::increment_minutes( timecode, _session->config.get_subframes_per_frame() ); Timecode::increment_minutes (timecode, _session->config.get_subframes_per_frame());
} }
break; break;
case timecode_show_hours: case timecode_show_hours:
// Find timecode time of this sample (pos) // Find timecode time of this sample (pos)
_session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ ); _session->sample_to_timecode (pos, timecode, true /* use_offset */, false /* use_subframes */);
// Go to next whole hour down // Go to next whole hour down
Timecode::hours_floor( timecode ); Timecode::hours_floor (timecode);
for (n = 0; n < timecode_nmarks; n++) { for (n = 0; n < timecode_nmarks; n++) {
_session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ ); _session->timecode_to_sample (timecode, pos, true /* use_offset */, false /* use_subframes */);
if ((timecode.hours % timecode_mark_modulo) == 0) { if ((timecode.hours % timecode_mark_modulo) == 0) {
mark.style = ArdourCanvas::Ruler::Mark::Major; mark.style = ArdourCanvas::Ruler::Mark::Major;
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
@ -932,17 +932,17 @@ Editor::metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdou
mark.label = buf; mark.label = buf;
mark.position = pos; mark.position = pos;
marks.push_back (mark); marks.push_back (mark);
Timecode::increment_hours( timecode, _session->config.get_subframes_per_frame() ); Timecode::increment_hours (timecode, _session->config.get_subframes_per_frame());
} }
break; break;
case timecode_show_many_hours: case timecode_show_many_hours:
// Find timecode time of this sample (pos) // Find timecode time of this sample (pos)
_session->sample_to_timecode(pos, timecode, true /* use_offset */, false /* use_subframes */ ); _session->sample_to_timecode (pos, timecode, true /* use_offset */, false /* use_subframes */);
// Go to next whole hour down // Go to next whole hour down
Timecode::hours_floor (timecode); Timecode::hours_floor (timecode);
for (n = 0; n < timecode_nmarks; ) { for (n = 0; n < timecode_nmarks;) {
_session->timecode_to_sample(timecode, pos, true /* use_offset */, false /* use_subframes */ ); _session->timecode_to_sample (timecode, pos, true /* use_offset */, false /* use_subframes */);
if ((timecode.hours % timecode_mark_modulo) == 0) { if ((timecode.hours % timecode_mark_modulo) == 0) {
mark.style = ArdourCanvas::Ruler::Mark::Major; mark.style = ArdourCanvas::Ruler::Mark::Major;
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames); snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
@ -1075,17 +1075,17 @@ Editor::compute_bbt_ruler_scale (samplepos_t lower, samplepos_t upper)
} }
//set upper limits on the beat_density based on the user's grid selection //set upper limits on the beat_density based on the user's grid selection
if ( _grid_type == GridTypeBar ) { if (_grid_type == GridTypeBar) {
beat_density = fmax (beat_density, 16.01); beat_density = fmax (beat_density, 16.01);
} else if ( _grid_type == GridTypeBeat ) { } else if (_grid_type == GridTypeBeat) {
beat_density = fmax (beat_density, 4.001); beat_density = fmax (beat_density, 4.001);
} else if ( _grid_type == GridTypeBeatDiv4) { } else if (_grid_type == GridTypeBeatDiv4) {
beat_density = fmax (beat_density, 2.001); beat_density = fmax (beat_density, 2.001);
} else if ( _grid_type == GridTypeBeatDiv8) { } else if (_grid_type == GridTypeBeatDiv8) {
beat_density = fmax (beat_density, 1.001); beat_density = fmax (beat_density, 1.001);
} else if ( _grid_type == GridTypeBeatDiv16) { } else if (_grid_type == GridTypeBeatDiv16) {
beat_density = fmax (beat_density, 0.2501); beat_density = fmax (beat_density, 0.2501);
} else if ( _grid_type == GridTypeBeatDiv32) { } else if (_grid_type == GridTypeBeatDiv32) {
beat_density = fmax (beat_density, 0.12501); beat_density = fmax (beat_density, 0.12501);
} }
@ -1411,7 +1411,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
case bbt_show_many: case bbt_show_many:
bbt_nmarks = 1; bbt_nmarks = 1;
snprintf (buf, sizeof(buf), "cannot handle %" PRIu32 " bars", bbt_bars ); snprintf (buf, sizeof(buf), "cannot handle %" PRIu32 " bars", bbt_bars);
mark.style = ArdourCanvas::Ruler::Mark::Major; mark.style = ArdourCanvas::Ruler::Mark::Major;
mark.label = buf; mark.label = buf;
mark.position = lower; mark.position = lower;
@ -1551,13 +1551,12 @@ Editor::metric_get_samples (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdoub
} }
static void static void
sample_to_clock_parts ( samplepos_t sample, sample_to_clock_parts (samplepos_t sample,
samplepos_t sample_rate, samplepos_t sample_rate,
long *hrs_p, long* hrs_p,
long *mins_p, long* mins_p,
long *secs_p, long* secs_p,
long *millisecs_p) long* millisecs_p)
{ {
samplepos_t left; samplepos_t left;
long hrs; long hrs;
@ -1725,7 +1724,7 @@ Editor::metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdoubl
lower = 0; lower = 0;
} }
if ( minsec_mark_interval== 0) { //we got here too early; divide-by-zero imminent if (minsec_mark_interval == 0) { //we got here too early; divide-by-zero imminent
return; return;
} }
@ -1810,7 +1809,7 @@ Editor::metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdoubl
break; break;
case minsec_show_many_hours: case minsec_show_many_hours:
for (n = 0; n < minsec_nmarks; ) { for (n = 0; n < minsec_nmarks;) {
sample_to_clock_parts (pos, _session->sample_rate(), &hrs, &mins, &secs, &millisecs); sample_to_clock_parts (pos, _session->sample_rate(), &hrs, &mins, &secs, &millisecs);
if (hrs % minsec_mark_modulo == 0) { if (hrs % minsec_mark_modulo == 0) {
mark.style = ArdourCanvas::Ruler::Mark::Major; mark.style = ArdourCanvas::Ruler::Mark::Major;

View file

@ -143,9 +143,9 @@ EditorSummary::render_background_image ()
double theoretical_end = ext.second; double theoretical_end = ext.second;
/* the summary should encompass the full extent of everywhere we've visited since the session was opened */ /* the summary should encompass the full extent of everywhere we've visited since the session was opened */
if ( _leftmost < theoretical_start) if (_leftmost < theoretical_start)
theoretical_start = _leftmost; theoretical_start = _leftmost;
if ( _rightmost > theoretical_end ) if (_rightmost > theoretical_end)
theoretical_end = _rightmost; theoretical_end = _rightmost;
/* range-check */ /* range-check */
@ -184,7 +184,7 @@ EditorSummary::render_background_image ()
/* paint a non-bg colored strip to represent the track itself */ /* paint a non-bg colored strip to represent the track itself */
if ( _track_height > 4 ) { if (_track_height > 4) {
cairo_set_source_rgb (cr, 0.2, 0.2, 0.2); cairo_set_source_rgb (cr, 0.2, 0.2, 0.2);
cairo_set_line_width (cr, _track_height - 1); cairo_set_line_width (cr, _track_height - 1);
cairo_move_to (cr, 0, y + _track_height / 2); cairo_move_to (cr, 0, y + _track_height / 2);
@ -198,10 +198,10 @@ EditorSummary::render_background_image ()
cairo_set_line_width (cr, _track_height * 0.8); cairo_set_line_width (cr, _track_height * 0.8);
s->foreach_regionview (sigc::bind ( s->foreach_regionview (sigc::bind (
sigc::mem_fun (*this, &EditorSummary::render_region), sigc::mem_fun (*this, &EditorSummary::render_region),
cr, cr,
y + _track_height / 2 y + _track_height / 2
)); ));
} }
y += _track_height; y += _track_height;
@ -238,17 +238,17 @@ EditorSummary::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle
/* maintain the leftmost and rightmost locations that we've ever reached */ /* maintain the leftmost and rightmost locations that we've ever reached */
samplecnt_t const leftmost = _editor->leftmost_sample (); samplecnt_t const leftmost = _editor->leftmost_sample ();
if ( leftmost < _leftmost) { if (leftmost < _leftmost) {
_leftmost = leftmost; _leftmost = leftmost;
_background_dirty = true; _background_dirty = true;
} }
samplecnt_t const rightmost = leftmost + _editor->current_page_samples(); samplecnt_t const rightmost = leftmost + _editor->current_page_samples();
if ( rightmost > _rightmost) { if (rightmost > _rightmost) {
_rightmost = rightmost; _rightmost = rightmost;
_background_dirty = true; _background_dirty = true;
} }
//draw the background (regions, markers, etc ) if they've changed /* draw the background (regions, markers, etc) if they've changed */
if (!_image || _background_dirty) { if (!_image || _background_dirty) {
render_background_image (); render_background_image ();
_background_dirty = false; _background_dirty = false;
@ -439,7 +439,7 @@ EditorSummary::on_button_press_event (GdkEventButton* ev)
{ {
_old_follow_playhead = _editor->follow_playhead (); _old_follow_playhead = _editor->follow_playhead ();
if (ev->button == 3) { //right-click: show the reset menu action if (ev->button == 3) { // right-click: show the reset menu action
using namespace Gtk::Menu_Helpers; using namespace Gtk::Menu_Helpers;
Gtk::Menu* m = manage (new Gtk::Menu); Gtk::Menu* m = manage (new Gtk::Menu);
MenuList& items = m->items (); MenuList& items = m->items ();
@ -576,7 +576,7 @@ EditorSummary::get_position (double x, double y) const
void void
EditorSummary::reset_to_extents() EditorSummary::reset_to_extents()
{ {
//reset as if the user never went anywhere outside the extents /* reset as if the user never went anywhere outside the extents */
_leftmost = max_samplepos; _leftmost = max_samplepos;
_rightmost = 0; _rightmost = 0;
@ -609,7 +609,7 @@ EditorSummary::set_cursor (Position p)
} }
void void
EditorSummary::summary_zoom_step ( int steps /* positive steps to zoom "out" , negative steps to zoom "in" */ ) EditorSummary::summary_zoom_step (int steps /* positive steps to zoom "out" , negative steps to zoom "in" */ )
{ {
pair<double, double> xn; pair<double, double> xn;
@ -618,9 +618,12 @@ EditorSummary::summary_zoom_step ( int steps /* positive steps to zoom "out" , n
xn.first -= steps; xn.first -= steps;
xn.second += steps; xn.second += steps;
//for now, disallow really close zooming-in from the scroomer. ( currently it causes the start-offset to 'walk' because of integer limitations. to fix this, probably need to maintain float throught the get/set_editor() path ) /* for now, disallow really close zooming-in from the scroomer. (Currently it
* causes the start-offset to 'walk' because of integer limitations.
* To fix this, probably need to maintain float throught the get/set_editor() path.)
*/
if (steps<0) { if (steps<0) {
if ( (xn.second-xn.first) < 2) if ((xn.second - xn.first) < 2)
return; return;
} }
@ -634,25 +637,25 @@ EditorSummary::on_motion_notify_event (GdkEventMotion* ev)
{ {
if (_move_dragging) { if (_move_dragging) {
//To avoid accidental zooming, the mouse must move exactly vertical, not diagonal, to trigger a zoom step /* To avoid accidental zooming, the mouse must move exactly vertical, not diagonal, to trigger a zoom step
//we use screen coordinates for this, not canvas-based grab_x * we use screen coordinates for this, not canvas-based grab_x */
double mx = ev->x; double mx = ev->x;
double dx = mx - _last_mx; double dx = mx - _last_mx;
double my = ev->y; double my = ev->y;
double dy = my - _last_my; double dy = my - _last_my;
//do zooming in windowed "steps" so it feels more reversible ? /* do zooming in windowed "steps" so it feels more reversible ? */
const int stepsize = 2; const int stepsize = 2;
int y_delta = _start_mouse_y - my; int y_delta = _start_mouse_y - my;
y_delta = y_delta / stepsize; y_delta = y_delta / stepsize;
//do the zoom? /* do the zoom? */
const float zscale = 3; const float zscale = 3;
if ( (dx==0) && (_last_dx ==0) && (y_delta != _last_y_delta) ) { if ((dx == 0) && (_last_dx == 0) && (y_delta != _last_y_delta)) {
summary_zoom_step( dy * zscale ); summary_zoom_step (dy * zscale);
//after the zoom we must re-calculate x-pos grabs /* after the zoom we must re-calculate x-pos grabs */
pair<double, double> xr; pair<double, double> xr;
get_editor (&xr); get_editor (&xr);
_start_editor_x = xr; _start_editor_x = xr;
@ -661,8 +664,8 @@ EditorSummary::on_motion_notify_event (GdkEventMotion* ev)
_last_y_delta = y_delta; _last_y_delta = y_delta;
} }
//always track horizontal movement, if any /* always track horizontal movement, if any */
if ( dx != 0 ) { if (dx != 0) {
double x = _start_editor_x.first; double x = _start_editor_x.first;
x += ev->x - _start_mouse_x; x += ev->x - _start_mouse_x;
@ -671,12 +674,11 @@ EditorSummary::on_motion_notify_event (GdkEventMotion* ev)
x = 0; x = 0;
} }
//zoom-behavior-tweaks /* zoom-behavior-tweaks: protect the right edge from expanding beyond the end */
//protect the right edge from expanding beyond the end
pair<double, double> xr; pair<double, double> xr;
get_editor (&xr); get_editor (&xr);
double w = xr.second - xr.first; double w = xr.second - xr.first;
if ( x + w < get_width() ) { if (x + w < get_width()) {
set_editor (x); set_editor (x);
} }
} }
@ -696,9 +698,8 @@ EditorSummary::on_motion_notify_event (GdkEventMotion* ev)
xr.first += dx; xr.first += dx;
} else if (_zoom_trim_position == RIGHT) { } else if (_zoom_trim_position == RIGHT) {
//zoom-behavior-tweaks /* zoom-behavior-tweaks: protect the right edge from expanding beyond the edge */
//protect the right edge from expanding beyond the edge if ((xr.second + dx) < get_width()) {
if ( (xr.second + dx) < get_width() ) {
xr.second += dx; xr.second += dx;
} }
@ -712,7 +713,7 @@ EditorSummary::on_motion_notify_event (GdkEventMotion* ev)
set_editor (xr); set_editor (xr);
} else { } else {
set_cursor ( get_position(ev->x, ev->y) ); set_cursor (get_position (ev->x, ev->y));
} }
return true; return true;
@ -746,14 +747,14 @@ EditorSummary::on_scroll_event (GdkEventScroll* ev)
switch (ev->direction) { switch (ev->direction) {
case GDK_SCROLL_UP: { case GDK_SCROLL_UP: {
summary_zoom_step( -4 ); summary_zoom_step (-4);
return true; return true;
} break; } break;
case GDK_SCROLL_DOWN: { case GDK_SCROLL_DOWN: {
summary_zoom_step( 4 ); summary_zoom_step (4);
return true; return true;
} break; } break;

View file

@ -1256,7 +1256,6 @@ MixerStrip::guess_main_type(bool for_input, bool favor_connected) const
/* /*
* Output port labelling * Output port labelling
* =====================
* *
* Case 1: Each output has one connection, all connections are to system:playback_%i * Case 1: Each output has one connection, all connections are to system:playback_%i
* out 1 -> system:playback_1 * out 1 -> system:playback_1
@ -1280,8 +1279,9 @@ MixerStrip::guess_main_type(bool for_input, bool favor_connected) const
* Default case (unusual routing): * Default case (unusual routing):
* Display as: *number of connections* * Display as: *number of connections*
* *
*
* Tooltips * Tooltips
* ======== *
* .-----------------------------------------------. * .-----------------------------------------------.
* | Mixdown | * | Mixdown |
* | out 1 -> ardour:master/in 1, jamin:input/in 1 | * | out 1 -> ardour:master/in 1, jamin:input/in 1 |

View file

@ -241,8 +241,8 @@ Selection::clear_markers (bool with_signal)
void void
Selection::toggle (boost::shared_ptr<Playlist> pl) Selection::toggle (boost::shared_ptr<Playlist> pl)
{ {
clear_time(); //enforce object/range exclusivity clear_time(); // enforce object/range exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
PlaylistSelection::iterator i; PlaylistSelection::iterator i;
@ -259,8 +259,8 @@ Selection::toggle (boost::shared_ptr<Playlist> pl)
void void
Selection::toggle (const MidiNoteSelection& midi_note_list) Selection::toggle (const MidiNoteSelection& midi_note_list)
{ {
clear_time(); //enforce object/range exclusivity clear_time(); // enforce object/range exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
for (MidiNoteSelection::const_iterator i = midi_note_list.begin(); i != midi_note_list.end(); ++i) { for (MidiNoteSelection::const_iterator i = midi_note_list.begin(); i != midi_note_list.end(); ++i) {
toggle ((*i)); toggle ((*i));
@ -287,8 +287,8 @@ Selection::toggle (MidiCutBuffer* midi)
void void
Selection::toggle (RegionView* r) Selection::toggle (RegionView* r)
{ {
clear_time(); //enforce object/range exclusivity clear_time(); // enforce object/range exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
RegionSelection::iterator i; RegionSelection::iterator i;
@ -304,8 +304,8 @@ Selection::toggle (RegionView* r)
void void
Selection::toggle (MidiRegionView* mrv) Selection::toggle (MidiRegionView* mrv)
{ {
clear_time(); //enforce object/range exclusivity clear_time(); // enforce object/range exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
MidiRegionSelection::iterator i; MidiRegionSelection::iterator i;
@ -321,8 +321,8 @@ Selection::toggle (MidiRegionView* mrv)
void void
Selection::toggle (vector<RegionView*>& r) Selection::toggle (vector<RegionView*>& r)
{ {
clear_time(); //enforce object/range exclusivity clear_time(); // enforce object/range exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
RegionSelection::iterator i; RegionSelection::iterator i;
@ -340,7 +340,7 @@ Selection::toggle (vector<RegionView*>& r)
long long
Selection::toggle (samplepos_t start, samplepos_t end) Selection::toggle (samplepos_t start, samplepos_t end)
{ {
clear_objects(); //enforce object/range exclusivity clear_objects(); // enforce object/range exclusivity
AudioRangeComparator cmp; AudioRangeComparator cmp;
@ -360,8 +360,8 @@ Selection::add (boost::shared_ptr<Playlist> pl)
{ {
if (find (playlists.begin(), playlists.end(), pl) == playlists.end()) { if (find (playlists.begin(), playlists.end(), pl) == playlists.end()) {
clear_time(); //enforce object/range exclusivity clear_time(); // enforce object/range exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
pl->use (); pl->use ();
playlists.push_back(pl); playlists.push_back(pl);
PlaylistsChanged (); PlaylistsChanged ();
@ -382,8 +382,8 @@ Selection::add (const list<boost::shared_ptr<Playlist> >& pllist)
} }
if (changed) { if (changed) {
clear_time(); //enforce object/range exclusivity clear_time(); // enforce object/range exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
PlaylistsChanged (); PlaylistsChanged ();
} }
} }
@ -395,8 +395,8 @@ Selection::add (const MidiNoteSelection& midi_list)
const MidiNoteSelection::const_iterator e = midi_list.end(); const MidiNoteSelection::const_iterator e = midi_list.end();
if (!midi_list.empty()) { if (!midi_list.empty()) {
clear_time(); //enforce object/range exclusivity clear_time(); // enforce object/range exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
midi_notes.insert (midi_notes.end(), b, e); midi_notes.insert (midi_notes.end(), b, e);
MidiNotesChanged (); MidiNotesChanged ();
} }
@ -428,8 +428,8 @@ Selection::add (vector<RegionView*>& v)
} }
if (changed) { if (changed) {
clear_time(); //enforce object/range exclusivity clear_time(); // enforce object/range exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
RegionsChanged (); RegionsChanged ();
} }
} }
@ -449,8 +449,8 @@ Selection::add (const RegionSelection& rs)
} }
if (changed) { if (changed) {
clear_time(); //enforce object/range exclusivity clear_time(); // enforce object/range exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
RegionsChanged (); RegionsChanged ();
} }
} }
@ -461,8 +461,8 @@ Selection::add (RegionView* r)
if (find (regions.begin(), regions.end(), r) == regions.end()) { if (find (regions.begin(), regions.end(), r) == regions.end()) {
bool changed = regions.add (r); bool changed = regions.add (r);
if (changed) { if (changed) {
clear_time(); //enforce object/range exclusivity clear_time(); // enforce object/range exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
RegionsChanged (); RegionsChanged ();
} }
} }
@ -473,8 +473,8 @@ Selection::add (MidiRegionView* mrv)
{ {
DEBUG_TRACE(DEBUG::Selection, string_compose("Selection::add MRV %1\n", mrv)); DEBUG_TRACE(DEBUG::Selection, string_compose("Selection::add MRV %1\n", mrv));
clear_time(); //enforce object/range exclusivity clear_time(); // enforce object/range exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
if (find (midi_regions.begin(), midi_regions.end(), mrv) == midi_regions.end()) { if (find (midi_regions.begin(), midi_regions.end(), mrv) == midi_regions.end()) {
midi_regions.push_back (mrv); midi_regions.push_back (mrv);
@ -486,7 +486,7 @@ Selection::add (MidiRegionView* mrv)
long long
Selection::add (samplepos_t start, samplepos_t end) Selection::add (samplepos_t start, samplepos_t end)
{ {
clear_objects(); //enforce object/range exclusivity clear_objects(); // enforce object/range exclusivity
AudioRangeComparator cmp; AudioRangeComparator cmp;
@ -519,7 +519,7 @@ Selection::move_time (samplecnt_t distance)
void void
Selection::replace (uint32_t sid, samplepos_t start, samplepos_t end) Selection::replace (uint32_t sid, samplepos_t start, samplepos_t end)
{ {
clear_objects(); //enforce object/range exclusivity clear_objects(); // enforce object/range exclusivity
for (list<AudioRange>::iterator i = time.begin(); i != time.end(); ++i) { for (list<AudioRange>::iterator i = time.begin(); i != time.end(); ++i) {
if ((*i).id == sid) { if ((*i).id == sid) {
@ -549,8 +549,8 @@ Selection::add (boost::shared_ptr<Evoral::ControlList> cl)
} }
if (!cl->empty()) { if (!cl->empty()) {
clear_time(); //enforce object/range exclusivity clear_time(); // enforce object/range exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
} }
/* The original may change so we must store a copy (not a pointer) here. /* The original may change so we must store a copy (not a pointer) here.
@ -691,8 +691,8 @@ void
Selection::set (const MidiNoteSelection& midi_list) Selection::set (const MidiNoteSelection& midi_list)
{ {
if (!midi_list.empty()) { if (!midi_list.empty()) {
clear_time (); //enforce region/object exclusivity clear_time (); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
} }
clear_objects (); clear_objects ();
add (midi_list); add (midi_list);
@ -702,8 +702,8 @@ void
Selection::set (boost::shared_ptr<Playlist> playlist) Selection::set (boost::shared_ptr<Playlist> playlist)
{ {
if (playlist) { if (playlist) {
clear_time (); //enforce region/object exclusivity clear_time (); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
} }
clear_objects (); clear_objects ();
add (playlist); add (playlist);
@ -713,7 +713,7 @@ void
Selection::set (const list<boost::shared_ptr<Playlist> >& pllist) Selection::set (const list<boost::shared_ptr<Playlist> >& pllist)
{ {
if (!pllist.empty()) { if (!pllist.empty()) {
clear_time(); //enforce region/object exclusivity clear_time(); // enforce region/object exclusivity
} }
clear_objects (); clear_objects ();
add (pllist); add (pllist);
@ -723,8 +723,8 @@ void
Selection::set (const RegionSelection& rs) Selection::set (const RegionSelection& rs)
{ {
if (!rs.empty()) { if (!rs.empty()) {
clear_time(); //enforce region/object exclusivity clear_time(); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
} }
clear_objects(); clear_objects();
regions = rs; regions = rs;
@ -735,8 +735,8 @@ void
Selection::set (MidiRegionView* mrv) Selection::set (MidiRegionView* mrv)
{ {
if (mrv) { if (mrv) {
clear_time(); //enforce region/object exclusivity clear_time(); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
} }
clear_objects (); clear_objects ();
add (mrv); add (mrv);
@ -746,8 +746,8 @@ void
Selection::set (RegionView* r, bool /*also_clear_tracks*/) Selection::set (RegionView* r, bool /*also_clear_tracks*/)
{ {
if (r) { if (r) {
clear_time(); //enforce region/object exclusivity clear_time(); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
} }
clear_objects (); clear_objects ();
add (r); add (r);
@ -757,8 +757,8 @@ void
Selection::set (vector<RegionView*>& v) Selection::set (vector<RegionView*>& v)
{ {
if (!v.empty()) { if (!v.empty()) {
clear_time(); //enforce region/object exclusivity clear_time(); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
} }
clear_objects(); clear_objects();
@ -772,7 +772,7 @@ Selection::set (vector<RegionView*>& v)
long long
Selection::set (samplepos_t start, samplepos_t end) Selection::set (samplepos_t start, samplepos_t end)
{ {
clear_objects(); //enforce region/object exclusivity clear_objects(); // enforce region/object exclusivity
clear_time(); clear_time();
if ((start == 0 && end == 0) || end < start) { if ((start == 0 && end == 0) || end < start) {
@ -809,7 +809,7 @@ Selection::set (samplepos_t start, samplepos_t end)
void void
Selection::set_preserving_all_ranges (samplepos_t start, samplepos_t end) Selection::set_preserving_all_ranges (samplepos_t start, samplepos_t end)
{ {
clear_objects(); //enforce region/object exclusivity clear_objects(); // enforce region/object exclusivity
if ((start == 0 && end == 0) || (end < start)) { if ((start == 0 && end == 0) || (end < start)) {
return; return;
@ -831,8 +831,8 @@ Selection::set_preserving_all_ranges (samplepos_t start, samplepos_t end)
void void
Selection::set (boost::shared_ptr<Evoral::ControlList> ac) Selection::set (boost::shared_ptr<Evoral::ControlList> ac)
{ {
clear_time(); //enforce region/object exclusivity clear_time(); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
clear_objects(); clear_objects();
add (ac); add (ac);
@ -859,7 +859,7 @@ Selection::selected (ControlPoint* cp) const
bool bool
Selection::empty (bool internal_selection) Selection::empty (bool internal_selection)
{ {
bool object_level_empty = regions.empty () && bool object_level_empty = regions.empty () &&
tracks.empty () && tracks.empty () &&
points.empty () && points.empty () &&
playlists.empty () && playlists.empty () &&
@ -884,8 +884,8 @@ Selection::empty (bool internal_selection)
void void
Selection::toggle (ControlPoint* cp) Selection::toggle (ControlPoint* cp)
{ {
clear_time(); //enforce region/object exclusivity clear_time(); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
cp->set_selected (!cp->selected ()); cp->set_selected (!cp->selected ());
PointSelection::iterator i = find (points.begin(), points.end(), cp); PointSelection::iterator i = find (points.begin(), points.end(), cp);
@ -901,8 +901,8 @@ Selection::toggle (ControlPoint* cp)
void void
Selection::toggle (vector<ControlPoint*> const & cps) Selection::toggle (vector<ControlPoint*> const & cps)
{ {
clear_time(); //enforce region/object exclusivity clear_time(); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
for (vector<ControlPoint*>::const_iterator i = cps.begin(); i != cps.end(); ++i) { for (vector<ControlPoint*>::const_iterator i = cps.begin(); i != cps.end(); ++i) {
toggle (*i); toggle (*i);
@ -912,8 +912,8 @@ Selection::toggle (vector<ControlPoint*> const & cps)
void void
Selection::toggle (list<Selectable*> const & selectables) Selection::toggle (list<Selectable*> const & selectables)
{ {
clear_time(); //enforce region/object exclusivity clear_time(); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
RegionView* rv; RegionView* rv;
ControlPoint* cp; ControlPoint* cp;
@ -945,8 +945,8 @@ Selection::toggle (list<Selectable*> const & selectables)
void void
Selection::set (list<Selectable*> const & selectables) Selection::set (list<Selectable*> const & selectables)
{ {
clear_time (); //enforce region/object exclusivity clear_time (); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
clear_objects (); clear_objects ();
add (selectables); add (selectables);
@ -955,8 +955,8 @@ Selection::set (list<Selectable*> const & selectables)
void void
Selection::add (PointSelection const & s) Selection::add (PointSelection const & s)
{ {
clear_time (); //enforce region/object exclusivity clear_time (); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
for (PointSelection::const_iterator i = s.begin(); i != s.end(); ++i) { for (PointSelection::const_iterator i = s.begin(); i != s.end(); ++i) {
points.push_back (*i); points.push_back (*i);
@ -966,8 +966,8 @@ Selection::add (PointSelection const & s)
void void
Selection::add (list<Selectable*> const & selectables) Selection::add (list<Selectable*> const & selectables)
{ {
clear_time (); //enforce region/object exclusivity clear_time (); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
RegionView* rv; RegionView* rv;
ControlPoint* cp; ControlPoint* cp;
@ -1010,8 +1010,8 @@ Selection::clear_points (bool with_signal)
void void
Selection::add (ControlPoint* cp) Selection::add (ControlPoint* cp)
{ {
clear_time (); //enforce region/object exclusivity clear_time (); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
cp->set_selected (true); cp->set_selected (true);
points.push_back (cp); points.push_back (cp);
@ -1021,8 +1021,8 @@ Selection::add (ControlPoint* cp)
void void
Selection::add (vector<ControlPoint*> const & cps) Selection::add (vector<ControlPoint*> const & cps)
{ {
clear_time (); //enforce region/object exclusivity clear_time (); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
for (vector<ControlPoint*>::const_iterator i = cps.begin(); i != cps.end(); ++i) { for (vector<ControlPoint*>::const_iterator i = cps.begin(); i != cps.end(); ++i) {
(*i)->set_selected (true); (*i)->set_selected (true);
@ -1034,8 +1034,8 @@ Selection::add (vector<ControlPoint*> const & cps)
void void
Selection::set (ControlPoint* cp) Selection::set (ControlPoint* cp)
{ {
clear_time (); //enforce region/object exclusivity clear_time (); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
if (cp->selected () && points.size () == 1) { if (cp->selected () && points.size () == 1) {
return; return;
@ -1052,8 +1052,8 @@ Selection::set (ControlPoint* cp)
void void
Selection::set (ArdourMarker* m) Selection::set (ArdourMarker* m)
{ {
clear_time (); //enforce region/object exclusivity clear_time (); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
markers.clear (); markers.clear ();
add (m); add (m);
@ -1085,8 +1085,8 @@ Selection::remove (ArdourMarker* m)
void void
Selection::add (ArdourMarker* m) Selection::add (ArdourMarker* m)
{ {
clear_time (); //enforce region/object exclusivity clear_time (); //enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); //enforce object/track exclusivity
if (find (markers.begin(), markers.end(), m) == markers.end()) { if (find (markers.begin(), markers.end(), m) == markers.end()) {
markers.push_back (m); markers.push_back (m);
@ -1097,8 +1097,8 @@ Selection::add (ArdourMarker* m)
void void
Selection::add (const list<ArdourMarker*>& m) Selection::add (const list<ArdourMarker*>& m)
{ {
clear_time (); //enforce region/object exclusivity clear_time (); // enforce region/object exclusivity
clear_tracks(); //enforce object/track exclusivity clear_tracks(); // enforce object/track exclusivity
markers.insert (markers.end(), m.begin(), m.end()); markers.insert (markers.end(), m.begin(), m.end());
markers.sort (); markers.sort ();
@ -1298,7 +1298,7 @@ Selection::set_state (XMLNode const & node, int)
pending_midi_note_selection.push_back (make_pair (id, notes)); pending_midi_note_selection.push_back (make_pair (id, notes));
} }
} else if ((*i)->name() == X_("ControlPoint")) { } else if ((*i)->name() == X_("ControlPoint")) {
XMLProperty const * prop_type = (*i)->property (X_("type")); XMLProperty const * prop_type = (*i)->property (X_("type"));
assert(prop_type); assert(prop_type);
@ -1369,7 +1369,7 @@ Selection::set_state (XMLNode const & node, int)
} }
} }
} else if ((*i)->name() == X_("AudioRange")) { } else if ((*i)->name() == X_("AudioRange")) {
samplepos_t start; samplepos_t start;
samplepos_t end; samplepos_t end;
@ -1671,7 +1671,7 @@ Selection::core_selection_changed (PropertyChange const & what_changed)
CoreSelection& selection (editor->session()->selection()); CoreSelection& selection (editor->session()->selection());
if (selection.selected()) { if (selection.selected()) {
clear_objects(); // enforce object/range exclusivity clear_objects(); // enforce object/range exclusivity
} }
tracks.clear (); // clear stage for whatever tracks are now selected (maybe none) tracks.clear (); // clear stage for whatever tracks are now selected (maybe none)