mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
new GUIs for stereo panners
git-svn-id: svn://localhost/ardour2/trunk@1236 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
99e92a1172
commit
f66a09c344
8 changed files with 166 additions and 21 deletions
|
|
@ -167,6 +167,7 @@ new_session_dialog.cc
|
||||||
option_editor.cc
|
option_editor.cc
|
||||||
opts.cc
|
opts.cc
|
||||||
pan_automation_time_axis.cc
|
pan_automation_time_axis.cc
|
||||||
|
panner.cc
|
||||||
panner2d.cc
|
panner2d.cc
|
||||||
panner_ui.cc
|
panner_ui.cc
|
||||||
playlist_selector.cc
|
playlist_selector.cc
|
||||||
|
|
|
||||||
|
|
@ -968,6 +968,15 @@ style "pan_slider"
|
||||||
text[INSENSITIVE] = { 0.70, 0.70, 0.70 }
|
text[INSENSITIVE] = { 0.70, 0.70, 0.70 }
|
||||||
text[SELECTED] = { 0.70, 0.70, 0.70 }
|
text[SELECTED] = { 0.70, 0.70, 0.70 }
|
||||||
text[PRELIGHT] = { 0.70, 0.70, 0.70 }
|
text[PRELIGHT] = { 0.70, 0.70, 0.70 }
|
||||||
|
|
||||||
|
# used to draw the triangular indicators
|
||||||
|
|
||||||
|
base[NORMAL] = { 0.93, 0.94, 0.71 }
|
||||||
|
base[ACTIVE] = {0.93, 0.94, 0.71 }
|
||||||
|
base[INSENSITIVE] = {0.32, 0.39, 0.45 } # matches default_base
|
||||||
|
base[SELECTED] = { 0.93, 0.94, 0.71 }
|
||||||
|
base[PRELIGHT] = { 0.93, 0.94, 0.71 }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
style "region_list_whole_file"
|
style "region_list_whole_file"
|
||||||
|
|
|
||||||
113
gtk2_ardour/panner.cc
Normal file
113
gtk2_ardour/panner.cc
Normal file
|
|
@ -0,0 +1,113 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "panner.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
static const int triangle_size = 9;
|
||||||
|
|
||||||
|
static void
|
||||||
|
null_label_callback (char* buf, unsigned int bufsize)
|
||||||
|
{
|
||||||
|
/* no label */
|
||||||
|
|
||||||
|
buf[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PannerBar::PannerBar (Gtk::Adjustment& adj, PBD::Controllable& c)
|
||||||
|
: BarController (adj, c, sigc::ptr_fun (null_label_callback))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PannerBar::~PannerBar ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PannerBar::expose (GdkEventExpose* ev)
|
||||||
|
{
|
||||||
|
Glib::RefPtr<Gdk::Window> win (darea.get_window());
|
||||||
|
Glib::RefPtr<Gdk::GC> gc (get_style()->get_base_gc (get_state()));
|
||||||
|
|
||||||
|
BarController::expose (ev);
|
||||||
|
|
||||||
|
/* now draw triangles for left, right and center */
|
||||||
|
|
||||||
|
GdkPoint points[3];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
points[0].x = 0;
|
||||||
|
points[0].y = 0;
|
||||||
|
|
||||||
|
points[1].x = triangle_size;
|
||||||
|
points[1].y = 0;
|
||||||
|
|
||||||
|
points[2].x = 0;
|
||||||
|
points[2].y = triangle_size;
|
||||||
|
|
||||||
|
gdk_draw_polygon (win->gobj(), gc->gobj(), true, points, 3);
|
||||||
|
|
||||||
|
points[0].x = darea.get_width()/2 - (triangle_size - 2);
|
||||||
|
points[0].y = 0;
|
||||||
|
|
||||||
|
points[1].x = darea.get_width()/2 + (triangle_size - 2);
|
||||||
|
points[1].y = 0;
|
||||||
|
|
||||||
|
points[2].x = darea.get_width()/2;
|
||||||
|
points[2].y = triangle_size - 2;
|
||||||
|
|
||||||
|
gdk_draw_polygon (win->gobj(), gc->gobj(), true, points, 3);
|
||||||
|
|
||||||
|
points[0].x = darea.get_width() - triangle_size;
|
||||||
|
points[0].y = 0;
|
||||||
|
|
||||||
|
points[1].x = darea.get_width();
|
||||||
|
points[1].y = 0;
|
||||||
|
|
||||||
|
points[2].x = darea.get_width();
|
||||||
|
points[2].y = triangle_size;
|
||||||
|
|
||||||
|
gdk_draw_polygon (win->gobj(), gc->gobj(), true, points, 3);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PannerBar::button_press (GdkEventButton* ev)
|
||||||
|
{
|
||||||
|
if (ev->button == 1 && ev->type == GDK_BUTTON_PRESS && ev->y < 10) {
|
||||||
|
if (ev->x < triangle_size) {
|
||||||
|
return true;
|
||||||
|
} else if (ev->x > (darea.get_width() - triangle_size)) {
|
||||||
|
return true;
|
||||||
|
} else if (ev->x > (darea.get_width()/2 - triangle_size) &&
|
||||||
|
ev->x < (darea.get_width()/2 + triangle_size)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return BarController::button_press (ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PannerBar::button_release (GdkEventButton* ev)
|
||||||
|
{
|
||||||
|
if (ev->button == 1 && ev->type == GDK_BUTTON_RELEASE && ev->y < 10) {
|
||||||
|
if (ev->x < triangle_size) {
|
||||||
|
adjustment.set_value (adjustment.get_lower());
|
||||||
|
return true;
|
||||||
|
} else if (ev->x > (darea.get_width() - triangle_size)) {
|
||||||
|
adjustment.set_value (adjustment.get_upper());
|
||||||
|
return true;
|
||||||
|
} else if (ev->x > (darea.get_width()/2 - triangle_size) &&
|
||||||
|
ev->x < (darea.get_width()/2 + triangle_size)) {
|
||||||
|
adjustment.set_value (adjustment.get_lower() + ((adjustment.get_upper() - adjustment.get_lower()) / 2.0));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return BarController::button_release (ev);
|
||||||
|
}
|
||||||
18
gtk2_ardour/panner.h
Normal file
18
gtk2_ardour/panner.h
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
#ifndef __gtk_ardour_panner_h__
|
||||||
|
#define __gtk_ardour_panner_h__
|
||||||
|
|
||||||
|
#include <gtkmm2ext/barcontroller.h>
|
||||||
|
|
||||||
|
class PannerBar : public Gtkmm2ext::BarController
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PannerBar (Gtk::Adjustment& adj, PBD::Controllable&);
|
||||||
|
~PannerBar ();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool expose (GdkEventExpose*);
|
||||||
|
bool button_press (GdkEventButton*);
|
||||||
|
bool button_release (GdkEventButton*);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* __gtk_ardour_panner_h__ */
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
#include "panner_ui.h"
|
#include "panner_ui.h"
|
||||||
#include "panner2d.h"
|
#include "panner2d.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "panner.h"
|
||||||
#include "gui_thread.h"
|
#include "gui_thread.h"
|
||||||
|
|
||||||
#include <ardour/session.h>
|
#include <ardour/session.h>
|
||||||
|
|
@ -217,7 +218,7 @@ PannerUI::set_width (Width w)
|
||||||
if (panner) {
|
if (panner) {
|
||||||
panner->set_size_request (61, 61);
|
panner->set_size_request (61, 61);
|
||||||
}
|
}
|
||||||
for (vector<BarController*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
|
for (vector<PannerBar*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
|
||||||
(*i)->set_size_request (61, 15);
|
(*i)->set_size_request (61, 15);
|
||||||
}
|
}
|
||||||
panning_link_button.set_label (_("link"));
|
panning_link_button.set_label (_("link"));
|
||||||
|
|
@ -227,7 +228,7 @@ PannerUI::set_width (Width w)
|
||||||
if (panner) {
|
if (panner) {
|
||||||
panner->set_size_request (31, 61);
|
panner->set_size_request (31, 61);
|
||||||
}
|
}
|
||||||
for (vector<BarController*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
|
for (vector<PannerBar*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
|
||||||
(*i)->set_size_request (31, 15);
|
(*i)->set_size_request (31, 15);
|
||||||
}
|
}
|
||||||
panning_link_button.set_label (_("L"));
|
panning_link_button.set_label (_("L"));
|
||||||
|
|
@ -244,7 +245,7 @@ PannerUI::~PannerUI ()
|
||||||
delete (*i);
|
delete (*i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (vector<BarController*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
|
for (vector<PannerBar*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
|
||||||
delete (*i);
|
delete (*i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -302,7 +303,7 @@ PannerUI::setup_pan ()
|
||||||
while ((asz = pan_adjustments.size()) < npans) {
|
while ((asz = pan_adjustments.size()) < npans) {
|
||||||
|
|
||||||
float x;
|
float x;
|
||||||
BarController* bc;
|
PannerBar* bc;
|
||||||
|
|
||||||
/* initialize adjustment with current value of panner */
|
/* initialize adjustment with current value of panner */
|
||||||
|
|
||||||
|
|
@ -313,9 +314,7 @@ PannerUI::setup_pan ()
|
||||||
|
|
||||||
_io->panner()[asz]->Changed.connect (bind (mem_fun(*this, &PannerUI::pan_value_changed), (uint32_t) asz));
|
_io->panner()[asz]->Changed.connect (bind (mem_fun(*this, &PannerUI::pan_value_changed), (uint32_t) asz));
|
||||||
|
|
||||||
bc = new BarController (*pan_adjustments[asz],
|
bc = new PannerBar (*pan_adjustments[asz], _io->panner()[asz]->control());
|
||||||
_io->panner()[asz]->control(),
|
|
||||||
bind (mem_fun(*this, &PannerUI::pan_printer), pan_adjustments[asz]));
|
|
||||||
|
|
||||||
bc->set_name ("PanSlider");
|
bc->set_name ("PanSlider");
|
||||||
bc->set_shadow_type (Gtk::SHADOW_NONE);
|
bc->set_shadow_type (Gtk::SHADOW_NONE);
|
||||||
|
|
@ -341,7 +340,7 @@ PannerUI::setup_pan ()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pan_bar_packer.pack_start (*pan_bars.back(), false, false);
|
pan_bar_packer.pack_start (*pan_bars.back(), true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now that we actually have the pan bars,
|
/* now that we actually have the pan bars,
|
||||||
|
|
@ -631,7 +630,7 @@ PannerUI::update_pan_sensitive ()
|
||||||
case 1:
|
case 1:
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
for (vector<BarController*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
|
for (vector<PannerBar*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
|
||||||
(*i)->set_sensitive (sensitive);
|
(*i)->set_sensitive (sensitive);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@
|
||||||
#include "enums.h"
|
#include "enums.h"
|
||||||
|
|
||||||
class Panner2d;
|
class Panner2d;
|
||||||
|
class PannerBar;
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
class IO;
|
class IO;
|
||||||
|
|
@ -44,7 +45,6 @@ namespace ARDOUR {
|
||||||
}
|
}
|
||||||
namespace Gtkmm2ext {
|
namespace Gtkmm2ext {
|
||||||
class FastMeter;
|
class FastMeter;
|
||||||
class BarController;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Gtk {
|
namespace Gtk {
|
||||||
|
|
@ -107,7 +107,7 @@ class PannerUI : public Gtk::HBox
|
||||||
void panning_link_direction_clicked ();
|
void panning_link_direction_clicked ();
|
||||||
|
|
||||||
vector<Gtk::Adjustment*> pan_adjustments;
|
vector<Gtk::Adjustment*> pan_adjustments;
|
||||||
vector<Gtkmm2ext::BarController*> pan_bars;
|
vector<PannerBar*> pan_bars;
|
||||||
|
|
||||||
void pan_adjustment_changed (uint32_t which);
|
void pan_adjustment_changed (uint32_t which);
|
||||||
void pan_value_changed (uint32_t which);
|
void pan_value_changed (uint32_t which);
|
||||||
|
|
|
||||||
|
|
@ -456,3 +456,10 @@ BarController::set_use_parent (bool yn)
|
||||||
use_parent = yn;
|
use_parent = yn;
|
||||||
queue_draw ();
|
queue_draw ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BarController::set_sensitive (bool yn)
|
||||||
|
{
|
||||||
|
Frame::set_sensitive (yn);
|
||||||
|
darea.set_sensitive (yn);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,6 @@ class BarController : public Gtk::Frame
|
||||||
BarController (Gtk::Adjustment& adj, PBD::Controllable&, sigc::slot<void,char*,unsigned int>);
|
BarController (Gtk::Adjustment& adj, PBD::Controllable&, sigc::slot<void,char*,unsigned int>);
|
||||||
virtual ~BarController () {}
|
virtual ~BarController () {}
|
||||||
|
|
||||||
void set_sensitive (bool yn) {
|
|
||||||
darea.set_sensitive (yn);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Style {
|
enum Style {
|
||||||
LeftToRight,
|
LeftToRight,
|
||||||
RightToLeft,
|
RightToLeft,
|
||||||
|
|
@ -53,6 +49,8 @@ class BarController : public Gtk::Frame
|
||||||
void set_with_text (bool yn);
|
void set_with_text (bool yn);
|
||||||
void set_use_parent (bool yn);
|
void set_use_parent (bool yn);
|
||||||
|
|
||||||
|
void set_sensitive (bool yn);
|
||||||
|
|
||||||
Gtk::SpinButton& get_spin_button() { return spinner; }
|
Gtk::SpinButton& get_spin_button() { return spinner; }
|
||||||
|
|
||||||
sigc::signal<void> StartGesture;
|
sigc::signal<void> StartGesture;
|
||||||
|
|
@ -79,12 +77,12 @@ class BarController : public Gtk::Frame
|
||||||
Gtk::SpinButton spinner;
|
Gtk::SpinButton spinner;
|
||||||
bool use_parent;
|
bool use_parent;
|
||||||
|
|
||||||
bool button_press (GdkEventButton *);
|
virtual bool button_press (GdkEventButton *);
|
||||||
bool button_release (GdkEventButton *);
|
virtual bool button_release (GdkEventButton *);
|
||||||
bool motion (GdkEventMotion *);
|
virtual bool motion (GdkEventMotion *);
|
||||||
bool expose (GdkEventExpose *);
|
virtual bool expose (GdkEventExpose *);
|
||||||
bool scroll (GdkEventScroll *);
|
virtual bool scroll (GdkEventScroll *);
|
||||||
bool entry_focus_out (GdkEventFocus*);
|
virtual bool entry_focus_out (GdkEventFocus*);
|
||||||
|
|
||||||
gint mouse_control (double x, GdkWindow* w, double scaling);
|
gint mouse_control (double x, GdkWindow* w, double scaling);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue