From e11544b59aaf84e2d4ed1a6fb57e1ae5e6e05ebf Mon Sep 17 00:00:00 2001 From: Nick Mainsbridge Date: Wed, 3 Sep 2008 18:15:31 +0000 Subject: [PATCH] Unify the canvases by moving groups around rather than using set_scrolling_region () (eliminates the double-draw during zoom on linux), fix verbose_time_cursor clamping, make fonts smaller on location dialog buttons, hopefully improve performance when dragging multiple regions on the same track, reduce some redrawing of clocks (still not done for samples clock), allow NLS=1 on OSX, other canvas performance improvements on OSX, build SAE-us.bindings (even though they are incomplete for now). git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3707 d708f5d6-7413-0410-9779-e7cbd77b26cf --- SConstruct | 11 +- gtk2_ardour/SConscript | 2 +- gtk2_ardour/ardour2_ui_dark.rc.in | 2 +- gtk2_ardour/ardour2_ui_light.rc.in | 2 +- gtk2_ardour/ardour_ui.cc | 2 +- gtk2_ardour/audio_clock.cc | 16 +- gtk2_ardour/editor.cc | 128 ++++---- gtk2_ardour/editor.h | 46 ++- gtk2_ardour/editor_canvas.cc | 462 +++++++++++++++------------- gtk2_ardour/editor_canvas_events.cc | 61 +--- gtk2_ardour/editor_cursors.cc | 16 +- gtk2_ardour/editor_markers.cc | 2 +- gtk2_ardour/editor_mixer.cc | 7 +- gtk2_ardour/editor_mouse.cc | 257 +++++++++------- gtk2_ardour/editor_ops.cc | 23 +- gtk2_ardour/editor_route_list.cc | 4 +- gtk2_ardour/editor_rulers.cc | 100 ++++-- gtk2_ardour/editor_tempodisplay.cc | 11 +- gtk2_ardour/public_editor.h | 5 +- gtk2_ardour/region_view.cc | 5 +- gtk2_ardour/streamview.cc | 12 +- gtk2_ardour/streamview.h | 2 +- gtk2_ardour/time_axis_view.cc | 3 +- gtk2_ardour/time_axis_view_item.cc | 2 +- libs/sigc++2/missing | 61 ++-- 25 files changed, 685 insertions(+), 557 deletions(-) diff --git a/SConstruct b/SConstruct index 9ff6a61e11..88ffd6993a 100644 --- a/SConstruct +++ b/SConstruct @@ -838,12 +838,13 @@ def prep_libcheck(topenv, libinfo): # # rationale: GTK-Quartz uses jhbuild and installs to /opt/gtk by default. # All libraries needed should be built against this location + # However.. now jhbuild installs to ~/gtk/inst by default.. changed to accomodate this if topenv['GTKOSX']: - gtkroot = os.path.expanduser ("~"); - libinfo.Append(CPPPATH="$GTKROOT/include", LIBPATH="$GTKROOT/lib") - libinfo.Append(CXXFLAGS="-I$GTKROOT/include", LINKFLAGS="-L$GTKROOT/lib") - libinfo.Append(CPPPATH="/opt/local/include", LIBPATH="/opt/local/lib") - libinfo.Append(CXXFLAGS="-I/opt/local/include", LINKFLAGS="-L/opt/local/lib") + GTKROOT = os.path.expanduser ('~/gtk/inst') + libinfo.Append(CPPPATH= GTKROOT + "/include", LIBPATH= GTKROOT + "/lib") + libinfo.Append(CXXFLAGS="-I" + GTKROOT + "/include", LINKFLAGS="-L" + GTKROOT + "/lib") + #libinfo.Append(CPPPATH="/opt/local/include", LIBPATH="/opt/local/lib") + #libinfo.Append(CXXFLAGS="-I/opt/local/include", LINKFLAGS="-L/opt/local/lib") prep_libcheck(env, env) diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript index 1b34f8aead..e147db641b 100644 --- a/gtk2_ardour/SConscript +++ b/gtk2_ardour/SConscript @@ -432,7 +432,7 @@ else: keybindings_dict['%LEVEL4%'] = env['WINDOWS_KEY'] keybindings_dict['%WINDOW%'] = 'Alt' -for b in [ 'SAE-de', 'mnemonic-us', 'ergonomic-us' ]: +for b in [ 'SAE-de', 'SAE-us', 'mnemonic-us', 'ergonomic-us' ]: target_file = b + '.bindings' src_file = target_file + '.in' Default (env.SubstInFile (target_file, src_file, SUBST_DICT = keybindings_dict)) diff --git a/gtk2_ardour/ardour2_ui_dark.rc.in b/gtk2_ardour/ardour2_ui_dark.rc.in index f875258465..0f171058af 100644 --- a/gtk2_ardour/ardour2_ui_dark.rc.in +++ b/gtk2_ardour/ardour2_ui_dark.rc.in @@ -1156,7 +1156,7 @@ style "tearoff_arrow" = "medium_bold_entry" style "location_row_button" = "default_button" { - font_name = "%FONT_BIG%" + font_name = "%FONT_NORMAL%" } style "location_rows_clock" = "default_clock_display" diff --git a/gtk2_ardour/ardour2_ui_light.rc.in b/gtk2_ardour/ardour2_ui_light.rc.in index 9967320ec0..72e30d6471 100644 --- a/gtk2_ardour/ardour2_ui_light.rc.in +++ b/gtk2_ardour/ardour2_ui_light.rc.in @@ -1159,7 +1159,7 @@ style "tearoff_arrow" = "medium_bold_entry" style "location_row_button" = "default_button" { - font_name = "%FONT_SMALL%" + font_name = "%FONT_NORMAL%" } style "location_rows_clock" = "default_clock_display" diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 9e3e576e27..ab4591177d 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1285,7 +1285,7 @@ ARDOUR_UI::do_transport_locate (nframes_t new_position) } void -ARDOUR_UI::transport_goto_start () +ARDOUR_UI::transport_goto_start () { if (session) { session->goto_start(); diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 96acf38337..6848644266 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -103,6 +103,9 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg Gtkmm2ext::set_size_request_to_display_given_text(*smpte_upper_info_label, "23.98",0,0); Gtkmm2ext::set_size_request_to_display_given_text(*smpte_lower_info_label, "NDF",0,0); + Gtkmm2ext::set_size_request_to_display_given_text(*bbt_upper_info_label, "88|88",0,0); + Gtkmm2ext::set_size_request_to_display_given_text(*bbt_lower_info_label, "888.88",0,0); + frames_info_box.pack_start (*frames_upper_info_label, true, true); frames_info_box.pack_start (*frames_lower_info_label, true, true); smpte_info_box.pack_start (*smpte_upper_info_label, true, true); @@ -429,7 +432,6 @@ AudioClock::set (nframes_t when, bool force, nframes_t offset, int which) } if (which == 1 && pdelta && !last_pdelta) { - cout << "set_widget_name() called" << endl; set_widget_name("TransportClockDisplayDelta"); last_pdelta = true; } else if (which == 1 && !pdelta && last_pdelta) { @@ -644,11 +646,17 @@ AudioClock::set_bbt (nframes_t when, bool force) } sprintf (buf, "%03" PRIu32, bbt.bars); - bars_label.set_text (buf); + if (force || bars_label.get_text () != buf) { + bars_label.set_text (buf); + } sprintf (buf, "%02" PRIu32, bbt.beats); - beats_label.set_text (buf); + if (force || beats_label.get_text () != buf) { + beats_label.set_text (buf); + } sprintf (buf, "%04" PRIu32, bbt.ticks); - ticks_label.set_text (buf); + if (force || ticks_label.get_text () != buf) { + ticks_label.set_text (buf); + } if (bbt_upper_info_label) { nframes64_t pos; diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index de28fd7c52..7d462287c1 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -199,8 +199,7 @@ Editor::Editor () range_mark_label (_("Range Markers")), transport_mark_label (_("Loop/Punch Ranges")), cd_mark_label (_("CD Markers")), - - edit_packer (3, 3, true), + edit_packer (3, 4, true), /* the values here don't matter: layout widgets reset them as needed. @@ -374,16 +373,10 @@ Editor::Editor () initialize_canvas (); edit_controls_vbox.set_spacing (0); - horizontal_adjustment.signal_value_changed().connect (mem_fun(*this, &Editor::canvas_horizontally_scrolled), false); + horizontal_adjustment.signal_value_changed().connect (mem_fun(*this, &Editor::scroll_canvas_horizontally), false); vertical_adjustment.signal_value_changed().connect (mem_fun(*this, &Editor::tie_vertical_scrolling), true); - - track_canvas->set_hadjustment (horizontal_adjustment); - track_canvas->set_vadjustment (vertical_adjustment); - time_canvas->set_hadjustment (horizontal_adjustment); - track_canvas->signal_map_event().connect (mem_fun (*this, &Editor::track_canvas_map_handler)); - time_canvas->signal_map_event().connect (mem_fun (*this, &Editor::time_canvas_map_handler)); - + controls_layout.add (edit_controls_vbox); controls_layout.set_name ("EditControlsBase"); controls_layout.add_events (Gdk::SCROLL_MASK); @@ -412,9 +405,8 @@ Editor::Editor () time_canvas_vbox.pack_start (*smpte_ruler, false, false); time_canvas_vbox.pack_start (*frames_ruler, false, false); time_canvas_vbox.pack_start (*bbt_ruler, false, false); - time_canvas_vbox.pack_start (*time_canvas, true, true); - time_canvas_vbox.set_size_request (-1, (int)(timebar_height * visible_timebars) + 2); - + //time_canvas_vbox.set_size_request (-1, (int)(timebar_height * visible_timebars) + 2); + time_canvas_vbox.set_size_request (-1, -1); bbt_label.set_name ("EditorTimeButton"); bbt_label.set_size_request (-1, (int)timebar_height); bbt_label.set_alignment (1.0, 0.5); @@ -431,6 +423,7 @@ Editor::Editor () frame_label.set_size_request (-1, (int)timebar_height); frame_label.set_alignment (1.0, 0.5); frame_label.set_padding (5,0); + tempo_label.set_name ("EditorTimeButton"); tempo_label.set_size_request (-1, (int)timebar_height); tempo_label.set_alignment (1.0, 0.5); @@ -455,11 +448,19 @@ Editor::Editor () transport_mark_label.set_size_request (-1, (int)timebar_height); transport_mark_label.set_alignment (1.0, 0.5); transport_mark_label.set_padding (5,0); + + ruler_label_vbox.pack_start (minsec_label, false, false); + ruler_label_vbox.pack_start (smpte_label, false, false); + ruler_label_vbox.pack_start (frame_label, false, false); + ruler_label_vbox.pack_start (bbt_label, false, false); + + 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)); + ruler_label_frame.add(ruler_label_event_box); + ruler_label_frame.property_shadow_type() = Gtk::SHADOW_OUT; - time_button_vbox.pack_start (minsec_label, false, false); - time_button_vbox.pack_start (smpte_label, false, false); - time_button_vbox.pack_start (frame_label, false, false); - time_button_vbox.pack_start (bbt_label, false, false); time_button_vbox.pack_start (meter_label, false, false); time_button_vbox.pack_start (tempo_label, false, false); time_button_vbox.pack_start (mark_label, false, false); @@ -488,16 +489,17 @@ Editor::Editor () edit_packer.set_border_width (0); edit_packer.set_name ("EditorWindow"); - edit_packer.attach (edit_vscrollbar, 0, 1, 1, 3, FILL, FILL|EXPAND, 0, 0); + edit_packer.attach (edit_vscrollbar, 0, 1, 0, 4, FILL, FILL|EXPAND, 0, 0); - edit_packer.attach (time_button_frame, 0, 2, 0, 1, FILL, FILL, 0, 0); + edit_packer.attach (ruler_label_frame, 1, 2, 0, 1, FILL, SHRINK, 0, 0); + edit_packer.attach (time_button_frame, 1, 2, 1, 2, FILL, FILL, 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, 1, 2, FILL, FILL|EXPAND, 0, 0); - edit_packer.attach (track_canvas_event_box, 2, 3, 1, 2, FILL|EXPAND, FILL|EXPAND, 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, 2, 3, FILL, FILL, 0, 0); - edit_packer.attach (edit_hscrollbar, 2, 3, 2, 3, FILL|EXPAND, FILL, 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); bottom_hbox.set_border_width (2); bottom_hbox.set_spacing (3); @@ -826,11 +828,6 @@ Editor::~Editor() delete track_canvas; track_canvas = 0; } - - if (time_canvas) { - delete time_canvas; - time_canvas = 0; - } } void @@ -1062,6 +1059,7 @@ Editor::start_scrolling () { scroll_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (mem_fun(*this, &Editor::update_current_screen)); + } void @@ -1120,7 +1118,7 @@ Editor::handle_new_duration () if (new_end > last_canvas_frame) { last_canvas_frame = new_end; horizontal_adjustment.set_upper (last_canvas_frame / frames_per_unit); - reset_scrolling_region (); + //reset_scrolling_region (); } horizontal_adjustment.set_value (leftmost_frame/frames_per_unit); @@ -3316,13 +3314,23 @@ Editor::hide_verbose_canvas_cursor () double Editor::clamp_verbose_cursor_x (double x) { - return min (horizontal_adjustment.get_value() + canvas_width - 75.0, x); + if (x < 0) { + x = 0; + } else { + x = min (canvas_width - 200.0, x); + } + return x; } double Editor::clamp_verbose_cursor_y (double y) { - return min (vertical_adjustment.get_value() + canvas_height - 50.0, y); + if (y < canvas_timebars_vsize) { + y = canvas_timebars_vsize; + } else { + y = min (canvas_height - 50, y); + } + return y; } void @@ -3331,7 +3339,7 @@ Editor::set_verbose_canvas_cursor (const string & txt, double x, double y) verbose_canvas_cursor->property_text() = txt.c_str(); /* don't get too close to the edge */ verbose_canvas_cursor->property_x() = clamp_verbose_cursor_x (x); - verbose_canvas_cursor->property_y() = clamp_verbose_cursor_x (y); + verbose_canvas_cursor->property_y() = clamp_verbose_cursor_y (y); } void @@ -3764,7 +3772,8 @@ void Editor::end_location_changed (Location* location) { ENSURE_GUI_THREAD (bind (mem_fun(*this, &Editor::end_location_changed), location)); - reset_scrolling_region (); + //reset_scrolling_region (); + horizontal_adjustment.set_upper ( location->start()); } int @@ -4160,6 +4169,7 @@ Editor::on_key_release_event (GdkEventKey* ev) void Editor::reset_x_origin (nframes64_t frame) { + //cerr << "resetting x origin" << endl; queue_visual_change (frame); } @@ -4287,10 +4297,6 @@ Editor::set_frames_per_unit (double fpu) return; } - if (fpu == frames_per_unit) { - return; - } - frames_per_unit = fpu; post_zoom (); } @@ -4321,9 +4327,11 @@ Editor::post_zoom () ZoomChanged (); /* EMIT_SIGNAL */ reset_hscrollbar_stepping (); - reset_scrolling_region (); + //reset_scrolling_region (); - if (playhead_cursor) playhead_cursor->set_position (playhead_cursor->current_frame); + if (playhead_cursor) { + playhead_cursor->set_position (playhead_cursor->current_frame); + } instant_save (); } @@ -4331,10 +4339,12 @@ Editor::post_zoom () void Editor::queue_visual_change (nframes64_t where) { - pending_visual_change.pending = VisualChange::Type (pending_visual_change.pending | VisualChange::TimeOrigin); - pending_visual_change.time_origin = where; +// pending_visual_change.pending = VisualChange::Type (pending_visual_change.pending | VisualChange::TimeOrigin); +// pending_visual_change.time_origin = where; if (pending_visual_change.idle_handler_id < 0) { + pending_visual_change.pending = VisualChange::Type (pending_visual_change.pending | VisualChange::TimeOrigin); + pending_visual_change.time_origin = where; pending_visual_change.idle_handler_id = g_idle_add (_idle_visual_changer, this); } } @@ -4360,41 +4370,39 @@ int Editor::idle_visual_changer () { VisualChange::Type p = pending_visual_change.pending; - nframes64_t csf, cef; - - if (session) { - csf = session->current_start_frame(); - cef = session->current_end_frame() + (current_page_frames() / 24);// Add a little extra so we can see the end marker - } - pending_visual_change.pending = (VisualChange::Type) 0; - pending_visual_change.idle_handler_id = -1; + if (p & VisualChange::ZoomLevel) { set_frames_per_unit (pending_visual_change.frames_per_unit); } if (p & VisualChange::TimeOrigin) { - - nframes64_t time_origin = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit); + + nframes64_t csf, cef; + nframes64_t current_time_origin = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit); + + if (session) { + csf = session->current_start_frame(); + cef = session->current_end_frame() + (current_page_frames() / 24);// Add a little extra so we can see the end marker + } /* if we seek beyond the current end of the canvas, move the end */ - if (time_origin != pending_visual_change.time_origin) { - - if (horizontal_adjustment.get_upper() < pending_visual_change.time_origin) { - last_canvas_frame = (cef > (pending_visual_change.time_origin + current_page_frames())) ? cef : pending_visual_change.time_origin + current_page_frames(); - horizontal_adjustment.set_upper ((cef - csf) / frames_per_unit); - reset_scrolling_region (); - } - - horizontal_adjustment.set_value (pending_visual_change.time_origin/frames_per_unit); + if (current_time_origin != pending_visual_change.time_origin) { + //if (horizontal_adjustment.get_upper() < pending_visual_change.time_origin) { + last_canvas_frame = (cef > (pending_visual_change.time_origin + current_page_frames())) ? cef : pending_visual_change.time_origin + current_page_frames(); + horizontal_adjustment.set_upper ((cef - csf) / frames_per_unit); + //} + horizontal_adjustment.set_value (pending_visual_change.time_origin / frames_per_unit); } else { update_fixed_rulers(); redisplay_tempo (true); } } + //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 */ } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 7aad4391f3..3332f5c8e6 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -575,7 +575,6 @@ class Editor : public PublicEditor Gdk::Cursor* which_grabber_cursor (); ArdourCanvas::Canvas* track_canvas; - ArdourCanvas::Canvas* time_canvas; ArdourCanvas::Text* first_action_message; ArdourCanvas::Text* verbose_canvas_cursor; @@ -595,7 +594,9 @@ class Editor : public PublicEditor Gtk::EventBox time_canvas_event_box; Gtk::EventBox track_canvas_event_box; Gtk::EventBox time_button_event_box; + Gtk::EventBox ruler_label_event_box; Gtk::Frame time_button_frame; + Gtk::Frame ruler_label_frame; ArdourCanvas::Pixbuf* logo_item; ArdourCanvas::Group* minsec_group; @@ -608,6 +609,34 @@ class Editor : public PublicEditor ArdourCanvas::Group* range_marker_group; ArdourCanvas::Group* transport_marker_group; ArdourCanvas::Group* cd_marker_group; + + ArdourCanvas::Group* timebar_group; + + /* These bars never need to be scrolled */ + ArdourCanvas::Group* meter_bar_group; + ArdourCanvas::Group* tempo_bar_group; + ArdourCanvas::Group* marker_bar_group; + ArdourCanvas::Group* range_marker_bar_group; + ArdourCanvas::Group* transport_marker_bar_group; + ArdourCanvas::Group* cd_marker_bar_group; + + /* + The _master_group is the group containing all items + that require horizontal scrolling.. + It is primarily used to separate canvas items + that require horizontal scrolling from those that do not. + */ + ArdourCanvas::Group* _master_group; + /* + The _trackview_group is the group containing all trackviews. + It is only scrolled vertically. + */ + ArdourCanvas::Group* _trackview_group; + /* + This canvas group is used for region motion. + It sits on top of the _trackview_group + */ + ArdourCanvas::Group* _region_motion_group; enum RulerType { ruler_metric_smpte = 0, @@ -680,6 +709,7 @@ class Editor : public PublicEditor static const double timebar_height; guint32 visible_timebars; + gdouble canvas_timebars_vsize; Gtk::Menu *editor_ruler_menu; ArdourCanvas::SimpleRect* tempo_bar; @@ -788,15 +818,16 @@ class Editor : public PublicEditor double canvas_width; double canvas_height; double full_canvas_height; + double grabbed_vadjustment; nframes64_t last_canvas_frame; bool track_canvas_map_handler (GdkEventAny*); - bool time_canvas_map_handler (GdkEventAny*); gint edit_controls_button_release (GdkEventButton*); Gtk::Menu *edit_controls_left_menu; Gtk::Menu *edit_controls_right_menu; + Gtk::VBox ruler_label_vbox; Gtk::VBox track_canvas_vbox; Gtk::VBox time_canvas_vbox; Gtk::VBox edit_controls_vbox; @@ -807,7 +838,11 @@ class Editor : public PublicEditor bool deferred_control_scroll (nframes64_t); sigc::connection control_scroll_connection; + gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;} + ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; } void tie_vertical_scrolling (); + void scroll_canvas_horizontally (); + void scroll_canvas_vertically (); void canvas_horizontally_scrolled (); void canvas_scroll_to (nframes64_t); @@ -1380,15 +1415,12 @@ public: bool canvas_playhead_cursor_event (GdkEvent* event, ArdourCanvas::Item*); bool track_canvas_scroll (GdkEventScroll* event); - bool time_canvas_scroll (GdkEventScroll* event); bool track_canvas_scroll_event (GdkEventScroll* event); bool track_canvas_button_press_event (GdkEventButton* event); bool track_canvas_button_release_event (GdkEventButton* event); bool track_canvas_motion_notify_event (GdkEventMotion* event); - bool time_canvas_scroll_event (GdkEventScroll* event); - Gtk::Allocation canvas_allocation; bool canvas_idle_queued; void track_canvas_allocate (Gtk::Allocation alloc); @@ -1405,7 +1437,6 @@ public: void handle_new_duration (); void initialize_canvas (); - void reset_scrolling_region (Gtk::Allocation* alloc = 0); /* display control */ @@ -1771,12 +1802,13 @@ public: uint32_t autoscroll_cnt; nframes64_t autoscroll_x_distance; double autoscroll_y_distance; - + static gint _autoscroll_canvas (void *); bool autoscroll_canvas (); void start_canvas_autoscroll (int x, int y); void stop_canvas_autoscroll (); void maybe_autoscroll (GdkEventMotion*); + void maybe_autoscroll_horizontally (GdkEventMotion*); bool allow_vertical_scroll; /* trimming */ diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 5411a3a611..376b474096 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -89,10 +89,8 @@ Editor::initialize_canvas () { if (getenv ("ARDOUR_NON_AA_CANVAS")) { track_canvas = new ArdourCanvas::Canvas (); - time_canvas = new ArdourCanvas::Canvas (); } else { track_canvas = new ArdourCanvas::CanvasAA (); - time_canvas = new ArdourCanvas::CanvasAA (); } ArdourCanvas::init (); @@ -101,7 +99,7 @@ Editor::initialize_canvas () /* don't try to center the canvas */ track_canvas->set_center_scroll_region (false); - track_canvas->set_dither (Gdk::RGB_DITHER_NONE); + track_canvas->set_dither (Gdk::RGB_DITHER_NONE); /* need to handle 4 specific types of events as catch-alls */ @@ -110,9 +108,6 @@ Editor::initialize_canvas () track_canvas->signal_button_press_event().connect (mem_fun (*this, &Editor::track_canvas_button_press_event)); track_canvas->signal_button_release_event().connect (mem_fun (*this, &Editor::track_canvas_button_release_event)); - /* just scroll stuff for the timecanvas */ - time_canvas->signal_scroll_event().connect (mem_fun (*this, &Editor::time_canvas_scroll_event)); - track_canvas->set_name ("EditorMainCanvas"); track_canvas->add_events (Gdk::POINTER_MOTION_HINT_MASK|Gdk::SCROLL_MASK); track_canvas->signal_leave_notify_event().connect (mem_fun(*this, &Editor::left_track_canvas)); @@ -156,90 +151,99 @@ Editor::initialize_canvas () // logo_item->property_width_set() = true; logo_item->show (); } - - /* a group to hold time (measure) lines */ - - time_line_group = new ArdourCanvas::Group (*track_canvas->root(), 0.0, 0.0); - cursor_group = new ArdourCanvas::Group (*track_canvas->root(), 0.0, 0.0); - time_canvas->set_name ("EditorTimeCanvas"); - time_canvas->add_events (Gdk::POINTER_MOTION_HINT_MASK); - time_canvas->set_flags (CAN_FOCUS); - time_canvas->set_center_scroll_region (false); - time_canvas->set_dither (Gdk::RGB_DITHER_NONE); - - meter_group = new ArdourCanvas::Group (*time_canvas->root(), 0.0, 0.0); - tempo_group = new ArdourCanvas::Group (*time_canvas->root(), 0.0, timebar_height); - range_marker_group = new ArdourCanvas::Group (*time_canvas->root(), 0.0, timebar_height * 2.0); - transport_marker_group = new ArdourCanvas::Group (*time_canvas->root(), 0.0, timebar_height * 3.0); - marker_group = new ArdourCanvas::Group (*time_canvas->root(), 0.0, timebar_height * 4.0); - cd_marker_group = new ArdourCanvas::Group (*time_canvas->root(), 0.0, timebar_height * 5.0); - - tempo_bar = new ArdourCanvas::SimpleRect (*tempo_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0); - tempo_bar->property_outline_what() = (0x1 | 0x8); - tempo_bar->property_outline_pixels() = 0; - - meter_bar = new ArdourCanvas::SimpleRect (*meter_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0); + _master_group = new ArdourCanvas::Group (*track_canvas->root()); + + _trackview_group = new ArdourCanvas::Group (*_master_group); + _region_motion_group = new ArdourCanvas::Group (*_master_group); + + meter_bar_group = new ArdourCanvas::Group (*track_canvas->root()); + meter_bar = new ArdourCanvas::SimpleRect (*meter_bar_group, 0.0, 0.0, 100, timebar_height); meter_bar->property_outline_what() = (0x1 | 0x8); meter_bar->property_outline_pixels() = 0; - - marker_bar = new ArdourCanvas::SimpleRect (*marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0); - marker_bar->property_outline_what() = (0x1 | 0x8); - marker_bar->property_outline_pixels() = 0; - cd_marker_bar = new ArdourCanvas::SimpleRect (*cd_marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0); - cd_marker_bar->property_outline_what() = (0x1 | 0x8); - cd_marker_bar->property_outline_pixels() = 0; - - range_marker_bar = new ArdourCanvas::SimpleRect (*range_marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0); + tempo_bar_group = new ArdourCanvas::Group (*track_canvas->root()); + tempo_bar = new ArdourCanvas::SimpleRect (*tempo_bar_group, 0.0, 0.0, 100, (timebar_height)); + tempo_bar->property_outline_what() = (0x1 | 0x8); + tempo_bar->property_outline_pixels() = 0; + + range_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root()); + range_marker_bar = new ArdourCanvas::SimpleRect (*range_marker_bar_group, 0.0, 0.0, 100, (timebar_height)); range_marker_bar->property_outline_what() = (0x1 | 0x8); range_marker_bar->property_outline_pixels() = 0; - transport_marker_bar = new ArdourCanvas::SimpleRect (*transport_marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0); + transport_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root()); + transport_marker_bar = new ArdourCanvas::SimpleRect (*transport_marker_bar_group, 0.0, 0.0, 100, (timebar_height)); transport_marker_bar->property_outline_what() = (0x1 | 0x8); transport_marker_bar->property_outline_pixels() = 0; + + marker_bar_group = new ArdourCanvas::Group (*track_canvas->root()); + marker_bar = new ArdourCanvas::SimpleRect (*marker_bar_group, 0.0, 0.0, 100, (timebar_height)); + marker_bar->property_outline_what() = (0x1 | 0x8); + marker_bar->property_outline_pixels() = 0; - cd_marker_bar_drag_rect = new ArdourCanvas::SimpleRect (*cd_marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0); - cd_marker_bar_drag_rect->property_outline_pixels() = 0; - cd_marker_bar_drag_rect->hide (); + cd_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root()); + cd_marker_bar = new ArdourCanvas::SimpleRect (*cd_marker_bar_group, 0.0, 0.0, 100, (timebar_height)); + cd_marker_bar->property_outline_what() = (0x1 | 0x8); + cd_marker_bar->property_outline_pixels() = 0; - range_bar_drag_rect = new ArdourCanvas::SimpleRect (*range_marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0); - range_bar_drag_rect->property_outline_pixels() = 0; - range_bar_drag_rect->hide (); - transport_bar_drag_rect = new ArdourCanvas::SimpleRect (*transport_marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height-1.0); - transport_bar_drag_rect->property_outline_pixels() = 0; - transport_bar_drag_rect->hide (); + /* a group to hold time (measure) lines */ + time_line_group = new ArdourCanvas::Group (*_master_group, 0.0, 0.0); + + range_marker_drag_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, 0.0); + //range_marker_drag_rect = new ArdourCanvas::SimpleRect (*_master_group, 0.0, 0.0, 0.0, 0.0); + range_marker_drag_rect->hide (); + + timebar_group = new ArdourCanvas::Group (*track_canvas->root()); + cursor_group = new ArdourCanvas::Group (*track_canvas->root(), 0.0, 0.0); + + meter_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height * 5.0); + tempo_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height * 4.0); + range_marker_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height * 3.0); + transport_marker_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height * 2.0); + marker_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height); + cd_marker_group = new ArdourCanvas::Group (*timebar_group, 0.0, 0.0); + marker_drag_line_points.push_back(Gnome::Art::Point(0.0, 0.0)); - marker_drag_line_points.push_back(Gnome::Art::Point(0.0, 0.0)); + marker_drag_line_points.push_back(Gnome::Art::Point(0.0, 1.0)); - marker_drag_line = new ArdourCanvas::Line (*track_canvas->root()); + marker_drag_line = new ArdourCanvas::Line (*timebar_group); marker_drag_line->property_width_pixels() = 1; marker_drag_line->property_points() = marker_drag_line_points; marker_drag_line->hide(); - range_marker_drag_rect = new ArdourCanvas::SimpleRect (*track_canvas->root(), 0.0, 0.0, 0.0, 0.0); - range_marker_drag_rect->hide (); - - transport_loop_range_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, 0.0); + cd_marker_bar_drag_rect = new ArdourCanvas::SimpleRect (*cd_marker_group, 0.0, 0.0, 100, timebar_height); + cd_marker_bar_drag_rect->property_outline_pixels() = 0; + cd_marker_bar_drag_rect->hide (); + + range_bar_drag_rect = new ArdourCanvas::SimpleRect (*range_marker_group, 0.0, 0.0, 100, timebar_height); + range_bar_drag_rect->property_outline_pixels() = 0; + range_bar_drag_rect->hide (); + + transport_bar_drag_rect = new ArdourCanvas::SimpleRect (*transport_marker_group, 0.0, 0.0, 100, timebar_height); + transport_bar_drag_rect->property_outline_pixels() = 0; + transport_bar_drag_rect->hide (); + + transport_loop_range_rect = new ArdourCanvas::SimpleRect (*_master_group, 0.0, 0.0, 0.0, 0.0); transport_loop_range_rect->property_outline_pixels() = 1; transport_loop_range_rect->hide(); - transport_punch_range_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, 0.0); + transport_punch_range_rect = new ArdourCanvas::SimpleRect (*_master_group, 0.0, 0.0, 0.0, 0.0); transport_punch_range_rect->property_outline_pixels() = 0; transport_punch_range_rect->hide(); transport_loop_range_rect->lower_to_bottom (); // loop on the bottom - transport_punchin_line = new ArdourCanvas::SimpleLine (*time_line_group); + transport_punchin_line = new ArdourCanvas::SimpleLine (*_master_group); transport_punchin_line->property_x1() = 0.0; transport_punchin_line->property_y1() = 0.0; transport_punchin_line->property_x2() = 0.0; transport_punchin_line->property_y2() = 0.0; transport_punchin_line->hide (); - transport_punchout_line = new ArdourCanvas::SimpleLine (*time_line_group); + transport_punchout_line = new ArdourCanvas::SimpleLine (*_master_group); transport_punchout_line->property_x1() = 0.0; transport_punchout_line->property_y1() = 0.0; transport_punchout_line->property_x2() = 0.0; @@ -247,14 +251,15 @@ Editor::initialize_canvas () transport_punchout_line->hide(); // used to show zoom mode active zooming - zoom_rect = new ArdourCanvas::SimpleRect (*track_canvas->root(), 0.0, 0.0, 0.0, 0.0); + zoom_rect = new ArdourCanvas::SimpleRect (*_master_group, 0.0, 0.0, 0.0, 0.0); zoom_rect->property_outline_pixels() = 1; zoom_rect->hide(); zoom_rect->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_zoom_rect_event), (ArdourCanvas::Item*) 0)); // used as rubberband rect - rubberband_rect = new ArdourCanvas::SimpleRect (*track_canvas->root(), 0.0, 0.0, 0.0, 0.0); + rubberband_rect = new ArdourCanvas::SimpleRect (*_trackview_group, 0.0, 0.0, 0.0, 0.0); + rubberband_rect->property_outline_pixels() = 1; rubberband_rect->hide(); @@ -267,10 +272,6 @@ Editor::initialize_canvas () ZoomChanged.connect (bind (mem_fun(*this, &Editor::update_loop_range_view), false)); ZoomChanged.connect (bind (mem_fun(*this, &Editor::update_punch_range_view), false)); - - double time_height = timebar_height * 5; - double time_width = FLT_MAX/frames_per_unit; - time_canvas->set_scroll_region(0.0, 0.0, time_width, time_height); playhead_cursor = new Cursor (*this, &Editor::canvas_playhead_cursor_event); @@ -326,72 +327,47 @@ Editor::track_canvas_size_allocated () } } - full_canvas_height = height; + full_canvas_height = height + canvas_timebars_vsize; } zoom_range_clock.set ((nframes64_t) floor ((canvas_width * frames_per_unit))); playhead_cursor->set_position (playhead_cursor->current_frame); + horizontal_adjustment.set_upper (session->current_end_frame()/frames_per_unit); + horizontal_adjustment.set_page_size (current_page_frames()/frames_per_unit); + reset_hscrollbar_stepping (); - reset_scrolling_region (); - if (playhead_cursor) playhead_cursor->set_length (canvas_height); + if (playhead_cursor) { + playhead_cursor->set_length (canvas_height); + } - double y1 = vertical_adjustment.get_value (); + vertical_adjustment.set_page_size (canvas_height); for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) { - (*x)->set_line_vpos (y1, canvas_height); - } - - range_marker_drag_rect->property_y1() = y1; - range_marker_drag_rect->property_y2() = full_canvas_height; - transport_loop_range_rect->property_y1() = y1; - transport_loop_range_rect->property_y2() = full_canvas_height; - transport_punch_range_rect->property_y1() = y1; - transport_punch_range_rect->property_y2() = full_canvas_height; - transport_punchin_line->property_y1() = y1; - transport_punchin_line->property_y2() = full_canvas_height; - transport_punchout_line->property_y1() = y1; - transport_punchout_line->property_y2() = full_canvas_height; - - update_fixed_rulers(); - redisplay_tempo (true); - - Resized (); /* EMIT_SIGNAL */ - - return false; -} - -void -Editor::reset_scrolling_region (Gtk::Allocation* alloc) -{ - TreeModel::Children rows = route_display_model->children(); - TreeModel::Children::iterator i; - double pos; - - for (pos = 0, i = rows.begin(); i != rows.end(); ++i) { - TimeAxisView *tv = (*i)[route_display_columns.tv]; - if (tv != 0 && !tv->hidden()) { - pos += tv->effective_height; - } + (*x)->set_line_vpos (0, canvas_height); } - double last_canvas_unit = max ((last_canvas_frame / frames_per_unit), canvas_width); - //cerr << "Editor::reset_scrolling_region () lcf:fpu:cw:lcu " << last_canvas_frame << ":" << frames_per_unit << ":" << canvas_width << ":" << last_canvas_unit << endl;//DEBUG - track_canvas->set_scroll_region (0.0, 0.0, last_canvas_unit, pos); - - // XXX what is the correct height value for the time canvas ? this overstates it - time_canvas->set_scroll_region ( 0.0, 0.0, last_canvas_unit, canvas_height); - + marker_drag_line_points.back().set_y(canvas_height); range_marker_drag_rect->property_y2() = canvas_height; transport_loop_range_rect->property_y2() = canvas_height; transport_punch_range_rect->property_y2() = canvas_height; transport_punchin_line->property_y2() = canvas_height; transport_punchout_line->property_y2() = canvas_height; - update_punch_range_view (true); + tempo_bar->property_x2() = canvas_width; + meter_bar->property_x2() = canvas_width; + marker_bar->property_x2() = canvas_width; + cd_marker_bar->property_x2() = canvas_width; + range_marker_bar->property_x2() = canvas_width; + transport_marker_bar->property_x2() = canvas_width; + + update_fixed_rulers(); + redisplay_tempo (true); + + Resized (); /* EMIT_SIGNAL */ - controls_layout.queue_resize(); + return false; } void @@ -429,7 +405,19 @@ Editor::controls_layout_size_request (Requisition* req) controls_layout.set_size (edit_controls_vbox.get_width(), (gint) pos); controls_layout.set_size_request(edit_controls_vbox.get_width(), -1); zoom_box.set_size_request(edit_controls_vbox.get_width(), -1); - time_button_frame.set_size_request(edit_controls_vbox.get_width() + edit_vscrollbar.get_width(), -1); + //time_button_frame.set_size_request(edit_controls_vbox.get_width() + edit_vscrollbar.get_width(), -1); + time_button_frame.set_size_request(edit_controls_vbox.get_width(), -1); + + if ((vertical_adjustment.get_value() + canvas_height) >= vertical_adjustment.get_upper()) { + /* + We're increasing the size of the canvas while the bottom is visible. + We scroll down to keep in step with the controls layout. + */ + vertical_adjustment.set_upper (pos + canvas_timebars_vsize); + vertical_adjustment.set_value (pos + canvas_timebars_vsize - canvas_height); + } else { + vertical_adjustment.set_upper (pos + canvas_timebars_vsize); + } //cerr << "sizes = " << req->width << " " << edit_controls_vbox.get_width() << " " << controls_layout.get_width() << " " << zoom_box.get_width() << " " << time_button_frame.get_width() << endl;//DEBUG } @@ -441,13 +429,6 @@ Editor::track_canvas_map_handler (GdkEventAny* ev) return false; } -bool -Editor::time_canvas_map_handler (GdkEventAny* ev) -{ - time_canvas->get_window()->set_cursor (*timebar_cursor); - return false; -} - void Editor::track_canvas_drag_data_received (const RefPtr& context, int x, int y, @@ -488,8 +469,8 @@ Editor::drop_paths (const RefPtr& context, double wy; track_canvas->window_to_world (x, y, wx, wy); - wx += horizontal_adjustment.get_value(); - wy += vertical_adjustment.get_value(); + //wx += horizontal_adjustment.get_value(); + //wy += vertical_adjustment.get_value(); ev.type = GDK_BUTTON_RELEASE; ev.button.x = wx; @@ -560,16 +541,25 @@ Editor::maybe_autoscroll (GdkEventMotion* event) nframes64_t frame = drag_info.current_pointer_frame; bool startit = false; double vertical_pos = vertical_adjustment.get_value(); + double upper = vertical_adjustment.get_upper(); + + /* + adjust the event.y to take account of the bounds + of the _trackview_group + */ + + double vsx1, vsx2, vsy1, vsy2; + _trackview_group->get_bounds (vsx1, vsy1, vsx2, vsy2); autoscroll_y = 0; autoscroll_x = 0; - if (event->y < vertical_pos) { + if ((event->y - vsy1) < vertical_pos) { autoscroll_y = -1; startit = true; } - if (event->y > vertical_pos + canvas_height) { + if ((event->y - vsy1) > (vertical_pos + canvas_height - canvas_timebars_vsize) && vertical_pos <= upper) { autoscroll_y = 1; startit = true; } @@ -582,7 +572,6 @@ Editor::maybe_autoscroll (GdkEventMotion* event) } } else if (frame < leftmost_frame) { - if (leftmost_frame > 0) { autoscroll_x = -1; startit = true; @@ -606,6 +595,43 @@ Editor::maybe_autoscroll (GdkEventMotion* event) last_autoscroll_y = autoscroll_y; } +void +Editor::maybe_autoscroll_horizontally (GdkEventMotion* event) +{ + nframes64_t rightmost_frame = leftmost_frame + current_page_frames(); + nframes64_t frame = drag_info.current_pointer_frame; + bool startit = false; + + autoscroll_y = 0; + autoscroll_x = 0; + + if (frame > rightmost_frame) { + + if (rightmost_frame < max_frames) { + autoscroll_x = 1; + startit = true; + } + + } else if (frame < leftmost_frame) { + if (leftmost_frame > 0) { + autoscroll_x = -1; + startit = true; + } + + } + + if ((autoscroll_x != last_autoscroll_x) || (autoscroll_y != last_autoscroll_y) || (autoscroll_x == 0 && autoscroll_y == 0)) { + stop_canvas_autoscroll (); + } + + if (startit && autoscroll_timeout_tag < 0) { + start_canvas_autoscroll (autoscroll_x, autoscroll_y); + } + + last_autoscroll_x = autoscroll_x; + last_autoscroll_y = autoscroll_y; +} + gint Editor::_autoscroll_canvas (void *arg) { @@ -618,26 +644,64 @@ Editor::autoscroll_canvas () nframes64_t new_frame; nframes64_t limit = max_frames - current_page_frames(); GdkEventMotion ev; - nframes64_t target_frame; + bool in_track_canvas; double new_pixel; double target_pixel; + if (autoscroll_x_distance != 0) { + + if (autoscroll_cnt == 50) { /* 0.5 seconds */ + + /* after about a while, speed up a bit by changing the timeout interval */ + + autoscroll_x_distance = (nframes64_t) floor (current_page_frames()/30.0f); + + } else if (autoscroll_cnt == 150) { /* 1.0 seconds */ + + autoscroll_x_distance = (nframes64_t) floor (current_page_frames()/20.0f); + + } else if (autoscroll_cnt == 300) { /* 1.5 seconds */ + + /* after about another while, speed up by increasing the shift per callback */ + + autoscroll_x_distance = (nframes64_t) floor (current_page_frames()/10.0f); + + } + } + + if (autoscroll_y_distance != 0) { + + if (autoscroll_cnt == 50) { /* 0.5 seconds */ + + /* after about a while, speed up a bit by changing the timeout interval */ + + autoscroll_y_distance = 10; + + } else if (autoscroll_cnt == 150) { /* 1.0 seconds */ + + autoscroll_y_distance = 20; + + } else if (autoscroll_cnt == 300) { /* 1.5 seconds */ + + /* after about another while, speed up by increasing the shift per callback */ + + autoscroll_y_distance = 40; + } + } + if (autoscroll_x < 0) { if (leftmost_frame < autoscroll_x_distance) { new_frame = 0; } else { new_frame = leftmost_frame - autoscroll_x_distance; } - target_frame = drag_info.current_pointer_frame - autoscroll_x_distance; } else if (autoscroll_x > 0) { if (leftmost_frame > limit - autoscroll_x_distance) { new_frame = limit; } else { new_frame = leftmost_frame + autoscroll_x_distance; } - target_frame = drag_info.current_pointer_frame + autoscroll_x_distance; } else { - target_frame = drag_info.current_pointer_frame; new_frame = leftmost_frame; } @@ -675,23 +739,36 @@ Editor::autoscroll_canvas () target_pixel = min (target_pixel, full_canvas_height - 10); } else { - target_pixel = drag_info.current_pointer_y; + target_pixel = drag_info.current_pointer_y; new_pixel = vertical_pos; } - /* now fake a motion event to get the object that is being dragged to move too */ - ev.type = GDK_MOTION_NOTIFY; - ev.state &= Gdk::BUTTON1_MASK; - ev.x = frame_to_unit (target_frame); - ev.y = target_pixel; - motion_handler (drag_info.item, (GdkEvent*) &ev, drag_info.item_type, true); if ((new_frame == 0 || new_frame == limit) && (new_pixel == 0 || new_pixel == DBL_MAX)) { /* we are done */ return false; } + if (new_frame != leftmost_frame) { + reset_x_origin (new_frame); + } + + vertical_adjustment.set_value (new_pixel); + + /* fake an event. */ + + Glib::RefPtr canvas_window = const_cast(this)->track_canvas->get_window(); + gint x, y; + Gdk::ModifierType mask; + canvas_window->get_pointer (x, y, mask); + ev.type = GDK_MOTION_NOTIFY; + ev.state |= Gdk::BUTTON1_MASK; + ev.x = x; + ev.y = y; + + motion_handler (drag_info.item, (GdkEvent*) &ev, drag_info.item_type, true); + autoscroll_cnt++; if (autoscroll_cnt == 1) { @@ -703,53 +780,6 @@ Editor::autoscroll_canvas () } - if (new_frame != leftmost_frame) { - reset_x_origin (new_frame); - } - - vertical_adjustment.set_value (new_pixel); - - if (autoscroll_x_distance != 0) { - - if (autoscroll_cnt == 50) { /* 0.5 seconds */ - - /* after about a while, speed up a bit by changing the timeout interval */ - - autoscroll_x_distance = (nframes64_t) floor (current_page_frames()/30.0f); - - } else if (autoscroll_cnt == 150) { /* 1.0 seconds */ - - autoscroll_x_distance = (nframes64_t) floor (current_page_frames()/20.0f); - - } else if (autoscroll_cnt == 300) { /* 1.5 seconds */ - - /* after about another while, speed up by increasing the shift per callback */ - - autoscroll_x_distance = (nframes64_t) floor (current_page_frames()/10.0f); - - } - } - - if (autoscroll_y_distance != 0) { - - if (autoscroll_cnt == 50) { /* 0.5 seconds */ - - /* after about a while, speed up a bit by changing the timeout interval */ - - autoscroll_y_distance = 10; - - } else if (autoscroll_cnt == 150) { /* 1.0 seconds */ - - autoscroll_y_distance = 20; - - } else if (autoscroll_cnt == 300) { /* 1.5 seconds */ - - /* after about another while, speed up by increasing the shift per callback */ - - autoscroll_y_distance = 40; - } - } - return true; } @@ -777,6 +807,7 @@ Editor::start_canvas_autoscroll (int dx, int dy) void Editor::stop_canvas_autoscroll () { + if (autoscroll_timeout_tag >= 0) { g_source_remove (autoscroll_timeout_tag); autoscroll_timeout_tag = -1; @@ -804,34 +835,48 @@ Editor::entered_track_canvas (GdkEventCrossing *ev) void Editor::tie_vertical_scrolling () { - double y1 = vertical_adjustment.get_value(); - - playhead_cursor->set_y_axis (y1); - - range_marker_drag_rect->property_y1() = y1; - range_marker_drag_rect->property_y2() = full_canvas_height; - transport_loop_range_rect->property_y1() = y1; - transport_loop_range_rect->property_y2() = full_canvas_height; - transport_punch_range_rect->property_y1() = y1; - transport_punch_range_rect->property_y2() = full_canvas_height; - transport_punchin_line->property_y1() = y1; - transport_punchin_line->property_y2() = full_canvas_height; - transport_punchout_line->property_y1() = y1; - transport_punchout_line->property_y2() = full_canvas_height; - - if (!selection->markers.empty()) { - for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) { - (*x)->set_line_vpos (y1, canvas_height); - } - } + scroll_canvas_vertically (); - if (logo_item) { - logo_item->property_y() = y1; + /* this will do an immediate redraw */ + + controls_layout.get_vadjustment()->set_value (vertical_adjustment.get_value()); +} + +void +Editor::scroll_canvas_horizontally () +{ + nframes64_t time_origin = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit); + + if (time_origin != leftmost_frame) { + canvas_scroll_to (time_origin); } - /* this will do an immediate redraw */ + /* horizontal scrolling only */ + double x1, x2, y1, y2, x_delta; + + _master_group->get_bounds(x1, y1, x2, y2); + x_delta = x1 + horizontal_adjustment.get_value(); + + _master_group->move (-x_delta, 0); + timebar_group->move (-x_delta, 0); + cursor_group->move (-x_delta, 0); +} + +void +Editor::scroll_canvas_vertically () +{ + /* vertical scrolling only */ + double x1, x2, y1, y2, y_delta; + + _trackview_group->get_bounds(x1, y1, x2, y2); + y_delta = y1 + vertical_adjustment.get_value() - canvas_timebars_vsize; + + _trackview_group->move (0, -y_delta); + _region_motion_group->move (0, -y_delta); + + /* required to keep the controls_layout in sync with the canvas group */ + track_canvas->update_now (); - controls_layout.get_vadjustment()->set_value (y1); } void @@ -848,16 +893,11 @@ void Editor::canvas_scroll_to (nframes64_t time_origin) { leftmost_frame = time_origin; - nframes64_t rightmost_frame = leftmost_frame + current_page_frames (); if (rightmost_frame > last_canvas_frame) { last_canvas_frame = rightmost_frame; - reset_scrolling_region (); - } - - if (logo_item) { - logo_item->property_x() = horizontal_adjustment.get_value (); + //reset_scrolling_region (); } update_fixed_rulers (); diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index a1ac41d47c..fc03aa49bd 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -69,9 +69,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) */ track_canvas->get_pointer (x, y); track_canvas->window_to_world (x, y, wx, wy); - wx += horizontal_adjustment.get_value(); - wy += vertical_adjustment.get_value(); - + GdkEvent event; event.type = GDK_BUTTON_RELEASE; event.button.x = wx; @@ -86,7 +84,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { if (!current_stepping_trackview) { step_timeout = Glib::signal_timeout().connect (mem_fun(*this, &Editor::track_height_step_timeout), 500); - if (!(current_stepping_trackview = trackview_by_y_position (ev->y))) { + if (!(current_stepping_trackview = trackview_by_y_position (ev->y + vertical_adjustment.get_value() - canvas_timebars_vsize))) { return false; } } @@ -104,9 +102,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) //if (ev->state == GDK_CONTROL_MASK) { track_canvas->get_pointer (x, y); track_canvas->window_to_world (x, y, wx, wy); - wx += horizontal_adjustment.get_value(); - wy += vertical_adjustment.get_value(); - + GdkEvent event; event.type = GDK_BUTTON_RELEASE; event.button.x = wx; @@ -121,7 +117,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { if (!current_stepping_trackview) { step_timeout = Glib::signal_timeout().connect (mem_fun(*this, &Editor::track_height_step_timeout), 500); - if (!(current_stepping_trackview = trackview_by_y_position (ev->y))) { + if (!(current_stepping_trackview = trackview_by_y_position (ev->y + vertical_adjustment.get_value() - canvas_timebars_vsize))) { return false; } } @@ -168,55 +164,6 @@ Editor::track_canvas_scroll_event (GdkEventScroll *event) return false; } -bool -Editor::time_canvas_scroll (GdkEventScroll* ev) -{ - nframes64_t xdelta; - int direction = ev->direction; - - switch (direction) { - case GDK_SCROLL_UP: - temporal_zoom_step (true); - break; - - case GDK_SCROLL_DOWN: - temporal_zoom_step (false); - break; - - case GDK_SCROLL_LEFT: - xdelta = (current_page_frames() / 2); - if (leftmost_frame > xdelta) { - reset_x_origin (leftmost_frame - xdelta); - } else { - reset_x_origin (0); - } - break; - - case GDK_SCROLL_RIGHT: - xdelta = (current_page_frames() / 2); - if (max_frames - xdelta > leftmost_frame) { - reset_x_origin (leftmost_frame + xdelta); - } else { - reset_x_origin (max_frames - current_page_frames()); - } - break; - - default: - /* what? */ - break; - } - - return false; -} - -bool -Editor::time_canvas_scroll_event (GdkEventScroll *event) -{ - time_canvas->grab_focus(); - time_canvas_scroll (event); - return false; -} - bool Editor::track_canvas_button_press_event (GdkEventButton *event) { diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc index 54786bcebf..e6b84ed3a0 100644 --- a/gtk2_ardour/editor_cursors.cc +++ b/gtk2_ardour/editor_cursors.cc @@ -38,11 +38,11 @@ Editor::Cursor::Cursor (Editor& ed, bool (Editor::*callbck)(GdkEvent*,ArdourCanv /* "randomly" initialize coords */ - points.push_back(Gnome::Art::Point(-9383839.0, 0.0)); points.push_back(Gnome::Art::Point(1.0, 0.0)); + points.push_back(Gnome::Art::Point(1.0, 1.0)); canvas_item.property_points() = points; - canvas_item.property_width_pixels() = 1; + canvas_item.property_width_pixels() = 1.0; canvas_item.property_first_arrowhead() = TRUE; canvas_item.property_last_arrowhead() = TRUE; canvas_item.property_arrow_shape_a() = 11.0; @@ -51,7 +51,6 @@ Editor::Cursor::Cursor (Editor& ed, bool (Editor::*callbck)(GdkEvent*,ArdourCanv canvas_item.set_data ("cursor", this); canvas_item.signal_event().connect (bind (mem_fun (ed, callbck), &canvas_item)); - current_frame = 1; /* force redraw at 0 */ } @@ -67,23 +66,15 @@ Editor::Cursor::set_position (nframes64_t frame) if (editor.session == 0) { canvas_item.hide(); - } else { - canvas_item.show(); } - current_frame = frame; - if (new_pos != points.front().get_x()) { points.front().set_x (new_pos); points.back().set_x (new_pos); canvas_item.property_points() = points; - - ArdourCanvas::Points p = canvas_item.property_points(); } - - canvas_item.raise_to_top(); } void @@ -92,6 +83,9 @@ Editor::Cursor::set_length (double units) length = units; points.back().set_y (points.front().get_y() + length); canvas_item.property_points() = points; + if (editor.session != 0) { + canvas_item.show(); + } } void diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index d3e9548b8f..c51297063b 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -1245,7 +1245,7 @@ Editor::marker_selection_changed () } for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) { - (*x)->add_line (cursor_group, vertical_adjustment.get_value(), canvas_height); + (*x)->add_line (cursor_group, 0, canvas_height); (*x)->show_line (); } diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index 651360d1fd..12c26a2bcb 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -185,7 +185,7 @@ Editor::update_current_screen () if (_follow_playhead && session->requested_return_frame() < 0) { - playhead_cursor->canvas_item.show(); + //playhead_cursor->canvas_item.show(); if (frame != last_update_frame) { @@ -241,7 +241,10 @@ Editor::update_current_screen () almost_done: last_update_frame = frame; - +#ifdef GTKOSX + /*XXX in a perfect world we would not have to do this. */ + track_canvas->update_now(); +#endif if (current_mixer_strip) { current_mixer_strip->fast_update (); } diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 36029a4213..9a862786b2 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1,3 +1,4 @@ + /* Copyright (C) 2000-2001 Paul Davis @@ -85,23 +86,15 @@ Editor::mouse_frame (nframes64_t& where, bool& in_track_canvas) const pointer_window = canvas_window->get_pointer (x, y, mask); if (pointer_window == track_canvas->get_bin_window()) { - - track_canvas->window_to_world (x, y, wx, wy); + wx = x; + wy = y; in_track_canvas = true; } else { in_track_canvas = false; - - if (pointer_window == time_canvas->get_bin_window()) { - time_canvas->window_to_world (x, y, wx, wy); - } else { return false; - } } - wx += horizontal_adjustment.get_value(); - wy += vertical_adjustment.get_value(); - GdkEvent event; event.type = GDK_BUTTON_RELEASE; event.button.x = wx; @@ -131,10 +124,16 @@ Editor::event_frame (GdkEvent* event, double* pcx, double* pcy) const case GDK_BUTTON_PRESS: case GDK_2BUTTON_PRESS: case GDK_3BUTTON_PRESS: - track_canvas->w2c(event->button.x, event->button.y, *pcx, *pcy); + + *pcx = event->button.x; + *pcy = event->button.y; + _trackview_group->w2i(*pcx, *pcy); break; case GDK_MOTION_NOTIFY: - track_canvas->w2c(event->motion.x, event->motion.y, *pcx, *pcy); + + *pcx = event->motion.x; + *pcy = event->motion.y; + _trackview_group->w2i(*pcx, *pcy); break; case GDK_ENTER_NOTIFY: case GDK_LEAVE_NOTIFY: @@ -214,9 +213,10 @@ Editor::which_grabber_cursor () return grabber_edit_point_cursor; break; default: - return grabber_cursor; + //return grabber_cursor; break; } + return grabber_cursor; } void @@ -478,7 +478,6 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp pointer_window = canvas_window->get_pointer (x, y, mask); if (pointer_window == track_canvas->get_bin_window()) { - track_canvas->window_to_world (x, y, wx, wy); allow_vertical_scroll = true; } else { @@ -1360,7 +1359,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ case MeterBarItem: case TempoBarItem: if (is_drawable()) { - time_canvas->get_window()->set_cursor (*timebar_cursor); + track_canvas->get_window()->set_cursor (*timebar_cursor); } break; @@ -1374,7 +1373,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ case MeterMarkerItem: case TempoMarkerItem: if (is_drawable()) { - time_canvas->get_window()->set_cursor (*timebar_cursor); + track_canvas->get_window()->set_cursor (*timebar_cursor); } break; case FadeInHandleItem: @@ -1495,7 +1494,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ case TempoBarItem: case MarkerBarItem: if (is_drawable()) { - time_canvas->get_window()->set_cursor (*timebar_cursor); + track_canvas->get_window()->set_cursor (*timebar_cursor); } break; @@ -1512,7 +1511,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ case TempoMarkerItem: if (is_drawable()) { - time_canvas->get_window()->set_cursor (*timebar_cursor); + track_canvas->get_window()->set_cursor (*timebar_cursor); } break; @@ -1647,7 +1646,7 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item where DISPLAY = :0.0, and given the cost of what the motion event might do, its a good tradeoff. */ - + track_canvas->get_pointer (x, y); } @@ -1705,6 +1704,9 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item switch (item_type) { case PlayheadCursorItem: case MarkerItem: + case RangeMarkerBarItem: + case TransportMarkerBarItem: + case CdMarkerBarItem: case GainControlPointItem: case RedirectAutomationControlPointItem: case GainAutomationControlPointItem: @@ -1730,13 +1732,13 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item if (drag_info.item && (event->motion.state & Gdk::BUTTON1_MASK || (event->motion.state & Gdk::BUTTON2_MASK))) { if (!from_autoscroll) { - maybe_autoscroll (&event->motion); + maybe_autoscroll_horizontally (&event->motion); } (this->*(drag_info.motion_callback)) (item, event); goto handled; } goto not_handled; - + break; default: break; } @@ -2278,7 +2280,7 @@ Editor::start_marker_grab (ArdourCanvas::Item* item, GdkEvent* event) // marker_drag_line->raise_to_top(); } else { range_marker_drag_rect->show(); - range_marker_drag_rect->raise_to_top(); + //range_marker_drag_rect->raise_to_top(); } if (is_start) { @@ -2978,6 +2980,17 @@ Editor::line_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event) void Editor::start_region_grab (ArdourCanvas::Item* item, GdkEvent* event) { + /* + the group containing moved regions may have been + offset during autoscroll. reset its y offset + (we should really handle this in the same way + we do with the x axis, but a simple way of achieving that + eludes me right now). + */ + + _region_motion_group->property_y() = 0; + grabbed_vadjustment = vertical_adjustment.get_value (); + if (selection->regions.empty() || clicked_regionview == 0) { return; } @@ -3019,6 +3032,8 @@ Editor::start_region_grab (ArdourCanvas::Item* item, GdkEvent* event) void Editor::start_region_copy_grab (ArdourCanvas::Item* item, GdkEvent* event) { + _region_motion_group->property_y() = 0; + if (selection->regions.empty() || clicked_regionview == 0) { return; } @@ -3105,7 +3120,7 @@ Editor::possibly_copy_regions_during_grab (GdkEvent* event) /* XXX handle MIDI here */ continue; } - + const boost::shared_ptr original = arv->region(); boost::shared_ptr region_copy = RegionFactory::create (original); boost::shared_ptr ar = boost::dynamic_pointer_cast (region_copy); @@ -3336,6 +3351,8 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) rv2->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2); rv2->get_canvas_group()->i2w (ix1, iy1); + iy1 += vertical_adjustment.get_value() - canvas_timebars_vsize; + TimeAxisView* tvp2 = trackview_by_y_position (iy1); RouteTimeAxisView* atv2 = dynamic_cast(tvp2); @@ -3421,10 +3438,9 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) /* compute the amount of pointer motion in frames, and where the region would be if we moved it by that much. */ - if ( drag_info.move_threshold_passed ) { - if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) { + if (drag_info.current_pointer_frame >= drag_info.pointer_frame_offset) { nframes64_t sync_frame; nframes64_t sync_offset; @@ -3459,7 +3475,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) if (pending_region_position > max_frames - rv->region()->length()) { pending_region_position = drag_info.last_frame_position; } - + // printf ("3: pending_region_position= %lu %lu\n", pending_region_position, drag_info.last_frame_position ); bool x_move_allowed; @@ -3475,7 +3491,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) x_move_allowed = !drag_info.x_constrained; } - if ( pending_region_position != drag_info.last_frame_position && x_move_allowed ) { + if (( pending_region_position != drag_info.last_frame_position) && x_move_allowed ) { /* now compute the canvas unit distance we need to move the regionview to make it appear at the new location. @@ -3485,10 +3501,29 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) x_delta = ((double) (pending_region_position - drag_info.last_frame_position) / frames_per_unit); } else { x_delta = -((double) (drag_info.last_frame_position - pending_region_position) / frames_per_unit); - } + for (list::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) { + RegionView* rv2 = (*i); + + // If any regionview is at zero, we need to know so we can stop further leftward motion. + + double ix1, ix2, iy1, iy2; + rv2->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2); + rv2->get_canvas_group()->i2w (ix1, iy1); + + if (-x_delta > ix1 + horizontal_adjustment.get_value()) { + // do_move = false; + cerr << "illegal move" << endl; + x_delta = 0; + pending_region_position = drag_info.last_frame_position; + break; + } + } + + } + drag_info.last_frame_position = pending_region_position; - + } else { x_delta = 0; } @@ -3508,41 +3543,16 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) trackviews. nothing to do. */ return; - } - - - if (x_delta < 0) { - for (list::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) { - - RegionView* rv2 = (*i); - - // If any regionview is at zero, we need to know so we can stop further leftward motion. - - double ix1, ix2, iy1, iy2; - rv2->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2); - rv2->get_canvas_group()->i2w (ix1, iy1); - - if (ix1 <= 1) { - x_delta = 0; - break; - } - } } /************************************************************* MOTION ************************************************************/ - - bool do_move; - + bool do_move = true; if (drag_info.first_move) { - if (drag_info.move_threshold_passed) { - do_move = true; - } else { + if (!drag_info.move_threshold_passed) { do_move = false; } - } else { - do_move = true; } if (do_move) { @@ -3567,6 +3577,30 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) rv->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2); rv->get_canvas_group()->i2w (ix1, iy1); + + if (drag_info.first_move) { + + // hide any dependent views + + rv->get_time_axis_view().hide_dependent_views (*rv); + + /* + reparent to a non scrolling group so that we can keep the + region selection above all time axis views. + reparenting means we have to move the rv as the two + parent groups have different coordinates. + */ + + rv->get_canvas_group()->reparent(*_region_motion_group); + + rv->get_canvas_group()->move ( 0, iy1 - 1); + rv->fake_set_opaque (true); + } + /* for evaluation of the track position of iy1, we have to adjust + to allow for the vertical scrolling adjustment and the height of the timebars. + */ + iy1 += vertical_adjustment.get_value() - canvas_timebars_vsize; + TimeAxisView* tvp2 = trackview_by_y_position (iy1); AudioTimeAxisView* canvas_atv = dynamic_cast(tvp2); AudioTimeAxisView* temp_atv; @@ -3629,43 +3663,12 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) } } - - /* prevent the regionview from being moved to before - the zero position on the canvas. - */ - /* clamp */ - - if (x_delta < 0) { - if (-x_delta > ix1) { - x_delta = -ix1; - } - } else if ((x_delta > 0) && (rv->region()->last_frame() > max_frames - x_delta)) { - x_delta = max_frames - rv->region()->last_frame(); - } - - - if (drag_info.first_move) { - - /* hide any dependent views */ - - rv->get_time_axis_view().hide_dependent_views (*rv); - - /* this is subtle. raising the regionview itself won't help, - because raise_to_top() just puts the item on the top of - its parent's stack. so, we need to put the trackview canvas_display group - on the top, since its parent is the whole canvas. - */ - - rv->get_canvas_group()->raise_to_top(); - rv->get_time_axis_view().canvas_display->raise_to_top(); - cursor_group->raise_to_top(); - rv->fake_set_opaque (true); - } - if (drag_info.brushing) { mouse_brush_insert_region (rv, pending_region_position); } else { - rv->move (x_delta, y_delta); + + rv->move (x_delta, y_delta); + } } /* foreach region */ @@ -3693,7 +3696,9 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event vector new_selection; typedef set > PlaylistSet; PlaylistSet modified_playlists; - pair insert_result; + PlaylistSet frozen_playlists; + list modified_playlist_connections; + pair insert_result, frozen_insert_result; /* first_move is set to false if the regionview has been moved in the motion handler. @@ -3706,11 +3711,12 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event nocommit = false; - /* The regionview has been moved at some stage during the grab so we need + /* XXX is this true??? i can''t tell the difference. + The regionview has been moved at some stage during the grab so we need to account for any mouse movement between this event and the last one. */ - region_drag_motion_callback (item, event); + //region_drag_motion_callback (item, event); if (Config->get_edit_mode() == Splice && !pre_drag_region_selection.empty()) { selection->set (pre_drag_region_selection); @@ -3758,14 +3764,17 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event for (list::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ) { RegionView* rv = (*i); - double ix1, ix2, iy1, iy2; + double ix1, ix2, iy1, iy2, y_pos; rv->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2); rv->get_canvas_group()->i2w (ix1, iy1); + + y_pos = iy1; + iy1 += vertical_adjustment.get_value() - canvas_timebars_vsize; + TimeAxisView* dest_tv = trackview_by_y_position (iy1); AudioTimeAxisView* dest_atv = dynamic_cast(dest_tv); double speed; - bool changed_tracks; - bool changed_position; + bool changed_tracks, changed_position; nframes64_t where; if (rv->region()->locked()) { @@ -3785,23 +3794,25 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event changed_tracks = (dest_tv != &rv->get_time_axis_view()); if (changed_position && !drag_info.x_constrained) { + _master_group->w2i(ix1, iy1); where = (nframes64_t) (unit_to_frame (ix1) * speed); } else { where = rv->region()->position(); } - /* undo the previous hide_dependent_views so that xfades don't - disappear on copying regions - */ - - rv->get_time_axis_view().reveal_dependent_views (*rv); - boost::shared_ptr new_region; if (drag_info.copy) { /* we already made a copy */ new_region = rv->region(); - } else { + + /* undo the previous hide_dependent_views so that xfades don't + disappear on copying regions + */ + + //rv->get_time_axis_view().reveal_dependent_views (*rv); + + } else if (changed_tracks) { new_region = RegionFactory::create (rv->region()); } @@ -3815,7 +3826,7 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event insert_result = modified_playlists.insert (to_playlist); if (insert_result.second) { - session->add_command (new MementoCommand(*to_playlist, &to_playlist->get_state(), 0)); + session->add_command (new MementoCommand(*to_playlist, &to_playlist->get_state(), 0)); } to_playlist->add_region (new_region, where); @@ -3824,19 +3835,36 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event if (!latest_regionviews.empty()) { // XXX why just the first one ? we only expect one - dest_atv->reveal_dependent_views (*latest_regionviews.front()); + //dest_atv->reveal_dependent_views (*latest_regionviews.front()); new_selection.push_back (latest_regionviews.front()); } } else { - + /* + motion on the same track. plonk the previously reparented region + back to its original canvas group (its streamview). + No need to do anything for copies as they are fake regions which will be deleted. + */ + /* account for any vertical autoscrolling that might have happened during the move */ + double vadjustment_delta = vertical_adjustment.get_value () - grabbed_vadjustment; + y_pos += vadjustment_delta; + + RouteTimeAxisView* dest_rtv = dynamic_cast (dest_atv); + rv->get_canvas_group()->reparent (*dest_rtv->view()->canvas_item()); + rv->get_canvas_group()->move ( 0, -y_pos + 1); + /* just change the model */ boost::shared_ptr playlist = dest_atv->playlist(); insert_result = modified_playlists.insert (playlist); if (insert_result.second) { - session->add_command (new MementoCommand(*playlist, &playlist->get_state(), 0)); + session->add_command (new MementoCommand(*playlist, &playlist->get_state(), 0)); + } + /* freeze to avoid lots of relayering in the case of a multi-region drag */ + frozen_insert_result = frozen_playlists.insert(playlist); + if (frozen_insert_result.second) { + playlist->freeze(); } rv->region()->set_position (where, (void*) this); @@ -3867,7 +3895,7 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event insert_result = modified_playlists.insert (from_playlist); if (insert_result.second) { - session->add_command (new MementoCommand(*from_playlist, &from_playlist->get_state(), 0)); + session->add_command (new MementoCommand(*from_playlist, &from_playlist->get_state(), 0)); } from_playlist->remove_region ((rv->region())); @@ -3903,7 +3931,6 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event copies.push_back (rv); } } - if (new_selection.empty()) { if (drag_info.copy) { @@ -3919,6 +3946,10 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event */ selection->set (new_selection); } + + for (set >::iterator p = frozen_playlists.begin(); p != frozen_playlists.end(); ++p) { + (*p)->thaw(); + } out: if (!nocommit) { @@ -3931,6 +3962,7 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event for (vector::iterator x = copies.begin(); x != copies.end(); ++x) { delete *x; } + } void @@ -4021,7 +4053,7 @@ Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos, set_verbose_canvas_cursor (buf, xpos + offset, ypos + offset); } else { - set_verbose_canvas_cursor (buf, drag_info.current_pointer_x + offset, drag_info.current_pointer_y + offset); + set_verbose_canvas_cursor (buf, drag_info.current_pointer_x + offset - horizontal_adjustment.get_value(), drag_info.current_pointer_y + offset - vertical_adjustment.get_value() + canvas_timebars_vsize); } show_verbose_canvas_cursor (); } @@ -4934,7 +4966,7 @@ Editor::drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event) update_marker_drag_item (temp_location); range_marker_drag_rect->show(); - range_marker_drag_rect->raise_to_top(); + //range_marker_drag_rect->raise_to_top(); } break; @@ -5215,8 +5247,7 @@ Editor::end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event) if (drag_info.current_pointer_y < drag_info.grab_y) { y1 = drag_info.current_pointer_y; y2 = drag_info.grab_y; - } - else { + } else { y2 = drag_info.current_pointer_y; y1 = drag_info.grab_y; } diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index fa5c3d9949..c3c6318178 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1534,7 +1534,7 @@ Editor::scroll_tracks_down_line () { Gtk::Adjustment* adj = edit_vscrollbar.get_adjustment(); - double vert_value = adj->get_value() + 20; + double vert_value = adj->get_value() + 60; if (vert_value>adj->get_upper() - canvas_height) { vert_value = adj->get_upper() - canvas_height; @@ -1546,7 +1546,7 @@ void Editor::scroll_tracks_up_line () { Gtk::Adjustment* adj = edit_vscrollbar.get_adjustment(); - adj->set_value (adj->get_value() - 20); + adj->set_value (adj->get_value() - 60); } /* ZOOM */ @@ -1860,8 +1860,9 @@ Editor::temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string void Editor::temporal_zoom_to_frame (bool coarser, nframes64_t frame) { - if (!session) return; - + if (!session) { + return; + } double range_before = frame - leftmost_frame; double new_fpu; @@ -1875,12 +1876,15 @@ Editor::temporal_zoom_to_frame (bool coarser, nframes64_t frame) range_before /= 1.61803399; } - if (new_fpu == frames_per_unit) return; + if (new_fpu == frames_per_unit) { + return; + } nframes64_t new_leftmost = frame - (nframes64_t)range_before; - if (new_leftmost > frame) new_leftmost = 0; - + if (new_leftmost > frame) { + new_leftmost = 0; + } // begin_reversible_command (_("zoom to frame")); // session->add_undo (bind (mem_fun(*this, &Editor::reposition_and_zoom), leftmost_frame, frames_per_unit)); // session->add_redo (bind (mem_fun(*this, &Editor::reposition_and_zoom), new_leftmost, new_fpu)); @@ -2198,8 +2202,8 @@ Editor::insert_region_list_drag (boost::shared_ptr region, int x, i boost::shared_ptr playlist; track_canvas->window_to_world (x, y, wx, wy); - wx += horizontal_adjustment.get_value(); - wy += vertical_adjustment.get_value(); + //wx += horizontal_adjustment.get_value(); + //wy += vertical_adjustment.get_value(); GdkEvent event; event.type = GDK_BUTTON_RELEASE; @@ -5953,7 +5957,6 @@ Editor::fit_tracks () first_y_pos = std::min ((*t)->y_position, first_y_pos); } - vertical_adjustment.set_value (first_y_pos); redo_visual_stack.push_back (current_visual_state()); diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index 8e83652d37..473858f8f5 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -317,7 +317,7 @@ Editor::redisplay_route_list () cursor_group->raise_to_top (); - reset_scrolling_region (); + //reset_scrolling_region (); if (Config->get_sync_all_route_ordering() && !ignore_route_list_reorder) { ignore_route_order_sync = true; @@ -353,7 +353,7 @@ Editor::hide_all_tracks (bool with_select) otherwise. */ - reset_scrolling_region (); + //reset_scrolling_region (); } void diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 396f88515c..1975e8cce6 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -87,7 +87,7 @@ Editor::initialize_rulers () minsec_ruler->set_size_request (-1, (int)timebar_height); gtk_custom_ruler_set_metric (GTK_CUSTOM_RULER(_minsec_ruler), &ruler_metrics[ruler_metric_minsec]); - visible_timebars = 7; /* 4 here, 3 in time_canvas */ + visible_timebars = 1; /*this will be changed below */ ruler_pressed_button = 0; } @@ -556,7 +556,9 @@ Editor::update_ruler_visibility () { using namespace Box_Helpers; BoxList & lab_children = time_button_vbox.children(); + BoxList & ruler_lab_children = ruler_label_vbox.children(); BoxList & ruler_children = time_canvas_vbox.children(); + int visible_rulers = 0; if (no_ruler_shown_update) { return; @@ -565,9 +567,10 @@ Editor::update_ruler_visibility () visible_timebars = 0; lab_children.clear(); + ruler_lab_children.clear(); // leave the last one (the time_canvas) intact - while (ruler_children.size() > 1) { + while (ruler_children.size() > 0) { ruler_children.pop_front(); } @@ -625,31 +628,32 @@ Editor::update_ruler_visibility () ruler_children.insert (canvaspos, Element(*_ruler_separator, PACK_SHRINK, PACK_START)); if (ruler_minsec_action->get_active()) { - lab_children.push_back (Element(minsec_label, PACK_SHRINK, PACK_START)); + ruler_lab_children.push_back (Element(minsec_label, PACK_SHRINK, PACK_START)); ruler_children.insert (canvaspos, Element(*minsec_ruler, PACK_SHRINK, PACK_START)); - visible_timebars++; + visible_rulers++; } if (ruler_timecode_action->get_active()) { - lab_children.push_back (Element(smpte_label, PACK_SHRINK, PACK_START)); + ruler_lab_children.push_back (Element(smpte_label, PACK_SHRINK, PACK_START)); ruler_children.insert (canvaspos, Element(*smpte_ruler, PACK_SHRINK, PACK_START)); - visible_timebars++; + visible_rulers++; } if (ruler_samples_action->get_active()) { - lab_children.push_back (Element(frame_label, PACK_SHRINK, PACK_START)); + ruler_lab_children.push_back (Element(frame_label, PACK_SHRINK, PACK_START)); ruler_children.insert (canvaspos, Element(*frames_ruler, PACK_SHRINK, PACK_START)); - visible_timebars++; + visible_rulers++; } if (ruler_bbt_action->get_active()) { - lab_children.push_back (Element(bbt_label, PACK_SHRINK, PACK_START)); + ruler_lab_children.push_back (Element(bbt_label, PACK_SHRINK, PACK_START)); ruler_children.insert (canvaspos, Element(*bbt_ruler, PACK_SHRINK, PACK_START)); - visible_timebars++; + visible_rulers++; } double tbpos = 1.0; - double old_unit_pos ; + double tbgpos = 1.0; + double old_unit_pos; if (ruler_meter_action->get_active()) { lab_children.push_back (Element(meter_label, PACK_SHRINK, PACK_START)); @@ -658,11 +662,17 @@ Editor::update_ruler_visibility () if (tbpos != old_unit_pos) { meter_group->move ( 0.0, tbpos - old_unit_pos); } + old_unit_pos = meter_bar_group->property_y(); + if (tbgpos != old_unit_pos) { + meter_bar_group->move ( 0.0, tbgpos - old_unit_pos); + } + meter_bar_group->show(); meter_group->show(); tbpos += timebar_height; + tbgpos += timebar_height; visible_timebars++; - } - else { + } else { + meter_bar_group->hide(); meter_group->hide(); } @@ -672,11 +682,17 @@ Editor::update_ruler_visibility () if (tbpos != old_unit_pos) { tempo_group->move(0.0, tbpos - old_unit_pos); } + old_unit_pos = tempo_bar_group->property_y(); + if (tbgpos != old_unit_pos) { + tempo_bar_group->move ( 0.0, tbgpos - old_unit_pos); + } + tempo_bar_group->show(); tempo_group->show(); tbpos += timebar_height; + tbgpos += timebar_height; visible_timebars++; - } - else { + } else { + tempo_bar_group->hide(); tempo_group->hide(); } @@ -686,10 +702,17 @@ Editor::update_ruler_visibility () if (tbpos != old_unit_pos) { range_marker_group->move (0.0, tbpos - old_unit_pos); } + old_unit_pos = range_marker_bar_group->property_y(); + if (tbgpos != old_unit_pos) { + range_marker_bar_group->move (0.0, tbgpos - old_unit_pos); + } + range_marker_bar_group->show(); range_marker_group->show(); tbpos += timebar_height; + tbgpos += timebar_height; visible_timebars++; } else { + range_marker_bar_group->hide(); range_marker_group->hide(); } @@ -699,11 +722,17 @@ Editor::update_ruler_visibility () if (tbpos != old_unit_pos) { transport_marker_group->move ( 0.0, tbpos - old_unit_pos); } + old_unit_pos = transport_marker_bar_group->property_y(); + if (tbgpos != old_unit_pos) { + transport_marker_bar_group->move ( 0.0, tbgpos - old_unit_pos); + } + transport_marker_bar_group->show(); transport_marker_group->show(); tbpos += timebar_height; + tbgpos += timebar_height; visible_timebars++; - } - else { + } else { + transport_marker_bar_group->hide(); transport_marker_group->hide(); } @@ -713,13 +742,19 @@ Editor::update_ruler_visibility () if (tbpos != old_unit_pos) { cd_marker_group->move (0.0, tbpos - old_unit_pos); } + old_unit_pos = cd_marker_bar_group->property_y(); + if (tbgpos != old_unit_pos) { + cd_marker_bar_group->move (0.0, tbgpos - old_unit_pos); + } + cd_marker_bar_group->show(); cd_marker_group->show(); tbpos += timebar_height; + tbgpos += timebar_height; visible_timebars++; // make sure all cd markers show up in their respective places update_cd_marker_display(); - } - else { + } else { + cd_marker_bar_group->hide(); cd_marker_group->hide(); // make sure all cd markers show up in their respective places update_cd_marker_display(); @@ -731,22 +766,41 @@ Editor::update_ruler_visibility () if (tbpos != old_unit_pos) { marker_group->move ( 0.0, tbpos - old_unit_pos); } + old_unit_pos = marker_bar_group->property_y(); + if (tbgpos != old_unit_pos) { + marker_bar_group->move ( 0.0, tbgpos - old_unit_pos); + } + marker_bar_group->show(); marker_group->show(); tbpos += timebar_height; + tbgpos += timebar_height; visible_timebars++; - } - else { + } else { + marker_bar_group->hide(); marker_group->hide(); } - time_canvas_vbox.set_size_request (-1, (int)(timebar_height * visible_timebars)); + gdouble old_canvas_timebars_vsize = canvas_timebars_vsize; + canvas_timebars_vsize = (timebar_height * visible_timebars) + 2.0; + gdouble vertical_pos_delta = canvas_timebars_vsize - old_canvas_timebars_vsize; + + if (vertical_pos_delta < 0 && (vertical_adjustment.get_value() + canvas_height) >= vertical_adjustment.get_upper()) { + /*if we're at the bottom of the canvas, don't move the _trackview_grooup*/ + vertical_adjustment.set_upper(vertical_adjustment.get_upper() + vertical_pos_delta); + } else { + vertical_adjustment.set_upper(vertical_adjustment.get_upper() + vertical_pos_delta); + _trackview_group->move (0, vertical_pos_delta); + } + ruler_label_vbox.set_size_request (-1, (int)(timebar_height * visible_rulers)); + + time_canvas_vbox.set_size_request (-1,-1); time_canvas_event_box.queue_resize(); update_fixed_rulers(); - //update_tempo_based_rulers(); redisplay_tempo (false); time_canvas_event_box.show_all(); + ruler_label_frame.show_all(); time_button_frame.show_all(); } diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 7896b217dc..1fe680fb04 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -171,7 +171,7 @@ void Editor::hide_measures () { for (TimeLineList::iterator i = used_measure_lines.begin(); i != used_measure_lines.end(); ++i) { - (*i)->hide(); + (*i)->hide(); free_measure_lines.push_back (*i); } used_measure_lines.clear (); @@ -212,7 +212,7 @@ Editor::draw_measures () TempoMap::BBTPointList::iterator i; ArdourCanvas::SimpleLine *line; gdouble xpos; - double x1, x2, y1, y2, beat_density; + double beat_density; uint32_t beats = 0; uint32_t bars = 0; @@ -222,9 +222,6 @@ Editor::draw_measures () return; } - track_canvas->get_scroll_region (x1, y1, x2, y2); - y2 = TimeAxisView::hLargest*5000; // five thousand largest tracks should be enough.. :) - /* get the first bar spacing */ i = current_bbt_points->end(); @@ -264,7 +261,7 @@ Editor::draw_measures () line = get_time_line (); line->property_x1() = xpos; line->property_x2() = xpos; - line->property_y2() = y2; + line->property_y2() = canvas_height; line->property_color_rgba() = color; //line->raise_to_top(); line->show(); @@ -274,7 +271,7 @@ Editor::draw_measures () /* the cursors are always on top of everything */ - cursor_group->raise_to_top(); + //cursor_group->raise_to_top(); time_line_group->lower_to_bottom(); if (logo_item) { logo_item->lower_to_bottom (); diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 3c2d588b22..22e4fef388 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -223,7 +223,10 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway static const int container_border_width; static const int vertical_spacing; static const int horizontal_spacing; - + + virtual gdouble get_trackview_group_vertical_offset () const = 0; + virtual ArdourCanvas::Group* get_trackview_group () const = 0; + static PublicEditor* _instance; friend class PluginUIWindow; diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index 6240a7062c..49b7894d11 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -221,7 +221,8 @@ RegionView::region_changed (Change what_changed) region_sync_changed (); } if (what_changed & Region::LayerChanged) { - region_layered (); + // this is handled by the playlist i believe + //region_layered (); } if (what_changed & Region::LockChanged) { region_locked (); @@ -270,7 +271,7 @@ RegionView::region_layered () { RouteTimeAxisView *rtv = dynamic_cast(&get_time_axis_view()); assert(rtv); - rtv->view()->region_layered (this); + //rtv->view()->region_layered (this); } void diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index 07c84a87e0..d8f0aadcfe 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -48,7 +48,6 @@ using namespace Editing; StreamView::StreamView (RouteTimeAxisView& tv) : _trackview (tv) , canvas_group(new ArdourCanvas::Group(*_trackview.canvas_display)) - , canvas_rect(new ArdourCanvas::SimpleRect (*canvas_group)) , _samples_per_unit(_trackview.editor.get_current_zoom()) , rec_updating(false) , rec_active(false) @@ -61,8 +60,9 @@ StreamView::StreamView (RouteTimeAxisView& tv) canvas_rect = new ArdourCanvas::SimpleRect (*canvas_group); canvas_rect->property_x1() = 0.0; canvas_rect->property_y1() = 0.0; - canvas_rect->property_x2() = _trackview.editor.frame_to_pixel (max_frames); + canvas_rect->property_x2() = _trackview.editor.frame_to_pixel (max_frames - 1); canvas_rect->property_y2() = (double) tv.current_height(); + canvas_rect->property_outline_what() = (guint32) (0x1|0x2|0x8); // outline ends and bottom // (Fill/Outline colours set in derived classes) @@ -285,12 +285,10 @@ StreamView::region_layered (RegionView* rv) /* don't ever leave it at the bottom, since then it doesn't get events - the parent group does instead ... + we need to raise it above the streamview's + canvas_rect, hence the layer+1 here */ - - /* this used to be + 1, but regions to the left ended up below - ..something.. and couldn't receive events. why? good question. - */ - rv->get_canvas_group()->raise (rv->region()->layer() + 2); + rv->get_canvas_group()->raise (rv->region()->layer() + 1); } void diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h index da44a7a2f0..b56c29257c 100644 --- a/gtk2_ardour/streamview.h +++ b/gtk2_ardour/streamview.h @@ -72,7 +72,7 @@ public: virtual int set_samples_per_unit (gdouble spp); gdouble get_samples_per_unit () { return _samples_per_unit; } - ArdourCanvas::Item* canvas_item() { return canvas_group; } + ArdourCanvas::Group* canvas_item() { return canvas_group; } enum ColorTarget { RegionColor, diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index a42d097b31..04d7c80533 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -79,7 +79,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie need_size_info = false; } - canvas_display = new Group (*canvas.root(), 0.0, 0.0); + canvas_display = new Group (*ed.get_trackview_group (), 0.0, 0.0); selection_group = new Group (*canvas_display); selection_group->hide(); @@ -229,6 +229,7 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent) */ canvas_display->get_bounds (ix1, iy1, ix2, iy2); + iy1 += editor.get_trackview_group_vertical_offset (); Group* pg = canvas_display->property_parent(); pg->i2w (ix1, iy1); diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index df48fe9c24..de58101740 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -149,7 +149,7 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_colo vestigial_frame = new ArdourCanvas::SimpleRect (*group); vestigial_frame->property_x1() = (double) 0.0; vestigial_frame->property_y1() = (double) 1.0; - vestigial_frame->property_x2() = 2.0; + vestigial_frame->property_x2() = (double) 2.0; vestigial_frame->property_y2() = (double) trackview.current_height(); vestigial_frame->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_VestigialFrame.get(); vestigial_frame->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_VestigialFrame.get(); diff --git a/libs/sigc++2/missing b/libs/sigc++2/missing index 894e786e16..1c8ff7049d 100755 --- a/libs/sigc++2/missing +++ b/libs/sigc++2/missing @@ -1,9 +1,9 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2005-06-08.21 +scriptversion=2006-05-10.23 -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. @@ -33,6 +33,8 @@ if test $# -eq 0; then fi run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. @@ -44,7 +46,7 @@ fi msg="missing on your system" -case "$1" in +case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= @@ -77,6 +79,7 @@ Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c @@ -106,7 +109,7 @@ esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). -case "$1" in +case $1 in lex|yacc) # Not GNU programs, they don't have --version. ;; @@ -135,7 +138,7 @@ esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. -case "$1" in +case $1 in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if @@ -164,7 +167,7 @@ WARNING: \`$1' is $msg. You should only need it if test -z "$files" && files="config.h" touch_files= for f in $files; do - case "$f" in + case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; @@ -192,8 +195,8 @@ WARNING: \`$1' is needed, but is $msg. You can get \`$1' as part of \`Autoconf' from any GNU archive site." - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else @@ -214,25 +217,25 @@ WARNING: \`$1' $msg. You should only need it if in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then + if test $# -ne 1; then eval LASTARG="\${$#}" - case "$LASTARG" in + case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi - if [ ! -f y.tab.h ]; then + if test ! -f y.tab.h; then echo >y.tab.h fi - if [ ! -f y.tab.c ]; then + if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; @@ -244,18 +247,18 @@ WARNING: \`$1' is $msg. You should only need it if in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c - if [ $# -ne 1 ]; then + if test $# -ne 1; then eval LASTARG="\${$#}" - case "$LASTARG" in + case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then + if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi - if [ ! -f lex.yy.c ]; then + if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; @@ -267,11 +270,9 @@ WARNING: \`$1' is $msg. You should only need it if \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then touch $file else test -z "$file" || exec >$file @@ -289,11 +290,17 @@ WARNING: \`$1' is $msg. You should only need it if DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi @@ -317,13 +324,13 @@ WARNING: \`$1' is $msg. You should only need it if fi firstarg="$1" if shift; then - case "$firstarg" in + case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac - case "$firstarg" in + case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 -- 2.30.2