diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index fbd4f13f02..d75384e253 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -706,6 +706,8 @@ Editor::left_track_canvas (GdkEventCrossing *ev) void Editor::canvas_horizontally_scrolled () { + cerr << "chs\n"; + /* this is the core function that controls horizontal scrolling of the canvas. it is called whenever the horizontal_adjustment emits its "value_changed" signal. it typically executes in an idle handler, which is important because tempo_map_changed() should issue redraws immediately diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index dc961f51ea..8efce4daac 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -549,8 +549,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp return true; case MarkerItem: - if (Keyboard::modifier_state_equals (event->button.state, - Keyboard::ModifierMask(Keyboard::Control|Keyboard::Shift))) { + if (Keyboard::modifier_state_equals (event->button.state, Keyboard::ModifierMask(Keyboard::Control|Keyboard::Shift))) { hide_marker (item, event); } else { start_marker_grab (item, event); @@ -2162,14 +2161,16 @@ Editor::start_marker_grab (ArdourCanvas::Item* item, GdkEvent* event) if (location->is_mark()) { marker_drag_line->show(); marker_drag_line->raise_to_top(); - } - else { + } else { range_marker_drag_rect->show(); range_marker_drag_rect->raise_to_top(); } - - if (is_start) show_verbose_time_cursor (location->start(), 10); - else show_verbose_time_cursor (location->end(), 10); + + if (is_start) { + show_verbose_time_cursor (location->start(), 10); + } else { + show_verbose_time_cursor (location->end(), 10); + } } void diff --git a/gtk2_ardour/location_ui.cc b/gtk2_ardour/location_ui.cc index faf986a2d1..e306110f15 100644 --- a/gtk2_ardour/location_ui.cc +++ b/gtk2_ardour/location_ui.cc @@ -256,6 +256,13 @@ LocationEditRow::set_location (Location *loc) cd_check_button.set_active (location->is_cd_marker()); cd_check_button.show(); + + if (location->start() == session->current_start_frame()) { + cd_check_button.set_sensitive (false); + } else { + cd_check_button.set_sensitive (true); + } + hide_check_button.show(); } @@ -277,12 +284,14 @@ LocationEditRow::set_location (Location *loc) end_go_button.show(); end_clock.show(); length_clock.show(); - } - else { + + } else { + end_set_button.hide(); end_go_button.hide(); end_clock.hide(); length_clock.hide(); + } start_changed_connection = location->start_changed.connect (mem_fun(*this, &LocationEditRow::start_changed)); @@ -290,7 +299,6 @@ LocationEditRow::set_location (Location *loc) name_changed_connection = location->name_changed.connect (mem_fun(*this, &LocationEditRow::name_changed)); changed_connection = location->changed.connect (mem_fun(*this, &LocationEditRow::location_changed)); flags_changed_connection = location->FlagsChanged.connect (mem_fun(*this, &LocationEditRow::flags_changed)); - } void @@ -405,44 +413,56 @@ LocationEditRow::clock_changed (LocationPart part) void LocationEditRow::cd_toggled () { + if (i_am_the_modifier || !location) { + return; + } + + if (cd_check_button.get_active() == location->is_cd_marker()) { + return; + } + + if (cd_check_button.get_active()) { + if (location->start() <= session->current_start_frame()) { + error << _("You cannot put a CD marker at the start of the session") << endmsg; + cd_check_button.set_active (false); + return; + } + } - if (i_am_the_modifier || !location) return; location->set_cd (cd_check_button.get_active(), this); if (location->is_cd_marker() && !(location->is_mark())) { - if (location->cd_info.find("isrc") != location->cd_info.end()) { - isrc_entry.set_text(location->cd_info["isrc"]); - } - if (location->cd_info.find("performer") != location->cd_info.end()) { - performer_entry.set_text(location->cd_info["performer"]); - } - if (location->cd_info.find("composer") != location->cd_info.end()) { - composer_entry.set_text(location->cd_info["composer"]); - } - if (location->cd_info.find("scms") != location->cd_info.end()) { - scms_check_button.set_active(true); - } - if (location->cd_info.find("preemph") != location->cd_info.end()) { - preemph_check_button.set_active(true); - } - - if(!cd_track_details_hbox.get_parent()) { - item_table.attach (cd_track_details_hbox, 1, 8, 1, 2, FILL | EXPAND, FILL, 4, 0); - } - // item_table.resize(2, 7); - cd_track_details_hbox.show_all(); - + if (location->cd_info.find("isrc") != location->cd_info.end()) { + isrc_entry.set_text(location->cd_info["isrc"]); + } + if (location->cd_info.find("performer") != location->cd_info.end()) { + performer_entry.set_text(location->cd_info["performer"]); + } + if (location->cd_info.find("composer") != location->cd_info.end()) { + composer_entry.set_text(location->cd_info["composer"]); + } + if (location->cd_info.find("scms") != location->cd_info.end()) { + scms_check_button.set_active(true); + } + if (location->cd_info.find("preemph") != location->cd_info.end()) { + preemph_check_button.set_active(true); + } + + if (!cd_track_details_hbox.get_parent()) { + item_table.attach (cd_track_details_hbox, 1, 8, 1, 2, FILL | EXPAND, FILL, 4, 0); + } + // item_table.resize(2, 7); + cd_track_details_hbox.show_all(); + } else if (cd_track_details_hbox.get_parent()){ - - item_table.remove (cd_track_details_hbox); - // item_table.resize(1, 7); - redraw_ranges(); /* EMIT_SIGNAL */ + + item_table.remove (cd_track_details_hbox); + // item_table.resize(1, 7); + redraw_ranges(); /* EMIT_SIGNAL */ } - } - void LocationEditRow::hide_toggled () { @@ -506,13 +526,19 @@ void LocationEditRow::start_changed (ARDOUR::Location *loc) { ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationEditRow::start_changed), loc)); - + if (!location) return; // update end and length i_am_the_modifier++; start_clock.set (location->start()); + + if (location->start() == session->current_start_frame()) { + cd_check_button.set_sensitive (false); + } else { + cd_check_button.set_sensitive (true); + } i_am_the_modifier--; } diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc index 32e14420ff..fc2492a7a1 100644 --- a/gtk2_ardour/main.cc +++ b/gtk2_ardour/main.cc @@ -314,6 +314,8 @@ int main (int argc, char *argv[]) ui->set_keybindings_path (keybindings_path); } + gdk_window_set_debug_updates (true); + ui->run (text_receiver); ui = 0; diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index bd9e7b8af5..093c6cf8fc 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -169,6 +169,14 @@ Location::set_hidden (bool yn, void *src) void Location::set_cd (bool yn, void *src) { + // XXX this really needs to be session start + // but its not available here - leave to GUI + + if (_start == 0) { + error << _("You cannot put a CD marker at this position") << endmsg; + return; + } + if (set_flag_internal (yn, IsCDMarker)) { FlagsChanged (this, src); /* EMIT SIGNAL */ }