Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 1384 → Rev 1385

/branches/Version13x/Scribus/scribus/undomanager.h
435,6 → 435,9
static const QString Transparency;
static const QString LineTransparency;
static const QString LineStyle;
static const QString LineEnd;
static const QString LineJoin;
static const QString LineWidth;
/*@}*/
 
/**
/branches/Version13x/Scribus/scribus/pageitem.h
384,6 → 384,23
* @sa Qt::PenStyle
*/
void setLineStyle(PenStyle newStyle);
/**
* @brief Set the width of line
* @param newWidth width of line
*/
void setLineWidth(double newWidth);
/**
* @brief Set the end style of line
* @param newStyle end style of line
* @sa Qt::PenCapStyle
*/
void setLineEnd(PenCapStyle newStyle);
/**
* @brief Set the join style of line
* @param newStyle join style of line
* @sa Qt::PenJoinStyle
*/
void setLineJoin(PenJoinStyle newStyle);
/** @brief Flip an image horizontally. */
void flipImageH();
/** @brief Flip an image vertically */
441,6 → 458,9
void restoreFillTP(SimpleState *state, bool isUndo);
void restoreLineTP(SimpleState *state, bool isUndo);
void restoreLineStyle(SimpleState *state, bool isUndo);
void restoreLineEnd(SimpleState *state, bool isUndo);
void restoreLineJoin(SimpleState *state, bool isUndo);
void restoreLineWidth(SimpleState *state, bool isUndo);
/*@}*/
 
/**
/branches/Version13x/Scribus/scribus/pageitem.cpp
2405,6 → 2405,46
PLineArt = newStyle;
}
 
void PageItem::setLineWidth(double newWidth)
{
if (UndoManager::undoEnabled())
{
SimpleState *ss = new SimpleState(Um::LineWidth,
QString(Um::FromTo).arg(Pwidth).arg(newWidth),Um::ILineStyle);
ss->set("LINE_WIDTH", "line_width");
ss->set("OLD_WIDTH", Pwidth);
ss->set("NEW_WIDTH", newWidth);
undoManager->action(this, ss);
}
Pwidth = newWidth;
}
 
void PageItem::setLineEnd(PenCapStyle newStyle)
{
if (UndoManager::undoEnabled())
{
SimpleState *ss = new SimpleState(Um::LineEnd,"",Um::ILineStyle);
ss->set("LINE_END", "line_end");
ss->set("OLD_STYLE", static_cast<int>(PLineEnd));
ss->set("NEW_STYLE", static_cast<int>(newStyle));
undoManager->action(this, ss);
}
PLineEnd = newStyle;
}
 
void PageItem::setLineJoin(PenJoinStyle newStyle)
{
if (UndoManager::undoEnabled())
{
SimpleState *ss = new SimpleState(Um::LineJoin,"",Um::ILineStyle);
ss->set("LINE_JOIN", "line_join");
ss->set("OLD_STYLE", static_cast<int>(PLineJoin));
ss->set("NEW_STYLE", static_cast<int>(newStyle));
undoManager->action(this, ss);
}
PLineJoin = newStyle;
}
 
void PageItem::flipImageH()
{
if (UndoManager::undoEnabled())
2635,6 → 2675,12
restoreLineTP(ss, isUndo);
else if (ss->contains("LINE_STYLE"))
restoreLineStyle(ss, isUndo);
else if (ss->contains("LINE_END"))
restoreLineEnd(ss, isUndo);
else if (ss->contains("LINE_JOIN"))
restoreLineJoin(ss, isUndo);
else if (ss->contains("LINE_WIDTH"))
restoreLineWidth(ss, isUndo);
}
}
 
2793,6 → 2839,33
ScApp->view->ChLineArt(ps);
}
 
void PageItem::restoreLineEnd(SimpleState *state, bool isUndo)
{
PenCapStyle pcs = static_cast<PenCapStyle>(state->getInt("OLD_STYLE"));
if (!isUndo)
pcs = static_cast<PenCapStyle>(state->getInt("NEW_STYLE"));
select();
ScApp->view->ChLineEnd(pcs);
}
 
void PageItem::restoreLineJoin(SimpleState *state, bool isUndo)
{
PenJoinStyle pjs = static_cast<PenJoinStyle>(state->getInt("OLD_STYLE"));
if (!isUndo)
pjs = static_cast<PenJoinStyle>(state->getInt("NEW_STYLE"));
select();
ScApp->view->ChLineJoin(pjs);
}
 
void PageItem::restoreLineWidth(SimpleState *state, bool isUndo)
{
double w = state->getDouble("OLD_WIDTH");
if (!isUndo)
w = state->getDouble("NEW_WIDTH");
select();
ScApp->view->ChLineWidth(w);
}
 
void PageItem::restoreName(SimpleState *state, bool isUndo)
{
QString oldName = state->get("OLD_NAME");
/branches/Version13x/Scribus/scribus/scribusview.cpp
9344,11 → 9344,14
{
if (SelItem.count() != 0)
{
if (SelItem.count() > 1)
undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::LineWidth, "", Um::ILineStyle);
for (uint a = 0; a < SelItem.count(); ++a)
{
PageItem *b = SelItem.at(a);
b->OldPwidth = b->Pwidth;
b->Pwidth = w;
b->setLineWidth(w);
if (b->PType == 7)
SetPolyClip(b, qRound(QMAX(b->Pwidth / 2, 1)));
if (b->PType == 5)
9360,6 → 9363,8
}
RefreshItem(b);
}
if (SelItem.count() > 1)
undoManager->commit();
}
}
 
9384,11 → 9389,16
{
if (SelItem.count() != 0)
{
if (SelItem.count() > 1)
undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::LineJoin, "", Um::ILineStyle);
for (uint a = 0; a < SelItem.count(); ++a)
{
SelItem.at(a)->PLineJoin = w;
SelItem.at(a)->setLineJoin(w);
RefreshItem(SelItem.at(a));
}
if (SelItem.count() > 1)
undoManager->commit();
}
}
 
9396,11 → 9406,16
{
if (SelItem.count() != 0)
{
if (SelItem.count() > 1)
undoManager->beginTransaction(Um::SelectionGroup,
Um::IGroup, Um::LineEnd, "", Um::ILineStyle);
for (uint a = 0; a < SelItem.count(); ++a)
{
SelItem.at(a)->PLineEnd = w;
SelItem.at(a)->setLineEnd(w);
RefreshItem(SelItem.at(a));
}
if (SelItem.count() > 1)
undoManager->commit();
}
}
 
/branches/Version13x/Scribus/scribus/undomanager.cpp
661,6 → 661,9
const QString UndoManager::Transparency = tr("Set fill color transparency");
const QString UndoManager::LineTransparency = tr("Set line color transparency");
const QString UndoManager::LineStyle = tr("Set line style");
const QString UndoManager::LineEnd = tr("Set the style of line end");
const QString UndoManager::LineJoin = tr("Set the style of line join");
const QString UndoManager::LineWidth = tr("Set line width");
 
/*** Icons for UndoObjects *******************************************/
QPixmap *UndoManager::IImageFrame = NULL;