Пример #1
0
	void execute()
	{
		Allocation rect;
		getAllocation( rect );
		try
		{
			Allocation a = d_model->getAllocation();
			Viewport* v = getHandler()->getViewport();
			assert( v );
			Viewport::pushCursor( Viewport::CurWait );
			if( rect.getWidth() != 0 && rect.getHeight() != 0 )
			{
				v->captureDamage();

				PpmRange rx, ry;
				rx.first = d_model->toPpm( rect.getLeft(), a.getLeft(), DimX );
				rx.second = d_model->toPpm( rect.getRight(), a.getLeft(), DimX );
				ry.first = d_model->toPpm( rect.getTop(), a.getTop(), DimY );
				ry.second = d_model->toPpm( rect.getBottom(), a.getTop(), DimY );
				d_target->setRange( rx, ry );
				v->commitDamage();
			}else
			{
				d_target->centerPoint( d_model->toPpm( rect.getLeft(), a.getLeft(), DimX ),
					d_model->toPpm( rect.getTop(), a.getTop(), DimY ) );
			}
			v->damageAll();
			Viewport::popCursor();
		}catch( ... )
		{
			qDebug( "Exception in _OverviewCmd" );
		}
		Command::execute();
	}
Пример #2
0
	void execute()
	{
		Allocation rect;
		getAllocation( rect );
		if( rect.getWidth() != 0 && rect.getHeight() != 0 )
		{
			Allocation a = d_model->getAllocation();
			Viewport* p = getController()->getViewport();
			assert( p );
			p->pushCursor( Viewport::CurWait );
			p->captureDamage();
			if( d_do[ DimY ] && d_model->inUse( DimY ) && 
				d_do[ DimX ] && d_model->inUse( DimX )  )
			{
				PpmRange rx;
				rx.first = d_model->toPpm( rect.getLeft(), a.getLeft(), DimX );
				rx.second = d_model->toPpm( rect.getRight(), a.getLeft(), DimX );
				
				PpmRange ry;
				ry.first = d_model->toPpm( rect.getTop(), a.getTop(), DimY );
				ry.second = d_model->toPpm( rect.getBottom(), a.getTop(), DimY );

				d_model->setRange( rx, ry );

			}else if( d_do[ DimX ] && d_model->inUse( DimX ) )
			{
				PpmRange rx;
				rx.first = d_model->toPpm( rect.getLeft(), a.getLeft(), DimX );
				rx.second = d_model->toPpm( rect.getRight(), a.getLeft(), DimX );

				d_model->setRange( DimX, rx );

			}else if( d_do[ DimY ] && d_model->inUse( DimY ) )
			{
				PpmRange ry;
				ry.first = d_model->toPpm( rect.getTop(), a.getTop(), DimY );
				ry.second = d_model->toPpm( rect.getBottom(), a.getTop(), DimY );

				d_model->setRange( DimY, ry );

			}
			p->commitDamage();
			p->popCursor();
			d_model->redraw(p);
		}
		Command::execute();
	}