home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Canvas;
- 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.Rectangle;
- import java.util.StringTokenizer;
-
- class imgarea extends Canvas {
- // $FF: renamed from: c1 java.awt.Color
- Color field_0;
- // $FF: renamed from: c2 java.awt.Color
- Color field_1;
- long entered;
- long inComponent;
- Font font;
- // $FF: renamed from: fm java.awt.FontMetrics
- FontMetrics field_2;
- coolmap m_parent;
- int maxNumArea;
- int[] hotPointX;
- int[] hotPointY;
- int hintX;
- int hintY;
- hintpot[] HotAreas;
- int iMaxHotArea;
- String szLastStatus;
- boolean bStatusChanged;
- String szHintText;
- boolean bHintVisible;
- boolean bHintChanged;
- int hintWidth;
- int hintTextHeigth;
- String[] hintLines;
- int lastHintLine;
- int makeStatic;
- int selHotAreaIndex;
- int preHotAreaIndex;
- String mmm;
- // $FF: renamed from: lx int
- int field_3;
- // $FF: renamed from: ly int
- int field_4;
- // $FF: renamed from: lw int
- int field_5;
- // $FF: renamed from: lh int
- int field_6;
- // $FF: renamed from: x0 int
- int field_7;
- // $FF: renamed from: y0 int
- int field_8;
- // $FF: renamed from: x1 int
- int field_9;
- // $FF: renamed from: y1 int
- int field_10;
- // $FF: renamed from: gg java.awt.Graphics
- Graphics field_11;
- // $FF: renamed from: ff java.awt.FontMetrics
- FontMetrics field_12;
- int fontHeight;
-
- public imgarea(coolmap var1, Rectangle var2) {
- this.field_0 = Color.pink;
- this.field_1 = Color.lightGray;
- this.font = new Font("Courier", 1, 12);
- this.maxNumArea = 50;
- this.iMaxHotArea = -1;
- this.szLastStatus = "";
- this.bStatusChanged = false;
- this.szHintText = "";
- this.bHintVisible = false;
- this.bHintChanged = false;
- this.hintWidth = 90;
- this.hintTextHeigth = 5;
- this.hintLines = new String[50];
- this.lastHintLine = -1;
- this.selHotAreaIndex = -1;
- this.preHotAreaIndex = -1;
- this.mmm = "nnn";
- this.fontHeight = 10;
- ((Component)this).reshape(var2.x, var2.y, var2.width, var2.height);
- this.m_parent = var1;
- this.HotAreas = new hintpot[this.maxNumArea];
- this.hotPointX = new int[100];
- this.hotPointY = new int[100];
- boolean var3 = false;
-
- int var4;
- for(var4 = -1; !var3; var3 = (this.HotAreas[var4] = this.HotAreaFromParam(var4 + 1)) == null) {
- ++var4;
- }
-
- this.iMaxHotArea = var4 - 1;
- }
-
- public int inWhichArea(int var1, int var2) {
- for(int var3 = 0; var3 <= this.iMaxHotArea; ++var3) {
- if (this.HotAreas[var3].polyMyArea.inside(var1, var2)) {
- return var3;
- }
- }
-
- return -1;
- }
-
- public void loadAudioFiles() {
- for(int var1 = 0; var1 <= this.iMaxHotArea; ++var1) {
- if (this.HotAreas[var1].auSourceName != null) {
- if (this.m_parent.m_common.whichBase == 0) {
- this.HotAreas[var1].auSource = this.m_parent.getAudioClip(this.m_parent.getDocumentBase(), this.HotAreas[var1].auSourceName);
- } else {
- this.HotAreas[var1].auSource = this.m_parent.getAudioClip(this.m_parent.getCodeBase(), this.HotAreas[var1].auSourceName);
- }
- }
- }
-
- }
-
- public void updateHotList() {
- for(int var1 = 0; var1 <= this.iMaxHotArea; ++var1) {
- if (!this.HotAreas[var1].bUsed && var1 + 1 <= this.iMaxHotArea) {
- for(int var2 = var1; var2 < this.iMaxHotArea; ++var2) {
- this.HotAreas[var1].copy(this.HotAreas[var1 + 1]);
- this.HotAreas[var1].bUsed = true;
- this.HotAreas[var1 + 1].bUsed = false;
- }
- break;
- }
- }
-
- --this.iMaxHotArea;
- }
-
- public boolean mouseDown(Event var1, int var2, int var3) {
- if (this.m_parent.mapMode == 0 && this.m_parent.editState == 1) {
- this.field_11 = ((Component)this).getGraphics();
- this.field_11.setColor(Color.black);
- this.field_11.setXORMode(Color.yellow);
- if (this.m_parent.currentPoint == 0 && this.m_parent.editState == 1) {
- this.field_7 = var2;
- this.field_8 = var3;
- this.field_9 = var2;
- this.field_10 = var3;
- this.hotPointX[this.m_parent.currentPoint] = var2;
- this.hotPointY[this.m_parent.currentPoint] = var3;
- ++this.m_parent.currentPoint;
- this.selHotAreaIndex = -100;
- }
- } else {
- this.preHotAreaIndex = this.selHotAreaIndex;
- this.selHotAreaIndex = this.inWhichArea(var2, var3);
- this.paint(((Component)this).getGraphics());
- this.m_parent.update_applet();
- }
-
- return true;
- }
-
- public boolean mouseMove(Event var1, int var2, int var3) {
- if (this.m_parent.mapMode == 1) {
- this.DoMouseMove(this.m_parent.gcOn, var1, var2, var3);
- }
-
- return true;
- }
-
- public boolean mouseDrag(Event var1, int var2, int var3) {
- if (this.m_parent.mapMode == 0 && this.m_parent.editState == 1) {
- this.field_11.drawLine(this.field_7, this.field_8, this.field_9, this.field_10);
- this.field_9 = var2;
- this.field_10 = var3;
- this.field_11.drawLine(this.field_7, this.field_8, this.field_9, this.field_10);
- }
-
- return true;
- }
-
- public boolean mouseUp(Event var1, int var2, int var3) {
- this.m_parent.mapImageArea.makeStatic = 0;
- if (this.m_parent.mapMode == 0 && this.m_parent.editState == 1) {
- this.field_11.drawLine(this.field_7, this.field_8, this.field_9, this.field_10);
- this.field_9 = var2;
- this.field_10 = var3;
- this.field_11.setPaintMode();
- this.field_11.drawLine(this.field_7, this.field_8, this.field_9, this.field_10);
- this.field_7 = var2;
- this.field_8 = var3;
- this.hotPointX[this.m_parent.currentPoint] = var2;
- this.hotPointY[this.m_parent.currentPoint] = var3;
- ++this.m_parent.currentPoint;
- this.m_parent.update_applet();
- } else if (this.m_parent.mapMode == 1) {
- this.DoMouseUp(var1, var2, var3);
- this.m_parent.update_applet();
- }
-
- return true;
- }
-
- public boolean mouseExit(Event var1, int var2, int var3) {
- if (this.m_parent.mapMode == 1) {
- this.DoMouseExit(var1, var2, var3);
- }
-
- this.m_parent.m_common.setTheCursor(0);
- return true;
- }
-
- public boolean mouseEnter(Event var1, int var2, int var3) {
- return true;
- }
-
- public void paint(Graphics var1) {
- boolean var2 = this.m_parent.gcOn == null;
- this.m_parent.gcOn = ((Component)this).getGraphics();
- this.m_parent.gcOn.setFont(new Font("TimesRoman", 1, this.fontHeight));
- this.field_12 = this.m_parent.gcOn.getFontMetrics();
- this.hintTextHeigth = this.field_12.getHeight();
- if (var2) {
- Event var3 = new Event(this.m_parent.modeBox[1], 1001, (Object)null);
- ((Component)this).postEvent(var3);
- }
-
- this.m_parent.maintainStaticImages();
- this.m_parent.copyOfftoOn();
- this.m_parent.update_applet();
- if (this.makeStatic > 0) {
- this.paintTips(var1, false);
- }
-
- }
-
- public void update(Graphics var1) {
- this.paint(var1);
- }
-
- public void setStatusText(String var1, boolean var2) {
- if (var2) {
- this.m_parent.showStatus(var1);
- this.szLastStatus = var1;
- } else {
- if (this.szLastStatus.equals(var1)) {
- this.szLastStatus = "";
- this.m_parent.showStatus("");
- }
-
- }
- }
-
- public void setNewHintText(String var1) {
- this.bHintVisible |= true;
- if (var1 == null) {
- if (this.szHintText != null) {
- this.bHintChanged = true;
- }
-
- this.szHintText = null;
- } else {
- if (!var1.equals(this.szHintText)) {
- this.bHintChanged = true;
- this.szHintText = var1;
- }
-
- }
- }
-
- private hintpot HotAreaFromParam(int var1) {
- Object var2 = null;
- String var3 = this.m_parent.getParameter("hot_area" + var1);
- if (var3 == null) {
- return null;
- } else {
- hintpot var4 = new hintpot(var3, this);
- return !var4.bInitialised ? null : var4;
- }
- }
-
- public boolean DoMouseUp(Event var1, int var2, int var3) {
- boolean var4 = false;
-
- for(int var5 = 0; var5 <= this.iMaxHotArea; ++var5) {
- this.HotAreas[var5].MouseUp(var2, var3);
- }
-
- return true;
- }
-
- public boolean DoMouseMove(Graphics var1, Event var2, int var3, int var4) {
- this.bHintVisible = false;
- this.bHintChanged = false;
- int var5 = 0;
- if (this.m_parent.mapMode == 1) {
- this.m_parent.mapImageArea.selHotAreaIndex = -1;
- }
-
- for(var5 = 0; var5 <= this.iMaxHotArea && !this.HotAreas[var5].MouseMove(var3, var4, var5); ++var5) {
- }
-
- if (var5 > this.iMaxHotArea && this.m_parent.mapImageArea.selHotAreaIndex == -1) {
- this.m_parent.mapImageArea.selHotAreaIndex = -400;
- this.m_parent.gcOff.drawImage(this.m_parent.m_common.bufBK, 0, 0, this);
- this.m_parent.gcOff.drawImage(this.m_parent.mapImage, this.m_parent.mapArea.x, this.m_parent.mapArea.y, this);
- this.m_parent.copyOfftoOn();
- }
-
- this.hintX = var3;
- this.hintY = var4;
- this.paintTips(var1, false);
- return true;
- }
-
- public void parseHint() {
- if (this.field_12 != null) {
- StringTokenizer var3 = new StringTokenizer(this.insertSpace(this.szHintText), " ", false);
- this.hintLines[0] = this.szHintText;
- String var2 = "";
- this.lastHintLine = -1;
-
- while(var3.hasMoreTokens()) {
- String var1;
- try {
- var1 = var3.nextToken();
- } catch (Exception var4) {
- break;
- }
-
- if (this.field_12.stringWidth(var2 + var1) > this.hintWidth - 50) {
- this.hintLines[++this.lastHintLine] = var2;
- var2 = this.lTrim(var1);
- } else {
- var2 = var2 + " " + var1;
- }
- }
-
- this.hintLines[++this.lastHintLine] = var2;
- }
- }
-
- public String insertSpace(String var1) {
- String var3 = "";
- String var4 = "";
- String var5 = "";
-
- for(int var2 = 0; var2 < var1.length() - 1; ++var2) {
- var4 = var1.substring(var2, var2 + 1);
- var5 = var1.substring(var2 + 1, var2 + 2);
- var3 = var3 + var4;
- if (this.IsPong(var4) && !this.IsPong(var5) && !var1.substring(var2, var2 + 1).equals(" ")) {
- var3 = var3 + " ";
- }
- }
-
- var3 = var3 + var5;
- return var3;
- }
-
- public String lTrim(String var1) {
- String var3 = "";
-
- for(int var2 = 0; var2 < var1.length(); ++var2) {
- var3 = var1.substring(var2, var2 + 1);
- if (!var3.equals(" ")) {
- return var1.substring(var2, var1.length());
- }
- }
-
- return "";
- }
-
- public boolean IsPong(String var1) {
- return var1.equals(",") || var1.equals(".") || var1.equals("?") || var1.equals("!") || var1.equals(";") || var1.equals(":");
- }
-
- public boolean DoMouseExit(Event var1, int var2, int var3) {
- this.setStatusText("", true);
- this.setNewHintText((String)null);
- this.m_parent.m_common.setTheCursor(0);
- this.m_parent.copyOfftoOn();
- return true;
- }
-
- public void paintHotArea(Graphics var1, boolean var2, Color var3) {
- if (this.m_parent.mapMode == 0) {
- if (var2) {
- var1.setXORMode(Color.blue);
-
- for(int var4 = 0; var4 <= this.iMaxHotArea; ++var4) {
- var1.fillPolygon(this.HotAreas[var4].polyMyArea);
- }
-
- var1.setPaintMode();
- }
-
- if (this.selHotAreaIndex >= 0 && this.selHotAreaIndex <= this.iMaxHotArea) {
- var1.setColor(var3);
- var1.drawPolygon(this.HotAreas[this.selHotAreaIndex].polyMyArea);
- return;
- }
- } else if (this.selHotAreaIndex >= 0 && this.selHotAreaIndex <= this.iMaxHotArea) {
- var1.setColor(var3);
- var1.drawPolygon(this.HotAreas[this.selHotAreaIndex].polyMyArea);
- }
-
- }
-
- public void paintTips(Graphics var1, boolean var2) {
- if (!this.bHintVisible && this.makeStatic == 0 && !var2) {
- this.setNewHintText((String)null);
- this.m_parent.m_common.setTheCursor(0);
- }
-
- if (this.m_parent.tipsOn != 0) {
- if (this.bHintChanged || this.makeStatic > 0 || var2) {
- this.bHintVisible = false;
- if (!var2) {
- this.m_parent.copyOfftoOn();
- }
-
- this.bHintVisible = true;
- if (this.szHintText != null || var2) {
- if (((Component)this).size().width - this.hintX < this.hintWidth) {
- this.hintX = ((Component)this).size().width - this.hintWidth - 10;
- }
-
- if (((Component)this).size().height - this.hintY < this.hintTextHeigth * (this.lastHintLine + 1)) {
- int var10002 = this.hintTextHeigth * (this.lastHintLine + 1);
- this.hintY = ((Component)this).size().height - var10002 - 10;
- }
-
- if (this.hintX < 0) {
- this.hintX = 0;
- }
-
- if (this.hintY < 0) {
- this.hintY = 0;
- }
-
- if (this.makeStatic > 0) {
- var1.setColor(Color.red);
- this.hintX = (((Component)this).size().width - this.hintWidth) / 2;
- this.hintY = (((Component)this).size().height - this.hintTextHeigth) / 2;
- } else {
- var1.setColor(Color.yellow);
- }
-
- var1.fillRect(this.hintX + 3, this.hintY + 3, this.hintWidth, this.hintTextHeigth * (this.lastHintLine + 1) + 10);
- if (this.makeStatic > 0) {
- var1.setColor(Color.yellow);
- } else {
- var1.setColor(Color.black);
- }
-
- var1.drawRect(this.hintX + 3, this.hintY + 3, this.hintWidth, this.hintTextHeigth * (this.lastHintLine + 1) + 10);
-
- for(int var3 = 0; var3 <= this.lastHintLine; ++var3) {
- var1.drawString(this.hintLines[var3], this.hintX + 8, this.hintY + this.hintTextHeigth * (var3 + 1) + 3);
- }
- }
- }
-
- }
- }
- }
-