implement editable system bar lines
This commit is contained in:
parent
2b84f708e3
commit
919c698faa
7 changed files with 44 additions and 28 deletions
|
@ -364,6 +364,12 @@ Element* BarLine::drop(const DropData& data)
|
|||
delete e;
|
||||
return 0;
|
||||
}
|
||||
if (parent()->type() == SYSTEM) {
|
||||
BarLine* b = static_cast<System*>(parent())->barLine();
|
||||
score()->undoChangeProperty(b, P_SUBTYPE, int(bl->subtype()));
|
||||
delete e;
|
||||
return 0;
|
||||
}
|
||||
Measure* m = static_cast<Segment*>(parent())->measure();
|
||||
if (st == START_REPEAT) {
|
||||
m = m->nextMeasure();
|
||||
|
@ -723,3 +729,4 @@ bool BarLine::setProperty(P_ID id, const QVariant& v)
|
|||
score()->setLayoutAll(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -2832,8 +2832,6 @@ qreal Measure::minWidth2() const
|
|||
// layoutX
|
||||
/// \brief main layout routine for note spacing
|
||||
/// Return width of measure (in MeasureWidth), taking into account \a stretch.
|
||||
/// In the layout process this method is called twice, first with stretch==1
|
||||
/// to find out the minimal width of the measure.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void Measure::layoutX(qreal stretch)
|
||||
|
@ -2868,6 +2866,9 @@ void Measure::layoutX(qreal stretch)
|
|||
|
||||
int segmentIdx = 0;
|
||||
qreal x = 0.0;
|
||||
if (system()->firstMeasure() == this && system()->barLine()) {
|
||||
x += BarLine::layoutWidth(score(), system()->barLine()->subtype(), system()->barLine()->magS());
|
||||
}
|
||||
int minTick = 100000;
|
||||
int ntick = tick() + ticks(); // position of next measure
|
||||
|
||||
|
|
|
@ -787,7 +787,6 @@ bool Page::isOdd() const
|
|||
void Page::write(Xml& xml) const
|
||||
{
|
||||
xml.stag("Page");
|
||||
QList<System*> _systems;
|
||||
foreach(System* system, _systems) {
|
||||
system->write(xml);
|
||||
}
|
||||
|
|
|
@ -99,12 +99,10 @@ void Score::write(Xml& xml, bool selectionOnly)
|
|||
xml.tag("showUnprintable", _showUnprintable);
|
||||
xml.tag("showFrames", _showFrames);
|
||||
xml.tag("showMargins", _showPageborders);
|
||||
// pageFormat()->write(xml); // saved with style
|
||||
|
||||
QMapIterator<QString, QString> i(_metaTags);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
// if (!i.value().isEmpty())
|
||||
if (!_testMode || i.key() != "platform")
|
||||
xml.tag(QString("metaTag name=\"%1\"").arg(i.key()), i.value());
|
||||
}
|
||||
|
@ -159,7 +157,6 @@ void Score::write(Xml& xml, bool selectionOnly)
|
|||
xml.etag();
|
||||
}
|
||||
xml.curTrack = -1;
|
||||
// xml.tag("cursorTrack", _is.track());
|
||||
if (!selectionOnly) {
|
||||
foreach(Excerpt* excerpt, _excerpts)
|
||||
excerpt->score()->write(xml, false); // recursion
|
||||
|
|
|
@ -67,7 +67,7 @@ SysStaff::~SysStaff()
|
|||
System::System(Score* s)
|
||||
: Element(s)
|
||||
{
|
||||
barLine = 0;
|
||||
_barLine = 0;
|
||||
_leftMargin = 0.0;
|
||||
_pageBreak = false;
|
||||
_firstSystem = false;
|
||||
|
@ -82,7 +82,7 @@ System::System(Score* s)
|
|||
|
||||
System::~System()
|
||||
{
|
||||
delete barLine;
|
||||
delete _barLine;
|
||||
qDeleteAll(_staves);
|
||||
qDeleteAll(_brackets);
|
||||
}
|
||||
|
@ -236,18 +236,18 @@ void System::layout(qreal xo1)
|
|||
}
|
||||
|
||||
if ((nstaves > 1 && score()->styleB(ST_startBarlineMultiple)) || (nstaves <= 1 && score()->styleB(ST_startBarlineSingle))) {
|
||||
if (barLine == 0) {
|
||||
barLine = new BarLine(score());
|
||||
barLine->setParent(this);
|
||||
barLine->setTrack(0);
|
||||
if (_barLine == 0) {
|
||||
_barLine = new BarLine(score());
|
||||
_barLine->setParent(this);
|
||||
_barLine->setTrack(0);
|
||||
_barLine->setGenerated(true);
|
||||
score()->undoAddElement(_barLine);
|
||||
}
|
||||
}
|
||||
else if (barLine) {
|
||||
delete barLine;
|
||||
barLine = 0;
|
||||
}
|
||||
if (barLine)
|
||||
barLine->setPos(_leftMargin + xo1, 0.0);
|
||||
else if (_barLine)
|
||||
score()->undoRemoveElement(_barLine);
|
||||
if (_barLine)
|
||||
_barLine->setPos(_leftMargin + xo1, 0.0);
|
||||
|
||||
//---------------------------------------------------
|
||||
// layout brackets
|
||||
|
@ -358,9 +358,9 @@ void System::layout2()
|
|||
}
|
||||
}
|
||||
|
||||
if (barLine) {
|
||||
barLine->setSpan(lastStaffIdx + 1);
|
||||
barLine->layout();
|
||||
if (_barLine) {
|
||||
_barLine->setSpan(lastStaffIdx + 1);
|
||||
_barLine->layout();
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
|
@ -589,6 +589,9 @@ void System::add(Element* el)
|
|||
}
|
||||
}
|
||||
break;
|
||||
case BAR_LINE:
|
||||
_barLine = static_cast<BarLine*>(el);
|
||||
break;
|
||||
default:
|
||||
qDebug("System::add(%s) not implemented", el->name());
|
||||
break;
|
||||
|
@ -639,6 +642,9 @@ void System::remove(Element* el)
|
|||
Q_ASSERT(score() == el->score());
|
||||
}
|
||||
break;
|
||||
case BAR_LINE:
|
||||
_barLine = 0;
|
||||
break;
|
||||
default:
|
||||
qDebug("System::remove(%s) not implemented", el->name());
|
||||
break;
|
||||
|
@ -908,8 +914,8 @@ void System::scanElements(void* data, void (*func)(void*, Element*), bool all)
|
|||
{
|
||||
if (isVbox())
|
||||
return;
|
||||
if (barLine)
|
||||
func(data, barLine);
|
||||
if (_barLine)
|
||||
func(data, _barLine);
|
||||
|
||||
foreach(Bracket* b, _brackets)
|
||||
func(data, b);
|
||||
|
@ -956,6 +962,8 @@ qreal System::staffY(int staffIdx) const
|
|||
void System::write(Xml& xml) const
|
||||
{
|
||||
xml.stag("System");
|
||||
if (_barLine && !_barLine->generated())
|
||||
_barLine->write(xml);
|
||||
xml.etag();
|
||||
}
|
||||
|
||||
|
@ -968,7 +976,11 @@ void System::read(const QDomElement& de)
|
|||
for (QDomElement e = de.firstChildElement(); !e.isNull(); e = e.nextSiblingElement()) {
|
||||
const QString& tag(e.tagName());
|
||||
|
||||
if (tag == "System") {
|
||||
if (tag == "BarLine") {
|
||||
_barLine = new BarLine(score());
|
||||
_barLine->read(e);
|
||||
_barLine->setTrack(0);
|
||||
_barLine->setParent(this);
|
||||
}
|
||||
else
|
||||
domError(e);
|
||||
|
|
|
@ -83,7 +83,7 @@ class System : public Element {
|
|||
QList<SysStaff*> _staves;
|
||||
QList<Bracket*> _brackets;
|
||||
|
||||
BarLine* barLine; ///< Left hand bar, connects staves in system.
|
||||
BarLine* _barLine; ///< Left hand bar, connects staves in system.
|
||||
qreal _leftMargin; ///< left margin for instrument name, brackets etc.
|
||||
bool _pageBreak;
|
||||
bool _firstSystem; ///< used to decide between long and short instrument
|
||||
|
@ -145,7 +145,7 @@ class System : public Element {
|
|||
SysStaff* insertStaff(int);
|
||||
void removeStaff(int);
|
||||
|
||||
BarLine* getBarLine() const { return barLine; }
|
||||
BarLine* barLine() const { return _barLine; }
|
||||
int y2staff(qreal y) const;
|
||||
void setInstrumentNames(bool longName);
|
||||
int snap(int tick, const QPointF p) const;
|
||||
|
|
|
@ -290,8 +290,8 @@ void Debugger::updateList(Score* s)
|
|||
foreach(System* system, *page->systems()) {
|
||||
ElementItem* si = new ElementItem(pi, system);
|
||||
|
||||
if (system->getBarLine())
|
||||
new ElementItem(si, system->getBarLine());
|
||||
if (system->barLine())
|
||||
new ElementItem(si, system->barLine());
|
||||
|
||||
|
||||
foreach(SysStaff* ss, *system->staves()) {
|
||||
|
|
Loading…
Reference in a new issue