Package quicktime.app.display

Source Code of quicktime.app.display.QTCanvas

/*      */ package quicktime.app.display;
/*      */
/*      */ import java.awt.AWTEventMulticaster;
/*      */ import java.awt.Canvas;
/*      */ import java.awt.Container;
/*      */ import java.awt.Dimension;
/*      */ import java.awt.Graphics;
/*      */ import java.awt.Point;
/*      */ import java.awt.Rectangle;
/*      */ import java.awt.Toolkit;
/*      */ import java.awt.event.ComponentEvent;
/*      */ import java.awt.event.ComponentListener;
/*      */ import java.util.Vector;
/*      */ import quicktime.QTException;
/*      */ import quicktime.QTRuntimeException;
/*      */ import quicktime.QTSession;
/*      */ import quicktime.QTUnknownOSException;
/*      */ import quicktime.app.image.ImageDrawer;
/*      */ import quicktime.app.players.QTPlayer;
/*      */ import quicktime.qd.NativeGraphics;
/*      */ import quicktime.qd.NativeGraphicsException;
/*      */ import quicktime.qd.QDGraphics;
/*      */ import quicktime.qd.QDPoint;
/*      */ import quicktime.qd.QDRect;
/*      */ import quicktime.qd.Region;
/*      */ import quicktime.util.QTUtils;
/*      */ import quicktime.util.UtilException;
/*      */
/*      */ /** @deprecated */
/*      */ public class QTCanvas extends Canvas
/*      */ {
/*      */   private static boolean MRJWorkaroundFlag;
/*      */   private static final boolean debug = false;
/*  126 */   private static int canvasCount = 0;
/*      */
/*      */   /** @deprecated */
/*      */   public static final int kIntegralResize = 1;
/*      */
/*      */   /** @deprecated */
/*      */   public static final int kInitialSize = 2;
/*      */
/*      */   /** @deprecated */
/*      */   public static final int kFreeResize = 3;
/*      */
/*      */   /** @deprecated */
/*      */   public static final int kAspectResize = 4;
/*      */
/*      */   /** @deprecated */
/*      */   public static final int kPerformanceResize = 5;
/*      */
/*      */   /** @deprecated */
/*      */   public static final int kHorizontalResize = 6;
/*      */
/*      */   /** @deprecated */
/*      */   public static final int kVerticalResize = 7;
/*      */
/*      */   /** @deprecated */
/*      */   public static final int kInitialSizeNoResize = 8;
/*      */   transient int numCanvas;
/*      */   private transient Vector mControllers;
/*      */   private QTCanvasHelper qtcHelper;
/*  225 */   private boolean doRedrawForQTPlayer = false;
/*      */   private float xAlignment;
/*      */   private float yAlignment;
/*      */   private int resizeFlag;
/*      */   transient int initialWidth;
/*      */   transient int initialHeight;
/*      */   int currentX;
/*      */   int currentY;
/*      */   private int minWidth;
/*      */   private int minHeight;
/*      */   private int maxWidth;
/*      */   private int maxHeight;
/*      */   private transient int prefWidth;
/*      */   private transient int prefHeight;
/*      */   int currentWidth;
/*      */   int currentHeight;
/*  243 */   transient NativeGraphics ng = null;
/*  244 */   private transient long msecs = 0L;
/*  245 */   transient boolean deferResize = false;
/*  246 */   private transient boolean appHasSetPreferredSize = false;
/*      */
/*  248 */   boolean isWin = QTSession.isCurrentOS(2);
/*      */
/*  370 */   boolean deferRedraw = false;
/*      */   private boolean moved;
/* 1134 */   private int countRegionErr = 0;
/*      */   ComponentListener clientListener;
/* 1236 */   private boolean addDone = false;
/*      */
/*      */   /** @deprecated */
/*      */   public QTCanvas()
/*      */   {
/*  191 */     this(3, 0.0F, 0.0F);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public QTCanvas(int paramInt, float paramFloat1, float paramFloat2)
/*      */   {
/*  204 */     this.resizeFlag = paramInt;
/*  205 */     this.initialWidth = 1;
/*  206 */     this.initialHeight = 1;
/*  207 */     setAlignmentValues(paramFloat1, paramFloat2);
/*  208 */     this.minWidth = 1;
/*  209 */     this.minHeight = 1;
/*  210 */     this.maxWidth = 2147483647;
/*  211 */     this.maxHeight = 2147483647;
/*  212 */     this.numCanvas = (canvasCount++);
/*      */
/*  217 */     this.qtcHelper = new QTCanvasHelper(this);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public final QDGraphics getPort()
/*      */     throws QTUnknownOSException, NativeGraphicsException
/*      */   {
/*  262 */     QDGraphics localQDGraphics = null;
/*  263 */     if (isVisible()) {
/*  264 */       localQDGraphics = this.ng != null ? this.ng.getGWorld() : null;
/*      */     }
/*  266 */     return localQDGraphics == null ? QDGraphics.scratch : localQDGraphics;
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public final Point getNGLocation()
/*      */     throws QTUnknownOSException, NativeGraphicsException
/*      */   {
/*  276 */     if ((this.qtcHelper.mClient instanceof QTDrawable))
/*      */     {
/*  278 */       return this.ng != null ? this.ng.getLocation() : new Point(0, 0);
/*      */     }
/*  280 */     return getLocation();
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public final NativeGraphics getNativeGraphics()
/*      */   {
/*  291 */     return this.ng;
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public final QDPoint translatePoint(int paramInt1, int paramInt2)
/*      */     throws QTUnknownOSException, NativeGraphicsException
/*      */   {
/*  304 */     Point localPoint = getNGLocation();
/*      */
/*  306 */     return new QDPoint(paramInt1 + localPoint.x, paramInt2 + localPoint.y);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public final synchronized void removeClient()
/*      */   {
/*  314 */     this.qtcHelper.doRemoveClient();
/*  315 */     repaint();
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public synchronized void setClient(Drawable paramDrawable, boolean paramBoolean)
/*      */     throws QTException
/*      */   {
/*  340 */     this.qtcHelper.doSetClient(paramDrawable, paramDrawable != null ? paramDrawable.getDisplayBounds() : null, getMinimumSize(), getMaximumSize(), paramBoolean);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public synchronized void setClient(Drawable paramDrawable, QDRect paramQDRect)
/*      */     throws QTException
/*      */   {
/*  360 */     this.qtcHelper.doSetClient(paramDrawable, paramQDRect, getMinimumSize(), getMaximumSize(), true);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public final Drawable getClient()
/*      */   {
/*  368 */     return this.qtcHelper.mClient;
/*      */   }
/*      */
/*      */   void setInitialWidthAndHeight(QDRect paramQDRect, Dimension paramDimension1, Dimension paramDimension2)
/*      */   {
/*  373 */     this.initialWidth = paramQDRect.getWidth();
/*  374 */     this.initialHeight = paramQDRect.getHeight();
/*      */
/*  377 */     if (paramDimension1.width < 0) this.minWidth = 0; else {
/*  378 */       this.minWidth = paramDimension1.width;
/*      */     }
/*  380 */     if (paramDimension1.height < 0) this.minHeight = 0; else {
/*  381 */       this.minHeight = paramDimension1.height;
/*      */     }
/*  383 */     if (paramDimension2.width < this.minWidth) this.maxWidth = this.minWidth; else {
/*  384 */       this.maxWidth = paramDimension2.width;
/*      */     }
/*  386 */     if (paramDimension2.height < this.minHeight) this.maxHeight = this.minHeight; else {
/*  387 */       this.maxHeight = paramDimension2.height;
/*      */     }
/*  389 */     if (this.initialWidth < this.minWidth) this.initialWidth = this.minWidth;
/*  390 */     else if (this.initialWidth > this.maxWidth) this.initialWidth = this.maxWidth;
/*      */
/*  392 */     if (this.initialHeight < this.minHeight) this.initialHeight = this.minHeight;
/*  393 */     else if (this.initialHeight > this.maxHeight) this.initialHeight = this.maxHeight;
/*      */
/*  395 */     if (!this.appHasSetPreferredSize) {
/*  396 */       this.prefWidth = this.initialWidth;
/*  397 */       this.prefHeight = this.initialHeight;
/*      */     }
/*      */   }
/*      */
/*      */   final void doParentLayout()
/*      */   {
/*  404 */     Container localContainer = getParent();
/*  405 */     if (localContainer != null) {
/*  406 */       invalidate();
/*  407 */       localContainer.validate();
/*  408 */       return;
/*      */     }
/*  410 */     super.reshape(this.currentX, this.currentY, this.currentWidth, this.currentHeight);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void setAlignment(float paramFloat1, float paramFloat2)
/*      */   {
/*  437 */     Rectangle localRectangle = getBounds();
/*  438 */     setAlignmentValues(paramFloat1, paramFloat2);
/*  439 */     doParentLayout();
/*      */
/*  441 */     this.doRedrawForQTPlayer = this.qtcHelper.shouldRedrawQTPlayer(localRectangle);
/*      */   }
/*      */
/*      */   public final void setAlignmentX(float paramFloat)
/*      */   {
/*  446 */     setAlignment(paramFloat, getAlignmentY());
/*      */   }
/*      */
/*      */   public final void setAlignmentY(float paramFloat) {
/*  450 */     setAlignment(getAlignmentX(), paramFloat);
/*      */   }
/*      */
/*      */   private final void setAlignmentValues(float paramFloat1, float paramFloat2) {
/*  454 */     if (paramFloat1 > 1.0F) this.xAlignment = 1.0F;
/*  455 */     else if (paramFloat1 < 0.0F) this.xAlignment = 0.0F; else {
/*  456 */       this.xAlignment = paramFloat1;
/*      */     }
/*  458 */     if (paramFloat2 > 1.0F) this.yAlignment = 1.0F;
/*  459 */     else if (paramFloat2 < 0.0F) this.yAlignment = 0.0F; else
/*  460 */       this.yAlignment = paramFloat2;
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public float getAlignmentX()
/*      */   {
/*  468 */     return this.xAlignment;
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public float getAlignmentY()
/*      */   {
/*  475 */     return this.yAlignment;
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void setResizeFlag(int paramInt)
/*      */   {
/*  483 */     this.resizeFlag = paramInt;
/*  484 */     Rectangle localRectangle = getBounds();
/*  485 */     doParentLayout();
/*  486 */     this.doRedrawForQTPlayer = this.qtcHelper.shouldRedrawQTPlayer(localRectangle);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public int getResizeFlag()
/*      */   {
/*  494 */     return this.resizeFlag;
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void setMinimumSize(Dimension paramDimension)
/*      */   {
/*  504 */     if (paramDimension == null)
/*  505 */       setMinimumSize(0, 0);
/*      */     else
/*  507 */       setMinimumSize(paramDimension.width, paramDimension.height);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void setMinimumSize(int paramInt1, int paramInt2)
/*      */   {
/*  517 */     if (paramInt1 < 0) this.minWidth = 0; else {
/*  518 */       this.minWidth = paramInt1;
/*      */     }
/*  520 */     if (paramInt2 < 0) this.minHeight = 0; else {
/*  521 */       this.minHeight = paramInt2;
/*      */     }
/*  523 */     if ((this.currentWidth < this.minWidth) || (this.currentHeight < this.minHeight))
/*  524 */       doParentLayout();
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public Dimension getMinimumSize()
/*      */   {
/*  533 */     return new Dimension(this.minWidth, this.minHeight);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public Dimension getBestSize()
/*      */   {
/*  544 */     return new Dimension(this.initialWidth, this.initialHeight);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void clientChanged(Dimension paramDimension)
/*      */   {
/*  566 */     clientChanged(paramDimension.width, paramDimension.height);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void clientChanged(int paramInt1, int paramInt2)
/*      */   {
/*  590 */     Rectangle localRectangle = new Rectangle(getLocation(), new Dimension(this.initialWidth, this.initialHeight));
/*  591 */     if (paramInt1 < 0) this.initialWidth = 0; else {
/*  592 */       this.initialWidth = paramInt1;
/*      */     }
/*  594 */     if (paramInt2 < 0) this.initialHeight = 0; else {
/*  595 */       this.initialHeight = paramInt2;
/*      */     }
/*  597 */     if (!this.appHasSetPreferredSize) {
/*  598 */       this.prefWidth = this.initialWidth;
/*  599 */       this.prefHeight = this.initialHeight;
/*      */     }
/*      */
/*  602 */     this.doRedrawForQTPlayer = this.qtcHelper.shouldRedrawQTPlayer(localRectangle);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public Dimension getPreferredSize()
/*      */   {
/*  611 */     return new Dimension(this.prefWidth, this.prefHeight);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void setPreferredSize(Dimension paramDimension)
/*      */   {
/*  619 */     if (paramDimension == null)
/*  620 */       setPreferredSize(this.initialWidth, this.initialHeight);
/*      */     else
/*  622 */       setPreferredSize(paramDimension.width, paramDimension.height);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void setPreferredSize(int paramInt1, int paramInt2)
/*      */   {
/*  634 */     if (paramInt1 < 0) {
/*  635 */       this.prefWidth = this.initialWidth;
/*  636 */       this.appHasSetPreferredSize = false;
/*      */     } else {
/*  638 */       this.prefWidth = paramInt1;
/*  639 */       this.appHasSetPreferredSize = true;
/*      */     }
/*      */
/*  642 */     if (paramInt2 < 0) {
/*  643 */       this.prefHeight = this.initialHeight;
/*  644 */       this.appHasSetPreferredSize = false;
/*      */     } else {
/*  646 */       this.prefHeight = paramInt2;
/*  647 */       this.appHasSetPreferredSize = true;
/*      */     }
/*      */
/*  650 */     if ((this.currentWidth != this.prefWidth) || (this.currentHeight != this.prefHeight))
/*  651 */       doParentLayout();
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public boolean isFocusTraversable()
/*      */   {
/*  661 */     return true;
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void setMaximumSize(Dimension paramDimension)
/*      */   {
/*  673 */     if (paramDimension == null) {
/*  674 */       Dimension localDimension = Toolkit.getDefaultToolkit().getScreenSize();
/*  675 */       setMaximumSize(localDimension.width, localDimension.height);
/*      */     }
/*      */     else {
/*  678 */       setMaximumSize(paramDimension.width, paramDimension.height);
/*      */     }
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void setMaximumSize(int paramInt1, int paramInt2)
/*      */   {
/*  688 */     if (paramInt1 < 0) this.maxWidth = 0; else {
/*  689 */       this.maxWidth = paramInt1;
/*      */     }
/*  691 */     if (paramInt2 < 0) this.maxHeight = 0; else {
/*  692 */       this.maxHeight = paramInt2;
/*      */     }
/*  694 */     if ((this.currentWidth > this.maxWidth) || (this.currentHeight > this.maxHeight))
/*  695 */       doParentLayout();
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public Dimension getMaximumSize()
/*      */   {
/*  704 */     return new Dimension(this.maxWidth, this.maxHeight);
/*      */   }
/*      */
/*      */   private Dimension getAspectSize(int paramInt1, int paramInt2)
/*      */   {
/*  710 */     if (paramInt1 < this.minWidth) paramInt1 = this.minWidth;
/*  711 */     else if (paramInt1 > this.maxWidth) paramInt1 = this.maxWidth;
/*  712 */     if (paramInt2 < this.minHeight) paramInt2 = this.minHeight;
/*  713 */     else if (paramInt2 > this.maxHeight) paramInt2 = this.maxHeight;
/*      */
/*  716 */     float f1 = paramInt1 / (this.initialWidth < 1 ? 1 : this.initialWidth);
/*  717 */     float f2 = paramInt2 / (this.initialHeight < 1 ? 1 : this.initialHeight);
/*      */     int i;
/*      */     int j;
/*  722 */     if (f1 < f2) {
/*  723 */       i = (int)(this.initialWidth * f1);
/*  724 */       j = (int)(this.initialHeight * f1);
/*      */     }
/*      */     else {
/*  727 */       i = (int)(this.initialWidth * f2);
/*  728 */       j = (int)(this.initialHeight * f2);
/*      */     }
/*      */
/*  731 */     return new Dimension(i, j);
/*      */   }
/*      */
/*      */   private void setCurrentWidthHeight(int paramInt1, int paramInt2)
/*      */   {
/*      */     Dimension localDimension;
/*      */     int i;
/*      */     int j;
/*      */     int k;
/*  739 */     switch (getResizeFlag())
/*      */     {
/*      */     case 2:
/*  742 */       this.currentWidth = this.initialWidth;
/*  743 */       this.currentHeight = this.initialHeight;
/*      */
/*  747 */       if (this.currentWidth < this.minWidth) this.currentWidth = this.minWidth;
/*  748 */       else if (this.currentWidth > this.maxWidth) this.currentWidth = this.maxWidth;
/*  749 */       if (this.currentHeight < this.minHeight) this.currentHeight = this.minHeight;
/*  750 */       else if (this.currentHeight > this.maxHeight) this.currentHeight = this.maxHeight;
/*      */
/*  754 */       if ((this.currentWidth > paramInt1) || (this.currentHeight > paramInt2)) {
/*  755 */         localDimension = getAspectSize(paramInt1, paramInt2);
/*  756 */         this.currentWidth = localDimension.width;
/*  757 */         this.currentHeight = localDimension.height;
/*  758 */       }break;
/*      */     case 4:
/*  765 */       localDimension = getAspectSize(paramInt1, paramInt2);
/*  766 */       this.currentWidth = localDimension.width;
/*  767 */       this.currentHeight = localDimension.height;
/*  768 */       break;
/*      */     case 6:
/*  771 */       this.currentWidth = paramInt1;
/*  772 */       this.currentHeight = this.initialHeight;
/*      */
/*  776 */       if (this.currentWidth < this.minWidth) this.currentWidth = this.minWidth;
/*  777 */       else if (this.currentWidth > this.maxWidth) this.currentWidth = this.maxWidth;
/*  778 */       if (this.currentHeight < this.minHeight) this.currentHeight = this.minHeight;
/*  779 */       else if (this.currentHeight > this.maxHeight) this.currentHeight = this.maxHeight;
/*      */
/*  783 */       if (this.currentHeight > paramInt2) {
/*  784 */         localDimension = getAspectSize(paramInt1, paramInt2);
/*  785 */         this.currentHeight = localDimension.height;
/*  786 */       }break;
/*      */     case 7:
/*  790 */       this.currentWidth = this.initialWidth;
/*  791 */       this.currentHeight = paramInt2;
/*      */
/*  795 */       if (this.currentWidth < this.minWidth) this.currentWidth = this.minWidth;
/*  796 */       else if (this.currentWidth > this.maxWidth) this.currentWidth = this.maxWidth;
/*  797 */       if (this.currentHeight < this.minHeight) this.currentHeight = this.minHeight;
/*  798 */       else if (this.currentHeight > this.maxHeight) this.currentHeight = this.maxHeight;
/*      */
/*  802 */       if (this.currentWidth > paramInt1) {
/*  803 */         localDimension = getAspectSize(paramInt1, paramInt2);
/*  804 */         this.currentWidth = localDimension.width;
/*  805 */       }break;
/*      */     case 5:
/*  812 */       if (paramInt1 < this.minWidth) paramInt1 = this.minWidth;
/*  813 */       else if (paramInt1 > this.maxWidth) paramInt1 = this.maxWidth;
/*  814 */       if (paramInt2 < this.minHeight) paramInt2 = this.minHeight;
/*  815 */       else if (paramInt2 > this.maxHeight) paramInt2 = this.maxHeight;
/*      */
/*  817 */       i = 0;
/*      */
/*  821 */       for (int m = 2; i == 0; m *= 2)
/*      */       {
/*      */         int n;
/*  822 */         if ((paramInt1 < this.initialWidth) || (paramInt2 < this.initialHeight)) {
/*  823 */           j = this.initialWidth / m;
/*  824 */           k = this.initialHeight / m;
/*  825 */           if ((j <= paramInt1) && (k <= paramInt2)) {
/*  826 */             i = 1;
/*      */
/*  828 */             n = 0;
/*  829 */             this.currentWidth = j; for (this.currentHeight = k;
/*  830 */               n != 0;
/*  831 */               this.currentHeight *= 2) {
/*  832 */               if ((this.currentWidth >= this.minWidth) && (this.currentHeight >= this.minHeight))
/*  833 */                 n = 1;
/*  831 */               this.currentWidth *= 2;
/*      */             }
/*      */
/*      */           }
/*      */
/*      */         }
/*      */         else
/*      */         {
/*  839 */           j = this.initialWidth * m;
/*  840 */           k = this.initialHeight * m;
/*  841 */           if ((j >= paramInt1) || (k >= paramInt2)) {
/*  842 */             i = 1;
/*      */
/*  844 */             if ((j > paramInt1) || (k > paramInt2)) {
/*  845 */               j /= 2;
/*  846 */               k /= 2;
/*      */             }
/*      */
/*  849 */             n = 0;
/*  850 */             this.currentWidth = j; for (this.currentHeight = k;
/*  851 */               n != 0;
/*  852 */               this.currentHeight /= 2) {
/*  853 */               if ((this.currentWidth <= this.maxWidth) && (this.currentHeight <= this.maxHeight))
/*  854 */                 n = 1;
/*  852 */               this.currentWidth /= 2;
/*      */             }
/*      */           }
/*      */
/*      */         }
/*      */
/*      */       }
/*      */
/*  860 */       break;
/*      */     case 1:
/*  865 */       if (paramInt1 < this.minWidth) paramInt1 = this.minWidth;
/*  866 */       else if (paramInt1 > this.maxWidth) paramInt1 = this.maxWidth;
/*  867 */       if (paramInt2 < this.minHeight) paramInt2 = this.minHeight;
/*  868 */       else if (paramInt2 > this.maxHeight) paramInt2 = this.maxHeight;
/*      */
/*  870 */       i = this.initialWidth == 0 ? 0 : paramInt1 / this.initialWidth;
/*  871 */       j = this.initialHeight == 0 ? 0 : paramInt2 / this.initialHeight;
/*      */
/*  873 */       k = Math.min(i, j);
/*  874 */       if (k < 1) {
/*  875 */         float f1 = this.initialWidth == 0 ? 0.0F : paramInt1 / this.initialWidth;
/*  876 */         float f2 = this.initialHeight == 0 ? 0.0F : paramInt2 / this.initialHeight;
/*      */
/*  878 */         k = 0;
/*  879 */         if (f1 <= f2)
/*  880 */           k = this.initialWidth / paramInt1 + 1;
/*      */         else
/*  882 */           k = this.initialHeight / paramInt2 + 1;
/*  883 */         this.currentWidth = ((int)(this.initialWidth * 1.0F / k));
/*  884 */         this.currentHeight = ((int)(this.initialHeight * 1.0F / k));
/*      */       } else {
/*  886 */         this.currentWidth = (this.initialWidth * k);
/*  887 */         this.currentHeight = (this.initialHeight * k);
/*      */       }
/*      */
/*  890 */       break;
/*      */     case 8:
/*  894 */       this.currentWidth = this.initialWidth;
/*  895 */       this.currentHeight = this.initialHeight;
/*      */
/*  899 */       if (this.currentWidth < this.minWidth) this.currentWidth = this.minWidth;
/*  900 */       else if (this.currentWidth > this.maxWidth) this.currentWidth = this.maxWidth;
/*  901 */       if (this.currentHeight < this.minHeight) this.currentHeight = this.minHeight;
/*  902 */       else if (this.currentHeight > this.maxHeight) this.currentHeight = this.maxHeight; break;
/*      */     case 3:
/*      */     default:
/*  909 */       if (paramInt1 < this.minWidth) paramInt1 = this.minWidth;
/*  910 */       else if (paramInt1 > this.maxWidth) paramInt1 = this.maxWidth;
/*  911 */       if (paramInt2 < this.minHeight) paramInt2 = this.minHeight;
/*  912 */       else if (paramInt2 > this.maxHeight) paramInt2 = this.maxHeight;
/*      */
/*  914 */       this.currentWidth = paramInt1;
/*  915 */       this.currentHeight = paramInt2;
/*      */     }
/*      */   }
/*      */
/*      */   private final void setCurrentXY(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
/*      */   {
/*  929 */     int i = paramInt3 - this.currentWidth;
/*  930 */     if (i < 0) i = 0;
/*      */
/*  933 */     int j = paramInt4 - this.currentHeight;
/*  934 */     if (j < 0) j = 0;
/*      */
/*  937 */     this.currentX = (paramInt1 + (int)(this.xAlignment * i));
/*  938 */     this.currentY = (paramInt2 + (int)(this.yAlignment * j));
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void setSize(Dimension paramDimension)
/*      */   {
/*  946 */     setSize(paramDimension.width, paramDimension.height);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void setSize(int paramInt1, int paramInt2)
/*      */   {
/*  955 */     setBounds(this.currentX, this.currentY, paramInt1, paramInt2);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public final void reshape(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
/*      */   {
/*  964 */     setBounds(paramInt1, paramInt2, paramInt3, paramInt4);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public final synchronized void setBounds(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
/*      */   {
/* 1011 */     boolean bool = isValid();
/*      */
/* 1013 */     int i = this.currentWidth;
/* 1014 */     int j = this.currentHeight;
/* 1015 */     setCurrentWidthHeight(paramInt3, paramInt4);
/* 1016 */     int k = (i != this.currentWidth) || (j != this.currentHeight) ? 1 : 0;
/*      */
/* 1018 */     int m = this.currentX;
/* 1019 */     int n = this.currentY;
/* 1020 */     setCurrentXY(paramInt1, paramInt2, paramInt3, paramInt4);
/*      */
/* 1022 */     super.reshape(this.currentX, this.currentY, this.currentWidth, this.currentHeight);
/*      */
/* 1025 */     if (this.qtcHelper.mClient != null) {
/* 1026 */       this.deferResize = ((this.deferResize) || (k != 0));
/* 1027 */       if (this.deferResize) {
/* 1028 */         this.doRedrawForQTPlayer = ((!this.isWin) && (!bool) && (((this.qtcHelper.mClient instanceof QTPlayer)) || ((this.qtcHelper.mClient instanceof GroupDrawable)) || ((this.qtcHelper.mClient instanceof ImageDrawer))) && (isShowing()));
/*      */       }
/*      */
/* 1034 */       this.moved = ((m != this.currentX) || (n != this.currentY) || (this.moved));
/*      */     }
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void paint(Graphics paramGraphics)
/*      */   {
/* 1048 */     if (this.qtcHelper.mClient != null)
/* 1049 */       if (isValid()) {
/* 1050 */         synchronized (this) {
/* 1051 */           QDGraphics localQDGraphics = null;
/* 1052 */           Region localRegion = null;
/*      */           try
/*      */           {
/* 1055 */             if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4))) {
/* 1056 */               localQDGraphics = getPort();
/* 1057 */               localRegion = localQDGraphics.getClip();
/* 1058 */               localQDGraphics.clipRect();
/*      */             }
/* 1060 */             synchronized (this.qtcHelper.mClient) {
/* 1061 */               if (this.deferResize)
/*      */               {
/* 1068 */                 this.qtcHelper.doClientSetBounds();
/*      */               }
/* 1070 */               if (this.moved) {
/* 1071 */                 this.moved = false;
/* 1072 */                 if (this.clientListener != null)
/* 1073 */                   this.clientListener.componentMoved(new ComponentEvent(this, 100));
/*      */               }
/* 1075 */               if (this.deferResize) {
/* 1076 */                 this.deferResize = false;
/* 1077 */                 if (this.clientListener != null) {
/* 1078 */                   this.clientListener.componentResized(new ComponentEvent(this, 101));
/*      */                 }
/* 1080 */                 if (this.doRedrawForQTPlayer) {
/* 1081 */                   this.qtcHelper.mClient.redraw(null);
/* 1082 */                   this.doRedrawForQTPlayer = false;
/*      */                 }
/* 1084 */                 if ((MRJWorkaroundFlag) && (!this.deferRedraw) &&
/* 1085 */                   (!this.isWin))
/*      */                 {
/* 1123 */                   if ((localQDGraphics != null) && (localRegion != null))
/* 1124 */                     localQDGraphics.setClip(localRegion);
/*      */                   return;
/*      */                 }
/*      */               }
/* 1089 */               if ((this.qtcHelper.mClient instanceof QTDrawable)) {
/* 1090 */                 if (!((QTDrawable)this.qtcHelper.mClient).getGWorld().equals(QDGraphics.scratch)) {
/* 1091 */                   QTUtils.checkFreeMemory();
/* 1092 */                   this.qtcHelper.mClient.redraw(null);
/*      */                 }
/* 1094 */               } else if (isShowing()) {
/* 1095 */                 QTUtils.checkFreeMemory();
/* 1096 */                 this.qtcHelper.mClient.redraw(null);
/*      */               }
/* 1098 */               this.deferRedraw = false;
/*      */             }
/*      */           } catch (QTException localQTException) {
/* 1101 */             if ((localQTException.errorCode() == -500) || (localQTException.errorCode() == -108)) {
/* 1102 */               if (localQTException.errorCode() == -108) {
/*      */                 try {
/* 1104 */                   QTUtils.checkFreeMemory();
/*      */                 } catch (UtilException localUtilException) {
/* 1106 */                   QTRuntimeException.handleOrThrow(new QTRuntimeException(localUtilException), this.qtcHelper.mClient, "redraw");
/*      */                 }
/*      */               }
/* 1109 */               if (this.countRegionErr < 3) {
/* 1110 */                 if (this.deferResize)
/* 1111 */                   this.doRedrawForQTPlayer = true;
/* 1112 */                 this.countRegionErr += 1;
/* 1113 */                 QTUtils.reclaimMemory();
/* 1114 */                 repaint();
/*      */
/* 1123 */                 if ((localQDGraphics != null) && (localRegion != null))
/* 1124 */                   localQDGraphics.setClip(localRegion);
/*      */                 return;
/*      */               }
/* 1117 */               this.countRegionErr = 0;
/* 1118 */               QTRuntimeException.handleOrThrow(new QTRuntimeException(localQTException), this.qtcHelper.mClient, "setDisplayBounds");
/*      */             }
/*      */             else {
/* 1121 */               QTRuntimeException.handleOrThrow(new QTRuntimeException(localQTException), this.qtcHelper.mClient, "setDisplayBounds");
/*      */             }
/*      */           } finally { if ((localQDGraphics != null) && (localRegion != null))
/* 1124 */               localQDGraphics.setClip(localRegion);
/*      */           }
/* 1126 */           this.countRegionErr = 0;
/*      */         }
/*      */       } else {
/* 1129 */         doParentLayout();
/* 1130 */         repaint();
/*      */       }
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void update(Graphics paramGraphics)
/*      */   {
/* 1143 */     if (this.qtcHelper.mClient == null) super.update(paramGraphics);
/* 1144 */     else if (QTSession.isCurrentOS(4))
/* 1145 */       paint(paramGraphics);
/* 1146 */     else if ((!(this.qtcHelper.mClient instanceof QTDrawable)) || (this.deferRedraw))
/* 1147 */       paint(paramGraphics);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public synchronized void setVisible(boolean paramBoolean)
/*      */   {
/* 1159 */     super.setVisible(paramBoolean);
/*      */     try {
/* 1161 */       if (paramBoolean) {
/* 1162 */         this.qtcHelper.doSetGWorld(true);
/* 1163 */         doParentLayout();
/*      */       } else {
/* 1165 */         this.qtcHelper.doSetGWorld(false);
/* 1166 */         Container localContainer = getParent();
/* 1167 */         if (localContainer != null)
/* 1168 */           localContainer.repaint();
/*      */       }
/*      */     }
/*      */     catch (QTException localQTException) {
/* 1172 */       QTRuntimeException.handleOrThrow(new QTRuntimeException(localQTException), this.qtcHelper.mClient, "setGWorld");
/*      */     }
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void addQTClientListener(ComponentListener paramComponentListener)
/*      */   {
/* 1192 */     this.clientListener = AWTEventMulticaster.add(this.clientListener, paramComponentListener);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public void removeQTClientListener(ComponentListener paramComponentListener)
/*      */   {
/* 1203 */     this.clientListener = AWTEventMulticaster.remove(this.clientListener, paramComponentListener);
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public synchronized void addNotify()
/*      */   {
/* 1213 */     super.addNotify();
/* 1214 */     if (!this.addDone) {
/*      */       try {
/* 1216 */         this.ng = NativeGraphics.getContext(this);
/* 1217 */         if (this.qtcHelper.mClient != null) {
/* 1218 */           this.qtcHelper.doSetGWorld(isVisible());
/* 1219 */           this.qtcHelper.mClient.addedTo(this);
/* 1220 */           if (isVisible()) {
/* 1221 */             if (!this.isWin)
/* 1222 */               this.deferRedraw = true;
/*      */             else
/* 1224 */               repaint();
/*      */           }
/*      */         }
/* 1227 */         QTSession.addActiveCanvas(this);
/*      */       } catch (QTException localQTException) {
/* 1229 */         this.qtcHelper.doRemoveClient();
/* 1230 */         throw new QTRuntimeException(localQTException);
/*      */       }
/* 1232 */       this.addDone = true;
/*      */     }
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public synchronized void removeNotify()
/*      */   {
/* 1245 */     synchronized (QTSession.terminationLock()) {
/* 1246 */       if ((this.addDone) && (QTSession.isInitialized()))
/*      */         try {
/* 1248 */           if (this.qtcHelper.mClient != null) {
/* 1249 */             this.qtcHelper.doSetGWorld(false);
/* 1250 */             this.qtcHelper.mClient.removedFrom(this);
/*      */           }
/* 1252 */           QTSession.removeActiveCanvas(this);
/*      */
/* 1254 */           this.addDone = false;
/*      */         }
/*      */         catch (QTException localQTException) {
/* 1257 */           this.qtcHelper.doRemoveClient();
/* 1258 */           throw new QTRuntimeException(localQTException);
/*      */         } finally {
/* 1260 */           if ((QTSession.isCurrentOS(2)) && (this.ng != null)) {
/* 1261 */             RemoveContext(this.ng);
/*      */           }
/*      */
/* 1264 */           this.ng = null;
/* 1265 */           super.removeNotify();
/*      */         }
/*      */       else
/* 1268 */         super.removeNotify();
/*      */     }
/*      */   }
/*      */
/*      */   /** @deprecated */
/*      */   public String toString()
/*      */   {
/* 1278 */     return getClass().getName() + "_" + this.numCanvas + "_" + "[Location=" + getLocation() + ",Size=" + getSize() + "]";
/*      */   }
/*      */
/*      */   protected void finalize()
/*      */     throws Throwable
/*      */   {
/*      */     try
/*      */     {
/* 1288 */       removeNotify();
/*      */     }
/*      */     finally
/*      */     {
/* 1292 */       this.qtcHelper.mClient = null;
/*      */     }
/*      */
/* 1295 */     super.finalize();
/*      */   }
/*      */
/*      */   private static native void RemoveContext(Object paramObject);
/*      */
/*      */   static
/*      */   {
/*   90 */     if ((QTSession.isCurrentOS(4)) && (QTSession.getJavaVersion() >= 65540)) {
/*   91 */       throw new QTRuntimeException("Unsupported on Mac OS X and Java 1.4 and higher.");
/*      */     }
/*   93 */     if (QTSession.isCurrentOS(2)) {
/*   94 */       MRJWorkaroundFlag = false;
/*   95 */     } else if ((QTSession.isCurrentOS(1)) || (QTSession.isCurrentOS(4)))
/*      */     {
/*   97 */       String str = System.getProperty("java.version");
/*   98 */       int i = Character.getNumericValue(str.charAt(0));
/*      */
/*  100 */       int j = 0;
/*  101 */       int k = 0;
/*  102 */       int m = 0;
/*      */
/*  104 */       for (int n = 1; n < str.length(); n++) {
/*  105 */         char c = str.charAt(n);
/*  106 */         if (Character.isDigit(c)) {
/*  107 */           if (m == 0) {
/*  108 */             j = Character.getNumericValue(c);
/*  109 */             m = 1;
/*      */           } else {
/*  111 */             k = Character.getNumericValue(c);
/*      */           }
/*      */         }
/*      */
/*      */       }
/*      */
/*  117 */       if ((i == 1) && (j == 1) && (k < 8))
/*  118 */         MRJWorkaroundFlag = true;
/*      */       else
/*  120 */         MRJWorkaroundFlag = false;
/*      */     }
/*      */   }
/*      */ }

/* Location:           Z:\System\Library\Java\Extensions\QTJava.zip
* Qualified Name:     quicktime.app.display.QTCanvas
* JD-Core Version:    0.6.2
*/
TOP

Related Classes of quicktime.app.display.QTCanvas

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.