mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
some rationalization of how global WaveView properties and per-WaveView properties interact
This commit is contained in:
parent
a74743f551
commit
81eed21dde
2 changed files with 75 additions and 30 deletions
|
|
@ -56,8 +56,6 @@ public:
|
||||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
|
|
||||||
void rebuild ();
|
|
||||||
|
|
||||||
void set_samples_per_pixel (double);
|
void set_samples_per_pixel (double);
|
||||||
void set_height (Distance);
|
void set_height (Distance);
|
||||||
void set_channel (int);
|
void set_channel (int);
|
||||||
|
|
@ -70,15 +68,22 @@ public:
|
||||||
void set_zero_color (Color);
|
void set_zero_color (Color);
|
||||||
void set_clip_color (Color);
|
void set_clip_color (Color);
|
||||||
void set_amplitude (double);
|
void set_amplitude (double);
|
||||||
double amplitude() const { return _amplitude; }
|
|
||||||
void set_logscaled (bool);
|
void set_logscaled (bool);
|
||||||
bool logscaled() const { return _logscaled; }
|
|
||||||
|
|
||||||
void set_shape (Shape);
|
void set_shape (Shape);
|
||||||
Shape shape() const;
|
double amplitude() const { return _amplitude; }
|
||||||
|
|
||||||
|
/* currently missing because we don't need them (yet):
|
||||||
|
set_shape_independent();
|
||||||
|
set_logscaled_independent()
|
||||||
|
*/
|
||||||
|
|
||||||
static void set_gradient_waveforms (bool);
|
static void set_gradient_waveforms (bool);
|
||||||
|
static void set_global_logscaled (bool);
|
||||||
|
static void set_global_shape (Shape);
|
||||||
|
|
||||||
static bool gradient_waveforms() { return _gradient_waveforms; }
|
static bool gradient_waveforms() { return _gradient_waveforms; }
|
||||||
|
static bool global_logscaled() { return _global_logscaled; }
|
||||||
|
static Shape global_shape() { return _global_shape; }
|
||||||
|
|
||||||
#ifdef CANVAS_COMPATIBILITY
|
#ifdef CANVAS_COMPATIBILITY
|
||||||
void*& property_gain_src () {
|
void*& property_gain_src () {
|
||||||
|
|
@ -143,10 +148,12 @@ private:
|
||||||
Color _wave_color;
|
Color _wave_color;
|
||||||
bool _show_zero;
|
bool _show_zero;
|
||||||
Color _zero_color;
|
Color _zero_color;
|
||||||
Shape _shape;
|
|
||||||
Color _clip_color;
|
Color _clip_color;
|
||||||
bool _logscaled;
|
bool _logscaled;
|
||||||
|
Shape _shape;
|
||||||
double _amplitude;
|
double _amplitude;
|
||||||
|
bool _shape_independent;
|
||||||
|
bool _logscaled_independent;
|
||||||
|
|
||||||
/** The `start' value to use for the region; we can't use the region's
|
/** The `start' value to use for the region; we can't use the region's
|
||||||
* value as the crossfade editor needs to alter it.
|
* value as the crossfade editor needs to alter it.
|
||||||
|
|
@ -158,7 +165,12 @@ private:
|
||||||
PBD::ScopedConnection invalidation_connection;
|
PBD::ScopedConnection invalidation_connection;
|
||||||
|
|
||||||
static bool _gradient_waveforms;
|
static bool _gradient_waveforms;
|
||||||
static PBD::Signal0<void> InvalidateAllImages;
|
static bool _global_logscaled;
|
||||||
|
static Shape _global_shape;
|
||||||
|
|
||||||
|
static PBD::Signal0<void> VisualPropertiesChanged;
|
||||||
|
|
||||||
|
void handle_visual_property_change ();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,10 @@ using namespace ARDOUR;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
bool WaveView::_gradient_waveforms = true;
|
bool WaveView::_gradient_waveforms = true;
|
||||||
PBD::Signal0<void> WaveView::InvalidateAllImages;
|
bool WaveView::_global_logscaled = false;
|
||||||
|
WaveView::Shape WaveView::_global_shape = WaveView::Normal;
|
||||||
|
|
||||||
|
PBD::Signal0<void> WaveView::VisualPropertiesChanged;
|
||||||
|
|
||||||
WaveView::WaveView (Group* parent, boost::shared_ptr<ARDOUR::AudioRegion> region)
|
WaveView::WaveView (Group* parent, boost::shared_ptr<ARDOUR::AudioRegion> region)
|
||||||
: Item (parent)
|
: Item (parent)
|
||||||
|
|
@ -54,20 +57,35 @@ WaveView::WaveView (Group* parent, boost::shared_ptr<ARDOUR::AudioRegion> region
|
||||||
, _wave_color (0xffffffff)
|
, _wave_color (0xffffffff)
|
||||||
, _show_zero (true)
|
, _show_zero (true)
|
||||||
, _zero_color (0xff0000ff)
|
, _zero_color (0xff0000ff)
|
||||||
, _shape (Normal)
|
|
||||||
, _clip_color (0xff0000ff)
|
, _clip_color (0xff0000ff)
|
||||||
, _logscaled (false)
|
, _logscaled (_global_logscaled)
|
||||||
|
, _shape (_global_shape)
|
||||||
, _amplitude (1.0)
|
, _amplitude (1.0)
|
||||||
|
, _shape_independent (false)
|
||||||
|
, _logscaled_independent (false)
|
||||||
, _region_start (0)
|
, _region_start (0)
|
||||||
{
|
{
|
||||||
InvalidateAllImages.connect_same_thread (invalidation_connection, boost::bind (&WaveView::rebuild, this));
|
VisualPropertiesChanged.connect_same_thread (invalidation_connection, boost::bind (&WaveView::handle_visual_property_change, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WaveView::rebuild ()
|
WaveView::handle_visual_property_change ()
|
||||||
{
|
{
|
||||||
|
bool changed = false;
|
||||||
|
|
||||||
|
if (!_shape_independent && (_shape != global_shape())) {
|
||||||
|
_shape = global_shape();
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_logscaled_independent && (_logscaled != global_logscaled())) {
|
||||||
|
_logscaled = global_logscaled();
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed) {
|
||||||
invalidate_image_cache ();
|
invalidate_image_cache ();
|
||||||
_canvas->item_visual_property_changed (this);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -218,6 +236,7 @@ WaveView::invalidate_whole_cache ()
|
||||||
}
|
}
|
||||||
|
|
||||||
_cache.clear ();
|
_cache.clear ();
|
||||||
|
_canvas->item_visual_property_changed (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -226,6 +245,7 @@ WaveView::invalidate_image_cache ()
|
||||||
for (list<CacheEntry*>::iterator i = _cache.begin(); i != _cache.end(); ++i) {
|
for (list<CacheEntry*>::iterator i = _cache.begin(); i != _cache.end(); ++i) {
|
||||||
(*i)->clear_image ();
|
(*i)->clear_image ();
|
||||||
}
|
}
|
||||||
|
_canvas->item_visual_property_changed (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -240,7 +260,6 @@ WaveView::set_logscaled (bool yn)
|
||||||
if (_logscaled != yn) {
|
if (_logscaled != yn) {
|
||||||
_logscaled = yn;
|
_logscaled = yn;
|
||||||
invalidate_image_cache ();
|
invalidate_image_cache ();
|
||||||
_canvas->item_visual_property_changed (this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -250,7 +269,6 @@ WaveView::set_amplitude (double a)
|
||||||
if (_amplitude != a) {
|
if (_amplitude != a) {
|
||||||
_amplitude = a;
|
_amplitude = a;
|
||||||
invalidate_image_cache ();
|
invalidate_image_cache ();
|
||||||
_canvas->item_visual_property_changed (this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -260,7 +278,6 @@ WaveView::set_zero_color (Color c)
|
||||||
if (_zero_color != c) {
|
if (_zero_color != c) {
|
||||||
_zero_color = c;
|
_zero_color = c;
|
||||||
invalidate_image_cache ();
|
invalidate_image_cache ();
|
||||||
_canvas->item_visual_property_changed (this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -270,7 +287,6 @@ WaveView::set_clip_color (Color c)
|
||||||
if (_clip_color != c) {
|
if (_clip_color != c) {
|
||||||
_clip_color = c;
|
_clip_color = c;
|
||||||
invalidate_image_cache ();
|
invalidate_image_cache ();
|
||||||
_canvas->item_visual_property_changed (this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -280,7 +296,6 @@ WaveView::set_show_zero_line (bool yn)
|
||||||
if (_show_zero != yn) {
|
if (_show_zero != yn) {
|
||||||
_show_zero = yn;
|
_show_zero = yn;
|
||||||
invalidate_image_cache ();
|
invalidate_image_cache ();
|
||||||
_canvas->item_visual_property_changed (this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -290,7 +305,25 @@ WaveView::set_shape (Shape s)
|
||||||
if (_shape != s) {
|
if (_shape != s) {
|
||||||
_shape = s;
|
_shape = s;
|
||||||
invalidate_image_cache ();
|
invalidate_image_cache ();
|
||||||
_canvas->item_visual_property_changed (this);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
WaveView::set_global_shape (Shape s)
|
||||||
|
{
|
||||||
|
if (_global_shape != s) {
|
||||||
|
_global_shape = s;
|
||||||
|
VisualPropertiesChanged (); /* EMIT SIGNAL */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
WaveView::set_global_logscaled (bool yn)
|
||||||
|
{
|
||||||
|
if (_global_logscaled != yn) {
|
||||||
|
_global_logscaled = yn;
|
||||||
|
VisualPropertiesChanged (); /* EMIT SIGNAL */
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -510,6 +543,6 @@ WaveView::set_gradient_waveforms (bool yn)
|
||||||
{
|
{
|
||||||
if (_gradient_waveforms != yn) {
|
if (_gradient_waveforms != yn) {
|
||||||
_gradient_waveforms = yn;
|
_gradient_waveforms = yn;
|
||||||
InvalidateAllImages (); /* EMIT SIGNAL */
|
VisualPropertiesChanged (); /* EMIT SIGNAL */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue