mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +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.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "widgets/ardour_spacer.h"
|
||||
|
||||
using namespace ArdourWidgets;
|
||||
|
|
@ -31,13 +33,13 @@ ArdourScalingSpacer::ArdourScalingSpacer (int natural_width, int natural_height)
|
|||
|
||||
ArdourVSpacer::ArdourVSpacer (float r)
|
||||
: CairoWidget ()
|
||||
, ratio (r)
|
||||
, _ratio (std::min (1.f, r))
|
||||
{
|
||||
}
|
||||
|
||||
ArdourHSpacer::ArdourHSpacer (float r)
|
||||
: CairoWidget ()
|
||||
, ratio (r)
|
||||
, _ratio (std::min (1.f, r))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,9 +60,13 @@ public:
|
|||
protected:
|
||||
void render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*) {
|
||||
|
||||
if (_ratio < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
float height = get_height();
|
||||
|
||||
float h = height * ratio;
|
||||
float h = height * _ratio;
|
||||
float t = .5f * (height - h);
|
||||
ctx->rectangle (0, t, 1, h);
|
||||
uint32_t c = UIConfigurationBase::instance().color ("neutral:backgroundest");
|
||||
|
|
@ -76,7 +80,8 @@ protected:
|
|||
CairoWidget::on_size_request (req);
|
||||
}
|
||||
|
||||
float ratio;
|
||||
private:
|
||||
float _ratio;
|
||||
};
|
||||
|
||||
class LIBWIDGETS_API ArdourHSpacer : public CairoWidget
|
||||
|
|
@ -87,9 +92,13 @@ public:
|
|||
protected:
|
||||
void render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*) {
|
||||
|
||||
if (_ratio < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
float width = get_width();
|
||||
|
||||
float w = width * ratio;
|
||||
float w = width * _ratio;
|
||||
float t = .5f * (width - w);
|
||||
ctx->rectangle (t, 0, w, 1);
|
||||
uint32_t c = UIConfigurationBase::instance().color ("neutral:backgroundest");
|
||||
|
|
@ -103,7 +112,8 @@ protected:
|
|||
CairoWidget::on_size_request (req);
|
||||
}
|
||||
|
||||
float ratio;
|
||||
private:
|
||||
float _ratio;
|
||||
};
|
||||
|
||||
class LIBWIDGETS_API ArdourDropShadow : public CairoWidget
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue