mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
Allow for blank separators
This commit is contained in:
parent
31a75af243
commit
7c476f0468
2 changed files with 18 additions and 6 deletions
|
|
@ -17,6 +17,8 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "widgets/ardour_spacer.h"
|
#include "widgets/ardour_spacer.h"
|
||||||
|
|
||||||
using namespace ArdourWidgets;
|
using namespace ArdourWidgets;
|
||||||
|
|
@ -31,13 +33,13 @@ ArdourScalingSpacer::ArdourScalingSpacer (int natural_width, int natural_height)
|
||||||
|
|
||||||
ArdourVSpacer::ArdourVSpacer (float r)
|
ArdourVSpacer::ArdourVSpacer (float r)
|
||||||
: CairoWidget ()
|
: CairoWidget ()
|
||||||
, ratio (r)
|
, _ratio (std::min (1.f, r))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ArdourHSpacer::ArdourHSpacer (float r)
|
ArdourHSpacer::ArdourHSpacer (float r)
|
||||||
: CairoWidget ()
|
: CairoWidget ()
|
||||||
, ratio (r)
|
, _ratio (std::min (1.f, r))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,13 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*) {
|
void render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*) {
|
||||||
|
|
||||||
|
if (_ratio < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
float height = get_height();
|
float height = get_height();
|
||||||
|
|
||||||
float h = height * ratio;
|
float h = height * _ratio;
|
||||||
float t = .5f * (height - h);
|
float t = .5f * (height - h);
|
||||||
ctx->rectangle (0, t, 1, h);
|
ctx->rectangle (0, t, 1, h);
|
||||||
uint32_t c = UIConfigurationBase::instance().color ("neutral:backgroundest");
|
uint32_t c = UIConfigurationBase::instance().color ("neutral:backgroundest");
|
||||||
|
|
@ -76,7 +80,8 @@ protected:
|
||||||
CairoWidget::on_size_request (req);
|
CairoWidget::on_size_request (req);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ratio;
|
private:
|
||||||
|
float _ratio;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LIBWIDGETS_API ArdourHSpacer : public CairoWidget
|
class LIBWIDGETS_API ArdourHSpacer : public CairoWidget
|
||||||
|
|
@ -87,9 +92,13 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*) {
|
void render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*) {
|
||||||
|
|
||||||
|
if (_ratio < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
float width = get_width();
|
float width = get_width();
|
||||||
|
|
||||||
float w = width * ratio;
|
float w = width * _ratio;
|
||||||
float t = .5f * (width - w);
|
float t = .5f * (width - w);
|
||||||
ctx->rectangle (t, 0, w, 1);
|
ctx->rectangle (t, 0, w, 1);
|
||||||
uint32_t c = UIConfigurationBase::instance().color ("neutral:backgroundest");
|
uint32_t c = UIConfigurationBase::instance().color ("neutral:backgroundest");
|
||||||
|
|
@ -103,7 +112,8 @@ protected:
|
||||||
CairoWidget::on_size_request (req);
|
CairoWidget::on_size_request (req);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ratio;
|
private:
|
||||||
|
float _ratio;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LIBWIDGETS_API ArdourDropShadow : public CairoWidget
|
class LIBWIDGETS_API ArdourDropShadow : public CairoWidget
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue