home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.Event;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.LayoutManager;
-
- public class OCdgImgSub extends OCdg {
- Dimension menud;
- private boolean movingImage;
- private boolean movingSub;
- private boolean subOn;
- int oldx;
- int oldy;
- Event the_e;
- Font font;
- // $FF: renamed from: fm java.awt.FontMetrics
- FontMetrics field_0;
- Image suboff;
- Graphics g_suboff;
- int break_hl;
- int break_stand;
- int font_style = 0;
- int menux;
- int menuy;
- int menuwidth;
- int menuheight;
- int bitheight;
- int on_sub_num = 0;
- int last_sub;
- boolean sub_highlighted = false;
- boolean[] hlimg_status;
- boolean[] simg_status;
- private Color m_bgcolor;
- private String[] m_imagefile;
- private String[] m_switchfile;
- private int[] m_pic_xcord;
- private int[] m_pic_ycord;
- private int[] m_menu_xcord;
- private int[] m_menu_ycord;
- private String[][] m_desc;
- private String m_bgimage;
- private int m_bgx;
- private int m_bgy;
- int manip_image;
- int num_images;
- int[] pic_width;
- int[] pic_height;
- int[] max_string_width;
- Image[] s_picture;
- Image[] h_picture;
- Image bg_picture;
- APInfo appinfo;
- OCmsl subs;
-
- private void moveImage(int var1, int var2) {
- this.m_pic_ycord[this.manip_image] -= this.oldy - var2;
- this.m_pic_xcord[this.manip_image] -= this.oldx - var1;
- this.reDraw();
- this.the_e.id = 9301;
- this.the_e.arg = "X: " + (new Integer(this.m_pic_xcord[this.manip_image])).toString() + ", Y: " + (new Integer(this.m_pic_ycord[this.manip_image])).toString();
- super.postEvent(this.the_e);
- ((OCdg)this).drawAppOff();
- ((OCdg)this).paintIt();
- }
-
- private void moveSub(int var1, int var2) {
- this.m_menu_ycord[this.manip_image] -= this.oldy - var2;
- this.m_menu_xcord[this.manip_image] -= this.oldx - var1;
- this.reDraw();
- this.the_e.id = 9301;
- this.the_e.arg = "X: " + (new Integer(this.m_menu_xcord[this.manip_image])).toString() + ", Y: " + (new Integer(this.m_menu_ycord[this.manip_image])).toString();
- super.postEvent(this.the_e);
- ((OCdg)this).drawAppOff();
- ((OCdg)this).paintIt();
- }
-
- public void reDraw() {
- super.g_off.setColor(this.m_bgcolor);
- super.g_off.fillRect(0, 0, super.appWidth, super.appHeight);
- if (this.bg_picture != null) {
- super.g_off.drawImage(this.bg_picture, this.m_bgx, this.m_bgy, this);
- }
-
- for(int var1 = 0; var1 < this.num_images; ++var1) {
- if (this.simg_status[var1]) {
- super.g_off.drawImage(this.s_picture[var1], this.m_pic_xcord[var1], this.m_pic_ycord[var1], this);
- }
- }
-
- if (this.manip_image > -1) {
- super.g_off.setColor(ACutil.invertColor(this.m_bgcolor));
- super.g_off.drawRect(this.m_pic_xcord[this.manip_image] - 2, this.m_pic_ycord[this.manip_image] - 2, this.pic_width[this.manip_image] + 3, this.pic_height[this.manip_image] + 3);
- }
-
- if (this.subOn) {
- this.drawSub();
- }
-
- }
-
- OCdgImgSub(APInfo var1) {
- this.m_bgcolor = Color.black;
- this.manip_image = -1;
- this.num_images = 0;
- this.appinfo = var1;
- this.the_e = new Event(this, 960, this);
- ((Container)this).setLayout((LayoutManager)null);
- this.subs = new OCmsl(true);
- }
-
- public void DrawApplet() {
- this.setUpGraphics();
- ACutil var1 = new ACutil();
- if ((this.bg_picture = var1.getImage(this.m_bgimage)) != null) {
- super.g_off.drawImage(this.bg_picture, this.m_bgx, this.m_bgy, this);
- }
-
- for(int var2 = 0; var2 < this.num_images; ++var2) {
- if ((this.s_picture[var2] = var1.getImage(this.m_imagefile[var2])) != null) {
- this.simg_status[var2] = true;
- super.g_off.drawImage(this.s_picture[var2], this.m_pic_xcord[var2], this.m_pic_ycord[var2], this);
- this.pic_width[var2] = this.s_picture[var2].getWidth(this);
- this.pic_height[var2] = this.s_picture[var2].getHeight(this);
- }
- }
-
- }
-
- public boolean mouseUp(Event var1, int var2, int var3) {
- if (this.movingSub) {
- this.the_e.id = 9211;
- this.the_e.arg = (new Integer(this.m_menu_xcord[this.manip_image])).toString() + "," + (new Integer(this.m_menu_ycord[this.manip_image])).toString();
- super.postEvent(this.the_e);
- this.movingSub = false;
- }
-
- if (this.manip_image > -1) {
- this.the_e.id = 9201;
- this.the_e.arg = (new Integer(this.m_pic_xcord[this.manip_image])).toString() + "," + (new Integer(this.m_pic_ycord[this.manip_image])).toString();
- super.postEvent(this.the_e);
- this.movingImage = false;
- }
-
- return true;
- }
-
- public void initDefault() {
- String var1 = ((OCdg)this).getParameterDefault("bgcolor");
- if (var1 != null) {
- this.m_bgcolor = occcolor.ConvertColor(var1);
- }
-
- var1 = ((OCdg)this).getParameterDefault("bgimagefile");
- if (var1 != null) {
- this.m_bgimage = var1;
- }
-
- var1 = ((OCdg)this).getParameterDefault("bgxy");
- if (var1 != null) {
- int[] var2 = occcord.getIntValues(var1, ",", 2);
- if (var2 != null) {
- this.m_bgx = var2[0];
- this.m_bgy = var2[1];
- }
- }
-
- }
-
- public void initSpecifics() {
- boolean var2 = false;
- this.num_images = super.spe_pv.size();
- this.m_imagefile = new String[this.num_images];
- this.m_switchfile = new String[this.num_images];
- this.m_pic_xcord = new int[this.num_images];
- this.m_pic_ycord = new int[this.num_images];
- this.pic_width = new int[this.num_images];
- this.pic_height = new int[this.num_images];
- this.s_picture = new Image[this.num_images];
- this.h_picture = new Image[this.num_images];
- this.hlimg_status = new boolean[this.num_images];
- this.simg_status = new boolean[this.num_images];
- this.m_menu_xcord = new int[this.num_images];
- this.m_menu_ycord = new int[this.num_images];
-
- for(int var7 = 0; var7 < this.num_images; ++var7) {
- String var1 = ((OCdg)this).getParameterSpecific("imagefile", var7);
- if (var1 != null) {
- this.m_imagefile[var7] = new String(var1);
- } else {
- this.m_imagefile[var7] = new String("-1");
- }
-
- var1 = ((OCdg)this).getParameterSpecific("switchfile", var7);
- if (var1 != null) {
- this.m_switchfile[var7] = new String(var1);
- } else {
- this.m_switchfile[var7] = new String("-1");
- }
-
- var1 = ((OCdg)this).getParameterSpecific("imagexy", var7);
- if (var1 != null) {
- int[] var3 = occcord.getIntValues(var1, ",", 2);
- if (var3 != null) {
- this.m_pic_xcord[var7] = var3[0];
- this.m_pic_ycord[var7] = var3[1];
- }
- }
-
- var1 = ((OCdg)this).getParameterSpecific("subxy", var7);
- if (var1 != null) {
- int[] var8 = occcord.getIntValues(var1, ",", 2);
- if (var8 != null) {
- this.m_menu_xcord[var7] = var8[0];
- this.m_menu_ycord[var7] = var8[1];
- }
- }
- }
-
- }
-
- public void setUpGraphics() {
- super.off = ((Component)this).createImage(super.appWidth, super.appHeight);
- super.g_off = super.off.getGraphics();
- super.g_off.setColor(this.m_bgcolor);
- super.g_off.fillRect(0, 0, super.appWidth, super.appHeight);
- }
-
- public boolean mouseDown(Event var1, int var2, int var3) {
- ((Component)this).requestFocus();
- this.oldx = var2;
- this.oldy = var3;
-
- for(int var4 = 0; var4 < this.num_images; ++var4) {
- if (this.subOn && this.manip_image == var4) {
- int var5 = this.m_pic_xcord[var4] + super.scroll_x + this.m_menu_xcord[var4] + super.offimgx;
- int var6 = this.m_pic_ycord[var4] + super.scroll_y + this.m_menu_ycord[var4] + super.offimgy;
- int var7 = var5 + this.menud.width;
- int var8 = var6 + this.menud.height;
- if (var3 > var6 && var3 < var8 && var2 > var5 && var2 < var7) {
- this.movingSub = true;
- return true;
- }
- }
- }
-
- for(int var9 = 0; var9 < this.num_images; ++var9) {
- if (var3 > this.m_pic_ycord[var9] + super.scroll_y + super.offimgy && var3 < this.m_pic_ycord[var9] + this.pic_height[var9] + super.scroll_y + super.offimgy && var2 > this.m_pic_xcord[var9] + super.scroll_x + super.offimgx && var2 < this.m_pic_xcord[var9] + this.pic_width[var9] + super.scroll_x + super.offimgx) {
- if (this.manip_image != var9) {
- this.manip_image = var9;
- this.the_e.id = 9202;
- this.the_e.arg = new Integer(this.manip_image);
- super.postEvent(this.the_e);
- this.setUpSub();
- this.reDraw();
- ((OCdg)this).drawAppOff();
- ((OCdg)this).paintIt();
- }
-
- this.movingImage = true;
- return true;
- }
- }
-
- this.movingSub = false;
- this.movingImage = false;
- this.subOn = false;
- this.manip_image = -1;
- this.reDraw();
- ((OCdg)this).drawAppOff();
- ((OCdg)this).paintIt();
- return true;
- }
-
- public void updateDisplay(int var1) {
- if (!super.first_run) {
- if (this.simg_status[var1]) {
- this.manip_image = var1;
- } else {
- this.manip_image = -1;
- this.subOn = false;
- this.movingSub = false;
- this.movingImage = false;
- }
-
- this.setUpSub();
- this.reDraw();
- ((OCdg)this).drawAppOff();
- ((OCdg)this).paintIt();
- }
-
- }
-
- public void setUpSub() {
- if (this.appinfo.getSpecMLValues().isItem(this.manip_image + "-0")) {
- this.subs.addDefaults(this.appinfo.getDefParamDescs(), this.appinfo.getDefValues());
- this.subs.addSpecifics(this.appinfo.getSpecMLParamDescs(), this.appinfo.getSpecMLValues().valuesAtLevel(this.manip_image + "-0"));
- this.subs.setAppDimensions(new Integer(this.appinfo.getDefValues()[0]), new Integer(this.appinfo.getDefValues()[1]));
- this.subs.getMenuImageSize();
- this.menud = this.subs.getMenuImageSize();
- this.suboff = ((Component)this).createImage(this.menud.width, this.menud.height);
- this.g_suboff = this.suboff.getGraphics();
- this.suboff = this.subs.getMenuImage(this.suboff, this.g_suboff);
- this.subOn = true;
- } else {
- this.subOn = false;
- }
- }
-
- private void drawSub() {
- if (this.manip_image > -1) {
- super.g_off.drawImage(this.suboff, this.m_pic_xcord[this.manip_image] + this.m_menu_xcord[this.manip_image], this.m_pic_ycord[this.manip_image] + this.m_menu_ycord[this.manip_image], this);
- }
-
- }
-
- public boolean mouseDrag(Event var1, int var2, int var3) {
- if (this.manip_image > -1) {
- if (this.movingSub) {
- this.moveSub(var2, var3);
- } else if (this.movingImage) {
- this.moveImage(var2, var3);
- }
-
- this.oldx = var2;
- this.oldy = var3;
- }
-
- return true;
- }
- }
-