1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2002-2011 Werner Schweer
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENCE.GPL
//=============================================================================
#ifndef __BRACKET_H__
#define __BRACKET_H__
#include "element.h"
#include "bracketItem.h"
namespace Ms {
class MuseScoreView;
class System;
enum class BracketType : signed char;
//---------------------------------------------------------
// @@ Bracket
//---------------------------------------------------------
class Bracket final : public Element {
BracketItem* _bi;
qreal ay1;
qreal h2;
int _firstStaff;
int _lastStaff;
QPainterPath path;
SymId _braceSymbol;
Shape _shape;
// horizontal scaling factor for brace symbol. Cannot be equal to magY or depend on h
// because layout needs width of brace before knowing height of system...
qreal _magx;
Measure* _measure = nullptr;
public:
Bracket(Score*);
virtual ~Bracket();
virtual Bracket* clone() const override { return new Bracket(*this); }
virtual ElementType type() const override { return ElementType::BRACKET; }
void setBracketItem(BracketItem* i) { _bi = i; }
BracketItem* bracketItem() const { return _bi; }
BracketType bracketType() const { return _bi->bracketType(); }
static const char* bracketTypeName(BracketType type);
int firstStaff() const { return _firstStaff; }
int lastStaff() const { return _lastStaff; }
void setStaffSpan(int a, int b);
SymId braceSymbol() const { return _braceSymbol; }
int column() const { return _bi->column(); }
int span() const { return _bi->bracketSpan(); }
qreal magx() const { return _magx; }
System* system() const { return (System*)parent(); }
Measure* measure() const { return _measure; }
void setMeasure(Measure* measure) { _measure = measure; }
virtual void setHeight(qreal) override;
virtual qreal width() const override;
virtual Shape shape() const override { return _shape; }
virtual void draw(QPainter*) const override;
virtual void layout() override;
virtual void write(XmlWriter& xml) const override;
virtual void read(XmlReader&) override;
virtual bool isEditable() const override { return true; }
virtual void startEdit(EditData&) override;
virtual bool edit(EditData&) override;
virtual void endEdit(EditData&) override;
virtual void editDrag(EditData&) override;
virtual void endEditDrag(EditData&) override;
virtual void updateGrips(EditData&) const override;
virtual bool acceptDrop(EditData&) const override;
virtual Element* drop(EditData&) override;
virtual QVariant getProperty(Pid propertyId) const override;
virtual bool setProperty(Pid propertyId, const QVariant&) override;
virtual QVariant propertyDefault(Pid) const override;
void undoChangeProperty(Pid id, const QVariant& v, PropertyFlags ps) override;
using ScoreElement::undoChangeProperty;
virtual void setSelected(bool f) override;
};
} // namespace Ms
#endif
|