25#include "vselection.h"
30 :
VCommand( doc, i18n(
"Group Objects" ),
"14_group" )
32 m_selection = document()->selection()->clone();
37VGroupCmd::~VGroupCmd()
39 delete( m_selection );
45 m_group =
new VGroup(
document()->activeLayer() );
47 VObjectListIterator itr( m_selection->objects() );
48 for ( ; itr.current() ; ++itr )
51 VGroup *parent =
dynamic_cast<VGroup*
>( itr.current()->parent() );
53 parent->
take( *itr.current() );
55 m_group->append( itr.current() );
73 VObjectListIterator itr( m_group->objects() );
74 for ( ; itr.current() ; ++itr )
81 if( ( parent =
dynamic_cast<VGroup*
>( m_group->parent() ) ) )
84 parent->
take( *m_group );
87 VObjectListIterator itr = m_selection->objects();
89 for ( ; itr.current() ; ++itr )
91 parent->
append( itr.current() );
The base class for all karbon commands.
virtual void unexecute()
Unexecutes the command.
VDocument * document() const
Returns the document the command works on.
virtual void execute()=0
Executes the command.
All non-visual, static doc info is in here.
VSelection * selection() const
Returns a pointer to the selection.
void append(VObject *object)
Appends a new object to the active layer.
void take(const VObject &object)
Removes the reference to child object, not the object itself.
void append(VObject *object)
Appends a new child object.
@ deleted
deleted, nearly dead
void append()
Adds all objects to the selection.
void clear()
Removes the references to all objects, not the objects themselves.
void setSuccess(bool success=true)
Set the success property.