20 #ifndef __PALETTETREE_H__ 21 #define __PALETTETREE_H__ 37 std::unique_ptr<Element>
element;
55 PaletteCell(std::unique_ptr<Element> e,
const QString& _name, QString _tag = QString(), qreal _mag = 1.0);
57 static constexpr
const char*
mimeDataFormat =
"application/musescore/palette/cell";
78 qreal _extraMag = 1.0;
84 : _cell(cell), _extraMag(extraMag) {}
88 void paint(QPainter* painter,
const QRect& rect, QIcon::Mode mode, QIcon::State state)
override;
135 QSize _gridSize = QSize(64, 64);
140 bool _drawGrid =
false;
141 bool _editable =
true;
143 qreal _yOffset = 0.0;
145 bool _moreElements =
false;
147 bool _visible =
true;
148 bool _expanded =
false;
150 Type guessType()
const;
158 const QString&
name()
const {
return _name; }
159 void setName(
const QString& str) { _name = str; }
165 void setGrid(
int w,
int h) { _gridSize = QSize(w, h); }
167 qreal
mag()
const {
return _mag; }
181 bool custom()
const {
return _type == Type::Custom; }
183 static constexpr
const char*
mimeDataFormat =
"application/musescore/palette/panel";
188 static std::unique_ptr<PalettePanel>
readMimeData(
const QByteArray& data);
190 bool readFromFile(
const QString& path);
191 bool writeToFile(
const QString& path)
const;
193 int ncells()
const {
return int(cells.size()); }
194 bool empty()
const {
return cells.empty(); }
198 std::vector<PaletteCellPtr> takeCells(
int idx,
int count);
199 bool insertCells(
int idx, std::vector<PaletteCellPtr> cells);
202 int findPaletteCell(
const PaletteCell& cell,
bool matchName =
true)
const;
213 Type contentType()
const;
223 std::vector<std::unique_ptr<PalettePanel>>
palettes;
void setExpanded(bool val)
Definition: palettetree.h:205
bool visible
Definition: palettetree.h:50
bool moreElements() const
Definition: palettetree.h:176
QString translatedName() const
Definition: palettetree.h:161
double y
Definition: palettemodel_list.h:38
Definition: bagpembell.h:51
qreal mag() const
Definition: palettetree.h:167
std::shared_ptr< const PaletteCell > PaletteCellConstPtr
Definition: palettetree.h:30
qreal mag
Definition: palettemodel_list.h:41
void setMoreElements(bool val)
Definition: palettetree.h:177
void setGrid(QSize s)
Definition: palettetree.h:164
static PaletteCellPtr readMimeData(const QByteArray &data)
Definition: palettetree.cpp:307
bool read(XmlReader &)
Definition: palettetree.cpp:244
QString _name
Definition: palettetree.h:127
PalettePanel(Type t=Type::Custom)
Definition: palettetree.h:153
PaletteCellConstPtr cell() const
Definition: palettetree.h:80
void setEditable(bool val)
Definition: palettetree.h:208
void setVisible(bool val)
Definition: palettetree.h:180
QString name
Definition: palettemodel_list.h:33
std::unique_ptr< Element > untranslatedElement
Definition: palettetree.h:38
bool active
Definition: palettetree.h:52
Base class of score layout elements.
Definition: element.h:158
Definition: palettetree.h:95
double x
Definition: palettemodel_list.h:37
bool expanded() const
Definition: palettetree.h:204
bool drawGrid() const
Definition: palettetree.h:170
QString tag
Definition: palettemodel_list.h:34
std::unique_ptr< Element > element
Definition: palettemodel_list.h:32
void write(XmlWriter &xml) const
Definition: palettetree.cpp:205
Definition: accidental.h:65
Type
Definition: palettetree.h:98
void setMag(qreal val)
Definition: palettetree.h:168
bool editable() const
Definition: palettetree.h:207
bool drawStaff
Definition: palettemodel_list.h:36
void retranslate()
Retranslates cell content, e.g.
Definition: palettetree.cpp:176
Definition: arpeggio.h:30
void setYOffset(qreal val)
Definition: palettetree.h:174
std::vector< std::unique_ptr< PalettePanel > > palettes
Definition: palettetree.h:223
const QString & name() const
Definition: palettetree.h:158
static constexpr const char * mimeDataFormat
Definition: palettetree.h:57
const char * translationContext() const
Definition: palettetree.cpp:119
std::vector< PaletteCellPtr > cells
Definition: palettetree.h:133
qreal yOffset() const
Definition: palettetree.h:173
Definition: palettemodel_list.h:31
double yoffset
Definition: palettemodel_list.h:40
double xoffset
Definition: palettemodel_list.h:39
articulation marks
Definition: articulation.h:57
Type type() const
Definition: palettetree.h:210
dynamics marker; determines midi velocity
Definition: dynamic.h:31
Definition: palettemodel_list.h:55
void setGrid(int w, int h)
Definition: palettetree.h:165
Definition: aeolus.cpp:26
PaletteCellConstPtr cell(int idx) const
Definition: palettetree.h:196
bool custom
Definition: palettetree.h:51
int ncells() const
Definition: palettetree.h:193
bool empty() const
Definition: palettetree.h:194
bool readOnly
Definition: palettemodel_list.h:42
QIconEngine * clone() const override
Definition: palettetree.h:86
bool custom() const
Definition: palettetree.h:181
Definition: fingering.h:24
QByteArray mimeData() const
Definition: palettetree.cpp:350
Type _type
Definition: palettetree.h:131
Repeat
Definition: measurebase.h:34
void setName(const QString &str)
Definition: palettetree.h:159
bool visible() const
Definition: palettetree.h:179
PaletteCellPtr cell(int idx)
Definition: palettetree.h:195
std::shared_ptr< PaletteCell > PaletteCellPtr
Definition: palettetree.h:29
void setType(Type t)
Definition: palettetree.h:211
PaletteCellIconEngine(PaletteCellConstPtr cell, qreal extraMag=1.0)
Definition: palettetree.h:83
PaletteCellConstPtr _cell
Definition: palettetree.h:77
QSize gridSize() const
Definition: palettetree.h:163
void setDrawGrid(bool val)
Definition: palettetree.h:171
static PaletteCellPtr readElementMimeData(const QByteArray &data)
Definition: palettetree.cpp:316
Definition: palettetree.h:222
void setElementTranslated(bool translate)
Definition: palettetree.cpp:190
QString translatedName() const
Definition: palettetree.cpp:161