home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Event;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.Panel;
-
- class OCslider extends Panel implements Runnable {
- // $FF: renamed from: ds java.awt.Dimension
- private Dimension field_0;
- public static final int SCROLL_LINE_UP = 601;
- public static final int SCROLL_LINE_DOWN = 602;
- public static final int SCROLL_PAGE_UP = 603;
- public static final int SCROLL_PAGE_DOWN = 604;
- public static final int SCROLL_ABSOLUTE = 605;
- public int sbHeight = 0;
- public int sbWidth = 0;
- private int sbValue = 0;
- private int pageIncrement = 0;
- private int sbMax = 0;
- private int sbIncrement = 1;
- private Thread goauto = null;
- private boolean paint_called = false;
- private boolean first_run = true;
- private boolean on_top = false;
- private boolean on_bottom = false;
- private boolean m_down = false;
- private boolean dragging_bubble = false;
- private boolean bad_scroll = true;
- private boolean mouse_in = false;
- private boolean m_off = false;
- private boolean bypass = false;
- private Event the_e = null;
- private int auto_type = 0;
- // $FF: renamed from: mx int
- private int field_1 = 0;
- // $FF: renamed from: my int
- private int field_2 = 0;
- private int drag_move = 0;
- private float hbp = 0.0F;
- private Color button_color;
- private Color arrow_color;
- private Color harrow_color;
- private Color bg_color;
- private Color slider_color;
- private Color outline_color;
- private int slider_height;
- private int last_button;
- private int auto_delay;
- private int auto_rate;
- private int bubble_range;
- private float bubble_pos;
- private float bubble_inc;
- private int position;
- private Image sboff;
- private Graphics g_sboff;
-
- public void reshape(int var1, int var2, int var3, int var4) {
- if (var3 * var4 > 0) {
- this.sbWidth = var3;
- this.sbHeight = var4;
- this.field_0 = new Dimension(var3, var4);
- this.figureBubble(true);
- super.reshape(var1, var2, var3, var4);
- }
- }
-
- public void stop() {
- if (this.goauto != null) {
- this.goauto.stop();
- this.goauto = null;
- }
-
- }
-
- public boolean mouseEnter(Event var1, int var2, int var3) {
- this.mouse_in = true;
- return true;
- }
-
- public boolean mouseMove(Event var1, int var2, int var3) {
- if (!this.m_down && !this.bad_scroll) {
- if (this.cButtons(var3)) {
- return true;
- } else {
- this.undoHButtons();
- return true;
- }
- } else {
- return true;
- }
- }
-
- public int getValue() {
- return this.sbValue;
- }
-
- public boolean mouseExit(Event var1, int var2, int var3) {
- if (this.bad_scroll) {
- return true;
- } else {
- this.mouse_in = false;
- this.m_off = true;
- this.undoHButtons();
- return true;
- }
- }
-
- OCslider(int var1) {
- this.button_color = ACutilb.windowColor;
- this.arrow_color = Color.black;
- this.harrow_color = Color.yellow;
- this.bg_color = Color.white;
- this.slider_color = Color.black;
- this.outline_color = ACutilb.windowColor;
- this.slider_height = 6;
- this.last_button = 0;
- this.auto_delay = 5;
- this.auto_rate = 40;
- this.bubble_range = 0;
- this.bubble_pos = 0.0F;
- this.bubble_inc = 0.0F;
- this.position = 0;
- this.sboff = null;
- this.g_sboff = null;
- }
-
- public void paint(Graphics var1) {
- this.paint_called = true;
- this.paintIt(((Component)this).getGraphics());
- }
-
- public boolean mouseUp(Event var1, int var2, int var3) {
- if (this.bad_scroll) {
- return true;
- } else {
- this.m_down = false;
- this.dragging_bubble = false;
- this.last_button = 0;
- this.stop();
- this.auto_type = 0;
- if (this.m_off) {
- this.drawButton(0, this.sbHeight - this.sbWidth, this.sbWidth - 1, this.sbWidth - 1, 2, this.arrow_color);
- this.drawButton(0, 0, this.sbWidth - 1, this.sbWidth - 1, 1, this.arrow_color);
- this.paintIt(((Component)this).getGraphics());
- this.on_bottom = false;
- this.on_top = false;
- this.m_off = false;
- return true;
- } else if (this.on_bottom) {
- this.drawButton(0, this.sbHeight - this.sbWidth, this.sbWidth - 1, this.sbWidth - 1, 2, this.harrow_color);
- this.paintIt(((Component)this).getGraphics());
- return true;
- } else if (this.on_top) {
- this.drawButton(0, 0, this.sbWidth - 1, this.sbWidth - 1, 1, this.harrow_color);
- this.paintIt(((Component)this).getGraphics());
- return true;
- } else {
- return true;
- }
- }
- }
-
- private synchronized void paintIt(Graphics var1) {
- if (this.paint_called) {
- if (!this.first_run) {
- ((Component)this).setBackground(this.bg_color);
- if (this.field_0.height >= 1 && this.field_0.width >= 1) {
- this.sboff = ((Component)this).createImage(this.field_0.width, this.field_0.height);
- this.g_sboff = this.sboff.getGraphics();
- this.drawBar(var1);
- this.first_run = true;
- }
- } else {
- var1.drawImage(this.sboff, 0, 0, this);
- }
- }
- }
-
- public void setValues(int var1, int var2) {
- this.sbMax = var2;
- this.pageIncrement = var1;
- if (this.sbMax < 1) {
- this.bad_scroll = true;
- this.bubble_pos = (float)this.sbWidth;
- } else {
- this.bad_scroll = false;
- }
-
- this.bubble_pos = 0.0F;
- this.sbValue = 0;
- this.figureBubble(true);
- }
-
- public void resize(Dimension var1) {
- if (var1.width * var1.height > 0) {
- this.sbWidth = var1.width;
- this.sbHeight = var1.height;
- this.field_0 = var1;
- this.figureBubble(true);
- super.resize(var1);
- }
- }
-
- public void resize(int var1, int var2) {
- if (var1 * var2 > 0) {
- this.sbWidth = var1;
- this.sbHeight = var2;
- this.field_0 = new Dimension(var1, var2);
- this.figureBubble(true);
- super.resize(var1, var2);
- }
- }
-
- public void start() {
- if (this.goauto == null) {
- this.goauto = new Thread(this);
- this.goauto.start();
- }
-
- }
-
- public void figureBubble(boolean var1) {
- this.bubble_range = this.sbHeight - this.sbWidth * 3;
- this.bubble_inc = (float)this.bubble_range / (float)this.sbMax;
- this.bubble_pos = (float)this.sbValue * this.bubble_inc + (float)this.sbWidth;
- if (var1) {
- this.first_run = false;
- this.paintIt(((Component)this).getGraphics());
- }
-
- }
-
- private void DrawBubble(boolean var1) {
- if (!this.bad_scroll) {
- this.g_sboff.setColor(this.bg_color);
- this.g_sboff.fillRect(0, (int)this.bubble_pos, this.sbWidth, this.sbWidth);
- this.drawSlider();
- if (!var1) {
- this.bubble_pos = (float)this.sbValue * this.bubble_inc + (float)this.sbWidth;
- } else {
- this.bubble_pos = this.hbp;
- float var2 = (this.bubble_pos - (float)this.sbWidth) / (float)this.bubble_range;
- this.sbValue = (int)(var2 * (float)this.sbMax);
- }
-
- this.drawButton(0, (int)this.bubble_pos, this.sbWidth - 1, this.sbWidth - 1, 0, this.arrow_color);
- }
-
- }
-
- private boolean cButtons(int var1) {
- if (var1 < this.sbWidth && var1 >= 0) {
- if (!this.on_top) {
- this.on_top = true;
- if (!this.m_down) {
- this.drawButton(0, 0, this.sbWidth - 1, this.sbWidth - 1, 1, this.harrow_color);
- } else if (this.last_button != 1) {
- this.drawButton(0, 0, this.sbWidth - 1, this.sbWidth - 1, 3, this.harrow_color);
- this.bypass = true;
- this.auto_type = 2;
- this.start();
- } else {
- this.on_top = false;
- }
-
- this.paintIt(((Component)this).getGraphics());
- }
-
- return true;
- } else if (var1 > this.sbHeight - this.sbWidth && var1 <= this.sbHeight) {
- if (!this.on_bottom) {
- this.on_bottom = true;
- if (!this.m_down) {
- this.drawButton(0, this.sbHeight - this.sbWidth, this.sbWidth - 1, this.sbWidth - 1, 2, this.harrow_color);
- } else if (this.last_button != 2) {
- this.drawButton(0, this.sbHeight - this.sbWidth, this.sbWidth - 1, this.sbWidth - 1, 4, this.harrow_color);
- this.bypass = true;
- this.auto_type = 1;
- this.start();
- } else {
- this.on_bottom = false;
- }
-
- this.paintIt(((Component)this).getGraphics());
- }
-
- return true;
- } else {
- return false;
- }
- }
-
- private void drawButton(int var1, int var2, int var3, int var4, int var5, Color var6) {
- this.g_sboff.setColor(this.button_color);
- if (var5 != 0 && var5 != 1 && var5 != 2) {
- this.g_sboff.fillRect(var1 + 1, var2 + 1, var3 - 1, var4 - 1);
- } else {
- this.g_sboff.fillRect(var1 + 2, var2 + 2, var3 - 2, var4 - 2);
- }
-
- if (var5 == 1 || var5 == 2 || var5 == 3 || var5 == 4) {
- int var7 = 0;
- byte var8 = 6;
- byte var9 = 2;
- int var10 = var3 / 2 - 2;
- if (var3 < 11) {
- var8 = 4;
- var9 = 1;
- var10 = var3 / 2 - 2;
- } else {
- var10 = var3 / 2 - 3;
- }
-
- if (var5 != 2 && var5 != 4) {
- var7 = var4 / 2 + var9;
- } else {
- var7 = this.sbHeight - var4 / 2 - (var9 + 2);
- }
-
- this.g_sboff.setColor(var6);
- if (var5 == 3 || var5 == 4) {
- ++var10;
- ++var7;
- }
-
- for(int var11 = var8; var11 >= 0; var11 -= 2) {
- this.g_sboff.drawLine(var10, var7, var10 + var11, var7);
- ++var10;
- if (var5 != 2 && var5 != 4) {
- --var7;
- } else {
- ++var7;
- }
- }
- }
-
- if (var5 != 0 && var5 != 1 && var5 != 2) {
- this.g_sboff.setColor(Color.gray);
- this.g_sboff.drawRect(var1, var2, var3, var4);
- } else {
- this.g_sboff.setColor(ACutilb.windowColor);
- this.g_sboff.drawRect(var1 + 1, var2 + 1, var3 - 1, var4 - 1);
- this.g_sboff.setColor(Color.gray);
- this.g_sboff.drawLine(var1 + 1, var2 + var4 - 1, var1 + var3 - 1, var2 + var4 - 1);
- this.g_sboff.drawLine(var1 + var3 - 1, var2 + 1, var1 + var3 - 1, var2 + var4 - 1);
- this.g_sboff.setColor(Color.white);
- this.g_sboff.drawRect(var1, var2, var3, var4);
- this.g_sboff.setColor(Color.black);
- this.g_sboff.drawLine(var1, var2 + var4, var1 + var3, var2 + var4);
- this.g_sboff.drawLine(var1 + var3, var2, var1 + var3, var2 + var4);
- }
- }
-
- public Dimension preferredSize() {
- return new Dimension(14, 75);
- }
-
- private void drawBar(Graphics var1) {
- this.g_sboff.setColor(this.bg_color);
- this.g_sboff.fillRect(0, 0, this.field_0.width, this.field_0.height);
- this.drawSlider();
- }
-
- private void drawSlider() {
- byte var1 = 0;
- int var2 = (this.field_0.height - this.slider_height) / 2;
- int var3 = this.field_0.width;
- int var4 = this.slider_height;
- this.g_sboff.setColor(this.slider_color);
- this.g_sboff.fillRect(var1, var2, var3, var4);
- }
-
- private void checkDbutton(Event var1, int var2) {
- if (var2 == 1) {
- this.sbValue += this.sbIncrement;
- if (this.sbValue > this.sbMax) {
- this.sbValue = this.sbMax;
- }
-
- this.DrawBubble(false);
- this.paintIt(((Component)this).getGraphics());
- var1.id = 602;
- ((Component)this).postEvent(var1);
- } else if (var2 == 2) {
- this.sbValue -= this.sbIncrement;
- if (this.sbValue < 0) {
- this.sbValue = 0;
- }
-
- this.DrawBubble(false);
- this.paintIt(((Component)this).getGraphics());
- var1.id = 601;
- ((Component)this).postEvent(var1);
- } else if (var2 == 3) {
- this.sbValue -= this.pageIncrement;
- if (this.sbValue < 0) {
- this.sbValue = 0;
- }
-
- this.DrawBubble(false);
- this.paintIt(((Component)this).getGraphics());
- var1.id = 603;
- ((Component)this).postEvent(var1);
- } else {
- if (var2 == 4) {
- this.sbValue += this.pageIncrement;
- if (this.sbValue > this.sbMax) {
- this.sbValue = this.sbMax;
- }
-
- this.DrawBubble(false);
- this.paintIt(((Component)this).getGraphics());
- var1.id = 604;
- ((Component)this).postEvent(var1);
- }
-
- }
- }
-
- public boolean mouseDown(Event var1, int var2, int var3) {
- this.m_down = true;
- if (this.bad_scroll) {
- return true;
- } else if (this.on_bottom) {
- this.drawButton(0, this.sbHeight - this.sbWidth, this.sbWidth - 1, this.sbWidth - 1, 4, this.harrow_color);
- this.last_button = 1;
- this.auto_type = 1;
- this.checkDbutton(var1, this.auto_type);
- this.the_e = var1;
- this.start();
- return true;
- } else if (this.on_top) {
- this.drawButton(0, 0, this.sbWidth - 1, this.sbWidth - 1, 3, this.harrow_color);
- this.last_button = 2;
- this.auto_type = 2;
- this.checkDbutton(var1, this.auto_type);
- this.the_e = var1;
- this.start();
- return true;
- } else {
- if (var2 >= 0 && var2 <= this.sbWidth) {
- if ((float)var3 >= this.bubble_pos && (float)var3 < this.bubble_pos + (float)this.sbWidth) {
- this.dragging_bubble = true;
- this.drag_move = var3;
- return true;
- }
-
- if ((float)var3 < this.bubble_pos) {
- this.field_2 = var3;
- this.field_1 = var2;
- this.auto_type = 3;
- this.checkDbutton(var1, this.auto_type);
- this.the_e = var1;
- this.start();
- } else {
- this.field_2 = var3;
- this.field_1 = var2;
- this.auto_type = 4;
- this.checkDbutton(var1, this.auto_type);
- this.the_e = var1;
- this.start();
- }
- }
-
- return true;
- }
- }
-
- public void run() {
- while(true) {
- if (!this.bypass) {
- try {
- Thread.sleep((long)(this.auto_delay * 100));
- } catch (InterruptedException var2) {
- }
- } else {
- this.bypass = false;
- }
-
- while(this.m_down) {
- if (this.auto_type != 3 && this.auto_type != 4 || this.field_1 > 0 && this.field_1 < this.sbWidth && this.field_2 <= this.sbHeight - this.sbWidth && this.field_2 >= this.sbWidth && (this.auto_type != 3 || !((float)this.field_2 > this.bubble_pos)) && (this.auto_type != 4 || !((float)this.field_2 < this.bubble_pos + (float)this.sbWidth))) {
- this.checkDbutton(this.the_e, this.auto_type);
-
- try {
- Thread.sleep((long)this.auto_rate);
- } catch (InterruptedException var1) {
- }
- }
- }
- }
- }
-
- private void undoHButtons() {
- if (this.on_bottom) {
- this.drawButton(0, this.sbHeight - this.sbWidth, this.sbWidth - 1, this.sbWidth - 1, 2, this.arrow_color);
- this.paintIt(((Component)this).getGraphics());
- this.on_bottom = false;
- }
-
- if (this.on_top) {
- this.drawButton(0, 0, this.sbWidth - 1, this.sbWidth - 1, 1, this.arrow_color);
- this.paintIt(((Component)this).getGraphics());
- this.on_top = false;
- }
-
- }
-
- public boolean mouseDrag(Event var1, int var2, int var3) {
- this.field_1 = var2;
- this.field_2 = var3;
- if (this.bad_scroll) {
- return true;
- } else {
- if (this.dragging_bubble) {
- if (this.drag_move != var3) {
- this.hbp = this.bubble_pos + (float)(var3 - this.drag_move);
- if (this.hbp > (float)(this.bubble_range + this.sbWidth)) {
- this.hbp = (float)(this.bubble_range + this.sbWidth);
- }
-
- if (this.hbp < (float)this.sbWidth) {
- this.hbp = (float)this.sbWidth;
- }
-
- this.DrawBubble(true);
- this.paintIt(((Component)this).getGraphics());
- var1.id = 605;
- ((Component)this).postEvent(var1);
- this.drag_move = var3;
- }
- } else {
- if (this.auto_type > 2) {
- return true;
- }
-
- if (var2 > 0 && var2 < this.sbWidth && this.cButtons(var3)) {
- this.m_off = false;
- return true;
- }
-
- this.m_off = true;
- this.drawButton(0, this.sbHeight - this.sbWidth, this.sbWidth - 1, this.sbWidth - 1, 2, this.arrow_color);
- this.on_bottom = false;
- this.drawButton(0, 0, this.sbWidth - 1, this.sbWidth - 1, 1, this.arrow_color);
- this.on_top = false;
- this.stop();
- this.auto_type = 0;
- this.paintIt(((Component)this).getGraphics());
- }
-
- return true;
- }
- }
-
- public void setBubblePos(int var1) {
- if (var1 < 1) {
- this.sbValue = 1;
- }
-
- if (var1 > this.sbMax) {
- this.sbValue = this.sbMax;
- }
-
- this.figureBubble(true);
- }
-
- public void setBarStyle(int var1, Color var2, Color var3, Color var4, Color var5, Color var6) {
- this.arrow_color = var2;
- this.slider_height = var1;
- this.harrow_color = var3;
- this.bg_color = var4;
- this.slider_color = var5;
- this.outline_color = var6;
- }
- }
-