Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 16418 → Rev 16419

/branches/Version135/Scribus/scribus/pageitem.cpp
2701,8 → 2701,20
to += ", ";
to += keepRatio ? Um::KeepRatio : Um::BreakRatio;
SimpleState *ss = new SimpleState(Um::ImageScaling, QString(Um::FromTo).arg(from).arg(to), Um::IImageScaling);
ss->set("SCALE_MODE", "scaling_mode");
if (freeScale != ScaleType)
{
ss->set("SCALE_TYPE", freeScale);
if (!freeScale)
{
//if switching from free scaling to frame size
//in undo must be offset and scale saved
ss->set("OLD_IMAGEXOFFSET", LocalX);
ss->set("OLD_IMAGEYOFFSET", LocalY);
ss->set("OLD_IMAGEXSCALE", LocalScX);
ss->set("OLD_IMAGEYSCALE", LocalScY);
}
}
if (keepRatio != AspectRatio)
ss->set("ASPECT_RATIO", keepRatio);
undoManager->action(this, ss);
3065,6 → 3077,7
{
SimpleState *ss = new SimpleState(Um::ImageOffset,
QString(Um::ImageOffsetFromTo).arg(oldLocalX).arg(oldLocalY).arg(LocalX).arg(LocalY), Um::IMove);
ss->set("IMAGE_OFFSET", "image_offset");
ss->set("OLD_IMAGEXOFFSET", oldLocalX);
ss->set("OLD_IMAGEYOFFSET", oldLocalY);
ss->set("NEW_IMAGEXOFFSET", LocalX);
3083,6 → 3096,7
{
SimpleState *ss = new SimpleState(Um::ImageScale,
QString(Um::ImageScaleFromTo).arg(oldLocalScX).arg(oldLocalScY).arg(LocalScX).arg(LocalScY), Um::IMove);
ss->set("IMAGE_SCALE", "image_scale");
ss->set("OLD_IMAGEXSCALE", oldLocalScX);
ss->set("OLD_IMAGEYSCALE", oldLocalScY);
ss->set("NEW_IMAGEXSCALE", LocalScX);
3175,14 → 3189,12
restoreType(ss, isUndo);
else if (ss->contains("TEXTFLOW_OLDMODE"))
restoreTextFlowing(ss, isUndo);
else if (ss->contains("SCALE_TYPE"))
restoreImageScaleType(ss, isUndo);
else if (ss->contains("OLD_IMAGEXSCALE"))
else if (ss->contains("SCALE_MODE"))
restoreImageScaleMode(ss, isUndo);
else if (ss->contains("IMAGE_SCALE"))
restoreImageScaleChange(ss, isUndo);
else if (ss->contains("OLD_IMAGEXOFFSET"))
else if (ss->contains("IMAGE_OFFSET"))
restoreImageOffsetChange(ss, isUndo);
else if (ss->contains("ASPECT_RATIO"))
restoreImageScaleType(ss, isUndo);
else if (ss->contains("EDIT_CONTOUR"))
restorePoly(ss, isUndo, true);
else if (ss->contains("EDIT_SHAPE"))
3219,7 → 3231,8
restoreImageEffects(ss, isUndo);
else if (ss->contains("STEXT"))
restoreEditText(ss, isUndo);
 
else if (ss->contains("CLEAR_IMAGE"))
restoreClearImage(ss,isUndo);
}
if (!OnMasterPage.isEmpty())
m_Doc->setCurrentPage(oldCurrentPage);
3516,7 → 3529,7
}
}
 
void PageItem::restoreImageScaleType(SimpleState *state, bool isUndo)
void PageItem::restoreImageScaleMode(SimpleState *state, bool isUndo)
{
bool type=ScaleType;
if (state->contains("SCALE_TYPE"))
3525,6 → 3538,20
type = !state->getBool("SCALE_TYPE");
else
type = state->getBool("SCALE_TYPE");
//if restoring free scaling
//old offset and scale ratio must be restored
if (type)
{
double oscx = state->getDouble("OLD_IMAGEXSCALE");
double oscy = state->getDouble("OLD_IMAGEYSCALE");
double ox = state->getDouble("OLD_IMAGEXOFFSET");
double oy = state->getDouble("OLD_IMAGEYOFFSET");
Selection tempSelection(this, false);
tempSelection.addItem(this, true);
m_Doc->itemSelection_SetImageScale(oscx, oscy, &tempSelection);
m_Doc->itemSelection_SetImageOffset(ox, oy, &tempSelection);
}
 
}
 
bool ratio=AspectRatio;
3567,6 → 3594,35
m_Doc->itemSelection_SetImageOffset(ox, oy, &tempSelection);
}
 
void PageItem::restoreClearImage(UndoState *state, bool isUndo)
{
if (!isImageFrame())
return;
if (isUndo)
{
ItemState<ScImageEffectList> *is = dynamic_cast<ItemState<ScImageEffectList>*>(state);
Pfile = is->get("CI_PFILE");
loadImage(Pfile, false);
effectsInUse = is->getItem();
setImageFlippedH(is->getBool("CI_FLIPPH"));
setImageFlippedV(is->getBool("CI_FLIPPV"));
setImageScalingMode(is->getBool("CI_SCALING"),is->getBool("CI_ASPECT"));
setImageXOffset(is->getDouble("CI_XOFF"));
setImageXScale(is->getDouble("CI_XSCALE"));
setImageYOffset(is->getDouble("CI_YOFF"));
setImageYScale(is->getDouble("CI_YSCALE"));
setFillTransparency(is->getDouble("CI_FILLT"));
setLineTransparency(is->getDouble("CI_LINET"));
 
select();
m_Doc->updatePic();
}
else
asImageFrame()->clearContents();
}
 
 
 
