#include "streamview.h"
#include "region_gain_line.h"
#include "automation_time_axis.h"
+#include "control_point.h"
#include "prompter.h"
#include "utils.h"
#include "selection.h"
set_mouse_mode (m);
}
break;
+
+ case MouseNote:
+ if (mouse_note_button.get_active()) {
+ set_mouse_mode (m);
+ }
+ break;
default:
break;
}
}
- /* XXX the hack of unsetting all other buttongs should go
+ /* XXX the hack of unsetting all other buttons should go
away once GTK2 allows us to use regular radio buttons drawn like
normal buttons, rather than my silly GroupedButton hack.
*/
mouse_audition_button.set_active (true);
current_canvas_cursor = speaker_cursor;
break;
+
+ case MouseNote:
+ mouse_note_button.set_active (true);
+ current_canvas_cursor = note_cursor;
+ break;
}
+ if (mouse_mode == MouseNote)
+ midi_toolbar_frame.show();
+ else
+ midi_toolbar_frame.hide();
+
ignore_mouse_mode_toggle = false;
if (is_drawable()) {
if (next) set_mouse_mode (MouseObject);
else set_mouse_mode (MouseTimeFX);
break;
+
+ case MouseNote:
+ if (next) set_mouse_mode (MouseObject);
+ else set_mouse_mode (MouseAudition);
+ break;
}
}
+void
+Editor::midi_edit_mode_toggled (MidiEditMode m)
+{
+ if (ignore_midi_edit_mode_toggle) {
+ return;
+ }
+
+ switch (m) {
+ case MidiEditSelect:
+ if (midi_tool_select_button.get_active()) {
+ set_midi_edit_mode (m);
+ }
+ break;
+
+ case MidiEditPencil:
+ if (midi_tool_pencil_button.get_active()) {
+ set_midi_edit_mode (m);
+ }
+ break;
+
+ case MidiEditErase:
+ if (midi_tool_erase_button.get_active()) {
+ set_midi_edit_mode (m);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+void
+Editor::set_midi_edit_mode (MidiEditMode m, bool force)
+{
+ if (drag_info.item) {
+ return;
+ }
+
+ if (!force && m == midi_edit_mode) {
+ return;
+ }
+
+ midi_edit_mode = m;
+
+ instant_save ();
+
+ ignore_midi_edit_mode_toggle = true;
+
+ switch (midi_edit_mode) {
+ case MidiEditSelect:
+ midi_tool_select_button.set_active (true);
+ //current_canvas_cursor = selector_cursor;
+ break;
+
+ case MidiEditPencil:
+ midi_tool_pencil_button.set_active (true);
+ //current_canvas_cursor = selector_cursor;
+ break;
+
+ case MidiEditErase:
+ midi_tool_erase_button.set_active (true);
+ //current_canvas_cursor = selector_cursor;
+ break;
+ }
+
+ if (mouse_mode == MouseNote)
+ midi_toolbar_frame.show();
+ else
+ midi_toolbar_frame.hide();
+
+ ignore_midi_edit_mode_toggle = false;
+
+ /*if (is_drawable()) {
+ track_canvas.get_window()->set_cursor(*current_canvas_cursor);
+ }*/
+}
+
void
Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{
commit = set_selected_track_from_click (press, op, false);
break;
- case GainAutomationControlPointItem:
- case PanAutomationControlPointItem:
- case RedirectAutomationControlPointItem:
- case MidiCCAutomationControlPointItem:
+ case ControlPointItem:
commit = set_selected_track_from_click (press, op, true);
if (mouse_mode != MouseRange) {
commit |= set_selected_control_point_from_click (op, false);
return true;
break;
- case GainAutomationControlPointItem:
- case PanAutomationControlPointItem:
- case RedirectAutomationControlPointItem:
- case MidiCCAutomationControlPointItem:
+ case ControlPointItem:
start_control_point_grab (item, event);
return true;
break;
- case GainAutomationLineItem:
- case PanAutomationLineItem:
- case ProcessorAutomationLineItem:
- case MidiCCAutomationLineItem:
+ case AutomationLineItem:
start_line_grab_from_line (item, event);
return true;
break;
// start_line_grab_from_regionview (item, event);
break;
- case GainControlPointItem:
- start_control_point_grab (item, event);
- return true;
-
case GainLineItem:
start_line_grab_from_line (item, event);
return true;
- case GainAutomationControlPointItem:
- case PanAutomationControlPointItem:
- case RedirectAutomationControlPointItem:
- case MidiCCAutomationControlPointItem:
+ case ControlPointItem:
start_control_point_grab (item, event);
return true;
break;
break;
switch (item_type) {
- case GainAutomationControlPointItem:
- case PanAutomationControlPointItem:
- case RedirectAutomationControlPointItem:
- case MidiCCAutomationControlPointItem:
+ case ControlPointItem:
start_control_point_grab (item, event);
break;
- case GainAutomationLineItem:
- case PanAutomationLineItem:
- case ProcessorAutomationLineItem:
- case MidiCCAutomationLineItem:
+ case AutomationLineItem:
start_line_grab_from_line (item, event);
break;
}
break;
- case GainAutomationControlPointItem:
- case PanAutomationControlPointItem:
- case RedirectAutomationControlPointItem:
- case MidiCCAutomationControlPointItem:
+ case ControlPointItem:
start_control_point_grab (item, event);
return true;
break;
}
break;
- case GainControlPointItem:
+ case ControlPointItem:
if (mouse_mode == MouseGain) {
remove_gain_control_point (item, event);
+ } else {
+ remove_control_point (item, event);
}
break;
- case GainAutomationControlPointItem:
- case PanAutomationControlPointItem:
- case RedirectAutomationControlPointItem:
- case MidiCCAutomationControlPointItem:
- remove_control_point (item, event);
- break;
-
default:
break;
}
case PlayheadCursorItem:
case MarkerItem:
case GainLineItem:
- case GainAutomationLineItem:
- case PanAutomationLineItem:
- case ProcessorAutomationLineItem:
- case MidiCCAutomationLineItem:
+ case AutomationLineItem:
case StartSelectionTrimItem:
case EndSelectionTrimItem:
return true;
double fraction;
switch (item_type) {
- case GainControlPointItem:
- if (mouse_mode == MouseGain) {
- cp = static_cast<ControlPoint*>(item->get_data ("control_point"));
- cp->set_visible (true);
-
- double at_x, at_y;
- at_x = cp->get_x();
- at_y = cp->get_y ();
- cp->item->i2w (at_x, at_y);
- at_x += 20.0;
- at_y += 20.0;
-
- fraction = 1.0 - ((cp->get_y() - cp->line.y_position()) / cp->line.height());
-
- set_verbose_canvas_cursor (cp->line.get_verbose_cursor_string (fraction), at_x, at_y);
- show_verbose_canvas_cursor ();
-
- if (is_drawable()) {
- track_canvas.get_window()->set_cursor (*fader_cursor);
- }
- }
- break;
-
- case GainAutomationControlPointItem:
- case PanAutomationControlPointItem:
- case RedirectAutomationControlPointItem:
- case MidiCCAutomationControlPointItem:
+ case ControlPointItem:
if (mouse_mode == MouseGain || mouse_mode == MouseObject) {
cp = static_cast<ControlPoint*>(item->get_data ("control_point"));
cp->set_visible (true);
double at_x, at_y;
at_x = cp->get_x();
at_y = cp->get_y ();
- cp->item->i2w (at_x, at_y);
+ cp->item()->i2w (at_x, at_y);
at_x += 20.0;
at_y += 20.0;
- fraction = 1.0 - (cp->get_y() / cp->line.height());
+ fraction = 1.0 - (cp->get_y() / cp->line().height());
- set_verbose_canvas_cursor (cp->line.get_verbose_cursor_string (fraction), at_x, at_y);
+ set_verbose_canvas_cursor (cp->line().get_verbose_cursor_string (fraction), at_x, at_y);
show_verbose_canvas_cursor ();
if (is_drawable()) {
if (mouse_mode == MouseGain) {
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
if (line)
- line->property_fill_color_rgba() = Config->canvasvar_EnteredGainLine.get();
+ line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EnteredGainLine.get();
if (is_drawable()) {
track_canvas.get_window()->set_cursor (*fader_cursor);
}
}
break;
- case GainAutomationLineItem:
- case ProcessorAutomationLineItem:
- case MidiCCAutomationLineItem:
- case PanAutomationLineItem:
+ case AutomationLineItem:
if (mouse_mode == MouseGain || mouse_mode == MouseObject) {
{
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
if (line)
- line->property_fill_color_rgba() = Config->canvasvar_EnteredAutomationLine.get();
+ line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EnteredAutomationLine.get();
}
if (is_drawable()) {
track_canvas.get_window()->set_cursor (*fader_cursor);
if ((marker = static_cast<Marker *> (item->get_data ("marker"))) == 0) {
break;
}
- marker->set_color_rgba (Config->canvasvar_EnteredMarker.get());
+ marker->set_color_rgba (ARDOUR_UI::config()->canvasvar_EnteredMarker.get());
// fall through
case MeterMarkerItem:
case TempoMarkerItem:
switch (item_type) {
case GainLineItem:
- case GainAutomationLineItem:
- case ProcessorAutomationLineItem:
- case MidiCCAutomationLineItem:
- case PanAutomationLineItem:
- case GainControlPointItem:
- case GainAutomationControlPointItem:
- case PanAutomationControlPointItem:
- case RedirectAutomationControlPointItem:
- case MidiCCAutomationControlPointItem:
+ case AutomationLineItem:
+ case ControlPointItem:
/* these do not affect the current entered track state */
clear_entered_track = false;
break;
bool is_start;
switch (item_type) {
- case GainControlPointItem:
- case GainAutomationControlPointItem:
- case PanAutomationControlPointItem:
- case RedirectAutomationControlPointItem:
- case MidiCCAutomationControlPointItem:
+ case ControlPointItem:
cp = reinterpret_cast<ControlPoint*>(item->get_data ("control_point"));
- if (cp->line.npoints() > 1) {
- if (!cp->selected) {
+ if (cp->line().the_list()->interpolation() != AutomationList::Discrete) {
+ if (cp->line().npoints() > 1 && !cp->selected()) {
cp->set_visible (false);
}
}
break;
case GainLineItem:
- case GainAutomationLineItem:
- case ProcessorAutomationLineItem:
- case MidiCCAutomationLineItem:
- case PanAutomationLineItem:
+ case AutomationLineItem:
al = reinterpret_cast<AutomationLine*> (item->get_data ("line"));
{
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
case PlayheadCursorItem:
case EditCursorItem:
case MarkerItem:
- case GainControlPointItem:
- case RedirectAutomationControlPointItem:
- case MidiCCAutomationControlPointItem:
- case GainAutomationControlPointItem:
- case PanAutomationControlPointItem:
+ case ControlPointItem:
case TempoMarkerItem:
case MeterMarkerItem:
case RegionViewNameHighlight:
case EndSelectionTrimItem:
case SelectionItem:
case GainLineItem:
- case ProcessorAutomationLineItem:
- case MidiCCAutomationLineItem:
- case GainAutomationLineItem:
- case PanAutomationLineItem:
+ case AutomationLineItem:
case FadeInHandleItem:
case FadeOutHandleItem:
// The actual copying is not done before we reach the finish callback.
char name[64];
snprintf (name, sizeof(name), "%g/%g", meter_marker->meter().beats_per_bar(), meter_marker->meter().note_divisor ());
- MeterMarker* new_marker = new MeterMarker(*this, *meter_group, Config->canvasvar_MeterMarker.get(), name,
+ MeterMarker* new_marker = new MeterMarker(*this, *meter_group, ARDOUR_UI::config()->canvasvar_MeterMarker.get(), name,
*new MeterSection(meter_marker->meter()));
drag_info.item = &new_marker->the_item();
// The actual copying is not done before we reach the finish callback.
char name[64];
snprintf (name, sizeof (name), "%.2f", tempo_marker->tempo().beats_per_minute());
- TempoMarker* new_marker = new TempoMarker(*this, *tempo_group, Config->canvasvar_TempoMarker.get(), name,
+ TempoMarker* new_marker = new TempoMarker(*this, *tempo_group, ARDOUR_UI::config()->canvasvar_TempoMarker.get(), name,
*new TempoSection(tempo_marker->tempo()));
drag_info.item = &new_marker->the_item();
}
// We shouldn't remove the first or last gain point
- if (control_point->line.is_last_point(*control_point) ||
- control_point->line.is_first_point(*control_point)) {
+ if (control_point->line().is_last_point(*control_point) ||
+ control_point->line().is_first_point(*control_point)) {
return;
}
- control_point->line.remove_point (*control_point);
+ control_point->line().remove_point (*control_point);
}
void
-Editor::remove_control_point (ArdourCanvas::Item*item, GdkEvent* event)
+Editor::remove_control_point (ArdourCanvas::Item* item, GdkEvent* event)
{
ControlPoint* control_point;
/*NOTREACHED*/
}
- control_point->line.remove_point (*control_point);
+ control_point->line().remove_point (*control_point);
}
void
start_grab (event, fader_cursor);
- control_point->line.start_drag (control_point, drag_info.grab_frame, 0);
+ control_point->line().start_drag (control_point, drag_info.grab_frame, 0);
- float fraction = 1.0 - ((control_point->get_y() - control_point->line.y_position()) / control_point->line.height());
- set_verbose_canvas_cursor (control_point->line.get_verbose_cursor_string (fraction),
+ double fraction = 1.0 - ((control_point->get_y() - control_point->line().y_position()) / (double)control_point->line().height());
+ set_verbose_canvas_cursor (control_point->line().get_verbose_cursor_string (fraction),
drag_info.current_pointer_x + 20, drag_info.current_pointer_y + 20);
show_verbose_canvas_cursor ();
cy = drag_info.grab_y;
}
- cp->line.parent_group().w2i (cx, cy);
+ cp->line().parent_group().w2i (cx, cy);
cx = max (0.0, cx);
cy = max (0.0, cy);
- cy = min ((double) (cp->line.y_position() + cp->line.height()), cy);
+ cy = min ((double) (cp->line().y_position() + cp->line().height()), cy);
//translate cx to frames
nframes_t cx_frames = unit_to_frame (cx);
snap_to (cx_frames);
}
- float const fraction = 1.0 - ((cy - cp->line.y_position()) / cp->line.height());
+ const double fraction = 1.0 - ((cy - cp->line().y_position()) / (double)cp->line().height());
bool push;
push = false;
}
- cp->line.point_drag (*cp, cx_frames , fraction, push);
+ cp->line().point_drag (*cp, cx_frames , fraction, push);
- set_verbose_canvas_cursor_text (cp->line.get_verbose_cursor_string (fraction));
+ set_verbose_canvas_cursor_text (cp->line().get_verbose_cursor_string (fraction));
drag_info.first_move = false;
}
} else {
control_point_drag_motion_callback (item, event);
}
- cp->line.end_drag (cp);
+ cp->line().end_drag (cp);
}
void
start_grab (event, fader_cursor);
- double const fraction = 1.0 - ((cy - line->y_position()) / line->height());
+ const double fraction = 1.0 - ((cy - line->y_position()) / (double)line->height());
line->start_drag (0, drag_info.grab_frame, fraction);
line->parent_group().w2i (cx, cy);
- double const fraction = 1.0 - ((cy - line->y_position()) / line->height());
+ const double fraction = 1.0 - ((cy - line->y_position()) / (double)line->height());
bool push;
TimeAxisView *tracklist_timeview;
tracklist_timeview = (*i);
RouteTimeAxisView* rtv2 = dynamic_cast<RouteTimeAxisView*>(tracklist_timeview);
- list<TimeAxisView*> children_list;
+ TimeAxisView::Children children_list;
/* zeroes are audio tracks. ones are other types. */
height_list[rtv2->order] = (*i)->height;
children = 1;
if ((children_list = rtv2->get_child_list()).size() > 0) {
- for (list<TimeAxisView*>::iterator j = children_list.begin(); j != children_list.end(); ++j) {
+ for (TimeAxisView::Children::iterator j = children_list.begin(); j != children_list.end(); ++j) {
tracks = tracks |= (0x01 << (rtv2->order + children));
height_list[rtv2->order + children] = (*j)->height;
numtracks++;