Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 17904 → Rev 17905

/trunk/Scribus/scribus/fpointarray.h
85,7 → 85,7
bool parseSVG(const QString& svgPath);
QString svgPath(bool closed = false) const;
QPainterPath toQPainterPath(bool closed);
void fromQPainterPath(QPainterPath &path);
void fromQPainterPath(QPainterPath &path, bool close = false);
private:
SVGState * svgState;
};
/trunk/Scribus/scribus/scribusdoc.cpp
15137,6 → 15137,77
setRedrawBounding(item);
}
 
void ScribusDoc::resizeGroupToContents(PageItem* group)
{
PageItem_Group* currItem = group->asGroupFrame();
QPainterPath input1 = currItem->PoLine.toQPainterPath(true);
input1.translate(currItem->xPos(), currItem->yPos());
if (currItem->fillEvenOdd())
input1.setFillRule(Qt::OddEvenFill);
else
input1.setFillRule(Qt::WindingFill);
double minx = std::numeric_limits<double>::max();
double miny = std::numeric_limits<double>::max();
double maxx = -std::numeric_limits<double>::max();
double maxy = -std::numeric_limits<double>::max();
int gcount = currItem->groupItemList.count();
for (int c = 0; c < gcount; c++)
{
PageItem* gItem = currItem->groupItemList.at(c);
gItem->setXYPos(currItem->xPos() + gItem->gXpos, currItem->yPos() + gItem->gYpos, true);
double x1, x2, y1, y2;
gItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
minx = qMin(minx, x1);
miny = qMin(miny, y1);
maxx = qMax(maxx, x2);
maxy = qMax(maxy, y2);
}
double oldW = currItem->width();
double oldH = currItem->height();
currItem->setXYPos(minx, miny, true);
currItem->setWidthHeight(maxx - minx, maxy - miny, true);
currItem->groupWidth = maxx - minx;
currItem->groupHeight = maxy - miny;
for (int c = 0; c < gcount; c++)
{
PageItem* gItem = currItem->groupItemList.at(c);
gItem->gXpos = gItem->xPos() - minx;
gItem->gYpos = gItem->yPos() - miny;
gItem->gWidth = maxx - minx;
gItem->gHeight = maxy - miny;
}
currItem->SetRectFrame();
if ((currItem->width() < oldW) || (currItem->height() < oldH))
{
QPainterPath input2 = currItem->PoLine.toQPainterPath(true);
input2.translate(currItem->xPos(), currItem->yPos());
if (currItem->fillEvenOdd())
input2.setFillRule(Qt::OddEvenFill);
else
input2.setFillRule(Qt::WindingFill);
QPainterPath result = input1.intersected(input2);
result.translate(-currItem->xPos(), -currItem->yPos());
currItem->PoLine.fromQPainterPath(result, true);
}
currItem->adjustXYPosition();
}
 
void ScribusDoc::itemSelection_resizeGroupToContents(Selection* customSelection)
{
Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
if (itemSelection->count() != 0)
{
int docSelectionCount = itemSelection->count();
for (int a = 0; a < docSelectionCount; ++a)
{
PageItem *group = itemSelection->itemAt(a);
if (group->isGroup())
resizeGroupToContents(group);
}
regionsChanged()->update(QRectF());
}
}
 
void ScribusDoc::itemSelection_UniteItems(Selection* /*customSelection*/)
{
PageItem *currItem;
/trunk/Scribus/scribus/fpointarray.cpp
566,7 → 566,7
return m_path;
}
 
void FPointArray::fromQPainterPath(QPainterPath &path)
void FPointArray::fromQPainterPath(QPainterPath &path, bool close)
{
resize(0);
svgInit();
591,6 → 591,8
break;
}
}
if (close)
svgClosePath();
}
 
FPointArray::~FPointArray()
/trunk/Scribus/scribus/pageitem.cpp
2760,7 → 2760,11
void PageItem::setGradient(const QString &newGradient)
{
if (gradientVal != newGradient)
{
gradientVal = newGradient;
if (m_Doc->docGradients.contains(gradientVal))
fill_gradient = m_Doc->docGradients[gradientVal];
}
}
 
