add arrow head to selected marker line; fix no-import-embed when selecting "use times...
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 12 Nov 2007 15:01:56 +0000 (15:01 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 12 Nov 2007 15:01:56 +0000 (15:01 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2621 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_actions.cc
gtk2_ardour/editor_audio_import.cc
gtk2_ardour/editor_keyboard.cc
gtk2_ardour/editor_mouse.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/marker.cc
gtk2_ardour/public_editor.h

index 6756b40fcf1908170229bc075596189bcf084757..33214d2cbd11e1fd3464b6701fccd52f3848f275 100644 (file)
@@ -316,6 +316,7 @@ Editor::Editor ()
        button_release_can_deselect = true;
        canvas_idle_queued = false;
        _dragging_playhead = false;
+       _dragging_edit_point = false;
        _dragging_hscrollbar = false;
 
        scrubbing_direction = 0;
@@ -884,6 +885,10 @@ Editor::instant_save ()
 void
 Editor::edit_point_clock_changed()
 {
+       if (_dragging_edit_point) {
+               return;
+       }
+
        if (selection->markers.empty()) {
                return;
        }
@@ -3970,13 +3975,11 @@ Editor::sort_track_selection ()
 }
 
 nframes64_t
-Editor::get_preferred_edit_position() const
+Editor::get_preferred_edit_position()
 {
        bool ignored;
        nframes64_t where = 0;
 
-       // XXX EDIT CURSOR used to sync with edit cursor clock
-
        switch (_edit_point) {
        case EditAtPlayhead:
                where = session->audible_frame();
@@ -3988,6 +3991,7 @@ Editor::get_preferred_edit_position() const
                        Location* loc = find_location_from_marker (selection->markers.front(), whocares);
                        if (loc) {
                                where =  loc->start();
+                               break;
                        }
                } 
                /* fallthru */
@@ -3995,13 +3999,13 @@ Editor::get_preferred_edit_position() const
        default:
        case EditAtMouse:
                if (!mouse_frame (where, ignored)) {
-                       /* XXX not right */
+                       /* XXX not right but what can we do ? */
                        return 0;
                }
+               snap_to (where);
+               break;
        }
 
-       // XXX MAKE ME SNAP
-       // snap_to (where);
        return where;
 }
 
index 0ad5339995048db76dc099cef682e7e18077fb5d..7d87776df5e49d50a67a470cf9b61f8ae628c116 100644 (file)
@@ -344,7 +344,7 @@ class Editor : public PublicEditor
        void reset_zoom (double);
        void reposition_and_zoom (nframes_t, double);
 
-       nframes64_t get_preferred_edit_position () const;
+       nframes64_t get_preferred_edit_position ();
 
        bool update_mouse_speed ();
        bool decelerate_mouse_speed ();
@@ -942,6 +942,8 @@ class Editor : public PublicEditor
 
        void reset_focus ();
 
+       void split ();
+
        void cut ();
        void copy ();
        void paste (float times);
@@ -1139,6 +1141,7 @@ class Editor : public PublicEditor
        void region_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
 
        bool _dragging_playhead;
+       bool _dragging_edit_point;
 
        void cursor_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
        void cursor_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
@@ -1234,23 +1237,15 @@ class Editor : public PublicEditor
        void track_canvas_allocate (Gtk::Allocation alloc);
        bool track_canvas_size_allocated ();
 
-       void set_playhead_cursor (GdkEvent* event);
+       void set_playhead_cursor ();
 
        void kbd_driver (sigc::slot<void,GdkEvent*>, bool use_track_canvas = true, bool use_time_canvas = true, bool can_select = true);
-       void kbd_set_playhead_cursor ();
-       void kbd_set_edit_point ();
        void kbd_mute_unmute_region ();
-       void kbd_split ();
        void kbd_set_sync_position ();
-       void kbd_align (ARDOUR::RegionPoint);
-       void kbd_align_relative (ARDOUR::RegionPoint);
        void kbd_brush ();
        void kbd_audition ();
 
-       void kbd_do_split (GdkEvent*);
        void kbd_do_set_sync_position (GdkEvent* ev);
-       void kbd_do_align (GdkEvent*, ARDOUR::RegionPoint);
-       void kbd_do_align_relative (GdkEvent*, ARDOUR::RegionPoint);
        void kbd_do_brush (GdkEvent*);
        void kbd_do_audition (GdkEvent*);
 
@@ -1920,7 +1915,7 @@ class Editor : public PublicEditor
        Gtk::ComboBoxText edit_point_selector;
 
        void set_edit_point_preference (Editing::EditPoint ep);
-       void set_edit_point (GdkEvent* ev);
+       void set_edit_point ();
        void edit_point_selection_done ();
        void edit_point_chosen (Editing::EditPoint);
        Glib::RefPtr<Gtk::RadioAction> edit_point_action (Editing::EditPoint);
index 937d83c7c8c905f6fb764eff186c6b555da91c1b..6e5e9fc49ad8295997a4d2408620884185731eb3 100644 (file)
@@ -219,13 +219,14 @@ Editor::register_actions ()
         ActionManager::session_sensitive_actions.push_back (act);
        act = ActionManager::register_action (editor_actions, "mute-unmute-region", _("Mute/Unmute Region"), mem_fun(*this, &Editor::kbd_mute_unmute_region));
        ActionManager::session_sensitive_actions.push_back (act);
-       act = ActionManager::register_action (editor_actions, "set-playhead", _("Set Playhead"), mem_fun(*this, &Editor::kbd_set_playhead_cursor));
+       act = ActionManager::register_action (editor_actions, "set-region-sync-position", _("Set Region Sync Position"), mem_fun(*this, &Editor::kbd_set_sync_position));
+        ActionManager::session_sensitive_actions.push_back (act);
+
+       act = ActionManager::register_action (editor_actions, "set-playhead", _("Set Playhead"), mem_fun(*this, &Editor::set_playhead_cursor));
        ActionManager::session_sensitive_actions.push_back (act);
-       act = ActionManager::register_action (editor_actions, "set-edit-point", _("Set Edit Point"), mem_fun(*this, &Editor::kbd_set_edit_point));
+       act = ActionManager::register_action (editor_actions, "set-edit-point", _("Set Edit Point"), mem_fun(*this, &Editor::set_edit_point));
        ActionManager::session_sensitive_actions.push_back (act);
-       act = ActionManager::register_action (editor_actions, "split-region", _("Split Region"), mem_fun(*this, &Editor::kbd_split));
-        ActionManager::session_sensitive_actions.push_back (act);
-       act = ActionManager::register_action (editor_actions, "set-region-sync-position", _("Set Region Sync Position"), mem_fun(*this, &Editor::kbd_set_sync_position));
+       act = ActionManager::register_action (editor_actions, "split-region", _("Split Region"), mem_fun(*this, &Editor::split));
         ActionManager::session_sensitive_actions.push_back (act);
 
        undo_action = act = ActionManager::register_action (editor_actions, "undo", _("Undo"), bind (mem_fun(*this, &Editor::undo), 1U));
index 475c103b31270071128ebf19717478ba4b2d0be5..714a41577ffa3929c8239c5fb2087118e764b005 100644 (file)
@@ -156,10 +156,6 @@ Editor::external_audio_dialog ()
                break;
        }
 
