/* */ package quicktime.app.actions;
/* */
/* */ import java.awt.event.MouseEvent;
/* */ import quicktime.QTException;
/* */ import quicktime.QTRuntimeException;
/* */ import quicktime.QTSession;
/* */ import quicktime.app.display.QTDrawable;
/* */ import quicktime.app.image.Transformable;
/* */ import quicktime.qd.QDDimension;
/* */ import quicktime.qd.QDPoint;
/* */ import quicktime.qd.QDRect;
/* */ import quicktime.std.image.Matrix;
/* */
/* */ /** @deprecated */
/* */ public class Dragger extends MouseResponder
/* */ {
/* */ public static final int kConstrainNone = 0;
/* */ public static final int kConstrainLeft = 1;
/* */ public static final int kConstrainRight = 16;
/* */ public static final int kConstrainTop = 256;
/* */ public static final int kConstrainBottom = 4096;
/* */ public static final int kConstrainHorizontal = 17;
/* */ public static final int kConstrainVertical = 4352;
/* */ public static final int kConstrainAll = 4369;
/* 115 */ private int constrained = 4369;
/* */
/* */ /** @deprecated */
/* */ protected Actionable actor;
/* */ protected Transformable target;
/* */ protected QTDrawable space;
/* 134 */ protected int xBufferIfUnConstrained = 1;
/* */
/* 138 */ protected int yBufferIfUnConstrained = 1;
/* */ private QDPoint[] origPt;
/* */ private QDPoint[] lastPt;
/* */ private QDRect spaceRect;
/* */ private Matrix invSpaceMatrix;
/* */ private Matrix origTargetMatrix;
/* */
/* */ /** @deprecated */
/* */ public Dragger(int paramInt)
/* */ {
/* 87 */ this(paramInt, -5, 0);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public Dragger(int paramInt1, int paramInt2)
/* */ {
/* 99 */ this(paramInt1, paramInt2, 0);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public Dragger(int paramInt1, int paramInt2, int paramInt3)
/* */ {
/* 111 */ super(paramInt1, paramInt2, 0x6 | paramInt3);
/* */ }
/* */
/* */ /** @deprecated */
/* */ protected void setTargetSpace(Object paramObject)
/* */ {
/* 154 */ this.space = ((QTDrawable)paramObject);
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void setActionable(Actionable paramActionable)
/* */ {
/* 161 */ this.actor = paramActionable;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public Actionable getActionable()
/* */ {
/* 167 */ return this.actor;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public boolean isAppropriate(Object paramObject)
/* */ {
/* 177 */ return paramObject instanceof Transformable;
/* */ }
/* */
/* */ /** @deprecated */
/* */ protected void setTarget(Object paramObject)
/* */ {
/* 188 */ this.target = ((Transformable)paramObject);
/* */ }
/* */
/* */ /** @deprecated */
/* */ protected void removeTarget()
/* */ {
/* 197 */ this.target = null;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void setConstrained(int paramInt)
/* */ {
/* 206 */ this.constrained = paramInt;
/* */ }
/* */
/* */ public int getConstrained()
/* */ {
/* 212 */ return this.constrained;
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void mousePressed(MouseEvent paramMouseEvent)
/* */ {
/* */ try
/* */ {
/* 227 */ QDRect localQDRect = this.space.getDisplayBounds();
/* */
/* 229 */ this.invSpaceMatrix = new Matrix();
/* 230 */ Matrix localMatrix = this.space.getMatrix().copy();
/* 231 */ localMatrix.setTx(0.0F);
/* 232 */ localMatrix.setTy(0.0F);
/* 233 */ localMatrix.inverse(this.invSpaceMatrix);
/* 234 */ this.origPt = new QDPoint[1];
/* 235 */ this.origPt[0] = new QDPoint(paramMouseEvent.getX(), paramMouseEvent.getY());
/* 236 */ this.invSpaceMatrix.transformPoints(this.origPt);
/* 237 */ this.origTargetMatrix = this.target.getMatrix();
/* 238 */ this.spaceRect = localQDRect.copy();
/* 239 */ this.spaceRect.setX(0);
/* 240 */ this.spaceRect.setY(0);
/* 241 */ this.invSpaceMatrix.transformRect(this.spaceRect);
/* */ } catch (QTException localQTException) {
/* 243 */ QTRuntimeException.handleOrThrow(new QTRuntimeException(localQTException), this, "mousePressed");
/* */ }
/* */ }
/* */
/* */ /** @deprecated */
/* */ public void mouseDragged(MouseEvent paramMouseEvent)
/* */ {
/* */ try
/* */ {
/* 256 */ int i = 0;
/* 257 */ QDPoint[] arrayOfQDPoint = new QDPoint[1];
/* 258 */ arrayOfQDPoint[0] = new QDPoint(paramMouseEvent.getX(), paramMouseEvent.getY());
/* 259 */ this.invSpaceMatrix.transformPoints(arrayOfQDPoint);
/* 260 */ int j = arrayOfQDPoint[0].getX() - this.origPt[0].getX();
/* 261 */ int k = arrayOfQDPoint[0].getY() - this.origPt[0].getY();
/* 262 */ Matrix localMatrix = this.origTargetMatrix.copy();
/* 263 */ localMatrix.translate(j, k);
/* */
/* 265 */ QDDimension localQDDimension = this.target.getOriginalSize();
/* 266 */ int m = localQDDimension.getWidth();
/* 267 */ int n = localQDDimension.getHeight();
/* 268 */ float f1 = localMatrix.getTx();
/* 269 */ float f2 = localMatrix.getTy();
/* 270 */ int i1 = this.spaceRect.getX();
/* 271 */ int i2 = this.spaceRect.getWidth() - m;
/* 272 */ int i3 = this.spaceRect.getY();
/* 273 */ int i4 = this.spaceRect.getHeight() - n;
/* */
/* 275 */ int i5 = localMatrix.getType();
/* 276 */ switch (i5) {
/* */ case 0:
/* */ case 1:
/* 279 */ break;
/* */ default:
/* 283 */ QDRect localQDRect = new QDRect(0, 0, m, n);
/* 284 */ localMatrix.transformRect(localQDRect);
/* 285 */ m = localQDRect.getWidth();
/* 286 */ n = localQDRect.getHeight();
/* 287 */ i1 = (int)(localMatrix.getTx() - localQDRect.getX() + 0.5F);
/* 288 */ f1 -= i1;
/* 289 */ i3 = (int)(localMatrix.getTy() - localQDRect.getY() + 0.5F);
/* 290 */ f2 -= i3;
/* 291 */ i4 = this.spaceRect.getHeight() - n + i3;
/* 292 */ i2 = this.spaceRect.getWidth() - m + i1;
/* */ }
/* */
/* 297 */ if (f1 < this.spaceRect.getX()) {
/* 298 */ if ((this.constrained & 0x1) != 0) {
/* 299 */ localMatrix.setTx(i1);
/* 300 */ i = 1;
/* 301 */ } else if (f1 <= -m) {
/* 302 */ localMatrix.setTx(-m + this.xBufferIfUnConstrained + i1);
/* 303 */ i = 1;
/* */ }
/* 305 */ } else if (f1 + m > this.spaceRect.getWidth()) {
/* 306 */ if ((this.constrained & 0x10) != 0) {
/* 307 */ localMatrix.setTx(i2);
/* 308 */ i = 1;
/* 309 */ } else if (f1 >= this.spaceRect.getWidth()) {
/* 310 */ localMatrix.setTx(i2 + m - this.xBufferIfUnConstrained);
/* 311 */ i = 1;
/* */ }
/* */ }
/* */
/* 315 */ if (f2 < this.spaceRect.getY()) {
/* 316 */ if ((this.constrained & 0x100) != 0) {
/* 317 */ localMatrix.setTy(i3);
/* 318 */ i = 1;
/* 319 */ } else if (f2 <= -n) {
/* 320 */ localMatrix.setTy(-n + this.yBufferIfUnConstrained + i3);
/* 321 */ i = 1;
/* */ }
/* 323 */ } else if (f2 + n > this.spaceRect.getHeight()) {
/* 324 */ if ((this.constrained & 0x1000) != 0) {
/* 325 */ localMatrix.setTy(i4);
/* 326 */ i = 1;
/* 327 */ } else if (f2 >= this.spaceRect.getHeight()) {
/* 328 */ localMatrix.setTy(i4 + n - this.yBufferIfUnConstrained);
/* 329 */ i = 1;
/* */ }
/* */ }
/* */
/* 333 */ this.target.setMatrix(localMatrix);
/* */
/* 335 */ if ((i != 0) && (this.actor != null))
/* 336 */ this.actor.trigger();
/* */ } catch (QTException localQTException) {
/* 338 */ QTRuntimeException.handleOrThrow(new QTRuntimeException(localQTException), this, "mouseDragged");
/* */ }
/* */ }
/* */
/* */ static
/* */ {
/* 60 */ if ((QTSession.isCurrentOS(4)) && (QTSession.getJavaVersion() >= 65540))
/* 61 */ throw new QTRuntimeException("Unsupported on Mac OS X and Java 1.4 and higher.");
/* */ }
/* */ }
/* Location: Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name: quicktime.app.actions.Dragger
* JD-Core Version: 0.6.2
*/