add single-layer zoom toggle; add toggle-fade-active commands (& bindings for SAE); add zoom-to-region; allow 2 digits in the tempo dialog

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2735 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-12-03 19:06:07 +00:00
parent 10140d119d
commit 523952e655
9 changed files with 151 additions and 22 deletions

View file

@ -67,6 +67,15 @@ AddRouteDialog::AddRouteDialog ()
{
if (channel_combo_strings.empty()) {
channel_combo_strings = I18N (channel_setup_names);
if (ARDOUR::Profile->get_sae()) {
/* remove all but the first two (Mono & Stereo) */
while (track_mode_strings.size() > 2) {
track_mode_strings.pop_back();
}
}
}
if (track_mode_strings.empty()) {

View file

@ -96,7 +96,7 @@
; (gtk_accel_path "<Actions>/Editor/Layering" "")
; (gtk_accel_path "<Actions>/JACK/JACKLatency4096" "")
(gtk_accel_path "<Actions>/Editor/scroll-tracks-up" "Page_Up")
(gtk_accel_path "<Actions>/Editor/set-edit-point" "o")
(gtk_accel_path "<Actions>/Editor/set-edit-point" "g")
; (gtk_accel_path "<Actions>/Editor/Smpte30drop" "")
; (gtk_accel_path "<Actions>/Zoom/zoom-focus-edit" "")
(gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-boundary" "leftarrow")
@ -123,7 +123,8 @@
; (gtk_accel_path "<Actions>/Editor/snap-magnetic" "")
; (gtk_accel_path "<Actions>/Editor/playhead-to-range-end" "")
(gtk_accel_path "<Actions>/Editor/scroll-playhead-forward" "<%TERTIARY%>rightarrow")
(gtk_accel_path "<Actions>/Editor/align-regions-sync-relative" "y")
(gtk_accel_path "<Actions>/Editor/align-regions-sync-relative" "<%SECONDARY%>less")
(gtk_accel_path "<Actions>/Editor/align-regions-sync" "less")
; (gtk_accel_path "<Actions>/Editor/EditSelectRegionOptions" "")
(gtk_accel_path "<Actions>/Editor/crop" "c")
; (gtk_accel_path "<Actions>/redirectmenu/newsend" "")
@ -137,7 +138,6 @@
; (gtk_accel_path "<Actions>/Transport/ToggleAutoInput" "")
; (gtk_accel_path "<Actions>/Snap/snap-to-thirtyseconds" "")
; (gtk_accel_path "<Actions>/Snap/snap-to-minutes" "")
(gtk_accel_path "<Actions>/Editor/align-regions-sync" "less")
; (gtk_accel_path "<Actions>/Main/Windows" "")
; (gtk_accel_path "<Actions>/Main/CleanupUnused" "")
; (gtk_accel_path "<Actions>/redirectmenu/deselectall" "")
@ -252,7 +252,7 @@
; (gtk_accel_path "<Actions>/redirectmenu/newinsert" "")
; (gtk_accel_path "<Actions>/options/UseMMC" "")
; (gtk_accel_path "<Actions>/options/MeterFalloffOff" "")
(gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-object" "o")
;(gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-object" "o")
; (gtk_accel_path "<Actions>/Editor/PullupMinus4Plus1" "")
; (gtk_accel_path "<Actions>/Editor/MeterHold" "")
; (gtk_accel_path "<Actions>/Snap/snap-to-cd-frame" "")
@ -315,7 +315,9 @@
; (gtk_accel_path "<Actions>/options/MeterHoldLong" "")
; (gtk_accel_path "<Actions>/Snap/snap-to-seconds" "")
(gtk_accel_path "<Actions>/Editor/set-fade-in-length" "q")
(gtk_accel_path "<Actions>/Editor/toggle-fade-in-active" "<%SECONDARY%>q")
(gtk_accel_path "<Actions>/Editor/set-fade-out-length" "e")
(gtk_accel_path "<Actions>/Editor/toggle-fade-out-active" "<%SECONDARY%>e")
(gtk_accel_path "<Actions>/Editor/trim-from-start" "<%TERTIARY%>braceleft")
(gtk_accel_path "<Actions>/Editor/trim-to-end" "<%TERTIARY%>braceright")
(gtk_accel_path "<Actions>/Editor/trim-front" "a")
@ -336,4 +338,7 @@
(gtk_accel_path "<Actions>/Editor/set-punch-from-edit-range" "bracketleft")
(gtk_accel_path "<Actions>/Editor/set-loop-from-region" "<%PRIMARY%><%SECONDARY%>bracketright")
(gtk_accel_path "<Actions>/Editor/loop-region" "<%PRIMARY%>bracketright")
(gtk_accel_path "<Actions>/Editor/toggle-zoom" "o")
(gtk_accel_path "<Actions>/Editor/zoom-to-region" "y")

View file

@ -140,7 +140,9 @@
<menuitem action='align-regions-sync-relative'/>
<separator/>
<menuitem action='set-fade-in-length'/>
<menuitem action='toggle-fade-in-active'/>
<menuitem action='set-fade-out-length'/>
<menuitem action='toggle-fade-out-active'/>
<separator/>
<menuitem action='trim-front'/>
<menuitem action='trim-back'/>
@ -184,10 +186,11 @@
<menuitem action='cycle-snap-choice'/>
</menu>
<separator/>
<menuitem action='temporal-zoom-in'/>
<menuitem action='temporal-zoom-out'/>
<menuitem action='zoom-to-session'/>
<menuitem action='zoom-to-region'/>
<menuitem action='toggle-zoom'/>
<menuitem action='scroll-tracks-down'/>
<menuitem action='scroll-tracks-up'/>
<menuitem action='scroll-tracks-down'/>

View file

@ -329,6 +329,8 @@ Editor::Editor ()
set_mouse_mode (MouseObject, true);
last_visual_state.frames_per_unit = 0;
frames_per_unit = 2048; /* too early to use reset_zoom () */
reset_hscrollbar_stepping ();
@ -3962,11 +3964,26 @@ Editor::reposition_and_zoom (nframes_t frame, double fpu)
reset_zoom (fpu);
}
void
Editor::swap_visual_state ()
{
if (last_visual_state.frames_per_unit == 0) {
// never set
return;
}
/* note: the correct functionality here is very dependent on the ordering of
setting zoom focus, horizontal position and finally zoom. this is because
it is set_frames_per_unit() that overwrites last_visual_state.
*/
set_zoom_focus (last_visual_state.zoom_focus);
reposition_and_zoom (last_visual_state.leftmost_frame, last_visual_state.frames_per_unit);
}
void
Editor::set_frames_per_unit (double fpu)
{
nframes_t frames;
/* this is the core function that controls the zoom level of the canvas. it is called
whenever one or more calls are made to reset_zoom(). it executes in an idle handler.
*/
@ -3979,9 +3996,6 @@ Editor::set_frames_per_unit (double fpu)
fpu = 2.0;
}
// convert fpu to frame count
frames = (nframes_t) floor (fpu * canvas_width);
/* don't allow zooms that fit more than the maximum number
of frames into an 800 pixel wide space.
@ -3994,10 +4008,23 @@ Editor::set_frames_per_unit (double fpu)
if (fpu == frames_per_unit) {
return;
}
last_visual_state.frames_per_unit = frames_per_unit;
last_visual_state.leftmost_frame = leftmost_frame;
last_visual_state.zoom_focus = zoom_focus;
frames_per_unit = fpu;
post_zoom ();
}
if (frames != zoom_range_clock.current_duration()) {
void
Editor::post_zoom ()
{
// convert fpu to frame count
nframes_t frames = (nframes_t) floor (frames_per_unit * canvas_width);
if (frames_per_unit != zoom_range_clock.current_duration()) {
zoom_range_clock.set (frames);
}
@ -4028,7 +4055,7 @@ Editor::queue_visual_change (nframes_t where)
{
pending_visual_change.pending = VisualChange::Type (pending_visual_change.pending | VisualChange::TimeOrigin);
pending_visual_change.time_origin = where;
if (pending_visual_change.idle_handler_id < 0) {
pending_visual_change.idle_handler_id = g_idle_add (_idle_visual_changer, this);
}

View file

@ -257,7 +257,7 @@ class Editor : public PublicEditor
void set_zoom_focus (Editing::ZoomFocus);
Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
gdouble get_current_zoom () { return frames_per_unit; }
double get_current_zoom () const { return frames_per_unit; }
void temporal_zoom_step (bool coarser);
@ -265,8 +265,6 @@ class Editor : public PublicEditor
PlaylistSelector& playlist_selector() const;
void route_name_changed (TimeAxisView *);
gdouble frames_per_unit;
nframes_t leftmost_frame;
void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
void new_playlists (TimeAxisView*);
@ -371,7 +369,22 @@ class Editor : public PublicEditor
PlaylistSelector* _playlist_selector;
void set_frames_per_unit (double);
struct VisualState {
double frames_per_unit;
nframes_t leftmost_frame;
Editing::ZoomFocus zoom_focus;
};
VisualState last_visual_state;
nframes_t leftmost_frame;
double frames_per_unit;
Editing::ZoomFocus zoom_focus;
void use_visual_state (const VisualState&);
void set_frames_per_unit (double);
void swap_visual_state ();
void post_zoom ();
Editing::MouseMode mouse_mode;
@ -990,9 +1003,8 @@ class Editor : public PublicEditor
void play_location (ARDOUR::Location&);
void loop_location (ARDOUR::Location&);
Editing::ZoomFocus zoom_focus;
void temporal_zoom_selection ();
void temporal_zoom_region ();
void temporal_zoom_session ();
void temporal_zoom (gdouble scale);
void temporal_zoom_by_frame (nframes_t start, nframes_t end, const string & op);
@ -1162,7 +1174,7 @@ class Editor : public PublicEditor
void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
void set_fade_length (bool in);
void toggle_fade_active (bool in);
void set_fade_in_active (bool);
void set_fade_out_active (bool);

View file

@ -201,12 +201,17 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "nudge-next-backward", _("Nudge Next Backward"), bind (mem_fun(*this, &Editor::nudge_backward), true));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "temporal-zoom-out", _("Zoom Out"), bind (mem_fun(*this, &Editor::temporal_zoom_step), true));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "temporal-zoom-in", _("Zoom In"), bind (mem_fun(*this, &Editor::temporal_zoom_step), false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "zoom-to-session", _("Zoom to Session"), mem_fun(*this, &Editor::temporal_zoom_session));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "zoom-to-region", _("Zoom to Session"), mem_fun(*this, &Editor::temporal_zoom_region));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "toggle-zoom", _("Toggle Zoom State"), mem_fun(*this, &Editor::swap_visual_state));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "scroll-tracks-up", _("Scroll Tracks Up"), mem_fun(*this, &Editor::scroll_tracks_up));
ActionManager::session_sensitive_actions.push_back (act);
@ -264,8 +269,12 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "set-fade-in-length", _("Set Fade In Length"), bind (mem_fun(*this, &Editor::set_fade_length), true));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "toggle-fade-in-active", _("Toggle Fade In Active"), bind (mem_fun(*this, &Editor::toggle_fade_active), true));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "set-fade-out-length", _("Set Fade Out Length"), bind (mem_fun(*this, &Editor::set_fade_length), false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "toggle-fade-out-active", _("Toggle Fade Out Active"), bind (mem_fun(*this, &Editor::toggle_fade_active), false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "align-regions-start", _("Align Regions Start"), bind (mem_fun(*this, &Editor::align), ARDOUR::Start));
ActionManager::session_sensitive_actions.push_back (act);

View file

@ -1540,6 +1540,32 @@ Editor::temporal_zoom (gdouble fpu)
reposition_and_zoom (leftmost_after_zoom, nfpu);
}
void
Editor::temporal_zoom_region ()
{
nframes64_t start = max_frames;
nframes64_t end = 0;
ensure_entered_region_selected (true);
if (selection->regions.empty()) {
info << _("cannot set loop: no region selected") << endmsg;
return;
}
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
if ((*i)->region()->position() < start) {
start = (*i)->region()->position();
}
if ((*i)->region()->last_frame() + 1 > end) {
end = (*i)->region()->last_frame() + 1;
}
}
temporal_zoom_by_frame (start, end, "zoom to region");
}
void
Editor::temporal_zoom_selection ()
{
@ -4055,7 +4081,7 @@ Editor::toggle_region_opaque ()
void
Editor::set_fade_length (bool in)
{
ensure_entered_region_selected ();
ensure_entered_region_selected (true);
/* we need a region to measure the offset from the start */
@ -4116,6 +4142,44 @@ Editor::set_fade_length (bool in)
commit_reversible_command ();
}
void
Editor::toggle_fade_active (bool in)
{
ensure_entered_region_selected (true);
if (selection->regions.empty()) {
return;
}
const char* cmd = (in ? _("toggle fade in active") : _("toggle fade out active"));
begin_reversible_command (cmd);
for (RegionSelection::iterator x = selection->regions.begin(); x != selection->regions.end(); ++x) {
AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*x);
if (!tmp) {
return;
}
boost::shared_ptr<AudioRegion> region (tmp->audio_region());
XMLNode &before = region->get_state();
if (in) {
region->set_fade_in_active (!region->fade_in_active());
} else {
region->set_fade_out_active (!region->fade_out_active());
}
XMLNode &after = region->get_state();
session->add_command(new MementoCommand<AudioRegion>(*region.get(), &before, &after));
}
commit_reversible_command ();
}
void
Editor::set_fade_in_shape (AudioRegion::FadeShape shape)
{

View file

@ -125,7 +125,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
virtual Gtk::HBox& get_status_bar_packer() = 0;
virtual void set_zoom_focus (Editing::ZoomFocus) = 0;
virtual Editing::ZoomFocus get_zoom_focus () const = 0;
virtual gdouble get_current_zoom () = 0;
virtual gdouble get_current_zoom () const = 0;
virtual PlaylistSelector& playlist_selector() const = 0;
virtual void route_name_changed (TimeAxisView *) = 0;
virtual void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>) = 0;

View file

@ -70,7 +70,7 @@ void
TempoDialog::init (const BBT_Time& when, double bpm, bool movable)
{
bpm_spinner.set_numeric (true);
bpm_spinner.set_digits (1);
bpm_spinner.set_digits (2);
bpm_spinner.set_wrap (true);
bpm_spinner.set_value (bpm);