parent
ea45012ee5
commit
33131b5609
6 changed files with 54 additions and 7 deletions
|
@ -114,11 +114,15 @@ void Bracket::setStaffSpan(int a, int b)
|
|||
_lastStaff = b;
|
||||
|
||||
if (bracketType() == BracketType::BRACE
|
||||
&& score()->styleSt(Sid::MusicalSymbolFont) != "Emmentaler"
|
||||
&& score()->styleSt(Sid::MusicalSymbolFont) != "Gonville") {
|
||||
&& score()->styleSt(Sid::MusicalSymbolFont) != "Emmentaler" && score()->styleSt(Sid::MusicalSymbolFont) != "Gonville") {
|
||||
int v = _lastStaff - _firstStaff + 1;
|
||||
if (score()->styleSt(Sid::MusicalSymbolFont) == "Leland") {
|
||||
v = qMin(4, v);
|
||||
}
|
||||
// total default height of a system of n staves / height of a 5 line staff
|
||||
_magx = v + ((v - 1) * score()->styleS(Sid::akkoladeDistance).val() / 4.0);
|
||||
qreal dist = score()->enableVerticalSpread() ? score()->styleS(Sid::maxAkkoladeDistance).val() : score()->styleS(
|
||||
Sid::akkoladeDistance).val();
|
||||
_magx = v + ((v - 1) * dist / 4.0);
|
||||
if (v == 1) {
|
||||
_braceSymbol = SymId::braceSmall;
|
||||
} else if (v <= 2) {
|
||||
|
|
|
@ -63,6 +63,7 @@ public:
|
|||
void setStaffSpan(int a, int b);
|
||||
|
||||
SymId braceSymbol() const { return _braceSymbol; }
|
||||
void setBraceSymbol(const SymId& sym) { _braceSymbol = sym; }
|
||||
int column() const { return _bi->column(); }
|
||||
int span() const { return _bi->bracketSpan(); }
|
||||
qreal magx() const { return _magx; }
|
||||
|
|
|
@ -668,7 +668,7 @@ static const StyleType styleTypes[] {
|
|||
{ Sid::subTitleFrameBgColor, "subTitleFrameBgColor", QColor(255, 255, 255, 0) },
|
||||
|
||||
{ Sid::composerFontFace, "composerFontFace", "FreeSerif" },
|
||||
{ Sid::composerFontSize, "composerFontSize", 12.0 },
|
||||
{ Sid::composerFontSize, "composerFontSize", 11.0 },
|
||||
{ Sid::composerFontSpatiumDependent, "composerFontSpatiumDependent", false },
|
||||
{ Sid::composerFontStyle, "composerFontStyle", int(FontStyle::Normal) },
|
||||
{ Sid::composerColor, "composerColor", QColor(0, 0, 0, 255) },
|
||||
|
@ -684,7 +684,7 @@ static const StyleType styleTypes[] {
|
|||
{ Sid::composerFrameBgColor, "composerFrameBgColor", QColor(255, 255, 255, 0) },
|
||||
|
||||
{ Sid::lyricistFontFace, "lyricistFontFace", "FreeSerif" },
|
||||
{ Sid::lyricistFontSize, "lyricistFontSize", 12.0 },
|
||||
{ Sid::lyricistFontSize, "lyricistFontSize", 11.0 },
|
||||
{ Sid::lyricistFontSpatiumDependent, "lyricistFontSpatiumDependent", false },
|
||||
{ Sid::lyricistFontStyle, "lyricistFontStyle", int(FontStyle::Normal) },
|
||||
{ Sid::lyricistColor, "lyricistColor", QColor(0, 0, 0, 255) },
|
||||
|
@ -1018,7 +1018,7 @@ static const StyleType styleTypes[] {
|
|||
{ Sid::frameFrameBgColor, "frameFrameBgColor", QColor(255, 255, 255, 0) },
|
||||
|
||||
{ Sid::textLineFontFace, "textLineFontFace", "FreeSerif" },
|
||||
{ Sid::textLineFontSize, "textLineFontSize", 12.0 },
|
||||
{ Sid::textLineFontSize, "textLineFontSize", 11.0 },
|
||||
{ Sid::textLineFontSpatiumDependent, "textLineFontSpatiumDependent", true },
|
||||
{ Sid::textLineFontStyle, "textLineFontStyle", int(FontStyle::Normal) },
|
||||
{ Sid::textLineColor, "textLineColor", QColor(0, 0, 0, 255) },
|
||||
|
|
|
@ -3052,7 +3052,7 @@ protected:
|
|||
public:
|
||||
Sym() { }
|
||||
|
||||
bool isValid() const { return _code != -1; }
|
||||
bool isValid() const { return _code != -1 && _bbox.isValid(); }
|
||||
|
||||
void setSymList(const std::vector<SymId>& sl) { _ids = sl; }
|
||||
const std::vector<SymId>& symList() const { return _ids; }
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include "libmscore/mscore.h"
|
||||
#include "libmscore/score.h"
|
||||
#include "libmscore/textbase.h"
|
||||
#include "libmscore/element.h"
|
||||
#include "libmscore/bracket.h"
|
||||
|
||||
#include "thirdparty/qzip/qzipreader_p.h"
|
||||
#include "thirdparty/qzip/qzipwriter_p.h"
|
||||
|
@ -443,6 +445,12 @@ bool PalettePanel::read(XmlReader& e)
|
|||
if (!cell->read(e)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto cellHandler = cellHandlerByPaletteType(_type);
|
||||
if (cellHandler) {
|
||||
cellHandler(cell.get());
|
||||
}
|
||||
|
||||
cells.push_back(cell);
|
||||
} else {
|
||||
e.unknown();
|
||||
|
@ -695,6 +703,12 @@ PaletteCell* PalettePanel::insert(int idx, Element* e, const QString& name, qrea
|
|||
e->layout(); // layout may be important for comparing cells, e.g. filtering "More" popup content
|
||||
}
|
||||
PaletteCell* cell = new PaletteCell(std::shared_ptr<Element>(e), name, mag);
|
||||
|
||||
auto cellHandler = cellHandlerByPaletteType(_type);
|
||||
if (cellHandler) {
|
||||
cellHandler(cell);
|
||||
}
|
||||
|
||||
cells.emplace(cells.begin() + idx, cell);
|
||||
return cell;
|
||||
}
|
||||
|
@ -709,6 +723,12 @@ PaletteCell* PalettePanel::append(Element* e, const QString& name, qreal mag)
|
|||
e->layout(); // layout may be important for comparing cells, e.g. filtering "More" popup content
|
||||
}
|
||||
PaletteCell* cell = new PaletteCell(std::shared_ptr<Element>(e), name, mag);
|
||||
|
||||
auto cellHandler = cellHandlerByPaletteType(_type);
|
||||
if (cellHandler) {
|
||||
cellHandler(cell);
|
||||
}
|
||||
|
||||
cells.emplace_back(cell);
|
||||
return cell;
|
||||
}
|
||||
|
@ -920,6 +940,26 @@ PalettePanel::Type PalettePanel::guessType() const
|
|||
return Type::Custom;
|
||||
}
|
||||
|
||||
std::function<void(PaletteCell*)> PalettePanel::cellHandlerByPaletteType(const PalettePanel::Type& type) const
|
||||
{
|
||||
switch (type) {
|
||||
case Type::Bracket: return [](PaletteCell* cellPtr) {
|
||||
if (!cellPtr || !cellPtr->element || !cellPtr->element.get()->isBracket()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Bracket* bracket = toBracket(cellPtr->element.get());
|
||||
|
||||
if (bracket->bracketType() == BracketType::BRACE) {
|
||||
bracket->setStaffSpan(0, 1);
|
||||
cellPtr->mag = 1.2;
|
||||
}
|
||||
};
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// PalettePanel::contentType
|
||||
/// Returns palette type if it is defined or deduces it
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#ifndef __PALETTETREE_H__
|
||||
#define __PALETTETREE_H__
|
||||
|
||||
#include <functional>
|
||||
#include <QIconEngine>
|
||||
|
||||
#include "libmscore/element.h"
|
||||
|
@ -173,6 +174,7 @@ private:
|
|||
bool _expanded = false;
|
||||
|
||||
Type guessType() const;
|
||||
std::function<void(PaletteCell*)> cellHandlerByPaletteType(const Type& type) const;
|
||||
|
||||
void showWritingPaletteError(const QString& path) const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue