Source Code (Use browser search to find items of interest.)

Class Index

kimageshop'MoveCommand (./koffice/kimageshop/tools/kis_tool_move.h:30)

class MoveCommand : public KisCommand
{
public:

  MoveCommand( KisDoc *_doc, int _layer, QPoint _oldpos, QPoint _newpos );

  virtual void execute();
  virtual void unexecute();

private:

  void moveTo( QPoint _pos );

  int m_layer;
  QPoint m_oldPos;
  QPoint m_newPos;
};


kimageshop'MoveCommand::MoveCommand() (./koffice/kimageshop/tools/kis_tool_move.cc:30)

MoveCommand::MoveCommand( KisDoc *_doc, int _layer, QPoint _oldpos, QPoint _newpos )
  : KisCommand( i18n( "Move layer" ), _doc )
  , m_layer( _layer )
  , m_oldPos( _oldpos )
  , m_newPos( _newpos )
{
}


kimageshop'MoveCommand::execute() (./koffice/kimageshop/tools/kis_tool_move.cc:38)

void MoveCommand::execute()
{
  cout << "MoveCommand::execute" << endl;

  moveTo( m_newPos );
}


kimageshop'MoveCommand::unexecute() (./koffice/kimageshop/tools/kis_tool_move.cc:45)

void MoveCommand::unexecute()
{
  cout << "MoveCommand::unexecute" << endl;

  moveTo( m_oldPos );
}


kimageshop'MoveCommand::moveTo() (./koffice/kimageshop/tools/kis_tool_move.cc:52)

void MoveCommand::moveTo( QPoint _pos )
{
  KisImage* img = m_pDoc->current();
  if (!img)
	return;

  img->setCurrentLayer( m_layer );

  QRect oldRect = img->getCurrentLayer()->imageExtents();

  img->getCurrentLayer()->moveTo( _pos.x(), _pos.y() );

  img->markDirty( img->getCurrentLayer()->imageExtents() );
  img->markDirty( oldRect );
}