#include "analysis_window.h"
#include "bundle_manager.h"
#include "global_port_matrix.h"
+#include "editor_drag.h"
#include "i18n.h"
cerr << "size of " << what << " = " << r->width << " x " << r->height << endl;
}
-void
-DragInfo::clear_copied_locations ()
-{
- for (list<Location*>::iterator i = copied_locations.begin(); i != copied_locations.end(); ++i) {
- delete *i;
- }
- copied_locations.clear ();
-}
-
Editor::Editor ()
:
/* time display buttons */
range_mark_label (_("Range Markers")),
transport_mark_label (_("Loop/Punch Ranges")),
cd_mark_label (_("CD Markers")),
- edit_packer (3, 4, true),
+ edit_packer (4, 4, true),
/* the values here don't matter: layout widgets
reset them as needed.
clicked_crossfadeview = 0;
clicked_control_point = 0;
last_update_frame = 0;
- drag_info.item = 0;
+ _drag = 0;
current_mixer_strip = 0;
current_bbt_points = 0;
tempo_lines = 0;
snap_threshold = 5.0;
bbt_beat_subdivision = 4;
- canvas_width = 0;
- canvas_height = 0;
+ _canvas_width = 0;
+ _canvas_height = 0;
last_autoscroll_x = 0;
last_autoscroll_y = 0;
autoscroll_active = false;
current_interthread_info = 0;
_show_measures = true;
- _show_waveforms = true;
_show_waveforms_recording = true;
- first_action_message = 0;
show_gain_after_trim = false;
route_redisplay_does_not_sync_order_keys = false;
route_redisplay_does_not_reset_order_keys = false;
no_region_list_redisplay = false;
resize_idle_id = -1;
- _scrubbing = false;
scrubbing_direction = 0;
sfbrowser = 0;
location_loop_color = ARDOUR_UI::config()->canvasvar_LocationLoop.get();
location_punch_color = ARDOUR_UI::config()->canvasvar_LocationPunch.get();
- range_marker_drag_rect = 0;
- marker_drag_line = 0;
set_midi_edit_mode (MidiEditPencil, true);
_edit_point = EditAtMouse;
set_mouse_mode (MouseObject, true);
tempo_label.set_no_show_all();
meter_label.set_name ("EditorTimeButton");
meter_label.set_size_request (-1, (int)timebar_height);
- meter_label.set_alignment (1.0, 0.5);
+ meter_label.set_alignment (0.0, 0.5);
meter_label.set_padding (5,0);
meter_label.hide();
meter_label.set_no_show_all();
transport_mark_label.set_no_show_all();
initialize_rulers ();
+ _summary = new EditorSummary (this);
initialize_canvas ();
selection->TimeChanged.connect (mem_fun(*this, &Editor::time_selection_changed));
ruler_label_event_box.add (ruler_label_vbox);
ruler_label_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
- ruler_label_event_box.set_name ("TimebarLabelBase");
ruler_label_event_box.signal_button_release_event().connect (mem_fun(*this, &Editor::ruler_label_button_release));
time_button_event_box.add (time_button_vbox);
- time_button_event_box.set_name ("TimebarLabelBase");
time_button_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
time_button_event_box.signal_button_release_event().connect (mem_fun(*this, &Editor::ruler_label_button_release));
time_canvas_event_box.add (time_canvas_vbox);
time_canvas_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK);
-
+
edit_packer.set_col_spacings (0);
edit_packer.set_row_spacings (0);
edit_packer.set_homogeneous (false);
edit_packer.set_border_width (0);
edit_packer.set_name ("EditorWindow");
-#ifndef THE_OLD_WAY
-
- edit_packer.attach (ruler_label_event_box, 0, 1, 0, 1, FILL, SHRINK, 0, 0);
-
- edit_packer.attach (time_button_event_box, 0, 1, 1, 2, FILL, SHRINK, 0, 0);
- edit_packer.attach (time_canvas_event_box, 1, 2, 0, 1, FILL|EXPAND, FILL, 0, 0);
-
- edit_packer.attach (controls_layout, 0, 1, 2, 3, FILL, FILL|EXPAND, 0, 0);
- edit_packer.attach (track_canvas_event_box, 1, 2, 1, 3, FILL|EXPAND, FILL|EXPAND, 0, 0);
-
- edit_packer.attach (zoom_box, 0, 1, 3, 4, FILL, FILL, 0, 0);
- edit_packer.attach (edit_hscrollbar, 1, 2, 3, 4, FILL|EXPAND, FILL, 0, 0);
-
- edit_packer.attach (edit_vscrollbar, 3, 4, 2, 3, FILL, FILL|EXPAND, 0, 0);
-
-#else
-
- edit_packer.attach (edit_vscrollbar, 0, 1, 0, 4, FILL, FILL|EXPAND, 0, 0);
-
edit_packer.attach (ruler_label_event_box, 1, 2, 0, 1, FILL, SHRINK, 0, 0);
edit_packer.attach (time_button_event_box, 1, 2, 1, 2, FILL, SHRINK, 0, 0);
+
edit_packer.attach (time_canvas_event_box, 2, 3, 0, 1, FILL|EXPAND, FILL, 0, 0);
edit_packer.attach (controls_layout, 1, 2, 2, 3, FILL, FILL|EXPAND, 0, 0);
edit_packer.attach (track_canvas_event_box, 2, 3, 1, 3, FILL|EXPAND, FILL|EXPAND, 0, 0);
- edit_packer.attach (zoom_box, 1, 2, 3, 4, FILL, FILL, 0, 0);
- edit_packer.attach (edit_hscrollbar, 2, 3, 3, 4, FILL|EXPAND, FILL, 0, 0);
-#endif
+ edit_packer.attach (*_summary, 0, 3, 3, 4, FILL|EXPAND, SHRINK, 0, 0);
bottom_hbox.set_border_width (2);
bottom_hbox.set_spacing (3);
route_display_model->signal_row_deleted().connect (mem_fun (*this, &Editor::route_list_delete));
route_display_model->signal_row_changed().connect (mem_fun (*this, &Editor::route_list_change));
+ route_display_model->signal_rows_reordered().connect (mem_fun (*this, &Editor::route_list_reordered));
route_list_display.signal_button_press_event().connect (mem_fun (*this, &Editor::route_list_display_button_press), false);
#endif
delete track_canvas;
- track_canvas = 0;
+ delete _drag;
}
void
audioregionview by itself.
*/
- if (rv->get_canvas_group() == drag_info.item) {
- end_grab (drag_info.item, 0);
+ if (_drag && rv->get_canvas_group() == _drag->item() && !_drag->ending()) {
+ _drag->end_grab (0);
+ delete _drag;
+ _drag = 0;
}
if (clicked_regionview == rv) {
if (! is_visible ()) {
show_all ();
- /* re-hide editor list if necessary */
- editor_list_button_toggled ();
+ /* re-hide editor list if necessary */
+ editor_list_button_toggled ();
+
+ /* re-hide summary widget if necessary */
+ parameter_changed ("show-summary");
/* now reset all audio_time_axis heights, because widgets might need
to be re-hidden
return;
}
- double fpu = zoom_range_clock.current_duration() / canvas_width;
+ double fpu = zoom_range_clock.current_duration() / _canvas_width;
if (fpu < 1.0) {
fpu = 1.0;
- zoom_range_clock.set ((nframes64_t) floor (fpu * canvas_width));
- } else if (fpu > session->current_end_frame() / canvas_width) {
- fpu = session->current_end_frame() / canvas_width;
- zoom_range_clock.set ((nframes64_t) floor (fpu * canvas_width));
+ zoom_range_clock.set ((nframes64_t) floor (fpu * _canvas_width));
+ } else if (fpu > session->current_end_frame() / _canvas_width) {
+ fpu = session->current_end_frame() / _canvas_width;
+ zoom_range_clock.set ((nframes64_t) floor (fpu * _canvas_width));
}
temporal_zoom (fpu);
void
Editor::center_screen (nframes64_t frame)
{
- double page = canvas_width * frames_per_unit;
+ double page = _canvas_width * frames_per_unit;
/* if we're off the page, then scroll.
*/
horizontal_adjustment.set_upper (new_end / frames_per_unit);
horizontal_adjustment.set_page_size (current_page_frames()/frames_per_unit);
- if (horizontal_adjustment.get_value() + canvas_width > horizontal_adjustment.get_upper()) {
- horizontal_adjustment.set_value (horizontal_adjustment.get_upper() - canvas_width);
+ if (horizontal_adjustment.get_value() + _canvas_width > horizontal_adjustment.get_upper()) {
+ horizontal_adjustment.set_value (horizontal_adjustment.get_upper() - _canvas_width);
}
//cerr << "Editor::handle_new_duration () called ha v:l:u:ps:lcf = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << endl;//DEBUG
}
session->request_locate (playhead_cursor->current_frame);
- if (first_action_message) {
- first_action_message->hide();
- }
-
update_title ();
session->GoingAway.connect (mem_fun(*this, &Editor::session_going_away));
session_connections.push_back (session->tempo_map().StateChanged.connect (mem_fun(*this, &Editor::tempo_map_changed)));
session_connections.push_back (session->Located.connect (mem_fun (*this, &Editor::located)));
+ session_connections.push_back (session->config.ParameterChanged.connect (mem_fun (*this, &Editor::parameter_changed)));
edit_groups_changed ();
}
Config->map_parameters (mem_fun (*this, &Editor::parameter_changed));
+ session->config.map_parameters (mem_fun (*this, &Editor::parameter_changed));
session->StateSaved.connect (mem_fun(*this, &Editor::session_state_saved));
/* register for undo history */
session->register_with_memento_command_factory(_id, this);
+ _summary->set_session (session);
+
start_updating ();
}
set_mouse_mode (MouseObject, true);
}
- if ((prop = node.property ("show-waveforms"))) {
- bool yn = (prop->value() == "yes");
- _show_waveforms = !yn;
- RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-waveform-visible"));
- if (act) {
- RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
- /* do it twice to force the change */
- tact->set_active (!yn);
- tact->set_active (yn);
- }
- }
-
if ((prop = node.property ("show-waveforms-recording"))) {
bool yn = (prop->value() == "yes");
_show_waveforms_recording = !yn;
snprintf (buf, sizeof (buf), "%" PRIi64, playhead_cursor->current_frame);
node->add_property ("playhead", buf);
- node->add_property ("show-waveforms", _show_waveforms ? "yes" : "no");
node->add_property ("show-waveforms-recording", _show_waveforms_recording ? "yes" : "no");
node->add_property ("show-measures", _show_measures ? "yes" : "no");
node->add_property ("follow-playhead", _follow_playhead ? "yes" : "no");
zoom_focus_selector.signal_changed().connect (mem_fun(*this, &Editor::zoom_focus_selection_done));
ARDOUR_UI::instance()->tooltips().set_tip (zoom_focus_selector, _("Zoom focus"));
- zoom_box.pack_start (zoom_focus_selector, true, true);
zoom_box.pack_start (zoom_out_button, false, false);
zoom_box.pack_start (zoom_in_button, false, false);
zoom_box.pack_start (zoom_out_full_button, false, false);
+ HBox* zbc = manage (new HBox);
+ zbc->pack_start (zoom_focus_selector, false, false);
+ zoom_vbox.pack_start (*zbc, false, false);
+ zoom_vbox.pack_start (zoom_box, false, false);
+
snap_box.set_spacing (1);
snap_box.set_border_width (2);
if (x < 0) {
x = 0;
} else {
- x = min (canvas_width - 200.0, x);
+ x = min (_canvas_width - 200.0, x);
}
return x;
}
if (y < canvas_timebars_vsize) {
y = canvas_timebars_vsize;
} else {
- y = min (canvas_height - 50, y);
+ y = min (_canvas_height - 50, y);
}
return y;
}
queue_visual_change (frame);
}
+void
+Editor::reset_y_origin (double y)
+{
+ queue_visual_change_y (y);
+}
+
void
Editor::reset_zoom (double fpu)
{
// convert fpu to frame count
- nframes64_t frames = (nframes64_t) floor (frames_per_unit * canvas_width);
+ nframes64_t frames = (nframes64_t) floor (frames_per_unit * _canvas_width);
if (frames_per_unit != zoom_range_clock.current_duration()) {
zoom_range_clock.set (frames);
}
}
+ leftmost_frame = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
ZoomChanged (); /* EMIT_SIGNAL */
playhead_cursor->set_position (playhead_cursor->current_frame);
}
+ _summary->set_overlays_dirty ();
+
instant_save ();
}
void
Editor::queue_visual_change (nframes64_t where)
{
- pending_visual_change.pending = VisualChange::Type (pending_visual_change.pending | VisualChange::TimeOrigin);
+ pending_visual_change.add (VisualChange::TimeOrigin);
/* if we're moving beyond the end, make sure the upper limit of the horizontal adjustment
can reach.
pending_visual_change.time_origin = where;
- if (pending_visual_change.idle_handler_id < 0) {
- pending_visual_change.idle_handler_id = g_idle_add (_idle_visual_changer, this);
- }
+ ensure_visual_change_idle_handler ();
}
void
Editor::queue_visual_change (double fpu)
{
- pending_visual_change.pending = VisualChange::Type (pending_visual_change.pending | VisualChange::ZoomLevel);
+ pending_visual_change.add (VisualChange::ZoomLevel);
pending_visual_change.frames_per_unit = fpu;
+ ensure_visual_change_idle_handler ();
+
+}
+
+void
+Editor::queue_visual_change_y (double y)
+{
+ pending_visual_change.add (VisualChange::YOrigin);
+ pending_visual_change.y_origin = y;
+
+ ensure_visual_change_idle_handler ();
+}
+
+void
+Editor::ensure_visual_change_idle_handler ()
+{
if (pending_visual_change.idle_handler_id < 0) {
- pending_visual_change.idle_handler_id = g_idle_add ( _idle_visual_changer, this);
+ pending_visual_change.idle_handler_id = g_idle_add (_idle_visual_changer, this);
}
-
}
int
if (p & VisualChange::TimeOrigin) {
horizontal_adjustment.set_value (pending_visual_change.time_origin / frames_per_unit);
}
-
+ if (p & VisualChange::YOrigin) {
+ vertical_adjustment.set_value (pending_visual_change.y_origin);
+ }
+
nframes64_t csf=0, cef=0;
nframes64_t current_time_origin = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
update_fixed_rulers();
redisplay_tempo (true);
}
+
+ _summary->set_overlays_dirty ();
+
//cerr << "Editor::idle_visual_changer () called ha v:l:u:ps:fpu = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << frames_per_unit << endl;//DEBUG
pending_visual_change.idle_handler_id = -1;
return 0; /* this is always a one-shot call */
need_resize_line = false;
if (old_resize_line_y >= 0) {
- Gdk::Rectangle r (0, old_resize_line_y, (int) canvas_width, 3);
+ Gdk::Rectangle r (0, old_resize_line_y, (int) _canvas_width, 3);
Glib::RefPtr<Gdk::Window> win = get_window();
cerr << "Final invalidation at " << old_resize_line_y << endl;
win->invalidate_rect (r, false);
resize_line_y = at;
- if (win && canvas_width) {
+ if (win && _canvas_width) {
int controls_width = controls_layout.get_width();
int xroot, discard;
/* redraw where it used to be */
- Gdk::Rectangle r (0, old_resize_line_y - 1, controls_width + (int) canvas_width, 3);
+ Gdk::Rectangle r (0, old_resize_line_y - 1, controls_width + (int) _canvas_width, 3);
win->invalidate_rect (r, true);
cerr << "invalidate " << xroot << "," << old_resize_line_y - 1 << ' '
- << controls_width + canvas_width << " x 3\n";
+ << controls_width + _canvas_width << " x 3\n";
}
/* draw where it is */
- Gdk::Rectangle r (0, at - 1, controls_width + (int) canvas_width, 3);
+ Gdk::Rectangle r (0, at - 1, controls_width + (int) _canvas_width, 3);
win->invalidate_rect (r, true);
}
#endif
lr.x = 0;
lr.y = resize_line_y;
- lr.width = controls_width + (int) canvas_width;
+ lr.width = controls_width + (int) _canvas_width;
lr.height = 3;
if (gdk_rectangle_intersect (&lr, &ev->area, &intersection)) {
gdk_draw_line (win, gc->gobj(),
0,
resize_line_y,
- (int) canvas_width + controls_width,
+ (int) _canvas_width + controls_width,
resize_line_y);
#if 0
cerr << "drew line @ " << xroot << ", " << yroot + resize_line_y
- << " to " << xroot + (int) canvas_width + controls_width
+ << " to " << xroot + (int) _canvas_width + controls_width
<< ", " << yroot + resize_line_y
<< endl;
#endif
_pending_locate_request = false;
}
+
+void
+Editor::region_view_added (RegionView *)
+{
+ _summary->set_dirty ();
+}
+
+void
+Editor::streamview_height_changed ()
+{
+ _summary->set_dirty ();
+}