home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Event;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Image;
-
- public class OCdgTextmlh extends OCdg {
- private boolean first_crun = true;
- private int m_yoffset = 5;
- private int m_xoffset = 5;
- private Font m_font;
- private int m_def_align = 0;
- private Color m_def_textcolor;
- private Color m_bgcolor;
- private Color m_hlcolor;
- private int[] m_size_pause;
- private Font[] m_cur_font;
- private boolean[] m_size_extra;
- private Color[] m_textcolor;
- private String[] m_desc;
- private int[] m_align;
- private int max_d;
- // $FF: renamed from: bo int
- private int field_0;
- private int num_descrips;
- private int i_h;
- // $FF: renamed from: fm java.awt.FontMetrics
- private FontMetrics field_1;
- private int num_links;
- private int[] link_cords;
- private String[] link_urls;
- private int[] line_coords;
- private int[] re_draw;
- private int hLine;
- private Color indArrowColor;
- private Image indArrow;
- private int aDist;
- private int curPoint;
-
- public boolean mouseExit(Event var1, int var2, int var3) {
- if (this.hLine != -1) {
- this.method_0(this.hLine, this.m_textcolor[this.hLine]);
- this.hLine = -1;
- }
-
- return true;
- }
-
- public void DrawApplet() {
- this.drawScroll();
- if (this.first_crun) {
- this.drawArrow();
- this.setPointer(ACutila.iface.appinfo.cur_spec_index);
- this.showPointer();
- this.first_crun = false;
- }
-
- }
-
- public OCdgTextmlh() {
- this.m_def_textcolor = Color.black;
- this.m_bgcolor = Color.white;
- this.m_hlcolor = Color.red;
- this.hLine = -1;
- this.indArrowColor = new Color(204, 0, 0);
- this.aDist = 8;
- this.curPoint = 0;
- }
-
- public void initDefault() {
- String var1 = ((OCdg)this).getParameterDefault("font");
- if (var1 != null) {
- this.m_font = ocfontc.getFontSD(var1, ",");
- } else {
- this.m_font = new Font("Helvetica", 0, 12);
- }
-
- var1 = ((OCdg)this).getParameterDefault("textcolor");
- if (var1 != null) {
- this.m_def_textcolor = occcolor.ConvertColor(var1);
- }
-
- var1 = ((OCdg)this).getParameterDefault("bgcolor");
- if (var1 != null) {
- this.m_bgcolor = occcolor.ConvertColor(var1);
- }
-
- var1 = ((OCdg)this).getParameterDefault("hlcolor");
- if (var1 != null) {
- this.m_hlcolor = occcolor.ConvertColor(var1);
- }
-
- var1 = ((OCdg)this).getParameterDefault("yoffset");
- if (var1 != null) {
- this.m_yoffset = Integer.parseInt(var1);
- }
-
- var1 = ((OCdg)this).getParameterDefault("valign");
- if (var1 != null) {
- this.m_def_align = Integer.parseInt(var1);
- }
-
- var1 = ((OCdg)this).getParameterDefault("pausemargin");
- if (var1 != null) {
- this.m_xoffset = Integer.parseInt(var1);
- }
-
- }
-
- private void drawArrow() {
- byte var1 = 7;
- byte var2 = 5;
- this.indArrow = ((Component)this).createImage(var1, var2);
- Graphics var3 = this.indArrow.getGraphics();
- var3.setColor(new Color(153, 153, 153));
- var3.fillRect(0, 0, var1, var2);
- var3.setColor(this.indArrowColor);
- int var4 = 0;
- int var5 = 0;
- int var6 = 6;
-
- do {
- var3.drawLine(var4, var5, var4 + var6, var5);
- ++var5;
- ++var4;
- var6 -= 2;
- } while(var6 >= 0);
-
- }
-
- public void initSpecifics() {
- boolean var2 = false;
- this.num_descrips = super.spe_pv.size();
- this.m_cur_font = new Font[this.num_descrips];
- this.m_textcolor = new Color[this.num_descrips];
- this.m_desc = new String[this.num_descrips];
- this.m_align = new int[this.num_descrips];
- this.m_size_pause = new int[this.num_descrips];
- this.m_size_extra = new boolean[this.num_descrips];
- this.line_coords = new int[this.num_descrips];
- this.re_draw = new int[this.num_descrips];
-
- for(int var7 = 0; var7 < this.num_descrips; ++var7) {
- String var1 = ((OCdg)this).getParameterSpecific("desc", var7);
- if (var1 != null) {
- this.m_desc[var7] = var1;
- } else {
- this.m_desc[var7] = " ";
- }
-
- var1 = ((OCdg)this).getParameterSpecific("font", var7);
- if (var1 != null) {
- this.m_cur_font[var7] = ocfontc.getFontSD(var1, ",");
- } else {
- this.m_cur_font[var7] = this.m_font;
- }
-
- var1 = ((OCdg)this).getParameterSpecific("align", var7);
- if (var1 != null) {
- this.m_align[var7] = Integer.parseInt(var1);
- } else {
- this.m_align[var7] = this.m_def_align;
- }
-
- var1 = ((OCdg)this).getParameterSpecific("textcolor", var7);
- if (var1 != null) {
- this.m_textcolor[var7] = occcolor.ConvertColor(var1);
- } else {
- this.m_textcolor[var7] = this.m_def_textcolor;
- }
-
- var1 = ((OCdg)this).getParameterSpecific("sizepause", var7);
- if (var1 != null) {
- this.m_size_pause[var7] = Integer.parseInt(var1);
- } else {
- this.m_size_pause[var7] = 0;
- }
- }
-
- this.link_cords = new int[this.num_descrips * 3];
- this.link_urls = new String[this.num_descrips];
- }
-
- public void setPointer(int var1) {
- this.curPoint = var1;
- if (!super.first_run) {
- this.showPointer();
- ((OCdg)this).drawAppOff();
- ((OCdg)this).paintIt();
- }
-
- }
-
- private void drawScroll() {
- int var1 = 0;
- int var2 = 0;
- int var3 = 0;
- int var4 = 0;
- boolean var5 = false;
- Image var6 = null;
- Graphics var7 = null;
- int var8 = 0;
-
- do {
- var1 = 0;
- var4 = 0;
-
- for(int var9 = 0; var9 < this.num_descrips; ++var9) {
- if (var8 != 0) {
- var7.setFont(this.m_cur_font[var9]);
- this.field_1 = var7.getFontMetrics(this.m_cur_font[var9]);
- var2 = var1;
- if (this.m_size_pause[var9] == 1) {
- var4 = var1;
- var5 = true;
- } else if (!var5) {
- var4 = var1;
- }
-
- this.line_coords[var9] = var1 - this.m_xoffset;
- var1 += this.field_1.stringWidth(this.m_desc[var9]);
- var7.setColor(this.m_textcolor[var9]);
- var7.drawString(this.m_desc[var9], var2 + this.m_xoffset, super.appHeight - this.max_d - this.m_yoffset);
- this.link_cords[var3 * 3] = var2 + this.m_xoffset;
- this.link_cords[var3 * 3 + 1] = var1 + this.m_xoffset;
- this.link_cords[var3 * 3 + 2] = var9;
- ++var3;
- if (var1 - var4 < super.appWidth && this.m_size_pause[var9] == 2) {
- var1 = var1 + (super.appWidth - (var1 - var4)) + 1;
- var5 = false;
- }
- } else {
- this.field_1 = ((Component)this).getFontMetrics(this.m_cur_font[var9]);
- if (this.m_size_pause[var9] == 1) {
- var4 = var1;
- var5 = true;
- } else if (!var5) {
- var4 = var1;
- }
-
- var1 += this.field_1.stringWidth(this.m_desc[var9]);
- if (this.field_1.getDescent() > this.max_d) {
- this.max_d = this.field_1.getDescent();
- }
-
- if (var9 != this.m_desc.length - 1) {
- if (this.m_size_pause[var9] == 2 && var1 - var4 < super.appWidth) {
- var1 = var1 + (super.appWidth - (var1 - var4)) + 1;
- var5 = false;
- }
- } else {
- this.i_h = var1 + 5;
- double var10 = (double)this.i_h;
- double var12 = (double)super.appWidth;
- int var14 = 0;
- if (var10 / var12 - (double)((int)(var10 / var12)) == (double)0.0F) {
- var14 = (int)(var10 / var12);
- } else {
- var14 = (int)(var10 / var12) + 1;
- }
-
- this.i_h = var14 * super.appWidth;
- if (var14 > 1) {
- this.field_0 = 7;
- } else {
- this.field_0 = 0;
- }
-
- int var15 = this.i_h;
- int var16 = super.appHeight + this.field_0;
- var6 = ((Component)this).createImage(this.i_h, super.appHeight);
- var7 = var6.getGraphics();
- super.off = ((Component)this).createImage(var15, var16 + this.aDist);
- super.g_off = super.off.getGraphics();
- super.g_off.setColor(new Color(153, 153, 153));
- super.g_off.fillRect(0, 0, var15, var16 + this.aDist);
- var7.setColor(this.m_bgcolor);
- var7.fillRect(0, 0, this.i_h, super.appHeight);
- if (var14 > 1) {
- Image var17 = ((Component)this).createImage(this.i_h, this.field_0);
- Graphics var18 = var17.getGraphics();
- var18.setColor(new Color(153, 153, 153));
- var18.fillRect(0, 0, this.i_h, this.field_0);
- var18.setColor(Color.black);
-
- for(int var19 = 0; var19 <= var14 - 1; ++var19) {
- var18.drawLine(var19 * super.appWidth, 2, var19 * super.appWidth, 5);
- }
-
- var18.drawLine(var14 * super.appWidth - 1, 2, var14 * super.appWidth - 1, 5);
- var18.drawLine(0, 2, this.i_h, 2);
- super.g_off.drawImage(var17, 0, this.aDist + super.appHeight, this);
- }
- }
- }
- }
-
- ++var8;
- } while(var8 < 2);
-
- super.g_off.drawImage(var6, 0, this.aDist, this);
- }
-
- private synchronized void showPointer() {
- if (this.curPoint >= 0) {
- int var1 = this.link_cords[this.curPoint * 3];
- int var2 = this.link_cords[this.curPoint * 3 + 1] - var1;
- super.g_off.setColor(new Color(153, 153, 153));
- super.g_off.fillRect(0, 0, super.actAppWidth, this.aDist);
- super.g_off.drawImage(this.indArrow, var1, 0, this);
- int var3 = 0;
- if (super.offimgx + super.scroll_x + var1 >= super.d.width - 5) {
- var3 = -var1;
- if (var2 < super.d.width) {
- var3 = var3 + (super.d.width - var2) - super.sEdge;
- }
-
- ((OCdg)this).setHorizontalPagePosition(var3);
- }
-
- if (super.offimgx + super.scroll_x + var1 < 0) {
- ((OCdg)this).setHorizontalPagePosition(-var1 + super.sEdge);
- }
-
- }
- }
-
- public boolean mouseDown(Event var1, int var2, int var3) {
- ((Component)this).requestFocus();
- if (this.hLine > -1) {
- super.postEvent(new Event(this, 9202, new Integer(this.hLine)));
- }
-
- return true;
- }
-
- // $FF: renamed from: HL (int, java.awt.Color) void
- private void method_0(int var1, Color var2) {
- super.g_off.setFont(this.m_cur_font[var1]);
- this.field_1 = super.g_off.getFontMetrics(this.m_cur_font[var1]);
- super.g_off.setColor(var2);
- super.g_off.drawString(this.m_desc[var1], this.link_cords[var1 * 3], super.appHeight - this.max_d - this.m_yoffset + this.aDist);
- ((OCdg)this).drawAppOff();
- ((OCdg)this).paintIt();
- }
-
- public boolean mouseMove(Event var1, int var2, int var3) {
- int var4 = super.scroll_x + super.offimgx;
- int var5 = super.scroll_y + super.offimgy + this.aDist;
- if (var2 > var4 && var2 < var4 + super.actAppWidth && var3 > var5 && var3 < var5 + super.appHeight) {
- for(int var6 = 0; var6 < this.num_descrips; ++var6) {
- if (var2 > var4 + this.link_cords[var6 * 3] && var2 < var4 + this.link_cords[var6 * 3 + 1]) {
- int var7 = this.link_cords[var6 * 3 + 2];
- if (var7 != this.hLine) {
- if (this.hLine != -1) {
- this.method_0(this.hLine, this.m_textcolor[this.hLine]);
- this.hLine = -1;
- }
-
- this.method_0(var7, this.m_hlcolor);
- }
-
- this.hLine = var7;
- return true;
- }
- }
-
- if (this.hLine != -1) {
- this.method_0(this.hLine, this.m_textcolor[this.hLine]);
- this.hLine = -1;
- }
- } else if (this.hLine != -1) {
- this.method_0(this.hLine, this.m_textcolor[this.hLine]);
- this.hLine = -1;
- }
-
- return true;
- }
- }
-