Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 3941 → Rev 3942

/branches/Version13x/Scribus/scribus/rulermover.cpp
51,7 → 51,7
{
currView->DrVX = -1;
currView->DrHY = -1;
currView->setRuler(m);
currView->setNewRulerOrigin(m);
}
qApp->setOverrideCursor(QCursor(ArrowCursor), true);
Mpressed = false;
/branches/Version13x/Scribus/scribus/reformdoc.cpp
988,7 → 988,7
currDoc->PDF_Options.PrintProf = currDoc->CMSSettings.DefaultPrinterProfile;
currDoc->PDF_Options.Intent = currDoc->CMSSettings.DefaultIntentMonitor;
ScApp->recalcColors(ScApp->mainWindowProgressBar);
ScApp->view->RecalcPictures(&ScApp->InputProfiles, &ScApp->InputProfilesCMYK, ScApp->mainWindowProgressBar);
currDoc->RecalcPictures(&ScApp->InputProfiles, &ScApp->InputProfilesCMYK, ScApp->mainWindowProgressBar);
#endif
ScApp->mainWindowProgressBar->setProgress(cc);
qApp->setOverrideCursor(QCursor(arrowCursor), true);
/branches/Version13x/Scribus/scribus/scribusdoc.cpp
22,6 → 22,7
 
#include <utility>
#include <qfile.h>
#include <qprogressbar.h>
 
#include "filewatcher.h"
#include "hyphenator.h"
3384,3 → 3385,99
ite->setFillQColor();
}
}
 
//CB Moved from view
void ScribusDoc::RecalcPictures(ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia)
{
uint docItemCount=Items->count();
if ( docItemCount!= 0)
{
int counter;
bool usingGUI=ScQApp->usingGUI();
if (usingGUI)
{
if (dia != NULL)
counter = dia->progress();
else
counter = 0;
}
PageItem* it;
for (uint i=0; i < docItemCount; ++i)
{
it = Items->at(i);
if ((it->itemType() == PageItem::ImageFrame) && (it->PicAvail))
{
if (it->pixm.imgInfo.colorspace == 1)
{
if (!PrCMYK->contains(it->IProfile))
it->IProfile = CMSSettings.DefaultImageCMYKProfile;
}
else
{
if (!Pr->contains(it->IProfile))
it->IProfile = CMSSettings.DefaultImageRGBProfile;
}
LoadPict(it->Pfile, i, true);
}
if (usingGUI)
{
++counter;
if (dia != NULL)
dia->setProgress(counter);
}
}
}
}
 
void ScribusDoc::buildAlignItemList()
{
PageItem *currItem;
int ObjGroup;
struct AlignObjs Object;
AObjects.clear();
//for (uint a = 0; a < SelItem.count(); ++a)
for (uint a = 0; a < selection->count(); ++a)
{
//currItem = SelItem.at(a);
currItem = selection->itemAt(a);
Object.Objects.clear();
currItem->getBoundingRect(&Object.x1, &Object.y1, &Object.x2, &Object.y2);
if (currItem->Groups.count() > 0)
{
ObjGroup = currItem->Groups.top();
bool found = false;
for (uint a2 = 0; a2 < AObjects.count(); ++a2)
{
if (AObjects[a2].Group == ObjGroup)
{
AObjects[a2].x1 = QMIN(AObjects[a2].x1, Object.x1);
AObjects[a2].y1 = QMIN(AObjects[a2].y1, Object.y1);
AObjects[a2].x2 = QMAX(AObjects[a2].x2, Object.x2);
AObjects[a2].y2 = QMAX(AObjects[a2].y2, Object.y2);
AObjects[a2].Objects.append(currItem);
found = true;
break;
}
}
if (!found)
{
Object.Group = ObjGroup;
Object.ObjNr = 0;
Object.Objects.append(currItem);
AObjects.append(Object);
}
}
else
{
Object.Group = 0;
Object.ObjNr = currItem->ItemNr;
Object.Objects.append(currItem);
AObjects.append(Object);
}
}
for (uint i = 0; i < AObjects.count(); ++i)
{
AObjects[i].width = AObjects[i].x2 - AObjects[i].x1;
AObjects[i].height = AObjects[i].y2 - AObjects[i].y1;
}
}
/branches/Version13x/Scribus/scribus/scribusview.h
139,7 → 139,7
QPtrList<PageItem> linkedFramesToShow;
QValueList<int> SelNode;
 
