use scroll handling instead of button 4/5 (incomplete)

git-svn-id: svn://localhost/trunk/ardour2@204 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2005-12-23 15:34:02 +00:00
parent d391778650
commit fc62426136
6 changed files with 75 additions and 43 deletions

View File

@ -626,11 +626,6 @@ ARDOUR_UI::shuttle_box_button_press (GdkEventButton* ev)
case 3:
return TRUE;
break;
case 4:
break;
case 5:
break;
}
return TRUE;

View File

@ -321,7 +321,7 @@ Editor::Editor (AudioEngine& eng)
ignore_route_list_reorder = false;
verbose_cursor_on = true;
route_removal = false;
track_spacing = 0;
track_spacing = 2;
show_automatic_regions_in_region_list = true;
have_pending_keyboard_selection = false;
_follow_playhead = true;
@ -386,11 +386,12 @@ Editor::Editor (AudioEngine& eng)
track_canvas.signal_map_event().connect (mem_fun (*this, &Editor::track_canvas_map_handler));
time_canvas.signal_map_event().connect (mem_fun (*this, &Editor::time_canvas_map_handler));
// edit_controls_hbox.pack_start (edit_controls_vbox, true, true);
controls_layout.add (edit_controls_vbox);
controls_layout.set_name ("EditControlsBase");
controls_layout.add_events (Gdk::SCROLL_MASK);
controls_layout.signal_size_request().connect (mem_fun(*this, &Editor::set_layout_width), false);
controls_layout.signal_expose_event().connect (mem_fun(*this, &Editor::layout_expose), false);
controls_layout.signal_expose_event().connect (mem_fun(*this, &Editor::control_layout_expose), false);
controls_layout.signal_scroll_event().connect (mem_fun(*this, &Editor::control_layout_scroll), false);
controls_layout.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
controls_layout.signal_button_release_event().connect (mem_fun(*this, &Editor::edit_controls_button_release));
@ -3920,8 +3921,29 @@ Editor::set_layout_width(Gtk::Requisition *r)
}
bool
Editor::layout_expose (GdkEventExpose* ex)
Editor::control_layout_expose (GdkEventExpose* ex)
{
cerr << "layout_expose() called" << endl;
return TRUE;
cerr << "control layout_expose() called" << endl;
return true;
}
bool
Editor::control_layout_scroll (GdkEventScroll* ev)
{
switch (ev->direction) {
case GDK_SCROLL_UP:
scroll_tracks_up_line ();
return true;
break;
case GDK_SCROLL_DOWN:
scroll_tracks_down_line ();
return true;
default:
/* no left/right handling yet */
break;
}
return false;
}

View File

@ -643,7 +643,8 @@ class Editor : public PublicEditor
Gtk::Layout controls_layout;
void set_layout_width(Gtk::Requisition *);
bool Editor::layout_expose (GdkEventExpose* ex);
bool Editor::control_layout_expose (GdkEventExpose* ev);
bool Editor::control_layout_scroll (GdkEventScroll* ev);
Gtk::HScrollbar edit_hscrollbar;
bool edit_hscroll_dragging;

View File

@ -224,10 +224,11 @@ Editor::route_list_reordered ()
{
TreeModel::Children rows = route_display_model->children();
TreeModel::Children::iterator i;
long order;
uint32_t position;
uint32_t order;
int n;
for (n = 0, order = 0, i = rows.begin(); i != rows.end(); ++i, ++order) {
for (n = 0, order = 0, position = 0, i = rows.begin(); i != rows.end(); ++i, ++order) {
TimeAxisView *tv = (*i)[route_display_columns.tv];
AudioTimeAxisView* at;
if (!ignore_route_list_reorder) {
@ -237,12 +238,12 @@ Editor::route_list_reordered ()
*/
if ((at = dynamic_cast<AudioTimeAxisView*> (tv)) != 0) {
at->route().set_order_key (N_("editor"), order);
at->route().set_order_key (N_("editor"), position);
}
}
if (tv->marked_for_display()) {
order += tv->show_at (order, n, &edit_controls_vbox);
order += track_spacing;
position += tv->show_at (position, n, &edit_controls_vbox);
position += track_spacing;
} else {
tv->hide ();
}
@ -251,7 +252,7 @@ Editor::route_list_reordered ()
}
// controls_layout.queue_resize ();
controls_layout.queue_resize ();
reset_scrolling_region ();
return FALSE;
}

View File

@ -52,6 +52,7 @@
#include "i18n.h"
using namespace Gtk;
using namespace Gdk;
using namespace sigc;
using namespace ARDOUR;
using namespace Editing;
@ -125,11 +126,12 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie
controls_ebox.set_name ("TimeAxisViewControlsBaseUnselected");
controls_ebox.add (controls_vbox);
controls_ebox.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
controls_ebox.set_flags (Gtk::CAN_FOCUS);
controls_ebox.add_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK|SCROLL_MASK);
controls_ebox.set_flags (CAN_FOCUS);
controls_ebox.signal_button_release_event().connect (mem_fun (*this, &TimeAxisView::controls_ebox_button_release));
controls_ebox.signal_scroll_event().connect (mem_fun (*this, &TimeAxisView::controls_ebox_scroll));
controls_lhs_pad.set_name ("TimeAxisViewControlsPadding");
controls_hbox.pack_start (controls_lhs_pad,false,false);
controls_hbox.pack_start (controls_ebox,true,true);
@ -137,7 +139,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie
controls_frame.add (controls_hbox);
controls_frame.set_name ("TimeAxisViewControlsBaseUnselected");
controls_frame.set_shadow_type (Gtk::SHADOW_OUT);
controls_frame.set_shadow_type (Gtk::SHADOW_IN);
}
TimeAxisView::~TimeAxisView()
@ -233,9 +235,37 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
return effective_height;
}
gint
bool
TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
{
switch (ev->direction) {
case GDK_SCROLL_UP:
if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
step_height (true);
return true;
}
break;
case GDK_SCROLL_DOWN:
if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
step_height (false);
return true;
}
break;
default:
/* no handling for left/right, yet */
break;
}
return false;
}
bool
TimeAxisView::controls_ebox_button_release (GdkEventButton* ev)
{
cerr << "controls ebox button release button " << ev->button << endl;
switch (ev->button) {
case 1:
selection_click (ev);
@ -244,27 +274,9 @@ TimeAxisView::controls_ebox_button_release (GdkEventButton* ev)
case 3:
popup_display_menu (ev->time);
break;
case 4:
if (Keyboard::no_modifier_keys_pressed (ev)) {
editor.scroll_tracks_up_line ();
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
step_height (true);
}
break;
case 5:
if (Keyboard::no_modifier_keys_pressed (ev)) {
editor.scroll_tracks_down_line ();
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
step_height (false);
}
break;
}
return TRUE;
return true;
}
void

View File

@ -218,7 +218,8 @@ class TimeAxisView : public virtual AxisView
*
*@ param ev the event
*/
virtual gint controls_ebox_button_release (GdkEventButton *ev);
virtual bool controls_ebox_button_release (GdkEventButton *ev);
virtual bool controls_ebox_scroll (GdkEventScroll *ev);
/**
* Displays the standard LHS control menu at when.