-       if (where < 0) {
-               return;
-       }
-
        SrcQuality quality = sfbrowser->get_src_quality();
 
        if (sfbrowser->copy_files_btn.get_active()) {
@@ -594,7 +590,6 @@ Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64
                if (sources[0]->natural_position() != 0) {
                        pos = sources[0]->natural_position();
                } else {
-                       // XXX is this the best alternative ?
                        pos = get_preferred_edit_position ();
                }
        }
index 8eb0d1a6e4fbd266a6c7048a5e3916f85b14215f..2912e2f4eeaf4de046737f3f4d78616e776ce801 100644 (file)
@@ -75,91 +75,6 @@ Editor::kbd_driver (sigc::slot<void,GdkEvent*> theslot, bool use_track_canvas, b
        }
 }
 
-void
-Editor::set_edit_point (GdkEvent* event)
-{
-       if (selection->markers.empty()) {
-               nframes64_t where = event_frame (event);
-
-               snap_to (where);
-               mouse_add_new_marker (where);
-
-       } else {
-               bool ignored;
-
-               Location* loc = find_location_from_marker (selection->markers.front(), ignored);
-
-               if (loc) {
-                       nframes64_t where = event_frame (event);
-                       snap_to (where);
-                       loc->move_to (where);
-               }
-       }
-}
-
-void
-Editor::set_playhead_cursor (GdkEvent* event)
-{
-       if (entered_marker) {
-               session->request_locate (entered_marker->position(), session->transport_rolling());
-       } else {
-               nframes_t pointer_frame = event_frame (event);
-               
-               if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
-                       snap_to (pointer_frame);
-               }
-               
-               if (session) {
-                       session->request_locate (pointer_frame, session->transport_rolling());
-               }
-       }
-}
-
-void
-Editor::kbd_set_edit_point ()
-{
-       kbd_driver (mem_fun(*this, &Editor::set_edit_point), true, true, false);
-}      
-
-void
-Editor::kbd_set_playhead_cursor ()
-{
-       kbd_driver (mem_fun(*this, &Editor::set_playhead_cursor), true, true, false);
-}
-
-void
-Editor::kbd_do_split (GdkEvent* ev)
-{
-       if (entered_regionview) {
-
-               nframes_t where = get_preferred_edit_position();
-
-               if (selection->regions.contains (entered_regionview)) {
-                       split_regions_at (where, selection->regions);
-               } else {
-                       RegionSelection s;
-                       s.add (entered_regionview);
-                       split_regions_at (where, s);
-               }
-
-       } else if (entered_marker) {
-
-               if (!selection->regions.empty()) {
-                       split_regions_at (entered_marker->position(), selection->regions);
-               } else {
-                       RegionSelection rs;
-                       rs = get_regions_at (entered_marker->position(), selection->tracks);
-                       split_regions_at (entered_marker->position(), rs);
-               }
-       }
-}
-
-void
-Editor::kbd_split ()
-{
-       kbd_driver (mem_fun(*this, &Editor::kbd_do_split), true, true, false);
-}
-
 void
 Editor::kbd_mute_unmute_region ()
 {
@@ -198,74 +113,6 @@ Editor::kbd_do_set_sync_position (GdkEvent* ev)
        }
 }
 