void PageItem::setMaskGradient(VGradient grad){
/trunk/Scribus/scribus/scribusdoc.h
1030,6 → 1030,8
void itemSelection_UnGroupObjects(Selection* customSelection=0);
void addToGroup(PageItem* group, PageItem* item);
void removeFromGroup(PageItem* item);
void resizeGroupToContents(PageItem* group);
void itemSelection_resizeGroupToContents(Selection *customSelection=0);
void itemSelection_convertItemsTo(const PageItem::ItemType newType, Selection* restoredSelection=0, Selection* customSelection=0);
 
void itemSelection_ApplyParagraphStyle(const ParagraphStyle & newstyle, Selection* customSelection=0, bool rmDirectFormatting = false);
/trunk/Scribus/scribus/actionmanager.cpp
400,6 → 400,8
scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
name="itemUngroup";
scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
name="itemGroupAdjust";
scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
name="itemLock";
scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
name="itemLockSize";
524,6 → 526,7
connect( (*scrActions)["itemTransform"], SIGNAL(triggered()), mainWindow, SLOT(slotItemTransform()) );
connect( (*scrActions)["itemGroup"], SIGNAL(triggered()), mainWindow, SLOT(GroupObj()) );
connect( (*scrActions)["itemUngroup"], SIGNAL(triggered()), mainWindow, SLOT(UnGroupObj()) );
connect( (*scrActions)["itemGroupAdjust"], SIGNAL(triggered()), mainWindow, SLOT(AdjustGroupObj()) );
connect( (*scrActions)["itemPDFAnnotationProps"], SIGNAL(triggered()), mainWindow, SLOT(ModifyAnnot()) );
connect( (*scrActions)["itemPDFFieldProps"], SIGNAL(triggered()), mainWindow, SLOT(ModifyAnnot()) );
connect( (*scrActions)["itemSendToPattern"], SIGNAL(triggered()), mainWindow, SLOT(PutToPatterns()) );
1494,6 → 1497,7
(*scrActions)["itemDelete"]->setTexts( tr("&Delete"));
(*scrActions)["itemGroup"]->setTexts( tr("&Group"));
(*scrActions)["itemUngroup"]->setTexts( tr("&Ungroup"));
(*scrActions)["itemGroupAdjust"]->setTexts( tr("Adjust Group"));
(*scrActions)["itemLock"]->setTexts( tr("Is &Locked"));
(*scrActions)["itemLockSize"]->setTexts( tr("Si&ze is Locked"));
(*scrActions)["itemPrintingEnabled"]->setTexts( tr("&Printing Enabled"));
1993,6 → 1997,7
<< "itemDelete"
<< "itemGroup"
<< "itemUngroup"
<< "itemGroupAdjust"
<< "itemLock"
<< "itemLockSize"
<< "itemImageIsVisible"
/trunk/Scribus/scribus/ui/contextmenu.cpp
386,7 → 386,10
else
{
if (currItem->isGroup())
{
addAction(m_AP->scrActions["itemUngroup"]);
addAction(m_AP->scrActions["itemGroupAdjust"]);
}
}
//-->
 
/trunk/Scribus/scribus/scribus.cpp
826,6 → 826,7
scrMenuMgr->addMenuSeparator("Item");
scrMenuMgr->addMenuItem(scrActions["itemGroup"], "Item", false);
scrMenuMgr->addMenuItem(scrActions["itemUngroup"], "Item", false);
scrMenuMgr->addMenuItem(scrActions["itemGroupAdjust"], "Item", false);
scrMenuMgr->addMenuItem(scrActions["itemLock"], "Item", false);
scrMenuMgr->addMenuItem(scrActions["itemLockSize"], "Item", false);
scrMenuMgr->addMenuSeparator("Item");
3288,10 → 3289,12
if (currItem->isGroup())
{
scrActions["itemUngroup"]->setEnabled(doc->appMode != modeEdit);
scrActions["itemGroupAdjust"]->setEnabled(doc->appMode != modeEdit);
}
else
{
scrActions["itemUngroup"]->setEnabled(false);
scrActions["itemGroupAdjust"]->setEnabled(false);
scrActions["itemSplitPolygons"]->setEnabled( (currItem->asPolygon()) && (currItem->Segments.count() != 0) );
}
if (currItem->locked())
7825,6 → 7828,7
{
view->requestMode(modeEditClip);
scrActions["itemUngroup"]->setEnabled(false);
scrActions["itemGroupAdjust"]->setEnabled(false);
}
}
else if (ite->itemType() == PageItem::TextFrame)
9142,6 → 9146,12
doc->itemSelection_UnGroupObjects();
}
 
void ScribusMainWindow::AdjustGroupObj()
{
if (HaveDoc)
doc->itemSelection_resizeGroupToContents();
}
 
void ScribusMainWindow::restore(UndoState* state, bool isUndo)
{
SimpleState *ss = dynamic_cast<SimpleState*>(state);
/trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
266,8 → 266,16
{
tmpSele->clear();
QDir::setCurrent(CurDirP);
if ((Elements.count() == 1) && (!(importerFlags & LoadSavePlugin::lfCreateDoc)))
{
PageItem *gr = Elements[0];
m_Doc->resizeGroupToContents(gr);
}
if ((Elements.count() > 1) && (!(importerFlags & LoadSavePlugin::lfCreateDoc)))
m_Doc->groupObjectsList(Elements);
{
PageItem *gr = m_Doc->groupObjectsList(Elements);
m_Doc->resizeGroupToContents(gr);
}
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
/trunk/Scribus/scribus/scribus.h
477,6 → 477,7
void Apply_MasterPage(QString pageName, int pageNumber, bool reb = true);
void GroupObj(bool showLockDia = true);
void UnGroupObj();
void AdjustGroupObj();
void StatusPic();
void ModifyAnnot();
void ToggleGuides();