void PageItem::restorePoly(SimpleState *state, bool isUndo, bool isContour)
{
int mode = state->getInt("MODE");
3636,11 → 3692,12
m_Doc->regionsChanged()->update(QRectF());
}
 
void PageItem::restoreGetImage(SimpleState *state, bool isUndo)
void PageItem::restoreGetImage(UndoState *state, bool isUndo)
{
QString fn = state->get("OLD_IMAGE_PATH");
ItemState<ScImageEffectList> *is = dynamic_cast<ItemState<ScImageEffectList>*>(state);
QString fn = is->get("OLD_IMAGE_PATH");
if (!isUndo)
fn = state->get("NEW_IMAGE_PATH");
fn = is->get("NEW_IMAGE_PATH");
if (fn.isEmpty())
{
Selection tempSelection(this, false);
3648,7 → 3705,25
m_Doc->itemSelection_ClearItem(&tempSelection);
}
else
{
loadImage(fn, false);
if (isUndo)
{
//restore old image settings
effectsInUse = is->getItem();
setImageFlippedH(is->getBool("FLIPPH"));
setImageFlippedV(is->getBool("FLIPPV"));
setImageScalingMode(is->getBool("SCALING"), is->getBool("ASPECT"));
setImageXOffset(is->getDouble("XOFF"));
setImageXScale(is->getDouble("XSCALE"));
setImageYOffset(is->getDouble("YOFF"));
setImageYScale(is->getDouble("YSCALE"));
setFillTransparency(is->getDouble("FILLT"));
setLineTransparency(is->getDouble("LINET"));
}
select();
m_Doc->updatePic();
}
}
 
void PageItem::restoreGroupsLastItem(SimpleState *state, bool isUndo)
4909,11 → 4984,22
QString ext = fi.suffix().toLower();
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);
ItemState<ScImageEffectList> *is = new ItemState<ScImageEffectList>(Um::GetImage, filename, Um::IGetImage);
is->set("GET_IMAGE", "get_image");
is->set("OLD_IMAGE_PATH", Pfile);
is->set("NEW_IMAGE_PATH", filename);
is->set("FLIPPH",imageFlippedH());
is->set("FLIPPV",imageFlippedV());
is->set("SCALING",ScaleType);
is->set("ASPECT",AspectRatio);
is->set("XOFF",imageXOffset());
is->set("XSCALE",imageXScale());
is->set("YOFF",imageYOffset());
is->set("YSCALE",imageYScale());
is->set("FILLT", fillTransparency());
is->set("LINET", lineTransparency());
is->setItem(effectsInUse);
undoManager->action(this, is);
}
double xres = pixm.imgInfo.xres;
double yres = pixm.imgInfo.yres;
/branches/Version135/Scribus/scribus/undomanager.cpp
965,6 → 965,7
UndoManager::CopyPage = tr("Copy page");
UndoManager::ToOutlines = tr("Convert to outlines");
UndoManager::EditText = tr("Edit text");
UndoManager::ClearImage = tr("Clear image frame content");
}
 
void UndoManager::initIcons()
1166,6 → 1167,7
QString UndoManager::CopyPage = "";
QString UndoManager::ToOutlines = "";
QString UndoManager::EditText = "";
QString UndoManager::ClearImage = "";
 
/*** Icons for UndoObjects *******************************************/
QPixmap *UndoManager::IImageFrame = 0;
/branches/Version135/Scribus/scribus/undomanager.h
589,6 → 589,7
static QString CopyPage;
static QString ToOutlines;
static QString EditText;
static QString ClearImage;
/*@}*/
 
/**
/branches/Version135/Scribus/scribus/pageitem.h
1070,14 → 1070,15
 
void restoreType(SimpleState *state, bool isUndo);
void restoreTextFlowing(SimpleState *state, bool isUndo);
void restoreImageScaleType(SimpleState *state, bool isUndo);
void restoreImageScaleMode(SimpleState *state, bool isUndo);
void restoreImageScaleChange(SimpleState *state, bool isUndo);
void restoreImageOffsetChange(SimpleState *state, bool isUndo);
void restoreClearImage(UndoState *state, bool isUndo);
void restoreGetImage(UndoState *state, bool isUndo);
void restorePoly(SimpleState *state, bool isUndo, bool isContour);
void restoreContourLine(SimpleState *state, bool isUndo);
void restoreShapeType(SimpleState *state, bool isUndo);
void restoreLayer(SimpleState *state, bool isUndo);
void restoreGetImage(SimpleState *state, bool isUndo);
void restoreGroupsLastItem(SimpleState *state, bool isUndo);
 
void restoreShapeContour(UndoState *state, bool isUndo);
/branches/Version135/Scribus/scribus/pageitem_imageframe.cpp
155,6 → 155,24
 
void PageItem_ImageFrame::clearContents()
{
if (UndoManager::undoEnabled())
{
ItemState<ScImageEffectList> *is = new ItemState<ScImageEffectList>(Um::ClearImage + "\n" + Pfile, "");
is->set("CLEAR_IMAGE", "clear_image");
is->set("CI_PFILE", Pfile);
is->set("CI_FLIPPH",imageFlippedH());
is->set("CI_FLIPPV",imageFlippedV());
is->set("CI_SCALING",ScaleType);
is->set("CI_ASPECT",AspectRatio);
is->set("CI_XOFF",imageXOffset());
is->set("CI_XSCALE",imageXScale());
is->set("CI_YOFF",imageYOffset());
is->set("CI_YSCALE",imageYScale());
is->set("CI_FILLT", fillTransparency());
is->set("CI_LINET", lineTransparency());
is->setItem(effectsInUse);
undoManager->action(this, is);
}
effectsInUse.clear();
PictureIsAvailable = false;
Pfile = "";