home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2002 June / INTERNET92.ISO / pc / software / windows / building / visual_dhtml / visualdhtmlwin2000.exe / OCmsl.___ (.txt) < prev    next >
Encoding:
Java Class File  |  2001-10-19  |  14.6 KB  |  943 lines

  1. import com.ms.awt.FontX;
  2. import java.awt.Color;
  3. import java.awt.Component;
  4. import java.awt.Dimension;
  5. import java.awt.Event;
  6. import java.awt.Font;
  7. import java.awt.FontMetrics;
  8. import java.awt.Graphics;
  9. import java.awt.Image;
  10. import java.awt.Menu;
  11. import java.awt.MenuItem;
  12. import java.awt.PopupMenu;
  13.  
  14. class OCmsl extends OCdg {
  15.    private int menux;
  16.    private int menuy;
  17.    private int oldmenux = -1;
  18.    private int oldmenuy = -1;
  19.    private int bitheight;
  20.    private boolean first_crun = true;
  21.    public Color bgColor = new Color(255, 255, 255);
  22.    private Image poff;
  23.    private Graphics g_poff;
  24.    private int pwidth = 8;
  25.    private int pheight = 8;
  26.    int oldpy = -1;
  27.    int oldpx = -1;
  28.    int curPoint = -1;
  29.    int aDist = 10;
  30.    int rmx;
  31.    int rmy;
  32.    int curHL = -1;
  33.    int leaveHL = -1;
  34.    int realHL = -1;
  35.    int auxHL = -1;
  36.    int sub_level;
  37.    String branchid;
  38.    boolean subOn = false;
  39.    private Image upa;
  40.    private Image downa;
  41.    Image menu;
  42.    Graphics g_menu;
  43.    // $FF: renamed from: fm java.awt.FontMetrics
  44.    public FontMetrics field_0;
  45.    // $FF: renamed from: ds java.awt.Dimension
  46.    public Dimension field_1;
  47.    public int appx;
  48.    public int appy;
  49.    private Color m_hltextcolor = new Color(255, 255, 153);
  50.    private Color m_hlbgcolor = new Color(102, 102, 102);
  51.    private Color m_outline_color;
  52.    private Color m_textcolor;
  53.    private Font m_font;
  54.    private Font m_hlfont;
  55.    public int m_xoffset;
  56.    private Color m_menucolor;
  57.    private String m_textdecoration;
  58.    private String m_hltextdecoration;
  59.    private int m_marginleft;
  60.    private int m_marginright;
  61.    private int m_margintop;
  62.    private int m_marginbottom;
  63.    private Color m_border_color;
  64.    private int m_borderwidth_left;
  65.    private int m_borderwidth_right;
  66.    private int m_borderheight_top;
  67.    private int m_borderheight_bottom;
  68.    private int m_divider_height;
  69.    private Color m_divider_color;
  70.    private boolean m_usedivder_topandbottom;
  71.    public String[] m_desc;
  72.    public int[] m_iconid;
  73.    public String[] m_iconfiles;
  74.    private Image[] m_iconimage;
  75.    public String[] m_switch_iconfiles;
  76.    private Image[] m_switch_iconimage;
  77.    public boolean[] iconimage_status;
  78.    private String m_icon_align;
  79.    public int num_descrips;
  80.    public int level;
  81.    public int max_string_width;
  82.    public int menuwidth;
  83.    public int menuheight;
  84.    private int itemwidth;
  85.    private int itemheight;
  86.    public int desc_index;
  87.    boolean multi_level;
  88.    private int indWidth;
  89.    private Color indArrowColor;
  90.    private Image upArrow;
  91.    private boolean[] hasHigherlevel;
  92.    public int drag_iposx;
  93.    public int drag_iposy;
  94.    private int init_dragx;
  95.    private int init_dragy;
  96.    private int[] save_iposx;
  97.    private int[] save_iposy;
  98.    private int[] save_iposw;
  99.    private int[] save_iposh;
  100.    private int[] item_h;
  101.    private int[] item_y;
  102.    private int icon_xoff;
  103.    private int icon_yoff;
  104.    APInfo apinfo;
  105.    private boolean useColors;
  106.  
  107.    public boolean mouseMove(Event var1, int var2, int var3) {
  108.       this.rmx = super.scroll_x + super.offimgx + this.aDist;
  109.       this.rmy = super.scroll_y + super.offimgy;
  110.       if (var2 > this.rmx && var2 < this.rmx + this.menuwidth + 1 && var3 > this.rmy && var3 < this.rmy + this.menuheight + 1) {
  111.          for(int var4 = 0; var4 < this.num_descrips; ++var4) {
  112.             int var5 = var4 * this.bitheight + this.rmy;
  113.             if (var3 > var5 && var3 < var5 + this.bitheight && this.curHL != var4) {
  114.                this.undohlMenuItem();
  115.                this.hlMenuItem(var4);
  116.                this.curHL = var4;
  117.                ((OCdg)this).drawAppOff();
  118.                ((OCdg)this).paintIt();
  119.             }
  120.          }
  121.       } else if (this.curHL != -1) {
  122.          this.undohlMenuItem();
  123.          this.curHL = -1;
  124.          ((OCdg)this).drawAppOff();
  125.          ((OCdg)this).paintIt();
  126.       }
  127.  
  128.       return true;
  129.    }
  130.  
  131.    public void initIcons() {
  132.       int var2 = super.icon_pv.size();
  133.       this.m_iconfiles = new String[var2];
  134.       this.m_iconimage = new Image[var2];
  135.       this.m_switch_iconfiles = new String[var2];
  136.       this.m_switch_iconimage = new Image[var2];
  137.       this.iconimage_status = new boolean[var2];
  138.  
  139.       for(int var3 = 0; var3 < var2; ++var3) {
  140.          String var1 = ((OCdg)this).getParameterIcon("iconimage", var3);
  141.          if (var1 != null) {
  142.             this.m_iconfiles[var3] = var1;
  143.          } else {
  144.             this.m_iconfiles[var3] = null;
  145.          }
  146.  
  147.          var1 = ((OCdg)this).getParameterIcon("switchimage", var3);
  148.          if (var1 != null && !var1.equalsIgnoreCase("<none>")) {
  149.             this.m_switch_iconfiles[var3] = var1;
  150.          } else {
  151.             this.m_switch_iconfiles[var3] = null;
  152.          }
  153.       }
  154.  
  155.       ACutil var6 = new ACutil();
  156.  
  157.       for(int var4 = 0; var4 < var2; ++var4) {
  158.          if (this.m_iconfiles[var4] != null && (this.m_iconimage[var4] = var6.getDGImage(this.m_iconfiles[var4])) != null) {
  159.             this.iconimage_status[var4] = true;
  160.             if (this.m_switch_iconfiles[var4] != null) {
  161.                if ((this.m_switch_iconimage[var4] = var6.getDGImage(this.m_switch_iconfiles[var4])) == null) {
  162.                   this.m_switch_iconimage[var4] = this.m_iconimage[var4];
  163.                }
  164.             } else {
  165.                this.m_switch_iconimage[var4] = this.m_iconimage[var4];
  166.             }
  167.          }
  168.       }
  169.  
  170.    }
  171.  
  172.    public boolean mouseExit(Event var1, int var2, int var3) {
  173.       this.rmx = super.scroll_x + super.offimgx + this.aDist;
  174.       this.rmy = super.scroll_y + super.offimgy;
  175.       if (this.curHL > -1) {
  176.          this.undohlMenuItem();
  177.          ((OCdg)this).drawAppOff();
  178.          ((OCdg)this).paintIt();
  179.          this.curHL = -1;
  180.       }
  181.  
  182.       return true;
  183.    }
  184.  
  185.    public void mouseMoveFromDesignGrid(Event var1, int var2, int var3, Image var4, Graphics var5, OCdgImg var6, Image var7) {
  186.       this.rmx = var6.sub_posx[this.level] + var6.scroll_x;
  187.       this.rmy = var6.sub_posy[this.level] + var6.scroll_y;
  188.  
  189.       for(int var8 = 0; var8 < this.num_descrips; ++var8) {
  190.          int var9 = this.item_y[var8] + this.rmy;
  191.          if (var3 > var9 && var3 < var9 + this.bitheight) {
  192.             this.realHL = var8;
  193.             if (var6.appinfo.getSpecMLValues().isItem(this.branchid + "-" + var8 + "-0")) {
  194.                if (this.curHL != var8) {
  195.                   this.fdg_undohlMenuItem(var7, var5);
  196.                   if (this.leaveHL > -1 && this.leaveHL != var8) {
  197.                      this.fdg_hlMenuItem(this.leaveHL, var5, true);
  198.                   }
  199.  
  200.                   this.fdg_hlMenuItem(var8, var5, true);
  201.                   this.curHL = var8;
  202.                   var6.drawSub(true);
  203.                   ((OCdg)var6).paintIt();
  204.                   return;
  205.                }
  206.             } else if (this.curHL != -1) {
  207.                this.fdg_undohlMenuItem(var7, var5);
  208.                this.curHL = -1;
  209.                if (this.leaveHL > -1) {
  210.                   this.fdg_hlMenuItem(this.leaveHL, var5, true);
  211.                }
  212.  
  213.                var6.drawSub(true);
  214.                ((OCdg)var6).paintIt();
  215.             }
  216.  
  217.             return;
  218.          }
  219.       }
  220.  
  221.       this.realHL = -1;
  222.    }
  223.  
  224.    OCmsl(APInfo var1) {
  225.       this.m_outline_color = Color.black;
  226.       this.m_textcolor = Color.black;
  227.       this.m_font = new Font("Helvetica", 0, 11);
  228.       this.m_hlfont = new Font("Helvetica", 0, 11);
  229.       this.m_xoffset = 8;
  230.       this.m_menucolor = Color.white;
  231.       this.m_textdecoration = "normal";
  232.       this.m_hltextdecoration = "normal";
  233.       this.m_marginleft = 0;
  234.       this.m_marginright = 0;
  235.       this.m_margintop = 0;
  236.       this.m_marginbottom = 0;
  237.       this.m_border_color = Color.white;
  238.       this.m_borderwidth_left = 0;
  239.       this.m_borderwidth_right = 0;
  240.       this.m_borderheight_top = 0;
  241.       this.m_borderheight_bottom = 0;
  242.       this.m_divider_height = 0;
  243.       this.m_divider_color = Color.white;
  244.       this.m_usedivder_topandbottom = false;
  245.       this.m_icon_align = "right";
  246.       this.desc_index = 0;
  247.       this.multi_level = false;
  248.       this.indWidth = 10;
  249.       this.indArrowColor = Color.black;
  250.       this.icon_xoff = 0;
  251.       this.icon_yoff = 0;
  252.       this.useColors = false;
  253.       this.apinfo = var1;
  254.       this.multi_level = this.apinfo.multi_level;
  255.    }
  256.  
  257.    OCmsl(APInfo var1, boolean var2) {
  258.       this.m_outline_color = Color.black;
  259.       this.m_textcolor = Color.black;
  260.       this.m_font = new Font("Helvetica", 0, 11);
  261.       this.m_hlfont = new Font("Helvetica", 0, 11);
  262.       this.m_xoffset = 8;
  263.       this.m_menucolor = Color.white;
  264.       this.m_textdecoration = "normal";
  265.       this.m_hltextdecoration = "normal";
  266.       this.m_marginleft = 0;
  267.       this.m_marginright = 0;
  268.       this.m_margintop = 0;
  269.       this.m_marginbottom = 0;
  270.       this.m_border_color = Color.white;
  271.       this.m_borderwidth_left = 0;
  272.       this.m_borderwidth_right = 0;
  273.       this.m_borderheight_top = 0;
  274.       this.m_borderheight_bottom = 0;
  275.       this.m_divider_height = 0;
  276.       this.m_divider_color = Color.white;
  277.       this.m_usedivder_topandbottom = false;
  278.       this.m_icon_align = "right";
  279.       this.desc_index = 0;
  280.       this.multi_level = false;
  281.       this.indWidth = 10;
  282.       this.indArrowColor = Color.black;
  283.       this.icon_xoff = 0;
  284.       this.icon_yoff = 0;
  285.       this.useColors = false;
  286.       this.apinfo = var1;
  287.       this.multi_level = this.apinfo.multi_level;
  288.    }
  289.  
  290.    OCmsl(boolean var1) {
  291.       this.m_outline_color = Color.black;
  292.       this.m_textcolor = Color.black;
  293.       this.m_font = new Font("Helvetica", 0, 11);
  294.       this.m_hlfont = new Font("Helvetica", 0, 11);
  295.       this.m_xoffset = 8;
  296.       this.m_menucolor = Color.white;
  297.       this.m_textdecoration = "normal";
  298.       this.m_hltextdecoration = "normal";
  299.       this.m_marginleft = 0;
  300.       this.m_marginright = 0;
  301.       this.m_margintop = 0;
  302.       this.m_marginbottom = 0;
  303.       this.m_border_color = Color.white;
  304.       this.m_borderwidth_left = 0;
  305.       this.m_borderwidth_right = 0;
  306.       this.m_borderheight_top = 0;
  307.       this.m_borderheight_bottom = 0;
  308.       this.m_divider_height = 0;
  309.       this.m_divider_color = Color.white;
  310.       this.m_usedivder_topandbottom = false;
  311.       this.m_icon_align = "right";
  312.       this.desc_index = 0;
  313.       this.multi_level = false;
  314.       this.indWidth = 10;
  315.       this.indArrowColor = Color.black;
  316.       this.icon_xoff = 0;
  317.       this.icon_yoff = 0;
  318.       this.useColors = false;
  319.       this.useColors = var1;
  320.    }
  321.  
  322.    OCmsl(boolean var1, int var2) {
  323.       this.m_outline_color = Color.black;
  324.       this.m_textcolor = Color.black;
  325.       this.m_font = new Font("Helvetica", 0, 11);
  326.       this.m_hlfont = new Font("Helvetica", 0, 11);
  327.       this.m_xoffset = 8;
  328.       this.m_menucolor = Color.white;
  329.       this.m_textdecoration = "normal";
  330.       this.m_hltextdecoration = "normal";
  331.       this.m_marginleft = 0;
  332.       this.m_marginright = 0;
  333.       this.m_margintop = 0;
  334.       this.m_marginbottom = 0;
  335.       this.m_border_color = Color.white;
  336.       this.m_borderwidth_left = 0;
  337.       this.m_borderwidth_right = 0;
  338.       this.m_borderheight_top = 0;
  339.       this.m_borderheight_bottom = 0;
  340.       this.m_divider_height = 0;
  341.       this.m_divider_color = Color.white;
  342.       this.m_usedivder_topandbottom = false;
  343.       this.m_icon_align = "right";
  344.       this.desc_index = 0;
  345.       this.multi_level = false;
  346.       this.indWidth = 10;
  347.       this.indArrowColor = Color.black;
  348.       this.icon_xoff = 0;
  349.       this.icon_yoff = 0;
  350.       this.useColors = false;
  351.       this.useColors = var1;
  352.       this.sub_level = var2;
  353.    }
  354.  
  355.    OCmsl() {
  356.       this.m_outline_color = Color.black;
  357.       this.m_textcolor = Color.black;
  358.       this.m_font = new Font("Helvetica", 0, 11);
  359.       this.m_hlfont = new Font("Helvetica", 0, 11);
  360.       this.m_xoffset = 8;
  361.       this.m_menucolor = Color.white;
  362.       this.m_textdecoration = "normal";
  363.       this.m_hltextdecoration = "normal";
  364.       this.m_marginleft = 0;
  365.       this.m_marginright = 0;
  366.       this.m_margintop = 0;
  367.       this.m_marginbottom = 0;
  368.       this.m_border_color = Color.white;
  369.       this.m_borderwidth_left = 0;
  370.       this.m_borderwidth_right = 0;
  371.       this.m_borderheight_top = 0;
  372.       this.m_borderheight_bottom = 0;
  373.       this.m_divider_height = 0;
  374.       this.m_divider_color = Color.white;
  375.       this.m_usedivder_topandbottom = false;
  376.       this.m_icon_align = "right";
  377.       this.desc_index = 0;
  378.       this.multi_level = false;
  379.       this.indWidth = 10;
  380.       this.indArrowColor = Color.black;
  381.       this.icon_xoff = 0;
  382.       this.icon_yoff = 0;
  383.       this.useColors = false;
  384.    }
  385.  
  386.    public void drawIconsFromDesignGrid(Graphics var1) {
  387.       for(int var2 = 0; var2 < this.num_descrips; ++var2) {
  388.          int var3 = this.m_iconid[var2];
  389.          if (var3 > -1 && this.iconimage_status[var3]) {
  390.             if (var2 != this.leaveHL && var2 != this.curHL) {
  391.                var1.drawImage(this.m_iconimage[var3], this.save_iposx[var2] - this.init_dragx + this.drag_iposx, this.save_iposy[var2] - this.init_dragy + this.drag_iposy, this);
  392.             } else {
  393.                var1.drawImage(this.m_switch_iconimage[var3], this.save_iposx[var2] - this.init_dragx + this.drag_iposx, this.save_iposy[var2] - this.init_dragy + this.drag_iposy, this);
  394.             }
  395.          }
  396.       }
  397.  
  398.    }
  399.  
  400.    public void initDefault() {
  401.       this.m_outline_color = Color.black;
  402.       this.m_textcolor = Color.black;
  403.       this.m_menucolor = new Color(220, 220, 220);
  404.       if (this.useColors) {
  405.          int var2 = 8;
  406.          String var3 = "Helvetica";
  407.          String var4 = "normal";
  408.          String var5 = "normal";
  409.          String var1 = ((OCdg)this).getParameterDefault("fontsize");
  410.          if (var1 != null) {
  411.             var2 = Integer.parseInt(var1);
  412.          }
  413.  
  414.          var1 = ((OCdg)this).getParameterDefault("fontfamily");
  415.          if (var1 != null) {
  416.             var3 = var1;
  417.          }
  418.  
  419.          var1 = ((OCdg)this).getParameterDefault("fontstyle");
  420.          if (var1 != null) {
  421.             var4 = var1;
  422.          }
  423.  
  424.          var1 = ((OCdg)this).getParameterDefault("fontweight");
  425.          if (var1 != null) {
  426.             var5 = var1;
  427.          }
  428.  
  429.          int var6 = 0;
  430.          if (var5.toLowerCase().equals("bold")) {
  431.             var6 = 1;
  432.          }
  433.  
  434.          if (var4.toLowerCase().equals("italic")) {
  435.             var6 += 2;
  436.          }
  437.  
  438.          var1 = ((OCdg)this).getParameterDefault("textdecoration");
  439.          if (var1 != null) {
  440.             this.m_textdecoration = var1;
  441.          }
  442.  
  443.          var1 = ((OCdg)this).getParameterDefault("hl_textdecoration");
  444.          if (var1 != null) {
  445.             this.m_hltextdecoration = var1;
  446.          }
  447.  
  448.          if (var2 > 3) {
  449.             var2 += 3;
  450.          }
  451.  
  452.          if (this.m_textdecoration.equalsIgnoreCase("underline")) {
  453.             this.m_font = new FontX(var3, var6, var2, 4);
  454.          } else {
  455.             this.m_font = new FontX(var3, var6, var2);
  456.          }
  457.  
  458.          if (this.m_hltextdecoration.equalsIgnoreCase("underline")) {
  459.             this.m_hlfont = new FontX(var3, var6, var2, 4);
  460.          } else {
  461.             this.m_hlfont = this.m_font;
  462.          }
  463.  
  464.          var1 = ((OCdg)this).getParameterDefault("textcolor");
  465.          if (var1 != null) {
  466.             this.m_textcolor = occcolor.ConvertColor(var1);
  467.          }
  468.  
  469.          var1 = ((OCdg)this).getParameterDefault("dividercolor");
  470.          if (var1 != null) {
  471.             this.m_divider_color = occcolor.ConvertColor(var1);
  472.          }
  473.  
  474.          var1 = ((OCdg)this).getParameterDefault("bordercolor");
  475.          if (var1 != null) {
  476.             this.m_border_color = occcolor.ConvertColor(var1);
  477.          }
  478.  
  479.          var1 = ((OCdg)this).getParameterDefault("bghighlightcolor");
  480.          if (var1 != null) {
  481.             this.m_hlbgcolor = occcolor.ConvertColor(var1);
  482.          }
  483.  
  484.          var1 = ((OCdg)this).getParameterDefault("hl_textcolor");
  485.          if (var1 != null) {
  486.             this.m_hltextcolor = occcolor.ConvertColor(var1);
  487.          }
  488.  
  489.          var1 = ((OCdg)this).getParameterDefault("bordercolor");
  490.          if (var1 != null) {
  491.             this.m_outline_color = occcolor.ConvertColor(var1);
  492.          }
  493.  
  494.          var1 = ((OCdg)this).getParameterDefault("backgroundcolor");
  495.          if (var1 != null) {
  496.             this.m_menucolor = occcolor.ConvertColor(var1);
  497.          }
  498.  
  499.          var1 = ((OCdg)this).getParameterDefault("icon_align");
  500.          if (var1 != null) {
  501.             this.m_icon_align = var1;
  502.          }
  503.  
  504.          var1 = ((OCdg)this).getParameterDefault("marginleft");
  505.          if (var1 != null) {
  506.             this.m_marginleft = Integer.parseInt(var1) + 2;
  507.          }
  508.  
  509.          var1 = ((OCdg)this).getParameterDefault("marginright");
  510.          if (var1 != null) {
  511.             this.m_marginright = Integer.parseInt(var1) + 2;
  512.          }
  513.  
  514.          var1 = ((OCdg)this).getParameterDefault("margintop");
  515.          if (var1 != null) {
  516.             this.m_margintop = Integer.parseInt(var1) + 2;
  517.          }
  518.  
  519.          var1 = ((OCdg)this).getParameterDefault("marginbottom");
  520.          if (var1 != null) {
  521.             this.m_marginbottom = Integer.parseInt(var1) + 2;
  522.          }
  523.  
  524.          var1 = ((OCdg)this).getParameterDefault("borderwidth_left");
  525.          if (var1 != null) {
  526.             this.m_borderwidth_left = Integer.parseInt(var1);
  527.          }
  528.  
  529.          var1 = ((OCdg)this).getParameterDefault("borderwidth_right");
  530.          if (var1 != null) {
  531.             this.m_borderwidth_right = Integer.parseInt(var1);
  532.          }
  533.  
  534.          var1 = ((OCdg)this).getParameterDefault("borderheight_top");
  535.          if (var1 != null) {
  536.             this.m_borderheight_top = Integer.parseInt(var1);
  537.          }
  538.  
  539.          var1 = ((OCdg)this).getParameterDefault("borderheight_bottom");
  540.          if (var1 != null) {
  541.             this.m_borderheight_bottom = Integer.parseInt(var1);
  542.          }
  543.  
  544.          var1 = ((OCdg)this).getParameterDefault("dividerheight");
  545.          if (var1 != null) {
  546.             this.m_divider_height = Integer.parseInt(var1);
  547.          }
  548.  
  549.          var1 = ((OCdg)this).getParameterDefault("usedivider_topandbottom");
  550.          if (var1 != null) {
  551.             this.m_usedivder_topandbottom = Boolean.valueOf(var1);
  552.          }
  553.  
  554.          var1 = ((OCdg)this).getParameterDefault("icon_offsetxy");
  555.          if (var1 != null) {
  556.             int[] var7 = occcord.getIntValues(var1, ",", 2);
  557.             if (var7 != null) {
  558.                this.icon_xoff = var7[0];
  559.                this.icon_yoff = var7[1];
  560.             }
  561.          }
  562.       }
  563.  
  564.       ((Component)this).setFont(this.m_font);
  565.       this.field_0 = ((Component)this).getFontMetrics(this.m_font);
  566.    }
  567.  
  568.    public void fdg_hlMenuItem(int var1, Graphics var2, boolean var3) {
  569.       var2.setFont(this.m_hlfont);
  570.       var2.setColor(this.m_hlbgcolor);
  571.       var2.fillRect(this.m_borderwidth_left, this.item_y[var1], this.itemwidth, this.bitheight);
  572.       var2.setColor(this.m_hltextcolor);
  573.       var2.drawString(this.m_desc[var1], this.m_marginleft + this.m_borderwidth_left, this.item_y[var1] + this.field_0.getHeight() - this.field_0.getDescent() + this.m_margintop);
  574.       if (var3) {
  575.          int var4 = this.m_iconid[var1];
  576.          if (var4 > -1 && this.iconimage_status[var4]) {
  577.             int var5 = this.m_iconimage[var4].getHeight(this);
  578.             int var6 = this.m_iconimage[var4].getWidth(this);
  579.             int var7 = (this.item_h[var1] - var5) / 2 + this.item_y[var1] + this.icon_yoff;
  580.             int var8 = this.icon_xoff + this.m_borderwidth_left;
  581.             if (this.m_icon_align.toLowerCase().equals("right")) {
  582.                var8 = var8 + this.itemwidth - var6;
  583.             }
  584.  
  585.             var2.drawImage(this.m_switch_iconimage[var4], var8, var7, this);
  586.          }
  587.       }
  588.  
  589.    }
  590.  
  591.    public void fdg_undohlMenuItem(Image var1, Graphics var2) {
  592.       var2.drawImage(var1, 0, 0, this);
  593.    }
  594.  
  595.    public void DrawApplet() {
  596.       this.drawMenu();
  597.       if (this.first_crun) {
  598.          this.drawPointer();
  599.          this.setPointer(this.apinfo.cur_tree_index);
  600.          this.showPointer();
  601.          this.first_crun = false;
  602.       }
  603.  
  604.    }
  605.  
  606.    public Dimension getMenuImageSize() {
  607.       this.field_0 = ((Component)this).getFontMetrics(this.m_font);
  608.       this.itemwidth = this.max_string_width + this.m_marginleft + this.m_marginright;
  609.       this.menuwidth = this.itemwidth + this.m_borderwidth_left + this.m_borderwidth_right;
  610.       this.itemheight = this.num_descrips * this.field_0.getHeight() + this.num_descrips * this.m_margintop + this.num_descrips * this.m_marginbottom;
  611.       if (this.m_usedivder_topandbottom) {
  612.          this.itemheight += (this.num_descrips + 1) * this.m_divider_height;
  613.       } else {
  614.          this.itemheight += (this.num_descrips - 1) * this.m_divider_height;
  615.       }
  616.  
  617.       this.menuheight = this.itemheight + this.m_borderheight_top + this.m_borderheight_bottom;
  618.       this.bitheight = this.field_0.getHeight() + this.m_margintop + this.m_marginbottom;
  619.  
  620.       for(int var1 = 0; var1 < this.num_descrips; ++var1) {
  621.          this.item_h[var1] = this.bitheight;
  622.          this.item_y[var1] = this.bitheight * var1 + this.m_borderheight_top;
  623.          if (this.m_usedivder_topandbottom) {
  624.             int[] var10000 = this.item_y;
  625.             var10000[var1] += this.m_divider_height;
  626.          }
  627.  
  628.          int[] var3 = this.item_y;
  629.          var3[var1] += var1 * this.m_divider_height;
  630.       }
  631.  
  632.       Dimension var2 = new Dimension(this.menuwidth, this.menuheight);
  633.       return var2;
  634.    }
  635.  
  636.    private void drawUpArrow() {
  637.       byte var1 = 7;
  638.       byte var2 = 5;
  639.       this.upArrow = ((Component)this).createImage(var1, var2);
  640.       Graphics var3 = this.upArrow.getGraphics();
  641.       var3.setColor(new Color(255, 255, 255));
  642.       var3.fillRect(0, 0, var1, var2);
  643.       var3.setColor(this.indArrowColor);
  644.       int var4 = 0;
  645.       int var5 = var2 - 1;
  646.       int var6 = 6;
  647.  
  648.       do {
  649.          var3.drawLine(var4, var5, var4 + var6, var5);
  650.          --var5;
  651.          ++var4;
  652.          var6 -= 2;
  653.       } while(var6 >= 0);
  654.  
  655.    }
  656.  
  657.    public void initSpecifics() {
  658.       this.max_string_width = 0;
  659.       boolean var2 = false;
  660.       this.num_descrips = super.spe_pv.size();
  661.       this.m_desc = new String[this.num_descrips];
  662.       this.m_iconid = new int[this.num_descrips];
  663.       this.item_h = new int[this.num_descrips];
  664.       this.item_y = new int[this.num_descrips];
  665.       this.save_iposx = new int[this.num_descrips];
  666.       this.save_iposy = new int[this.num_descrips];
  667.       this.save_iposw = new int[this.num_descrips];
  668.       this.save_iposh = new int[this.num_descrips];
  669.  
  670.       for(int var4 = 0; var4 < this.num_descrips; ++var4) {
  671.          String var1 = ((OCdg)this).getParameterSpecific("subdesc", var4);
  672.          if (var1 != null) {
  673.             this.m_desc[var4] = var1;
  674.             if (this.field_0.stringWidth(this.m_desc[var4]) > this.max_string_width) {
  675.                this.max_string_width = this.field_0.stringWidth(this.m_desc[var4]);
  676.             }
  677.          } else {
  678.             this.m_desc[var4] = " ";
  679.          }
  680.  
  681.          var1 = ((OCdg)this).getParameterSpecific("iconid", var4);
  682.          if (var1 != null) {
  683.             this.m_iconid[var4] = Integer.parseInt(var1);
  684.          } else {
  685.             this.m_iconid[var4] = -1;
  686.          }
  687.       }
  688.  
  689.    }
  690.  
  691.    private synchronized void showUpArrows() {
  692.       int var1 = this.aDist + 1 + this.menuwidth;
  693.       super.g_off.setColor(new Color(255, 255, 255));
  694.       super.g_off.fillRect(var1, 0, this.indWidth, super.off.getHeight(this));
  695.       String var2 = ACutila.iface.appinfo.getMLparamObject().getBranchId(ACutila.iface.appinfo.convertTree());
  696.  
  697.       for(int var3 = 0; var3 < this.num_descrips; ++var3) {
  698.          if (ACutila.iface.appinfo.getMLparamObject().isItem(var2 + "-" + var3 + "-0")) {
  699.             super.g_off.drawImage(this.upArrow, var1 + 3, this.bitheight * var3 + (this.bitheight - 4) / 2, this);
  700.          }
  701.       }
  702.  
  703.    }
  704.  
  705.    private void drawMenu() {
  706.       this.max_string_width += this.m_xoffset * 2;
  707.       this.field_0 = ((Component)this).getFontMetrics(this.m_font);
  708.       this.menuwidth = this.max_string_width;
  709.       this.menuheight = this.num_descrips * this.field_0.getHeight();
  710.       this.bitheight = this.field_0.getHeight();
  711.       this.menu = ((Component)this).createImage(this.menuwidth + 1, this.menuheight + 1);
  712.       this.g_menu = this.menu.getGraphics();
  713.       this.g_menu.setFont(this.m_font);
  714.       int var1 = this.menuwidth + 1 + this.aDist;
  715.       if (this.multi_level) {
  716.          var1 += this.indWidth;
  717.       }
  718.  
  719.       super.off = ((Component)this).createImage(var1, this.menuheight + 1);
  720.       super.g_off = super.off.getGraphics();
  721.       super.g_off.setColor(new Color(255, 255, 255));
  722.       super.g_off.fillRect(0, 0, var1, this.menuheight + 1);
  723.       this.g_menu.setColor(this.m_menucolor);
  724.       this.g_menu.fillRect(0, 0, this.menuwidth, this.menuheight);
  725.  
  726.       for(int var2 = 0; var2 < this.num_descrips; ++var2) {
  727.          this.g_menu.setColor(this.m_outline_color);
  728.          this.g_menu.drawRect(0, this.bitheight * var2, this.max_string_width, this.field_0.getHeight());
  729.          this.g_menu.setColor(this.m_textcolor);
  730.          this.g_menu.drawString(this.m_desc[var2], this.m_xoffset, this.bitheight * var2 + this.field_0.getHeight() - this.field_0.getDescent());
  731.       }
  732.  
  733.       super.g_off.drawImage(this.menu, this.aDist, 0, this);
  734.       if (this.multi_level) {
  735.          if (this.first_crun) {
  736.             this.drawUpArrow();
  737.          }
  738.  
  739.          this.showUpArrows();
  740.       }
  741.  
  742.    }
  743.  
  744.    private void drawPointer() {
  745.       this.poff = ((Component)this).createImage(this.pwidth, this.pheight);
  746.       this.g_poff = this.poff.getGraphics();
  747.       this.g_poff.setColor(new Color(255, 255, 255));
  748.       this.g_poff.fillRect(0, 0, this.pwidth, this.pheight);
  749.       ACutil var2 = new ACutil();
  750.       Image var1;
  751.       if ((var1 = var2.getImage("acimg/gold_arrow.gif")) != null) {
  752.          this.g_poff.drawImage(var1, 2, 1, this);
  753.       }
  754.  
  755.    }
  756.  
  757.    public void setPointer(int var1) {
  758.       this.curPoint = var1;
  759.       if (!super.first_run) {
  760.          this.showPointer();
  761.          ((OCdg)this).drawAppOff();
  762.          ((OCdg)this).paintIt();
  763.       }
  764.  
  765.    }
  766.  
  767.    private synchronized void showPointer() {
  768.       if (this.curPoint >= 0) {
  769.          int var1 = this.bitheight * this.curPoint + (this.bitheight - this.pheight) / 2;
  770.          int var2 = this.bitheight;
  771.          super.g_off.setColor(new Color(255, 255, 255));
  772.          super.g_off.fillRect(0, 0, this.aDist - 1, super.off.getHeight(this));
  773.          super.g_off.drawImage(this.poff, 0, var1, this);
  774.          int var3 = 0;
  775.          if (super.offimgy + super.scroll_y + var1 >= super.d.height - 5) {
  776.             var3 = -var1;
  777.             if (var2 < super.d.height) {
  778.                var3 = var3 + (super.d.height - var2) - super.sEdge;
  779.             }
  780.  
  781.             ((OCdg)this).setVerticalPagePosition(var3);
  782.          }
  783.  
  784.          if (super.offimgy + super.scroll_y + var1 < 0) {
  785.             ((OCdg)this).setVerticalPagePosition(-var1);
  786.          }
  787.  
  788.       }
  789.    }
  790.  
  791.    public boolean mouseDown(Event var1, int var2, int var3) {
  792.       boolean var4 = false;
  793.       if (var1.modifiers == 4) {
  794.          var4 = true;
  795.       }
  796.  
  797.       this.rmx = super.scroll_x + super.offimgx + this.aDist;
  798.       this.rmy = super.scroll_y + super.offimgy;
  799.       if (var2 > this.rmx && var2 < this.rmx + this.menuwidth + 1 && var3 > this.rmy && var3 < this.rmy + this.menuheight + 1 && this.curHL > -1) {
  800.          ((Component)this).requestFocus();
  801.          super.postEvent(new Event(this, 9202, new Integer(this.curHL)));
  802.          if (var4) {
  803.             PopupMenu var9 = new PopupMenu("pu - dnm - additem");
  804.             MenuItem[] var10 = new MenuItem[]{new MenuItem("Level - Up"), new MenuItem("Level - Down"), new MenuItem("-"), new MenuItem("Edit Text"), new MenuItem("-"), new MenuItem("Add Item"), new MenuItem("Insert Item")};
  805.  
  806.             for(int var7 = 0; var7 < var10.length; ++var7) {
  807.                ((Menu)var9).add(var10[var7]);
  808.             }
  809.  
  810.             if (ACutila.iface.appinfo.cur_tree_level < 2) {
  811.                var10[1].disable();
  812.             }
  813.  
  814.             ((Component)this).add(var9);
  815.             var9.show(this, var2, var3);
  816.             return true;
  817.          }
  818.  
  819.          if (var1.clickCount > 1) {
  820.             String var5 = ACutila.iface.appinfo.getMLparamObject().getBranchId(ACutila.iface.appinfo.convertTree());
  821.             if (ACutila.iface.appinfo.getMLparamObject().isItem(var5 + "-" + this.curHL + "-0")) {
  822.                Event var6 = new Event(this, 960, this);
  823.                var6.id = 1001;
  824.                var6.arg = "Level - Up";
  825.                super.postEvent(var6);
  826.                return true;
  827.             }
  828.          }
  829.  
  830.          if (var1.clickCount > 2 && ACutila.iface.appinfo.cur_tree_level > 1) {
  831.             Event var8 = new Event(this, 960, this);
  832.             var8.id = 1001;
  833.             var8.arg = "Level - Down";
  834.             super.postEvent(var8);
  835.             return true;
  836.          }
  837.       }
  838.  
  839.       return true;
  840.    }
  841.  
  842.    public Image getMenuImage(Image var1, Graphics var2) {
  843.       this.field_0 = ((Component)this).getFontMetrics(this.m_font);
  844.       var2.setFont(this.m_font);
  845.       var2.setColor(this.m_border_color);
  846.       var2.fillRect(0, 0, this.menuwidth, this.menuheight);
  847.       var2.setColor(this.m_menucolor);
  848.       var2.fillRect(this.m_borderwidth_left, this.m_borderheight_top, this.itemwidth, this.itemheight);
  849.       if (this.m_usedivder_topandbottom) {
  850.          var2.setColor(this.m_divider_color);
  851.          var2.fillRect(this.m_borderwidth_left, this.m_borderheight_top, this.itemwidth, this.m_divider_height);
  852.       }
  853.  
  854.       for(int var3 = 0; var3 < this.num_descrips; ++var3) {
  855.          if (var3 != this.num_descrips - 1 || this.m_usedivder_topandbottom) {
  856.             var2.setColor(this.m_divider_color);
  857.             var2.fillRect(this.m_borderwidth_left, this.item_y[var3] + this.bitheight, this.itemwidth, this.m_divider_height);
  858.          }
  859.  
  860.          var2.setColor(this.m_textcolor);
  861.          var2.drawString(this.m_desc[var3], this.m_marginleft + this.m_borderwidth_left, this.item_y[var3] + this.field_0.getHeight() - this.field_0.getDescent() + this.m_margintop);
  862.       }
  863.  
  864.       return var1;
  865.    }
  866.  
  867.    public boolean mouseDownFromDesignGrid(int var1, int var2, OCdgImg var3) {
  868.       this.rmx = var3.sub_posx[this.level] + var3.scroll_x;
  869.       this.rmy = var3.sub_posy[this.level] + var3.scroll_y;
  870.  
  871.       for(int var4 = 0; var4 < this.num_descrips; ++var4) {
  872.          if (this.save_iposw[var4] > -1 && var1 > this.save_iposx[var4] + this.rmx && var2 > this.save_iposy[var4] + this.rmy && var1 < this.save_iposx[var4] + this.rmx + this.save_iposw[var4] && var2 < this.save_iposy[var4] + this.rmy + this.save_iposh[var4]) {
  873.             return true;
  874.          }
  875.       }
  876.  
  877.       return false;
  878.    }
  879.  
  880.    private void hlMenuItem(int var1) {
  881.       super.g_off.setColor(new Color(102, 102, 102));
  882.       super.g_off.fillRect(this.aDist + 1, var1 * this.bitheight + 1, this.menuwidth - 1, this.bitheight - 1);
  883.       super.g_off.setColor(new Color(255, 255, 153));
  884.       super.g_off.drawString(this.m_desc[var1], this.m_xoffset + this.aDist, var1 * this.bitheight + this.field_0.getHeight() - this.field_0.getDescent());
  885.    }
  886.  
  887.    public void setLevelColors(String[] var1, String[] var2) {
  888.       super.def_pn = var1;
  889.       super.def_pv = var2;
  890.       String var3 = ((OCdg)this).getParameterDefault("menucolor");
  891.       if (var3 != null && !var3.equalsIgnoreCase("<default>")) {
  892.          this.m_menucolor = occcolor.ConvertColor(var3);
  893.       }
  894.  
  895.       var3 = ((OCdg)this).getParameterDefault("menutextcolor");
  896.       if (var3 != null && !var3.equalsIgnoreCase("<default>")) {
  897.          this.m_textcolor = occcolor.ConvertColor(var3);
  898.       }
  899.  
  900.       var3 = ((OCdg)this).getParameterDefault("menuoutlinecolor");
  901.       if (var3 != null && !var3.equalsIgnoreCase("<default>")) {
  902.          this.m_outline_color = occcolor.ConvertColor(var3);
  903.       }
  904.  
  905.    }
  906.  
  907.    private void undohlMenuItem() {
  908.       super.g_off.drawImage(this.menu, this.aDist, 0, this);
  909.    }
  910.  
  911.    public Image getMenuImageIcon(Image var1, Graphics var2) {
  912.       for(int var3 = 0; var3 < this.num_descrips; ++var3) {
  913.          int var4 = this.m_iconid[var3];
  914.          if (var4 > -1 && this.iconimage_status[var4]) {
  915.             int var5 = this.m_iconimage[var4].getHeight(this);
  916.             int var6 = this.m_iconimage[var4].getWidth(this);
  917.             int var7 = (this.item_h[var3] - var5) / 2 + this.item_y[var3] + this.icon_yoff;
  918.             int var8 = this.icon_xoff + this.m_borderwidth_left;
  919.             if (this.m_icon_align.equalsIgnoreCase("right")) {
  920.                var8 = var8 + this.itemwidth - var6;
  921.             }
  922.  
  923.             this.drag_iposx = this.icon_xoff;
  924.             this.drag_iposy = this.icon_yoff;
  925.             this.init_dragx = this.drag_iposx;
  926.             this.init_dragy = this.drag_iposy;
  927.             this.save_iposx[var3] = var8;
  928.             this.save_iposy[var3] = var7;
  929.             this.save_iposw[var3] = var6;
  930.             this.save_iposh[var3] = var5;
  931.             var2.drawImage(this.m_iconimage[var4], var8, var7, this);
  932.          } else {
  933.             this.save_iposx[var3] = -1;
  934.             this.save_iposy[var3] = -1;
  935.             this.save_iposw[var3] = -1;
  936.             this.save_iposh[var3] = -1;
  937.          }
  938.       }
  939.  
  940.       return var1;
  941.    }
  942. }
  943.