home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 October / PCO1097.ISO / FilesBBS / FREI / TOC42.EXE / RUNTIME / TOC.class (.txt) next >
Encoding:
Java Class File  |  1997-08-29  |  13.4 KB  |  1,026 lines

  1. import java.applet.Applet;
  2. import java.awt.BorderLayout;
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Container;
  6. import java.awt.Event;
  7. import java.awt.Font;
  8. import java.awt.FontMetrics;
  9. import java.awt.Graphics;
  10. import java.awt.Image;
  11. import java.awt.MediaTracker;
  12. import java.awt.image.ImageObserver;
  13. import java.net.MalformedURLException;
  14. import java.net.URL;
  15.  
  16. public final class TOC extends Applet implements Runnable, ImageObserver {
  17.    public String scriptFile;
  18.    public TOCScript script;
  19.    public TOCTreeItem TOCAnchor;
  20.    public TOCTreeItem itemSelected;
  21.    public TOCTreeItem helpItem;
  22.    public TOCScrollItem helpScroll;
  23.    public TOCTreeItem soundItem;
  24.    public boolean fSoundPlayed;
  25.    public int helpCounter;
  26.    public int soundCounter;
  27.    public int xOff;
  28.    public int yOff;
  29.    public int xIndent;
  30.    public String standardfont;
  31.    public int standardfontsize;
  32.    public Font standardF;
  33.    public FontMetrics standardFM;
  34.    public String helpfont;
  35.    public int helpfontsize;
  36.    public Font helpF;
  37.    public FontMetrics helpFM;
  38.    public Color bgC;
  39.    public Color bgCInfo;
  40.    public Color textC;
  41.    public Color textCInfo;
  42.    public Color reversC;
  43.    public Color lineC;
  44.    public Color plusC;
  45.    public Image imgBackground;
  46.    public Image imgBackgroundLoad;
  47.    public URL bgImage;
  48.    public Image imgSelection;
  49.    public Image imgSelectionLoad;
  50.    public URL selImage;
  51.    // $FF: renamed from: ├ò java.lang.Thread
  52.    private Thread field_0;
  53.    public boolean fRepaint;
  54.    // $FF: renamed from: ├╡ boolean
  55.    private boolean field_1;
  56.    public MediaTracker tracker;
  57.    public TOCScroller Scroller;
  58.    public TOCInfo Info;
  59.    public TOCFrame frame;
  60.    public boolean fVertScroll;
  61.    public boolean fHorzScroll;
  62.    public boolean fScriptToLoad = true;
  63.    public boolean fShowLoading = true;
  64.    // $FF: renamed from: ├╢ java.net.URL
  65.    private URL field_2;
  66.    // $FF: renamed from: ├╕ java.net.URL
  67.    private URL field_3;
  68.    public boolean asWindow;
  69.    // $FF: renamed from: ├╣ java.lang.String
  70.    private String field_4 = new String("Table of Contents");
  71.    public int windowX;
  72.    public int windowY;
  73.    public int windowWidth;
  74.    public int windowHeight;
  75.    // $FF: renamed from: ├║ boolean
  76.    private boolean field_5;
  77.    // $FF: renamed from: ├╗ int
  78.    private int field_6;
  79.    public boolean fLicense;
  80.    public boolean fInitDone;
  81.    // $FF: renamed from: ├╝ java.lang.String
  82.    private String field_7 = new String(" ┬ºa\"b$c%d&e/f(g)h=i?j,k.l-m_n:o;p#[0]123456789q~r+s*t\\u|v<w>x{y}z ");
  83.    public int infoHeight;
  84.    public TOCScrollRun ScrollRun;
  85.    // $FF: renamed from: ├╜ boolean
  86.    private boolean field_8;
  87.    public TOCScrollItem genericScroll;
  88.    public String genScrollFile;
  89.    public int iID = 10;
  90.    public int yInfoBase;
  91.    public boolean fUpdate;
  92.    public boolean fPaint;
  93.    public long lReload;
  94.    public long lStart;
  95.    public boolean fCompTOCScript;
  96.  
  97.    public void stop() {
  98.       if (this.field_0 != null) {
  99.          this.field_0.stop();
  100.          this.field_0 = null;
  101.          if (this.ScrollRun != null) {
  102.             this.ScrollRun.stop();
  103.             this.ScrollRun = null;
  104.          }
  105.       }
  106.  
  107.       if (this.frame != null) {
  108.          Event var1 = new Event(this.frame, 201, (Object)null);
  109.          this.frame.postEvent(var1);
  110.          this.frame = null;
  111.       }
  112.  
  113.       if (this.itemSelected != null) {
  114.          this.field_3 = this.itemSelected.url;
  115.       } else {
  116.          this.field_3 = null;
  117.       }
  118.    }
  119.  
  120.    // $FF: renamed from: ├╡ () void
  121.    private final void method_0() {
  122.       this.frame = new TOCFrame(this.field_4, this);
  123.       this.frame.show();
  124.       this.frame.move(this.windowX, this.windowY);
  125.       this.frame.resize(this.windowWidth, this.windowHeight);
  126.       if (this.infoHeight > 0) {
  127.          this.field_8 = true;
  128.       }
  129.  
  130.       this.fRepaint = true;
  131.    }
  132.  
  133.    public synchronized boolean mouseClicked(int var1, int var2, TOCTreeItem var3) {
  134.       if (this.Scroller.Canvas.fCalculating) {
  135.          return true;
  136.       } else {
  137.          for(boolean var4 = false; var3 != null; var3 = var3.next) {
  138.             if (var3.child != null && var2 >= var3.Symboly1 && var2 <= var3.Symboly2 && var1 >= var3.Symbolx1 && var1 <= var3.Symbolx2) {
  139.                boolean var5 = this.subitemSelected(var3.child);
  140.                if (var5) {
  141.                   this.selectItem(var3);
  142.                   if (var3.url != null) {
  143.                      if (var3.target.length() > 0) {
  144.                         ((Applet)this).getAppletContext().showDocument(var3.url, var3.target);
  145.                      } else {
  146.                         ((Applet)this).getAppletContext().showDocument(var3.url);
  147.                      }
  148.                   }
  149.                }
  150.  
  151.                var3.isExpanded = !var3.isExpanded;
  152.                return true;
  153.             }
  154.  
  155.             if (var2 >= var3.Texty1 && var2 <= var3.Texty2 && var1 >= var3.Textx1 && var1 <= var3.Textx2) {
  156.                this.selectItem(var3);
  157.                if (var3.url != null) {
  158.                   if (var3.target.length() > 0) {
  159.                      ((Applet)this).getAppletContext().showDocument(var3.url, var3.target);
  160.                   } else {
  161.                      ((Applet)this).getAppletContext().showDocument(var3.url);
  162.                   }
  163.                }
  164.  
  165.                return true;
  166.             }
  167.  
  168.             if (var3.child != null && var3.isExpanded) {
  169.                var4 = this.mouseClicked(var1, var2, var3.child);
  170.                if (var4) {
  171.                   return true;
  172.                }
  173.             }
  174.          }
  175.  
  176.          return false;
  177.       }
  178.    }
  179.  
  180.    public final void selectItem(TOCTreeItem var1) {
  181.       if (this.itemSelected != null) {
  182.          this.itemSelected.isSelected = false;
  183.       }
  184.  
  185.       var1.isSelected = true;
  186.       this.itemSelected = var1;
  187.       if (var1.isAutoExpand && var1.child != null) {
  188.          var1.isExpanded = true;
  189.       }
  190.  
  191.       for(TOCTreeItem var2 = var1.parent; var2 != null; var2 = var2.parent) {
  192.          var2.isExpanded = true;
  193.       }
  194.  
  195.       if (Math.min(var1.Texty1, var1.Symboly1) < 0 || Math.max(var1.Texty2, var1.Symboly2) > ((Component)this).size().height) {
  196.          while(this.Scroller.Canvas.fCalculating) {
  197.             this.wait(1);
  198.          }
  199.  
  200.          this.Scroller.Canvas.fCalculating = true;
  201.          this.Scroller.Canvas.paintTree((Graphics)null, this.TOCAnchor, 0, true);
  202.          this.Scroller.Canvas.fCalculating = false;
  203.          this.Scroller.hMax = this.Scroller.Canvas.yMax;
  204.       }
  205.  
  206.       int var3 = this.Scroller.hMax + this.yOff - this.Scroller.Canvas.size().height;
  207.       int var4 = Math.max(var1.Texty2, var1.Symboly2) - this.Scroller.Canvas.size().height + this.yOff;
  208.       if (Math.min(var1.Texty1, var1.Symboly1) < 0) {
  209.          this.Scroller.yScroll = Math.max(1, this.Scroller.yScroll + Math.min(var1.Texty1, var1.Symboly1) - this.yOff);
  210.          this.Scroller.yScroll = Math.min(this.Scroller.yScroll, var3);
  211.          this.fRepaint = true;
  212.       } else {
  213.          if (var4 > 0) {
  214.             TOCScroller var10000 = this.Scroller;
  215.             var10000.yScroll += var4;
  216.             this.Scroller.yScroll = Math.min(this.Scroller.yScroll, var3);
  217.             this.fRepaint = true;
  218.          }
  219.  
  220.       }
  221.    }
  222.  
  223.    public void selectItem(String var1, boolean var2) {
  224.       if (this.asWindow) {
  225.          this.wait(500);
  226.          if (this.frame != null) {
  227.             if (!this.frame.isVisible()) {
  228.                this.frame.show();
  229.             }
  230.          } else {
  231.             this.field_5 = true;
  232.          }
  233.       }
  234.  
  235.       TOCTreeItem var3 = this.TOCAnchor;
  236.  
  237.       while(var3 != null) {
  238.          if (var3.fct != 0) {
  239.             var3 = var3.nextLine;
  240.          } else {
  241.             if (var3.url != null) {
  242.                String var5 = var3.url.toExternalForm();
  243.                boolean var9 = true;
  244.  
  245.                while(var9) {
  246.                   int var7 = var5.indexOf("..");
  247.                   if (var7 != -1) {
  248.                      int var6 = var7 - 2;
  249.                      if (var6 >= 0) {
  250.                         for(char var8 = var5.charAt(var6); var8 != '/' && var8 != '\\' && var6 > 0; var8 = var5.charAt(var6)) {
  251.                            --var6;
  252.                         }
  253.  
  254.                         var5 = var5.substring(0, var6) + var5.substring(var7 + 2);
  255.                      } else {
  256.                         var9 = false;
  257.                      }
  258.                   } else {
  259.                      var9 = false;
  260.                   }
  261.                }
  262.  
  263.                var5 = var5.replace('\\', '/');
  264.                String var4 = var1.replace('\\', '/');
  265.                if (var5.startsWith(var4)) {
  266.                   if (var2 && var3.child != null) {
  267.                      var3.isExpanded = true;
  268.                   }
  269.  
  270.                   if (!var3.isSelected) {
  271.                      this.selectItem(var3);
  272.                   }
  273.                   break;
  274.                }
  275.             }
  276.  
  277.             var3 = var3.nextLine;
  278.          }
  279.       }
  280.  
  281.       this.fRepaint = true;
  282.    }
  283.  
  284.    // $FF: renamed from: ├╢ (java.lang.String, int) int
  285.    private final int method_1(String var1, int var2) {
  286.       int var4 = var2;
  287.       String var3;
  288.       if ((var3 = ((Applet)this).getParameter(var1)) != null) {
  289.          var3 = var3.trim();
  290.  
  291.          try {
  292.             var4 = Integer.valueOf(var3);
  293.          } catch (NumberFormatException var5) {
  294.             var4 = var2;
  295.          }
  296.       }
  297.  
  298.       return var4;
  299.    }
  300.  
  301.    public synchronized boolean mouseMoved(int var1, int var2, TOCTreeItem var3) {
  302.       if (this.Scroller.Canvas.fCalculating) {
  303.          return true;
  304.       } else {
  305.          boolean var4 = false;
  306.  
  307.          TOCTreeItem var5;
  308.          for(var5 = var3; var3 != null; var3 = var3.next) {
  309.             if (var2 >= var3.Texty1 && var2 <= var3.Texty2 && var1 >= var3.Textx1 && var1 <= var3.Textx2) {
  310.                if (var3.helpText.length() > 0) {
  311.                   this.helpItem = var3;
  312.                } else {
  313.                   this.helpItem = null;
  314.                }
  315.  
  316.                if (var3.soundClip != null) {
  317.                   this.soundItem = var3;
  318.                } else {
  319.                   this.soundItem = null;
  320.                }
  321.  
  322.                if (var3.url != null) {
  323.                   ((Applet)this).getAppletContext().showStatus(var3.url.toExternalForm());
  324.                }
  325.  
  326.                var4 = true;
  327.                break;
  328.             }
  329.  
  330.             if (var3.child != null && var3.isExpanded) {
  331.                var4 = this.mouseMoved(var1, var2, var3.child);
  332.                if (var4) {
  333.                   break;
  334.                }
  335.             }
  336.          }
  337.  
  338.          if (var5 == this.TOCAnchor && !var4) {
  339.             this.helpItem = null;
  340.             this.soundItem = null;
  341.             ((Applet)this).getAppletContext().showStatus("");
  342.          }
  343.  
  344.          return var4;
  345.       }
  346.    }
  347.  
  348.    // $FF: renamed from: ├╕ (java.lang.String) java.awt.Color
  349.    private final Color method_2(String var1) {
  350.       Color var2 = null;
  351.       String var3;
  352.       if ((var3 = ((Applet)this).getParameter(var1)) != null) {
  353.          var2 = this.ColorFromRGB(var3.trim());
  354.       }
  355.  
  356.       return var2;
  357.    }
  358.  
  359.    public void paint(Graphics var1) {
  360.       int var2 = 200;
  361.       if (this.asWindow) {
  362.          if (this.frame != null) {
  363.             this.frame.fUpdate = true;
  364.             this.frame.repaint();
  365.  
  366.             while(this.frame.fUpdate) {
  367.                --var2;
  368.                if (var2 <= 0) {
  369.                   break;
  370.                }
  371.  
  372.                this.wait(1);
  373.             }
  374.  
  375.             this.frame.fUpdate = false;
  376.          }
  377.       } else {
  378.          this.Scroller.fUpdate = true;
  379.          this.Scroller.repaint();
  380.  
  381.          while(this.Scroller.fUpdate) {
  382.             --var2;
  383.             if (var2 <= 0) {
  384.                break;
  385.             }
  386.  
  387.             this.wait(1);
  388.          }
  389.  
  390.          this.Scroller.fUpdate = false;
  391.       }
  392.  
  393.       this.fPaint = false;
  394.    }
  395.  
  396.    public final void wait(int var1) {
  397.       try {
  398.          Thread.sleep((long)var1);
  399.       } catch (InterruptedException var2) {
  400.       }
  401.    }
  402.  
  403.    public final Color ColorFromRGB(String var1) {
  404.       Object var2 = null;
  405.  
  406.       try {
  407.          int var4 = Integer.valueOf(var1.substring(0, var1.indexOf(",")));
  408.          if (var4 < 0) {
  409.             var4 = 0;
  410.          }
  411.  
  412.          if (var4 > 255) {
  413.             var4 = 255;
  414.          }
  415.  
  416.          String var3 = var1.substring(var1.indexOf(",") + 1);
  417.          int var5 = Integer.valueOf(var3.substring(0, var3.indexOf(",")));
  418.          if (var5 < 0) {
  419.             var5 = 0;
  420.          }
  421.  
  422.          if (var5 > 255) {
  423.             var5 = 255;
  424.          }
  425.  
  426.          var3 = var3.substring(var3.indexOf(",") + 1);
  427.          int var6 = Integer.valueOf(var3);
  428.          if (var6 < 0) {
  429.             var6 = 0;
  430.          }
  431.  
  432.          if (var6 > 255) {
  433.             var6 = 255;
  434.          }
  435.  
  436.          var8 = new Color(var4, var5, var6);
  437.       } catch (NumberFormatException var7) {
  438.          var8 = null;
  439.       }
  440.  
  441.       return var8;
  442.    }
  443.  
  444.    public final Image TOCCreateImage(int var1, int var2) {
  445.       Object var3 = null;
  446.       Image var5 = ((Component)this).createImage(var1, var2);
  447.       boolean var4 = ((Component)this).prepareImage(var5, this);
  448.       if (!var4) {
  449.          while((((Component)this).checkImage(var5, this) & 224) == 0) {
  450.             this.wait(1);
  451.          }
  452.       }
  453.  
  454.       return var5;
  455.    }
  456.  
  457.    public void update(Graphics var1) {
  458.       if (!this.fScriptToLoad) {
  459.          this.Scroller.setScrollbars();
  460.       }
  461.  
  462.       int var2 = 200;
  463.       this.fPaint = true;
  464.       this.paint(var1);
  465.  
  466.       while(this.fPaint) {
  467.          --var2;
  468.          if (var2 <= 0) {
  469.             break;
  470.          }
  471.  
  472.          this.wait(1);
  473.       }
  474.  
  475.       this.fPaint = false;
  476.       ((Component)this).getToolkit().sync();
  477.       this.fUpdate = false;
  478.    }
  479.  
  480.    public final boolean subitemSelected(TOCTreeItem var1) {
  481.       boolean var2;
  482.       for(var2 = false; var1 != null; var1 = var1.next) {
  483.          if (var1.isSelected) {
  484.             var2 = true;
  485.             break;
  486.          }
  487.  
  488.          if (var1.child != null) {
  489.             var2 = this.subitemSelected(var1.child);
  490.          }
  491.  
  492.          if (var2) {
  493.             break;
  494.          }
  495.       }
  496.  
  497.       return var2;
  498.    }
  499.  
  500.    public final void TOCDrawImage(Graphics var1, Image var2, int var3, int var4, ImageObserver var5) {
  501.       if (var1 != null && var2 != null) {
  502.          var1.drawImage(var2, var3, var4, var5);
  503.       }
  504.    }
  505.  
  506.    public final void getInfo() {
  507.       if (this.genScrollFile != null) {
  508.          TOCTreeItem var1 = new TOCTreeItem();
  509.          TOCScrollScript var2 = new TOCScrollScript(((Applet)this).getDocumentBase(), this.genScrollFile, this, var1, true);
  510.          var2.start();
  511.  
  512.          while(!var2.fDone) {
  513.             this.wait(500);
  514.          }
  515.  
  516.          this.genericScroll = var1.scroll;
  517.       }
  518.  
  519.       if (this.script == null) {
  520.          this.script = new TOCScript(((Applet)this).getDocumentBase(), this.scriptFile, this);
  521.          if (this.script.ok == -1) {
  522.             this.stop();
  523.          }
  524.  
  525.          this.TOCAnchor = this.script.start;
  526.          TOCTreeItem var3 = this.TOCAnchor;
  527.  
  528.          while(var3 != null) {
  529.             if (var3.fct != 0) {
  530.                var3 = var3.nextLine;
  531.             } else {
  532.                if (var3.imageName != null) {
  533.                   var3.imageLoad = ((Applet)this).getImage(((Applet)this).getDocumentBase(), var3.imageName);
  534.                   this.tracker.addImage(var3.imageLoad, var3.id);
  535.                }
  536.  
  537.                if (var3.imageOpenName != null) {
  538.                   var3.imageOpenLoad = ((Applet)this).getImage(((Applet)this).getDocumentBase(), var3.imageOpenName);
  539.                   this.tracker.addImage(var3.imageOpenLoad, var3.id + 1);
  540.                }
  541.  
  542.                if (var3.sound != null) {
  543.                   var3.soundClip = ((Applet)this).getAudioClip(((Applet)this).getDocumentBase(), var3.sound);
  544.                }
  545.  
  546.                if (var3.isSelected) {
  547.                   this.itemSelected = var3;
  548.                }
  549.  
  550.                var3 = var3.nextLine;
  551.             }
  552.          }
  553.       }
  554.  
  555.       if (this.asWindow && this.frame != null && this.script.menuStart != null) {
  556.          this.frame.createMenu();
  557.          this.fRepaint = true;
  558.       }
  559.  
  560.       if (!this.fShowLoading && this.field_3 != null) {
  561.          this.selectItem(this.field_3.toExternalForm(), false);
  562.       }
  563.  
  564.       this.fScriptToLoad = false;
  565.    }
  566.  
  567.    public void start() {
  568.       this.helpItem = null;
  569.       this.helpScroll = null;
  570.       this.soundItem = null;
  571.       this.fSoundPlayed = false;
  572.       if (this.asWindow) {
  573.          if (this.frame == null) {
  574.             this.field_5 = true;
  575.          } else {
  576.             this.frame.show();
  577.             this.frame.move(this.windowX, this.windowY);
  578.             this.frame.resize(this.windowWidth, this.windowHeight);
  579.          }
  580.       }
  581.  
  582.       if (this.field_2 == null || ((Applet)this).getDocumentBase().toExternalForm() != this.field_2.toExternalForm()) {
  583.          if (this.field_2 != null) {
  584.             this.fShowLoading = false;
  585.          }
  586.  
  587.          this.field_2 = ((Applet)this).getDocumentBase();
  588.       }
  589.  
  590.       if (this.field_0 == null) {
  591.          this.field_0 = new Thread(this);
  592.          this.field_0.start();
  593.          if (this.infoHeight > 0) {
  594.             this.ScrollRun = new TOCScrollRun(this);
  595.             this.ScrollRun.start();
  596.          }
  597.       }
  598.  
  599.       this.fRepaint = true;
  600.    }
  601.  
  602.    public String getAppletInfo() {
  603.       return "TOC.java, 4.2, (c) by Stefan Ruettinger";
  604.    }
  605.  
  606.    public final URL getURL(String var1) {
  607.       URL var2 = null;
  608.       boolean var3 = true;
  609.  
  610.       try {
  611.          var2 = new URL(var1);
  612.       } catch (MalformedURLException var5) {
  613.          var3 = false;
  614.       }
  615.  
  616.       if (!var3) {
  617.          try {
  618.             var2 = new URL(((Applet)this).getDocumentBase(), var1);
  619.          } catch (MalformedURLException var4) {
  620.             var2 = null;
  621.          }
  622.       }
  623.  
  624.       return var2;
  625.    }
  626.  
  627.    // $FF: renamed from: ├╣ () int
  628.    private int method_3() {
  629.       if ((this.scriptFile = ((Applet)this).getParameter("script")) == null) {
  630.          return -1;
  631.       } else {
  632.          String var1;
  633.          if ((var1 = ((Applet)this).getParameter("standardfont")) != null) {
  634.             var1 = var1.trim();
  635.             this.standardfont = var1.substring(0, var1.indexOf(","));
  636.             var1 = var1.substring(var1.indexOf(",") + 1);
  637.  
  638.             try {
  639.                this.standardfontsize = new Integer(var1);
  640.             } catch (NumberFormatException var8) {
  641.                this.standardfontsize = 14;
  642.             }
  643.          } else {
  644.             this.standardfont = new String("TimesRoman");
  645.             this.standardfontsize = 14;
  646.          }
  647.  
  648.          if ((var1 = ((Applet)this).getParameter("helpfont")) != null) {
  649.             var1 = var1.trim();
  650.             this.helpfont = var1.substring(0, var1.indexOf(","));
  651.             var1 = var1.substring(var1.indexOf(",") + 1);
  652.  
  653.             try {
  654.                this.helpfontsize = new Integer(var1);
  655.             } catch (NumberFormatException var7) {
  656.                this.helpfontsize = 10;
  657.             }
  658.          } else {
  659.             this.helpfont = new String("TimesRoman");
  660.             this.helpfontsize = 10;
  661.          }
  662.  
  663.          this.xIndent = this.method_1("xindent", 12);
  664.          this.xOff = this.method_1("xoffset", 5);
  665.          this.yOff = this.method_1("yoffset", 5) + 2;
  666.          this.fVertScroll = true;
  667.          if ((var1 = ((Applet)this).getParameter("vscroll")) != null) {
  668.             var1 = var1.trim();
  669.             if (var1.equals("NO")) {
  670.                this.fVertScroll = false;
  671.             }
  672.          }
  673.  
  674.          this.fHorzScroll = true;
  675.          if ((var1 = ((Applet)this).getParameter("hscroll")) != null) {
  676.             var1 = var1.trim();
  677.             if (var1.equals("NO")) {
  678.                this.fHorzScroll = false;
  679.             }
  680.          }
  681.  
  682.          this.textC = this.method_2("textcolor");
  683.          if (this.textC == null) {
  684.             this.textC = Color.black;
  685.          }
  686.  
  687.          this.reversC = this.method_2("reverstextcolor");
  688.          if (this.reversC == null) {
  689.             this.reversC = Color.white;
  690.          }
  691.  
  692.          this.lineC = this.method_2("linecolor");
  693.          if (this.lineC == null) {
  694.             this.lineC = Color.black;
  695.          }
  696.  
  697.          this.plusC = this.method_2("pluscolor");
  698.          if (this.plusC == null) {
  699.             this.plusC = this.lineC;
  700.          }
  701.  
  702.          this.bgC = this.method_2("backgroundcolor");
  703.          if (this.bgC == null) {
  704.             this.bgC = new Color(192, 192, 192);
  705.          }
  706.  
  707.          if ((var1 = ((Applet)this).getParameter("background")) != null) {
  708.             boolean var2 = true;
  709.  
  710.             try {
  711.                this.bgImage = new URL(var1);
  712.             } catch (MalformedURLException var6) {
  713.                var2 = false;
  714.             }
  715.  
  716.             if (!var2) {
  717.                try {
  718.                   this.bgImage = new URL(((Applet)this).getDocumentBase(), var1);
  719.                } catch (MalformedURLException var5) {
  720.                   this.bgImage = null;
  721.                }
  722.             }
  723.          }
  724.  
  725.          if ((var1 = ((Applet)this).getParameter("selectimage")) != null) {
  726.             boolean var25 = true;
  727.  
  728.             try {
  729.                this.selImage = new URL(var1);
  730.             } catch (MalformedURLException var4) {
  731.                var25 = false;
  732.             }
  733.  
  734.             if (!var25) {
  735.                try {
  736.                   this.selImage = new URL(((Applet)this).getDocumentBase(), var1);
  737.                } catch (MalformedURLException var3) {
  738.                   this.selImage = null;
  739.                }
  740.             }
  741.          }
  742.  
  743.          if ((var1 = ((Applet)this).getParameter("aswindow")) != null) {
  744.             var1 = var1.trim();
  745.             if (var1.equals("YES")) {
  746.                this.asWindow = true;
  747.             }
  748.          }
  749.  
  750.          if ((var1 = ((Applet)this).getParameter("windowtitle")) != null) {
  751.             this.field_4 = var1;
  752.          }
  753.  
  754.          this.windowX = this.method_1("windowx", 10);
  755.          this.windowY = this.method_1("windowy", 10);
  756.          this.windowWidth = this.method_1("windowwidth", 200);
  757.          this.windowHeight = this.method_1("windowheight", 400);
  758.          this.infoHeight = this.method_1("infoheight", 0);
  759.          this.bgCInfo = this.method_2("infobackgroundcolor");
  760.          if (this.bgCInfo == null) {
  761.             this.bgCInfo = new Color(192, 192, 192);
  762.          }
  763.  
  764.          this.textCInfo = this.method_2("infotextcolor");
  765.          if (this.textCInfo == null) {
  766.             this.textCInfo = Color.black;
  767.          }
  768.  
  769.          this.genScrollFile = ((Applet)this).getParameter("infoscript");
  770.          this.lReload = (long)this.method_1("inforeload", -1);
  771.          if (this.lReload > 0L) {
  772.             this.lReload *= 100L;
  773.          }
  774.  
  775.          if ((var1 = ((Applet)this).getParameter("compressedscript")) != null) {
  776.             var1 = var1.trim();
  777.             if (var1.equals("YES")) {
  778.                this.fCompTOCScript = true;
  779.             }
  780.          }
  781.  
  782.          return 0;
  783.       }
  784.    }
  785.  
  786.    public void run() {
  787.       while(this.field_0 != null) {
  788.          if (this.field_5) {
  789.             if (this.frame == null) {
  790.                this.method_0();
  791.             }
  792.  
  793.             this.field_5 = false;
  794.          }
  795.  
  796.          if (this.fScriptToLoad) {
  797.             ((Component)this).repaint();
  798.             this.getInfo();
  799.             this.Scroller.checkScrollbars();
  800.          } else {
  801.             if (!this.field_1) {
  802.                boolean var2 = false;
  803.                if (this.imgBackgroundLoad != null) {
  804.                   boolean var3 = this.tracker.checkID(0, true);
  805.                   if (var3) {
  806.                      if (!this.tracker.isErrorID(0)) {
  807.                         this.imgBackground = this.imgBackgroundLoad;
  808.                         this.fRepaint = true;
  809.                      }
  810.  
  811.                      this.imgBackgroundLoad = null;
  812.                   } else {
  813.                      var2 = true;
  814.                   }
  815.                }
  816.  
  817.                if (this.imgSelectionLoad != null) {
  818.                   boolean var4 = this.tracker.checkID(1, true);
  819.                   if (var4) {
  820.                      if (!this.tracker.isErrorID(1)) {
  821.                         this.imgSelection = this.imgSelectionLoad;
  822.                         this.fRepaint = true;
  823.                      }
  824.  
  825.                      this.imgSelectionLoad = null;
  826.                   } else {
  827.                      var2 = true;
  828.                   }
  829.                }
  830.  
  831.                TOCTreeItem var1 = this.TOCAnchor;
  832.  
  833.                while(var1 != null) {
  834.                   if (var1.fct != 0) {
  835.                      var1 = var1.nextLine;
  836.                   } else {
  837.                      if (var1.imageName != null && var1.imageLoad != null) {
  838.                         boolean var5 = this.tracker.checkID(var1.id, true);
  839.                         if (var5) {
  840.                            if (!this.tracker.isErrorID(var1.id)) {
  841.                               var1.image = var1.imageLoad;
  842.                               var1.imgWidth = var1.image.getWidth(this);
  843.                               var1.imgHeight = var1.image.getHeight(this);
  844.                               this.fRepaint = true;
  845.                            } else {
  846.                               var1.imageLoad = null;
  847.                            }
  848.                         } else {
  849.                            var2 = true;
  850.                         }
  851.                      }
  852.  
  853.                      if (var1.imageOpenName != null && var1.imageOpenLoad != null) {
  854.                         boolean var6 = this.tracker.checkID(var1.id + 1, true);
  855.                         if (var6) {
  856.                            if (!this.tracker.isErrorID(var1.id + 1)) {
  857.                               var1.imageOpen = var1.imageOpenLoad;
  858.                               var1.imgOpenWidth = var1.imageOpen.getWidth(this);
  859.                               var1.imgOpenHeight = var1.imageOpen.getHeight(this);
  860.                               this.fRepaint = true;
  861.                            }
  862.  
  863.                            var1.imageOpenLoad = null;
  864.                         } else {
  865.                            var2 = true;
  866.                         }
  867.                      }
  868.  
  869.                      var1 = var1.nextLine;
  870.                   }
  871.                }
  872.  
  873.                if (!var2) {
  874.                   this.field_1 = true;
  875.                }
  876.             }
  877.  
  878.             if (this.helpCounter == 3) {
  879.                this.fRepaint = true;
  880.             }
  881.  
  882.             if (this.helpCounter < 4) {
  883.                ++this.helpCounter;
  884.             }
  885.  
  886.             if (this.soundCounter < 4) {
  887.                ++this.soundCounter;
  888.             }
  889.  
  890.             if (this.soundItem != null && !this.fSoundPlayed && this.soundCounter == 3) {
  891.                this.fSoundPlayed = true;
  892.                this.soundItem.soundClip.play();
  893.             }
  894.  
  895.             if (this.Scroller.tAbsEvt != 0L && System.currentTimeMillis() - this.Scroller.tAbsEvt > 100L) {
  896.                this.fRepaint = true;
  897.                this.Scroller.tAbsEvt = 0L;
  898.             }
  899.  
  900.             if (this.fRepaint) {
  901.                this.Scroller.checkScrollbars();
  902.                if (this.infoHeight > 0) {
  903.                   this.Info.repaint();
  904.                   if (this.field_8) {
  905.                      this.frame.add("South", this.Info);
  906.                      this.frame.validate();
  907.                      this.field_8 = false;
  908.                   }
  909.                }
  910.  
  911.                this.fRepaint = false;
  912.             }
  913.  
  914.             this.wait(200);
  915.             ++this.field_6;
  916.             if (this.field_6 > 300) {
  917.                System.gc();
  918.                this.field_6 = 0;
  919.             }
  920.          }
  921.       }
  922.  
  923.    }
  924.  
  925.    public void init() {
  926.       super.init();
  927.       if (!this.fLicense) {
  928.          URL var1 = ((Applet)this).getCodeBase();
  929.          if (!var1.getProtocol().equals("file")) {
  930.             int var2 = TOCLicense.id;
  931.             String var4 = TOCLicense.domain;
  932.             String var5 = new String();
  933.             if (var4.length() < 6) {
  934.                return;
  935.             }
  936.  
  937.             if (!var4.substring(0, 1).equals("1")) {
  938.                return;
  939.             }
  940.  
  941.             String var6 = Integer.toString(var2);
  942.             int var8 = 1;
  943.  
  944.             for(int var3 = 0; var3 < var6.length(); ++var3) {
  945.                var8 += Integer.valueOf(var6.substring(var3, var3 + 1));
  946.             }
  947.  
  948.             String var7 = "000" + Integer.toString(var8);
  949.             var7 = var7.substring(var7.length() - 3);
  950.             if (var4.substring(1, 4).equals(var7)) {
  951.                for(int var13 = 4; var13 < var4.length(); var13 += 2) {
  952.                   String var9 = var4.substring(var13, var13 + 2);
  953.                   int var10 = Integer.valueOf(var9);
  954.                   int var11 = (var2 + var13) / 30;
  955.                   int var12 = var10 - (var2 + var13) + var11 * 30;
  956.                   var5 = var5 + this.field_7.substring(var12, var12 + 1);
  957.                }
  958.  
  959.                String var16 = var1.getHost().toLowerCase();
  960.                int var17 = 1;
  961.  
  962.                for(int var14 = 0; var14 < var16.length(); ++var14) {
  963.                   var17 += this.field_7.indexOf(var16.substring(var14, var14 + 1));
  964.                }
  965.  
  966.                String var18 = var16 + var1.getFile().toLowerCase();
  967.                int var19 = var18.indexOf(var5);
  968.                if (var19 != -1 && var5.length() > 4) {
  969.                   if (var19 == 0) {
  970.                      if (var17 == var2) {
  971.                         this.fLicense = true;
  972.                      }
  973.                   } else {
  974.                      this.fLicense = true;
  975.                   }
  976.                }
  977.             }
  978.          } else {
  979.             this.fLicense = true;
  980.          }
  981.       }
  982.  
  983.       if (this.tracker == null) {
  984.          this.tracker = new MediaTracker(this);
  985.       }
  986.  
  987.       if (this.method_3() == -1) {
  988.          this.stop();
  989.       }
  990.  
  991.       if (this.bgImage != null) {
  992.          this.imgBackgroundLoad = ((Applet)this).getImage(this.bgImage);
  993.          this.tracker.addImage(this.imgBackgroundLoad, 0);
  994.       }
  995.  
  996.       if (this.selImage != null) {
  997.          this.imgSelectionLoad = ((Applet)this).getImage(this.selImage);
  998.          this.tracker.addImage(this.imgSelectionLoad, 1);
  999.       }
  1000.  
  1001.       this.standardF = new Font(this.standardfont, 0, this.standardfontsize);
  1002.       this.standardFM = ((Component)this).getFontMetrics(this.standardF);
  1003.       this.helpF = new Font(this.helpfont, 0, this.helpfontsize);
  1004.       this.helpFM = ((Component)this).getFontMetrics(this.helpF);
  1005.       this.field_6 = 0;
  1006.       this.yInfoBase = this.infoHeight - this.standardFM.getMaxDescent();
  1007.       this.Scroller = new TOCScroller(this);
  1008.       if (this.infoHeight > 0) {
  1009.          this.Info = new TOCInfo(this);
  1010.          this.Info.resize(((Component)this).size().width, this.infoHeight);
  1011.       }
  1012.  
  1013.       if (this.asWindow) {
  1014.          this.field_5 = true;
  1015.       } else {
  1016.          ((Container)this).setLayout(new BorderLayout());
  1017.          ((Container)this).add("Center", this.Scroller);
  1018.          if (this.infoHeight > 0) {
  1019.             ((Container)this).add("South", this.Info);
  1020.          }
  1021.       }
  1022.  
  1023.       this.fInitDone = true;
  1024.    }
  1025. }
  1026.