Unify gain and draw tools.
There might be a few special cases lingering around from attempts at magic tool business, but this seems to work fine as far as I can tell.
This commit is contained in:
@@ -1050,7 +1050,7 @@ AudioRegionView::update_envelope_visibility ()
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config->get_show_region_gain() || trackview.editor().current_mouse_mode() == Editing::MouseGain || trackview.editor().current_mouse_mode() == Editing::MouseRange ) {
|
||||
if (Config->get_show_region_gain() || trackview.editor().current_mouse_mode() == Editing::MouseDraw || trackview.editor().current_mouse_mode() == Editing::MouseRange ) {
|
||||
gain_line->add_visibility (AutomationLine::Line);
|
||||
} else {
|
||||
gain_line->hide ();
|
||||
|
||||
@@ -69,7 +69,6 @@ REGIONLISTSORTTYPE(ByTimestamp)
|
||||
MOUSEMODE(MouseObject)
|
||||
MOUSEMODE(MouseRange)
|
||||
MOUSEMODE(MouseCut)
|
||||
MOUSEMODE(MouseGain)
|
||||
MOUSEMODE(MouseTimeFX)
|
||||
MOUSEMODE(MouseAudition)
|
||||
MOUSEMODE(MouseDraw)
|
||||
|
||||
@@ -2852,7 +2852,6 @@ Editor::setup_toolbar ()
|
||||
mouse_mode_size_group->add_widget (mouse_move_button);
|
||||
mouse_mode_size_group->add_widget (mouse_cut_button);
|
||||
mouse_mode_size_group->add_widget (mouse_select_button);
|
||||
mouse_mode_size_group->add_widget (mouse_gain_button);
|
||||
mouse_mode_size_group->add_widget (mouse_timefx_button);
|
||||
mouse_mode_size_group->add_widget (mouse_audition_button);
|
||||
mouse_mode_size_group->add_widget (mouse_draw_button);
|
||||
@@ -2892,7 +2891,6 @@ Editor::setup_toolbar ()
|
||||
}
|
||||
|
||||
if (!ARDOUR::Profile->get_trx()) {
|
||||
mouse_mode_hbox->pack_start (mouse_gain_button, false, false);
|
||||
mouse_mode_hbox->pack_start (mouse_timefx_button, false, false);
|
||||
mouse_mode_hbox->pack_start (mouse_audition_button, false, false);
|
||||
mouse_mode_hbox->pack_start (mouse_draw_button, false, false);
|
||||
@@ -3184,8 +3182,7 @@ Editor::setup_tooltips ()
|
||||
ARDOUR_UI::instance()->set_tip (mouse_move_button, _("Object Mode (select/move Objects)"));
|
||||
ARDOUR_UI::instance()->set_tip (mouse_cut_button, _("Cut Mode (split Regions)"));
|
||||
ARDOUR_UI::instance()->set_tip (mouse_select_button, _("Range Mode (select/move Ranges)"));
|
||||
ARDOUR_UI::instance()->set_tip (mouse_draw_button, _("Draw/Edit MIDI Notes"));
|
||||
ARDOUR_UI::instance()->set_tip (mouse_gain_button, _("Draw Region Gain"));
|
||||
ARDOUR_UI::instance()->set_tip (mouse_draw_button, _("Draw/Edit Gain/Notes/Automation"));
|
||||
ARDOUR_UI::instance()->set_tip (mouse_timefx_button, _("Stretch/Shrink Regions and MIDI Notes"));
|
||||
ARDOUR_UI::instance()->set_tip (mouse_audition_button, _("Listen to Specific Regions"));
|
||||
ARDOUR_UI::instance()->set_tip (internal_edit_button, _("Note Level Editing"));
|
||||
|
||||
@@ -1630,7 +1630,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||
ArdourButton mouse_select_button;
|
||||
ArdourButton mouse_draw_button;
|
||||
ArdourButton mouse_move_button;
|
||||
ArdourButton mouse_gain_button;
|
||||
ArdourButton mouse_timefx_button;
|
||||
ArdourButton mouse_audition_button;
|
||||
ArdourButton mouse_cut_button;
|
||||
|
||||
@@ -465,11 +465,6 @@ Editor::register_actions ()
|
||||
mouse_draw_button.set_image (::get_icon("midi_tool_pencil"));
|
||||
mouse_draw_button.set_name ("mouse mode button");
|
||||
|
||||
act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-gain", _("Gain Tool"), sigc::bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseGain));
|
||||
mouse_gain_button.set_related_action (act);
|
||||
mouse_gain_button.set_image (::get_icon("tool_gain"));
|
||||
mouse_gain_button.set_name ("mouse mode button");
|
||||
|
||||
act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-audition", _("Audition Tool"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseAudition));
|
||||
mouse_audition_button.set_related_action (act);
|
||||
mouse_audition_button.set_image (::get_icon("tool_audition"));
|
||||
|
||||
@@ -1113,10 +1113,6 @@ Editor::which_mode_cursor () const
|
||||
mode_cursor = _cursors->midi_pencil;
|
||||
break;
|
||||
|
||||
case MouseGain:
|
||||
mode_cursor = _cursors->cross_hair;
|
||||
break;
|
||||
|
||||
case MouseTimeFX:
|
||||
mode_cursor = _cursors->time_fx; // just use playhead
|
||||
break;
|
||||
@@ -1300,12 +1296,12 @@ Editor::choose_canvas_cursor_on_entry (GdkEventCrossing* /*event*/, ItemType typ
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (mouse_mode == MouseGain) {
|
||||
} else if (mouse_mode == MouseDraw) {
|
||||
|
||||
/* ControlPointItem is not really specific to region gain mode
|
||||
but it is the same cursor so don't worry about this for now.
|
||||
The result is that we'll see the fader cursor if we enter
|
||||
non-region-gain-line control points while in MouseGain
|
||||
non-region-gain-line control points while in MouseDraw
|
||||
mode, even though we can't edit them in this mode.
|
||||
*/
|
||||
|
||||
|
||||
@@ -3644,8 +3644,8 @@ ControlPointDrag::aborted (bool)
|
||||
bool
|
||||
ControlPointDrag::active (Editing::MouseMode m)
|
||||
{
|
||||
if (m == Editing::MouseGain) {
|
||||
/* always active in mouse gain */
|
||||
if (m == Editing::MouseDraw) {
|
||||
/* always active in mouse draw */
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
* @return true if this drag should happen in this mouse mode.
|
||||
*/
|
||||
virtual bool active (Editing::MouseMode m) {
|
||||
return (m != Editing::MouseGain);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return minimum number of frames (in x) and pixels (in y) that should be considered a movement */
|
||||
@@ -523,6 +523,14 @@ public:
|
||||
void finished (GdkEvent *, bool);
|
||||
void aborted (bool);
|
||||
|
||||
bool active (Editing::MouseMode mode) {
|
||||
return mode == Editing::MouseDraw;
|
||||
}
|
||||
|
||||
bool y_movement_matters () const {
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
double y_to_region (double) const;
|
||||
framecnt_t grid_frames (framepos_t) const;
|
||||
@@ -689,10 +697,6 @@ public:
|
||||
void finished (GdkEvent *, bool);
|
||||
void aborted (bool);
|
||||
|
||||
bool active (Editing::MouseMode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool allow_vertical_autoscroll () const {
|
||||
return false;
|
||||
}
|
||||
@@ -820,10 +824,6 @@ public:
|
||||
void finished (GdkEvent *, bool);
|
||||
void aborted (bool);
|
||||
|
||||
bool active (Editing::MouseMode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
AutomationLine* _line;
|
||||
@@ -843,10 +843,6 @@ public:
|
||||
void finished (GdkEvent *, bool);
|
||||
void aborted (bool);
|
||||
|
||||
bool active (Editing::MouseMode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
ArdourCanvas::Line* _line;
|
||||
@@ -1054,10 +1050,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool active (Editing::MouseMode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
void setup (std::list<boost::shared_ptr<AutomationLine> > const &);
|
||||
double y_fraction (boost::shared_ptr<AutomationLine>, double global_y_position) const;
|
||||
|
||||
@@ -255,10 +255,6 @@ Editor::set_mouse_mode (MouseMode m, bool force)
|
||||
act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-draw"));
|
||||
break;
|
||||
|
||||
case MouseGain:
|
||||
act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-gain"));
|
||||
break;
|
||||
|
||||
case MouseTimeFX:
|
||||
act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-timefx"));
|
||||
break;
|
||||
@@ -307,10 +303,6 @@ Editor::mouse_mode_toggled (MouseMode m)
|
||||
act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-draw"));
|
||||
break;
|
||||
|
||||
case MouseGain:
|
||||
act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-gain"));
|
||||
break;
|
||||
|
||||
case MouseTimeFX:
|
||||
act = ActionManager::get_action (X_("MouseMode"), X_("set-mouse-mode-timefx"));
|
||||
break;
|
||||
@@ -463,7 +455,6 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp
|
||||
if (((mouse_mode != MouseObject) &&
|
||||
(mouse_mode != MouseAudition || item_type != RegionItem) &&
|
||||
(mouse_mode != MouseTimeFX || item_type != RegionItem) &&
|
||||
(mouse_mode != MouseGain) &&
|
||||
(mouse_mode != MouseDraw)) ||
|
||||
((event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE) || event->button.button > 3) ||
|
||||
(internal_editing() && mouse_mode != MouseTimeFX)) {
|
||||
@@ -750,36 +741,6 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||
return true;
|
||||
break;
|
||||
|
||||
case MouseDraw:
|
||||
switch (item_type) {
|
||||
case NoteItem:
|
||||
/* Existing note: allow trimming/motion */
|
||||
if (internal_editing()) {
|
||||
/* trim notes if we're in internal edit mode and near the ends of the note */
|
||||
NoteBase* cn = reinterpret_cast<NoteBase*>(item->get_data ("notebase"));
|
||||
assert (cn);
|
||||
if (cn->big_enough_to_trim() && cn->mouse_near_ends()) {
|
||||
_drags->set (new NoteResizeDrag (this, item), event, current_canvas_cursor);
|
||||
} else {
|
||||
_drags->set (new NoteDrag (this, item), event);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case StreamItem:
|
||||
if (internal_editing()) {
|
||||
if (dynamic_cast<MidiTimeAxisView*> (clicked_axisview)) {
|
||||
_drags->set (new RegionCreateDrag (this, item, clicked_axisview), event);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case MouseCut:
|
||||
switch (item_type) {
|
||||
case RegionItem:
|
||||
@@ -985,7 +946,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||
return true;
|
||||
break;
|
||||
|
||||
case MouseGain:
|
||||
case MouseDraw:
|
||||
switch (item_type) {
|
||||
case GainLineItem:
|
||||
_drags->set (new LineDrag (this, item), event);
|
||||
@@ -1019,7 +980,31 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||
case AutomationLineItem:
|
||||
_drags->set (new LineDrag (this, item), event);
|
||||
break;
|
||||
|
||||
|
||||
case NoteItem:
|
||||
/* Existing note: allow trimming/motion */
|
||||
if (internal_editing()) {
|
||||
/* trim notes if we're in internal edit mode and near the ends of the note */
|
||||
NoteBase* cn = reinterpret_cast<NoteBase*>(item->get_data ("notebase"));
|
||||
assert (cn);
|
||||
if (cn->big_enough_to_trim() && cn->mouse_near_ends()) {
|
||||
_drags->set (new NoteResizeDrag (this, item), event, current_canvas_cursor);
|
||||
} else {
|
||||
_drags->set (new NoteDrag (this, item), event);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case StreamItem:
|
||||
if (internal_editing()) {
|
||||
if (dynamic_cast<MidiTimeAxisView*> (clicked_axisview)) {
|
||||
_drags->set (new RegionCreateDrag (this, item, clicked_axisview), event);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1525,23 +1510,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||
}
|
||||
|
||||
switch (eff) {
|
||||
case MouseObject:
|
||||
case MouseDraw:
|
||||
switch (item_type) {
|
||||
case AutomationTrackItem:
|
||||
atv = dynamic_cast<AutomationTimeAxisView*>(clicked_axisview);
|
||||
if (atv) {
|
||||
bool with_guard_points = Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier);
|
||||
atv->add_automation_event (event, where, event->button.y, with_guard_points);
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case MouseGain:
|
||||
switch (item_type) {
|
||||
case RegionItem:
|
||||
{
|
||||
@@ -1560,8 +1529,10 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||
|
||||
case AutomationTrackItem: {
|
||||
bool with_guard_points = Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier);
|
||||
dynamic_cast<AutomationTimeAxisView*>(clicked_axisview)->
|
||||
add_automation_event (event, where, event->button.y, with_guard_points);
|
||||
atv = dynamic_cast<AutomationTimeAxisView*>(clicked_axisview);
|
||||
if (atv) {
|
||||
atv->add_automation_event (event, where, event->button.y, with_guard_points);
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
@@ -1663,7 +1634,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
|
||||
|
||||
switch (item_type) {
|
||||
case ControlPointItem:
|
||||
if (mouse_mode == MouseGain || mouse_mode == MouseObject) {
|
||||
if (mouse_mode == MouseDraw || mouse_mode == MouseObject) {
|
||||
cp = static_cast<ControlPoint*>(item->get_data ("control_point"));
|
||||
cp->show ();
|
||||
|
||||
@@ -1675,7 +1646,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
|
||||
break;
|
||||
|
||||
case GainLineItem:
|
||||
if (mouse_mode == MouseGain) {
|
||||
if (mouse_mode == MouseDraw) {
|
||||
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
|
||||
if (line) {
|
||||
line->set_outline_color (ARDOUR_UI::config()->get_EnteredGainLine());
|
||||
@@ -1684,7 +1655,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
|
||||
break;
|
||||
|
||||
case AutomationLineItem:
|
||||
if (mouse_mode == MouseGain || mouse_mode == MouseObject) {
|
||||
if (mouse_mode == MouseDraw || mouse_mode == MouseObject) {
|
||||
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
|
||||
if (line) {
|
||||
line->set_outline_color (ARDOUR_UI::config()->get_EnteredAutomationLine());
|
||||
@@ -2453,11 +2424,6 @@ Editor::set_internal_edit (bool yn)
|
||||
(*i)->leave_internal_edit_mode ();
|
||||
}
|
||||
|
||||
if (mouse_mode == MouseDraw && pre_internal_mouse_mode != MouseDraw) {
|
||||
/* we were drawing .. flip back to something sensible */
|
||||
set_mouse_mode (pre_internal_mouse_mode);
|
||||
}
|
||||
|
||||
set_snap_to (pre_internal_snap_type);
|
||||
set_snap_mode (pre_internal_snap_mode);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,6 @@ setup_gtk_ardour_enums ()
|
||||
REGISTER_ENUM (SamplesRulerItem);
|
||||
REGISTER (item_type);
|
||||
|
||||
REGISTER_ENUM(MouseGain);
|
||||
REGISTER_ENUM(MouseObject);
|
||||
REGISTER_ENUM(MouseRange);
|
||||
REGISTER_ENUM(MouseDraw);
|
||||
|
||||
Reference in New Issue
Block a user