13
0

add functionality for cut tool

This commit is contained in:
Paul Davis 2014-07-07 07:05:27 -04:00
parent 7ec397c019
commit 779fe6c082
6 changed files with 56 additions and 6 deletions

View File

@ -470,6 +470,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void metric_get_samples (std::vector<ArdourCanvas::Ruler::Mark>&, gdouble, gdouble, gint);
void metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>&, gdouble, gdouble, gint);
/* editing operations that need to be public */
void mouse_add_new_marker (framepos_t where, bool is_cd=false, bool is_xrun=false);
void split_region ();
void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false);
protected:
void map_transport_state ();
void map_position_change (framepos_t);
@ -625,7 +630,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void hide_marker (ArdourCanvas::Item*, GdkEvent*);
void clear_marker_display ();
void mouse_add_new_marker (framepos_t where, bool is_cd=false, bool is_xrun=false);
void mouse_add_new_range (framepos_t);
bool choose_new_marker_name(std::string &name);
void update_cd_marker_display ();
@ -1135,7 +1139,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void lower_region_to_bottom ();
void split_regions_at (framepos_t, RegionSelection&);
void split_region_at_transients ();
void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false);
void crop_region_to_selection ();
void crop_region_to (framepos_t start, framepos_t end);
void set_sync_point (framepos_t, const RegionSelection&);
@ -1187,8 +1190,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void reset_focus ();
void split_region ();
void delete_ ();
void cut ();
void copy ();

View File

@ -5447,3 +5447,24 @@ CrossfadeEdgeDrag::aborted (bool)
}
}
RegionCutDrag::RegionCutDrag (Editor* e, ArdourCanvas::Item* item)
: Drag (e, item, true)
{
}
void
RegionCutDrag::motion (GdkEvent*, bool)
{
}
void
RegionCutDrag::finished (GdkEvent*, bool)
{
_editor->split_region ();
}
void
RegionCutDrag::aborted (bool)
{
}

View File

@ -440,6 +440,16 @@ private:
};
/** "Drag" to cut a region (action only on button release) */
class RegionCutDrag : public Drag
{
public:
RegionCutDrag (Editor*, ArdourCanvas::Item*);
void motion (GdkEvent*, bool);
void finished (GdkEvent*, bool);
void aborted (bool);
};
/** Drags to create regions */
class RegionCreateDrag : public Drag
{

View File

@ -40,7 +40,7 @@ using namespace PBD;
using namespace Editing;
void
Editor::keyboard_selection_finish (bool add)
Editor::keyboard_selection_finish (bool /*add*/)
{
if (_session) {

View File

@ -240,7 +240,7 @@ Editor::set_mouse_mode (MouseMode m, bool force)
break;
case MouseCut:
act = ActionManager::get_action (X_("MouseCut"), X_("set-mouse-mode-cut"));
act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-cut"));
break;
case MouseObject:
@ -854,6 +854,23 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
}
break;
case MouseCut:
switch (item_type) {
case RegionItem:
case FadeInHandleItem:
case FadeOutHandleItem:
case LeftFrameHandle:
case RightFrameHandle:
case FeatureLineItem:
case RegionViewNameHighlight:
case RegionViewName:
_drags->set (new RegionCutDrag (this, item), event, current_canvas_cursor);
break;
default:
break;
}
break;
case MouseObject:
switch (item_type) {
case NoteItem:

View File

@ -295,6 +295,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
virtual void update_tearoff_visibility () = 0;
virtual framepos_t get_preferred_edit_position (bool ignore_playhead = false, bool from_context_menu = false) = 0;
virtual void toggle_meter_updating() = 0;
virtual void split_region () = 0;
virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false) = 0;
virtual void mouse_add_new_marker (framepos_t where, bool is_cd=false, bool is_xrun=false) = 0;
virtual void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>) = 0;