mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-04 12:45:45 +01:00
fix #1394 - The 'narrow strip' option in the mixer does not take extra width into account; involved some nice cleanup of width handling in mixer strips etc.
git-svn-id: svn://localhost/ardour2/trunk@1526 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
ad55d36c56
commit
e1957a3166
11 changed files with 72 additions and 81 deletions
|
|
@ -3321,7 +3321,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
}
|
||||
}
|
||||
|
||||
rv->region()->set_opaque(false);
|
||||
rv->fake_set_opaque (false);
|
||||
}
|
||||
|
||||
if (drag_info.brushing) {
|
||||
|
|
@ -3431,7 +3431,7 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
|
|||
TimeAxisView* tvp2 = trackview_by_y_position (iy1);
|
||||
AudioTimeAxisView* atv2 = dynamic_cast<AudioTimeAxisView*>(tvp2);
|
||||
|
||||
(*i)->region()->set_opaque (true);
|
||||
(*i)->fake_set_opaque (true);
|
||||
|
||||
from_playlist = (*i)->region()->playlist();
|
||||
to_playlist = atv2->playlist();
|
||||
|
|
@ -3525,7 +3525,7 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
|
|||
/* no need to add an undo here, we did that when we added this playlist to motion_frozen playlists */
|
||||
|
||||
rv->region()->set_position (where, (void *) this);
|
||||
rv->region()->set_opaque (true);
|
||||
rv->fake_set_opaque (true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4101,7 +4101,7 @@ Editor::trim_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
begin_reversible_command (trim_type);
|
||||
|
||||
for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) {
|
||||
(*i)->region()->set_opaque(false);
|
||||
(*i)->fake_set_opaque(false);
|
||||
(*i)->region()->freeze ();
|
||||
|
||||
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
|
||||
|
|
@ -4296,7 +4296,7 @@ Editor::trim_finished_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
i != selection->regions.by_layer().end(); ++i)
|
||||
{
|
||||
thaw_region_after_trim (**i);
|
||||
(*i)->region()->set_opaque(true);
|
||||
(*i)->fake_set_opaque (true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -447,6 +447,14 @@ GainMeter::setup_meters ()
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
GainMeter::get_gm_width ()
|
||||
{
|
||||
Gtk::Requisition sz;
|
||||
hbox.size_request (sz);
|
||||
return sz.width;
|
||||
}
|
||||
|
||||
bool
|
||||
GainMeter::gain_key_press (GdkEventKey* ev)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ class GainMeter : public Gtk::VBox
|
|||
void set_width (Width);
|
||||
void setup_meters ();
|
||||
|
||||
int get_gm_width ();
|
||||
|
||||
void set_meter_strip_name (const char * name);
|
||||
void set_fader_name (const char * name);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
|
||||
#include <sigc++/bind.h>
|
||||
|
||||
|
|
@ -62,6 +63,7 @@ using namespace ARDOUR;
|
|||
using namespace PBD;
|
||||
using namespace Gtk;
|
||||
using namespace Gtkmm2ext;
|
||||
using namespace std;
|
||||
|
||||
int MixerStrip::scrollbar_height = 0;
|
||||
|
||||
|
|
@ -439,7 +441,6 @@ MixerStrip::set_width (Width w)
|
|||
break;
|
||||
|
||||
case Narrow:
|
||||
set_size_request (50, -1);
|
||||
xml_node->add_property ("strip_width", "narrow");
|
||||
|
||||
if (rec_enable_button) {
|
||||
|
|
@ -461,6 +462,7 @@ MixerStrip::set_width (Width w)
|
|||
((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style()));
|
||||
((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state()));
|
||||
Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2);
|
||||
set_size_request (max (50, gpm.get_gm_width()), -1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ Panner2d::Target::~Target ()
|
|||
}
|
||||
}
|
||||
|
||||
Panner2d::Panner2d (Panner& p, int32_t w, int32_t h)
|
||||
: panner (p), width (w), height (h)
|
||||
Panner2d::Panner2d (Panner& p, int32_t h)
|
||||
: panner (p), width (0), height (h)
|
||||
{
|
||||
context_menu = 0;
|
||||
bypass_menu_item = 0;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace Pango {
|
|||
class Panner2d : public Gtk::DrawingArea
|
||||
{
|
||||
public:
|
||||
Panner2d (ARDOUR::Panner&, int32_t width, int32_t height);
|
||||
Panner2d (ARDOUR::Panner&, int32_t height);
|
||||
~Panner2d ();
|
||||
|
||||
int puck_position (int which_puck, float& x, float& y);
|
||||
|
|
|
|||
|
|
@ -73,8 +73,7 @@ PannerUI::PannerUI (boost::shared_ptr<IO> io, Session& s)
|
|||
//set_size_request_to_display_given_text (pan_automation_style_button, X_("0"), 2, 2);
|
||||
|
||||
pan_bar_packer.set_size_request (-1, 61);
|
||||
panning_viewport.set_size_request (64, 61);
|
||||
|
||||
panning_viewport.set_size_request (-1, 61);
|
||||
panning_viewport.set_name (X_("BaseFrame"));
|
||||
|
||||
ARDOUR_UI::instance()->tooltips().set_tip (panning_link_button,
|
||||
|
|
@ -137,7 +136,7 @@ PannerUI::PannerUI (boost::shared_ptr<IO> io, Session& s)
|
|||
pan_vbox.pack_start (panning_viewport, Gtk::PACK_SHRINK);
|
||||
pan_vbox.pack_start (panning_link_box, Gtk::PACK_SHRINK);
|
||||
|
||||
pack_start (pan_vbox, true, false);
|
||||
pack_start (pan_vbox, true, true);
|
||||
|
||||
panner = 0;
|
||||
|
||||
|
|
@ -215,23 +214,9 @@ PannerUI::set_width (Width w)
|
|||
{
|
||||
switch (w) {
|
||||
case Wide:
|
||||
panning_viewport.set_size_request (64, 61);
|
||||
if (panner) {
|
||||
panner->set_size_request (63, 61);
|
||||
}
|
||||
for (vector<PannerBar*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
|
||||
(*i)->set_size_request (63, pan_bar_height);
|
||||
}
|
||||
panning_link_button.set_label (_("link"));
|
||||
break;
|
||||
case Narrow:
|
||||
panning_viewport.set_size_request (34, 61);
|
||||
if (panner) {
|
||||
panner->set_size_request (33, 61);
|
||||
}
|
||||
for (vector<PannerBar*>::iterator i = pan_bars.begin(); i != pan_bars.end(); ++i) {
|
||||
(*i)->set_size_request (33, pan_bar_height);
|
||||
}
|
||||
panning_link_button.set_label (_("L"));
|
||||
break;
|
||||
}
|
||||
|
|
@ -344,16 +329,9 @@ PannerUI::setup_pan ()
|
|||
bc->event_widget().signal_button_release_event().connect
|
||||
(bind (mem_fun(*this, &PannerUI::pan_button_event), (uint32_t) asz));
|
||||
|
||||
pan_bars.push_back (bc);
|
||||
switch (_width) {
|
||||
case Wide:
|
||||
bc->set_size_request (63, pan_bar_height);
|
||||
break;
|
||||
case Narrow:
|
||||
bc->set_size_request (33, pan_bar_height);
|
||||
break;
|
||||
}
|
||||
bc->set_size_request (-1, pan_bar_height);
|
||||
|
||||
pan_bars.push_back (bc);
|
||||
pan_bar_packer.pack_start (*bc, false, false);
|
||||
}
|
||||
|
||||
|
|
@ -370,26 +348,15 @@ PannerUI::setup_pan ()
|
|||
|
||||
} else {
|
||||
|
||||
int w = 0;
|
||||
|
||||
switch (_width) {
|
||||
case Wide:
|
||||
w = 63;
|
||||
break;
|
||||
case Narrow:
|
||||
w = 33;
|
||||
break;
|
||||
}
|
||||
|
||||
if (panner == 0) {
|
||||
panner = new Panner2d (_io->panner(), w, 61);
|
||||
panner = new Panner2d (_io->panner(), 61);
|
||||
panner->set_name ("MixerPanZone");
|
||||
panner->show ();
|
||||
}
|
||||
|
||||
update_pan_sensitive ();
|
||||
panner->reset (_io->n_inputs());
|
||||
panner->set_size_request (w, 61);
|
||||
panner->set_size_request (-1, 61);
|
||||
|
||||
/* and finally, add it to the panner frame */
|
||||
|
||||
|
|
|
|||
|
|
@ -366,6 +366,18 @@ RegionView::set_frame_color ()
|
|||
TimeAxisViewItem::set_frame_color ();
|
||||
}
|
||||
|
||||
void
|
||||
RegionView::fake_set_opaque (bool yn)
|
||||
{
|
||||
if (yn) {
|
||||
fill_opacity = 130;
|
||||
} else {
|
||||
fill_opacity = 60;
|
||||
}
|
||||
|
||||
TimeAxisViewItem::set_frame_color ();
|
||||
}
|
||||
|
||||
void
|
||||
RegionView::hide_region_editor()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ class RegionView : public TimeAxisViewItem
|
|||
void lower_to_bottom ();
|
||||
|
||||
bool set_position(nframes_t pos, void* src, double* delta = 0);
|
||||
void fake_set_opaque (bool yn);
|
||||
|
||||
virtual void show_region_editor () = 0;
|
||||
virtual void hide_region_editor();
|
||||
|
|
@ -82,7 +83,7 @@ class RegionView : public TimeAxisViewItem
|
|||
virtual void entered () {}
|
||||
virtual void exited () {}
|
||||
|
||||
static sigc::signal<void,RegionView*> RegionViewGoingAway;
|
||||
static sigc::signal<void,RegionView*> RegionViewGoingAway;
|
||||
sigc::signal<void> GoingAway;
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -57,11 +57,10 @@ FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o)
|
|||
pixrect.x = 0;
|
||||
pixrect.y = 0;
|
||||
|
||||
|
||||
if (orientation == Vertical) {
|
||||
pixbuf = request_vertical_meter(250);
|
||||
pixbuf = request_vertical_meter(dimen, 250);
|
||||
} else {
|
||||
pixbuf = request_horizontal_meter(186);
|
||||
pixbuf = request_horizontal_meter(186, dimen);
|
||||
}
|
||||
|
||||
pixheight = pixbuf->get_height();
|
||||
|
|
@ -79,14 +78,14 @@ FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o)
|
|||
request_height= pixrect.height;
|
||||
}
|
||||
|
||||
Glib::RefPtr<Gdk::Pixbuf> FastMeter::request_vertical_meter(int length)
|
||||
Glib::RefPtr<Gdk::Pixbuf> FastMeter::request_vertical_meter(int width, int height)
|
||||
{
|
||||
if (length < min_v_pixbuf_size)
|
||||
length = min_v_pixbuf_size;
|
||||
if (length > max_v_pixbuf_size)
|
||||
length = max_v_pixbuf_size;
|
||||
if (height < min_v_pixbuf_size)
|
||||
height = min_v_pixbuf_size;
|
||||
if (height > max_v_pixbuf_size)
|
||||
height = max_v_pixbuf_size;
|
||||
|
||||
int index = length - 1;
|
||||
int index = height - 1;
|
||||
|
||||
if (v_pixbuf_cache == 0) {
|
||||
v_pixbuf_cache = (Glib::RefPtr<Gdk::Pixbuf>*) malloc(sizeof(Glib::RefPtr<Gdk::Pixbuf>) * max_v_pixbuf_size);
|
||||
|
|
@ -97,8 +96,6 @@ Glib::RefPtr<Gdk::Pixbuf> FastMeter::request_vertical_meter(int length)
|
|||
return ret;
|
||||
|
||||
guint8* data;
|
||||
int width = 5;
|
||||
int height = length;
|
||||
|
||||
data = (guint8*) malloc(width*height * 3);
|
||||
|
||||
|
|
@ -155,15 +152,15 @@ Glib::RefPtr<Gdk::Pixbuf> FastMeter::request_vertical_meter(int length)
|
|||
return ret;
|
||||
}
|
||||
|
||||
Glib::RefPtr<Gdk::Pixbuf> FastMeter::request_horizontal_meter(int length)
|
||||
Glib::RefPtr<Gdk::Pixbuf> FastMeter::request_horizontal_meter(int width, int height)
|
||||
{
|
||||
if (length < min_h_pixbuf_size)
|
||||
length = min_h_pixbuf_size;
|
||||
if (length > max_h_pixbuf_size)
|
||||
length = max_h_pixbuf_size;
|
||||
if (width < min_h_pixbuf_size)
|
||||
width = min_h_pixbuf_size;
|
||||
if (width > max_h_pixbuf_size)
|
||||
width = max_h_pixbuf_size;
|
||||
|
||||
int index = width - 1;
|
||||
|
||||
int index = length - 1;
|
||||
|
||||
if (h_pixbuf_cache == 0) {
|
||||
h_pixbuf_cache = (Glib::RefPtr<Gdk::Pixbuf>*) malloc(sizeof(Glib::RefPtr<Gdk::Pixbuf>) * max_h_pixbuf_size);
|
||||
memset(h_pixbuf_cache,0,sizeof(Glib::RefPtr<Gdk::Pixbuf>) * max_h_pixbuf_size);
|
||||
|
|
@ -173,8 +170,6 @@ Glib::RefPtr<Gdk::Pixbuf> FastMeter::request_horizontal_meter(int length)
|
|||
return ret;
|
||||
|
||||
guint8* data;
|
||||
int width = length;
|
||||
int height = 5;
|
||||
|
||||
data = (guint8*) malloc(width*height * 3);
|
||||
|
||||
|
|
@ -253,19 +248,20 @@ void
|
|||
FastMeter::on_size_request (GtkRequisition* req)
|
||||
{
|
||||
if (orientation == Vertical) {
|
||||
|
||||
req->height = request_height;
|
||||
|
||||
req->height = max(req->height, min_v_pixbuf_size);
|
||||
req->height = min(req->height, max_v_pixbuf_size);
|
||||
|
||||
req->width = 5;
|
||||
} else {
|
||||
req->width = request_width;
|
||||
|
||||
} else {
|
||||
|
||||
req->width = request_width;
|
||||
req->width = max(req->width, min_h_pixbuf_size);
|
||||
req->width = min(req->width, max_h_pixbuf_size);
|
||||
|
||||
req->height = 5;
|
||||
req->height = request_height;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -274,8 +270,9 @@ void
|
|||
FastMeter::on_size_allocate (Gtk::Allocation &alloc)
|
||||
{
|
||||
if (orientation == Vertical) {
|
||||
if (alloc.get_width() != 5) {
|
||||
alloc.set_width(5);
|
||||
|
||||
if (alloc.get_width() != request_width) {
|
||||
alloc.set_width (request_width);
|
||||
}
|
||||
|
||||
int h = alloc.get_height();
|
||||
|
|
@ -286,11 +283,13 @@ FastMeter::on_size_allocate (Gtk::Allocation &alloc)
|
|||
alloc.set_height(h);
|
||||
|
||||
if (pixheight != h) {
|
||||
pixbuf = request_vertical_meter(h);
|
||||
pixbuf = request_vertical_meter(request_width, h);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (alloc.get_height() != 5) {
|
||||
alloc.set_height(5);
|
||||
|
||||
if (alloc.get_height() != request_height) {
|
||||
alloc.set_height(request_height);
|
||||
}
|
||||
|
||||
int w = alloc.get_width();
|
||||
|
|
@ -301,7 +300,7 @@ FastMeter::on_size_allocate (Gtk::Allocation &alloc)
|
|||
alloc.set_width(w);
|
||||
|
||||
if (pixwidth != w) {
|
||||
pixbuf = request_horizontal_meter(w);
|
||||
pixbuf = request_horizontal_meter(w, request_height);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,13 +70,13 @@ class FastMeter : public Gtk::DrawingArea {
|
|||
bool vertical_expose (GdkEventExpose*);
|
||||
bool horizontal_expose (GdkEventExpose*);
|
||||
|
||||
static Glib::RefPtr<Gdk::Pixbuf> request_vertical_meter(int);
|
||||
static Glib::RefPtr<Gdk::Pixbuf> request_vertical_meter(int w, int h);
|
||||
|
||||
static Glib::RefPtr<Gdk::Pixbuf> *v_pixbuf_cache;
|
||||
static int min_v_pixbuf_size;
|
||||
static int max_v_pixbuf_size;
|
||||
|
||||
static Glib::RefPtr<Gdk::Pixbuf> request_horizontal_meter(int);
|
||||
static Glib::RefPtr<Gdk::Pixbuf> request_horizontal_meter(int w, int h);
|
||||
|
||||
static Glib::RefPtr<Gdk::Pixbuf> *h_pixbuf_cache;
|
||||
static int min_h_pixbuf_size;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue