X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor.h;h=2da7650ce5c12fa7fa830d79621c4e62e26cd790;hb=05caa9caa1ace0cfa029f034345eb1a0602b86a4;hp=43d3fccedf9217d654296771d92cfd523fec7136;hpb=30968b854257cb5f9159ca59589f783c85615601;p=ardour.git diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 43d3fccedf..2da7650ce5 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -147,10 +147,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void first_idle (); virtual bool have_idled () const { return _have_idled; } - framepos_t leftmost_position() const { return leftmost_frame; } + framepos_t leftmost_sample() const { return leftmost_frame; } - framecnt_t current_page_frames() const { - return (framecnt_t) floor (_visible_canvas_width * frames_per_pixel); + framecnt_t current_page_samples() const { + return (framecnt_t) floor (_visible_canvas_width * samples_per_pixel); } double visible_canvas_height () const { @@ -220,32 +220,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void separate_regions_using_location (ARDOUR::Location&); void transition_to_rolling (bool forward); - /* undo related */ - - framepos_t unit_to_frame (double unit) const { - return (framepos_t) rint (unit * frames_per_pixel); - } - - double frame_to_unit (framepos_t frame) const { - return rint ((double) frame / (double) frames_per_pixel); - } - - double frame_to_unit_unrounded (framepos_t frame) const { - return frame / frames_per_pixel; - } - - double frame_to_unit (double frame) const { - return rint (frame / frames_per_pixel); - } - /* NOTE: these functions assume that the "pixel" coordinate is - the result of using the world->canvas affine transform on a - world coordinate. These coordinates already take into - account any scrolling carried out by adjusting the - xscroll_adjustment. + in canvas coordinates. These coordinates already take into + account any scrolling offsets. */ - framepos_t pixel_to_frame (double pixel) const { + framepos_t pixel_to_sample (double pixel) const { /* pixel can be less than zero when motion events are processed. since we've already run the world->canvas @@ -254,17 +234,19 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD */ if (pixel >= 0) { - return (framepos_t) rint (pixel * frames_per_pixel); + return (framepos_t) rint (pixel * samples_per_pixel); } else { return 0; } } - gulong frame_to_pixel (framepos_t frame) const { - return (gulong) rint (frame / frames_per_pixel); + double sample_to_pixel (framepos_t sample) const { + return rint (sample / samples_per_pixel); } - void flush_canvas (); + double sample_to_pixel_unrounded (framepos_t sample) const { + return sample / samples_per_pixel; + } /* selection */ @@ -310,7 +292,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void set_zoom_focus (Editing::ZoomFocus); Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; } - double get_current_zoom () const { return frames_per_pixel; } + double get_current_zoom () const { return samples_per_pixel; } void cycle_zoom_focus (); void temporal_zoom_step (bool coarser); void tav_zoom_step (bool coarser); @@ -497,7 +479,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD VisualState (bool with_tracks); ~VisualState (); double y_position; - double frames_per_pixel; + double samples_per_pixel; framepos_t leftmost_frame; Editing::ZoomFocus zoom_focus; GUIObjectState* gui_state; @@ -517,11 +499,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void cancel_visual_state_op (uint32_t n); framepos_t leftmost_frame; - double frames_per_pixel; + double samples_per_pixel; Editing::ZoomFocus zoom_focus; - void set_frames_per_pixel (double); - bool clamp_frames_per_pixel (double &) const; + void set_samples_per_pixel (double); + bool clamp_samples_per_pixel (double &) const; Editing::MouseMode mouse_mode; Editing::MouseMode pre_internal_mouse_mode; @@ -714,12 +696,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD ArdourCanvas::GtkCanvas* _track_canvas; ArdourCanvas::GtkCanvasViewport* _track_canvas_viewport; - Gtk::Adjustment* _track_canvas_hadj; - Gtk::Adjustment* _track_canvas_vadj; ArdourCanvas::GtkCanvas* _time_bars_canvas; ArdourCanvas::GtkCanvasViewport* _time_bars_canvas_viewport; - Gtk::Adjustment* _time_bars_canvas_hadj; Gtk::Adjustment* _time_bars_canvas_vadj; bool within_track_canvas; @@ -732,7 +711,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD bool track_canvas_motion (GdkEvent*); Gtk::EventBox time_canvas_event_box; - Gtk::EventBox track_canvas_event_box; Gtk::EventBox time_bars_event_box; Gtk::EventBox ruler_label_event_box; @@ -786,9 +764,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD ruler_time_range_marker = 7, ruler_time_transport_marker = 8, ruler_time_cd_marker = 9, -#ifdef WITH_VIDEOTIMELINE ruler_video_timeline = 10, -#endif }; static GtkCustomMetric ruler_metrics[4]; @@ -922,8 +898,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Gtk::Label transport_mark_label; Gtk::Label cd_mark_label; -#ifdef WITH_VIDEOTIMELINE - ArdourCanvas::Rectangle* videotl_bar; + /* videtimline related actions */ + ArdourCanvas::Rectangle* videotl_bar; Gtk::Label videotl_label; ArdourCanvas::Group* videotl_bar_group; ArdourCanvas::Group* videotl_group; @@ -946,7 +922,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD int get_videotl_bar_height () const { return videotl_bar_height; } void export_video (); void toggle_region_video_lock (); -#endif Gtk::VBox time_bars_vbox; @@ -992,7 +967,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD /** the adjustment that controls the overall editor vertical scroll position */ Gtk::Adjustment vertical_adjustment; + Gtk::Adjustment horizontal_adjustment; + Gtk::Adjustment unused_adjustment; // yes, really; Gtk::Layout constructor requires refs Gtk::Layout controls_layout; bool control_layout_scroll (GdkEventScroll* ev); void reset_controls_layout_width (); @@ -1057,14 +1034,14 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Type pending; framepos_t time_origin; - double frames_per_pixel; + double samples_per_pixel; double y_origin; int idle_handler_id; /** true if we are currently in the idle handler */ bool being_handled; - VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_pixel (0), idle_handler_id (-1), being_handled (false) {} + VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), samples_per_pixel (0), idle_handler_id (-1), being_handled (false) {} void add (Type t) { pending = Type (pending | t); } @@ -1454,7 +1431,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*); bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*); bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*); -#ifdef WITH_VIDEOTIMELINE + bool canvas_videotl_bar_event (GdkEvent* event, ArdourCanvas::Item*); void update_video_timeline (bool flush = false); void set_video_timeline_height (const int); @@ -1463,7 +1440,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void set_video_timeline_locked (const bool); void queue_visual_videotimeline_update (); void embed_audio_from_video (std::string, framepos_t n = 0); -#endif bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*); bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*); @@ -1890,7 +1866,15 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void duplicate_range (bool with_dialog); - framepos_t event_frame (GdkEvent const *, double* px = 0, double* py = 0) const; + /** computes the timeline frame (sample) of an event whose coordinates + * are in canvas units (pixels, scroll offset included). + */ + framepos_t canvas_event_frame (GdkEvent const *, double* px = 0, double* py = 0) const; + + /** computes the timeline frame (sample) of an event whose coordinates + * are in window units (pixels, no scroll offset). + */ + framepos_t window_event_frame (GdkEvent const *, double* px = 0, double* py = 0) const; /* returns false if mouse pointer is not in track or marker canvas */ @@ -2097,8 +2081,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void region_view_added (RegionView *); void region_view_removed (); - void update_canvas_now (); - EditorGroupTabs* _group_tabs; void fit_route_group (ARDOUR::RouteGroup *); @@ -2181,9 +2163,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD friend class RegionCreateDrag; friend class RegionMotionDrag; friend class RegionInsertDrag; -#ifdef WITH_VIDEOTIMELINE friend class VideoTimeLineDrag; -#endif friend class EditorSummary; friend class EditorGroupTabs;