size-based scrolling and right-click pages for editor notebook
[ardour.git] / gtk2_ardour / audio_time_axis.cc
index 3958bea4b5d8820070e3fb451c581f9f5892805f..c1ccc52fc9774df360f6372b297a0c45b8591678 100644 (file)
@@ -100,7 +100,7 @@ static const gchar * small_x_xpm[] = {
 "           ",
 "           "};
 
-AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt, CanvasAA& canvas)
+AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt, Canvas& canvas)
        : AxisView(sess),
          RouteUI(rt, sess, _("m"), _("s"), _("r")), // mute, solo, and record
          TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas),
@@ -161,19 +161,13 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt
        mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press));
        mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release));
        rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press));
-       edit_group_button.signal_button_release_event().connect (mem_fun(*this, &AudioTimeAxisView::edit_click));
+       edit_group_button.signal_button_release_event().connect (mem_fun(*this, &AudioTimeAxisView::edit_click), false);
        playlist_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::playlist_click));
        automation_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::automation_click));
-       size_button.signal_button_release_event().connect (mem_fun(*this, &AudioTimeAxisView::size_click));
+       size_button.signal_button_release_event().connect (mem_fun(*this, &AudioTimeAxisView::size_click), false);
        visual_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::visual_click));
        hide_button.signal_clicked().connect (mem_fun(*this, &AudioTimeAxisView::hide_click));
 
-       name_entry.signal_activate().connect (mem_fun(*this, &AudioTimeAxisView::name_entry_activated));
-       name_entry.signal_focus_out_event().connect (mem_fun(*this, &AudioTimeAxisView::name_entry_focus_out_handler));
-       name_entry.signal_button_press_event().connect (mem_fun(*this, &AudioTimeAxisView::name_entry_button_press_handler));
-       name_entry.signal_button_release_event().connect (mem_fun(*this, &AudioTimeAxisView::name_entry_button_release_handler));
-       name_entry.signal_key_release_event().connect (mem_fun(*this, &AudioTimeAxisView::name_entry_key_release_handler));
-       
        if (is_audio_track()) {
                controls_table.attach (*rec_enable_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
        }
@@ -501,12 +495,10 @@ AudioTimeAxisView::show_timestretch (jack_nframes_t start, jack_nframes_t end)
        x2 = (end - 1) / editor.get_current_zoom();
        y2 = height - 2;
        
-       gtk_object_set (GTK_OBJECT(timestretch_rect), 
-                       "x1", x1,
-                       "y1", 1.0,
-                       "x2", x2,
-                       "y2", y2,
-                       NULL);
+       timestretch_rect->property_x1() = x1;
+       timestretch_rect->property_y1() = 1.0;
+       timestretch_rect->property_x2() = x2;
+       timestretch_rect->property_y2() = y2;
 }
 
 void
@@ -1038,7 +1030,7 @@ AudioTimeAxisView::get_selectables (jack_nframes_t start, jack_nframes_t end, do
        }
        
        jack_nframes_t start_adjusted = session_frame_to_track_frame(start, speed);
-       jack_nframes_t end_adjusted = session_frame_to_track_frame(start, speed);
+       jack_nframes_t end_adjusted   = session_frame_to_track_frame(end, speed);
 
        if (view && touched (top, bot)) {
                view->get_selectables (start_adjusted, end_adjusted, results);
@@ -1093,59 +1085,11 @@ AudioTimeAxisView::playlist () const
        }
 }
 
