location_loop_color = ARDOUR_UI::config()->get_canvasvar_LocationLoop();
location_punch_color = ARDOUR_UI::config()->get_canvasvar_LocationPunch();
+ zoom_focus = ZoomFocusLeft;
_edit_point = EditAtMouse;
_internal_editing = false;
current_canvas_cursor = 0;
_scroll_callbacks = 0;
- zoom_focus = ZoomFocusLeft;
- set_zoom_focus (ZoomFocusLeft);
zoom_range_clock->ValueChanged.connect (sigc::mem_fun(*this, &Editor::zoom_adjustment_changed));
bbt_label.set_name ("EditorRulerLabel");
setup_toolbar ();
+ set_zoom_focus (zoom_focus);
_snap_type = SnapToBeat;
set_snap_to (_snap_type);
_snap_mode = SnapOff;
signal_configure_event().connect (sigc::mem_fun (*ARDOUR_UI::instance(), &ARDOUR_UI::configure_handler));
signal_delete_event().connect (sigc::mem_fun (*ARDOUR_UI::instance(), &ARDOUR_UI::exit_on_main_window_close));
- Gtkmm2ext::Keyboard::the_keyboard().ShiftReleased.connect (sigc::mem_fun (*this, &Editor::shift_key_released));
+ Gtkmm2ext::Keyboard::the_keyboard().ZoomVerticalModifierReleased.connect (sigc::mem_fun (*this, &Editor::zoom_vertical_modifier_released));
/* allow external control surfaces/protocols to do various things */
return;
}
- double fpu = zoom_range_clock->current_duration() / _visible_canvas_width;
+ framecnt_t fpu = llrintf (zoom_range_clock->current_duration() / _visible_canvas_width);
bool clamped = clamp_samples_per_pixel (fpu);
if (clamped) {
void
Editor::center_screen (framepos_t frame)
{
- double const page = _visible_canvas_width * samples_per_pixel;
+ framecnt_t const page = _visible_canvas_width * samples_per_pixel;
/* if we're off the page, then scroll.
*/
/* These signals can all be emitted by a non-GUI thread. Therefore the
handlers for them must not attempt to directly interact with the GUI,
- but use Gtkmm2ext::UI::instance()->call_slot();
+ but use PBD::Signal<T>::connect() which accepts an event loop
+ ("context") where the handler will be asked to run.
*/
_session->StepEditStatusChange.connect (_session_connections, invalidator (*this), boost::bind (&Editor::step_edit_status_change, this, _1), gui_context());
edit_items.push_back (MenuElem (_("Bounce Range to Region List"), sigc::bind (sigc::mem_fun(*this, &Editor::bounce_range_selection), false, false)));
edit_items.push_back (MenuElem (_("Bounce Range to Region List With Processing"), sigc::bind (sigc::mem_fun(*this, &Editor::bounce_range_selection), false, true)));
edit_items.push_back (MenuElem (_("Export Range..."), sigc::mem_fun(*this, &Editor::export_selection)));
+ if (ARDOUR_UI::instance()->video_timeline->get_duration() > 0) {
+ edit_items.push_back (MenuElem (_("Export Video Range..."), sigc::bind (sigc::mem_fun(*this, &Editor::export_video), true)));
+ }
}
}
if ((prop = node.property ("zoom"))) {
- reset_zoom (PBD::atof (prop->value()));
+ /* older versions of ardour used floating point samples_per_pixel */
+ double f = PBD::atof (prop->value());
+ reset_zoom (llrintf (f));
} else {
reset_zoom (samples_per_pixel);
}
maybe_add_mixer_strip_width (*node);
node->add_property ("zoom-focus", enum_2_string (zoom_focus));
- snprintf (buf, sizeof(buf), "%f", samples_per_pixel);
+
+ snprintf (buf, sizeof(buf), "%" PRId64, samples_per_pixel);
node->add_property ("zoom", buf);
node->add_property ("snap-to", enum_2_string (_snap_type));
node->add_property ("snap-mode", enum_2_string (_snap_mode));
*/
string txt = data.get_text();
- const char* p;
+ char* p;
const char* q;
- p = (const char *) malloc (txt.length() + 1);
- txt.copy (const_cast<char *> (p), txt.length(), 0);
- const_cast<char*>(p)[txt.length()] = '\0';
+ p = (char *) malloc (txt.length() + 1);
+ txt.copy (p, txt.length(), 0);
+ p[txt.length()] = '\0';
while (p)
{
}
void
-Editor::reset_zoom (double fpp)
+Editor::reset_zoom (framecnt_t spp)
{
- clamp_samples_per_pixel (fpp);
+ clamp_samples_per_pixel (spp);
- if (fpp == samples_per_pixel) {
+ if (spp == samples_per_pixel) {
return;
}
pending_visual_change.add (VisualChange::ZoomLevel);
- pending_visual_change.samples_per_pixel = fpp;
+ pending_visual_change.samples_per_pixel = spp;
ensure_visual_change_idle_handler ();
}
* @param fpu New frames per unit; should already have been clamped so that it is sensible.
*/
void
-Editor::set_samples_per_pixel (double fpp)
+Editor::set_samples_per_pixel (framecnt_t spp)
{
+ clamp_samples_per_pixel (spp);
+ samples_per_pixel = spp;
+
if (tempo_lines) {
tempo_lines->tempo_map_changed();
}
- samples_per_pixel = fpp;
-
/* convert fpu to frame count */
- framepos_t frames = (framepos_t) floor (samples_per_pixel * _visible_canvas_width);
+ framepos_t frames = samples_per_pixel * _visible_canvas_width;
if (samples_per_pixel != zoom_range_clock->current_duration()) {
zoom_range_clock->set (frames);
ZoomChanged (); /* EMIT_SIGNAL */
- //reset_scrolling_region ();
+ ArdourCanvas::GtkCanvasViewport* c;
+
+ c = get_time_bars_canvas();
+ if (c) {
+ c->canvas()->zoomed ();
+ }
+ c = get_track_canvas();
+ if (c) {
+ c->canvas()->zoomed ();
+ }
if (playhead_cursor) {
playhead_cursor->set_position (playhead_cursor->current_frame ());
double const last_time_origin = horizontal_position ();
+
if (p & VisualChange::ZoomLevel) {
set_samples_per_pixel (pending_visual_change.samples_per_pixel);
compute_bbt_ruler_scale (pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_samples(),
current_bbt_points_begin, current_bbt_points_end);
update_tempo_based_rulers (current_bbt_points_begin, current_bbt_points_end);
- }
- if (p & VisualChange::ZoomLevel) {
update_video_timeline();
}
EditPoint ep = _edit_point;
if (from_context_menu && (ep == EditAtMouse)) {
- return window_event_frame (&context_click_event, 0, 0);
+ return canvas_event_frame (&context_click_event, 0, 0);
}
if (entered_marker) {
rtv->view()->RegionViewRemoved.connect (sigc::mem_fun (*this, &Editor::region_view_removed));
}
- _routes->routes_added (new_views);
- _summary->routes_added (new_views);
+ if (new_views.size() > 0) {
+ _routes->routes_added (new_views);
+ _summary->routes_added (new_views);
+ }
if (show_editor_mixer_when_tracks_arrive) {
show_editor_mixer (true);
}
void
-Editor::shift_key_released ()
+Editor::zoom_vertical_modifier_released()
{
_stepping_axis_view = 0;
}