QValueList<AlignObjs> AObjects;
struct oldPageVar
{
uint newPg;
156,10 → 156,14
void hideMasterPage();
QImage PageToPixmap(int Nr, int maxGr);
QImage MPageToPixmap(QString name, int maxGr);
void RecalcPictures(ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia = 0);
//void RecalcPictures(ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia = 0);
void RecalcPicturesRes();
void rulerMove(QMouseEvent *m);
void setRuler(QMouseEvent *m);
/**
* Called when the ruler origin is dragged
* @param m mouse event
*/
void setNewRulerOrigin(QMouseEvent *m);
void FromHRuler(QMouseEvent *m);
void FromVRuler(QMouseEvent *m);
void SetYGuide(QMouseEvent *m, int oldIndex);
252,7 → 256,6
void FlipImageV();
//void AdjustPictScale(PageItem *currItem, bool reload = true);
void PasteItem(struct CopyPasteBuffer *Buffer, bool loading, bool drag = false);
void BuildAObj();
void QueryFarben();
void rememberPreviousSettings(int mx=0, int my=0);
bool mousePressed();
286,7 → 289,10
void editExtendedImageProperties();
void TogglePic();
void UpdatePic();
void FrameToPic();
/**
* Adjust an image frame's size to fit the size of the image in it
*/
void adjustFrametoImageSize();
void ToggleBookmark();
void ToggleAnnotation();
void ToggleLock();
328,6 → 334,11
 
private slots:
void Zval();
/**
* Called to update the GUI when the canvas(view) scrollbars are moved
* @param x
* @param y
*/
void setRulerPos(int x, int y);
void selectionChanged();
void setObjectUndoMode();
/branches/Version13x/Scribus/scribus/pageitem.cpp
1760,8 → 1760,6
ScaleType = freeScale;
AspectRatio = keepRatio;
AdjustPictScale();
//FIXME emit here instead
ScApp->propertiesPalette->setLvalue(LocalScX, LocalScY, LocalX, LocalY);
ScApp->view->RefreshItem(this);
}
 
3451,8 → 3449,7
cl.scale(LocalScX, LocalScY);
imageClip.map(cl);
}
//FIXME Make this emit here, currently pasted after calls to this function in the view
//emit SetLocalValues(LocalScX, LocalScY, LocalX, LocalY );
emit imageOffsetScale(LocalScX, LocalScY, LocalX, LocalY );
}
 
QRect PageItem::getRedrawBounding(const double viewScale)
3650,6 → 3647,7
 
void PageItem::emitAllToGUI()
{
qDebug("bling");
emit position(Xpos, Ypos);
emit widthAndHeight(Width, Height);
emit rotation(Rot);
/branches/Version13x/Scribus/scribus/scribusdoc.h
58,7 → 58,9
class Hyphenator;
class Selection;
 
class QProgressBar;
 
 
/**
* the Document Class
*/
382,9 → 384,21
* @retval Return false on failure
*/
const bool LoadPict(QString fn, int ItNr, bool reload = false);
/**
*
* @param fn
* @param pageItem
* @param reload
* @return
*/
const bool loadPict(QString fn, PageItem *pageItem, bool reload = false);
/**
*
* @param currItem
* @return
*/
void RecalcPictures(ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia = 0);
/**
* @brief Find the minX,MinY and maxX,maxY for the canvas required for the doc
*/
void canvasMinMax(FPoint&, FPoint&);
475,6 → 489,10
* @brief Update the fill and line QColors for all items in the doc
*/
void updateAllItemQColors();
/**
*
*/
void buildAlignItemList();
 
protected:
520,6 → 538,8
QPtrList<PageItem> MasterItems;
QPtrList<PageItem> DocItems;
QPtrList<PageItem> FrameItems;
/**List of objects for alignment purposes*/
QValueList<AlignObjs> AObjects;
Selection* selection;
/** Pagewidth */
double pageWidth;
/branches/Version13x/Scribus/scribus/scribusview.cpp
83,6 → 83,7
#endif
 
#include "scfontmetrics.h"
#include "scmessagebox.h"
#include "util.h"
#include "story.h"
#include "prefsmanager.h"
1899,9 → 1900,9
if ((!currItem->isTableItem) && (!currItem->isSingleSel))
{
pmen->insertItem( tr("Le&vel"), pmenLevel);
ScApp->scrActions["itemRaiseToTop"]->addTo(pmenLevel);
ScApp->scrActions["itemRaise"]->addTo(pmenLevel);
ScApp->scrActions["itemLower"]->addTo(pmenLevel);
ScApp->scrActions["itemRaiseToTop"]->addTo(pmenLevel);
ScApp->scrActions["itemLowerToBottom"]->addTo(pmenLevel);
}
}
2630,7 → 2631,9
if (currItem->itemType() == PageItem::ImageFrame)
{
currItem->AdjustPictScale();
/*Dont need this now adjustpictscale will emit for 1st selected item
emit SetLocalValues(currItem->LocalScX, currItem->LocalScY, currItem->LocalX, currItem->LocalY );
*/
}
UpdateClip(currItem);
emit ItemTextCols(currItem->Cols, currItem->ColGap);
5676,7 → 5679,7
}
return;
}
FPoint oldPos = FPoint(currItem->xPos(), currItem->yPos());
FPoint oldPos(currItem->xyPos());
double offsX = currItem->width() / 2.0;
double offsY = currItem->height() / 2.0;
ma.translate(-offsX, -offsY);
6057,7 → 6060,9
if ((currItem->asImageFrame()) && (!currItem->Sizing) && (!Doc->EditClip))
{
currItem->AdjustPictScale();
/*Dont need this now adjustpictscale will emit for 1st selected item
emit SetLocalValues(currItem->LocalScX, currItem->LocalScY, currItem->LocalX, currItem->LocalY );
*/
}
if (currItem->asLine())
{
7179,11 → 7184,10
 
void ScribusView::selectPage(QMouseEvent *m)
{
QRect mpo;
Mpressed = true;
Mxp = static_cast<int>(m->x()/Scale);
Myp = static_cast<int>(m->y()/Scale);
mpo = QRect(m->x()-Doc->guidesSettings.grabRad, m->y()-Doc->guidesSettings.grabRad, Doc->guidesSettings.grabRad*2, Doc->guidesSettings.grabRad*2);
QRect mpo(m->x()-Doc->guidesSettings.grabRad, m->y()-Doc->guidesSettings.grabRad, Doc->guidesSettings.grabRad*2, Doc->guidesSettings.grabRad*2);
mpo.moveBy(qRound(Doc->minCanvasCoordinate.x() * Scale), qRound(Doc->minCanvasCoordinate.y() * Scale));
ClRe = -1;
Deselect(false);
7763,8 → 7767,9
Doc->appMode = modeNormal;
emit DocChanged();
currItem->Sizing = currItem->asLine() ? false : true;
//CB unnecessary now with addItem
//EmitValues(currItem);
currItem->emitAllToGUI();
//currItem->emitAllToGUI();
}
 
/*
8163,9 → 8168,9
{
if (currItem->itemText.count() != 0 && (currItem->NextBox == 0 || currItem->BackBox == 0))
{
int t = QMessageBox::warning(this, CommonStrings::trWarning,
int t = ScMessageBox::warning(this, CommonStrings::trWarning,
tr("Do you really want to clear all your text?"),
QMessageBox::No, QMessageBox::Yes, QMessageBox::NoButton);
QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton);
if (t == QMessageBox::No)
continue;
}
8358,7 → 8363,7
_groupTransactionStarted = isOn;
}
 
// jjsa 27-03-2004 add for better settinf while zooming
// jjsa 27-03-2004 add for better setting while zooming
void ScribusView::rememberPreviousSettings(int mx, int my)
{
oldX = mx;
8384,6 → 8389,7
horizRuler->repaint();
vertRuler->repaint();
evSpon = true;
QString newStatusBarText;
if ((verticalScrollBar()->draggingSlider()) || (horizontalScrollBar()->draggingSlider()))
{
QValueList<int> pag;
8401,10 → 8407,9
pag.append(a+1);
}
if (!pag.isEmpty())
ScApp->mainWindowStatusLabel->setText( tr("Page %1 to %2").arg(pag.first()).arg(pag.last()));
newStatusBarText=( tr("Page %1 to %2").arg(pag.first()).arg(pag.last()));
}
else
ScApp->mainWindowStatusLabel->setText("");
ScApp->mainWindowStatusLabel->setText(newStatusBarText);
}
 
void ScribusView::Zval()
8690,12 → 8695,6
emit changeLA(layerNumber);
}
 
void ScribusView::GotoPa(int Seite)
{
GotoPage(Seite-1);
//ScApp->setFocus();
}
 
void ScribusView::ChgUnit(int art)
{
emit changeUN(art);
8704,6 → 8703,12
horizRuler->repaint();
}
 
void ScribusView::GotoPa(int Seite)
{
GotoPage(Seite-1);
//ScApp->setFocus();
}
 
void ScribusView::GotoPage(int Seite)
{
Doc->currentPage = Doc->Pages->at(Seite);
8753,6 → 8758,7
// DrawNew();
}
 
/*CB Moved to doc
void ScribusView::RecalcPictures(ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia)
{
uint docItemCount=Doc->Items->count();
8787,6 → 8793,7
}
}
}
*/
 
QImage ScribusView::MPageToPixmap(QString name, int maxGr)
{
8899,7 → 8906,7
DrVX = newX;
}
 
void ScribusView::setRuler(QMouseEvent *m)
void ScribusView::setNewRulerOrigin(QMouseEvent *m)
{
QPoint py = viewport()->mapFromGlobal(m->globalPos());
Doc->rulerXoffset = (py.x() + contentsX()) / Scale + Doc->minCanvasCoordinate.x();
8912,10 → 8919,11
setRulerPos(contentsX(), contentsY());
updateContents();
//if (SelItem.count() != 0)
if (Doc->selection->count() != 0)
int docSelectionCount=Doc->selection->count();
if (docSelectionCount != 0)
{
//if (SelItem.count() > 1)
if (Doc->selection->count() > 1)
if (docSelectionCount > 1)
{
double x, y, w, h;
getGroupRect(&x, &y, &w, &h);
10454,6 → 10462,7
//We only need to emit this for the 1st item in the selection, if theres no item selected,
//prop pal is showing 0s anyway. Multi selection needs fixing for prop pal anyway
//if (SelItem.count()!=0)
/*Dont need this now adjustpictscale will emit for 1st selected item
if (Doc->selection->count()!=0)
{
//PageItem* currItem=SelItem.at(0);
10460,6 → 10469,7
PageItem* currItem=Doc->selection->itemAt(0);
emit SetLocalValues(currItem->LocalScX, currItem->LocalScY, currItem->LocalX, currItem->LocalY );
}
*/
emit DocChanged();
}
 
10508,6 → 10518,7
//We only need to emit this for the 1st item in the selection, if theres no item selected,
//prop pal is showing 0s anyway. Multi selection needs fixing for prop pal anyway
//if (SelItem.count()!=0)
/*Dont need this now adjustpictscale will emit for 1st selected item
if (Doc->selection->count()!=0)
{
//PageItem* currItem=SelItem.at(0);
10514,6 → 10525,7
PageItem* currItem=Doc->selection->itemAt(0);
emit SetLocalValues(currItem->LocalScX, currItem->LocalScY, currItem->LocalX, currItem->LocalY );
}
*/
updateContents();
emit DocChanged();
}
10556,11 → 10568,11
void ScribusView::UpdatePic()
{
//uint selectedItemCount=SelItem.count();
uint selectedItemCount=Doc->selection->count();
if (selectedItemCount > 0)
uint docSelectionCount=Doc->selection->count();
if (docSelectionCount > 0)
{
bool toUpdate=false;
for (uint i = 0; i < selectedItemCount; ++i)
for (uint i = 0; i < docSelectionCount; ++i)
{
//if (SelItem.at(i)!=NULL)
if (Doc->selection->itemAt(i)!=NULL)
10568,7 → 10580,7
if (Doc->selection->itemAt(i)->asImageFrame())
{
//PageItem *currItem = SelItem.at(0);
PageItem *currItem = Doc->selection->itemAt(0);
PageItem *currItem = Doc->selection->itemAt(i);//CB should be i, not 0
if (currItem->PicAvail)
{
int fho = currItem->imageFlippedH();
10583,15 → 10595,17
}
if (toUpdate)
{
/*Dont need this now adjustpictscale will emit for 1st selected item
//PageItem* currItem=SelItem.at(0);
PageItem* currItem=Doc->selection->itemAt(0);
emit SetLocalValues(currItem->LocalScX, currItem->LocalScY, currItem->LocalX, currItem->LocalY );
*/
updateContents();
}
}
}
 
void ScribusView::FrameToPic()
void ScribusView::adjustFrametoImageSize()
{
uint docSelectionCount=Doc->selection->count();
//if (SelItem.count() > 0)
10605,33 → 10619,30
//if (SelItem.at(i)!=NULL)
if (currItem!=NULL)
//if (SelItem.at(i)->asImageFrame())
if (currItem->asImageFrame())
if (currItem->asImageFrame() && currItem->PicAvail && !currItem->isTableItem)
{
//PageItem *currItem = SelItem.at(i);
if (currItem->PicAvail)
double w, h;
if (currItem->pixm.imgInfo.lowResType == 0)
{
double w, h, x, y;
if (currItem->pixm.imgInfo.lowResType == 0)
{
w = static_cast<double>(currItem->pixm.width()) * currItem->LocalScX;
h = static_cast<double>(currItem->pixm.height()) * currItem->LocalScY;
}
else
{
w = static_cast<double>(currItem->pixm.width())*currItem->pixm.imgInfo.lowResScale * currItem->LocalScX;
h = static_cast<double>(currItem->pixm.height())*currItem->pixm.imgInfo.lowResScale * currItem->LocalScY;
}
x = currItem->LocalX * currItem->LocalScX;
y = currItem->LocalY * currItem->LocalScY;
if (!currItem->isTableItem)
{
SizeItem(w, h, currItem->ItemNr);
MoveItem(x, y, currItem);
currItem->LocalX = 0;
currItem->LocalY = 0;
}
toUpdate=true;
w = static_cast<double>(currItem->pixm.width()) * currItem->LocalScX;
h = static_cast<double>(currItem->pixm.height()) * currItem->LocalScY;
}
else
{
w = static_cast<double>(currItem->pixm.width())*currItem->pixm.imgInfo.lowResScale * currItem->LocalScX;
h = static_cast<double>(currItem->pixm.height())*currItem->pixm.imgInfo.lowResScale * currItem->LocalScY;
}
double x = currItem->LocalX * currItem->LocalScX;
double y = currItem->LocalY * currItem->LocalScY;
//CB Why is this here? We do nothing if it is a table item so push it up to the other if
//if (!currItem->isTableItem)
//{
SizeItem(w, h, currItem->ItemNr);
MoveItem(x, y, currItem);
currItem->LocalX = 0;
currItem->LocalY = 0;
//}
toUpdate=true;
}
}
if (toUpdate)
10982,8 → 10993,10
if (currItem->asImageFrame())
{
currItem->AdjustPictScale();
/*Dont need this now adjustpictscale will emit for 1st selected item
//FIXME: From old AdjustPictScale, Emit the new scale to the Prop Pal..
emit SetLocalValues(currItem->LocalScX, currItem->LocalScY, currItem->LocalX, currItem->LocalY );
*/
}
if ((currItem->asTextFrame()) && !(currItem->asPathText()))
currItem->IFont = Doc->toolSettings.defFont;
11043,59 → 11056,6
emit NewBMNr(currItem->BMnr, z); */
}
 
void ScribusView::BuildAObj()
{
PageItem *currItem;
int ObjGroup;
struct AlignObjs Object;
AObjects.clear();
//for (uint a = 0; a < SelItem.count(); ++a)
for (uint a = 0; a < Doc->selection->count(); ++a)
{
//currItem = SelItem.at(a);
currItem = Doc->selection->itemAt(a);
Object.Objects.clear();
currItem->getBoundingRect(&Object.x1, &Object.y1, &Object.x2, &Object.y2);
if (currItem->Groups.count() > 0)
{
ObjGroup = currItem->Groups.top();
bool found = false;
for (uint a2 = 0; a2 < AObjects.count(); ++a2)
{
if (AObjects[a2].Group == ObjGroup)
{
AObjects[a2].x1 = QMIN(AObjects[a2].x1, Object.x1);
AObjects[a2].y1 = QMIN(AObjects[a2].y1, Object.y1);
AObjects[a2].x2 = QMAX(AObjects[a2].x2, Object.x2);
AObjects[a2].y2 = QMAX(AObjects[a2].y2, Object.y2);
AObjects[a2].Objects.append(currItem);
found = true;
break;
}
}
if (!found)
{
Object.Group = ObjGroup;
Object.ObjNr = 0;
Object.Objects.append(currItem);
AObjects.append(Object);
}
}
else
{
Object.Group = 0;
Object.ObjNr = currItem->ItemNr;
Object.Objects.append(currItem);
AObjects.append(Object);
}
}
for (uint i = 0; i < AObjects.count(); ++i)
{
AObjects[i].width = AObjects[i].x2 - AObjects[i].x1;
AObjects[i].height = AObjects[i].y2 - AObjects[i].y1;
}
}
 
void ScribusView::QueryFarben()
{
PageItem *currItem;
/branches/Version13x/Scribus/scribus/actionmanager.cpp
679,7 → 679,7
connect( (*scrActions)["itemDetachTextFromPath"], SIGNAL(activated()), currView, SLOT(FromPathText()) );
connect( (*scrActions)["itemLock"], SIGNAL(activated()), currView, SLOT(ToggleLock()) );
connect( (*scrActions)["itemLockSize"], SIGNAL(activated()), currView, SLOT(ToggleSizeLock()) );
connect( (*scrActions)["itemAdjustFrameToImage"], SIGNAL(activated()), currView, SLOT(FrameToPic()) );
connect( (*scrActions)["itemAdjustFrameToImage"], SIGNAL(activated()), currView, SLOT(adjustFrametoImageSize()) );
connect( (*scrActions)["itemUpdateImage"], SIGNAL(activated()), currView, SLOT(UpdatePic()) );
connect( (*scrActions)["itemExtendedImageProperties"], SIGNAL(activated()), currView, SLOT(editExtendedImageProperties()) );
}
/branches/Version13x/Scribus/scribus/scribus.cpp
2945,7 → 2945,7
if (CMSavail && doc->CMSSettings.CMSinUse)
{
recalcColors();
view->RecalcPictures(&InputProfiles, &InputProfilesCMYK);
doc->RecalcPictures(&InputProfiles, &InputProfilesCMYK);
}
uint docItemsCount=doc->Items->count();
for (uint i = oldItemsCount; i < docItemsCount; ++i)
3235,7 → 3235,7
if (doc->CMSSettings.CMSinUse)
{
recalcColors();
view->RecalcPictures(&InputProfiles, &InputProfilesCMYK);
doc->RecalcPictures(&InputProfiles, &InputProfilesCMYK);
}
}
else
/branches/Version13x/Scribus/scribus/aligndistribute.cpp
363,13 → 363,13
currView=newView;
if (currView!=NULL)
{
alignObjects=&(currView->AObjects);
currDoc=currView->Doc;
alignObjects=&(currDoc->AObjects);
}
else
{
currDoc=NULL;
alignObjects=NULL;
currDoc=NULL;
}
unitChange();
}
376,7 → 376,7
 
bool AlignDistributePalette::startAlign()
{
currView->BuildAObj();
currDoc->buildAlignItemList();
alignObjectsCount=alignObjects->count();
if (alignObjectsCount==0)
return false;