Commit 2de77f30 authored by Thomas Zander's avatar Thomas Zander

Rename KoShape::isLocked to isGeometryProtected in line with other accessors

svn path=/trunk/koffice/; revision=956586
parent ca951452
......@@ -128,7 +128,7 @@ bool recursiveFindActiveLayerInChildren( KoSelection* _selection, KoShapeLayer*
void KisLayerContainerShape::editabilityChanged( )
{
dbgKrita << m_d->groupLayer->isEditable();
setLocked( !m_d->groupLayer->isEditable() );
setGeometryProtected( !m_d->groupLayer->isEditable() );
KoCanvasController* canvas = KoToolManager::instance()->activeCanvasController();
if( canvas )
{
......
......@@ -156,7 +156,7 @@ bool recursiveFindActiveLayerInChildren( KoSelection* _selection, KoShapeLayer*
void KisNodeShape::editabilityChanged( )
{
dbgKrita << m_d->node->isEditable();
setLocked( !m_d->node->isEditable() );
setGeometryProtected( !m_d->node->isEditable() );
KoCanvasController* canvas = KoToolManager::instance()->activeCanvasController();
if( canvas )
{
......
......@@ -128,5 +128,5 @@ void KisShapeSelectionModel::childChanged(KoShape * child, KoShape::ChangeType t
bool KisShapeSelectionModel::isChildLocked(const KoShape *child) const
{
return child->isLocked() || child->parent()->isLocked();
return child->isGeometryProtected() || child->parent()->isGeometryProtected();
}
......@@ -301,7 +301,7 @@ void KisNodeManager::activateNode(KisNodeSP node)
KoShapeLayer * shapeLayer = dynamic_cast<KoShapeLayer*>(shape);
Q_ASSERT( shapeLayer );
if (shapeLayer) {
shapeLayer->setLocked(node->userLocked());
shapeLayer->setGeometryProtected(node->userLocked());
shapeLayer->setVisible(node->visible());
selection->setActiveLayer(shapeLayer);
}
......
......@@ -105,7 +105,7 @@ void Viewport::handleDragEnterEvent(QDragEnterEvent *event)
// only allow dropping when active layer is editable
KoSelection * selection = m_parent->canvas()->shapeManager()->selection();
KoShapeLayer * activeLayer = selection->activeLayer();
if( activeLayer && (!activeLayer->isEditable() || activeLayer->isLocked() ) )
if( activeLayer && (!activeLayer->isEditable() || activeLayer->isGeometryProtected() ) )
return;
QByteArray itemData;
......
......@@ -81,7 +81,7 @@ public:
zIndex(0),
visible(true),
printable(true),
locked(false),
geometryProtected(false),
keepAspect(false),
selectable(true),
detectCollision(false),
......@@ -139,7 +139,7 @@ public:
int zIndex : 14; // should be enough ;)
int visible : 1;
int printable : 1;
int locked : 1;
int geometryProtected : 1;
int keepAspect : 1;
int selectable : 1;
int detectCollision : 1;
......@@ -471,7 +471,7 @@ void KoShape::copySettings(const KoShape *shape)
else
d->printable = shape->isPrintable();
d->locked = shape->isLocked();
d->geometryProtected = shape->isGeometryProtected();
d->keepAspect = shape->keepAspectRatio();
d->localMatrix = shape->d->localMatrix;
}
......@@ -656,14 +656,14 @@ bool KoShape::isSelectable() const
return d->selectable;
}
void KoShape::setLocked(bool locked)
void KoShape::setGeometryProtected(bool on)
{
d->locked = locked;
d->geometryProtected = on;
}
bool KoShape::isLocked() const
bool KoShape::isGeometryProtected() const
{
return d->locked;
return d->geometryProtected;
}
void KoShape::setContentProtected(bool protect)
......@@ -784,7 +784,7 @@ void KoShape::deleteLater()
bool KoShape::isEditable() const
{
if (!d->visible || d->locked)
if (!d->visible || d->geometryProtected)
return false;
if (d->parent && d->parent->isChildLocked(this))
......@@ -821,7 +821,7 @@ QString KoShape::saveStyle(KoGenStyle &style, KoShapeSavingContext &context) con
}
QString value;
if (isLocked())
if (isGeometryProtected())
value = "position size";
if (isContentProtected()) {
if (! value.isEmpty())
......
......@@ -372,6 +372,7 @@ public:
* Being visible means being painted, as well as being used for
* things like guidelines or searches.
* @param on when true; set the shape to be visible.
* @see setGeometryProtected(), setContentProtected(), setSelectable()
*/
void setVisible(bool on);
/**
......@@ -380,6 +381,7 @@ public:
* things like guidelines or searches.
* @param recursive when true, checks visibility recursively
* @return current visibility state of this shape.
* @see isGeometryProtected(), isContentProtected(), isSelectable()
*/
bool isVisible(bool recursive = false) const;
......@@ -406,37 +408,45 @@ public:
* Makes it possible for the user to select this shape.
* This parameter defaults to true.
* @param selectable when true; set the shape to be selectable by the user.
* @see setGeometryProtected(), setContentProtected(), setVisible()
*/
void setSelectable(bool selectable);
/**
* Returns if this shape can be selected by the user.
* @return true only when the object is selectable.
* @see isGeometryProtected(), isContentProtected(), isVisible()
*/
bool isSelectable() const;
/**
* Changes the Shape to be locked in place.
* Being locked means the user can not change shape or position of the shape.
* @param locked when true; set the shape to be locked.
* Tells the shape to have its position/rotation and size protected from user-changes.
* The geometry being protected means the user can not change shape or position of the
* shape. This includes any matrix operation such as rotation.
* @param on when true; set the shape to have its geometry protected.
* @see setContentProtected(), setSelectable(), setVisible()
*/
void setLocked(bool locked);
void setGeometryProtected(bool on);
/**
* Returns current locked state of this shape.
* Being locked means the user can not change shape or position of the shape.
* @return current locked state of this shape.
* Returns current geometry protection state of this shape.
* The geometry being protected means the user can not change shape or position of the
* shape. This includes any matrix operation such as rotation.
* @return current geometry protection state of this shape.
* @see isContentProtected(), isSelectable(), isVisible()
*/
bool isLocked() const;
bool isGeometryProtected() const;
/**
* Marks the shape to have its content protected against editing.
* Content protection is a hint for tools to disallow the user editing the content.
* @param protect when true set the shapes content to be protected from user modification.
* @see setGeometryProtected(), setSelectable(), setVisible()
*/
void setContentProtected(bool protect);
/**
* Returns current content protection state of this shape.
* Content protection is a hint for tools to disallow the user editing the content.
* @return current content protection state of this shape.
* @see isGeometryProtected(), isSelectable(), isVisible()
*/
bool isContentProtected() const;
......
......@@ -88,7 +88,7 @@ public:
}
bool isChildLocked(const KoShape *child) const {
return child->isLocked();
return child->isGeometryProtected();
}
void containerChanged(KoShapeContainer *) { }
......
......@@ -124,7 +124,7 @@ public:
/**
* Return wheather the child has the effective state of being locked for user modifications.
* This method is deferred to the model, which should call the KoShape::isLocked() on the child.
* This method is deferred to the model, which should call the KoShape::isGeometryProtected() on the child.
* @param child the shape that the user wants to move.
*/
bool isChildLocked(const KoShape *child) const;
......
......@@ -75,7 +75,7 @@ public:
/**
* Return wheather the child has the effective state of being locked for user modifications.
* The model has to call KoShape::isLocked() and base its return value upon that, it can
* The model has to call KoShape::isGeometryProtected() and base its return value upon that, it can
* additionally find rules on wheather the child is locked based on the container state.
* @param child the shape that the user wants to move.
*/
......
......@@ -77,7 +77,7 @@ bool KoShapeLayer::loadOdf(const KoXmlElement & element, KoShapeLoadingContext &
// set layer name
setName(element.attributeNS(KoXmlNS::draw, "name"));
// layer locking
setLocked(element.attributeNS(KoXmlNS::draw, "protected", "false") == "true");
setGeometryProtected(element.attributeNS(KoXmlNS::draw, "protected", "false") == "true");
// layer visibility
setVisible(element.attributeNS(KoXmlNS::draw, "display", "false") != "none");
......
......@@ -131,7 +131,7 @@ void KoShapeSavingContext::saveLayerSet(KoXmlWriter * xmlWriter) const
foreach(const KoShapeLayer * layer, m_layers) {
xmlWriter->startElement("draw:layer");
xmlWriter->addAttribute("draw:name", layer->name());
if (layer->isLocked())
if (layer->isGeometryProtected())
xmlWriter->addAttribute("draw:protected", "true");
if (! layer->isVisible())
xmlWriter->addAttribute("draw:display", "none");
......
......@@ -49,7 +49,7 @@ public:
void childChanged(KoShape *, KoShape::ChangeType) { }
bool isChildLocked(const KoShape *child) const {
Q_ASSERT(child->parent());
return child->isLocked() || child->parent()->isLocked();
return child->isGeometryProtected() || child->parent()->isGeometryProtected();
}
private: // members
......
......@@ -44,7 +44,7 @@ void KoShapeLockCommand::redo()
{
QUndoCommand::redo();
for (int i = 0; i < m_shapes.count(); ++i) {
m_shapes[i]->setLocked(m_newLock[i]);
m_shapes[i]->setGeometryProtected(m_newLock[i]);
}
}
......@@ -52,6 +52,6 @@ void KoShapeLockCommand::undo()
{
QUndoCommand::undo();
for (int i = 0; i < m_shapes.count(); ++i) {
m_shapes[i]->setLocked(m_oldLock[i]);
m_shapes[i]->setGeometryProtected(m_oldLock[i]);
}
}
......@@ -169,7 +169,7 @@ public:
}// ignored
/// reimplemented
bool isChildLocked(const KoShape *child) const {
return child->isLocked();
return child->isGeometryProtected();
}
/// reimplemented
int count() const {
......
......@@ -684,7 +684,7 @@ void KoPathTool::activate(bool temporary)
foreach(KoShape *shape, m_canvas->shapeManager()->selection()->selectedShapes()) {
KoPathShape *pathShape = dynamic_cast<KoPathShape*>(shape);
if (!shape->isLocked() && pathShape) {
if (!shape->isGeometryProtected() && pathShape) {
// as the tool is just in activation repaintDecorations does not yet get called
// so we need to use repaint of the tool and it is only needed to repaint the
// current canvas
......
......@@ -288,19 +288,19 @@ KoDocumentSectionModel::PropertyList KoPADocumentModel::properties( KoShape* sha
{
PropertyList l;
l << Property(i18n("Visible"), SmallIcon("14_layer_visible"), SmallIcon("14_layer_novisible"), shape->isVisible());
l << Property(i18n("Locked"), SmallIcon("object-locked"), SmallIcon("object-unlocked"), shape->isLocked());
l << Property(i18n("Locked"), SmallIcon("object-locked"), SmallIcon("object-unlocked"), shape->isGeometryProtected());
return l;
}
void KoPADocumentModel::setProperties( KoShape* shape, const PropertyList &properties )
{
bool oldVisibleState = shape->isVisible();
bool oldLockedState = shape->isLocked();
bool oldLockedState = shape->isGeometryProtected();
shape->setVisible( properties.at( 0 ).state.toBool() );
shape->setLocked( properties.at( 1 ).state.toBool() );
shape->setGeometryProtected( properties.at( 1 ).state.toBool() );
if( ( oldVisibleState != shape->isVisible() ) || ( oldLockedState != shape->isLocked() ) )
if( ( oldVisibleState != shape->isVisible() ) || ( oldLockedState != shape->isGeometryProtected() ) )
shape->update();
}
......
......@@ -206,5 +206,5 @@ void KoTextShapeContainerModel::proposeMove(KoShape *child, QPointF &move)
bool KoTextShapeContainerModel::isChildLocked(const KoShape *child) const
{
return child->isLocked();
return child->isGeometryProtected();
}
......@@ -668,7 +668,7 @@ bool DefaultTool::moveSelection(int direction, Qt::KeyboardModifiers modifiers)
QList<QPointF> newPos;
QList<KoShape*> shapes;
foreach(KoShape* shape, koSelection()->selectedShapes(KoFlake::StrippedSelection)) {
if (shape->isLocked())
if (shape->isGeometryProtected())
continue;
shapes.append(shape);
QPointF p = shape->position();
......@@ -791,7 +791,7 @@ void DefaultTool::deleteSelection()
{
QList<KoShape *> shapes;
foreach (KoShape *s, m_canvas->shapeManager()->selection()->selectedShapes(KoFlake::TopLevelSelection)) {
if (s->isLocked())
if (s->isGeometryProtected())
continue;
shapes << s;
}
......
......@@ -80,7 +80,7 @@ void SelectionDecorator::paint(QPainter &painter, const KoViewConverter &convert
// draw the shape bounding rect
painter.drawRect( QRectF( QPointF(), shape->size() ) );
if(!shape->isLocked())
if(!shape->isGeometryProtected())
editable = true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment