Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 1289 → Rev 1290

/branches/Version13x/Scribus/scribus/undomanager.h
420,6 → 420,10
static const QString SetLineShade;
static const QString FlipH;
static const QString FlipV;
static const QString Lock;
static const QString UnLock;
static const QString SizeLock;
static const QString SizeUnLock;
/*@}*/
 
/**
446,6 → 450,8
static QPixmap *IShade;
static QPixmap *IFlipH;
static QPixmap *IFlipV;
static QPixmap *ILock;
static QPixmap *IUnLock;
/*@}*/
 
protected:
/branches/Version13x/Scribus/scribus/pageitem.h
335,6 → 335,10
void flipImageH();
/** @brief Flip an image vertically */
void flipImageV();
/** @brief Lock or unlock this pageitem. */
void toggleLock();
/** @brief Toggle lock for resizing */
void toggleSizeLock();
/**
* @brief Check the changes to the item and add undo actions for them.
* @param force Force the check. Do not care if mouse button or arrow key is down
380,6 → 384,8
* state of arrow keys and mouse buttons else returns false.
*/
bool shouldCheck();
/** @brief Clears the current selection and selects this PageItem. */
void select();
};
 
#endif
/branches/Version13x/Scribus/scribus/pageitem.cpp
2341,6 → 2341,36
flippedV += 1;
}
 
void PageItem::toggleLock()
{
if (UndoManager::undoEnabled())
{
SimpleState *ss;
if (Locked)
ss = new SimpleState(Um::UnLock, 0, Um::IUnLock);
else
ss = new SimpleState(Um::Lock, 0, Um::ILock);
ss->set("LOCK", "lock");
undoManager->action(this, ss);
}
Locked = !Locked;
}
 
void PageItem::toggleSizeLock()
{
if (UndoManager::undoEnabled())
{
SimpleState *ss;
if (Locked)
ss = new SimpleState(Um::SizeUnLock, 0, Um::IUnLock);
else
ss = new SimpleState(Um::SizeLock, 0, Um::ILock);
ss->set("SIZE_LOCK", "size_lock");
undoManager->action(this, ss);
}
LockRes = !LockRes;
}
 
void PageItem::checkChanges(bool force)
{
// has the item been resized
2468,9 → 2498,25
else if (ss->contains("LINE_SHADE"))
restoreLineShade(ss, isUndo);
else if (ss->contains("IMAGEFLIPH"))
{
select();
ScApp->view->FlipImageH();
}
else if (ss->contains("IMAGEFLIPV"))
{
select();
ScApp->view->FlipImageV();
}
else if (ss->contains("LOCK"))
{
select();
ScApp->view->ToggleLock();
}
else if (ss->contains("SIZE_LOCK"))
{
select();
ScApp->view->ToggleResize();
}
}
}
 
2590,8 → 2636,7
QString fill = state->get("OLD_COLOR");
if (!isUndo)
fill = state->get("NEW_COLOR");
ScApp->view->SelItem.clear();
ScApp->view->SelItem.append(this);
select();
ScApp->view->ItemPen(fill);
}
 
2600,8 → 2645,12
int shade = state->getInt("OLD_SHADE");
if (!isUndo)
shade = state->getInt("NEW_SHADE");
select();
ScApp->view->ItemPenShade(shade);
}
 
void PageItem::select()
{
ScApp->view->SelItem.clear();
ScApp->view->SelItem.append(this);
ScApp->view->ItemPenShade(shade);
}
 
/branches/Version13x/Scribus/scribus/scribusview.cpp
7458,13 → 7458,24
{
if (SelItem.count() != 0)
{
if (SelItem.count() > 1)
{
if (SelItem.at(0)->Locked)
undoManager->beginTransaction(Um::Selection + "/" + Um::Group,
Um::IGroup, Um::UnLock, 0, Um::IUnLock);
else
undoManager->beginTransaction(Um::Selection + "/" + Um::Group,
Um::IGroup, Um::Lock, 0, Um::ILock);
}
for ( uint a = 0; a < SelItem.count(); ++a)
{
SelItem.at(a)->Locked = !SelItem.at(a)->Locked;
SelItem.at(a)->toggleLock();
RefreshItem(SelItem.at(a));
emit HaveSel(SelItem.at(a)->PType);
}
emit DocChanged();
if (SelItem.count() > 1)
undoManager->commit();
}
}
 
7472,13 → 7483,24
{
if (SelItem.count() != 0)
{
if (SelItem.count() > 1)
{
if (SelItem.at(0)->LockRes)
undoManager->beginTransaction(Um::Selection + "/" + Um::Group,
Um::IGroup, Um::SizeUnLock, 0, Um::IUnLock);
else
undoManager->beginTransaction(Um::Selection + "/" + Um::Group,
Um::IGroup, Um::SizeLock, 0, Um::ILock);
}
for ( uint a = 0; a < SelItem.count(); ++a)
{
SelItem.at(a)->LockRes = !SelItem.at(a)->LockRes;
SelItem.at(a)->toggleSizeLock();
RefreshItem(SelItem.at(a));
emit HaveSel(SelItem.at(a)->PType);
}
emit DocChanged();
if (SelItem.count() > 1)
undoManager->commit();
}
}
 
/branches/Version13x/Scribus/scribus/undomanager.cpp
587,6 → 587,8
UndoManager::IShade = new QPixmap(iconDir + "u_shade.png");
// UndoManager::IFlipH = new QPixmap(iconDir + "u_fliph.png");
// UndoManager::IFlipV = new QPixmap(iconDir + "u_flipv.png");
UndoManager::ILock = new QPixmap(iconDir + "u_lock.png");
UndoManager::IUnLock = new QPixmap(iconDir + "u_unlock.png");
}
 
const QString UndoManager::AddVGuide = tr("Add vertical guide");
618,6 → 620,10
const QString UndoManager::SetLineShade = tr("Set line color shade");
const QString UndoManager::FlipH = tr("Flip horizontally");
const QString UndoManager::FlipV = tr("Flip vertically");
const QString UndoManager::Lock = tr("Lock");
const QString UndoManager::UnLock = tr("Unlock");
const QString UndoManager::SizeLock = tr("Lock size");
const QString UndoManager::SizeUnLock = tr("Unlock size");
 
/*** Icons for UndoObjects *******************************************/
QPixmap *UndoManager::IImageFrame = NULL;
638,3 → 644,5
QPixmap *UndoManager::IShade = NULL;
QPixmap *UndoManager::IFlipH = NULL;
QPixmap *UndoManager::IFlipV = NULL;
QPixmap *UndoManager::ILock = NULL;
QPixmap *UndoManager::IUnLock = NULL;