-gint 
-AudioTimeAxisView::name_entry_button_press_handler (GdkEventButton *ev)
-{
-       if (ev->button == 3) {
-               return stop_signal (name_entry, "button_press_event");
-       }
-       return FALSE;
-}
-
-gint 
-AudioTimeAxisView::name_entry_button_release_handler (GdkEventButton *ev)
-{
-       return FALSE;
-}
-
-gint
-AudioTimeAxisView::name_entry_focus_out_handler (GdkEventFocus* ev)
-{
-       name_entry_changed ();
-       return TRUE;
-}
-
-gint
-AudioTimeAxisView::name_entry_key_release_handler (GdkEventKey* ev)
-{
-       switch (ev->keyval) {
-       case GDK_Tab:
-       case GDK_Up:
-       case GDK_Down:
-               name_entry_changed ();
-               return TRUE;
-
-       default:
-               return FALSE;
-       }
-}
-
-void
-AudioTimeAxisView::name_entry_activated ()
-{
-       /* this should drop focus from the entry,
-          and cause a call to name_entry_changed()
-       */
-       controls_ebox.grab_focus();
-}
-
 void
 AudioTimeAxisView::name_entry_changed ()
 {
        string x;
 
-       ARDOUR_UI::generic_focus_out_event (0);
-
        x = name_entry.get_text ();
        
        if (x == _route.name()) {
@@ -1202,20 +1146,15 @@ AudioTimeAxisView::add_gain_automation_child ()
                                                     _route,
                                                     editor,
                                                     *this,
-                                                    *(parent_canvas.root()),
+                                                    parent_canvas,
                                                     _("gain"),
                                                     _route.gain_automation_curve());
        
-
-#if 0
        line = new AutomationGainLine ("automation gain",
                                       _session,
                                       *gain_track,
                                       *gain_track->canvas_display,
-                                      _route.gain_automation_curve(),
-                                      mem_fun (editor, &PublicEditor::canvas_control_point_event),
-                                      mem_fun (editor, &PublicEditor::canvas_line_event));
-#endif
+                                      _route.gain_automation_curve());
 
        line->set_line_color (color_map[cAutomationLine]);
        
@@ -1248,7 +1187,7 @@ AudioTimeAxisView::add_pan_automation_child ()
 {
        XMLProperty* prop;
 
-       pan_track = new PanAutomationTimeAxisView (_session, _route, editor, *this, *(parent_canvas.root()), _("pan"));
+       pan_track = new PanAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, _("pan"));
 
        update_pans ();
        
@@ -1294,9 +1233,7 @@ AudioTimeAxisView::update_pans ()
 
                line = new AutomationPanLine ("automation pan", _session, *pan_track,
                                              *pan_track->canvas_display, 
-                                             (*p)->automation(),
-                                             mem_fun (editor, &PublicEditor::canvas_control_point_event),
-                                             mem_fun (editor, &PublicEditor::canvas_line_event));
+                                             (*p)->automation());
 
                if (p == _route.panner().begin()) {
                        /* first line is a nice orange */
@@ -1472,13 +1409,11 @@ AudioTimeAxisView::add_redirect_automation_curve (Redirect *redirect, uint32_t w
        char state_name[256];
        snprintf (state_name, sizeof (state_name), "Redirect-%s-%" PRIu32, legalize_for_xml_node (redirect->name()).c_str(), what);
 
-       ran->view = new RedirectAutomationTimeAxisView (_session, _route, editor, *this, (*parent_canvas.root()), name, what, *redirect, state_name);
+       ran->view = new RedirectAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, name, what, *redirect, state_name);
 
        ral = new RedirectAutomationLine (name, 
                                          *redirect, what, _session, *ran->view,
-                                         *ran->view->canvas_display, redirect->automation_list (what), 
-                                         mem_fun (editor, &PublicEditor::canvas_control_point_event),
-                                         mem_fun (editor, &PublicEditor::canvas_line_event));
+                                         *ran->view->canvas_display, redirect->automation_list (what));
        
        ral->set_line_color (color_map[cRedirectAutomationLine]);
        ral->queue_reset ();
@@ -2002,7 +1937,7 @@ AudioTimeAxisView::route_active_changed ()
 }
 
 XMLNode* 
-AudioTimeAxisView::get_child_xml_node (std::string childname)
+AudioTimeAxisView::get_child_xml_node (stringcr_t childname)
 {
        return RouteUI::get_child_xml_node (childname);
 }