@Override
	public void mousePressed(MouseEvent e) {
		Frame selected  = getSelectedFrame();
		if(selected==null) return;
	
		if(e.getButton() == MouseEvent.BUTTON3) {
			if(parent.isSettingOffsetDirectly()) {
			    	handleEditOffset(selected, e);
			}
		    if (parent.isSettingOffsetWithRelativePos()) {
		    	freeOffsetStart = getViewPoint(e);
		    }
			if(parent.isSettingPivot()) {
				selected.setPivot(new Point(getViewX(e),getViewY(e)));
			}		
			if (parent.isRectangleLocked()) {
				selected.setRectangle(new Rectangle(getViewX(e),getViewY(e),parent.lockRectButton.lastRect.width,parent.lockRectButton.lastRect.height));
				selected.setImageFile(editorFrame.getData().getProject().getRelativeFile(imageFile));
				int PivotDX = parent.lockRectButton.lastPivot.x - parent.lockRectButton.lastRect.x;
				int PivotDY = parent.lockRectButton.lastPivot.y - parent.lockRectButton.lastRect.y;
				selected.setPivot(new Point(getViewX(e)+PivotDX,getViewY(e)+PivotDY));					
			}
			if(parent.isEditingRectangle()) {
				selected.setRectangle(new Rectangle(getViewX(e),getViewY(e),0,0));
				selected.setImageFile(editorFrame.getData().getProject().getRelativeFile(imageFile));
				selected.setPivot(null);
			}
			if(parent.isSettingOffsetWithTemporaryPivot()) {
				if(parent.temporaryPivotOffsetButton.getPivot1()==null) {
					parent.temporaryPivotOffsetButton.setPivot1(getViewPoint(e));
				} else {
					parent.temporaryPivotOffsetButton.setPivot2(getViewPoint(e));
					selected.setOffset(parent.temporaryPivotOffsetButton.getOffset());
				}
			}
		}
		repaint(20);
	}