make click on empty canvas area clear selection; change zoom-ot-region to be a toggle...
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 17 Dec 2007 14:44:27 +0000 (14:44 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 17 Dec 2007 14:44:27 +0000 (14:44 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2789 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour-sae-ansi.bindings.in
gtk2_ardour/ardour-sae.menus
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_actions.cc
gtk2_ardour/editor_canvas_events.cc
gtk2_ardour/editor_mouse.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/editor_region_list.cc

index 78af95aa15fb58493acca3e682f8c0758b9dc24e..82f967c7659ee9d25636afe7d5127770fba46369 100644 (file)
@@ -66,7 +66,7 @@
 (gtk_accel_path "<Actions>/Editor/jump-backward-to-mark" "<%PRIMARY%>KP_Left")
 ; (gtk_accel_path "<Actions>/Main/AudioFileFormatData" "")
 ; (gtk_accel_path "<Actions>/options/MeterFalloffFastest" "")
-(gtk_accel_path "<Actions>/Editor/audition-region" "w")
+(gtk_accel_path "<Actions>/Editor/play-selected-regions" "w")
 (gtk_accel_path "<Actions>/Transport/Forward" "<%PRIMARY%>rightarrow")
 ; (gtk_accel_path "<Actions>/Snap/snap-to-smpte-seconds" "")
 ; (gtk_accel_path "<Actions>/Snap/snap-to-smpte-frame" "")
index 1b80e5c3b004326617f1087b90a076246004bb77..7a74beb00b383118f07d7a67b231b0f835104575 100644 (file)
                   <menuitem action='edit-to-playhead'/>
               </menu>
               <menu name='KeyMouse Actions' action='KeyMouse Actions'>
-                       <menuitem action='audition-region'/>
+                       <menuitem action='play-selected-regions'/>
                                <menuitem action='brush-at-mouse'/>
                                <menuitem action='mute-unmute-region'/>
                        <separator/>
index ba824512df348a11a1ccb3f9f04b822e6f137012..6dc7ecde41fd21b4df91655f73a3f7dc8f758358 100644 (file)
@@ -312,6 +312,7 @@ Editor::Editor ()
        _dragging_edit_point = false;
        _dragging_hscrollbar = false;
        select_new_marker = false;
+       zoomed_to_region = false;
 
        scrubbing_direction = 0;
 
@@ -1719,7 +1720,7 @@ Editor::add_region_context_items (AudioStreamView* sv, boost::shared_ptr<Region>
        items.push_back (MenuElem (_("Remove sync point"), mem_fun(*this, &Editor::remove_region_sync)));
        items.push_back (SeparatorElem());
 
-       items.push_back (MenuElem (_("Audition"), mem_fun(*this, &Editor::audition_selected_region)));
+       items.push_back (MenuElem (_("Audition"), mem_fun(*this, &Editor::play_selected_region)));
        items.push_back (MenuElem (_("Export"), mem_fun(*this, &Editor::export_region)));
        items.push_back (MenuElem (_("Bounce"), mem_fun(*this, &Editor::bounce_region_selection)));
 
index 4994e9aa575d71aed7feb928cc553992bc1e741f..71a8440ea39fe2829d9f38aae761b94f03836ccf 100644 (file)
@@ -1000,13 +1000,14 @@ class Editor : public PublicEditor
        void play_from_start ();
        void play_from_edit_point ();
        void play_selected_region ();
-       void audition_selected_region ();
        void loop_selected_region ();
        void play_location (ARDOUR::Location&);
        void loop_location (ARDOUR::Location&);
 
        void temporal_zoom_selection ();
        void temporal_zoom_region ();
+       void toggle_zoom_region ();
+       bool zoomed_to_region;
        void temporal_zoom_session ();
        void temporal_zoom (gdouble scale);
        void temporal_zoom_by_frame (nframes_t start, nframes_t end, const string & op);
index 360ba10b448529655f7b13014ed050c23c1efb1d..35ea88a20f9c2e2a65d034c21b63359b3f0dd617 100644 (file)
@@ -209,7 +209,7 @@ Editor::register_actions ()
        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 Region"), mem_fun(*this, &Editor::temporal_zoom_region));
+       act = ActionManager::register_action (editor_actions, "zoom-to-region", _("Zoom to Region"), mem_fun(*this, &Editor::toggle_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);
@@ -294,7 +294,7 @@ Editor::register_actions ()
        act = ActionManager::register_action (editor_actions, "align-regions-sync-relative", _("Align Regions Sync Relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::SyncPoint));
        ActionManager::session_sensitive_actions.push_back (act);
        
-        act = ActionManager::register_action (editor_actions, "audition-region", _("Audition Region"), mem_fun(*this, &Editor::audition_selected_region));
+        act = ActionManager::register_action (editor_actions, "play-selected-regions", _("Play Selected Region(s)"), mem_fun(*this, &Editor::play_selected_region));
         ActionManager::session_sensitive_actions.push_back (act);
         act = ActionManager::register_action (editor_actions, "brush-at-mouse", _("Brush at Mouse"), mem_fun(*this, &Editor::kbd_brush));
         ActionManager::session_sensitive_actions.push_back (act);
index 2a24eb3d731f446ceead0aa02579c93882c4dffc..f7e7a590dd39596ad8887304c6bc061dd0ab8e37 100644 (file)
@@ -168,6 +168,7 @@ Editor::track_canvas_scroll_event (GdkEventScroll *event)
 bool
 Editor::track_canvas_button_press_event (GdkEventButton *event)
 {
+       selection->clear ();
        track_canvas.grab_focus();
        return false;
 }
index f65325c2deba5847c461a01a091d2bd23f306f76..ecce201af3d8cbe279bb3ea8e1812808f4888705 100644 (file)
@@ -1070,7 +1070,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
                                /* no drag, just a click */
                                switch (item_type) {
                                case RegionItem:
-                                       audition_selected_region ();
+                                       play_selected_region ();
                                        break;
                                default:
                                        break;
index 2107d3718edc3c1b455a6f07449071d7de6feb71..f3a493e1959f215e55bd361ddab4777c04ea6453 100644 (file)
@@ -1588,6 +1588,17 @@ Editor::temporal_zoom_region ()
        }
 
        temporal_zoom_by_frame (start, end, "zoom to region");
+       zoomed_to_region = true;
+}
+
+void
+Editor::toggle_zoom_region ()
+{
+       if (zoomed_to_region) {
+               swap_visual_state ();
+       } else {
+               temporal_zoom_region ();
+       }
 }
 
 void
@@ -2117,16 +2128,6 @@ Editor::play_selection ()
        session->request_play_range (true);
 }
 
-void
-Editor::play_selected_region ()
-{
-       if (!selection->regions.empty()) {
-               RegionView *rv = *(selection->regions.begin());
-
-               session->request_bounded_roll (rv->region()->position(), rv->region()->last_frame());   
-       }
-}
-
 void
 Editor::loop_selected_region ()
 {
@@ -2280,7 +2281,7 @@ Editor::audition_playlist_region_via_route (boost::shared_ptr<Region> region, Ro
 }
 
 void
-Editor::audition_selected_region ()
+Editor::play_selected_region ()
 {
        nframes64_t start = max_frames;
        nframes64_t end = 0;
@@ -2300,11 +2301,7 @@ Editor::audition_selected_region ()
                }
        }
 
-       list<AudioRange> lr;
-       lr.push_back (AudioRange (start, end, 0));
-
-       session->set_audio_range (lr);
-       session->request_play_range (true);
+       session->request_bounded_roll (start, end);
 }
 
 void
index 48cfbd06f883bc5e9a21bd9a8b7138ef3f5de81d..1678b3961f09ddf24a3fde16c3d7a083a418895e 100644 (file)
@@ -611,6 +611,8 @@ Editor::region_list_display_drag_data_received (const RefPtr<Gdk::DragContext>&
 {
        vector<ustring> paths;
 
+       cerr << "ERLD:dddr target = " << data.get_target() << endl;
+
        if (convert_drop_to_paths (paths, context, x, y, data, info, time) == 0) {
                nframes64_t pos = 0;
                do_embed (paths, Editing::ImportDistinctFiles, ImportAsRegion, pos);