mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-04 20:55:48 +01:00
Trackfaders
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3068 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
cdd8ef7fc8
commit
640a60169b
11 changed files with 196 additions and 79 deletions
|
|
@ -357,13 +357,13 @@ else:
|
|||
}
|
||||
else:
|
||||
font_sizes = {
|
||||
'TINY' : '6',
|
||||
'SMALLER' : '8',
|
||||
'SMALL' : '9',
|
||||
'NORMAL' : '10',
|
||||
'BIG' : '14',
|
||||
'BIGGER' : '16',
|
||||
'LARGE' : '18',
|
||||
'TINY' : '5',
|
||||
'SMALLER' : '6',
|
||||
'SMALL' : '7',
|
||||
'NORMAL' : '7',
|
||||
'BIG' : '8',
|
||||
'BIGGER' : '10',
|
||||
'LARGE' : '12',
|
||||
'LARGER' : '24',
|
||||
'HUGER' : '34',
|
||||
'MASSIVE' : '60'
|
||||
|
|
@ -464,9 +464,9 @@ env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), ardour_
|
|||
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour2_ui_default.conf'))
|
||||
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.menus'))
|
||||
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour-sae.menus'))
|
||||
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ergonomic-us.bindings'))
|
||||
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'mnemonic-us.bindings'))
|
||||
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'SAE-de.bindings'))
|
||||
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour.bindings'))
|
||||
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour-sae-ansi.bindings'))
|
||||
env.Alias('install', env.Install(os.path.join(config_prefix, 'ardour2'), 'ardour-sae-de.bindings'))
|
||||
# data files
|
||||
env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2'), 'splash.png'))
|
||||
env.Alias('install', env.Install(os.path.join(install_prefix, 'share', 'ardour2', 'pixmaps'), pixmap_files))
|
||||
|
|
|
|||
|
|
@ -338,7 +338,6 @@ Editor::session_going_away ()
|
|||
editor_mixer_button.set_active(false);
|
||||
editor_mixer_button.set_sensitive(false);
|
||||
/* clear tempo/meter rulers */
|
||||
|
||||
remove_metric_marks ();
|
||||
hide_measures ();
|
||||
clear_marker_display ();
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ Editor::handle_new_route (Session::RouteList& routes)
|
|||
if (atv->route()->order_key(N_("editor")) == -1) {
|
||||
atv->route()->set_order_key (N_("editor"), route_display_model->children().size()-1);
|
||||
}
|
||||
atv->effective_gain_display ();
|
||||
}
|
||||
|
||||
tv->set_old_order_key (route_display_model->children().size() - 1);
|
||||
|
|
|
|||
BIN
gtk2_ardour/icons/fader_belt_h.png
Normal file
BIN
gtk2_ardour/icons/fader_belt_h.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
|
|
@ -79,9 +79,19 @@
|
|||
|
||||
using namespace ARDOUR;
|
||||
using namespace PBD;
|
||||
using namespace Gtkmm2ext;
|
||||
using namespace Gtk;
|
||||
using namespace Editing;
|
||||
using namespace std;
|
||||
|
||||
Glib::RefPtr<Gdk::Pixbuf> RouteTimeAxisView::slider;
|
||||
|
||||
int
|
||||
RouteTimeAxisView::setup_slider_pix ()
|
||||
{
|
||||
slider = ::get_icon ("fader_belt_h");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas)
|
||||
: AxisView(sess),
|
||||
|
|
@ -94,9 +104,14 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
|
|||
size_button (_("h")), // height
|
||||
automation_button (_("a")),
|
||||
visual_button (_("v")),
|
||||
lm (rt, sess)
|
||||
|
||||
lm (rt, sess),
|
||||
gain_slider (0),
|
||||
gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1)
|
||||
{
|
||||
if (slider == 0) {
|
||||
setup_slider_pix ();
|
||||
}
|
||||
|
||||
lm.set_no_show_all();
|
||||
lm.setup_meters(50);
|
||||
_has_state = true;
|
||||
|
|
@ -109,6 +124,8 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
|
|||
destructive_track_mode_item = 0;
|
||||
normal_track_mode_item = 0;
|
||||
|
||||
gain_slider = manage (new HSliderController (slider, &gain_adjustment, _route->gain_control(), false));
|
||||
|
||||
ignore_toggle = false;
|
||||
|
||||
edit_group_button.set_name ("TrackGroupButton");
|
||||
|
|
@ -150,7 +167,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
|
|||
|
||||
rec_enable_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::rec_enable_press), false);
|
||||
rec_enable_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::rec_enable_release));
|
||||
controls_table.attach (*rec_enable_button, 4, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
|
||||
controls_table.attach (*rec_enable_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
|
||||
ARDOUR_UI::instance()->tooltips().set_tip(*rec_enable_button, _("Record"));
|
||||
|
||||
}
|
||||
|
|
@ -160,10 +177,11 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
|
|||
_route->input_changed.connect (mem_fun(*this, &RouteTimeAxisView::io_changed));
|
||||
_route->output_changed.connect (mem_fun(*this, &RouteTimeAxisView::io_changed));
|
||||
|
||||
controls_table.attach (*mute_button, 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
|
||||
controls_table.attach (*solo_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
|
||||
controls_table.attach (*mute_button, 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
|
||||
controls_table.attach (*solo_button, 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
|
||||
|
||||
controls_table.attach (edit_group_button, 6, 7, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
|
||||
controls_table.attach (edit_group_button, 7, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
|
||||
controls_table.attach (*gain_slider, 0, 5, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
|
||||
|
||||
ARDOUR_UI::instance()->tooltips().set_tip(*solo_button,_("Solo"));
|
||||
ARDOUR_UI::instance()->tooltips().set_tip(*mute_button,_("Mute"));
|
||||
|
|
@ -187,11 +205,11 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
|
|||
|
||||
} else {
|
||||
|
||||
controls_table.attach (automation_button, 5, 6, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
|
||||
controls_table.attach (automation_button, 6, 7, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
|
||||
}
|
||||
|
||||
if (is_track() && track()->mode() == ARDOUR::Normal) {
|
||||
controls_table.attach (playlist_button, 4, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
|
||||
controls_table.attach (playlist_button, 5, 6, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
|
||||
}
|
||||
|
||||
y_position = -1;
|
||||
|
|
@ -213,6 +231,15 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
|
|||
|
||||
editor.ZoomChanged.connect (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
|
||||
ColorsChanged.connect (mem_fun (*this, &RouteTimeAxisView::color_handler));
|
||||
|
||||
gain_slider->signal_button_press_event().connect (mem_fun(*this, &RouteTimeAxisView::start_gain_touch));
|
||||
gain_slider->signal_button_release_event().connect (mem_fun(*this, &RouteTimeAxisView::end_gain_touch));
|
||||
gain_slider->set_name ("TrackGainFader");
|
||||
|
||||
gain_adjustment.signal_value_changed().connect (mem_fun(*this, &RouteTimeAxisView::gain_adjusted));
|
||||
_route->gain_changed.connect (mem_fun(*this, &RouteTimeAxisView::gain_changed));
|
||||
|
||||
gain_slider->show_all();
|
||||
}
|
||||
|
||||
RouteTimeAxisView::~RouteTimeAxisView ()
|
||||
|
|
@ -1862,3 +1889,36 @@ RouteTimeAxisView::io_changed (IOChange change, void *src)
|
|||
{
|
||||
reset_meter ();
|
||||
}
|
||||
|
||||
gint
|
||||
RouteTimeAxisView::start_gain_touch (GdkEventButton* ev)
|
||||
{
|
||||
_route->start_gain_touch ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gint
|
||||
RouteTimeAxisView::end_gain_touch (GdkEventButton* ev)
|
||||
{
|
||||
_route->end_gain_touch ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
RouteTimeAxisView::gain_adjusted ()
|
||||
{
|
||||
_route->set_gain (slider_position_to_gain (gain_adjustment.get_value()), this);
|
||||
}
|
||||
|
||||
void
|
||||
RouteTimeAxisView::gain_changed (void *src)
|
||||
{
|
||||
Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &RouteTimeAxisView::effective_gain_display));
|
||||
}
|
||||
|
||||
void
|
||||
RouteTimeAxisView::effective_gain_display ()
|
||||
{
|
||||
gfloat value = gain_to_slider_position (_route->effective_gain());
|
||||
gain_adjustment.set_value (value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,10 @@
|
|||
#include <gtkmm/menuitem.h>
|
||||
#include <gtkmm/radiomenuitem.h>
|
||||
#include <gtkmm/checkmenuitem.h>
|
||||
#include <gtkmm/adjustment.h>
|
||||
|
||||
#include <gtkmm2ext/selector.h>
|
||||
#include <gtkmm2ext/slider_controller.h>
|
||||
#include <list>
|
||||
|
||||
#include <ardour/types.h>
|
||||
|
|
@ -108,6 +110,7 @@ public:
|
|||
void clear_meter ();
|
||||
void io_changed (ARDOUR::IOChange, void *);
|
||||
void meter_changed (void *);
|
||||
void effective_gain_display ();
|
||||
|
||||
protected:
|
||||
friend class StreamView;
|
||||
|
|
@ -255,6 +258,16 @@ protected:
|
|||
void post_construct ();
|
||||
|
||||
LevelMeter lm;
|
||||
|
||||
Gtkmm2ext::HSliderController *gain_slider;
|
||||
Gtk::Adjustment gain_adjustment;
|
||||
static Glib::RefPtr<Gdk::Pixbuf> slider;
|
||||
static int setup_slider_pix ();
|
||||
void gain_adjusted();
|
||||
|
||||
gint start_gain_touch (GdkEventButton*);
|
||||
gint end_gain_touch (GdkEventButton*);
|
||||
void gain_changed (void *);
|
||||
};
|
||||
|
||||
#endif /* __ardour_route_time_axis_h__ */
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ bool TimeAxisView::need_size_info = true;
|
|||
TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* rent, Canvas& canvas)
|
||||
: AxisView (sess),
|
||||
editor (ed),
|
||||
controls_table (2, 7)
|
||||
controls_table (2, 8)
|
||||
{
|
||||
if (need_size_info) {
|
||||
compute_controls_size_info ();
|
||||
|
|
@ -126,7 +126,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie
|
|||
controls_table.set_col_spacings (0);
|
||||
controls_table.set_homogeneous (true);
|
||||
|
||||
controls_table.attach (name_hbox, 0, 4, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 3, 0);
|
||||
controls_table.attach (name_hbox, 0, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 3, 0);
|
||||
controls_table.show_all ();
|
||||
controls_table.set_no_show_all ();
|
||||
|
||||
|
|
@ -146,6 +146,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie
|
|||
|
||||
controls_frame.add (controls_hbox);
|
||||
controls_frame.set_name ("TimeAxisViewControlsBaseUnselected");
|
||||
controls_vbox.set_name ("TimeAxisViewControlsBaseUnselected");
|
||||
controls_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
|
||||
|
||||
ColorsChanged.connect (mem_fun (*this, &TimeAxisView::color_handler));
|
||||
|
|
@ -562,7 +563,7 @@ TimeAxisView::set_selected (bool yn)
|
|||
if (_selected) {
|
||||
controls_ebox.set_name (controls_base_selected_name);
|
||||
controls_frame.set_name (controls_base_selected_name);
|
||||
|
||||
controls_vbox.set_name (controls_base_selected_name);
|
||||
/* propagate any existing selection, if the mode is right */
|
||||
|
||||
if (editor.current_mouse_mode() == Editing::MouseRange && !editor.get_selection().time.empty()) {
|
||||
|
|
@ -572,7 +573,7 @@ TimeAxisView::set_selected (bool yn)
|
|||
} else {
|
||||
controls_ebox.set_name (controls_base_unselected_name);
|
||||
controls_frame.set_name (controls_base_unselected_name);
|
||||
|
||||
controls_vbox.set_name (controls_base_unselected_name);
|
||||
hide_selection ();
|
||||
|
||||
/* children will be set for the yn=true case. but when deselecting
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace Gtkmm2ext {
|
|||
|
||||
class PixFader : public Gtk::DrawingArea {
|
||||
public:
|
||||
PixFader (Glib::RefPtr<Gdk::Pixbuf> belt_image, Gtk::Adjustment& adjustment);
|
||||
PixFader (Glib::RefPtr<Gdk::Pixbuf> belt_image, Gtk::Adjustment& adjustment, int orientation);
|
||||
virtual ~PixFader ();
|
||||
|
||||
protected:
|
||||
|
|
@ -44,23 +44,29 @@ class PixFader : public Gtk::DrawingArea {
|
|||
bool on_motion_notify_event (GdkEventMotion*);
|
||||
bool on_scroll_event (GdkEventScroll* ev);
|
||||
|
||||
private:
|
||||
enum Orientation {
|
||||
VERT=1,
|
||||
HORIZ=2,
|
||||
};
|
||||
|
||||
private:
|
||||
Glib::RefPtr<Gdk::Pixbuf> pixbuf;
|
||||
gint pixheight;
|
||||
int span, girth;
|
||||
int _orien;
|
||||
|
||||
GdkRectangle view;
|
||||
|
||||
GdkWindow* grab_window;
|
||||
double grab_y;
|
||||
double grab_loc;
|
||||
double grab_start;
|
||||
int last_drawn;
|
||||
bool dragging;
|
||||
float default_value;
|
||||
int unity_y;
|
||||
int unity_loc;
|
||||
|
||||
void adjustment_changed ();
|
||||
|
||||
int display_height ();
|
||||
int display_span ();
|
||||
|
||||
static int fine_scale_modifier;
|
||||
static int extra_fine_scale_modifier;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class SliderController : public Gtkmm2ext::PixFader
|
|||
{
|
||||
public:
|
||||
SliderController (Glib::RefPtr<Gdk::Pixbuf> image,
|
||||
Gtk::Adjustment* adj,
|
||||
Gtk::Adjustment* adj, int orientation,
|
||||
PBD::Controllable&,
|
||||
bool with_numeric = true);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,21 +35,28 @@ int PixFader::fine_scale_modifier = GDK_CONTROL_MASK;
|
|||
|
||||
int PixFader::extra_fine_scale_modifier = GDK_MOD1_MASK;
|
||||
|
||||
PixFader::PixFader (Glib::RefPtr<Pixbuf> belt, Gtk::Adjustment& adj)
|
||||
PixFader::PixFader (Glib::RefPtr<Pixbuf> belt, Gtk::Adjustment& adj, int orientation)
|
||||
|
||||
: adjustment (adj),
|
||||
pixbuf (belt)
|
||||
pixbuf (belt),
|
||||
_orien(orientation)
|
||||
{
|
||||
dragging = false;
|
||||
default_value = adjustment.get_value();
|
||||
last_drawn = -1;
|
||||
pixheight = pixbuf->get_height();
|
||||
|
||||
view.x = 0;
|
||||
view.y = 0;
|
||||
view.width = pixbuf->get_width();
|
||||
view.height = pixheight / 2;
|
||||
|
||||
unity_y = (int) rint (view.height - (default_value * view.height)) - 1;
|
||||
if (orientation == 1) {
|
||||
view.width = girth = pixbuf->get_width();
|
||||
view.height = span = pixbuf->get_height() / 2;
|
||||
unity_loc = (int) rint (view.height - (default_value * view.height)) - 1;
|
||||
} else {
|
||||
view.width = span = pixbuf->get_width () / 2;
|
||||
view.height = girth = pixbuf->get_height();
|
||||
unity_loc = (int) rint (default_value * view.width) - 1;
|
||||
}
|
||||
|
||||
add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
|
||||
|
||||
|
|
@ -65,28 +72,37 @@ bool
|
|||
PixFader::on_expose_event (GdkEventExpose* ev)
|
||||
{
|
||||
GdkRectangle intersection;
|
||||
int dh = display_height ();
|
||||
int offset_into_pixbuf = (int) floor (view.height / ((float) view.height / dh));
|
||||
int srcx, srcy, ds = display_span ();
|
||||
int offset_into_pixbuf = (int) floor (span / ((float) span / ds));
|
||||
Glib::RefPtr<Gdk::GC> fg_gc (get_style()->get_fg_gc(get_state()));
|
||||
|
||||
if (gdk_rectangle_intersect (&view, &ev->area, &intersection)) {
|
||||
if (_orien == VERT) {
|
||||
srcx = intersection.x;
|
||||
srcy = offset_into_pixbuf + intersection.y;
|
||||
} else {
|
||||
srcx = offset_into_pixbuf + intersection.x;
|
||||
srcy = intersection.y;
|
||||
}
|
||||
get_window()->draw_pixbuf (fg_gc, pixbuf,
|
||||
intersection.x, offset_into_pixbuf + intersection.y,
|
||||
srcx, srcy,
|
||||
intersection.x, intersection.y,
|
||||
intersection.width, intersection.height,
|
||||
Gdk::RGB_DITHER_NONE, 0, 0);
|
||||
|
||||
get_window()->draw_line (get_style()->get_bg_gc(STATE_ACTIVE), 0, 0, view.width - 1, 0); /* top */
|
||||
get_window()->draw_line (get_style()->get_bg_gc(STATE_ACTIVE), 0, 0, view.width - 1, 0); /* top */
|
||||
get_window()->draw_line (get_style()->get_bg_gc(STATE_ACTIVE), 0, 0, 0, view.height - 1); /* left */
|
||||
get_window()->draw_line (get_style()->get_bg_gc(STATE_NORMAL), view.width - 1, 0, view.width - 1, view.height - 1); /* right */
|
||||
get_window()->draw_line (get_style()->get_bg_gc(STATE_NORMAL), 0, view.height - 1, view.width - 1, view.height - 1); /* bottom */
|
||||
}
|
||||
|
||||
/* always draw the line */
|
||||
|
||||
get_window()->draw_line (fg_gc, 1, unity_y, view.width - 2, unity_y);
|
||||
|
||||
last_drawn = dh;
|
||||
if (_orien == VERT) {
|
||||
get_window()->draw_line (fg_gc, 1, unity_loc, girth - 2, unity_loc);
|
||||
} else {
|
||||
get_window()->draw_line (fg_gc, unity_loc, 1, unity_loc, girth - 2);
|
||||
}
|
||||
last_drawn = ds;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -104,8 +120,8 @@ PixFader::on_button_press_event (GdkEventButton* ev)
|
|||
case 1:
|
||||
case 2:
|
||||
add_modal_grab();
|
||||
grab_y = ev->y;
|
||||
grab_start = ev->y;
|
||||
grab_loc = (_orien == VERT) ? ev->y : ev->x;
|
||||
grab_start = (_orien == VERT) ? ev->y : ev->x;
|
||||
grab_window = ev->window;
|
||||
dragging = true;
|
||||
break;
|
||||
|
|
@ -120,15 +136,17 @@ PixFader::on_button_press_event (GdkEventButton* ev)
|
|||
bool
|
||||
PixFader::on_button_release_event (GdkEventButton* ev)
|
||||
{
|
||||
double fract;
|
||||
|
||||
double fract, ev_pos;
|
||||
|
||||
(_orien == VERT) ? ev_pos = ev->y : ev->x;
|
||||
|
||||
switch (ev->button) {
|
||||
case 1:
|
||||
if (dragging) {
|
||||
remove_modal_grab();
|
||||
dragging = false;
|
||||
|
||||
if (ev->y == grab_start) {
|
||||
if (ev_pos == grab_start) {
|
||||
|
||||
/* no motion - just a click */
|
||||
|
||||
|
|
@ -136,7 +154,7 @@ PixFader::on_button_release_event (GdkEventButton* ev)
|
|||
adjustment.set_value (default_value);
|
||||
} else if (ev->state & fine_scale_modifier) {
|
||||
adjustment.set_value (adjustment.get_lower());
|
||||
} else if (ev->y < view.height - display_height()) {
|
||||
} else if (ev_pos < span - display_span()) {
|
||||
/* above the current display height, remember X Window coords */
|
||||
adjustment.set_value (adjustment.get_value() + adjustment.get_step_increment());
|
||||
} else {
|
||||
|
|
@ -152,7 +170,7 @@ PixFader::on_button_release_event (GdkEventButton* ev)
|
|||
remove_modal_grab();
|
||||
dragging = false;
|
||||
|
||||
fract = 1.0 - (ev->y / view.height); // inverted X Window coordinates, grrr
|
||||
fract = 1.0 - (ev_pos / span); // inverted X Window coordinates, grrr
|
||||
|
||||
fract = min (1.0, fract);
|
||||
fract = max (0.0, fract);
|
||||
|
|
@ -183,18 +201,34 @@ PixFader::on_scroll_event (GdkEventScroll* ev)
|
|||
scale = 0.25;
|
||||
}
|
||||
|
||||
switch (ev->direction) {
|
||||
if (_orien == VERT) {
|
||||
switch (ev->direction) {
|
||||
|
||||
case GDK_SCROLL_UP:
|
||||
/* wheel up */
|
||||
adjustment.set_value (adjustment.get_value() + (adjustment.get_page_increment() * scale));
|
||||
break;
|
||||
case GDK_SCROLL_DOWN:
|
||||
/* wheel down */
|
||||
adjustment.set_value (adjustment.get_value() - (adjustment.get_page_increment() * scale));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case GDK_SCROLL_UP:
|
||||
/* wheel up */
|
||||
adjustment.set_value (adjustment.get_value() + (adjustment.get_page_increment() * scale));
|
||||
break;
|
||||
case GDK_SCROLL_DOWN:
|
||||
/* wheel down */
|
||||
adjustment.set_value (adjustment.get_value() - (adjustment.get_page_increment() * scale));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (ev->direction) {
|
||||
|
||||
case GDK_SCROLL_RIGHT:
|
||||
/* wheel right */
|
||||
adjustment.set_value (adjustment.get_value() + (adjustment.get_page_increment() * scale));
|
||||
break;
|
||||
case GDK_SCROLL_LEFT:
|
||||
/* wheel left */
|
||||
adjustment.set_value (adjustment.get_value() - (adjustment.get_page_increment() * scale));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -203,12 +237,11 @@ bool
|
|||
PixFader::on_motion_notify_event (GdkEventMotion* ev)
|
||||
{
|
||||
if (dragging) {
|
||||
double fract;
|
||||
double delta;
|
||||
double scale;
|
||||
|
||||
double fract, delta, scale, ev_pos;
|
||||
(_orien == VERT) ? ev_pos = ev->y : ev_pos = ev->x;
|
||||
cerr << "PixFader::on_motion_notify_event() called x:y = " << ev->x << ":" << ev->y;
|
||||
if (ev->window != grab_window) {
|
||||
grab_y = ev->y;
|
||||
grab_loc = ev_pos;
|
||||
grab_window = ev->window;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -222,20 +255,23 @@ PixFader::on_motion_notify_event (GdkEventMotion* ev)
|
|||
} else {
|
||||
scale = 1.0;
|
||||
}
|
||||
cerr << " ev_pos=" << ev_pos << " grab_loc=" << grab_loc;
|
||||
delta = ev_pos - grab_loc;
|
||||
grab_loc = ev_pos;
|
||||
|
||||
delta = ev->y - grab_y;
|
||||
grab_y = ev->y;
|
||||
|
||||
fract = (delta / view.height);
|
||||
fract = (delta / span);
|
||||
|
||||
fract = min (1.0, fract);
|
||||
fract = max (-1.0, fract);
|
||||
|
||||
// X Window is top->bottom for 0..Y
|
||||
|
||||
fract = -fract;
|
||||
if (_orien == VERT) {
|
||||
fract = -fract;
|
||||
}
|
||||
|
||||
adjustment.set_value (adjustment.get_value() + scale * fract * (adjustment.get_upper() - adjustment.get_lower()));
|
||||
cerr << " adj=" << adjustment.get_value() << " fract=" << fract << " delta=" << delta << " scale=" << scale << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -244,14 +280,15 @@ PixFader::on_motion_notify_event (GdkEventMotion* ev)
|
|||
void
|
||||
PixFader::adjustment_changed ()
|
||||
{
|
||||
if (display_height() != last_drawn) {
|
||||
if (display_span() != last_drawn) {
|
||||
queue_draw ();
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
PixFader::display_height ()
|
||||
PixFader::display_span ()
|
||||
{
|
||||
float fract = (adjustment.get_upper() - adjustment.get_value ()) / ((adjustment.get_upper() - adjustment.get_lower()));
|
||||
return (int) floor (view.height * (1.0 - fract));
|
||||
return (_orien == VERT) ? (int)floor (span * (1.0 - fract)) : (int)floor (span * fract);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@ using namespace Gtkmm2ext;
|
|||
using namespace PBD;
|
||||
|
||||
SliderController::SliderController (Glib::RefPtr<Gdk::Pixbuf> image,
|
||||
Gtk::Adjustment *adj,
|
||||
Gtk::Adjustment *adj, int orientation,
|
||||
Controllable& c,
|
||||
bool with_numeric)
|
||||
|
||||
: PixFader (image, *adj),
|
||||
: PixFader (image, *adj, orientation),
|
||||
binding_proxy (c),
|
||||
spin (*adj, 0, 2)
|
||||
{
|
||||
|
|
@ -63,7 +63,7 @@ VSliderController::VSliderController (Glib::RefPtr<Gdk::Pixbuf> image,
|
|||
Controllable& control,
|
||||
bool with_numeric)
|
||||
|
||||
: SliderController (image, adj, control, with_numeric)
|
||||
: SliderController (image, adj, VERT, control, with_numeric)
|
||||
{
|
||||
if (with_numeric) {
|
||||
spin_frame.add (spin);
|
||||
|
|
@ -79,7 +79,7 @@ HSliderController::HSliderController (Glib::RefPtr<Gdk::Pixbuf> image,
|
|||
Controllable& control,
|
||||
bool with_numeric)
|
||||
|
||||
: SliderController (image, adj, control, with_numeric)
|
||||
: SliderController (image, adj, HORIZ, control, with_numeric)
|
||||
{
|
||||
if (with_numeric) {
|
||||
spin_frame.add (spin);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue