Subversion Repositories Scribus

Compare Revisions

Regard whitespace Rev 3301 → Rev 3302

/branches/Version13x/Scribus/scribus/prefsmanager.cpp
1745,3 → 1745,8
QMessageBox::NoButton);
ScApp->showSplash(splashShowing);
}
 
const int PrefsManager::gsResolution()
{
return appPrefs.gs_Resolution;
}
/branches/Version13x/Scribus/scribus/prefsmanager.h
75,6 → 75,7
void setImageEditorExecutable(const QString&);
const QString ghostscriptExecutable();
const QString imageEditorExecutable();
const int gsResolution(); //Get the users preferred preview resolution
const QString documentDir(); // Get the users preferred document directory
const int mouseWheelValue();
const double displayScale(); // Get the user set display scale
/branches/Version13x/Scribus/scribus/pageitem.h
818,6 → 818,11
* @sa isTagged()
*/
void setTagged(bool);
/**
* @brief Load an image into an image frame, moved from ScribusView
* @return True if load succeeded
*/
bool loadImage(const QString& filename, const bool reload, const int gsResolution=-1);
protected:
/**
/branches/Version13x/Scribus/scribus/pageitem.cpp
34,6 → 34,7
#include "scribus.h"
#include "scribusstructs.h"
#include "scribusdoc.h"
#include "prefsmanager.h"
#include "undomanager.h"
#include "undostate.h"
#include "mpalette.h"
4837,7 → 4838,7
ScApp->view->ClearItem();
}
else
ScApp->view->loadPict(fn, this, false);
loadImage(fn, false);
}
 
void PageItem::select()
5296,3 → 5297,100
return ret;
}
*/
 
bool PageItem::loadImage(const QString& filename, const bool reload, const int gsResolution)
{
if (itemType()!=PageItem::ImageFrame)
return false;
QFileInfo fi(filename);
QString clPath(pixm.imgInfo.usedPath);
pixm.imgInfo.valid = false;
pixm.imgInfo.clipPath="";
pixm.imgInfo.PDSpathData.clear();
pixm.imgInfo.layerInfo.clear();
pixm.imgInfo.usedPath="";
imageClip.resize(0);
int gsRes=gsResolution;
if (gsResolution==-1) //If it wasn't supplied, get it from PrefsManager.
gsRes=PrefsManager::instance()->gsResolution();
bool dummy;
if (!pixm.LoadPicture(filename, IProfile, IRender, UseEmbedded, true, 2, gsRes, &dummy))
{
Pfile = fi.absFilePath();
PicAvail = false;
PicArt = false;
}
else
{
if (UndoManager::undoEnabled() && !reload)
{
SimpleState *ss = new SimpleState(Um::GetImage, filename, Um::IGetImage);
ss->set("GET_IMAGE", "get_image");
ss->set("OLD_IMAGE_PATH", Pfile);
ss->set("NEW_IMAGE_PATH", filename);
undoManager->action(this, ss);
}
double xres = pixm.imgInfo.xres;
double yres = pixm.imgInfo.yres;
PicAvail = true;
PicArt = true;
BBoxX = 0;
if (Pfile != filename)
{
LocalScX = 72.0 / xres;
LocalScY = 72.0 / yres;
LocalX = 0;
LocalY = 0;
if ((Doc->toolSettings.useEmbeddedPath) && (!pixm.imgInfo.clipPath.isEmpty()))
{
pixm.imgInfo.usedPath = pixm.imgInfo.clipPath;
clPath = pixm.imgInfo.clipPath;
if (pixm.imgInfo.PDSpathData.contains(clPath))
{
imageClip = pixm.imgInfo.PDSpathData[clPath].copy();
pixm.imgInfo.usedPath = clPath;
QWMatrix cl;
cl.translate(LocalX*LocalScX, LocalY*LocalScY);
cl.scale(LocalScX, LocalScY);
imageClip.map(cl);
}
}
}
Pfile = fi.absFilePath();
if (reload && pixm.imgInfo.PDSpathData.contains(clPath))
{
imageClip = pixm.imgInfo.PDSpathData[clPath].copy();
pixm.imgInfo.usedPath = clPath;
QWMatrix cl;
cl.translate(LocalX*LocalScX, LocalY*LocalScY);
cl.scale(LocalScX, LocalScY);
imageClip.map(cl);
}
BBoxH = pixm.height();
OrigW = pixm.width();
OrigH = pixm.height();
QString ext = fi.extension(false).lower();
isRaster = !(ext == "pdf" || ext == "ps" || ext == "eps");
UseEmbedded=pixm.imgInfo.isEmbedded;
if (pixm.imgInfo.isEmbedded)
{
IProfile = "Embedded " + pixm.imgInfo.profileName;
EmProfile = "Embedded " + pixm.imgInfo.profileName;
}
else
IProfile = pixm.imgInfo.profileName;
}
if (PicAvail)
{
if (pixm.imgInfo.lowResType != 0)
{
double scaling = pixm.imgInfo.xres / 36.0;
if (pixm.imgInfo.lowResType == 1)
scaling = pixm.imgInfo.xres / 72.0;
pixm.createLowRes(scaling);
pixm.imgInfo.lowResScale = scaling;
}
pixm.applyEffect(effectsInUse, Doc->PageColors, false);
}
return true;
}
/branches/Version13x/Scribus/scribus/scribusview.cpp
9128,28 → 9128,25
 
void ScribusView::RecalcPictures(ProfilesL *Pr, QProgressBar *dia)
{
PageItem* it;
uint docItemCount=Doc->Items.count();
if ( docItemCount!= 0)
{
int counter;
if (dia != NULL)
counter = dia->progress();
else
counter = 0;
if (Doc->Items.count() != 0)
PageItem* it;
for (uint i=0; i < docItemCount; ++i)
{
for (uint i=0; i < Doc->Items.count(); i++)
{
it = Doc->Items.at(i);
if ((it->itemType() == PageItem::ImageFrame) && (it->PicAvail))
{
if (Pr->contains(it->IProfile))
LoadPict(it->Pfile, i, true);
else
{
if (!Pr->contains(it->IProfile))
it->IProfile = Doc->CMSSettings.DefaultImageRGBProfile;
LoadPict(it->Pfile, i, true);
}
}
counter++;
++counter;
if (dia != NULL)
dia->setProgress(counter);
}
9256,7 → 9253,7
 
void ScribusView::rulerMove(QMouseEvent *m)
{
QPoint py = viewport()->mapFromGlobal(m->globalPos());
QPoint py(viewport()->mapFromGlobal(m->globalPos()));
int newY = py.y();
int newX = py.x();
QPoint out = viewportToContents(py);
9911,12 → 9908,13
 
void ScribusView::ChLineWidth(double w)
{
if (SelItem.count() != 0)
uint selectedItemCount=SelItem.count();
if (selectedItemCount != 0)
{
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::LineWidth, "", Um::ILineStyle);
for (uint a = 0; a < SelItem.count(); ++a)
for (uint a = 0; a < selectedItemCount; ++a)
{
PageItem *currItem = SelItem.at(a);
currItem->OldPwidth = currItem->Pwidth;
9932,7 → 9930,7
}
RefreshItem(currItem);
}
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->commit();
}
}
9939,17 → 9937,18
 
void ScribusView::ChLineArt(PenStyle w)
{
if (SelItem.count() != 0)
uint selectedItemCount=SelItem.count();
if (selectedItemCount != 0)
{
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::LineStyle, "", Um::ILineStyle);
for (uint a = 0; a < SelItem.count(); ++a)
for (uint a = 0; a < selectedItemCount; ++a)
{
SelItem.at(a)->setLineStyle(w);
RefreshItem(SelItem.at(a));
}
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->commit();
}
}
9956,17 → 9955,18
 
void ScribusView::ChLineJoin(PenJoinStyle w)
{
if (SelItem.count() != 0)
uint selectedItemCount=SelItem.count();
if (selectedItemCount != 0)
{
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::LineJoin, "", Um::ILineStyle);
for (uint a = 0; a < SelItem.count(); ++a)
for (uint a = 0; a < selectedItemCount; ++a)
{
SelItem.at(a)->setLineJoin(w);
RefreshItem(SelItem.at(a));
}
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->commit();
}
}
9973,17 → 9973,18
 
void ScribusView::ChLineEnd(PenCapStyle w)
{
if (SelItem.count() != 0)
uint selectedItemCount=SelItem.count();
if (selectedItemCount != 0)
{
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::LineEnd, "", Um::ILineStyle);
for (uint a = 0; a < SelItem.count(); ++a)
for (uint a = 0; a < selectedItemCount; ++a)
{
SelItem.at(a)->setLineEnd(w);
RefreshItem(SelItem.at(a));
}
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->commit();
}
}
9990,18 → 9991,19
 
void ScribusView::ChLineSpa(double w)
{
if (SelItem.count() != 0)
uint selectedItemCount=SelItem.count();
if (selectedItemCount != 0)
{
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::SetLineSpacing, QString("%1").arg(w), Um::IFont);
for (uint a = 0; a < SelItem.count(); ++a)
for (uint a = 0; a < selectedItemCount; ++a)
{
SelItem.at(a)->setLineSpacing(w);
RefreshItem(SelItem.at(a));
}
Doc->docParagraphStyles[0].LineSpa = w;
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->commit();
}
}
10008,10 → 10010,11
 
void ScribusView::ChLocalXY(double x, double y)
{
if (SelItem.count() != 0)
uint selectedItemCount=SelItem.count();
if (selectedItemCount != 0)
{
PageItem *currItem;
for (uint a = 0; a < SelItem.count(); ++a)
for (uint a = 0; a < selectedItemCount; ++a)
{
currItem = SelItem.at(a);
currItem->LocalX = x;
10031,10 → 10034,11
 
void ScribusView::ChLocalSc(double x, double y)
{
if (SelItem.count() != 0)
uint selectedItemCount=SelItem.count();
if (selectedItemCount != 0)
{
PageItem *currItem;
for (uint a = 0; a < SelItem.count(); ++a)
for (uint a = 0; a < selectedItemCount; ++a)
{
currItem = SelItem.at(a);
currItem->LocalScX = x;
10054,11 → 10058,12
 
void ScribusView::ItemFont(QString fon)
{
if (SelItem.count() != 0)
uint selectedItemCount=SelItem.count();
if (selectedItemCount != 0)
{
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::SetFont, fon, Um::IFont);
for (uint aa = 0; aa < SelItem.count(); ++aa)
for (uint aa = 0; aa < selectedItemCount; ++aa)
{
PageItem *currItem = SelItem.at(aa);
if (Doc->appMode == modeNormal)
10091,7 → 10096,7
}
}
}
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->commit();
}
}
10098,15 → 10103,16
 
void ScribusView::ItemPen(QString farbe)
{
uint selectedItemCount=SelItem.count();
if (selectedItemCount != 0)
{
if (farbe == ScApp->noneString)
farbe = "None";
if (SelItem.count() != 0)
{
PageItem *i;
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::SetLineColor, farbe, Um::IFill);
for (uint a = 0; a < SelItem.count(); ++a)
PageItem *i;
for (uint a = 0; a < selectedItemCount; ++a)
{
i = SelItem.at(a);
if ((i->itemType() == PageItem::Line) && (farbe == "None"))
10117,7 → 10123,7
RefreshItem(i);
emit ItemFarben(i->lineColor(), i->fillColor(), i->lineShade(), i->fillShade());
}
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->commit();
}
}
10124,15 → 10130,16
 
void ScribusView::ItemTextBrush(QString farbe)
{
uint selectedItemCount=SelItem.count();
if (selectedItemCount != 0)
{
if (farbe == ScApp->noneString)
farbe = "None";
if (SelItem.count() != 0)
{
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::SetFontFill,
farbe, Um::IFont);
PageItem *currItem;
for (uint a = 0; a < SelItem.count(); ++a)
for (uint a = 0; a < selectedItemCount; ++a)
{
currItem = SelItem.at(a);
if ((currItem->itemType() == PageItem::TextFrame) || (currItem->itemType() == PageItem::PathText))
10153,7 → 10160,7
RefreshItem(currItem);
emit ItemFarben(currItem->lineColor(), currItem->fillColor(), currItem->lineShade(), currItem->fillShade());
}
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->commit();
}
}
10160,13 → 10167,14
 
void ScribusView::ItemTextBrushS(int sha)
{
if (SelItem.count() != 0)
uint selectedItemCount=SelItem.count();
if (selectedItemCount != 0)
{
PageItem *currItem;
if (SelItem.count() > 1)
undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::SetFontFillShade,
QString("%1").arg(sha), Um::IFont);
for (uint a = 0; a < SelItem.count(); ++a)
for (uint a = 0; a < selectedItemCount; ++a)
{
currItem = SelItem.at(a);
if (currItem->itemType() == PageItem::TextFrame)
10187,7 → 10195,7
RefreshItem(currItem);
emit ItemFarben(currItem->lineColor(), currItem->fillColor(), currItem->lineShade(), currItem->fillShade());
}
if (SelItem.count() > 1)
if (selectedItemCount > 1)
undoManager->commit();
}
}
11075,115 → 11083,17
 
void ScribusView::loadPict(QString fn, PageItem *pageItem, bool reload)
{
bool dummy;
QFileInfo fi = QFileInfo(fn);
PageItem *Item = pageItem;
QString clPath = Item->pixm.imgInfo.usedPath;
Item->pixm.imgInfo.valid = false;
Item->pixm.imgInfo.clipPath = "";
Item->pixm.imgInfo.PDSpathData.clear();
Item->pixm.imgInfo.layerInfo.clear();
Item->pixm.imgInfo.usedPath = "";
Item->imageClip.resize(0);
if (!reload)
{
if ((ScApp->fileWatcher->files().contains(Item->Pfile) != 0) && (Item->PicAvail))
ScApp->fileWatcher->removeFile(Item->Pfile);
if ((ScApp->fileWatcher->files().contains(pageItem->Pfile) != 0) && (pageItem->PicAvail))
ScApp->fileWatcher->removeFile(pageItem->Pfile);
}
if (!Item->pixm.LoadPicture(fn, Item->IProfile, Item->IRender, Item->UseEmbedded, true, 2, Prefs->gs_Resolution, &dummy))
{
Item->Pfile = fi.absFilePath();
Item->PicAvail = false;
Item->PicArt = false;
}
else
{
if (UndoManager::undoEnabled() && !reload)
{
SimpleState *ss = new SimpleState(Um::GetImage, fn, Um::IGetImage);
ss->set("GET_IMAGE", "get_image");
ss->set("OLD_IMAGE_PATH", Item->Pfile);
ss->set("NEW_IMAGE_PATH", fn);
undoManager->action(Item, ss);
}
double xres = Item->pixm.imgInfo.xres;
double yres = Item->pixm.imgInfo.yres;
Item->PicAvail = true;
Item->PicArt = true;
Item->BBoxX = 0;
if (Item->Pfile != fn)
{
Item->LocalScX = 72.0 / xres;
Item->LocalScY = 72.0 / yres;
Item->LocalX = 0;
Item->LocalY = 0;
if ((Doc->toolSettings.useEmbeddedPath) && (!Item->pixm.imgInfo.clipPath.isEmpty()))
{
Item->pixm.imgInfo.usedPath = Item->pixm.imgInfo.clipPath;
clPath = Item->pixm.imgInfo.clipPath;
if (Item->pixm.imgInfo.PDSpathData.contains(clPath))
{
Item->imageClip = Item->pixm.imgInfo.PDSpathData[clPath].copy();
Item->pixm.imgInfo.usedPath = clPath;
QWMatrix cl;
cl.translate(Item->LocalX*Item->LocalScX, Item->LocalY*Item->LocalScY);
cl.scale(Item->LocalScX, Item->LocalScY);
Item->imageClip.map(cl);
}
}
}
Item->Pfile = fi.absFilePath();
pageItem->loadImage(fn, reload);
if (!reload)
ScApp->fileWatcher->addFile(Item->Pfile);
else
{
if (Item->pixm.imgInfo.PDSpathData.contains(clPath))
{
Item->imageClip = Item->pixm.imgInfo.PDSpathData[clPath].copy();
Item->pixm.imgInfo.usedPath = clPath;
QWMatrix cl;
cl.translate(Item->LocalX*Item->LocalScX, Item->LocalY*Item->LocalScY);
cl.scale(Item->LocalScX, Item->LocalScY);
Item->imageClip.map(cl);
}
}
Item->BBoxH = Item->pixm.height();
Item->OrigW = Item->pixm.width();
Item->OrigH = Item->pixm.height();
QString ext = fi.extension(false).lower();
if ((ext == "pdf") || (ext == "ps") || (ext == "eps"))
Item->isRaster = false;
else
Item->isRaster = true;
if (Item->pixm.imgInfo.isEmbedded)
{
Item->IProfile = "Embedded " + Item->pixm.imgInfo.profileName;
Item->EmProfile = "Embedded " + Item->pixm.imgInfo.profileName;
Item->UseEmbedded = true;
}
else
{
Item->IProfile = Item->pixm.imgInfo.profileName;
Item->UseEmbedded = false;
}
}
if (Item->PicAvail)
{
if (Item->pixm.imgInfo.lowResType != 0)
{
double scaling = 1.0;
if (Item->pixm.imgInfo.lowResType == 1)
scaling = Item->pixm.imgInfo.xres / 72.0;
else
scaling = Item->pixm.imgInfo.xres / 36.0;
Item->pixm.createLowRes(scaling);
Item->pixm.imgInfo.lowResScale = scaling;
}
Item->pixm.applyEffect(Item->effectsInUse, Doc->PageColors, false);
}
ScApp->fileWatcher->addFile(pageItem->Pfile);
if (!Doc->isLoading())
{
emit RasterPic(Item->isRaster);
emit RasterPic(pageItem->isRaster);
// emit UpdtObj(PageNr, ItNr);
emit DocChanged();
}