/trunk/Scribus/scribus/guidemanagercore.cpp |
---|
236,6 → 236,106 |
return -1.0; // just for compiler warning |
} |
Guides GuideManagerCore::getAutoHorizontals(Page* page) |
{ |
Guides guides; |
double rowSize; |
int value = m_horizontalAutoCount; |
double offset = 0.0; |
double newPageHeight = page->height(); |
if (page == NULL) |
page = m_page; |
if (page == NULL) |
return guides; |
if (m_horizontalAutoCount == 0) |
return guides; |
++value; |
if (m_horizontalAutoRefer == 1) |
{ |
newPageHeight = newPageHeight - page->Margins.Top - page->Margins.Bottom; |
offset = page->Margins.Top; |
} |
else if (m_horizontalAutoRefer == 2) |
{ |
if (qRound(page->guides.gy) != 0.0) |
{ |
offset = page->guides.gy; |
newPageHeight = page->guides.gh; |
} |
} |
if (page->guides.horizontalAutoGap() > 0.0) |
rowSize = (newPageHeight - (value - 1) * page->guides.horizontalAutoGap()) / value; |
else |
rowSize = newPageHeight / value; |
for (int i = 1, gapCount = 0; i < value; ++i) |
{ |
if (page->guides.horizontalAutoGap() > 0.0) |
{ |
guides.append(offset + i * rowSize + gapCount * page->guides.horizontalAutoGap()); |
++gapCount; |
guides.append(offset + i * rowSize + gapCount * page->guides.horizontalAutoGap()); |
} |
else |
guides.append(offset + rowSize * i); |
} |
return guides; |
} |
Guides GuideManagerCore::getAutoVerticals(Page* page) |
{ |
Guides guides; |
double columnSize; |
int value = m_verticalAutoCount; |
double offset = 0.0; |
double newPageWidth = page->width(); |
if (page == NULL) |
page = m_page; |
if (page == NULL) |
return guides; |
if (m_verticalAutoCount == 0) |
return guides; |
++value; |
if (m_horizontalAutoRefer == 1) |
{ |
newPageWidth = newPageWidth - page->Margins.Left - page->Margins.Right; |
offset = page->Margins.Left; |
} |
else if (m_horizontalAutoRefer == 2) |
{ |
if (qRound(page->guides.gx) != 0) |
{ |
offset = page->guides.gx; |
newPageWidth = page->guides.gw; |
} |
} |
if (page->guides.verticalAutoGap() > 0.0) |
columnSize = (newPageWidth - (value - 1) * page->guides.verticalAutoGap()) / value; |
else |
columnSize = newPageWidth / value; |
for (int i = 1, gapCount = 0; i < value; ++i) |
{ |
if (page->guides.verticalAutoGap() > 0.0) |
{ |
guides.append(offset + i * columnSize + gapCount * page->guides.verticalAutoGap()); |
++gapCount; |
guides.append(offset + i * columnSize + gapCount * page->guides.verticalAutoGap()); |
} |
else |
guides.append(offset + columnSize * i); |
} |
return guides; |
} |
void GuideManagerCore::clearHorizontals(GuideType type) |
{ |
switch (type) |
/trunk/Scribus/scribus/ui/guidemanager.cpp |
---|
556,94 → 556,46 |
QDialog::windowActivationChange( oldActive ); |
} |
Guides GuideManager::getAutoVerticals(Page * p) |
Guides GuideManager::getAutoVerticals(Page * page) |
{ |
Guides retval; |
double columnSize; |
int value = verticalAutoCountSpin->value(); |
double offset = 0.0; |
double newPageWidth = p->width(); |
GuideManagerCore guides; |
if (value == 0) |
return retval; |
++value; |
double gapValue = 0.0; |
if (horizontalAutoGapCheck->isChecked()) |
gapValue = value2pts(horizontalAutoGapSpin->value(), docUnitIndex); |
guides.setHorizontalAutoGap(gapValue); |
guides.setHorizontalAutoCount(horizontalAutoCountSpin->value()); |
guides.setHorizontalAutoRefer(horizontalRefer()); |
if (verticalRefer() == 1) |
{ |
newPageWidth = newPageWidth - p->Margins.Left - p->Margins.Right; |
offset = p->Margins.Left; |
} |
else if (verticalRefer() == 2) |
{ |
if (qRound(p->guides.gx) != 0) |
{ |
offset = p->guides.gx; |
newPageWidth = p->guides.gw; |
} |
} |
gapValue = 0.0; |
if (verticalAutoGapCheck->isChecked()) |
gapValue = value2pts(verticalAutoGapSpin->value(), docUnitIndex); |
guides.setVerticalAutoGap(gapValue); |
guides.setVerticalAutoCount(verticalAutoCountSpin->value()); |
guides.setVerticalAutoRefer(verticalRefer()); |
if (p->guides.verticalAutoGap() > 0.0 && verticalAutoGapCheck->isChecked()) |
columnSize = (newPageWidth - (value - 1) * p->guides.verticalAutoGap()) / value; |
else |
columnSize = newPageWidth / value; |
for (int i = 1, gapCount = 0; i < value; ++i) |
{ |
if (p->guides.verticalAutoGap() > 0.0 && verticalAutoGapCheck->isChecked()) |
{ |
retval.append(offset + i * columnSize + gapCount * p->guides.verticalAutoGap()); |
++gapCount; |
retval.append(offset + i * columnSize + gapCount * p->guides.verticalAutoGap()); |
} |
else |
retval.append(offset + columnSize * i); |
} |
return retval; |
return guides.getAutoVerticals(page); |
} |
Guides GuideManager::getAutoHorizontals(Page * p) |
Guides GuideManager::getAutoHorizontals(Page * page) |
{ |
Guides retval; |
double rowSize; |
int value = horizontalAutoCountSpin->value(); |
double offset = 0.0; |
double newPageHeight = p->height(); |
GuideManagerCore guides; |
if (value == 0) |
return retval; |
++value; |
double gapValue = 0.0; |
if (horizontalAutoGapCheck->isChecked()) |
gapValue = value2pts(horizontalAutoGapSpin->value(), docUnitIndex); |
guides.setHorizontalAutoGap(gapValue); |
guides.setHorizontalAutoCount(horizontalAutoCountSpin->value()); |
guides.setHorizontalAutoRefer(horizontalRefer()); |
if (horizontalRefer() == 1) |
{ |
newPageHeight = newPageHeight - p->Margins.Top - p->Margins.Bottom; |
offset = p->Margins.Top; |
} |
else if (horizontalRefer() == 2) |
{ |
if (qRound(p->guides.gy) != 0.0) |
{ |
offset = p->guides.gy; |
newPageHeight = p->guides.gh; |
} |
} |
gapValue = 0.0; |
if (verticalAutoGapCheck->isChecked()) |
gapValue = value2pts(verticalAutoGapSpin->value(), docUnitIndex); |
guides.setVerticalAutoGap(gapValue); |
guides.setVerticalAutoCount(verticalAutoCountSpin->value()); |
guides.setVerticalAutoRefer(verticalRefer()); |
if (p->guides.horizontalAutoGap() > 0.0 && horizontalAutoGapCheck->isChecked()) |
rowSize = (newPageHeight - (value - 1) * p->guides.horizontalAutoGap()) / value; |
else |
rowSize = newPageHeight / value; |
for (int i = 1, gapCount = 0; i < value; ++i) |
{ |
if (p->guides.horizontalAutoGap() > 0.0&& horizontalAutoGapCheck->isChecked()) |
{ |
retval.append(offset + i * rowSize + gapCount * p->guides.horizontalAutoGap()); |
++gapCount; |
retval.append(offset + i * rowSize + gapCount * p->guides.horizontalAutoGap()); |
} |
else |
retval.append(offset + rowSize * i); |
} |
return retval; |
return guides.getAutoHorizontals(page); |
} |
void GuideManager::resetSelectionForPage() |
/trunk/Scribus/scribus/guidemanagercore.h |
---|
56,6 → 56,9 |
double horizontal(uint ix, GuideType type); |
double vertical(uint ix, GuideType type); |
Guides getAutoHorizontals(Page* page = NULL); |
Guides getAutoVerticals(Page* page = NULL); |
void clearHorizontals(GuideType type); |
void clearVerticals(GuideType type); |
/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp |
---|
1684,6 → 1684,9 |
GuideManagerCore::Standard, |
attrs.hasAttribute("NumHGuides")); |
GuideManagerIO::readSelection(attrs.valueAsString("AGSelection"), newPage); |
newPage->guides.addHorizontals(newPage->guides.getAutoHorizontals(newPage), GuideManagerCore::Auto); |
newPage->guides.addVerticals(newPage->guides.getAutoVerticals(newPage), GuideManagerCore::Auto); |
return true; |
} |
3136,6 → 3139,9 |
GuideManagerCore::Standard, |
attrs.hasAttribute("NumHGuides")); |
GuideManagerIO::readSelection(attrs.valueAsString("AGSelection"), newPage); |
newPage->guides.addHorizontals(newPage->guides.getAutoHorizontals(newPage), GuideManagerCore::Auto); |
newPage->guides.addVerticals(newPage->guides.getAutoVerticals(newPage), GuideManagerCore::Auto); |
} |
if ((tagName == "PAGEOBJECT") || (tagName == "MASTEROBJECT") || (tagName == "FRAMEOBJECT")) |
{ |
/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp |
---|
1681,6 → 1681,9 |
GuideManagerCore::Standard, |
attrs.hasAttribute("NumHGuides")); |
GuideManagerIO::readSelection(attrs.valueAsString("AGSelection"), newPage); |
newPage->guides.addHorizontals(newPage->guides.getAutoHorizontals(newPage), GuideManagerCore::Auto); |
newPage->guides.addVerticals(newPage->guides.getAutoVerticals(newPage), GuideManagerCore::Auto); |
return true; |
} |
3101,6 → 3104,9 |
GuideManagerCore::Standard, |
attrs.hasAttribute("NumHGuides")); |
GuideManagerIO::readSelection(attrs.valueAsString("AGSelection"), newPage); |
newPage->guides.addHorizontals(newPage->guides.getAutoHorizontals(newPage), GuideManagerCore::Auto); |
newPage->guides.addVerticals(newPage->guides.getAutoVerticals(newPage), GuideManagerCore::Auto); |
} |
if ((tagName == "PAGEOBJECT") || (tagName == "MASTEROBJECT") || (tagName == "FRAMEOBJECT")) |
{ |