fix page height in SYSTEM layout mode

This commit is contained in:
ws 2015-12-11 14:30:54 +01:00
parent 77e980d95d
commit 600306e1ec
5 changed files with 22 additions and 7 deletions

View file

@ -13,6 +13,8 @@
#ifndef __CURSOR_H__
#define __CURSOR_H__
#include "segment.h"
namespace Ms {
class Element;
@ -20,7 +22,7 @@ class Score;
class Chord;
class Rest;
class Note;
class Segment;
// class Segment;
class RepeatSegment;
class ChordRest;
class StaffText;

View file

@ -1575,6 +1575,12 @@ void Score::doLayout()
// but then it's used for drag and drop and should be set to new version
if (_mscVersion <= 114)
_mscVersion = MSCVERSION; // for later drag & drop usage
if (_layoutMode == LayoutMode::SYSTEM) {
Page* page = _pages.front();
System* system = _systems.back();
page->setHeight(system->abbox().bottom());
}
}
//---------------------------------------------------------
@ -3277,12 +3283,13 @@ Page* Score::getEmptyPage()
qreal x, y;
if (MScore::verticalOrientation()) {
x = 0.0;
y = (curPage == 0) ? 0.0 : _pages[curPage - 1]->pos().y() + page->height() + 5;
y = (curPage == 0) ? 0.0 : _pages[curPage - 1]->pos().y() + page->height() + MScore::verticalPageGap;
}
else {
y = 0.0;
x = (curPage == 0) ? 0.0 : _pages[curPage - 1]->pos().x()
+ page->width() + (((curPage+_pageNumberOffset) & 1) ? 50.0 : 1.0);
+ page->width()
+ (((curPage+_pageNumberOffset) & 1) ? MScore::horizontalPageGapOdd : MScore::horizontalPageGapEven);
}
++curPage;
page->setPos(x, y);

View file

@ -70,6 +70,10 @@ QString MScore::_globalShare;
int MScore::_vRaster;
int MScore::_hRaster;
bool MScore::_verticalOrientation = false;
qreal MScore::verticalPageGap = 5.0;
qreal MScore::horizontalPageGapEven = 1.0;
qreal MScore::horizontalPageGapOdd = 50.0;
QColor MScore::selectColor[VOICES];
QColor MScore::defaultColor;
QColor MScore::layoutBreakColor;

View file

@ -420,6 +420,10 @@ class MScore : public QObject {
static bool pdfPrinting;
static qreal verticalPageGap;
static qreal horizontalPageGapEven;
static qreal horizontalPageGapOdd;
#ifdef SCRIPT_INTERFACE
static QQmlEngine* qml();
#endif

View file

@ -612,7 +612,6 @@ MeasureBase* Score::pos2measure(const QPointF& p, int* rst, int* pitch,
return 0;
System* s = m->system();
// qreal sy1 = 0;
qreal y = p.y() - s->canvasPos().y();
int i;
@ -638,7 +637,6 @@ MeasureBase* Score::pos2measure(const QPointF& p, int* rst, int* pitch,
else
sy2 = s->page()->height() - s->pos().y(); // s->height();
if (y > sy2) {
// sy1 = sy2;
i = ni;
continue;
}
@ -649,7 +647,7 @@ MeasureBase* Score::pos2measure(const QPointF& p, int* rst, int* pitch,
QPointF pppp = p - m->canvasPos();
int strack = i * VOICES;
if (!staff(i))
return nullptr;
return 0;
int etrack = staff(i)->part()->nstaves() * VOICES + strack;
SysStaff* sstaff = m->system()->staff(i);
@ -1196,7 +1194,7 @@ int Score::midiChannel(int idx) const
Page* Score::searchPage(const QPointF& p) const
{
foreach(Page* page, pages()) {
for (Page* page : pages()) {
if (page->bbox().translated(page->pos()).contains(p))
return page;
}