Package quicktime.app.display

Source Code of quicktime.app.display.QTCanvasHelper

/*     */ package quicktime.app.display;
/*     */
/*     */ import java.awt.Dimension;
/*     */ import java.awt.Point;
/*     */ import java.awt.Rectangle;
/*     */ import java.awt.event.ComponentEvent;
/*     */ import java.awt.event.ComponentListener;
/*     */ import quicktime.QTException;
/*     */ import quicktime.QTRuntimeException;
/*     */ import quicktime.QTSession;
/*     */ import quicktime.app.image.ImageDrawer;
/*     */ import quicktime.app.players.QTPlayer;
/*     */ import quicktime.qd.QDGraphics;
/*     */ import quicktime.qd.QDRect;
/*     */ import quicktime.util.QTUtils;
/*     */
/*     */ /** @deprecated */
/*     */ class QTCanvasHelper
/*     */ {
/*     */   private static final boolean debug = false;
/*     */   private QTCanvas canvas;
/*     */   transient Drawable mClient;
/*     */
/*     */   QTCanvasHelper(QTCanvas paramQTCanvas)
/*     */   {
/*  43 */     this.canvas = paramQTCanvas;
/*     */   }
/*     */
/*     */   void doRemoveClient()
/*     */   {
/*     */     try
/*     */     {
/*  56 */       if (this.mClient != null) {
/*  57 */         if (QTSession.isInitialized())
/*  58 */           doSetGWorld(false);
/*  59 */         this.mClient.removedFrom(this.canvas);
/*     */       }
/*     */     } catch (QTException localQTException) {
/*     */     }
/*     */     finally {
/*  64 */       this.mClient = null;
/*     */     }
/*     */   }
/*     */
/*     */   void doSetClient(Drawable paramDrawable, QDRect paramQDRect, Dimension paramDimension1, Dimension paramDimension2, boolean paramBoolean) throws QTException
/*     */   {
/*  70 */     if (paramDrawable == this.mClient) return;
/*     */
/*  72 */     if (this.mClient != null) {
/*  73 */       doRemoveClient();
/*     */     }
/*  75 */     if (paramDrawable != null) {
/*  76 */       this.mClient = paramDrawable;
/*  77 */       int i = this.canvas.currentWidth;
/*  78 */       int j = this.canvas.currentHeight;
/*  79 */       if (paramBoolean)
/*     */       {
/*  81 */         paramQDRect = paramQDRect != null ? paramQDRect : new QDRect(0, 0, this.canvas.getSize().width, this.canvas.getSize().height);
/*     */
/*  83 */         this.canvas.setInitialWidthAndHeight(paramQDRect, paramDimension1, paramDimension2);
/*  84 */         this.canvas.currentX = paramQDRect.getX();
/*  85 */         this.canvas.currentY = paramQDRect.getY();
/*  86 */         this.canvas.currentWidth = this.canvas.initialWidth;
/*  87 */         this.canvas.currentHeight = this.canvas.initialHeight;
/*     */
/*  89 */         this.canvas.doParentLayout();
/*  90 */         this.canvas.deferResize = true;
/*     */       }
/*     */       else {
/*  93 */         this.canvas.setInitialWidthAndHeight(paramQDRect, this.canvas.getMinimumSize(), this.canvas.getMaximumSize());
/*  94 */         doClientSetBounds();
/*     */       }
/*     */       try {
/*  97 */         doSetGWorld(this.canvas.isVisible());
/*  98 */         if (this.canvas.getPeer() != null) {
/*  99 */           this.mClient.addedTo(this.canvas);
/* 100 */           this.canvas.repaint();
/*     */         }
/* 102 */         if (this.canvas.isVisible())
/* 103 */           if ((!this.canvas.isWin) || (!paramBoolean) || ((i == this.canvas.currentWidth) && (j == this.canvas.currentHeight)))
/* 104 */             this.canvas.deferRedraw = true;
/*     */           else
/* 106 */             this.canvas.repaint();
/*     */       }
/*     */       catch (QTException localQTException) {
/* 109 */         this.mClient.removedFrom(this.canvas);
/* 110 */         throw localQTException;
/*     */       }
/*     */     }
/*     */   }
/*     */
/*     */   void doSetGWorld(boolean paramBoolean)
/*     */     throws QTException
/*     */   {
/* 118 */     if ((this.mClient instanceof QTDrawable)) {
/* 119 */       QTDrawable localQTDrawable = (QTDrawable)this.mClient;
/*     */       QDGraphics localQDGraphics1;
/* 121 */       if ((paramBoolean) && (this.canvas.getPeer() != null))
/* 122 */         localQDGraphics1 = this.canvas.getPort();
/*     */       else {
/* 124 */         localQDGraphics1 = QDGraphics.scratch;
/*     */       }
/* 126 */       QDGraphics localQDGraphics2 = localQTDrawable.getGWorld();
/* 127 */       if (!localQDGraphics1.equals(localQDGraphics2))
/*     */       {
/* 132 */         localQTDrawable.setGWorld(localQDGraphics1);
/* 133 */         if (paramBoolean) {
/* 134 */           QTUtils.checkFreeMemory();
/* 135 */           if (this.canvas.clientListener != null)
/* 136 */             this.canvas.clientListener.componentShown(new ComponentEvent(this.canvas, 102));
/*     */         }
/* 138 */         else if (this.canvas.clientListener != null) {
/* 139 */           this.canvas.clientListener.componentHidden(new ComponentEvent(this.canvas, 103));
/*     */         }
/*     */       }
/*     */     }
/*     */   }
/*     */
/*     */   boolean shouldRedrawQTPlayer(Rectangle paramRectangle)
/*     */   {
/* 158 */     if ((!this.canvas.isWin) && (((this.mClient instanceof QTPlayer)) || ((this.mClient instanceof GroupDrawable)) || ((this.mClient instanceof ImageDrawer))) && (this.canvas.isShowing()) &&
/* 159 */       (!paramRectangle.equals(this.canvas.getBounds()))) {
/* 160 */       return true;
/*     */     }
/*     */
/* 163 */     return false;
/*     */   }
/*     */
/*     */   void doClientSetBounds() throws QTException
/*     */   {
/* 168 */     Point localPoint = this.canvas.getNGLocation();
/*     */
/* 170 */     this.mClient.setDisplayBounds(new QDRect(localPoint.x, localPoint.y, this.canvas.currentWidth, this.canvas.currentHeight));
/*     */   }
/*     */
/*     */   static
/*     */   {
/*  34 */     if ((QTSession.isCurrentOS(4)) && (QTSession.getJavaVersion() >= 65540))
/*  35 */       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.display.QTCanvasHelper
* JD-Core Version:    0.6.2
*/
TOP

Related Classes of quicktime.app.display.QTCanvasHelper

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.