本文整理汇总了C++中Guides类的典型用法代码示例。如果您正苦于以下问题:C++ Guides类的具体用法?C++ Guides怎么用?C++ Guides使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Guides类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: color
void GuideManagerCore::drawPage(ScPainter *p, ScribusDoc *doc, double lineWidth)
{
Guides::iterator it;
const GuideManager* guideManager = ScCore->primaryMainWindow()->guidePalette;
QColor color(doc->guidesPrefs().guideColor);
if (!m_page || guideManager->pageNr() < 0)
return;
// real painting margins including bleeds
double verticalFrom = 0.0 - doc->bleeds()->top();
double verticalTo = m_page->height() + doc->bleeds()->bottom();
double horizontalFrom = 0.0 - doc->bleeds()->left();
double horizontalTo = m_page->width() + doc->bleeds()->right();
// all standard
p->setPen(color, lineWidth, Qt::DashDotLine, Qt::FlatCap, Qt::MiterJoin);
for (it = m_verticalStdG.begin(); it != m_verticalStdG.end(); ++it)
// if ((*it) >= 0 && (*it) <= m_page->width())
// p->drawLine(FPoint((*it), 0), FPoint((*it), m_page->height()));
p->drawLine(FPoint((*it), verticalFrom), FPoint((*it), verticalTo));
for (it = m_horizontalStdG.begin(); it != m_horizontalStdG.end(); ++it)
// if ((*it) >= 0 && (*it) <= m_page->height())
// p->drawLine(FPoint(0, (*it)), FPoint(m_page->width(), (*it)));
p->drawLine(FPoint(horizontalFrom, (*it)), FPoint(horizontalTo, (*it)));
// highlight selected standards
if (guideManager->currentIndex() == 0
&& m_page->pageNr() == guideManager->pageNr())
{
p->setPen(Qt::red, lineWidth, Qt::DashDotLine, Qt::FlatCap, Qt::MiterJoin);
Guides highlight = guideManager->selectedVerticals();
for (it = highlight.begin(); it != highlight.end(); ++it)
// if ((*it) >= 0 && (*it) <= m_page->width())
// p->drawLine(FPoint((*it), 0), FPoint((*it), m_page->height()));
p->drawLine(FPoint((*it), verticalFrom), FPoint((*it), verticalTo));
highlight = guideManager->selectedHorizontals();
for (it = highlight.begin(); it != highlight.end(); ++it)
// if ((*it) >= 0 && (*it) <= m_page->height())
// p->drawLine(FPoint(0, (*it)), FPoint(m_page->width(), (*it)));
p->drawLine(FPoint(horizontalFrom, (*it)), FPoint(horizontalTo, (*it)));
}
// all auto
if (guideManager->currentIndex() == 1 && guideManager->isVisible())
color = Qt::red;
else
color = doc->guidesPrefs().guideColor;
p->setPen(color, lineWidth, Qt::DashDotLine, Qt::FlatCap, Qt::MiterJoin);
for (it = m_verticalAutoG.begin(); it != m_verticalAutoG.end(); ++it)
// if ((*it) >= 0 && (*it) <= m_page->width())
// p->drawLine(FPoint((*it), 0), FPoint((*it), m_page->height()));
p->drawLine(FPoint((*it), verticalFrom), FPoint((*it), verticalTo));
for (it = m_horizontalAutoG.begin(); it != m_horizontalAutoG.end(); ++it)
// if ((*it) >= 0 && (*it) <= m_page->height())
// p->drawLine(FPoint(0, (*it)), FPoint(m_page->width(), (*it)));
p->drawLine(FPoint(horizontalFrom, (*it)), FPoint(horizontalTo, (*it)));
}
示例2: selectedHorizontals
Guides GuideManager::selectedHorizontals()
{
QModelIndex i;
QModelIndexList selectedIndexes = horizontalView->selectionModel()->selectedIndexes();
Guides ret;
Guides curr = horizontalModel->values();
foreach (i , selectedIndexes)
{
ret.append(curr.at(i.row()));
}
示例3: writeVerticalGuides
QString GuideManagerIO::writeVerticalGuides(ScPage *page, GuideManagerCore::GuideType type)
{
Guides::iterator it;
QString retval;
QString tmp;
Guides tmpGuides = page->guides.verticals(type);
for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it)
{
tmp = tmp.setNum((*it));
retval += tmp + " ";
}
return retval;
}
示例4: getAutoVerticals
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_verticalAutoRefer == 1)
{
newPageWidth = newPageWidth - page->Margins.Left - page->Margins.Right;
offset = page->Margins.Left;
}
else if (m_verticalAutoRefer == 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;
}
示例5: getAutoHorizontals
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;
}
示例6: foreach
void GuideManager::delVerButton_clicked()
{
QModelIndexList indexes = verticalView->selectionModel()->selectedRows(0);
QModelIndex ix;
Guides v;
foreach(ix, indexes)
// here *must* go EditRole due truncations in DisplayRole
// see GuidesModel::data()
v.append(verticalModel->data(ix, Qt::EditRole).toDouble());
verticalModel->removeValues(v);
currentPage->guides.clearVerticals(GuideManagerCore::Standard);
currentPage->guides.addVerticals(verticalModel->values(), GuideManagerCore::Standard);
drawGuides();
m_Doc->changed();
}
示例7: addHorizontals
void GuideManagerCore::addHorizontals(Guides values, GuideType type)
{
Guides::iterator it;
switch (type)
{
case Standard:
for (it = values.begin(); it != values.end(); ++it)
{
if (!m_horizontalStdG.contains((*it)))
m_horizontalStdG.append((*it));
}
break;
case Auto:
m_horizontalAutoG.clear();
for (it = values.begin(); it != values.end(); ++it)
m_horizontalAutoG.append((*it));
break;
}
}
示例8: Py_BuildValue
PyObject *scribus_getVguides(PyObject* /* self */)
{
if(!checkHaveDocument())
return NULL;
Guides g = ScCore->primaryMainWindow()->doc->currentPage()->guides.verticals(GuideManagerCore::Standard);
int n = g.count();//ScCore->primaryMainWindow()->doc->currentPage->XGuides.count();
if (n == 0)
return Py_BuildValue((char*)"[]");
int i;
double tmp;
PyObject *l, *guide;
l = PyList_New(0);
for (i=0; i<n; i++)
{
tmp = g[i];
guide = Py_BuildValue("d", PointToValue(tmp));
PyList_Append(l, guide);
}
return l;
}
示例9: isMouseOnVertical
int GuideManagerCore::isMouseOnVertical(double low, double high, GuideType type)
{
Guides tmp;
Guides::iterator it;
switch (type)
{
case Standard:
tmp = m_verticalStdG;
break;
case Auto:
tmp = m_horizontalAutoG;
break;
}
for (it = tmp.begin(); it != tmp.end(); ++it)
{
double guideOffset = (*it) + m_page->xOffset();
if (guideOffset < low && guideOffset > high)
return it - tmp.begin();
}
return -1;
}