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.Graphics;
- import java.awt.Image;
- import java.awt.LayoutManager;
- import java.awt.MediaTracker;
- import java.awt.Panel;
- import java.awt.Scrollbar;
- import java.io.File;
- import java.util.Vector;
-
- public class OCdg extends Panel {
- public int appWidth = 0;
- public int appHeight = 0;
- public int actAppWidth;
- public int actAppHeight;
- private int save_altx = 0;
- private int save_alty = 0;
- private boolean paint_called = false;
- public Color bgColor;
- int offimgx;
- int offimgy;
- boolean first_paint;
- // $FF: renamed from: d java.awt.Dimension
- Dimension field_0;
- // $FF: renamed from: ts java.awt.Image
- private Image field_1;
- private Graphics g_ts;
- private int tsImgWidth;
- private int tsImgHeight;
- Image off;
- Graphics g_off;
- boolean first_run;
- public String[] def_pn;
- public String[] def_pv;
- public String[] spe_pn;
- public String[] spe_pt;
- public Vector spe_pv;
- public String[] ml_pn;
- public MLparam ml_pv;
- public String[] icon_pn;
- public Vector icon_pv;
- int sb_width;
- // $FF: renamed from: sb java.awt.Scrollbar
- Scrollbar field_2;
- Scrollbar hsb;
- int scroll_y;
- int scroll_x;
- int sb_linedist;
- int hsb_linedist;
- boolean first_sb_run;
- boolean first_hsb_run;
- boolean use_sb;
- boolean use_hsb;
- private int last_scroll_y;
- private int last_scroll_x;
- public int sEdge;
- Panel sb_corner;
-
- public void setVerticalPagePosition(int var1) {
- if (this.use_sb) {
- this.last_scroll_y = this.scroll_y;
- this.scroll_y = var1;
- this.field_2.setValue(Math.abs(this.scroll_y));
- this.paintIt();
- } else {
- this.last_scroll_y = var1;
- this.scroll_y = var1;
- }
- }
-
- public void checkAppSizeChange() {
- if (this.actAppWidth != this.off.getWidth(this) || this.actAppHeight != this.off.getHeight(this)) {
- this.centerAppArea();
- }
-
- }
-
- public String getParameterSpecific(String var1, int var2) {
- for(int var3 = 0; var3 < this.spe_pn.length; ++var3) {
- if (this.spe_pn[var3].equals(var1)) {
- String var4 = ((String[])this.spe_pv.elementAt(var2))[var3];
- if (var4 != null && !var4.equals("") && !var4.equalsIgnoreCase("<default>") && !var4.equalsIgnoreCase("<none>")) {
- return var4;
- }
-
- return null;
- }
- }
-
- return null;
- }
-
- public void setAppDimensions(int var1, int var2) {
- if (var1 != this.appWidth || var2 != this.appHeight) {
- this.appWidth = var1;
- this.appHeight = var2;
- if (this.appWidth <= 0 || this.appHeight <= 0) {
- return;
- }
- }
-
- if (this.paint_called) {
- this.DrawApplet();
- this.checkAppSizeChange();
- this.drawAppOff();
- this.paintIt();
- }
-
- }
-
- public void setBgColor(Color var1) {
- this.bgColor = var1;
- ((Component)this).setBackground(var1);
- this.figureAltScrollBars(0, 0);
- if (ACutila.iface.dgrid_id == 0) {
- ACutila.iface.ipan.getOCdgvtis().setArrowBgColor(var1);
- }
-
- }
-
- public void addDefaults(String[] var1, String[] var2) {
- this.def_pn = var1;
- this.def_pv = var2;
- this.initDefault();
- }
-
- public void addIcons(String[] var1, Vector var2) {
- this.icon_pn = var1;
- this.icon_pv = var2;
- this.initIcons();
- }
-
- public void redoAltOffs() {
- }
-
- public void reDrawAltOffs() {
- }
-
- public void checkAltOffScrollBars(Image[] var1, int[] var2, int[] var3, OCmsl[] var4) {
- int var5 = 0;
- int var6 = 0;
- int var7 = 0;
-
- for(int var8 = 0; var8 < var1.length; ++var8) {
- if (var4[var8].subOn) {
- var7 = var2[var8] + var1[var8].getWidth(this);
- if (var7 > var5) {
- var5 = var7;
- }
-
- var7 = var3[var8] + var1[var8].getHeight(this);
- if (var7 > var6) {
- var6 = var7;
- }
- }
- }
-
- this.figureAltScrollBars(var5, var6);
- }
-
- public void figureAltScrollBars(int var1, int var2) {
- int var3 = 0;
- int var4 = 0;
- if (this.actAppWidth + this.offimgx > var1) {
- var1 = this.actAppWidth + this.offimgx;
- }
-
- if (this.actAppHeight + this.offimgy > var2) {
- var2 = this.actAppHeight + this.offimgy;
- }
-
- if (var2 > this.field_0.height - 4) {
- this.use_sb = true;
- this.tsImgHeight = var2 + this.sEdge * 2;
- var4 = this.sb_width;
- this.scroll_y = this.last_scroll_y;
- } else {
- this.use_sb = false;
- this.tsImgHeight = this.field_0.height;
- }
-
- if (var1 > this.field_0.width - 4) {
- this.use_hsb = true;
- this.tsImgWidth = var1 + this.sEdge * 2;
- var3 = this.sb_width;
- this.scroll_x = this.last_scroll_x;
- } else {
- this.use_hsb = false;
- this.tsImgWidth = this.field_0.width;
- }
-
- this.figureScrollBars();
- this.field_1 = ((Component)this).createImage(this.tsImgWidth, this.tsImgHeight);
- this.g_ts = this.field_1.getGraphics();
- this.drawAppOff();
- this.reDrawAltOffs();
- if (this.use_hsb) {
- if (this.scroll_x + this.tsImgWidth < this.field_0.width) {
- this.scroll_x = this.field_0.width - this.tsImgWidth;
- }
- } else {
- this.scroll_x = 0;
- this.last_scroll_x = 0;
- }
-
- if (this.use_sb) {
- if (this.scroll_y + this.tsImgHeight < this.field_0.height) {
- this.scroll_y = this.field_0.height - this.tsImgHeight;
- }
- } else {
- this.scroll_y = 0;
- this.last_scroll_y = 0;
- }
-
- this.paintIt();
- }
-
- public void reshape(int var1, int var2, int var3, int var4) {
- if (var3 * var4 > 0) {
- this.field_0 = new Dimension(var3, var4);
- if (!this.first_run) {
- this.centerAppArea();
- this.drawAppOff();
- this.redoAltOffs();
- this.paintIt();
- }
-
- super.reshape(var1, var2, var3, var4);
- }
- }
-
- public void drawAltOff(Image var1, int var2, int var3, boolean var4) {
- if (!var4) {
- this.g_ts.setColor(this.bgColor);
- this.g_ts.fillRect(this.save_altx, this.save_alty, var1.getWidth(this), var1.getHeight(this));
- this.drawAppOff();
- }
-
- this.g_ts.drawImage(var1, var2, var3, this);
- this.save_altx = var2;
- this.save_alty = var3;
- }
-
- public void initIcons() {
- }
-
- public String getParameterIcon(String var1, int var2) {
- for(int var3 = 0; var3 < this.icon_pn.length; ++var3) {
- if (this.icon_pn[var3].equals(var1)) {
- String var4 = ((String[])this.icon_pv.elementAt(var2))[var3];
- if (var4 != null && !var4.equals("") && !var4.equalsIgnoreCase("<default>") && !var4.equalsIgnoreCase("<none>")) {
- return var4;
- }
-
- return null;
- }
- }
-
- return null;
- }
-
- public void setHorizontalPagePosition(int var1) {
- if (this.use_hsb) {
- this.last_scroll_x = this.scroll_x;
- this.scroll_x = var1;
- this.hsb.setValue(Math.abs(this.scroll_x));
- this.paintIt();
- } else {
- this.last_scroll_x = var1;
- this.scroll_x = var1;
- }
- }
-
- public void drawAppOff() {
- this.g_ts.drawImage(this.off, this.offimgx, this.offimgy, this);
- }
-
- public void eraseAppOff() {
- this.g_ts.setColor(this.bgColor);
- this.g_ts.fillRect(this.offimgx, this.offimgy, this.off.getWidth(this), this.off.getHeight(this));
- }
-
- OCdg() {
- this.bgColor = ACutilWindow.daColor;
- this.first_run = true;
- this.sb_width = 13;
- this.scroll_y = 0;
- this.sb_linedist = 1;
- this.hsb_linedist = 1;
- this.first_sb_run = true;
- this.first_hsb_run = true;
- this.use_sb = false;
- this.use_hsb = false;
- this.last_scroll_y = 0;
- this.sEdge = 5;
- this.sb_corner = null;
- ((Container)this).setLayout((LayoutManager)null);
- this.sb_corner = new Panel();
- this.sb_corner.setLayout((LayoutManager)null);
- this.sb_corner.setBackground(ACutilb.windowColor);
- ((Component)this).setBackground(this.bgColor);
- }
-
- public void paint(Graphics var1) {
- this.paint_called = true;
- this.paintIt();
- }
-
- public void DrawApplet() {
- }
-
- public boolean mouseUp(Event var1, int var2, int var3) {
- return ACutila.iface.isMouseInReposition(var1) ? true : true;
- }
-
- public void addSpecifics(String[] var1, Vector var2) {
- this.spe_pn = var1;
- this.spe_pv = var2;
- this.initSpecifics();
- }
-
- public void addSpecifics(String[] var1, Vector var2, String[] var3) {
- this.spe_pn = var1;
- this.spe_pv = var2;
- this.spe_pt = var3;
- this.initSpecifics();
- }
-
- public String getParameterDefault(String var1) {
- for(int var2 = 0; var2 < this.def_pn.length; ++var2) {
- if (this.def_pn[var2].equals(var1)) {
- if (this.def_pv[var2].equalsIgnoreCase("<none>")) {
- return null;
- }
-
- return this.def_pv[var2];
- }
- }
-
- return null;
- }
-
- public String getParameterSpecificByTitle(String var1, int var2) {
- for(int var3 = 0; var3 < this.spe_pt.length; ++var3) {
- if (this.spe_pt[var3].equalsIgnoreCase(var1)) {
- String var4 = ((String[])this.spe_pv.elementAt(var2))[var3];
- if (var4 != null && !var4.equals("") && !var4.equalsIgnoreCase("<default>") && !var4.equalsIgnoreCase("<none>")) {
- return var4;
- }
-
- return null;
- }
- }
-
- return null;
- }
-
- public void initDefault() {
- }
-
- public synchronized void paintIt() {
- try {
- if (this.paint_called) {
- Graphics var1 = ((Component)this).getGraphics();
- if (this.first_run) {
- this.DrawApplet();
- this.checkAppSizeChange();
- this.drawAppOff();
- this.figureScrollBars();
- this.first_run = false;
- }
-
- var1.drawImage(this.field_1, this.scroll_x, this.scroll_y, this);
- if (this.use_sb && this.use_hsb) {
- this.sb_corner.reshape(this.field_0.width - this.sb_width, this.field_0.height - this.sb_width, this.sb_width, this.sb_width);
- ((Container)this).add(this.sb_corner);
- } else {
- ((Container)this).remove(this.sb_corner);
- }
- }
- } catch (Exception var2) {
- }
- }
-
- public Image trackReturn(String var1) {
- Object var2 = null;
- MediaTracker var3 = new MediaTracker(this);
- if (!var1.equals("-1")) {
- Image var5 = ((Component)this).getToolkit().getImage((new File(var1)).getAbsolutePath());
- var3.addImage(var5, 0);
-
- try {
- var3.waitForID(0);
- } catch (InterruptedException var4) {
- return null;
- }
-
- if (var3.isErrorID(0)) {
- System.out.println("Error Loading Image File:" + var1);
- return null;
- } else {
- return var5;
- }
- } else {
- return null;
- }
- }
-
- public void resize(Dimension var1) {
- if (var1.width * var1.height > 0) {
- if (!this.first_run) {
- this.centerAppArea();
- this.drawAppOff();
- this.redoAltOffs();
- this.paintIt();
- }
-
- super.resize(var1);
- }
- }
-
- public void resize(int var1, int var2) {
- if (var1 * var2 > 0) {
- this.field_0 = new Dimension(var1, var2);
- if (!this.first_run) {
- this.centerAppArea();
- this.drawAppOff();
- this.redoAltOffs();
- this.paintIt();
- }
-
- super.resize(var1, var2);
- }
- }
-
- public void figureScrollBars() {
- if (this.first_sb_run) {
- if (this.use_sb) {
- this.field_2 = new Scrollbar(1);
- if (this.use_sb && this.use_hsb) {
- this.field_2.reshape(this.field_0.width - this.sb_width, 0, this.sb_width, this.field_0.height - this.sb_width);
- } else {
- this.field_2.reshape(this.field_0.width - this.sb_width, 0, this.sb_width, this.field_0.height);
- }
-
- this.field_2.setBackground(Color.gray);
- ((Container)this).add(this.field_2);
- this.first_sb_run = false;
- }
- } else if (!this.use_sb) {
- ((Container)this).remove(this.field_2);
- this.field_2 = null;
- this.first_sb_run = true;
- } else if (this.use_sb && this.use_hsb) {
- this.field_2.reshape(this.field_0.width - this.sb_width, 0, this.sb_width, this.field_0.height - this.sb_width);
- } else {
- this.field_2.reshape(this.field_0.width - this.sb_width, 0, this.sb_width, this.field_0.height);
- }
-
- if (this.use_sb) {
- int var1 = Math.abs(this.scroll_y);
- if (this.scroll_y > this.tsImgHeight) {
- var1 = this.tsImgHeight;
- }
-
- int var2 = 0;
- if (this.use_hsb) {
- var2 = this.sb_width;
- }
-
- this.field_2.setValues(var1, this.field_0.height, 0, this.tsImgHeight + var2);
- this.field_2.setLineIncrement(10);
- this.field_2.setPageIncrement(this.field_0.height);
- }
-
- if (this.first_hsb_run) {
- if (this.use_hsb) {
- this.hsb = new Scrollbar(0);
- if (this.use_sb && this.use_hsb) {
- this.hsb.reshape(0, this.field_0.height - this.sb_width, this.field_0.width - this.sb_width, this.sb_width);
- } else {
- this.hsb.reshape(0, this.field_0.height - this.sb_width, this.field_0.width, this.sb_width);
- }
-
- this.hsb.setBackground(Color.gray);
- ((Container)this).add(this.hsb);
- this.first_hsb_run = false;
- }
- } else if (!this.use_hsb) {
- ((Container)this).remove(this.hsb);
- this.hsb = null;
- this.first_hsb_run = true;
- } else if (this.use_sb && this.use_hsb) {
- this.hsb.reshape(0, this.field_0.height - this.sb_width, this.field_0.width - this.sb_width, this.sb_width);
- } else {
- this.hsb.reshape(0, this.field_0.height - this.sb_width, this.field_0.width, this.sb_width);
- }
-
- if (this.use_hsb) {
- int var3 = Math.abs(this.scroll_x);
- if (this.scroll_x > this.tsImgWidth) {
- var3 = this.tsImgWidth;
- }
-
- int var4 = 0;
- if (this.use_sb) {
- var4 = this.sb_width;
- }
-
- this.hsb.setValues(var3, this.field_0.width, 0, this.tsImgWidth + var4);
- this.hsb.setLineIncrement(10);
- this.hsb.setPageIncrement(this.field_0.width);
- }
-
- }
-
- public void initSpecifics() {
- }
-
- public void undoAltOff(Image var1, int var2, int var3) {
- this.g_ts.setColor(this.bgColor);
- this.g_ts.fillRect(var2, var3, var1.getWidth(this), var1.getHeight(this));
- }
-
- public boolean mouseDown(Event var1, int var2, int var3) {
- return true;
- }
-
- private void centerAppArea() {
- int var1 = 0;
- int var2 = 0;
- this.actAppWidth = this.off.getWidth(this);
- this.actAppHeight = this.off.getHeight(this);
- ACutila.dg_img_width = this.actAppWidth;
- ACutila.dg_img_height = this.actAppHeight;
- if (this.actAppHeight > this.field_0.height - 4) {
- this.use_sb = true;
- this.tsImgHeight = this.actAppHeight + this.sEdge * 2;
- var2 = this.sb_width;
- this.scroll_y = this.last_scroll_y;
- } else {
- this.use_sb = false;
- this.tsImgHeight = this.field_0.height;
- }
-
- if (this.actAppWidth > this.field_0.width - 4) {
- this.use_hsb = true;
- this.tsImgWidth = this.actAppWidth + this.sEdge * 2;
- var1 = this.sb_width;
- this.scroll_x = this.last_scroll_x;
- } else {
- this.use_hsb = false;
- this.tsImgWidth = this.field_0.width;
- }
-
- this.figureScrollBars();
- this.field_1 = ((Component)this).createImage(this.tsImgWidth, this.tsImgHeight);
- this.g_ts = this.field_1.getGraphics();
- this.offimgx = (this.tsImgWidth - this.actAppWidth) / 2;
- this.offimgy = (this.tsImgHeight - this.actAppHeight) / 2;
- if (this.use_hsb) {
- if (this.scroll_x + this.tsImgWidth < this.field_0.width) {
- this.scroll_x = this.field_0.width - this.tsImgWidth;
- }
- } else {
- this.scroll_x = 0;
- this.last_scroll_x = 0;
- }
-
- if (this.use_sb) {
- if (this.scroll_y + this.tsImgHeight < this.field_0.height) {
- this.scroll_y = this.field_0.height - this.tsImgHeight;
- return;
- }
- } else {
- this.scroll_y = 0;
- this.last_scroll_y = 0;
- }
-
- }
-
- public boolean handleEvent(Event var1) {
- boolean var2 = false;
- boolean var3 = false;
- if (var1.target == this.field_2) {
- if (var1.id != 602 && var1.id != 601 && var1.id != 605) {
- if (var1.id == 604 || var1.id == 603) {
- this.scroll_y = -(this.field_2.getValue() * this.sb_linedist);
- var2 = true;
- }
- } else {
- this.scroll_y = -(this.field_2.getValue() * this.sb_linedist);
- var2 = true;
- }
-
- if (var2) {
- if (this.scroll_y >= 0) {
- this.scroll_y = 0;
- } else {
- int var7 = 0;
- if (this.use_hsb) {
- var7 = this.sb_width;
- }
-
- if (this.scroll_y + this.tsImgHeight + var7 < this.field_0.height) {
- this.scroll_y = -this.tsImgHeight + this.field_0.height;
- }
- }
-
- this.last_scroll_y = this.scroll_y;
- this.paintIt();
- var2 = false;
- }
-
- return true;
- } else if (var1.target != this.hsb) {
- return super.handleEvent(var1);
- } else {
- if (var1.id != 602 && var1.id != 601 && var1.id != 605) {
- if (var1.id == 604 || var1.id == 603) {
- this.scroll_x = -this.hsb.getValue();
- var3 = true;
- }
- } else {
- this.scroll_x = -this.hsb.getValue();
- var3 = true;
- }
-
- if (var3) {
- if (this.scroll_x >= 0) {
- this.scroll_x = 0;
- } else {
- int var4 = 0;
- if (this.use_sb) {
- var4 = this.sb_width;
- }
-
- if (this.scroll_x + this.tsImgWidth + var4 < this.field_0.width) {
- this.scroll_x = -this.tsImgWidth + this.field_0.width;
- }
- }
-
- this.last_scroll_x = this.scroll_x;
- this.paintIt();
- var3 = false;
- }
-
- return true;
- }
- }
-
- public boolean mouseDrag(Event var1, int var2, int var3) {
- return true;
- }
-
- public void setVerticalPagePositionMax() {
- this.setVerticalPagePosition(-this.tsImgHeight - this.field_0.height);
- }
-
- public void drawDeleteAltOffMult(Image[] var1, int[] var2, int[] var3, int[] var4, int[] var5, OCmsl[] var6, boolean var7) {
- this.g_ts.setColor(this.bgColor);
-
- for(int var8 = 0; var8 < var6.length; ++var8) {
- if (var6[var8].subOn) {
- this.g_ts.fillRect(var4[var8], var5[var8], var1[var8].getWidth(this), var1[var8].getHeight(this));
- }
- }
-
- }
-
- public void drawAltOffMult(Image[] var1, int[] var2, int[] var3, int[] var4, int[] var5, OCmsl[] var6, boolean var7) {
- if (!var7) {
- this.g_ts.setColor(this.bgColor);
-
- for(int var8 = 0; var8 < var6.length; ++var8) {
- if (var6[var8].subOn) {
- this.g_ts.fillRect(var4[var8], var5[var8], var1[var8].getWidth(this), var1[var8].getHeight(this));
- }
- }
-
- this.drawAppOff();
- }
-
- for(int var9 = 0; var9 < var6.length; ++var9) {
- if (var6[var9].subOn) {
- this.g_ts.drawImage(var1[var9], var2[var9], var3[var9], this);
- }
- }
-
- }
- }
-