home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 October / PCO1097.ISO / FilesBBS / FREI / TOC42.EXE / TOC.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-08-29  |  16.1 KB  |  1,040 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.             System.out.println("Bad value '" + var3 + "'. Setting value to default=" + var2 + ".");
  295.             var4 = var2;
  296.          }
  297.       }
  298.  
  299.       return var4;
  300.    }
  301.  
  302.    public synchronized boolean mouseMoved(int var1, int var2, TOCTreeItem var3) {
  303.       if (this.Scroller.Canvas.fCalculating) {
  304.          return true;
  305.       } else {
  306.          boolean var4 = false;
  307.  
  308.          TOCTreeItem var5;
  309.          for(var5 = var3; var3 != null; var3 = var3.next) {
  310.             if (var2 >= var3.Texty1 && var2 <= var3.Texty2 && var1 >= var3.Textx1 && var1 <= var3.Textx2) {
  311.                if (var3.helpText.length() > 0) {
  312.                   this.helpItem = var3;
  313.                } else {
  314.                   this.helpItem = null;
  315.                }
  316.  
  317.                if (var3.soundClip != null) {
  318.                   this.soundItem = var3;
  319.                } else {
  320.                   this.soundItem = null;
  321.                }
  322.  
  323.                if (var3.url != null) {
  324.                   ((Applet)this).getAppletContext().showStatus(var3.url.toExternalForm());
  325.                }
  326.  
  327.                var4 = true;
  328.                break;
  329.             }
  330.  
  331.             if (var3.child != null && var3.isExpanded) {
  332.                var4 = this.mouseMoved(var1, var2, var3.child);
  333.                if (var4) {
  334.                   break;
  335.                }
  336.             }
  337.          }
  338.  
  339.          if (var5 == this.TOCAnchor && !var4) {
  340.             this.helpItem = null;
  341.             this.soundItem = null;
  342.             ((Applet)this).getAppletContext().showStatus("");
  343.          }
  344.  
  345.          return var4;
  346.       }
  347.    }
  348.  
  349.    // $FF: renamed from: ├¼ (java.lang.String) java.awt.Color
  350.    private final Color method_2(String var1) {
  351.       Color var2 = null;
  352.       String var3;
  353.       if ((var3 = ((Applet)this).getParameter(var1)) != null) {
  354.          var2 = this.ColorFromRGB(var3.trim());
  355.       }
  356.  
  357.       return var2;
  358.    }
  359.  
  360.    public void paint(Graphics var1) {
  361.       int var2 = 200;
  362.       if (this.asWindow) {
  363.          if (this.frame != null) {
  364.             this.frame.fUpdate = true;
  365.             this.frame.repaint();
  366.  
  367.             while(this.frame.fUpdate) {
  368.                --var2;
  369.                if (var2 <= 0) {
  370.                   break;
  371.                }
  372.  
  373.                this.wait(1);
  374.             }
  375.  
  376.             this.frame.fUpdate = false;
  377.          }
  378.       } else {
  379.          this.Scroller.fUpdate = true;
  380.          this.Scroller.repaint();
  381.  
  382.          while(this.Scroller.fUpdate) {
  383.             --var2;
  384.             if (var2 <= 0) {
  385.                break;
  386.             }
  387.  
  388.             this.wait(1);
  389.          }
  390.  
  391.          this.Scroller.fUpdate = false;
  392.       }
  393.  
  394.       this.fPaint = false;
  395.    }
  396.  
  397.    public String[][] getParameterInfo() {
  398.       String[][] var1 = new String[][]{{"script", "String", "name of script file                    (mandatory)"}, {"standardfont", "String,int", "name and size of standard font         (optional, 'TimesRoman,14')"}, {"helpfont", "String,int", "name and size of help font             (optional, 'TimesRoman,10')"}, {"textcolor", "int[3]", "default RGB color of text              (optional, '0,0,0')"}, {"reverstextcolor", "int[3]", "revers RGB color of text               (optional, '255,255,255')"}, {"linecolor", "int[3]", "RGB color of the lines                 (optional, '0,0,0')"}, {"backgroundcolor", "int[3]", "RGB color of background (if no image)  (optional, '192,192,192')"}, {"xindent", "int", "indent for each level of the tree      (optional, '10')"}, {"xoffset", "int", "x-offset of the TOC                    (optional, '5')"}, {"yoffset", "int", "y-offset of the TOC                    (optional, '5')"}, {"background", "String", "URL of the background image            (optional, '')"}, {"hscroll", "String", "horizontal scrollbar                   (optional, 'YES')"}, {"vscroll", "String", "vertical   scrollbar                   (optional, 'YES')"}, {"aswindow", "String", "running in seperate window             (optional, 'NO')"}, {"compressedscript", "String", "used compressed script file            (optional, 'NO')"}, {"windowtitle", "String", "title text of seperate window          (optional, 'Table of Contents')"}, {"windowx", "int", "x position of seperate window          (optional, '10')"}, {"windowy", "int", "y position of seperate window          (optional, '10')"}, {"windowwidth", "int", "width  of seperate window              (optional, '200')"}, {"windowheight", "int", "height of seperate window              (optional, '400')"}};
  399.       return var1;
  400.    }
  401.  
  402.    public final void wait(int var1) {
  403.       try {
  404.          Thread.sleep((long)var1);
  405.       } catch (InterruptedException var2) {
  406.       }
  407.    }
  408.  
  409.    public final Color ColorFromRGB(String var1) {
  410.       Object var2 = null;
  411.  
  412.       try {
  413.          int var4 = Integer.valueOf(var1.substring(0, var1.indexOf(",")));
  414.          if (var4 < 0) {
  415.             var4 = 0;
  416.          }
  417.  
  418.          if (var4 > 255) {
  419.             var4 = 255;
  420.          }
  421.  
  422.          String var3 = var1.substring(var1.indexOf(",") + 1);
  423.          int var5 = Integer.valueOf(var3.substring(0, var3.indexOf(",")));
  424.          if (var5 < 0) {
  425.             var5 = 0;
  426.          }
  427.  
  428.          if (var5 > 255) {
  429.             var5 = 255;
  430.          }
  431.  
  432.          var3 = var3.substring(var3.indexOf(",") + 1);
  433.          int var6 = Integer.valueOf(var3);
  434.          if (var6 < 0) {
  435.             var6 = 0;
  436.          }
  437.  
  438.          if (var6 > 255) {
  439.             var6 = 255;
  440.          }
  441.  
  442.          var8 = new Color(var4, var5, var6);
  443.       } catch (NumberFormatException var7) {
  444.          System.out.println("Bad color value '" + var1 + "'.");
  445.          var8 = null;
  446.       }
  447.  
  448.       return var8;
  449.    }
  450.  
  451.    public final Image TOCCreateImage(int var1, int var2) {
  452.       Object var3 = null;
  453.       Image var5 = ((Component)this).createImage(var1, var2);
  454.       boolean var4 = ((Component)this).prepareImage(var5, this);
  455.       if (!var4) {
  456.          while((((Component)this).checkImage(var5, this) & 224) == 0) {
  457.             this.wait(1);
  458.          }
  459.       }
  460.  
  461.       return var5;
  462.    }
  463.  
  464.    public void update(Graphics var1) {
  465.       if (!this.fScriptToLoad) {
  466.          this.Scroller.setScrollbars();
  467.       }
  468.  
  469.       int var2 = 200;
  470.       this.fPaint = true;
  471.       this.paint(var1);
  472.  
  473.       while(this.fPaint) {
  474.          --var2;
  475.          if (var2 <= 0) {
  476.             break;
  477.          }
  478.  
  479.          this.wait(1);
  480.       }
  481.  
  482.       this.fPaint = false;
  483.       ((Component)this).getToolkit().sync();
  484.       this.fUpdate = false;
  485.    }
  486.  
  487.    public final boolean subitemSelected(TOCTreeItem var1) {
  488.       boolean var2;
  489.       for(var2 = false; var1 != null; var1 = var1.next) {
  490.          if (var1.isSelected) {
  491.             var2 = true;
  492.             break;
  493.          }
  494.  
  495.          if (var1.child != null) {
  496.             var2 = this.subitemSelected(var1.child);
  497.          }
  498.  
  499.          if (var2) {
  500.             break;
  501.          }
  502.       }
  503.  
  504.       return var2;
  505.    }
  506.  
  507.    public final void TOCDrawImage(Graphics var1, Image var2, int var3, int var4, ImageObserver var5) {
  508.       if (var1 != null && var2 != null) {
  509.          var1.drawImage(var2, var3, var4, var5);
  510.       }
  511.    }
  512.  
  513.    public final void getInfo() {
  514.       if (this.genScrollFile != null) {
  515.          TOCTreeItem var1 = new TOCTreeItem();
  516.          TOCScrollScript var2 = new TOCScrollScript(((Applet)this).getDocumentBase(), this.genScrollFile, this, var1, true);
  517.          var2.start();
  518.  
  519.          while(!var2.fDone) {
  520.             this.wait(500);
  521.          }
  522.  
  523.          this.genericScroll = var1.scroll;
  524.       }
  525.  
  526.       if (this.script == null) {
  527.          this.script = new TOCScript(((Applet)this).getDocumentBase(), this.scriptFile, this);
  528.          if (this.script.ok == -1) {
  529.             System.out.println("Script file not found or error in script file.");
  530.             this.stop();
  531.          }
  532.  
  533.          this.TOCAnchor = this.script.start;
  534.          TOCTreeItem var3 = this.TOCAnchor;
  535.  
  536.          while(var3 != null) {
  537.             if (var3.fct != 0) {
  538.                var3 = var3.nextLine;
  539.             } else {
  540.                if (var3.imageName != null) {
  541.                   var3.imageLoad = ((Applet)this).getImage(((Applet)this).getDocumentBase(), var3.imageName);
  542.                   this.tracker.addImage(var3.imageLoad, var3.id);
  543.                }
  544.  
  545.                if (var3.imageOpenName != null) {
  546.                   var3.imageOpenLoad = ((Applet)this).getImage(((Applet)this).getDocumentBase(), var3.imageOpenName);
  547.                   this.tracker.addImage(var3.imageOpenLoad, var3.id + 1);
  548.                }
  549.  
  550.                if (var3.sound != null) {
  551.                   var3.soundClip = ((Applet)this).getAudioClip(((Applet)this).getDocumentBase(), var3.sound);
  552.                }
  553.  
  554.                if (var3.isSelected) {
  555.                   this.itemSelected = var3;
  556.                }
  557.  
  558.                var3 = var3.nextLine;
  559.             }
  560.          }
  561.       }
  562.  
  563.       if (this.asWindow && this.frame != null && this.script.menuStart != null) {
  564.          this.frame.createMenu();
  565.          this.fRepaint = true;
  566.       }
  567.  
  568.       if (!this.fShowLoading && this.field_3 != null) {
  569.          this.selectItem(this.field_3.toExternalForm(), false);
  570.       }
  571.  
  572.       this.fScriptToLoad = false;
  573.    }
  574.  
  575.    public void start() {
  576.       this.helpItem = null;
  577.       this.helpScroll = null;
  578.       this.soundItem = null;
  579.       this.fSoundPlayed = false;
  580.       if (this.asWindow) {
  581.          if (this.frame == null) {
  582.             this.field_5 = true;
  583.          } else {
  584.             this.frame.show();
  585.             this.frame.move(this.windowX, this.windowY);
  586.             this.frame.resize(this.windowWidth, this.windowHeight);
  587.          }
  588.       }
  589.  
  590.       if (this.field_2 == null || ((Applet)this).getDocumentBase().toExternalForm() != this.field_2.toExternalForm()) {
  591.          if (this.field_2 != null) {
  592.             this.fShowLoading = false;
  593.          }
  594.  
  595.          this.field_2 = ((Applet)this).getDocumentBase();
  596.       }
  597.  
  598.       if (this.field_0 == null) {
  599.          this.field_0 = new Thread(this);
  600.          this.field_0.start();
  601.          if (this.infoHeight > 0) {
  602.             this.ScrollRun = new TOCScrollRun(this);
  603.             this.ScrollRun.start();
  604.          }
  605.       }
  606.  
  607.       this.fRepaint = true;
  608.    }
  609.  
  610.    public String getAppletInfo() {
  611.       return "TOC.java, 4.2, (c) by Stefan Ruettinger";
  612.    }
  613.  
  614.    public final URL getURL(String var1) {
  615.       URL var2 = null;
  616.       boolean var3 = true;
  617.  
  618.       try {
  619.          var2 = new URL(var1);
  620.       } catch (MalformedURLException var5) {
  621.          var3 = false;
  622.       }
  623.  
  624.       if (!var3) {
  625.          try {
  626.             var2 = new URL(((Applet)this).getDocumentBase(), var1);
  627.          } catch (MalformedURLException var4) {
  628.             System.out.println("Bad URL '" + var1 + "'. Ignoring URL value.");
  629.             var2 = null;
  630.          }
  631.       }
  632.  
  633.       return var2;
  634.    }
  635.  
  636.    // $FF: renamed from: ├¡ () int
  637.    private int method_3() {
  638.       if ((this.scriptFile = ((Applet)this).getParameter("script")) == null) {
  639.          System.out.println("Applet Error: 'script' parameter is mandatory.");
  640.          return -1;
  641.       } else {
  642.          String var1;
  643.          if ((var1 = ((Applet)this).getParameter("standardfont")) != null) {
  644.             var1 = var1.trim();
  645.             this.standardfont = var1.substring(0, var1.indexOf(","));
  646.             var1 = var1.substring(var1.indexOf(",") + 1);
  647.  
  648.             try {
  649.                this.standardfontsize = new Integer(var1);
  650.             } catch (NumberFormatException var8) {
  651.                System.out.println("Bad standardfont size '" + var1 + "'. Setting size=14.");
  652.                this.standardfontsize = 14;
  653.             }
  654.          } else {
  655.             this.standardfont = new String("TimesRoman");
  656.             this.standardfontsize = 14;
  657.          }
  658.  
  659.          if ((var1 = ((Applet)this).getParameter("helpfont")) != null) {
  660.             var1 = var1.trim();
  661.             this.helpfont = var1.substring(0, var1.indexOf(","));
  662.             var1 = var1.substring(var1.indexOf(",") + 1);
  663.  
  664.             try {
  665.                this.helpfontsize = new Integer(var1);
  666.             } catch (NumberFormatException var7) {
  667.                System.out.println("Bad helpfont size '" + var1 + "'. Setting size=10.");
  668.                this.helpfontsize = 10;
  669.             }
  670.          } else {
  671.             this.helpfont = new String("TimesRoman");
  672.             this.helpfontsize = 10;
  673.          }
  674.  
  675.          this.xIndent = this.method_1("xindent", 12);
  676.          this.xOff = this.method_1("xoffset", 5);
  677.          this.yOff = this.method_1("yoffset", 5) + 2;
  678.          this.fVertScroll = true;
  679.          if ((var1 = ((Applet)this).getParameter("vscroll")) != null) {
  680.             var1 = var1.trim();
  681.             if (var1.equals("NO")) {
  682.                this.fVertScroll = false;
  683.             }
  684.          }
  685.  
  686.          this.fHorzScroll = true;
  687.          if ((var1 = ((Applet)this).getParameter("hscroll")) != null) {
  688.             var1 = var1.trim();
  689.             if (var1.equals("NO")) {
  690.                this.fHorzScroll = false;
  691.             }
  692.          }
  693.  
  694.          this.textC = this.method_2("textcolor");
  695.          if (this.textC == null) {
  696.             this.textC = Color.black;
  697.          }
  698.  
  699.          this.reversC = this.method_2("reverstextcolor");
  700.          if (this.reversC == null) {
  701.             this.reversC = Color.white;
  702.          }
  703.  
  704.          this.lineC = this.method_2("linecolor");
  705.          if (this.lineC == null) {
  706.             this.lineC = Color.black;
  707.          }
  708.  
  709.          this.plusC = this.method_2("pluscolor");
  710.          if (this.plusC == null) {
  711.             this.plusC = this.lineC;
  712.          }
  713.  
  714.          this.bgC = this.method_2("backgroundcolor");
  715.          if (this.bgC == null) {
  716.             this.bgC = new Color(192, 192, 192);
  717.          }
  718.  
  719.          if ((var1 = ((Applet)this).getParameter("background")) != null) {
  720.             boolean var2 = true;
  721.  
  722.             try {
  723.                this.bgImage = new URL(var1);
  724.             } catch (MalformedURLException var6) {
  725.                var2 = false;
  726.             }
  727.  
  728.             if (!var2) {
  729.                try {
  730.                   this.bgImage = new URL(((Applet)this).getDocumentBase(), var1);
  731.                } catch (MalformedURLException var5) {
  732.                   System.out.println("Bad background value '" + var1 + "'. Ignoring background image.");
  733.                   this.bgImage = null;
  734.                }
  735.             }
  736.          }
  737.  
  738.          if ((var1 = ((Applet)this).getParameter("selectimage")) != null) {
  739.             boolean var25 = true;
  740.  
  741.             try {
  742.                this.selImage = new URL(var1);
  743.             } catch (MalformedURLException var4) {
  744.                var25 = false;
  745.             }
  746.  
  747.             if (!var25) {
  748.                try {
  749.                   this.selImage = new URL(((Applet)this).getDocumentBase(), var1);
  750.                } catch (MalformedURLException var3) {
  751.                   System.out.println("Bad selection image alue '" + var1 + "'. Ignoring selection image.");
  752.                   this.selImage = null;
  753.                }
  754.             }
  755.          }
  756.  
  757.          if ((var1 = ((Applet)this).getParameter("aswindow")) != null) {
  758.             var1 = var1.trim();
  759.             if (var1.equals("YES")) {
  760.                this.asWindow = true;
  761.             }
  762.          }
  763.  
  764.          if ((var1 = ((Applet)this).getParameter("windowtitle")) != null) {
  765.             this.field_4 = var1;
  766.          }
  767.  
  768.          this.windowX = this.method_1("windowx", 10);
  769.          this.windowY = this.method_1("windowy", 10);
  770.          this.windowWidth = this.method_1("windowwidth", 200);
  771.          this.windowHeight = this.method_1("windowheight", 400);
  772.          this.infoHeight = this.method_1("infoheight", 0);
  773.          this.bgCInfo = this.method_2("infobackgroundcolor");
  774.          if (this.bgCInfo == null) {
  775.             this.bgCInfo = new Color(192, 192, 192);
  776.          }
  777.  
  778.          this.textCInfo = this.method_2("infotextcolor");
  779.          if (this.textCInfo == null) {
  780.             this.textCInfo = Color.black;
  781.          }
  782.  
  783.          this.genScrollFile = ((Applet)this).getParameter("infoscript");
  784.          this.lReload = (long)this.method_1("inforeload", -1);
  785.          if (this.lReload > 0L) {
  786.             this.lReload *= 100L;
  787.          }
  788.  
  789.          if ((var1 = ((Applet)this).getParameter("compressedscript")) != null) {
  790.             var1 = var1.trim();
  791.             if (var1.equals("YES")) {
  792.                this.fCompTOCScript = true;
  793.             }
  794.          }
  795.  
  796.          return 0;
  797.       }
  798.    }
  799.  
  800.    public void run() {
  801.       while(this.field_0 != null) {
  802.          if (this.field_5) {
  803.             if (this.frame == null) {
  804.                this.method_0();
  805.             }
  806.  
  807.             this.field_5 = false;
  808.          }
  809.  
  810.          if (this.fScriptToLoad) {
  811.             ((Component)this).repaint();
  812.             this.getInfo();
  813.             this.Scroller.checkScrollbars();
  814.          } else {
  815.             if (!this.field_1) {
  816.                boolean var2 = false;
  817.                if (this.imgBackgroundLoad != null) {
  818.                   boolean var3 = this.tracker.checkID(0, true);
  819.                   if (var3) {
  820.                      if (!this.tracker.isErrorID(0)) {
  821.                         this.imgBackground = this.imgBackgroundLoad;
  822.                         this.fRepaint = true;
  823.                      }
  824.  
  825.                      this.imgBackgroundLoad = null;
  826.                   } else {
  827.                      var2 = true;
  828.                   }
  829.                }
  830.  
  831.                if (this.imgSelectionLoad != null) {
  832.                   boolean var4 = this.tracker.checkID(1, true);
  833.                   if (var4) {
  834.                      if (!this.tracker.isErrorID(1)) {
  835.                         this.imgSelection = this.imgSelectionLoad;
  836.                         this.fRepaint = true;
  837.                      }
  838.  
  839.                      this.imgSelectionLoad = null;
  840.                   } else {
  841.                      var2 = true;
  842.                   }
  843.                }
  844.  
  845.                TOCTreeItem var1 = this.TOCAnchor;
  846.  
  847.                while(var1 != null) {
  848.                   if (var1.fct != 0) {
  849.                      var1 = var1.nextLine;
  850.                   } else {
  851.                      if (var1.imageName != null && var1.imageLoad != null) {
  852.                         boolean var5 = this.tracker.checkID(var1.id, true);
  853.                         if (var5) {
  854.                            if (!this.tracker.isErrorID(var1.id)) {
  855.                               var1.image = var1.imageLoad;
  856.                               var1.imgWidth = var1.image.getWidth(this);
  857.                               var1.imgHeight = var1.image.getHeight(this);
  858.                               this.fRepaint = true;
  859.                            } else {
  860.                               var1.imageLoad = null;
  861.                            }
  862.                         } else {
  863.                            var2 = true;
  864.                         }
  865.                      }
  866.  
  867.                      if (var1.imageOpenName != null && var1.imageOpenLoad != null) {
  868.                         boolean var6 = this.tracker.checkID(var1.id + 1, true);
  869.                         if (var6) {
  870.                            if (!this.tracker.isErrorID(var1.id + 1)) {
  871.                               var1.imageOpen = var1.imageOpenLoad;
  872.                               var1.imgOpenWidth = var1.imageOpen.getWidth(this);
  873.                               var1.imgOpenHeight = var1.imageOpen.getHeight(this);
  874.                               this.fRepaint = true;
  875.                            }
  876.  
  877.                            var1.imageOpenLoad = null;
  878.                         } else {
  879.                            var2 = true;
  880.                         }
  881.                      }
  882.  
  883.                      var1 = var1.nextLine;
  884.                   }
  885.                }
  886.  
  887.                if (!var2) {
  888.                   this.field_1 = true;
  889.                }
  890.             }
  891.  
  892.             if (this.helpCounter == 3) {
  893.                this.fRepaint = true;
  894.             }
  895.  
  896.             if (this.helpCounter < 4) {
  897.                ++this.helpCounter;
  898.             }
  899.  
  900.             if (this.soundCounter < 4) {
  901.                ++this.soundCounter;
  902.             }
  903.  
  904.             if (this.soundItem != null && !this.fSoundPlayed && this.soundCounter == 3) {
  905.                this.fSoundPlayed = true;
  906.                this.soundItem.soundClip.play();
  907.             }
  908.  
  909.             if (this.Scroller.tAbsEvt != 0L && System.currentTimeMillis() - this.Scroller.tAbsEvt > 100L) {
  910.                this.fRepaint = true;
  911.                this.Scroller.tAbsEvt = 0L;
  912.             }
  913.  
  914.             if (this.fRepaint) {
  915.                this.Scroller.checkScrollbars();
  916.                if (this.infoHeight > 0) {
  917.                   this.Info.repaint();
  918.                   if (this.field_8) {
  919.                      this.frame.add("South", this.Info);
  920.                      this.frame.validate();
  921.                      this.field_8 = false;
  922.                   }
  923.                }
  924.  
  925.                this.fRepaint = false;
  926.             }
  927.  
  928.             this.wait(200);
  929.             ++this.field_6;
  930.             if (this.field_6 > 300) {
  931.                System.gc();
  932.                this.field_6 = 0;
  933.             }
  934.          }
  935.       }
  936.  
  937.    }
  938.  
  939.    public void init() {
  940.       super.init();
  941.       if (!this.fLicense) {
  942.          URL var1 = ((Applet)this).getCodeBase();
  943.          if (!var1.getProtocol().equals("file")) {
  944.             int var2 = TOCLicense.id;
  945.             String var4 = TOCLicense.domain;
  946.             String var5 = new String();
  947.             if (var4.length() < 6) {
  948.                return;
  949.             }
  950.  
  951.             if (!var4.substring(0, 1).equals("1")) {
  952.                return;
  953.             }
  954.  
  955.             String var6 = Integer.toString(var2);
  956.             int var8 = 1;
  957.  
  958.             for(int var3 = 0; var3 < var6.length(); ++var3) {
  959.                var8 += Integer.valueOf(var6.substring(var3, var3 + 1));
  960.             }
  961.  
  962.             String var7 = "000" + Integer.toString(var8);
  963.             var7 = var7.substring(var7.length() - 3);
  964.             if (var4.substring(1, 4).equals(var7)) {
  965.                for(int var13 = 4; var13 < var4.length(); var13 += 2) {
  966.                   String var9 = var4.substring(var13, var13 + 2);
  967.                   int var10 = Integer.valueOf(var9);
  968.                   int var11 = (var2 + var13) / 30;
  969.                   int var12 = var10 - (var2 + var13) + var11 * 30;
  970.                   var5 = var5 + this.field_7.substring(var12, var12 + 1);
  971.                }
  972.  
  973.                String var16 = var1.getHost().toLowerCase();
  974.                int var17 = 1;
  975.  
  976.                for(int var14 = 0; var14 < var16.length(); ++var14) {
  977.                   var17 += this.field_7.indexOf(var16.substring(var14, var14 + 1));
  978.                }
  979.  
  980.                String var18 = var16 + var1.getFile().toLowerCase();
  981.                int var19 = var18.indexOf(var5);
  982.                if (var19 != -1 && var5.length() > 4) {
  983.                   if (var19 == 0) {
  984.                      if (var17 == var2) {
  985.                         this.fLicense = true;
  986.                      }
  987.                   } else {
  988.                      this.fLicense = true;
  989.                   }
  990.                }
  991.             }
  992.          } else {
  993.             this.fLicense = true;
  994.          }
  995.       }
  996.  
  997.       if (this.tracker == null) {
  998.          this.tracker = new MediaTracker(this);
  999.       }
  1000.  
  1001.       if (this.method_3() == -1) {
  1002.          this.stop();
  1003.       }
  1004.  
  1005.       if (this.bgImage != null) {
  1006.          this.imgBackgroundLoad = ((Applet)this).getImage(this.bgImage);
  1007.          this.tracker.addImage(this.imgBackgroundLoad, 0);
  1008.       }
  1009.  
  1010.       if (this.selImage != null) {
  1011.          this.imgSelectionLoad = ((Applet)this).getImage(this.selImage);
  1012.          this.tracker.addImage(this.imgSelectionLoad, 1);
  1013.       }
  1014.  
  1015.       this.standardF = new Font(this.standardfont, 0, this.standardfontsize);
  1016.       this.standardFM = ((Component)this).getFontMetrics(this.standardF);
  1017.       this.helpF = new Font(this.helpfont, 0, this.helpfontsize);
  1018.       this.helpFM = ((Component)this).getFontMetrics(this.helpF);
  1019.       this.field_6 = 0;
  1020.       this.yInfoBase = this.infoHeight - this.standardFM.getMaxDescent();
  1021.       this.Scroller = new TOCScroller(this);
  1022.       if (this.infoHeight > 0) {
  1023.          this.Info = new TOCInfo(this);
  1024.          this.Info.resize(((Component)this).size().width, this.infoHeight);
  1025.       }
  1026.  
  1027.       if (this.asWindow) {
  1028.          this.field_5 = true;
  1029.       } else {
  1030.          ((Container)this).setLayout(new BorderLayout());
  1031.          ((Container)this).add("Center", this.Scroller);
  1032.          if (this.infoHeight > 0) {
  1033.             ((Container)this).add("South", this.Info);
  1034.          }
  1035.       }
  1036.  
  1037.       this.fInitDone = true;
  1038.    }
  1039. }
  1040.