-void
-Editor::kbd_do_align (GdkEvent* ev, ARDOUR::RegionPoint what)
-{
-       if (entered_regionview) {
-
-               nframes_t where = event_frame (ev);
-               snap_to (where);
-
-               if (selection->regions.contains (entered_regionview)) {
-                       align_selection (what, where, selection->regions);
-               } else {
-                       RegionSelection s;
-                       s.add (entered_regionview);
-                       align_selection (what, where, s);
-               }
-
-       } else if (entered_marker) {
-
-               if (!selection->regions.empty()) {
-                       align_selection (what, entered_marker->position(), selection->regions);
-               } else {
-                       RegionSelection rs;
-                       rs = get_regions_at (entered_marker->position(), selection->tracks);
-                       align_selection (what, entered_marker->position(), rs);
-               }
-       }
-}
-
-void
-Editor::kbd_do_align_relative (GdkEvent* ev, ARDOUR::RegionPoint what)
-{
-       if (entered_regionview) {
-
-               nframes_t where = event_frame (ev);
-               snap_to (where);
-
-               if (selection->regions.contains (entered_regionview)) {
-                       align_selection_relative (what, where, selection->regions);
-               } else {
-                       RegionSelection s;
-                       s.add (entered_regionview);
-                       align_selection_relative (what, where, s);
-               }
-
-       } else if (entered_marker) {
-
-               if (!selection->regions.empty()) {
-                       align_selection_relative (what, entered_marker->position(), selection->regions);
-               } else {
-                       RegionSelection rs;
-                       rs = get_regions_at (entered_marker->position(), selection->tracks);
-                       align_selection_relative (what, entered_marker->position(), rs);
-               }
-       }
-}
-
-void
-Editor::kbd_align (ARDOUR::RegionPoint what)
-{
-       kbd_driver (bind (mem_fun(*this, &Editor::kbd_do_align), what));
-}
-
-void
-Editor::kbd_align_relative (ARDOUR::RegionPoint what)
-{
-       kbd_driver (bind (mem_fun(*this, &Editor::kbd_do_align), what), true, true, false);
-}
-
 void
 Editor::kbd_do_brush (GdkEvent *ev)
 {
index ebc17e41f75c95397eb9b3431a1c675a8bc28424..2b7360f41cdffc2896871442f40315db94eef42a 100644 (file)
@@ -2103,6 +2103,8 @@ Editor::start_marker_grab (ArdourCanvas::Item* item, GdkEvent* event)
 
        start_grab (event);
 
+       _dragging_edit_point = true;
+
        drag_info.copied_location = new Location (*location);
        drag_info.pointer_frame_offset = drag_info.grab_frame - (is_start ? location->start() : location->end());       
 
@@ -2150,7 +2152,6 @@ Editor::marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
        bool is_start;
        bool move_both = false;
 
-
        nframes_t newframe;
        if (drag_info.pointer_frame_offset <= drag_info.current_pointer_frame) {
                newframe = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
@@ -2231,7 +2232,8 @@ Editor::marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
 
        LocationMarkers* lm = find_location_markers (real_location);
        lm->set_position (copy_location->start(), copy_location->end());
-       
+       edit_point_clock.set (copy_location->start());
+
        show_verbose_time_cursor (newframe, 10);
 }
 
@@ -2242,6 +2244,8 @@ Editor::marker_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
                marker_drag_motion_callback (item, event);
 
        }
