From cd44c8241c868b47c11ea8a669e5c37484fee25f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 16 May 2008 13:57:51 +0000 Subject: add GotoWallClock command; switch Editor class to use nframes64_t throughout; fix up some glitches in playhead/screen handling when locating ; never save keybindings to user's ~/.ardour2 dir unless the user changed them (well, nearly) git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3361 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour.menus | 1 + gtk2_ardour/ardour_ui.cc | 29 +++++ gtk2_ardour/ardour_ui.h | 1 + gtk2_ardour/ardour_ui_ed.cc | 3 + gtk2_ardour/editor.cc | 105 ++++++++-------- gtk2_ardour/editor.h | 134 ++++++++++----------- gtk2_ardour/editor_canvas.cc | 29 ++--- gtk2_ardour/editor_canvas_events.cc | 8 +- gtk2_ardour/editor_cursors.cc | 2 +- gtk2_ardour/editor_export_audio.cc | 20 +-- gtk2_ardour/editor_imageframe.cc | 70 +++++------ gtk2_ardour/editor_markers.cc | 6 +- gtk2_ardour/editor_mixer.cc | 8 +- gtk2_ardour/editor_mouse.cc | 162 ++++++++++++------------- gtk2_ardour/editor_ops.cc | 234 ++++++++++++++++++------------------ gtk2_ardour/editor_rulers.cc | 80 ++++++------ gtk2_ardour/editor_selection.cc | 20 +-- gtk2_ardour/editor_tempodisplay.cc | 6 +- gtk2_ardour/keyboard.cc | 13 +- gtk2_ardour/keyboard.h | 2 + gtk2_ardour/public_editor.h | 18 +-- 21 files changed, 501 insertions(+), 450 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index 91d48477c4..5d377837f9 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -82,6 +82,7 @@ + diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 16dd93f771..a5e1f0b46a 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -1304,6 +1305,34 @@ ARDOUR_UI::transport_goto_zero () } } +void +ARDOUR_UI::transport_goto_wallclock () +{ + if (session && editor) { + + time_t now; + struct tm tmnow; + nframes64_t frames; + + time (&now); + localtime_r (&now, &tmnow); + + frames = tmnow.tm_hour * (60 * 60 * session->frame_rate()); + frames += tmnow.tm_min * (60 * session->frame_rate()); + frames += tmnow.tm_sec * session->frame_rate(); + + session->request_locate (frames); + + /* force displayed area in editor to start no matter + what "follow playhead" setting is. + */ + + if (editor) { + editor->reset_x_origin (frames - (editor->current_page_frames()/2)); + } + } +} + void ARDOUR_UI::transport_goto_end () { diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 33e7217638..6c937c2309 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -561,6 +561,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI void transport_goto_zero (); void transport_goto_start (); void transport_goto_end (); + void transport_goto_wallclock (); void transport_stop (); void transport_stop_and_forget_capture (); void transport_record (bool roll); diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 53f307749c..ee2e10f175 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -301,6 +301,9 @@ ARDOUR_UI::install_actions () act = ActionManager::register_action (transport_actions, X_("GotoEnd"), _("Goto End"), mem_fun(*this, &ARDOUR_UI::transport_goto_end)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); + act = ActionManager::register_action (transport_actions, X_("GotoWallClock"), _("Goto Wall Clock"), mem_fun(*this, &ARDOUR_UI::transport_goto_wallclock)); + ActionManager::session_sensitive_actions.push_back (act); + ActionManager::transport_sensitive_actions.push_back (act); act = ActionManager::register_action (transport_actions, X_("focus-on-clock"), _("Focus On Clock"), mem_fun(primary_clock, &AudioClock::focus)); ActionManager::session_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 19bb9839cd..d038dd7079 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -942,10 +942,10 @@ Editor::zoom_adjustment_changed () if (fpu < 1.0) { fpu = 1.0; - zoom_range_clock.set ((nframes_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 ((nframes_t) floor (fpu * canvas_width)); + zoom_range_clock.set ((nframes64_t) floor (fpu * canvas_width)); } temporal_zoom (fpu); @@ -965,7 +965,7 @@ Editor::control_scroll (float fraction) /* _control_scroll_target is an optional - it acts like a pointer to an nframes_t, with + it acts like a pointer to an nframes64_t, with a operator conversion to boolean to check that it has a value could possibly use playhead_cursor->current_frame to store the @@ -978,12 +978,12 @@ Editor::control_scroll (float fraction) _dragging_playhead = true; } - if ((fraction < 0.0f) && (*_control_scroll_target < (nframes_t) fabs(step))) { + if ((fraction < 0.0f) && (*_control_scroll_target < (nframes64_t) fabs(step))) { *_control_scroll_target = 0; } else if ((fraction > 0.0f) && (max_frames - *_control_scroll_target < step)) { *_control_scroll_target = max_frames - (current_page_frames()*2); // allow room for slop in where the PH is on the screen } else { - *_control_scroll_target += (nframes_t) floor (step); + *_control_scroll_target += (nframes64_t) floor (step); } /* move visuals, we'll catch up with it later */ @@ -1014,7 +1014,7 @@ Editor::control_scroll (float fraction) } bool -Editor::deferred_control_scroll (nframes_t target) +Editor::deferred_control_scroll (nframes64_t target) { session->request_locate (*_control_scroll_target, session->transport_rolling()); // reset for next stream @@ -1061,7 +1061,7 @@ Editor::stop_scrolling () } void -Editor::map_position_change (nframes_t frame) +Editor::map_position_change (nframes64_t frame) { ENSURE_GUI_THREAD (bind (mem_fun(*this, &Editor::map_position_change), frame)); @@ -1074,7 +1074,7 @@ Editor::map_position_change (nframes_t frame) } void -Editor::center_screen (nframes_t frame) +Editor::center_screen (nframes64_t frame) { double page = canvas_width * frames_per_unit; @@ -1087,12 +1087,12 @@ Editor::center_screen (nframes_t frame) } void -Editor::center_screen_internal (nframes_t frame, float page) +Editor::center_screen_internal (nframes64_t frame, float page) { page /= 2; if (frame > page) { - frame -= (nframes_t) page; + frame -= (nframes64_t) page; } else { frame = 0; } @@ -1105,7 +1105,7 @@ Editor::handle_new_duration () { ENSURE_GUI_THREAD (mem_fun (*this, &Editor::handle_new_duration)); - nframes_t new_end = session->get_maximum_extent() + (nframes_t) floorf (current_page_frames() * 0.10f); + nframes64_t new_end = session->get_maximum_extent() + (nframes64_t) floorf (current_page_frames() * 0.10f); if (new_end > last_canvas_frame) { last_canvas_frame = new_end; @@ -1445,10 +1445,10 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i } void -Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type, bool with_selection, nframes_t frame) +Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type, bool with_selection, nframes64_t frame) { using namespace Menu_Helpers; - Menu* (Editor::*build_menu_function)(nframes_t); + Menu* (Editor::*build_menu_function)(nframes64_t); Menu *menu; switch (item_type) { @@ -1560,7 +1560,7 @@ Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type, } Menu* -Editor::build_track_context_menu (nframes_t ignored) +Editor::build_track_context_menu (nframes64_t ignored) { using namespace Menu_Helpers; @@ -1572,7 +1572,7 @@ Editor::build_track_context_menu (nframes_t ignored) } Menu* -Editor::build_track_bus_context_menu (nframes_t ignored) +Editor::build_track_bus_context_menu (nframes64_t ignored) { using namespace Menu_Helpers; @@ -1584,7 +1584,7 @@ Editor::build_track_bus_context_menu (nframes_t ignored) } Menu* -Editor::build_track_region_context_menu (nframes_t frame) +Editor::build_track_region_context_menu (nframes64_t frame) { using namespace Menu_Helpers; MenuList& edit_items = track_region_context_menu.items(); @@ -1597,7 +1597,7 @@ Editor::build_track_region_context_menu (nframes_t frame) boost::shared_ptr pl; if ((ds = atv->get_diskstream()) && ((pl = ds->playlist()))) { - Playlist::RegionList* regions = pl->regions_at ((nframes_t) floor ( (double)frame * ds->speed())); + Playlist::RegionList* regions = pl->regions_at ((nframes64_t) floor ( (double)frame * ds->speed())); for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) { add_region_context_items (atv->audio_view(), (*i), edit_items); } @@ -1611,7 +1611,7 @@ Editor::build_track_region_context_menu (nframes_t frame) } Menu* -Editor::build_track_crossfade_context_menu (nframes_t frame) +Editor::build_track_crossfade_context_menu (nframes64_t frame) { using namespace Menu_Helpers; MenuList& edit_items = track_crossfade_context_menu.items(); @@ -1691,7 +1691,7 @@ Editor::analyze_range_selection() Menu* -Editor::build_track_selection_context_menu (nframes_t ignored) +Editor::build_track_selection_context_menu (nframes64_t ignored) { using namespace Menu_Helpers; MenuList& edit_items = track_selection_context_menu.items(); @@ -2294,7 +2294,7 @@ Editor::set_state (const XMLNode& node) move (x, y); if (session && (prop = node.property ("playhead"))) { - nframes_t pos = atol (prop->value().c_str()); + nframes64_t pos = atol (prop->value().c_str()); playhead_cursor->set_position (pos); } else { playhead_cursor->set_position (0); @@ -2469,7 +2469,7 @@ Editor::get_state () node->add_property ("edit-point", enum_2_string (_edit_point)); - snprintf (buf, sizeof (buf), "%" PRIu32, playhead_cursor->current_frame); + snprintf (buf, sizeof (buf), "%" PRIi64, playhead_cursor->current_frame); node->add_property ("playhead", buf); node->add_property ("show-waveforms", _show_waveforms ? "yes" : "no"); @@ -2531,17 +2531,17 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) switch (snap_type) { case SnapToCDFrame: if (((direction == 0) && (start % (one_second/75) > (one_second/75) / 2)) || (direction > 0)) { - start = (nframes_t) ceil ((double) start / (one_second / 75)) * (one_second / 75); + start = (nframes64_t) ceil ((double) start / (one_second / 75)) * (one_second / 75); } else { - start = (nframes_t) floor ((double) start / (one_second / 75)) * (one_second / 75); + start = (nframes64_t) floor ((double) start / (one_second / 75)) * (one_second / 75); } break; case SnapToSMPTEFrame: if (((direction == 0) && (fmod((double)start, (double)session->frames_per_smpte_frame()) > (session->frames_per_smpte_frame() / 2))) || (direction > 0)) { - start = (nframes_t) (ceil ((double) start / session->frames_per_smpte_frame()) * session->frames_per_smpte_frame()); + start = (nframes64_t) (ceil ((double) start / session->frames_per_smpte_frame()) * session->frames_per_smpte_frame()); } else { - start = (nframes_t) (floor ((double) start / session->frames_per_smpte_frame()) * session->frames_per_smpte_frame()); + start = (nframes64_t) (floor ((double) start / session->frames_per_smpte_frame()) * session->frames_per_smpte_frame()); } break; @@ -2553,9 +2553,9 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) start -= session->smpte_offset (); } if (((direction == 0) && (start % one_smpte_second > one_smpte_second / 2)) || direction > 0) { - start = (nframes_t) ceil ((double) start / one_smpte_second) * one_smpte_second; + start = (nframes64_t) ceil ((double) start / one_smpte_second) * one_smpte_second; } else { - start = (nframes_t) floor ((double) start / one_smpte_second) * one_smpte_second; + start = (nframes64_t) floor ((double) start / one_smpte_second) * one_smpte_second; } if (session->smpte_offset_negative()) @@ -2574,9 +2574,9 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) start -= session->smpte_offset (); } if (((direction == 0) && (start % one_smpte_minute > one_smpte_minute / 2)) || direction > 0) { - start = (nframes_t) ceil ((double) start / one_smpte_minute) * one_smpte_minute; + start = (nframes64_t) ceil ((double) start / one_smpte_minute) * one_smpte_minute; } else { - start = (nframes_t) floor ((double) start / one_smpte_minute) * one_smpte_minute; + start = (nframes64_t) floor ((double) start / one_smpte_minute) * one_smpte_minute; } if (session->smpte_offset_negative()) { @@ -2588,17 +2588,17 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) case SnapToSeconds: if (((direction == 0) && (start % one_second > one_second / 2)) || (direction > 0)) { - start = (nframes_t) ceil ((double) start / one_second) * one_second; + start = (nframes64_t) ceil ((double) start / one_second) * one_second; } else { - start = (nframes_t) floor ((double) start / one_second) * one_second; + start = (nframes64_t) floor ((double) start / one_second) * one_second; } break; case SnapToMinutes: if (((direction == 0) && (start % one_minute > one_minute / 2)) || (direction > 0)) { - start = (nframes_t) ceil ((double) start / one_minute) * one_minute; + start = (nframes64_t) ceil ((double) start / one_minute) * one_minute; } else { - start = (nframes_t) floor ((double) start / one_minute) * one_minute; + start = (nframes64_t) floor ((double) start / one_minute) * one_minute; } break; @@ -2675,7 +2675,7 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) case SnapToRegionSync: case SnapToRegionBoundary: if (!region_boundary_cache.empty()) { - vector::iterator i; + vector::iterator i; if (direction > 0) { i = std::upper_bound (region_boundary_cache.begin(), region_boundary_cache.end(), start); @@ -3700,10 +3700,10 @@ Editor::playlist_selector () const return *_playlist_selector; } -nframes_t -Editor::get_nudge_distance (nframes_t pos, nframes_t& next) +nframes64_t +Editor::get_nudge_distance (nframes64_t pos, nframes64_t& next) { - nframes_t ret; + nframes64_t ret; ret = nudge_clock.current_duration (pos); next = ret + 1; /* XXXX fix me */ @@ -3755,7 +3755,7 @@ Editor::playlist_deletion_dialog (boost::shared_ptr pl) } bool -Editor::audio_region_selection_covers (nframes_t where) +Editor::audio_region_selection_covers (nframes64_t where) { for (RegionSelection::iterator a = selection->regions.begin(); a != selection->regions.end(); ++a) { if ((*a)->region()->covers (where)) { @@ -4100,7 +4100,7 @@ Editor::on_key_release_event (GdkEventKey* ev) } void -Editor::reset_x_origin (nframes_t frame) +Editor::reset_x_origin (nframes64_t frame) { queue_visual_change (frame); } @@ -4112,7 +4112,7 @@ Editor::reset_zoom (double fpu) } void -Editor::reposition_and_zoom (nframes_t frame, double fpu) +Editor::reposition_and_zoom (nframes64_t frame, double fpu) { reset_x_origin (frame); reset_zoom (fpu); @@ -4241,7 +4241,7 @@ Editor::post_zoom () { // convert fpu to frame count - nframes_t frames = (nframes_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); @@ -4270,11 +4270,11 @@ Editor::post_zoom () } void -Editor::queue_visual_change (nframes_t where) +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; - + if (pending_visual_change.idle_handler_id < 0) { pending_visual_change.idle_handler_id = g_idle_add (_idle_visual_changer, this); } @@ -4311,9 +4311,18 @@ Editor::idle_visual_changer () if (p & VisualChange::TimeOrigin) { - nframes_t time_origin = (nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit); + nframes64_t time_origin = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit); + + /* 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 = pending_visual_change.time_origin + current_page_frames(); + horizontal_adjustment.set_upper (last_canvas_frame / frames_per_unit); + reset_scrolling_region (); + } + horizontal_adjustment.set_value (pending_visual_change.time_origin/frames_per_unit); } else { update_fixed_rulers(); @@ -4391,7 +4400,7 @@ Editor::get_preferred_edit_position (bool ignore_playhead) } void -Editor::set_loop_range (nframes_t start, nframes_t end, string cmd) +Editor::set_loop_range (nframes64_t start, nframes64_t end, string cmd) { if (!session) return; @@ -4418,7 +4427,7 @@ Editor::set_loop_range (nframes_t start, nframes_t end, string cmd) } void -Editor::set_punch_range (nframes_t start, nframes_t end, string cmd) +Editor::set_punch_range (nframes64_t start, nframes64_t end, string cmd) { if (!session) return; @@ -4466,7 +4475,7 @@ Editor::get_regions_at (RegionSelection& rs, nframes64_t where, const TrackSelec if ((ds = atv->get_diskstream()) && ((pl = ds->playlist()))) { - Playlist::RegionList* regions = pl->regions_at ((nframes_t) floor ( (double)where * ds->speed())); + Playlist::RegionList* regions = pl->regions_at ((nframes64_t) floor ( (double)where * ds->speed())); for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) { @@ -4504,7 +4513,7 @@ Editor::get_regions_after (RegionSelection& rs, nframes64_t where, const TrackSe if ((ds = atv->get_diskstream()) && ((pl = ds->playlist()))) { - Playlist::RegionList* regions = pl->regions_touched ((nframes_t) floor ( (double)where * ds->speed()), max_frames); + Playlist::RegionList* regions = pl->regions_touched ((nframes64_t) floor ( (double)where * ds->speed()), max_frames); for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) { diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index e521c51a2d..4b4f0fbda6 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -133,9 +133,9 @@ class Editor : public PublicEditor void first_idle (); virtual bool have_idled() const { return _have_idled; } - nframes_t leftmost_position() const { return leftmost_frame; } - nframes_t current_page_frames() const { - return (nframes_t) floor (canvas_width * frames_per_unit); + nframes64_t leftmost_position() const { return leftmost_frame; } + nframes64_t current_page_frames() const { + return (nframes64_t) floor (canvas_width * frames_per_unit); } void cycle_snap_mode (); @@ -192,11 +192,11 @@ class Editor : public PublicEditor /* undo related */ - nframes_t unit_to_frame (double unit) const { - return (nframes_t) rint (unit * frames_per_unit); + nframes64_t unit_to_frame (double unit) const { + return (nframes64_t) rint (unit * frames_per_unit); } - double frame_to_unit (nframes_t frame) const { + double frame_to_unit (nframes64_t frame) const { return rint ((double) frame / (double) frames_per_unit); } @@ -220,7 +220,7 @@ class Editor : public PublicEditor */ if (pixel >= 0) { - return (nframes_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit); + return (nframes64_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit); } else { return 0; } @@ -359,9 +359,9 @@ class Editor : public PublicEditor void maximise_editing_space(); void restore_editing_space(); - void reset_x_origin (nframes_t); + void reset_x_origin (nframes64_t); void reset_zoom (double); - void reposition_and_zoom (nframes_t, double); + void reposition_and_zoom (nframes64_t, double); nframes64_t get_preferred_edit_position (bool ignore_playhead = false); @@ -377,7 +377,7 @@ class Editor : public PublicEditor protected: void map_transport_state (); - void map_position_change (nframes_t); + void map_position_change (nframes64_t); void on_realize(); @@ -387,7 +387,7 @@ class Editor : public PublicEditor bool constructed; // to keep track of the playhead position for control_scroll - boost::optional _control_scroll_target; + boost::optional _control_scroll_target; PlaylistSelector* _playlist_selector; @@ -396,7 +396,7 @@ class Editor : public PublicEditor struct VisualState { double y_position; double frames_per_unit; - nframes_t leftmost_frame; + nframes64_t leftmost_frame; Editing::ZoomFocus zoom_focus; bool zoomed_to_region; std::list track_states; @@ -417,7 +417,7 @@ class Editor : public PublicEditor void cancel_visual_state_op (uint32_t n); bool end_visual_state_op (uint32_t n); - nframes_t leftmost_frame; + nframes64_t leftmost_frame; double frames_per_unit; Editing::ZoomFocus zoom_focus; @@ -470,7 +470,7 @@ class Editor : public PublicEditor void hide(); void show (); void set_name (const string&); - void set_position (nframes_t start, nframes_t end = 0); + void set_position (nframes64_t start, nframes64_t end = 0); void set_color_rgba (uint32_t); }; @@ -483,7 +483,7 @@ class Editor : public PublicEditor void hide_marker (ArdourCanvas::Item*, GdkEvent*); void clear_marker_display (); - void mouse_add_new_marker (nframes_t where, bool is_cd=false, bool is_xrun=false); + void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false); bool choose_new_marker_name(string &name); void update_cd_marker_display (); void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location); @@ -539,12 +539,12 @@ class Editor : public PublicEditor Gtk::Menu * track_edit_playlist_submenu; Gtk::Menu * track_selection_edit_playlist_submenu; - void popup_track_context_menu (int, int, ItemType, bool, nframes_t); - Gtk::Menu* build_track_context_menu (nframes_t); - Gtk::Menu* build_track_bus_context_menu (nframes_t); - Gtk::Menu* build_track_region_context_menu (nframes_t frame); - Gtk::Menu* build_track_crossfade_context_menu (nframes_t); - Gtk::Menu* build_track_selection_context_menu (nframes_t); + void popup_track_context_menu (int, int, ItemType, bool, nframes64_t); + Gtk::Menu* build_track_context_menu (nframes64_t); + Gtk::Menu* build_track_bus_context_menu (nframes64_t); + Gtk::Menu* build_track_region_context_menu (nframes64_t frame); + Gtk::Menu* build_track_crossfade_context_menu (nframes64_t); + Gtk::Menu* build_track_selection_context_menu (nframes64_t); void add_dstream_context_items (Gtk::Menu_Helpers::MenuList&); void add_bus_context_items (Gtk::Menu_Helpers::MenuList&); void add_region_context_items (AudioStreamView*, boost::shared_ptr, Gtk::Menu_Helpers::MenuList&); @@ -637,7 +637,7 @@ class Editor : public PublicEditor void update_just_smpte (); void update_fixed_rulers (); void update_tempo_based_rulers (); - void popup_ruler_menu (nframes_t where = 0, ItemType type = RegionItem); + void popup_ruler_menu (nframes64_t where = 0, ItemType type = RegionItem); void update_ruler_visibility (); void set_ruler_visible (RulerType, bool); void toggle_ruler_visibility (RulerType rt); @@ -705,13 +705,13 @@ class Editor : public PublicEditor Editor& editor; ArdourCanvas::Points points; ArdourCanvas::Line canvas_item; - nframes_t current_frame; + nframes64_t current_frame; double length; Cursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*)); ~Cursor (); - void set_position (nframes_t); + void set_position (nframes64_t); void set_length (double units); void set_y_axis (double position); }; @@ -746,10 +746,10 @@ class Editor : public PublicEditor void select_all_selectables_between (bool within); void select_range_between (); - boost::shared_ptr find_next_region (nframes_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0); + boost::shared_ptr find_next_region (nframes64_t, ARDOUR::RegionPoint, int32_t dir, TrackViewList&, TimeAxisView ** = 0); nframes64_t find_next_region_boundary (nframes64_t, int32_t dir, const TrackViewList&); - vector region_boundary_cache; + vector region_boundary_cache; void build_region_boundary_cache (); Gtk::HBox top_hbox; @@ -777,7 +777,7 @@ class Editor : public PublicEditor double canvas_width; double canvas_height; double full_canvas_height; - nframes_t last_canvas_frame; + nframes64_t last_canvas_frame; bool track_canvas_map_handler (GdkEventAny*); bool time_canvas_map_handler (GdkEventAny*); @@ -793,7 +793,7 @@ class Editor : public PublicEditor void control_scroll (float); void access_action (std::string,std::string); - bool deferred_control_scroll (nframes_t); + bool deferred_control_scroll (nframes64_t); sigc::connection control_scroll_connection; void tie_vertical_scrolling (); @@ -807,7 +807,7 @@ class Editor : public PublicEditor }; Type pending; - nframes_t time_origin; + nframes64_t time_origin; double frames_per_unit; int idle_handler_id; @@ -821,7 +821,7 @@ class Editor : public PublicEditor static int _idle_visual_changer (void *arg); int idle_visual_changer (); - void queue_visual_change (nframes_t); + void queue_visual_change (nframes64_t); void queue_visual_change (double); void end_location_changed (ARDOUR::Location*); @@ -946,16 +946,16 @@ class Editor : public PublicEditor static void build_cursors (); sigc::connection scroll_connection; - nframes_t last_update_frame; - void center_screen (nframes_t); - void center_screen_internal (nframes_t, float); + nframes64_t last_update_frame; + void center_screen (nframes64_t); + void center_screen_internal (nframes64_t, float); void update_current_screen (); void session_going_away (); - nframes_t cut_buffer_start; - nframes_t cut_buffer_length; + nframes64_t cut_buffer_start; + nframes64_t cut_buffer_length; bool typed_event (ArdourCanvas::Item*, GdkEvent*, ItemType); bool button_press_handler (ArdourCanvas::Item*, GdkEvent*, ItemType); @@ -968,7 +968,7 @@ class Editor : public PublicEditor void register_actions (); - int ensure_cursor (nframes_t* pos); + int ensure_cursor (nframes64_t* pos); void handle_new_audio_region (boost::weak_ptr); void handle_new_audio_regions (vector >& ); @@ -987,7 +987,7 @@ class Editor : public PublicEditor void cut_copy_ranges (Editing::CutCopyOp); void mouse_paste (); - void paste_internal (nframes_t position, float times); + void paste_internal (nframes64_t position, float times); /* EDITING OPERATIONS */ @@ -1001,19 +1001,19 @@ class Editor : public PublicEditor void lower_region (); void lower_region_to_bottom (); void split_region (); - void split_region_at (nframes_t); - void split_regions_at (nframes_t, RegionSelection&); + void split_region_at (nframes64_t); + void split_regions_at (nframes64_t, RegionSelection&); void split_region_at_transients (); void split_region_at_points (boost::shared_ptr, ARDOUR::AnalysisFeatureList&, bool can_ferret); void crop_region_to_selection (); - void crop_region_to (nframes_t start, nframes_t end); + void crop_region_to (nframes64_t start, nframes64_t end); void set_sync_point (nframes64_t, const RegionSelection&); void set_region_sync_from_edit_point (); void remove_region_sync(); - void align_selection (ARDOUR::RegionPoint, nframes_t position, const RegionSelection&); - void align_selection_relative (ARDOUR::RegionPoint point, nframes_t position, const RegionSelection&); - void align_region (boost::shared_ptr, ARDOUR::RegionPoint point, nframes_t position); - void align_region_internal (boost::shared_ptr, ARDOUR::RegionPoint point, nframes_t position); + void align_selection (ARDOUR::RegionPoint, nframes64_t position, const RegionSelection&); + void align_selection_relative (ARDOUR::RegionPoint point, nframes64_t position, const RegionSelection&); + void align_region (boost::shared_ptr, ARDOUR::RegionPoint point, nframes64_t position); + void align_region_internal (boost::shared_ptr, ARDOUR::RegionPoint point, nframes64_t position); void remove_clicked_region (); void destroy_clicked_region (); void edit_region (); @@ -1080,8 +1080,8 @@ class Editor : public PublicEditor bool zoomed_to_region; void temporal_zoom_session (); void temporal_zoom (gdouble scale); - void temporal_zoom_by_frame (nframes_t start, nframes_t end, const string & op); - void temporal_zoom_to_frame (bool coarser, nframes_t frame); + void temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & op); + void temporal_zoom_to_frame (bool coarser, nframes64_t frame); void amplitude_zoom (gdouble scale); void amplitude_zoom_step (bool in); @@ -1199,8 +1199,8 @@ class Editor : public PublicEditor void set_loop_from_region (bool play); void set_punch_from_edit_range (); - void set_loop_range (nframes_t start, nframes_t end, std::string cmd); - void set_punch_range (nframes_t start, nframes_t end, std::string cmd); + void set_loop_range (nframes64_t start, nframes64_t end, std::string cmd); + void set_punch_range (nframes64_t start, nframes64_t end, std::string cmd); void add_location_from_playhead_cursor (); bool select_new_marker; @@ -1221,7 +1221,7 @@ class Editor : public PublicEditor void keyboard_selection_begin (); void keyboard_selection_finish (bool add); bool have_pending_keyboard_selection; - nframes_t pending_keyboard_selection_start; + nframes64_t pending_keyboard_selection_start; boost::shared_ptr select_region_for_operation (int dir, TimeAxisView **tv); void extend_selection_to_end_of_region (bool next); @@ -1310,11 +1310,11 @@ class Editor : public PublicEditor void remove_gain_control_point (ArdourCanvas::Item*, GdkEvent*); void remove_control_point (ArdourCanvas::Item*, GdkEvent*); - void mouse_brush_insert_region (RegionView*, nframes_t pos); - void brush (nframes_t); + void mouse_brush_insert_region (RegionView*, nframes64_t pos); + void brush (nframes64_t); - void show_verbose_time_cursor (nframes_t frame, double offset = 0, double xpos=-1, double ypos=-1); - void show_verbose_duration_cursor (nframes_t start, nframes_t end, double offset = 0, double xpos=-1, double ypos=-1); + void show_verbose_time_cursor (nframes64_t frame, double offset = 0, double xpos=-1, double ypos=-1); + void show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset = 0, double xpos=-1, double ypos=-1); double clamp_verbose_cursor_x (double); double clamp_verbose_cursor_y (double); @@ -1416,8 +1416,8 @@ public: void new_tempo_section (); - void mouse_add_new_tempo_event (nframes_t where); - void mouse_add_new_meter_event (nframes_t where); + void mouse_add_new_tempo_event (nframes64_t where); + void mouse_add_new_meter_event (nframes64_t where); void remove_tempo_marker (ArdourCanvas::Item*); void remove_meter_marker (ArdourCanvas::Item*); @@ -1476,12 +1476,6 @@ public: void redisplay_tempo (bool immediate_redraw); void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false); - void snap_to (nframes_t& first, int32_t direction = 0, bool for_mark = false) { - /* XXX remove this function when everything moves to 64 bit frame counts */ - nframes64_t first64 = first; - snap_to (first64, direction, for_mark); - first = (nframes_t) first64; - } uint32_t bbt_beat_subdivision; @@ -1594,7 +1588,7 @@ public: void region_selection_op (void (ARDOUR::Region::*pmf)(void*), void*); void region_selection_op (void (ARDOUR::Region::*pmf)(bool), bool); - bool audio_region_selection_covers (nframes_t where); + bool audio_region_selection_covers (nframes64_t where); /* transport range select process */ enum RangeMarkerOp { @@ -1637,7 +1631,7 @@ public: void drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event); void end_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event); - bool select_all_within (nframes_t start, nframes_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op); + bool select_all_within (nframes64_t start, nframes64_t end, gdouble topy, gdouble boty, const TrackViewList&, Selection::Operation op); ArdourCanvas::SimpleRect *rubberband_rect; @@ -1648,7 +1642,7 @@ public: void end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event); ArdourCanvas::SimpleRect *zoom_rect; - void reposition_zoom_rect (nframes_t start, nframes_t end); + void reposition_zoom_rect (nframes64_t start, nframes64_t end); /* diskstream/route display management */ @@ -1761,7 +1755,7 @@ public: int last_autoscroll_x; int last_autoscroll_y; uint32_t autoscroll_cnt; - nframes_t autoscroll_x_distance; + nframes64_t autoscroll_x_distance; double autoscroll_y_distance; static gint _autoscroll_canvas (void *); @@ -1781,9 +1775,9 @@ public: void start_trim (ArdourCanvas::Item*, GdkEvent*); void point_trim (GdkEvent*); void trim_motion_callback (ArdourCanvas::Item*, GdkEvent*); - void single_contents_trim (RegionView&, nframes_t, bool, bool, bool); - void single_start_trim (RegionView&, nframes_t, bool, bool); - void single_end_trim (RegionView&, nframes_t, bool, bool); + void single_contents_trim (RegionView&, nframes64_t, bool, bool, bool); + void single_start_trim (RegionView&, nframes64_t, bool, bool); + void single_end_trim (RegionView&, nframes64_t, bool, bool); void trim_finished_callback (ArdourCanvas::Item*, GdkEvent*); void thaw_region_after_trim (RegionView& rv); @@ -1844,7 +1838,7 @@ public: ExportDialog *export_dialog; ExportDialog *export_range_markers_dialog; - void export_range (nframes_t start, nframes_t end); + void export_range (nframes64_t start, nframes64_t end); void export_range_markers (); int write_region_selection(RegionSelection&); @@ -2044,7 +2038,7 @@ public: Gtk::VBox nudge_vbox; AudioClock nudge_clock; - nframes_t get_nudge_distance (nframes_t pos, nframes_t& next); + nframes64_t get_nudge_distance (nframes64_t pos, nframes64_t& next); bool nudge_forward_release (GdkEventButton*); bool nudge_backward_release (GdkEventButton*); diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 20181c1081..d0150713aa 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -53,7 +53,7 @@ using namespace Glib; using namespace Gtkmm2ext; using namespace Editing; -/* XXX this is a hack. it ought to be the maximum value of an nframes_t */ +/* XXX this is a hack. it ought to be the maximum value of an nframes64_t */ const double max_canvas_coordinate = (double) JACK_MAX_FRAMES; @@ -329,7 +329,7 @@ Editor::track_canvas_size_allocated () full_canvas_height = height; } - zoom_range_clock.set ((nframes_t) floor ((canvas_width * frames_per_unit))); + zoom_range_clock.set ((nframes64_t) floor ((canvas_width * frames_per_unit))); playhead_cursor->set_position (playhead_cursor->current_frame); reset_hscrollbar_stepping (); @@ -556,8 +556,8 @@ Editor::drop_regions (const RefPtr& context, void Editor::maybe_autoscroll (GdkEventMotion* event) { - nframes_t rightmost_frame = leftmost_frame + current_page_frames(); - nframes_t frame = drag_info.current_pointer_frame; + nframes64_t rightmost_frame = leftmost_frame + current_page_frames(); + nframes64_t frame = drag_info.current_pointer_frame; bool startit = false; double vertical_pos = vertical_adjustment.get_value(); @@ -615,10 +615,10 @@ Editor::_autoscroll_canvas (void *arg) bool Editor::autoscroll_canvas () { - nframes_t new_frame; - nframes_t limit = max_frames - current_page_frames(); + nframes64_t new_frame; + nframes64_t limit = max_frames - current_page_frames(); GdkEventMotion ev; - nframes_t target_frame; + nframes64_t target_frame; double new_pixel; double target_pixel; @@ -715,17 +715,17 @@ Editor::autoscroll_canvas () /* after about a while, speed up a bit by changing the timeout interval */ - autoscroll_x_distance = (nframes_t) floor (current_page_frames()/30.0f); + autoscroll_x_distance = (nframes64_t) floor (current_page_frames()/30.0f); } else if (autoscroll_cnt == 150) { /* 1.0 seconds */ - autoscroll_x_distance = (nframes_t) floor (current_page_frames()/20.0f); + 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 = (nframes_t) floor (current_page_frames()/10.0f); + autoscroll_x_distance = (nframes64_t) floor (current_page_frames()/10.0f); } } @@ -765,7 +765,7 @@ Editor::start_canvas_autoscroll (int dx, int dy) autoscroll_active = true; autoscroll_x = dx; autoscroll_y = dy; - autoscroll_x_distance = (nframes_t) floor (current_page_frames()/50.0); + autoscroll_x_distance = (nframes64_t) floor (current_page_frames()/50.0); autoscroll_y_distance = fabs (dy * 5); /* pixels */ autoscroll_cnt = 0; @@ -837,7 +837,7 @@ Editor::tie_vertical_scrolling () void Editor::canvas_horizontally_scrolled () { - nframes64_t time_origin = (nframes_t) floor (horizontal_adjustment.get_value() * frames_per_unit); + nframes64_t time_origin = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit); if (time_origin != leftmost_frame) { canvas_scroll_to (time_origin); @@ -847,8 +847,9 @@ Editor::canvas_horizontally_scrolled () void Editor::canvas_scroll_to (nframes64_t time_origin) { - leftmost_frame = time_origin; - nframes_t rightmost_frame = leftmost_frame + current_page_frames (); + leftmost_frame = time_origin; + + nframes64_t rightmost_frame = leftmost_frame + current_page_frames (); if (rightmost_frame > last_canvas_frame) { last_canvas_frame = rightmost_frame; diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index 4615fda5f4..a1ac41d47c 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -54,7 +54,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) { int x, y; double wx, wy; - nframes_t xdelta; + nframes64_t xdelta; int direction = ev->direction; retry: @@ -77,7 +77,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) event.button.x = wx; event.button.y = wy; - nframes_t where = event_frame (&event, 0, 0); + nframes64_t where = event_frame (&event, 0, 0); temporal_zoom_to_frame (false, where); return true; } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) { @@ -112,7 +112,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) event.button.x = wx; event.button.y = wy; - nframes_t where = event_frame (&event, 0, 0); + nframes64_t where = event_frame (&event, 0, 0); temporal_zoom_to_frame (true, where); return true; } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::SecondaryModifier)) { @@ -171,7 +171,7 @@ Editor::track_canvas_scroll_event (GdkEventScroll *event) bool Editor::time_canvas_scroll (GdkEventScroll* ev) { - nframes_t xdelta; + nframes64_t xdelta; int direction = ev->direction; switch (direction) { diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc index 239d27d4f9..54786bcebf 100644 --- a/gtk2_ardour/editor_cursors.cc +++ b/gtk2_ardour/editor_cursors.cc @@ -61,7 +61,7 @@ Editor::Cursor::~Cursor () } void -Editor::Cursor::set_position (nframes_t frame) +Editor::Cursor::set_position (nframes64_t frame) { double new_pos = editor.frame_to_unit (frame); diff --git a/gtk2_ardour/editor_export_audio.cc b/gtk2_ardour/editor_export_audio.cc index 8a749d45bc..8ee0ac1f90 100644 --- a/gtk2_ardour/editor_export_audio.cc +++ b/gtk2_ardour/editor_export_audio.cc @@ -73,7 +73,7 @@ Editor::export_selection () } void -Editor::export_range (nframes_t start, nframes_t end) +Editor::export_range (nframes64_t start, nframes64_t end) { if (session) { if (export_dialog == 0) { @@ -157,11 +157,11 @@ bool Editor::write_region (string path, boost::shared_ptr region) { boost::shared_ptr fs; - const nframes_t chunk_size = 4096; - nframes_t to_read; + const nframes64_t chunk_size = 4096; + nframes64_t to_read; Sample buf[chunk_size]; gain_t gain_buffer[chunk_size]; - nframes_t pos; + nframes64_t pos; char s[PATH_MAX+1]; uint32_t cnt; vector > sources; @@ -224,7 +224,7 @@ Editor::write_region (string path, boost::shared_ptr region) pos = region->position(); while (to_read) { - nframes_t this_time; + nframes64_t this_time; this_time = min (to_read, chunk_size); @@ -302,11 +302,11 @@ bool Editor::write_audio_range (AudioPlaylist& playlist, uint32_t channels, list& range) { boost::shared_ptr fs; - const nframes_t chunk_size = 4096; - nframes_t nframes; + const nframes64_t chunk_size = 4096; + nframes64_t nframes; Sample buf[chunk_size]; gain_t gain_buffer[chunk_size]; - nframes_t pos; + nframes64_t pos; char s[PATH_MAX+1]; uint32_t cnt; string path; @@ -355,7 +355,7 @@ Editor::write_audio_range (AudioPlaylist& playlist, uint32_t channels, list(frames_per_unit * (edit_hscroll_slider_width/2)) ; - nframes_t offset = 0; + //nframes64_t offset = static_cast(frames_per_unit * (edit_hscroll_slider_width/2)) ; + nframes64_t offset = 0; - nframes_t x_pos = 0 ; + nframes64_t x_pos = 0 ; if (item->get_position() < offset) { x_pos = 0 ; @@ -493,14 +493,14 @@ Editor::markerview_drag_motion_callback(ArdourCanvas::Item*, GdkEvent* event) double cx, cy ; MarkerView* mv = reinterpret_cast(drag_info.data) ; - nframes_t pending_region_position ; - nframes_t pointer_frame ; + nframes64_t pending_region_position ; + nframes64_t pointer_frame ; pointer_frame = event_frame(event, &cx, &cy) ; snap_to(pointer_frame) ; - if (pointer_frame > (nframes_t) drag_info.pointer_frame_offset) + if (pointer_frame > (nframes64_t) drag_info.pointer_frame_offset) { pending_region_position = pointer_frame - drag_info.pointer_frame_offset ; snap_to(pending_region_position) ; @@ -541,14 +541,14 @@ Editor::imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent* event) ImageFrameView* ifv = reinterpret_cast(drag_info.data) ; - nframes_t pending_region_position; - nframes_t pointer_frame; + nframes64_t pending_region_position; + nframes64_t pointer_frame; pointer_frame = event_frame(event, &cx, &cy) ; snap_to(pointer_frame) ; - if (pointer_frame > (nframes_t) drag_info.pointer_frame_offset) + if (pointer_frame > (nframes64_t) drag_info.pointer_frame_offset) { pending_region_position = pointer_frame - drag_info.pointer_frame_offset ; snap_to(pending_region_position) ; @@ -576,7 +576,7 @@ Editor::imageframe_drag_motion_callback(ArdourCanvas::Item*, GdkEvent* event) void Editor::timeaxis_item_drag_finished_callback(ArdourCanvas::Item*, GdkEvent* event) { - nframes_t where ; + nframes64_t where ; TimeAxisViewItem* tavi = reinterpret_cast(drag_info.data) ; bool item_x_movement = (drag_info.last_frame_position != tavi->get_position()) ; @@ -674,9 +674,9 @@ Editor::imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* { ImageFrameView* ifv = reinterpret_cast (drag_info.data) ; - nframes_t start = 0 ; - nframes_t end = 0 ; - nframes_t pointer_frame = event_frame(event) ; + nframes64_t start = 0 ; + nframes64_t end = 0 ; + nframes64_t pointer_frame = event_frame(event) ; // chekc th eposition of the item is not locked if(!ifv->get_position_locked()) { @@ -693,7 +693,7 @@ Editor::imageframe_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* } // are we getting bigger or smaller? - nframes_t new_dur_val = end - start ; + nframes64_t new_dur_val = end - start ; // start handle, so a smaller pointer frame increases our component size if(pointer_frame <= drag_info.grab_frame) @@ -751,10 +751,10 @@ Editor::imageframe_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* eve } else { - nframes_t temp = ifv->get_position() + ifv->get_duration() ; + nframes64_t temp = ifv->get_position() + ifv->get_duration() ; - ifv->set_position((nframes_t) (temp - drag_info.cumulative_x_drag), this) ; - ifv->set_duration((nframes_t) drag_info.cumulative_x_drag, this) ; + ifv->set_position((nframes64_t) (temp - drag_info.cumulative_x_drag), this) ; + ifv->set_duration((nframes64_t) drag_info.cumulative_x_drag, this) ; } } @@ -763,10 +763,10 @@ Editor::imageframe_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* ev { ImageFrameView* ifv = reinterpret_cast (drag_info.data) ; - nframes_t start = 0 ; - nframes_t end = 0 ; - nframes_t pointer_frame = event_frame(event) ; - nframes_t new_dur_val = 0 ; + nframes64_t start = 0 ; + nframes64_t end = 0 ; + nframes64_t pointer_frame = event_frame(event) ; + nframes64_t new_dur_val = 0 ; snap_to(pointer_frame) ; @@ -828,7 +828,7 @@ Editor::imageframe_end_handle_end_trim (ArdourCanvas::Item* item, GdkEvent* even } else { - nframes_t new_duration = (nframes_t)drag_info.cumulative_x_drag ; + nframes64_t new_duration = (nframes64_t)drag_info.cumulative_x_drag ; if((new_duration <= ifv->get_max_duration()) && (new_duration >= ifv->get_min_duration())) { ifv->set_duration(new_duration, this) ; @@ -888,9 +888,9 @@ Editor::markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* { MarkerView* mv = reinterpret_cast (drag_info.data) ; - nframes_t start = 0 ; - nframes_t end = 0 ; - nframes_t pointer_frame = event_frame(event) ; + nframes64_t start = 0 ; + nframes64_t end = 0 ; + nframes64_t pointer_frame = event_frame(event) ; // chekc th eposition of the item is not locked if(!mv->get_position_locked()) @@ -911,7 +911,7 @@ Editor::markerview_start_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* } // are we getting bigger or smaller? - nframes_t new_dur_val = end - start ; + nframes64_t new_dur_val = end - start ; if(pointer_frame <= drag_info.grab_frame) { @@ -968,10 +968,10 @@ Editor::markerview_start_handle_end_trim(ArdourCanvas::Item* item, GdkEvent* eve } else { - nframes_t temp = mv->get_position() + mv->get_duration() ; + nframes64_t temp = mv->get_position() + mv->get_duration() ; - mv->set_position((nframes_t) (temp - drag_info.cumulative_x_drag), this) ; - mv->set_duration((nframes_t) drag_info.cumulative_x_drag, this) ; + mv->set_position((nframes64_t) (temp - drag_info.cumulative_x_drag), this) ; + mv->set_duration((nframes64_t) drag_info.cumulative_x_drag, this) ; } } @@ -980,10 +980,10 @@ Editor::markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* ev { MarkerView* mv = reinterpret_cast (drag_info.data) ; - nframes_t start = 0 ; - nframes_t end = 0 ; - nframes_t pointer_frame = event_frame(event) ; - nframes_t new_dur_val = 0 ; + nframes64_t start = 0 ; + nframes64_t end = 0 ; + nframes64_t pointer_frame = event_frame(event) ; + nframes64_t new_dur_val = 0 ; snap_to(pointer_frame) ; @@ -1008,7 +1008,7 @@ Editor::markerview_end_handle_trim_motion(ArdourCanvas::Item* item, GdkEvent* ev { // we cant extend beyond the item we are marking ImageFrameView* marked_item = mv->get_marked_item() ; - nframes_t marked_end = marked_item->get_position() + marked_item->get_duration() ; + nframes64_t marked_end = marked_item->get_position() + marked_item->get_duration() ; if(mv->get_max_duration_active() && (new_dur_val > mv->get_max_duration())) { @@ -1062,7 +1062,7 @@ Editor::markerview_end_handle_end_trim (ArdourCanvas::Item* item, GdkEvent* even } else { - nframes_t new_duration = (nframes_t)drag_info.cumulative_x_drag ; + nframes64_t new_duration = (nframes64_t)drag_info.cumulative_x_drag ; mv->set_duration(new_duration, this) ; } } diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index daad9383e5..b905e3a6a9 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -375,8 +375,8 @@ Editor::LocationMarkers::set_name (const string& str) } void -Editor::LocationMarkers::set_position (nframes_t startf, - nframes_t endf) +Editor::LocationMarkers::set_position (nframes64_t startf, + nframes64_t endf) { start->set_position (startf); if (end) { end->set_position (endf); } @@ -390,7 +390,7 @@ Editor::LocationMarkers::set_color_rgba (uint32_t rgba) } void -Editor::mouse_add_new_marker (nframes_t where, bool is_cd, bool is_xrun) +Editor::mouse_add_new_marker (nframes64_t where, bool is_cd, bool is_xrun) { string markername, markerprefix; int flags = (is_cd ? Location::IsCDMarker|Location::IsMark : Location::IsMark); diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index 715b9c467f..651360d1fd 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -173,7 +173,7 @@ Editor::update_current_screen () { if (session && session->engine().running()) { - nframes_t frame; + nframes64_t frame; frame = session->audible_frame(); @@ -235,11 +235,7 @@ Editor::update_current_screen () } else { if (frame != last_update_frame) { - if (frame < leftmost_frame || frame > leftmost_frame + current_page_frames()) { - playhead_cursor->canvas_item.hide(); - } else { - playhead_cursor->set_position (frame); - } + playhead_cursor->set_position (frame); } } diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 721dfb1e94..36029a4213 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -863,7 +863,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp bool Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type) { - nframes_t where = event_frame (event, 0, 0); + nframes64_t where = event_frame (event, 0, 0); AutomationTimeAxisView* atv = 0; /* no action if we're recording */ @@ -1939,15 +1939,15 @@ Editor::start_fade_in_grab (ArdourCanvas::Item* item, GdkEvent* event) AudioRegionView* arv = static_cast(drag_info.data); - drag_info.pointer_frame_offset = drag_info.grab_frame - ((nframes_t) arv->audio_region()->fade_in().back()->when + arv->region()->position()); + drag_info.pointer_frame_offset = drag_info.grab_frame - ((nframes64_t) arv->audio_region()->fade_in().back()->when + arv->region()->position()); } void Editor::fade_in_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) { AudioRegionView* arv = static_cast(drag_info.data); - nframes_t pos; - nframes_t fade_length; + nframes64_t pos; + nframes64_t fade_length; if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) { pos = drag_info.current_pointer_frame - drag_info.pointer_frame_offset; @@ -1989,8 +1989,8 @@ void Editor::fade_in_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event) { AudioRegionView* arv = static_cast(drag_info.data); - nframes_t pos; - nframes_t fade_length; + nframes64_t pos; + nframes64_t fade_length; if (drag_info.first_move) return; @@ -2047,15 +2047,15 @@ Editor::start_fade_out_grab (ArdourCanvas::Item* item, GdkEvent* event) AudioRegionView* arv = static_cast(drag_info.data); - drag_info.pointer_frame_offset = drag_info.grab_frame - (arv->region()->length() - (nframes_t) arv->audio_region()->fade_out().back()->when + arv->region()->position()); + drag_info.pointer_frame_offset = drag_info.grab_frame - (arv->region()->length() - (nframes64_t) arv->audio_region()->fade_out().back()->when + arv->region()->position()); } void Editor::fade_out_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) { AudioRegionView* arv = static_cast(drag_info.data); - nframes_t pos; - nframes_t fade_length; + nframes64_t pos; + nframes64_t fade_length; if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) { pos = drag_info.current_pointer_frame - drag_info.pointer_frame_offset; @@ -2101,8 +2101,8 @@ Editor::fade_out_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* eve if (drag_info.first_move) return; AudioRegionView* arv = static_cast(drag_info.data); - nframes_t pos; - nframes_t fade_length; + nframes64_t pos; + nframes64_t fade_length; if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) { pos = drag_info.current_pointer_frame - drag_info.pointer_frame_offset; @@ -2185,7 +2185,7 @@ void Editor::cursor_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) { Cursor* cursor = (Cursor *) drag_info.data; - nframes_t adjusted_frame; + nframes64_t adjusted_frame; if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) { adjusted_frame = drag_info.current_pointer_frame - drag_info.pointer_frame_offset; @@ -2308,21 +2308,21 @@ Editor::start_marker_grab (ArdourCanvas::Item* item, GdkEvent* event) void Editor::marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) { - nframes_t f_delta; + nframes64_t f_delta; Marker* marker = (Marker *) drag_info.data; Location *real_location; Location *copy_location; bool is_start; bool move_both = false; - nframes_t newframe; + nframes64_t newframe; if (drag_info.pointer_frame_offset <= drag_info.current_pointer_frame) { newframe = drag_info.current_pointer_frame - drag_info.pointer_frame_offset; } else { newframe = 0; } - nframes_t next = newframe; + nframes64_t next = newframe; if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) { snap_to (newframe, 0, true); @@ -2508,7 +2508,7 @@ void Editor::meter_marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) { MeterMarker* marker = (MeterMarker *) drag_info.data; - nframes_t adjusted_frame; + nframes64_t adjusted_frame; if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) { adjusted_frame = drag_info.current_pointer_frame - drag_info.pointer_frame_offset; @@ -2640,7 +2640,7 @@ void Editor::tempo_marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) { TempoMarker* marker = (TempoMarker *) drag_info.data; - nframes_t adjusted_frame; + nframes64_t adjusted_frame; if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) { adjusted_frame = drag_info.current_pointer_frame - drag_info.pointer_frame_offset; @@ -2812,7 +2812,7 @@ Editor::control_point_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* cy = min ((double) cp->line.height(), cy); //translate cx to frames - nframes_t cx_frames = unit_to_frame (cx); + nframes64_t cx_frames = unit_to_frame (cx); if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier()) && !drag_info.x_constrained) { snap_to (cx_frames); @@ -2885,7 +2885,7 @@ Editor::start_line_grab (AutomationLine* line, GdkEvent* event) { double cx; double cy; - nframes_t frame_within_region; + nframes64_t frame_within_region; /* need to get x coordinate in terms of parent (TimeAxisItemView) origin. @@ -2894,7 +2894,7 @@ Editor::start_line_grab (AutomationLine* line, GdkEvent* event) cx = event->button.x; cy = event->button.y; line->parent_group().w2i (cx, cy); - frame_within_region = (nframes_t) floor (cx * frames_per_unit); + frame_within_region = (nframes64_t) floor (cx * frames_per_unit); if (!line->control_points_adjacent (frame_within_region, current_line_drag_info.before, current_line_drag_info.after)) { @@ -3004,7 +3004,7 @@ Editor::start_region_grab (ArdourCanvas::Item* item, GdkEvent* event) speed = tv->get_diskstream()->speed(); } - drag_info.last_frame_position = (nframes_t) (clicked_regionview->region()->position() / speed); + drag_info.last_frame_position = (nframes64_t) (clicked_regionview->region()->position() / speed); drag_info.pointer_frame_offset = drag_info.grab_frame - drag_info.last_frame_position; drag_info.source_trackview = &clicked_regionview->get_time_axis_view(); drag_info.dest_trackview = drag_info.source_trackview; @@ -3039,7 +3039,7 @@ Editor::start_region_copy_grab (ArdourCanvas::Item* item, GdkEvent* event) drag_info.source_trackview = &clicked_regionview->get_time_axis_view(); drag_info.dest_trackview = drag_info.source_trackview; - drag_info.last_frame_position = (nframes_t) (clicked_regionview->region()->position() / speed); + drag_info.last_frame_position = (nframes64_t) (clicked_regionview->region()->position() / speed); drag_info.pointer_frame_offset = drag_info.grab_frame - drag_info.last_frame_position; // we want a move threshold drag_info.want_move_threshold = true; @@ -3071,7 +3071,7 @@ Editor::start_region_brush_grab (ArdourCanvas::Item* item, GdkEvent* event) speed = tv->get_diskstream()->speed(); } - drag_info.last_frame_position = (nframes_t) (clicked_regionview->region()->position() / speed); + drag_info.last_frame_position = (nframes64_t) (clicked_regionview->region()->position() / speed); drag_info.pointer_frame_offset = drag_info.grab_frame - drag_info.last_frame_position; drag_info.source_trackview = &clicked_regionview->get_time_axis_view(); drag_info.dest_trackview = drag_info.source_trackview; @@ -3239,7 +3239,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) double x_delta; double y_delta = 0; RegionView* rv = reinterpret_cast (drag_info.data); - nframes_t pending_region_position = 0; + nframes64_t pending_region_position = 0; int32_t pointer_y_span = 0, canvas_pointer_y_span = 0, original_pointer_order; int32_t visible_y_high = 0, visible_y_low = 512; //high meaning higher numbered.. not the height on the screen bool clamp_y_axis = false; @@ -3426,8 +3426,8 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) { - nframes_t sync_frame; - nframes_t sync_offset; + nframes64_t sync_frame; + nframes64_t sync_offset; int32_t sync_dir; pending_region_position = drag_info.current_pointer_frame - drag_info.pointer_frame_offset; @@ -3766,7 +3766,7 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event double speed; bool changed_tracks; bool changed_position; - nframes_t where; + nframes64_t where; if (rv->region()->locked()) { ++i; @@ -3781,11 +3781,11 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event speed = dest_atv->get_diskstream()->speed(); } - changed_position = (drag_info.last_frame_position != (nframes_t) (rv->region()->position()/speed)); + changed_position = (drag_info.last_frame_position != (nframes64_t) (rv->region()->position()/speed)); changed_tracks = (dest_tv != &rv->get_time_axis_view()); if (changed_position && !drag_info.x_constrained) { - where = (nframes_t) (unit_to_frame (ix1) * speed); + where = (nframes64_t) (unit_to_frame (ix1) * speed); } else { where = rv->region()->position(); } @@ -3954,28 +3954,28 @@ Editor::region_view_item_click (AudioRegionView& rv, GdkEventButton* event) if (Keyboard::modifier_state_equals (event->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) { - align_region (rv.region(), SyncPoint, (nframes_t) (where * speed)); + align_region (rv.region(), SyncPoint, (nframes64_t) (where * speed)); } else if (Keyboard::modifier_state_equals (event->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) { - align_region (rv.region(), End, (nframes_t) (where * speed)); + align_region (rv.region(), End, (nframes64_t) (where * speed)); } else { - align_region (rv.region(), Start, (nframes_t) (where * speed)); + align_region (rv.region(), Start, (nframes64_t) (where * speed)); } } } } void -Editor::show_verbose_time_cursor (nframes_t frame, double offset, double xpos, double ypos) +Editor::show_verbose_time_cursor (nframes64_t frame, double offset, double xpos, double ypos) { char buf[128]; SMPTE::Time smpte; BBT_Time bbt; int hours, mins; - nframes_t frame_rate; + nframes64_t frame_rate; float secs; if (session == 0) { @@ -4013,7 +4013,7 @@ Editor::show_verbose_time_cursor (nframes_t frame, double offset, double xpos, d break; default: - snprintf (buf, sizeof(buf), "%u", frame); + snprintf (buf, sizeof(buf), "%" PRIi64, frame); break; } @@ -4027,14 +4027,14 @@ Editor::show_verbose_time_cursor (nframes_t frame, double offset, double xpos, d } void -Editor::show_verbose_duration_cursor (nframes_t start, nframes_t end, double offset, double xpos, double ypos) +Editor::show_verbose_duration_cursor (nframes64_t start, nframes64_t end, double offset, double xpos, double ypos) { char buf[128]; SMPTE::Time smpte; BBT_Time sbbt; BBT_Time ebbt; int hours, mins; - nframes_t distance, frame_rate; + nframes64_t distance, frame_rate; float secs; Meter meter_at_start(session->tempo_map().meter_at(start)); @@ -4095,7 +4095,7 @@ Editor::show_verbose_duration_cursor (nframes_t start, nframes_t end, double off break; default: - snprintf (buf, sizeof(buf), "%u", end - start); + snprintf (buf, sizeof(buf), "%" PRIi64, end - start); break; } @@ -4200,8 +4200,8 @@ Editor::cancel_selection () void Editor::start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, SelectionOp op) { - nframes_t start = 0; - nframes_t end = 0; + nframes64_t start = 0; + nframes64_t end = 0; if (session == 0) { return; @@ -4258,10 +4258,10 @@ Editor::start_selection_op (ArdourCanvas::Item* item, GdkEvent* event, Selection void Editor::drag_selection (ArdourCanvas::Item* item, GdkEvent* event) { - nframes_t start = 0; - nframes_t end = 0; - nframes_t length; - nframes_t pending_position; + nframes64_t start = 0; + nframes64_t end = 0; + nframes64_t length; + nframes64_t pending_position; if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) { pending_position = drag_info.current_pointer_frame - drag_info.pointer_frame_offset; @@ -4419,9 +4419,9 @@ Editor::start_trim (ArdourCanvas::Item* item, GdkEvent* event) speed = tv->get_diskstream()->speed(); } - nframes_t region_start = (nframes_t) (clicked_regionview->region()->position() / speed); - nframes_t region_end = (nframes_t) (clicked_regionview->region()->last_frame() / speed); - nframes_t region_length = (nframes_t) (clicked_regionview->region()->length() / speed); + nframes64_t region_start = (nframes64_t) (clicked_regionview->region()->position() / speed); + nframes64_t region_end = (nframes64_t) (clicked_regionview->region()->last_frame() / speed); + nframes64_t region_length = (nframes64_t) (clicked_regionview->region()->length() / speed); //drag_info.item = clicked_regionview->get_name_highlight(); drag_info.item = item; @@ -4460,7 +4460,7 @@ void Editor::trim_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) { RegionView* rv = clicked_regionview; - nframes_t frame_delta = 0; + nframes64_t frame_delta = 0; bool left_direction; bool obey_snap = !Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier()); @@ -4544,7 +4544,7 @@ Editor::trim_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) } case EndTrim: - if ((left_direction == true) && (drag_info.current_pointer_frame > (nframes_t) (rv->region()->last_frame()/speed))) { + if ((left_direction == true) && (drag_info.current_pointer_frame > (nframes64_t) (rv->region()->last_frame()/speed))) { break; } else { for (list::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) { @@ -4572,10 +4572,10 @@ Editor::trim_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) switch (trim_op) { case StartTrim: - show_verbose_time_cursor((nframes_t) (rv->region()->position()/speed), 10); + show_verbose_time_cursor((nframes64_t) (rv->region()->position()/speed), 10); break; case EndTrim: - show_verbose_time_cursor((nframes_t) (rv->region()->last_frame()/speed), 10); + show_verbose_time_cursor((nframes64_t) (rv->region()->last_frame()/speed), 10); break; case ContentsTrim: show_verbose_time_cursor(drag_info.current_pointer_frame, 10); @@ -4587,7 +4587,7 @@ Editor::trim_motion_callback (ArdourCanvas::Item* item, GdkEvent* event) } void -Editor::single_contents_trim (RegionView& rv, nframes_t frame_delta, bool left_direction, bool swap_direction, bool obey_snap) +Editor::single_contents_trim (RegionView& rv, nframes64_t frame_delta, bool left_direction, bool swap_direction, bool obey_snap) { boost::shared_ptr region (rv.region()); @@ -4595,7 +4595,7 @@ Editor::single_contents_trim (RegionView& rv, nframes_t frame_delta, bool left_d return; } - nframes_t new_bound; + nframes64_t new_bound; double speed = 1.0; TimeAxisView* tvp = clicked_trackview; @@ -4607,27 +4607,27 @@ Editor::single_contents_trim (RegionView& rv, nframes_t frame_delta, bool left_d if (left_direction) { if (swap_direction) { - new_bound = (nframes_t) (region->position()/speed) + frame_delta; + new_bound = (nframes64_t) (region->position()/speed) + frame_delta; } else { - new_bound = (nframes_t) (region->position()/speed) - frame_delta; + new_bound = (nframes64_t) (region->position()/speed) - frame_delta; } } else { if (swap_direction) { - new_bound = (nframes_t) (region->position()/speed) - frame_delta; + new_bound = (nframes64_t) (region->position()/speed) - frame_delta; } else { - new_bound = (nframes_t) (region->position()/speed) + frame_delta; + new_bound = (nframes64_t) (region->position()/speed) + frame_delta; } } if (obey_snap) { snap_to (new_bound); } - region->trim_start ((nframes_t) (new_bound * speed), this); + region->trim_start ((nframes64_t) (new_bound * speed), this); rv.region_changed (StartChanged); } void -Editor::single_start_trim (RegionView& rv, nframes_t frame_delta, bool left_direction, bool obey_snap) +Editor::single_start_trim (RegionView& rv, nframes64_t frame_delta, bool left_direction, bool obey_snap) { boost::shared_ptr region (rv.region()); @@ -4635,7 +4635,7 @@ Editor::single_start_trim (RegionView& rv, nframes_t frame_delta, bool left_dire return; } - nframes_t new_bound; + nframes64_t new_bound; double speed = 1.0; TimeAxisView* tvp = clicked_trackview; @@ -4646,22 +4646,22 @@ Editor::single_start_trim (RegionView& rv, nframes_t frame_delta, bool left_dire } if (left_direction) { - new_bound = (nframes_t) (region->position()/speed) - frame_delta; + new_bound = (nframes64_t) (region->position()/speed) - frame_delta; } else { - new_bound = (nframes_t) (region->position()/speed) + frame_delta; + new_bound = (nframes64_t) (region->position()/speed) + frame_delta; } if (obey_snap) { snap_to (new_bound, (left_direction ? 0 : 1)); } - region->trim_front ((nframes_t) (new_bound * speed), this); + region->trim_front ((nframes64_t) (new_bound * speed), this); rv.region_changed (Change (LengthChanged|PositionChanged|StartChanged)); } void -Editor::single_end_trim (RegionView& rv, nframes_t frame_delta, bool left_direction, bool obey_snap) +Editor::single_end_trim (RegionView& rv, nframes64_t frame_delta, bool left_direction, bool obey_snap) { boost::shared_ptr region (rv.region()); @@ -4669,7 +4669,7 @@ Editor::single_end_trim (RegionView& rv, nframes_t frame_delta, bool left_direct return; } - nframes_t new_bound; + nframes64_t new_bound; double speed = 1.0; TimeAxisView* tvp = clicked_trackview; @@ -4680,15 +4680,15 @@ Editor::single_end_trim (RegionView& rv, nframes_t frame_delta, bool left_direct } if (left_direction) { - new_bound = (nframes_t) ((region->last_frame() + 1)/speed) - frame_delta; + new_bound = (nframes64_t) ((region->last_frame() + 1)/speed) - frame_delta; } else { - new_bound = (nframes_t) ((region->last_frame() + 1)/speed) + frame_delta; + new_bound = (nframes64_t) ((region->last_frame() + 1)/speed) + frame_delta; } if (obey_snap) { snap_to (new_bound); } - region->trim_end ((nframes_t) (new_bound * speed), this); + region->trim_end ((nframes64_t) (new_bound * speed), this); rv.region_changed (LengthChanged); } @@ -4728,7 +4728,7 @@ void Editor::point_trim (GdkEvent* event) { RegionView* rv = clicked_regionview; - nframes_t new_bound = drag_info.current_pointer_frame; + nframes64_t new_bound = drag_info.current_pointer_frame; if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) { snap_to (new_bound); @@ -4876,8 +4876,8 @@ Editor::start_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event, Ran void Editor::drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event) { - nframes_t start = 0; - nframes_t end = 0; + nframes64_t start = 0; + nframes64_t end = 0; ArdourCanvas::SimpleRect *crect; switch (range_marker_op) { @@ -5008,8 +5008,8 @@ Editor::end_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event) if (Keyboard::no_modifier_keys_pressed (&event->button) && range_marker_op != CreateCDMarker) { - nframes_t start; - nframes_t end; + nframes64_t start; + nframes64_t end; start = session->locations()->first_mark_before (drag_info.grab_frame); end = session->locations()->first_mark_after (drag_info.grab_frame); @@ -5059,8 +5059,8 @@ Editor::start_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event) void Editor::drag_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event) { - nframes_t start; - nframes_t end; + nframes64_t start; + nframes64_t end; if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) { snap_to (drag_info.current_pointer_frame); @@ -5120,7 +5120,7 @@ Editor::end_mouse_zoom (ArdourCanvas::Item* item, GdkEvent* event) } void -Editor::reposition_zoom_rect (nframes_t start, nframes_t end) +Editor::reposition_zoom_rect (nframes64_t start, nframes64_t end) { double x1 = frame_to_pixel (start); double x2 = frame_to_pixel (end); @@ -5147,8 +5147,8 @@ Editor::start_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event) void Editor::drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event) { - nframes_t start; - nframes_t end; + nframes64_t start; + nframes64_t end; double y1; double y2; @@ -5321,7 +5321,7 @@ Editor::end_time_fx (ArdourCanvas::Item* item, GdkEvent* event) return; } - nframes_t newlen = drag_info.last_pointer_frame - clicked_regionview->region()->position(); + nframes64_t newlen = drag_info.last_pointer_frame - clicked_regionview->region()->position(); #ifdef USE_RUBBERBAND float percentage = (float) ((double) newlen / (double) clicked_regionview->region()->length()); #else @@ -5341,7 +5341,7 @@ Editor::end_time_fx (ArdourCanvas::Item* item, GdkEvent* event) } void -Editor::mouse_brush_insert_region (RegionView* rv, nframes_t pos) +Editor::mouse_brush_insert_region (RegionView* rv, nframes64_t pos) { /* no brushing without a useful snap setting */ @@ -5380,7 +5380,7 @@ Editor::mouse_brush_insert_region (RegionView* rv, nframes_t pos) double speed = atv->get_diskstream()->speed(); XMLNode &before = playlist->get_state(); - playlist->add_region (boost::dynamic_pointer_cast (RegionFactory::create (arv->audio_region())), (nframes_t) (pos * speed)); + playlist->add_region (boost::dynamic_pointer_cast (RegionFactory::create (arv->audio_region())), (nframes64_t) (pos * speed)); XMLNode &after = playlist->get_state(); session->add_command(new MementoCommand(*playlist.get(), &before, &after)); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 084859dc83..85fa1caa19 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -108,7 +108,7 @@ Editor::split_region () } void -Editor::split_region_at (nframes_t where) +Editor::split_region_at (nframes64_t where) { RegionSelection rs; @@ -117,7 +117,7 @@ Editor::split_region_at (nframes_t where) } void -Editor::split_regions_at (nframes_t where, RegionSelection& regions) +Editor::split_regions_at (nframes64_t where, RegionSelection& regions) { if (regions.empty()) { return; @@ -245,7 +245,7 @@ Editor::select_region_for_operation (int dir, TimeAxisView **tv) { RegionView* rv; boost::shared_ptr region; - nframes_t start = 0; + nframes64_t start = 0; if (selection->time.start () == selection->time.end_frame ()) { @@ -288,7 +288,7 @@ Editor::extend_selection_to_end_of_region (bool next) { TimeAxisView *tv; boost::shared_ptr region; - nframes_t start; + nframes64_t start; if ((region = select_region_for_operation (next ? 1 : 0, &tv)) == 0) { return; @@ -316,7 +316,7 @@ Editor::extend_selection_to_start_of_region (bool previous) { TimeAxisView *tv; boost::shared_ptr region; - nframes_t end; + nframes64_t end; if ((region = select_region_for_operation (previous ? -1 : 0, &tv)) == 0) { return; @@ -365,8 +365,8 @@ Editor::nudge_backward_release (GdkEventButton* ev) void Editor::nudge_forward (bool next, bool force_playhead) { - nframes_t distance; - nframes_t next_distance; + nframes64_t distance; + nframes64_t next_distance; RegionSelection rs; get_regions_for_action (rs); @@ -441,8 +441,8 @@ Editor::nudge_forward (bool next, bool force_playhead) void Editor::nudge_backward (bool next, bool force_playhead) { - nframes_t distance; - nframes_t next_distance; + nframes64_t distance; + nframes64_t next_distance; RegionSelection rs; get_regions_for_action (rs); @@ -528,7 +528,7 @@ Editor::nudge_backward (bool next, bool force_playhead) void Editor::nudge_forward_capture_offset () { - nframes_t distance; + nframes64_t distance; RegionSelection rs; get_regions_for_action (rs); @@ -558,7 +558,7 @@ Editor::nudge_forward_capture_offset () void Editor::nudge_backward_capture_offset () { - nframes_t distance; + nframes64_t distance; RegionSelection rs; get_regions_for_action (rs); @@ -607,7 +607,7 @@ Editor::move_to_end () void Editor::build_region_boundary_cache () { - nframes_t pos = 0; + nframes64_t pos = 0; vector interesting_points; boost::shared_ptr r; TrackViewList tracks; @@ -650,8 +650,8 @@ Editor::build_region_boundary_cache () while (pos < session->current_end_frame() && !at_end) { - nframes_t rpos; - nframes_t lpos = max_frames; + nframes64_t rpos; + nframes64_t lpos = max_frames; for (vector::iterator p = interesting_points.begin(); p != interesting_points.end(); ++p) { @@ -699,7 +699,7 @@ Editor::build_region_boundary_cache () to sort later. */ - vector::iterator ri; + vector::iterator ri; for (ri = region_boundary_cache.begin(); ri != region_boundary_cache.end(); ++ri) { if (*ri == rpos) { @@ -721,20 +721,20 @@ Editor::build_region_boundary_cache () } boost::shared_ptr -Editor::find_next_region (nframes_t frame, RegionPoint point, int32_t dir, TrackViewList& tracks, TimeAxisView **ontrack) +Editor::find_next_region (nframes64_t frame, RegionPoint point, int32_t dir, TrackViewList& tracks, TimeAxisView **ontrack) { TrackViewList::iterator i; - nframes_t closest = max_frames; + nframes64_t closest = max_frames; boost::shared_ptr ret; - nframes_t rpos = 0; + nframes64_t rpos = 0; float track_speed; - nframes_t track_frame; + nframes64_t track_frame; AudioTimeAxisView *atav; for (i = tracks.begin(); i != tracks.end(); ++i) { - nframes_t distance; + nframes64_t distance; boost::shared_ptr r; track_speed = 1.0f; @@ -866,7 +866,7 @@ void Editor::cursor_to_region_point (Cursor* cursor, RegionPoint point, int32_t dir) { boost::shared_ptr r; - nframes_t pos = cursor->current_frame; + nframes64_t pos = cursor->current_frame; if (!session) { return; @@ -945,7 +945,7 @@ Editor::cursor_to_previous_region_point (Cursor* cursor, RegionPoint point) void Editor::cursor_to_selection_start (Cursor *cursor) { - nframes_t pos = 0; + nframes64_t pos = 0; RegionSelection rs; get_regions_for_action (rs); @@ -977,7 +977,7 @@ Editor::cursor_to_selection_start (Cursor *cursor) void Editor::cursor_to_selection_end (Cursor *cursor) { - nframes_t pos = 0; + nframes64_t pos = 0; RegionSelection rs; get_regions_for_action (rs); @@ -1071,7 +1071,7 @@ void Editor::selected_marker_to_region_point (RegionPoint point, int32_t dir) { boost::shared_ptr r; - nframes_t pos; + nframes64_t pos; Location* loc; bool ignored; @@ -1154,7 +1154,7 @@ Editor::selected_marker_to_previous_region_point (RegionPoint point) void Editor::selected_marker_to_selection_start () { - nframes_t pos = 0; + nframes64_t pos = 0; Location* loc; bool ignored; @@ -1193,7 +1193,7 @@ Editor::selected_marker_to_selection_start () void Editor::selected_marker_to_selection_end () { - nframes_t pos = 0; + nframes64_t pos = 0; Location* loc; bool ignored; @@ -1232,8 +1232,8 @@ Editor::selected_marker_to_selection_end () void Editor::scroll_playhead (bool forward) { - nframes_t pos = playhead_cursor->current_frame; - nframes_t delta = (nframes_t) floor (current_page_frames() / 0.8); + nframes64_t pos = playhead_cursor->current_frame; + nframes64_t delta = (nframes64_t) floor (current_page_frames() / 0.8); if (forward) { if (pos == max_frames) { @@ -1265,8 +1265,8 @@ Editor::scroll_playhead (bool forward) void Editor::playhead_backward () { - nframes_t pos; - nframes_t cnt; + nframes64_t pos; + nframes64_t cnt; float prefix; bool was_floating; @@ -1274,15 +1274,15 @@ Editor::playhead_backward () cnt = 1; } else { if (was_floating) { - cnt = (nframes_t) floor (prefix * session->frame_rate ()); + cnt = (nframes64_t) floor (prefix * session->frame_rate ()); } else { - cnt = (nframes_t) prefix; + cnt = (nframes64_t) prefix; } } pos = playhead_cursor->current_frame; - if ((nframes_t) pos < cnt) { + if ((nframes64_t) pos < cnt) { pos = 0; } else { pos -= cnt; @@ -1299,8 +1299,8 @@ Editor::playhead_backward () void Editor::playhead_forward () { - nframes_t pos; - nframes_t cnt; + nframes64_t pos; + nframes64_t cnt; bool was_floating; float prefix; @@ -1308,9 +1308,9 @@ Editor::playhead_forward () cnt = 1; } else { if (was_floating) { - cnt = (nframes_t) floor (prefix * session->frame_rate ()); + cnt = (nframes64_t) floor (prefix * session->frame_rate ()); } else { - cnt = (nframes_t) floor (prefix); + cnt = (nframes64_t) floor (prefix); } } @@ -1370,9 +1370,9 @@ Editor::edit_cursor_backward () cnt = 1; } else { if (was_floating) { - cnt = (nframes_t) floor (prefix * session->frame_rate ()); + cnt = (nframes64_t) floor (prefix * session->frame_rate ()); } else { - cnt = (nframes_t) prefix; + cnt = (nframes64_t) prefix; } } @@ -1392,8 +1392,8 @@ Editor::edit_cursor_backward () void Editor::edit_cursor_forward () { - //nframes_t pos; - nframes_t cnt; + //nframes64_t pos; + nframes64_t cnt; bool was_floating; float prefix; @@ -1401,9 +1401,9 @@ Editor::edit_cursor_forward () cnt = 1; } else { if (was_floating) { - cnt = (nframes_t) floor (prefix * session->frame_rate ()); + cnt = (nframes64_t) floor (prefix * session->frame_rate ()); } else { - cnt = (nframes_t) floor (prefix); + cnt = (nframes64_t) floor (prefix); } } @@ -1416,16 +1416,16 @@ Editor::goto_frame () { float prefix; bool was_floating; - nframes_t frame; + nframes64_t frame; if (get_prefix (prefix, was_floating)) { return; } if (was_floating) { - frame = (nframes_t) floor (prefix * session->frame_rate()); + frame = (nframes64_t) floor (prefix * session->frame_rate()); } else { - frame = (nframes_t) floor (prefix); + frame = (nframes64_t) floor (prefix); } session->request_locate (frame); @@ -1434,19 +1434,19 @@ Editor::goto_frame () void Editor::scroll_backward (float pages) { - nframes_t frame; - nframes_t one_page = (nframes_t) rint (canvas_width * frames_per_unit); + nframes64_t frame; + nframes64_t one_page = (nframes64_t) rint (canvas_width * frames_per_unit); bool was_floating; float prefix; - nframes_t cnt; + nframes64_t cnt; if (get_prefix (prefix, was_floating)) { - cnt = (nframes_t) floor (pages * one_page); + cnt = (nframes64_t) floor (pages * one_page); } else { if (was_floating) { - cnt = (nframes_t) floor (prefix * session->frame_rate()); + cnt = (nframes64_t) floor (prefix * session->frame_rate()); } else { - cnt = (nframes_t) floor (prefix * one_page); + cnt = (nframes64_t) floor (prefix * one_page); } } @@ -1462,19 +1462,19 @@ Editor::scroll_backward (float pages) void Editor::scroll_forward (float pages) { - nframes_t frame; - nframes_t one_page = (nframes_t) rint (canvas_width * frames_per_unit); + nframes64_t frame; + nframes64_t one_page = (nframes64_t) rint (canvas_width * frames_per_unit); bool was_floating; float prefix; - nframes_t cnt; + nframes64_t cnt; if (get_prefix (prefix, was_floating)) { - cnt = (nframes_t) floor (pages * one_page); + cnt = (nframes64_t) floor (pages * one_page); } else { if (was_floating) { - cnt = (nframes_t) floor (prefix * session->frame_rate()); + cnt = (nframes64_t) floor (prefix * session->frame_rate()); } else { - cnt = (nframes_t) floor (prefix * one_page); + cnt = (nframes64_t) floor (prefix * one_page); } } @@ -1589,7 +1589,7 @@ Editor::temporal_zoom (gdouble fpu) nfpu = fpu; - new_page_size = (nframes_t) floor (canvas_width * nfpu); + new_page_size = (nframes64_t) floor (canvas_width * nfpu); half_page_size = new_page_size / 2; switch (zoom_focus) { @@ -1736,9 +1736,9 @@ Editor::temporal_zoom_region (bool both_axes) return; } - nframes_t range = end - start; + nframes64_t range = end - start; double new_fpu = (double)range / (double)canvas_width; - nframes_t extra_samples = (nframes_t) floor (one_centimeter_in_pixels * new_fpu); + nframes64_t extra_samples = (nframes64_t) floor (one_centimeter_in_pixels * new_fpu); if (start > extra_samples) { start -= extra_samples; @@ -1811,8 +1811,8 @@ Editor::temporal_zoom_selection () return; } - nframes_t start = selection->time[clicked_selection].start; - nframes_t end = selection->time[clicked_selection].end; + nframes64_t start = selection->time[clicked_selection].start; + nframes64_t end = selection->time[clicked_selection].end; temporal_zoom_by_frame (start, end, "zoom to selection"); } @@ -1828,7 +1828,7 @@ Editor::temporal_zoom_session () } void -Editor::temporal_zoom_by_frame (nframes_t start, nframes_t end, const string & op) +Editor::temporal_zoom_by_frame (nframes64_t start, nframes64_t end, const string & op) { if (!session) return; @@ -1836,13 +1836,13 @@ Editor::temporal_zoom_by_frame (nframes_t start, nframes_t end, const string & o return; } - nframes_t range = end - start; + nframes64_t range = end - start; double new_fpu = (double)range / (double)canvas_width; - nframes_t new_page = (nframes_t) floor (canvas_width * new_fpu); - nframes_t middle = (nframes_t) floor( (double)start + ((double)range / 2.0f )); - nframes_t new_leftmost = (nframes_t) floor( (double)middle - ((double)new_page/2.0f)); + nframes64_t new_page = (nframes64_t) floor (canvas_width * new_fpu); + nframes64_t middle = (nframes64_t) floor( (double)start + ((double)range / 2.0f )); + nframes64_t new_leftmost = (nframes64_t) floor( (double)middle - ((double)new_page/2.0f)); if (new_leftmost > middle) { new_leftmost = 0; @@ -1852,7 +1852,7 @@ Editor::temporal_zoom_by_frame (nframes_t start, nframes_t end, const string & o } void -Editor::temporal_zoom_to_frame (bool coarser, nframes_t frame) +Editor::temporal_zoom_to_frame (bool coarser, nframes64_t frame) { if (!session) return; @@ -1871,7 +1871,7 @@ Editor::temporal_zoom_to_frame (bool coarser, nframes_t frame) if (new_fpu == frames_per_unit) return; - nframes_t new_leftmost = frame - (nframes_t)range_before; + nframes64_t new_leftmost = frame - (nframes64_t)range_before; if (new_leftmost > frame) new_leftmost = 0; @@ -1936,8 +1936,8 @@ Editor::add_location_from_selection () return; } - nframes_t start = selection->time[clicked_selection].start; - nframes_t end = selection->time[clicked_selection].end; + nframes64_t start = selection->time[clicked_selection].start; + nframes64_t end = selection->time[clicked_selection].end; session->locations()->next_available_name(rangename,"selection"); Location *location = new Location (start, end, rangename, Location::IsRangeMarker); @@ -2089,7 +2089,7 @@ Editor::jump_backward_to_mark () void Editor::set_mark () { - nframes_t pos; + nframes64_t pos; float prefix; bool was_floating; string markername; @@ -2098,9 +2098,9 @@ Editor::set_mark () pos = session->audible_frame (); } else { if (was_floating) { - pos = (nframes_t) floor (prefix * session->frame_rate ()); + pos = (nframes64_t) floor (prefix * session->frame_rate ()); } else { - pos = (nframes_t) floor (prefix); + pos = (nframes64_t) floor (prefix); } } @@ -2187,7 +2187,7 @@ Editor::insert_region_list_drag (boost::shared_ptr region, int x, i double wx, wy; double cx, cy; TimeAxisView *tv; - nframes_t where; + nframes64_t where; AudioTimeAxisView *atv = 0; boost::shared_ptr playlist; @@ -2640,17 +2640,17 @@ Editor::region_from_selection () return; } - nframes_t start = selection->time[clicked_selection].start; - nframes_t end = selection->time[clicked_selection].end; + nframes64_t start = selection->time[clicked_selection].start; + nframes64_t end = selection->time[clicked_selection].end; - nframes_t selection_cnt = end - start + 1; + nframes64_t selection_cnt = end - start + 1; for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) { boost::shared_ptr current; boost::shared_ptr current_r; boost::shared_ptr pl; - nframes_t internal_start; + nframes64_t internal_start; string new_name; if ((pl = (*i)->playlist()) == 0) { @@ -2678,8 +2678,8 @@ Editor::create_region_from_selection (vector >& n return; } - nframes_t start = selection->time[clicked_selection].start; - nframes_t end = selection->time[clicked_selection].end; + nframes64_t start = selection->time[clicked_selection].start; + nframes64_t end = selection->time[clicked_selection].end; sort_track_selection (); @@ -2688,7 +2688,7 @@ Editor::create_region_from_selection (vector >& n boost::shared_ptr current; boost::shared_ptr current_r; boost::shared_ptr playlist; - nframes_t internal_start; + nframes64_t internal_start; string new_name; if ((playlist = (*i)->playlist()) == 0) { @@ -2823,7 +2823,7 @@ Editor::separate_regions_between (const TimeSelection& ts) sigc::connection c = atv->view()->RegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view)); latest_regionviews.clear (); - playlist->partition ((nframes_t)((*t).start * speed), (nframes_t)((*t).end * speed), true); + playlist->partition ((nframes64_t)((*t).start * speed), (nframes64_t)((*t).end * speed), true); c.disconnect (); @@ -2940,7 +2940,7 @@ Editor::crop_region_to_selection () } void -Editor::crop_region_to (nframes_t start, nframes_t end) +Editor::crop_region_to (nframes64_t start, nframes64_t end) { vector > playlists; boost::shared_ptr playlist; @@ -2978,9 +2978,9 @@ Editor::crop_region_to (nframes_t start, nframes_t end) return; } - nframes_t the_start; - nframes_t the_end; - nframes_t cnt; + nframes64_t the_start; + nframes64_t the_end; + nframes64_t cnt; begin_reversible_command (_("trim to selection")); @@ -2998,7 +2998,7 @@ Editor::crop_region_to (nframes_t start, nframes_t end) if the selection extends beyond the region */ - the_start = max (the_start, region->position()); + the_start = max (the_start, (nframes64_t) region->position()); if (max_frames - the_start < region->length()) { the_end = the_start + region->length() - 1; } else { @@ -3019,7 +3019,7 @@ Editor::crop_region_to (nframes_t start, nframes_t end) void Editor::region_fill_track () { - nframes_t end; + nframes64_t end; RegionSelection rs; get_regions_for_action (rs); @@ -3082,8 +3082,8 @@ Editor::region_fill_selection () TreeModel::iterator i = region_list_display.get_selection()->get_selected(); boost::shared_ptr region = (*i)[region_list_columns.region]; - nframes_t start = selection->time[clicked_selection].start; - nframes_t end = selection->time[clicked_selection].end; + nframes64_t start = selection->time[clicked_selection].start; + nframes64_t end = selection->time[clicked_selection].end; boost::shared_ptr playlist; @@ -3091,7 +3091,7 @@ Editor::region_fill_selection () return; } - nframes_t selection_length = end - start; + nframes64_t selection_length = end - start; float times = (float)selection_length / region->length(); begin_reversible_command (_("fill selection")); @@ -3221,14 +3221,14 @@ struct RegionSortByTime { }; void -Editor::align_selection_relative (RegionPoint point, nframes_t position, const RegionSelection& rs) +Editor::align_selection_relative (RegionPoint point, nframes64_t position, const RegionSelection& rs) { if (rs.empty()) { return; } - nframes_t distance; - nframes_t pos = 0; + nframes64_t distance; + nframes64_t pos = 0; int dir; list sorted; @@ -3309,7 +3309,7 @@ Editor::align_selection_relative (RegionPoint point, nframes_t position, const R } void -Editor::align_selection (RegionPoint point, nframes_t position, const RegionSelection& rs) +Editor::align_selection (RegionPoint point, nframes64_t position, const RegionSelection& rs) { if (rs.empty()) { return; @@ -3325,7 +3325,7 @@ Editor::align_selection (RegionPoint point, nframes_t position, const RegionSele } void -Editor::align_region (boost::shared_ptr region, RegionPoint point, nframes_t position) +Editor::align_region (boost::shared_ptr region, RegionPoint point, nframes64_t position) { begin_reversible_command (_("align region")); align_region_internal (region, point, position); @@ -3333,7 +3333,7 @@ Editor::align_region (boost::shared_ptr region, RegionPoint point, nfram } void -Editor::align_region_internal (boost::shared_ptr region, RegionPoint point, nframes_t position) +Editor::align_region_internal (boost::shared_ptr region, RegionPoint point, nframes64_t position) { XMLNode &before = region->playlist()->get_state(); @@ -3409,8 +3409,8 @@ Editor::trim_region_to_location (const Location& loc, const char* str) } float speed = 1.0; - nframes_t start; - nframes_t end; + nframes64_t start; + nframes64_t end; if (atav->get_diskstream() != 0) { speed = atav->get_diskstream()->speed(); @@ -3608,9 +3608,9 @@ Editor::bounce_range_selection () TrackSelection views = selection->tracks; - nframes_t start = selection->time[clicked_selection].start; - nframes_t end = selection->time[clicked_selection].end; - nframes_t cnt = end - start + 1; + nframes64_t start = selection->time[clicked_selection].start; + nframes64_t end = selection->time[clicked_selection].end; + nframes64_t cnt = end - start + 1; begin_reversible_command (_("bounce range")); @@ -3813,7 +3813,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs) vector pmap; - nframes_t first_position = max_frames; + nframes64_t first_position = max_frames; set freezelist; pair::iterator,bool> insert_result; @@ -3824,7 +3824,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs) for (RegionSelection::iterator x = rs.begin(); x != rs.end(); ++x) { - first_position = min ((*x)->region()->position(), first_position); + first_position = min ((nframes64_t) (*x)->region()->position(), first_position); if (op == Cut || op == Clear) { boost::shared_ptr pl = boost::dynamic_pointer_cast((*x)->region()->playlist()); @@ -3980,7 +3980,7 @@ Editor::mouse_paste () } void -Editor::paste_internal (nframes_t position, float times) +Editor::paste_internal (nframes64_t position, float times) { bool commit = false; @@ -4199,9 +4199,9 @@ void Editor::nudge_track (bool use_edit, bool forwards) { boost::shared_ptr playlist; - nframes_t distance; - nframes_t next_distance; - nframes_t start; + nframes64_t distance; + nframes64_t next_distance; + nframes64_t start; if (use_edit) { start = get_preferred_edit_position(); @@ -4476,7 +4476,7 @@ Editor::external_edit_region () } void -Editor::brush (nframes_t pos) +Editor::brush (nframes64_t pos) { RegionSelection sel; RegionSelection rs; @@ -4629,7 +4629,7 @@ Editor::set_fade_length (bool in) } nframes64_t pos = get_preferred_edit_position(); - nframes_t len; + nframes64_t len; char* cmd; if (pos > rv->region()->last_frame() || pos < rv->region()->first_frame()) { @@ -5073,8 +5073,8 @@ Editor::set_loop_from_selection (bool play) return; } - nframes_t start = selection->time[clicked_selection].start; - nframes_t end = selection->time[clicked_selection].end; + nframes64_t start = selection->time[clicked_selection].start; + nframes64_t end = selection->time[clicked_selection].end; set_loop_range (start, end, _("set loop range from selection")); @@ -5144,8 +5144,8 @@ Editor::set_punch_from_selection () return; } - nframes_t start = selection->time[clicked_selection].start; - nframes_t end = selection->time[clicked_selection].end; + nframes64_t start = selection->time[clicked_selection].start; + nframes64_t end = selection->time[clicked_selection].end; set_punch_range (start, end, _("set punch range from selection")); } @@ -5820,7 +5820,7 @@ Editor::do_insert_time () return; } - nframes_t distance = clock.current_duration (pos); + nframes64_t distance = clock.current_duration (pos); if (distance == 0) { return; diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 24e9d22f1c..396f88515c 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -94,7 +94,7 @@ Editor::initialize_rulers () bool Editor::ruler_scroll (GdkEventScroll* event) { - nframes_t xdelta; + nframes64_t xdelta; int direction = event->direction; bool handled = false; @@ -167,7 +167,7 @@ Editor::ruler_button_press (GdkEventButton* ev) /* need to use the correct x,y, the event lies */ time_canvas_event_box.get_window()->get_pointer (x, y, state); - nframes_t where = leftmost_frame + pixel_to_frame (x); + nframes64_t where = leftmost_frame + pixel_to_frame (x); switch (ev->button) { case 1: @@ -211,7 +211,7 @@ Editor::ruler_button_release (GdkEventButton* ev) stop_canvas_autoscroll(); - nframes_t where = leftmost_frame + pixel_to_frame (x); + nframes64_t where = leftmost_frame + pixel_to_frame (x); switch (ev->button) { case 1: @@ -279,10 +279,10 @@ Editor::ruler_mouse_motion (GdkEventMotion* ev) track_canvas->c2w (x, y, wcx, wcy); track_canvas->w2c (wcx, wcy, cx, cy); - nframes_t where = leftmost_frame + pixel_to_frame (x); + nframes64_t where = leftmost_frame + pixel_to_frame (x); /// ripped from maybe_autoscroll, and adapted to work here - nframes_t rightmost_frame = leftmost_frame + current_page_frames (); + nframes64_t rightmost_frame = leftmost_frame + current_page_frames (); if (autoscroll_timeout_tag < 0) { if (where > rightmost_frame) { @@ -333,7 +333,7 @@ Editor::ruler_mouse_motion (GdkEventMotion* ev) void -Editor::popup_ruler_menu (nframes_t where, ItemType t) +Editor::popup_ruler_menu (nframes64_t where, ItemType t) { using namespace Menu_Helpers; @@ -759,7 +759,7 @@ Editor::update_just_smpte () return; } - nframes_t rightmost_frame = leftmost_frame + current_page_frames(); + nframes64_t rightmost_frame = leftmost_frame + current_page_frames(); if (ruler_timecode_action->get_active()) { gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_smpte_ruler), leftmost_frame, rightmost_frame, @@ -770,7 +770,7 @@ Editor::update_just_smpte () void Editor::update_fixed_rulers () { - nframes_t rightmost_frame; + nframes64_t rightmost_frame; if (session == 0) { return; @@ -846,10 +846,10 @@ Editor::_metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble u gint Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars) { - nframes_t range; nframes_t pos; - nframes_t spacer; - nframes_t fr; + nframes64_t range; + nframes64_t spacer; + nframes64_t fr; SMPTE::Time smpte; gchar buf[16]; gint nmarks = 0; @@ -867,13 +867,13 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp fr = session->frame_rate(); - if (lower > (spacer = (nframes_t)(128 * Editor::get_current_zoom ()))) { + if (lower > (spacer = (nframes64_t)(128 * Editor::get_current_zoom ()))) { lower = lower - spacer; } else { lower = 0; } upper = upper + spacer; - range = (nframes_t) floor (upper - lower); + range = (nframes64_t) floor (upper - lower); if (range < (2 * session->frames_per_smpte_frame())) { /* 0 - 2 frames */ show_bits = true; @@ -882,19 +882,19 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp } else if (range <= (fr / 4)) { /* 2 frames - 0.250 second */ show_frames = true; mark_modulo = 1; - nmarks = 1 + (range / (nframes_t)session->frames_per_smpte_frame()); + nmarks = 1 + (range / (nframes64_t)session->frames_per_smpte_frame()); } else if (range <= (fr / 2)) { /* 0.25-0.5 second */ show_frames = true; mark_modulo = 2; - nmarks = 1 + (range / (nframes_t)session->frames_per_smpte_frame()); + nmarks = 1 + (range / (nframes64_t)session->frames_per_smpte_frame()); } else if (range <= fr) { /* 0.5-1 second */ show_frames = true; mark_modulo = 5; - nmarks = 1 + (range / (nframes_t)session->frames_per_smpte_frame()); + nmarks = 1 + (range / (nframes64_t)session->frames_per_smpte_frame()); } else if (range <= 2 * fr) { /* 1-2 seconds */ show_frames = true; mark_modulo = 10; - nmarks = 1 + (range / (nframes_t)session->frames_per_smpte_frame()); + nmarks = 1 + (range / (nframes64_t)session->frames_per_smpte_frame()); } else if (range <= 8 * fr) { /* 2-8 seconds */ show_seconds = true; mark_modulo = 1; @@ -945,7 +945,7 @@ Editor::metric_get_smpte (GtkCustomRulerMark **marks, gdouble lower, gdouble upp nmarks = 1 + 24; } else { - /* not possible if nframes_t is a 32 bit quantity */ + /* not possible if nframes64_t is a 32 bit quantity */ show_hours = true; mark_modulo = 4; @@ -1095,11 +1095,11 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper gint nmarks; char buf[64]; gint n = 0; - nframes_t pos; + nframes64_t pos; bool bar_helper_on = true; BBT_Time next_beat; - nframes_t next_beat_pos; + nframes64_t next_beat_pos; if ((desirable_marks = maxchars / 7) == 0) { return 0; @@ -1152,7 +1152,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper uint32_t tick = 0; uint32_t skip; uint32_t t; - nframes_t frame_skip; + nframes64_t frame_skip; double frame_skip_error; double accumulated_error; double position_of_helper; @@ -1228,7 +1228,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper next_beat_pos = session->tempo_map().frame_time(next_beat); - frame_skip = (nframes_t) floor (frame_skip_error = (session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute())); + frame_skip = (nframes64_t) floor (frame_skip_error = (session->frame_rate() * 60) / (bbt_beat_subdivision * (*i).tempo->beats_per_minute())); frame_skip_error -= frame_skip; skip = (uint32_t) (Meter::ticks_per_beat / bbt_beat_subdivision); @@ -1254,7 +1254,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper (*marks)[n].label = g_strdup (buf); - /* Error compensation for float to nframes_t*/ + /* Error compensation for float to nframes64_t*/ accumulated_error += frame_skip_error; if (accumulated_error > 1) { pos += 1; @@ -1382,10 +1382,10 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble upper gint Editor::metric_get_frames (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars) { - nframes_t mark_interval; - nframes_t pos; - nframes_t ilower = (nframes_t) floor (lower); - nframes_t iupper = (nframes_t) floor (upper); + nframes64_t mark_interval; + nframes64_t pos; + nframes64_t ilower = (nframes64_t) floor (lower); + nframes64_t iupper = (nframes64_t) floor (upper); gchar buf[16]; gint nmarks; gint n; @@ -1403,7 +1403,7 @@ Editor::metric_get_frames (GtkCustomRulerMark **marks, gdouble lower, gdouble up nmarks = 5; *marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * nmarks); for (n = 0, pos = ilower; n < nmarks; pos += mark_interval, ++n) { - snprintf (buf, sizeof(buf), "%u", pos); + snprintf (buf, sizeof(buf), "%" PRIi64, pos); (*marks)[n].label = g_strdup (buf); (*marks)[n].position = pos; (*marks)[n].style = GtkCustomRulerMarkMajor; @@ -1413,15 +1413,15 @@ Editor::metric_get_frames (GtkCustomRulerMark **marks, gdouble lower, gdouble up } static void -sample_to_clock_parts ( nframes_t sample, - nframes_t sample_rate, +sample_to_clock_parts ( nframes64_t sample, + nframes64_t sample_rate, long *hrs_p, long *mins_p, long *secs_p, long *millisecs_p) { - nframes_t left; + nframes64_t left; long hrs; long mins; long secs; @@ -1447,11 +1447,11 @@ sample_to_clock_parts ( nframes_t sample, gint Editor::metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble upper, gint maxchars) { - nframes_t range; - nframes_t fr; - nframes_t mark_interval; - nframes_t pos; - nframes_t spacer; + nframes64_t range; + nframes64_t fr; + nframes64_t mark_interval; + nframes64_t pos; + nframes64_t spacer; long hrs, mins, secs, millisecs; gchar buf[16]; gint nmarks; @@ -1460,8 +1460,8 @@ Editor::metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble up bool show_seconds = false; bool show_minutes = false; bool show_hours = false; - nframes_t ilower = (nframes_t) floor (lower); - nframes_t iupper = (nframes_t) floor (upper); + nframes64_t ilower = (nframes64_t) floor (lower); + nframes64_t iupper = (nframes64_t) floor (upper); if (session == 0) { return 0; @@ -1470,7 +1470,7 @@ Editor::metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble up fr = session->frame_rate(); /* to prevent 'flashing' */ - if (lower > (spacer = (nframes_t)(128 * Editor::get_current_zoom ()))) { + if (lower > (spacer = (nframes64_t)(128 * Editor::get_current_zoom ()))) { lower = lower - spacer; } else { lower = 0; @@ -1542,7 +1542,7 @@ Editor::metric_get_minsec (GtkCustomRulerMark **marks, gdouble lower, gdouble up mark_modulo = 2; } else { - /* not possible if nframes_t is a 32 bit quantity */ + /* not possible if nframes64_t is a 32 bit quantity */ mark_interval = 4 * 60 * 60 * fr; /* show 4 hrs */ } diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 371f84a2f6..b26958cd91 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -235,7 +235,7 @@ Editor::set_selected_control_point_from_click (Selection::Operation op, bool no_ /* select this point and any others that it represents */ double y1, y2; - nframes_t x1, x2; + nframes64_t x1, x2; x1 = pixel_to_frame (clicked_control_point->get_x() - 10); x2 = pixel_to_frame (clicked_control_point->get_x() + 10); @@ -452,8 +452,8 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, } else if (op == Selection::Extend) { list results; - nframes_t last_frame; - nframes_t first_frame; + nframes64_t last_frame; + nframes64_t first_frame; bool same_track = false; /* 1. find the last selected regionview in the track that was clicked in */ @@ -913,7 +913,7 @@ Editor::invert_selection () } bool -Editor::select_all_within (nframes_t start, nframes_t end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op) +Editor::select_all_within (nframes64_t start, nframes64_t end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op) { list touched; list::size_type n = 0; @@ -1033,8 +1033,8 @@ Editor::select_all_selectables_using_time_selection () return; } - nframes_t start = selection->time[clicked_selection].start; - nframes_t end = selection->time[clicked_selection].end; + nframes64_t start = selection->time[clicked_selection].start; + nframes64_t end = selection->time[clicked_selection].end; if (end - start < 1) { return; @@ -1126,8 +1126,8 @@ Editor::select_all_selectables_using_loop() void Editor::select_all_selectables_using_cursor (Cursor *cursor, bool after) { - nframes_t start; - nframes_t end; + nframes64_t start; + nframes64_t end; list touched; if (after) { @@ -1166,8 +1166,8 @@ Editor::select_all_selectables_using_cursor (Cursor *cursor, bool after) void Editor::select_all_selectables_using_edit (bool after) { - nframes_t start; - nframes_t end; + nframes64_t start; + nframes64_t end; list touched; if (after) { diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 034ea26f37..7896b217dc 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -260,7 +260,7 @@ Editor::draw_measures () } } - xpos = frame_to_unit ((*i).frame); + xpos = frame_to_unit ((nframes64_t) (*i).frame); line = get_time_line (); line->property_x1() = xpos; line->property_x2() = xpos; @@ -283,7 +283,7 @@ Editor::draw_measures () } void -Editor::mouse_add_new_tempo_event (nframes_t frame) +Editor::mouse_add_new_tempo_event (nframes64_t frame) { if (session == 0) { return; @@ -325,7 +325,7 @@ Editor::mouse_add_new_tempo_event (nframes_t frame) } void -Editor::mouse_add_new_meter_event (nframes_t frame) +Editor::mouse_add_new_meter_event (nframes64_t frame) { if (session == 0) { return; diff --git a/gtk2_ardour/keyboard.cc b/gtk2_ardour/keyboard.cc index 1ec1351266..c3d9122f17 100644 --- a/gtk2_ardour/keyboard.cc +++ b/gtk2_ardour/keyboard.cc @@ -76,6 +76,7 @@ bool Keyboard::_some_magic_widget_has_focus = false; std::string Keyboard::user_keybindings_path; bool Keyboard::can_save_keybindings = false; +bool Keyboard::bindings_changed_after_save_became_legal = false; map Keyboard::binding_files; string Keyboard::_current_binding_name = _("Unknown"); map,Keyboard::AccelKeyLess> Keyboard::release_keys; @@ -421,6 +422,16 @@ accel_map_changed (GtkAccelMap* map, GdkModifierType mod, gpointer arg) { + Keyboard::keybindings_changed (); +} + +void +Keyboard::keybindings_changed () +{ + if (Keyboard::can_save_keybindings) { + Keyboard::bindings_changed_after_save_became_legal = true; + } + Keyboard::save_keybindings (); } @@ -433,7 +444,7 @@ Keyboard::set_can_save_keybindings (bool yn) void Keyboard::save_keybindings () { - if (can_save_keybindings) { + if (can_save_keybindings && bindings_changed_after_save_became_legal) { Gtk::AccelMap::save (user_keybindings_path); } } diff --git a/gtk2_ardour/keyboard.h b/gtk2_ardour/keyboard.h index 175208a434..2b6d7c4564 100644 --- a/gtk2_ardour/keyboard.h +++ b/gtk2_ardour/keyboard.h @@ -116,6 +116,7 @@ class Keyboard : public sigc::trackable, Stateful static void magic_widget_drop_focus (); static void setup_keybindings (); + static void keybindings_changed (); static void save_keybindings (); static bool load_keybindings (std::string path); static void set_can_save_keybindings (bool yn); @@ -146,6 +147,7 @@ class Keyboard : public sigc::trackable, Stateful static Gtk::Window* current_window; static std::string user_keybindings_path; static bool can_save_keybindings; + static bool bindings_changed_after_save_became_legal; static std::string _current_binding_name; typedef std::pair two_strings; diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index d7d854ae51..3fc04f80fa 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -108,8 +108,12 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway virtual void separate_region_from_selection () = 0; virtual void toggle_playback (bool with_abort) = 0; virtual void transition_to_rolling (bool fwd) = 0; - virtual nframes_t unit_to_frame (double unit) const = 0; - virtual double frame_to_unit (nframes_t frame) const = 0; + virtual nframes64_t unit_to_frame (double unit) const = 0; + // XXX remove me when libardour goes nframes64_t + double frame_to_unit (nframes_t frame) const { + return frame_to_unit ((nframes64_t) frame); + } + virtual double frame_to_unit (nframes64_t frame) const = 0; virtual double frame_to_unit (double frame) const = 0; virtual nframes64_t pixel_to_frame (double pixel) const = 0; virtual gulong frame_to_pixel (nframes64_t frame) const = 0; @@ -146,21 +150,21 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway virtual void ensure_float (Gtk::Window&) = 0; virtual void show_window () = 0; virtual TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0) = 0; - virtual nframes_t leftmost_position() const = 0; - virtual nframes_t current_page_frames() const = 0; + virtual nframes64_t leftmost_position() const = 0; + virtual nframes64_t current_page_frames() const = 0; virtual void temporal_zoom_step (bool coarser) = 0; virtual void scroll_tracks_down_line () = 0; virtual void scroll_tracks_up_line () = 0; virtual bool new_regionviews_display_gain () = 0; virtual void prepare_for_cleanup () = 0; - virtual void reset_x_origin (nframes_t frame) = 0; + virtual void reset_x_origin (nframes64_t frame) = 0; virtual void remove_last_capture () = 0; virtual void maximise_editing_space() = 0; virtual void restore_editing_space() = 0; virtual nframes64_t get_preferred_edit_position (bool ignore_playhead = false) = 0; virtual void toggle_meter_updating() = 0; virtual void split_region_at_points (boost::shared_ptr, ARDOUR::AnalysisFeatureList&, bool can_ferret) = 0; - virtual void mouse_add_new_marker (nframes_t where, bool is_cd=false, bool is_xrun=false) = 0; + virtual void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false) = 0; virtual void foreach_time_axis_view (sigc::slot) = 0; sigc::signal ZoomFocusChanged; @@ -168,7 +172,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway sigc::signal Resized; sigc::signal Realized; sigc::signal GoingAway; - sigc::signal UpdateAllTransportClocks; + sigc::signal UpdateAllTransportClocks; Glib::RefPtr editor_actions; -- cgit v1.2.3