+
+       _dragging_edit_point = false;
        
        Marker* marker = (Marker *) drag_info.data;
        bool is_start;
index 2a57d4e41cfca583444e2386aa9829d63307fa95..7b303dc35253cf3d0888f790667a0c1276f6b8fe 100644 (file)
@@ -2583,13 +2583,31 @@ Editor::naturalize ()
 void
 Editor::align (RegionPoint what)
 {
-       align_selection (what, get_preferred_edit_position(), selection->regions);
+       nframes64_t where = get_preferred_edit_position();
+
+       if (!selection->regions.empty()) {
+               align_selection (what, where, selection->regions);
+       } else {
+
+               RegionSelection rs;
+               rs = get_regions_at (where, selection->tracks);
+               align_selection (what, where, rs);
+       }
 }
 
 void
 Editor::align_relative (RegionPoint what)
 {
-       align_selection_relative (what, get_preferred_edit_position(), selection->regions);
+       nframes64_t where = get_preferred_edit_position();
+
+       if (!selection->regions.empty()) {
+               align_selection_relative (what, where, selection->regions);
+       } else {
+
+               RegionSelection rs;
+               rs = get_regions_at (where, selection->tracks);
+               align_selection_relative (what, where, rs);
+       }
 }
 
 struct RegionSortByTime {
@@ -3835,3 +3853,68 @@ Editor::update_xfade_visibility ()
                }
        }
 }
+
+void
+Editor::set_edit_point ()
+{
+       nframes64_t where;
+       bool ignored;
+
+       if (!mouse_frame (where, ignored)) {
+               return;
+       }
+       
+       snap_to (where);
+
+       if (selection->markers.empty()) {
+               
+               mouse_add_new_marker (where);
+
+       } else {
+               bool ignored;
+
+               Location* loc = find_location_from_marker (selection->markers.front(), ignored);
+
+               if (loc) {
+                       loc->move_to (where);
+               }
+       }
+}
+
+void
+Editor::set_playhead_cursor ()
+{
+       if (entered_marker) {
+               session->request_locate (entered_marker->position(), session->transport_rolling());
+       } else {
+               nframes64_t where;
+               bool ignored;
+
+               if (!mouse_frame (where, ignored)) {
+                       return;
+               }
+                       
+               snap_to (where);
+               
+               if (session) {
+                       session->request_locate (where, session->transport_rolling());
+               }
+       }
+}
+
+void
+Editor::split ()
+{
+       nframes64_t where = get_preferred_edit_position();
+
+       if (!selection->regions.empty()) {
+               
+               split_regions_at (where, selection->regions);
+
+       } else {
+               
+               RegionSelection rs;
+               rs = get_regions_at (where, selection->tracks);
+               split_regions_at (where, rs);
+       }
+}
index 505e577c4288d5ae8356efebd1de462400ee4db4..63a6a8bc5175464388c8b1270cb34af6990353d8 100644 (file)
@@ -299,6 +299,13 @@ Marker::add_line (ArdourCanvas::Group* group, double initial_height)
                line->property_width_pixels() = 1;
                line->property_points() = *line_points;
                line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EditPoint.get();
+               line->property_first_arrowhead() = TRUE;
+               line->property_last_arrowhead() = TRUE;
+               line->property_arrow_shape_a() = 11.0;
+               line->property_arrow_shape_b() = 0.0;
+               line->property_arrow_shape_c() = 9.0;
+
+               line->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this));
        }
 
        show_line ();
index 3badc327e6067de02fee99905c4c2d1f0b926df4..bd8e71f2694e9c86b038f20bf2d46ffb862f7c2f 100644 (file)
@@ -155,7 +155,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
        virtual void remove_last_capture () = 0;
        virtual void maximise_editing_space() = 0;
        virtual void restore_editing_space() = 0;
-       virtual nframes64_t get_preferred_edit_position () const = 0;
+       virtual nframes64_t get_preferred_edit_position () = 0;
 
        sigc::signal<void> ZoomFocusChanged;
        sigc::signal<void> ZoomChanged;