opal-0.9.5

16:39:21.104 INFO  jd.cli.Main - Decompiling opal-0.9.5.jar
package org.mihalis.opal;

import java.util.Map;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;

public abstract class OpalItem
{
  private Map<String, Object> data;
  private Object datum;
  private Color background;
  private Font font;
  private Color foreground;
  private Image image;
  private String text;
  private int height = -1;
  
  public Color getBackground()
  {
    return background;
  }
  
  public Object getData()
  {
    return datum;
  }
  
  public Object getData(String paramString)
  {
    return data.get(paramString);
  }
  
  public Font getFont()
  {
    return font;
  }
  
  public Color getForeground()
  {
    return foreground;
  }
  
  public int getHeight()
  {
    return height;
  }
  
  public Image getImage()
  {
    return image;
  }
  
  public String getText()
  {
    return text;
  }
  
  public void setBackground(Color paramColor)
  {
    background = paramColor;
  }
  
  public void setFont(Font paramFont)
  {
    font = paramFont;
  }
  
  public void setForeground(Color paramColor)
  {
    foreground = paramColor;
  }
  
  public void setHeight(int paramInt)
  {
    height = paramInt;
  }
  
  public void setImage(Image paramImage)
  {
    image = paramImage;
  }
  
  public void setText(String paramString)
  {
    text = paramString;
  }
  
  public void setData(Object paramObject)
  {
    datum = paramObject;
  }
  
  public void setData(String paramString, Object paramObject)
  {
    data.put(paramString, paramObject);
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.OpalItem
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.angles;

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class AngleSlider$1
  implements Listener
{
  AngleSlider$1(AngleSlider paramAngleSlider) {}
  
  public void handleEvent(Event paramEvent)
  {
    AngleSlider.access$000(this$0, paramEvent);
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.angles.AngleSlider.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.angles;

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.mihalis.opal.utils.SWTGraphicUtil;

class AngleSlider$2
  implements DisposeListener
{
  AngleSlider$2(AngleSlider paramAngleSlider) {}
  
  public void widgetDisposed(DisposeEvent paramDisposeEvent)
  {
    SWTGraphicUtil.dispose(AngleSlider.access$100(this$0));
    SWTGraphicUtil.dispose(AngleSlider.access$200(this$0));
    SWTGraphicUtil.dispose(AngleSlider.access$300(this$0));
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.angles.AngleSlider.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.angles;

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class AngleSlider$3
  implements Listener
{
  AngleSlider$3(AngleSlider paramAngleSlider) {}
  
  public void handleEvent(Event paramEvent)
  {
    if (!this$0.isEnabled()) {
      return;
    }
    if (type == 3) {
      AngleSlider.access$402(this$0, true);
    }
    if ((type == 3) || ((type == 5) && (AngleSlider.access$400(this$0))))
    {
      float f1 = x - 20.0F;
      float f2 = y - 20.0F;
      double d = Math.atan2(f1, f2);
      AngleSlider.access$502(this$0, 360 - (int)(360.0D * d / 6.283185307179586D + 360.0D) % 360);
      this$0.redraw();
    }
    if (type == 4)
    {
      AngleSlider.access$402(this$0, false);
      AngleSlider.access$600(this$0, paramEvent);
    }
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.angles.AngleSlider.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.angles;

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class AngleSlider$4
  implements Listener
{
  AngleSlider$4(AngleSlider paramAngleSlider) {}
  
  public void handleEvent(Event paramEvent)
  {
    if (!this$0.isEnabled()) {
      return;
    }
    if (type != 1) {
      return;
    }
    if ((keyCode == 16777217) || (keyCode == 16777219)) {
      this$0.setSelection(AngleSlider.access$500(this$0) + 5);
    }
    if ((keyCode == 16777218) || (keyCode == 16777220)) {
      this$0.setSelection(AngleSlider.access$500(this$0) - 5);
    }
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.angles.AngleSlider.4
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.angles;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.mihalis.opal.utils.SWTGraphicUtil;

public class AngleSlider
  extends Canvas
{
  private static final int WHOLE_RADIUS = 40;
  private static final int BUTTON_RADIUS = 10;
  private static final int STEP = 5;
  private final Image backgroundImage = new Image(getDisplay(), getClass().getClassLoader().getResourceAsStream("images/angleBackground.png"));
  private final Image buttonFocus = new Image(getDisplay(), getClass().getClassLoader().getResourceAsStream("images/angleButtonFocus.png"));
  private final Image buttonNoFocus = new Image(getDisplay(), getClass().getClassLoader().getResourceAsStream("images/angleButtonFocusLost.png"));
  private int selection;
  private final List<SelectionListener> selectionListeners;
  private boolean mousePressed;
  
  public AngleSlider(Composite paramComposite, int paramInt)
  {
    super(paramComposite, paramInt | 0x20000000);
    addListener(9, new Listener()
    {
      public void handleEvent(Event paramAnonymousEvent)
      {
        AngleSlider.this.paintControl(paramAnonymousEvent);
      }
    });
    addDisposeListener(new DisposeListener()
    {
      public void widgetDisposed(DisposeEvent paramAnonymousDisposeEvent)
      {
        SWTGraphicUtil.dispose(backgroundImage);
        SWTGraphicUtil.dispose(buttonFocus);
        SWTGraphicUtil.dispose(buttonNoFocus);
      }
    });
    addListener(3, createMouseListener());
    addListener(4, createMouseListener());
    addListener(5, createMouseListener());
    addListener(1, createKeyListener());
    selection = 0;
    selectionListeners = new ArrayList();
  }
  
  private void paintControl(Event paramEvent)
  {
    GC localGC = gc;
    localGC.drawImage(backgroundImage, 0, 0);
    float f1 = selection / 360.0F;
    f1 = (float)(f1 * 2.0F * 3.141592653589793D - 1.5707963267948966D);
    float f2 = (float)(20.0D - 10.0D * Math.cos(f1));
    float f3 = (float)(20.0D - 10.0D * Math.sin(f1));
    if (isFocusControl()) {
      localGC.drawImage(buttonFocus, (int)f2 - 2, (int)f3 - 2);
    } else {
      localGC.drawImage(buttonNoFocus, (int)f2 - 2, (int)f3 - 2);
    }
    if (!isEnabled())
    {
      localGC.setAlpha(127);
      localGC.setAntialias(1);
      localGC.setBackground(getDisplay().getSystemColor(1));
      localGC.fillOval(4, 4, 33, 33);
    }
  }
  
  private Listener createMouseListener()
  {
    new Listener()
    {
      public void handleEvent(Event paramAnonymousEvent)
      {
        if (!isEnabled()) {
          return;
        }
        if (type == 3) {
          mousePressed = true;
        }
        if ((type == 3) || ((type == 5) && (mousePressed)))
        {
          float f1 = x - 20.0F;
          float f2 = y - 20.0F;
          double d = Math.atan2(f1, f2);
          selection = (360 - (int)(360.0D * d / 6.283185307179586D + 360.0D) % 360);
          redraw();
        }
        if (type == 4)
        {
          mousePressed = false;
          AngleSlider.this.fireSelectionListeners(paramAnonymousEvent);
        }
      }
    };
  }
  
  private void fireSelectionListeners(Event paramEvent)
  {
    Iterator localIterator = selectionListeners.iterator();
    while (localIterator.hasNext())
    {
      SelectionListener localSelectionListener = (SelectionListener)localIterator.next();
      localSelectionListener.widgetSelected(new SelectionEvent(paramEvent));
    }
  }
  
  private Listener createKeyListener()
  {
    new Listener()
    {
      public void handleEvent(Event paramAnonymousEvent)
      {
        if (!isEnabled()) {
          return;
        }
        if (type != 1) {
          return;
        }
        if ((keyCode == 16777217) || (keyCode == 16777219)) {
          setSelection(selection + 5);
        }
        if ((keyCode == 16777218) || (keyCode == 16777220)) {
          setSelection(selection - 5);
        }
      }
    };
  }
  
  public void addSelectionListener(SelectionListener paramSelectionListener)
  {
    checkWidget();
    selectionListeners.add(paramSelectionListener);
  }
  
  public Point computeSize(int paramInt1, int paramInt2, boolean paramBoolean)
  {
    checkWidget();
    return new Point(40, 40);
  }
  
  public int getSelection()
  {
    checkWidget();
    return selection;
  }
  
  public void removeSelectionListener(SelectionListener paramSelectionListener)
  {
    checkWidget();
    selectionListeners.remove(paramSelectionListener);
  }
  
  public void setEnabled(boolean paramBoolean)
  {
    super.setEnabled(paramBoolean);
    redraw();
  }
  
  public void setSelection(int paramInt)
  {
    checkWidget();
    if ((paramInt < 0) || (paramInt > 360)) {
      SWT.error(28);
    }
    selection = paramInt;
    fireSelectionListeners(new Event());
    redraw();
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.angles.AngleSlider
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.breadcrumb;

import java.util.Iterator;
import java.util.List;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class Breadcrumb$1
  implements Listener
{
  Breadcrumb$1(Breadcrumb paramBreadcrumb) {}
  
  public void handleEvent(Event paramEvent)
  {
    Iterator localIterator = Breadcrumb.access$000(this$0).iterator();
    while (localIterator.hasNext())
    {
      BreadcrumbItem localBreadcrumbItem = (BreadcrumbItem)localIterator.next();
      if (localBreadcrumbItem.getBounds().contains(x, y))
      {
        int i = (localBreadcrumbItem.getStyle() & 0x2) != 0 ? 1 : 0;
        int j = (localBreadcrumbItem.getStyle() & 0x8) != 0 ? 1 : 0;
        if ((i != 0) || (j != 0))
        {
          localBreadcrumbItem.setSelection(!localBreadcrumbItem.getSelection());
          this$0.redraw();
          this$0.update();
        }
        return;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.breadcrumb.Breadcrumb.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.breadcrumb;

import java.util.Iterator;
import java.util.List;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class Breadcrumb$2
  implements Listener
{
  Breadcrumb$2(Breadcrumb paramBreadcrumb) {}
  
  public void handleEvent(Event paramEvent)
  {
    Iterator localIterator = Breadcrumb.access$000(this$0).iterator();
    while (localIterator.hasNext())
    {
      BreadcrumbItem localBreadcrumbItem = (BreadcrumbItem)localIterator.next();
      if (localBreadcrumbItem.getBounds().contains(x, y))
      {
        if ((localBreadcrumbItem.getStyle() & 0x8) != 0) {
          localBreadcrumbItem.setSelection(false);
        }
        if ((localBreadcrumbItem.getStyle() & 0xA) != 0)
        {
          localBreadcrumbItem.fireSelectionEvent();
          this$0.redraw();
          this$0.update();
        }
        return;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.breadcrumb.Breadcrumb.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.breadcrumb;

import java.util.Iterator;
import java.util.List;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class Breadcrumb$3
  implements Listener
{
  Breadcrumb$3(Breadcrumb paramBreadcrumb) {}
  
  public void handleEvent(Event paramEvent)
  {
    Iterator localIterator = Breadcrumb.access$000(this$0).iterator();
    while (localIterator.hasNext())
    {
      BreadcrumbItem localBreadcrumbItem = (BreadcrumbItem)localIterator.next();
      if (localBreadcrumbItem.getBounds().contains(x, y))
      {
        this$0.setToolTipText(localBreadcrumbItem.getTooltipText() == null ? "" : localBreadcrumbItem.getTooltipText());
        return;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.breadcrumb.Breadcrumb.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.breadcrumb;

import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;

class Breadcrumb$4
  implements PaintListener
{
  Breadcrumb$4(Breadcrumb paramBreadcrumb) {}
  
  public void paintControl(PaintEvent paramPaintEvent)
  {
    this$0.paintControl(paramPaintEvent);
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.breadcrumb.Breadcrumb.4
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.breadcrumb;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.mihalis.opal.utils.SWTGraphicUtil;

public class Breadcrumb
  extends Canvas
{
  private final List<BreadcrumbItem> items = new ArrayList();
  private static Color START_GRADIENT_COLOR = SWTGraphicUtil.createDisposableColor(255, 255, 255);
  private static Color END_GRADIENT_COLOR = SWTGraphicUtil.createDisposableColor(224, 224, 224);
  static Color BORDER_COLOR = SWTGraphicUtil.createDisposableColor(128, 128, 128);
  static Color BORDER_COLOR_1 = SWTGraphicUtil.createDisposableColor(212, 212, 212);
  static Color BORDER_COLOR_2 = SWTGraphicUtil.createDisposableColor(229, 229, 229);
  static Color BORDER_COLOR_3 = SWTGraphicUtil.createDisposableColor(243, 243, 243);
  boolean hasBorder = false;
  
  public Breadcrumb(Composite paramComposite, int paramInt)
  {
    super(paramComposite, checkStyle(paramInt) | 0x20000000);
    hasBorder = ((paramInt & 0x800) != 0);
    addListeners();
  }
  
  private static int checkStyle(int paramInt)
  {
    if ((paramInt & 0x800) != 0) {
      paramInt &= 0xF7FF;
    }
    return 0;
  }
  
  private void addListeners()
  {
    addListener(3, new Listener()
    {
      public void handleEvent(Event paramAnonymousEvent)
      {
        Iterator localIterator = items.iterator();
        while (localIterator.hasNext())
        {
          BreadcrumbItem localBreadcrumbItem = (BreadcrumbItem)localIterator.next();
          if (localBreadcrumbItem.getBounds().contains(x, y))
          {
            int i = (localBreadcrumbItem.getStyle() & 0x2) != 0 ? 1 : 0;
            int j = (localBreadcrumbItem.getStyle() & 0x8) != 0 ? 1 : 0;
            if ((i != 0) || (j != 0))
            {
              localBreadcrumbItem.setSelection(!localBreadcrumbItem.getSelection());
              redraw();
              update();
            }
            return;
          }
        }
      }
    });
    addListener(4, new Listener()
    {
      public void handleEvent(Event paramAnonymousEvent)
      {
        Iterator localIterator = items.iterator();
        while (localIterator.hasNext())
        {
          BreadcrumbItem localBreadcrumbItem = (BreadcrumbItem)localIterator.next();
          if (localBreadcrumbItem.getBounds().contains(x, y))
          {
            if ((localBreadcrumbItem.getStyle() & 0x8) != 0) {
              localBreadcrumbItem.setSelection(false);
            }
            if ((localBreadcrumbItem.getStyle() & 0xA) != 0)
            {
              localBreadcrumbItem.fireSelectionEvent();
              redraw();
              update();
            }
            return;
          }
        }
      }
    });
    addListener(32, new Listener()
    {
      public void handleEvent(Event paramAnonymousEvent)
      {
        Iterator localIterator = items.iterator();
        while (localIterator.hasNext())
        {
          BreadcrumbItem localBreadcrumbItem = (BreadcrumbItem)localIterator.next();
          if (localBreadcrumbItem.getBounds().contains(x, y))
          {
            setToolTipText(localBreadcrumbItem.getTooltipText() == null ? "" : localBreadcrumbItem.getTooltipText());
            return;
          }
        }
      }
    });
    addPaintListener(new PaintListener()
    {
      public void paintControl(PaintEvent paramAnonymousPaintEvent)
      {
        Breadcrumb.this.paintControl(paramAnonymousPaintEvent);
      }
    });
  }
  
  void addItem(BreadcrumbItem paramBreadcrumbItem)
  {
    items.add(paramBreadcrumbItem);
  }
  
  public Point computeSize(int paramInt1, int paramInt2, boolean paramBoolean)
  {
    int i = 0;
    int j = 0;
    Iterator localIterator = items.iterator();
    while (localIterator.hasNext())
    {
      BreadcrumbItem localBreadcrumbItem = (BreadcrumbItem)localIterator.next();
      i += localBreadcrumbItem.getWidth();
      j = Math.max(j, localBreadcrumbItem.getHeight());
    }
    return new Point(Math.max(i, paramInt1), Math.max(j, paramInt2));
  }
  
  public BreadcrumbItem getItem(int paramInt)
  {
    checkWidget();
    if ((paramInt < 0) || (paramInt > items.size())) {
      SWT.error(5);
    }
    return (BreadcrumbItem)items.get(paramInt);
  }
  
  public BreadcrumbItem getItem(Point paramPoint)
  {
    checkWidget();
    Iterator localIterator = items.iterator();
    while (localIterator.hasNext())
    {
      BreadcrumbItem localBreadcrumbItem = (BreadcrumbItem)localIterator.next();
      if (localBreadcrumbItem.getBounds().contains(paramPoint)) {
        return localBreadcrumbItem;
      }
    }
    return null;
  }
  
  public int getItemCount()
  {
    checkWidget();
    return items.size();
  }
  
  public BreadcrumbItem[] getItems()
  {
    checkWidget();
    return (BreadcrumbItem[])items.toArray(new BreadcrumbItem[items.size()]);
  }
  
  public int indexOf(BreadcrumbItem paramBreadcrumbItem)
  {
    checkWidget();
    return items.indexOf(paramBreadcrumbItem);
  }
  
  protected void paintControl(PaintEvent paramPaintEvent)
  {
    GC localGC = gc;
    localGC.setAdvanced(true);
    localGC.setAntialias(1);
    int i = getSizex;
    int j = getSizey;
    drawBackground(localGC, i, j);
    Iterator localIterator = items.iterator();
    int k = 0;
    while (localIterator.hasNext())
    {
      BreadcrumbItem localBreadcrumbItem = (BreadcrumbItem)localIterator.next();
      localBreadcrumbItem.drawButton(localGC, k, j, !localIterator.hasNext());
      k += localBreadcrumbItem.getWidth();
    }
  }
  
  private void drawBackground(GC paramGC, int paramInt1, int paramInt2)
  {
    paramGC.setForeground(START_GRADIENT_COLOR);
    paramGC.setBackground(END_GRADIENT_COLOR);
    paramGC.fillGradientRectangle(0, 0, paramInt1, paramInt2, true);
    if (hasBorder)
    {
      paramGC.setForeground(BORDER_COLOR);
      paramGC.drawRectangle(0, 0, paramInt1 - 1, paramInt2 - 1);
    }
  }
  
  void removeItem(BreadcrumbItem paramBreadcrumbItem)
  {
    items.remove(paramBreadcrumbItem);
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.breadcrumb.Breadcrumb
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.breadcrumb;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Item;
import org.mihalis.opal.utils.SWTGraphicUtil;

public class BreadcrumbItem
  extends Item
{
  private static final int MIN_WIDTH = 40;
  private static final int MARGIN = 4;
  private static Color SELECTED_COLOR = SWTGraphicUtil.createDisposableColor(223, 220, 213);
  private final Breadcrumb parentBreadcrumb;
  private final List<SelectionListener> selectionListeners;
  private Rectangle bounds;
  private boolean enabled;
  private boolean selection;
  private int width;
  private int height;
  private Image disabledImage;
  private Image selectionImage;
  private int alignment;
  private Color textColorSelected;
  private Color textColor;
  private String tooltipText;
  private GC gc;
  private int toolbarHeight;
  private boolean isLast;
  
  public BreadcrumbItem(Breadcrumb paramBreadcrumb)
  {
    this(paramBreadcrumb, 0);
  }
  
  public BreadcrumbItem(Breadcrumb paramBreadcrumb, int paramInt)
  {
    super(paramBreadcrumb, checkStyle(paramInt));
    paramBreadcrumb.addItem(this);
    parentBreadcrumb = paramBreadcrumb;
    textColor = paramBreadcrumb.getDisplay().getSystemColor(2);
    textColorSelected = paramBreadcrumb.getDisplay().getSystemColor(2);
    enabled = true;
    if ((paramInt & 0x4000) != 0) {
      alignment = 16384;
    }
    if ((paramInt & 0x1000000) != 0) {
      alignment = 16777216;
    }
    if ((paramInt & 0x20000) != 0) {
      alignment = 131072;
    }
    selectionListeners = new ArrayList();
    width = (height = -1);
  }
  
  private static int checkStyle(int paramInt)
  {
    paramInt = checkBits(paramInt, 0, 8, 2);
    if ((paramInt & 0xA) != 0) {
      return checkBits(paramInt, 16777216, 16384, 131072);
    }
    return paramInt;
  }
  
  static int checkBits(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    int i = paramInt2 | paramInt3 | paramInt4;
    if ((paramInt1 & i) == 0) {
      paramInt1 |= paramInt2;
    }
    if ((paramInt1 & paramInt2) != 0) {
      paramInt1 = paramInt1 & (i ^ 0xFFFFFFFF) | paramInt2;
    }
    if ((paramInt1 & paramInt3) != 0) {
      paramInt1 = paramInt1 & (i ^ 0xFFFFFFFF) | paramInt3;
    }
    if ((paramInt1 & paramInt4) != 0) {
      paramInt1 = paramInt1 & (i ^ 0xFFFFFFFF) | paramInt4;
    }
    return paramInt1;
  }
  
  public void addSelectionListener(SelectionListener paramSelectionListener)
  {
    checkWidget();
    if (paramSelectionListener == null) {
      SWT.error(4);
    }
    selectionListeners.add(paramSelectionListener);
  }
  
  Point computeDefaultSize()
  {
    Point localPoint = computeSizeOfTextAndImages();
    return new Point(8 + x, 8 + y);
  }
  
  private Point computeSizeOfTextAndImages()
  {
    int i = 0;
    int j = 0;
    int k = (getText() != null) && (!getText().equals("")) ? 1 : 0;
    if (k != 0)
    {
      localObject = new GC(parentBreadcrumb);
      ((GC)localObject).setFont(parentBreadcrumb.getFont());
      Point localPoint = ((GC)localObject).stringExtent(getText());
      ((GC)localObject).dispose();
      i += x;
      j = y;
    }
    Object localObject = new Point(-1, -1);
    computeImageSize(getImage(), (Point)localObject);
    computeImageSize(selectionImage, (Point)localObject);
    computeImageSize(disabledImage, (Point)localObject);
    if (x != -1)
    {
      i += x;
      j = Math.max(y, j);
      if (k != 0) {
        i += 4;
      }
    }
    return new Point(i, j);
  }
  
  private void computeImageSize(Image paramImage, Point paramPoint)
  {
    if (paramImage == null) {
      return;
    }
    Rectangle localRectangle = paramImage.getBounds();
    x = Math.max(width, x);
    y = Math.max(height, y);
  }
  
  public void dispose()
  {
    getParent().removeItem(this);
    bounds = null;
    if (disabledImage != null) {
      disabledImage.dispose();
    }
    disabledImage = null;
    if (selectionImage != null) {
      selectionImage.dispose();
    }
    selectionImage = null;
    if (textColor != null) {
      textColor.dispose();
    }
    textColor = null;
    if (textColorSelected != null) {
      textColorSelected.dispose();
    }
    textColorSelected = null;
    super.dispose();
  }
  
  void drawButton(GC paramGC, int paramInt1, int paramInt2, boolean paramBoolean)
  {
    gc = paramGC;
    toolbarHeight = paramInt2;
    isLast = paramBoolean;
    if (selection) {
      drawBackground(paramInt1);
    }
    if (!paramBoolean) {
      drawTriangles(paramInt1);
    }
    int i = computeStartingPosition(paramInt1);
    i += drawImage(paramInt1 + i);
    drawText(paramInt1 + i);
    bounds = new Rectangle(paramInt1, 0, getWidth(), paramInt2);
  }
  
  private void drawBackground(int paramInt)
  {
    gc.setAdvanced(true);
    gc.setAntialias(1);
    gc.setForeground(SELECTED_COLOR);
    gc.setBackground(SELECTED_COLOR);
    boolean bool = parentBreadcrumb.hasBorder;
    int i = parentBreadcrumb.indexOf(this) == 0 ? 1 : 0;
    int j = bool ? 1 : 0;
    int k;
    if (i != 0) {
      k = 0;
    } else {
      k = 5 + (bool ? 0 : 1);
    }
    int m = paramInt + j + k;
    int n = j;
    int i1 = getWidth() - j - k - ((isLast) && (bool) ? 1 : 0);
    int i2 = getHeight() - 2 * j;
    gc.fillRectangle(m, n, i1, i2);
    if (i == 0)
    {
      gc.fillPolygon(new int[] { m - 5, n, m, n, m, n + toolbarHeight / 2 });
      gc.fillPolygon(new int[] { m - 5, n + i2, m, n + i2, m, n + toolbarHeight / 2 });
    }
    if (!isLast) {
      gc.fillPolygon(new int[] { m + i1, n + 1, m + i1, n + getHeight(), m + i1 + 5, n + toolbarHeight / 2 });
    }
    gc.setClipping((Rectangle)null);
  }
  
  private void drawTriangles(int paramInt)
  {
    gc.setForeground(Breadcrumb.BORDER_COLOR);
    drawTriangle(paramInt + getWidth());
    gc.setAlpha(127);
    gc.setForeground(Breadcrumb.BORDER_COLOR_1);
    drawTriangle(paramInt + getWidth() + 1);
    gc.setForeground(Breadcrumb.BORDER_COLOR_2);
    drawTriangle(paramInt + getWidth() + 2);
    gc.setForeground(Breadcrumb.BORDER_COLOR_3);
    drawTriangle(paramInt + getWidth() + 3);
    gc.setAlpha(255);
    if (parentBreadcrumb.hasBorder)
    {
      gc.setForeground(Breadcrumb.BORDER_COLOR);
      gc.drawLine(paramInt + getWidth(), 0, paramInt + getWidth() + 3, 0);
      gc.drawLine(paramInt + getWidth(), toolbarHeight - 1, paramInt + getWidth() + 3, toolbarHeight - 1);
    }
  }
  
  private void drawTriangle(int paramInt)
  {
    gc.drawLine(paramInt, 0, paramInt + 5, toolbarHeight / 2);
    gc.drawLine(paramInt + 5, toolbarHeight / 2, paramInt, toolbarHeight);
  }
  
  private int computeStartingPosition(int paramInt)
  {
    int i = computeSizeOfTextAndImagesx;
    switch (alignment)
    {
    case 16777216: 
      return (getWidth() - i) / 2;
    case 131072: 
      return getWidth() - i - 4;
    }
    return 4;
  }
  
  void fireSelectionEvent()
  {
    Event localEvent = new Event();
    widget = parentBreadcrumb;
    display = getDisplay();
    item = this;
    type = 13;
    Iterator localIterator = selectionListeners.iterator();
    while (localIterator.hasNext())
    {
      SelectionListener localSelectionListener = (SelectionListener)localIterator.next();
      localSelectionListener.widgetSelected(new SelectionEvent(localEvent));
    }
  }
  
  private int drawImage(int paramInt)
  {
    Image localImage;
    if (!isEnabled()) {
      localImage = disabledImage;
    } else if (selection) {
      localImage = selectionImage;
    } else {
      localImage = getImage();
    }
    if (localImage == null) {
      return 0;
    }
    int i = (toolbarHeight - getBoundsheight) / 2;
    gc.drawImage(localImage, paramInt, i);
    return getBoundswidth + 4;
  }
  
  private void drawText(int paramInt)
  {
    gc.setFont(parentBreadcrumb.getFont());
    if (selection) {
      gc.setForeground(textColorSelected);
    } else {
      gc.setForeground(textColor);
    }
    Point localPoint = gc.stringExtent(getText());
    int i = (toolbarHeight - y) / 2;
    int j;
    if ((parentBreadcrumb.indexOf(this) == 0) || (isLast)) {
      j = 0;
    } else {
      j = 5;
    }
    gc.drawText(getText(), paramInt + j, i, true);
  }
  
  public int getAlignment()
  {
    checkWidget();
    return alignment;
  }
  
  public Rectangle getBounds()
  {
    checkWidget();
    return bounds;
  }
  
  public Image getDisabledImage()
  {
    checkWidget();
    return disabledImage;
  }
  
  public boolean getEnabled()
  {
    checkWidget();
    return enabled;
  }
  
  public int getHeight()
  {
    checkWidget();
    if (height == -1) {
      return computeDefaultSizey;
    }
    return height;
  }
  
  public Breadcrumb getParent()
  {
    checkWidget();
    return parentBreadcrumb;
  }
  
  public boolean getSelection()
  {
    checkWidget();
    return selection;
  }
  
  public Image getSelectionImage()
  {
    checkWidget();
    return selectionImage;
  }
  
  public Color getTextColor()
  {
    checkWidget();
    return textColor;
  }
  
  public Color getTextColorSelected()
  {
    checkWidget();
    return textColorSelected;
  }
  
  public String getTooltipText()
  {
    checkWidget();
    return tooltipText;
  }
  
  public int getWidth()
  {
    checkWidget();
    if (width == -1) {
      return Math.max(computeDefaultSizex, 40);
    }
    return Math.max(width, 40);
  }
  
  public boolean isEnabled()
  {
    checkWidget();
    return enabled;
  }
  
  public void removeSelectionListener(SelectionListener paramSelectionListener)
  {
    checkWidget();
    if (paramSelectionListener == null) {
      SWT.error(4);
    }
    selectionListeners.remove(paramSelectionListener);
  }
  
  public void setAlignment(int paramInt)
  {
    checkWidget();
    alignment = paramInt;
  }
  
  public void setBounds(Rectangle paramRectangle)
  {
    checkWidget();
    if (bounds == null) {
      SWT.error(4);
    }
    bounds = new Rectangle(Math.max(0, x), Math.max(0, y), Math.max(0, width), Math.max(0, height));
  }
  
  public void setDisabledImage(Image paramImage)
  {
    checkWidget();
    disabledImage = paramImage;
  }
  
  public void setEnabled(boolean paramBoolean)
  {
    checkWidget();
    enabled = paramBoolean;
  }
  
  public void setHeight(int paramInt)
  {
    checkWidget();
    height = Math.max(paramInt, 0);
  }
  
  public void setSelection(boolean paramBoolean)
  {
    checkWidget();
    selection = paramBoolean;
  }
  
  public void setSelectionImage(Image paramImage)
  {
    checkWidget();
    selectionImage = paramImage;
  }
  
  public void setTextColor(Color paramColor)
  {
    checkWidget();
    textColor = paramColor;
  }
  
  public void setTextColorSelected(Color paramColor)
  {
    checkWidget();
    textColorSelected = paramColor;
  }
  
  public void setTooltipText(String paramString)
  {
    checkWidget();
    tooltipText = (paramString == null ? "" : paramString);
  }
  
  public void setWidth(int paramInt)
  {
    checkWidget();
    width = Math.max(0, paramInt);
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.breadcrumb.BreadcrumbItem
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.brushedMetalComposite;

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class BrushedMetalComposite$1
  implements Listener
{
  BrushedMetalComposite$1(BrushedMetalComposite paramBrushedMetalComposite) {}
  
  public void handleEvent(Event paramEvent)
  {
    BrushedMetalComposite.access$000(this$0);
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.brushedMetalComposite.BrushedMetalComposite.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.brushedMetalComposite;

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.mihalis.opal.utils.SWTGraphicUtil;

class BrushedMetalComposite$2
  implements DisposeListener
{
  BrushedMetalComposite$2(BrushedMetalComposite paramBrushedMetalComposite) {}
  
  public void widgetDisposed(DisposeEvent paramDisposeEvent)
  {
    SWTGraphicUtil.dispose(BrushedMetalComposite.access$100(this$0));
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.brushedMetalComposite.BrushedMetalComposite.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.brushedMetalComposite;

import java.util.Random;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.mihalis.opal.utils.SWTGraphicUtil;

public class BrushedMetalComposite
  extends Composite
{
  private Image oldImage;
  private int radius = 10;
  private float amount = 0.1F;
  private int color = -7829368;
  private float shine = 0.1F;
  private boolean monochrome = true;
  private Random randomNumbers;
  
  public BrushedMetalComposite(Composite paramComposite, int paramInt)
  {
    super(paramComposite, paramInt);
    addListener(11, new Listener()
    {
      public void handleEvent(Event paramAnonymousEvent)
      {
        BrushedMetalComposite.this.redrawComposite();
      }
    });
    paramComposite.addDisposeListener(new DisposeListener()
    {
      public void widgetDisposed(DisposeEvent paramAnonymousDisposeEvent)
      {
        SWTGraphicUtil.dispose(oldImage);
      }
    });
  }
  
  private void redrawComposite()
  {
    Display localDisplay = getDisplay();
    Rectangle localRectangle = getClientArea();
    ImageData localImageData = drawBrushedMetalBackground(Math.max(1, width), Math.max(1, width));
    Image localImage = new Image(localDisplay, localImageData);
    setBackgroundImage(localImage);
    SWTGraphicUtil.dispose(oldImage);
    oldImage = localImage;
  }
  
  private ImageData drawBrushedMetalBackground(int paramInt1, int paramInt2)
  {
    int[] arrayOfInt = new int[paramInt1];
    PaletteData localPaletteData = new PaletteData(16711680, 65280, 255);
    ImageData localImageData = new ImageData(paramInt1, paramInt2, 32, localPaletteData);
    randomNumbers = new Random(0L);
    int i = color & 0xFF000000;
    int j = color >> 16 & 0xFF;
    int k = color >> 8 & 0xFF;
    int m = color & 0xFF;
    for (int n = 0; n < paramInt2; n++)
    {
      for (int i1 = 0; i1 < paramInt1; i1++)
      {
        int i2 = j;
        int i3 = k;
        int i4 = m;
        int i5;
        if (shine != 0.0F)
        {
          i5 = (int)(255.0F * shine * Math.sin(i1 / paramInt1 * 3.141592653589793D));
          i2 += i5;
          i3 += i5;
          i4 += i5;
        }
        if (monochrome)
        {
          i5 = (int)(255.0F * (2.0F * randomNumbers.nextFloat() - 1.0F) * amount);
          arrayOfInt[i1] = (i | clamp(i2 + i5) << 16 | clamp(i3 + i5) << 8 | clamp(i4 + i5));
        }
        else
        {
          arrayOfInt[i1] = (i | random(i2) << 16 | random(i3) << 8 | random(i4));
        }
      }
      if (radius != 0) {
        setDataElements(localImageData, localPaletteData, 0, n, paramInt1, 1, blur(arrayOfInt, paramInt1, radius));
      } else {
        setDataElements(localImageData, localPaletteData, 0, n, paramInt1, 1, arrayOfInt);
      }
    }
    return localImageData;
  }
  
  private void setDataElements(ImageData paramImageData, PaletteData paramPaletteData, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int[] paramArrayOfInt)
  {
    int i = 0;
    for (int j = paramInt2; j < paramInt2 + paramInt4; j++) {
      for (int k = paramInt1; k < paramInt1 + paramInt3; k++)
      {
        int m = paramArrayOfInt[(i++)];
        int n = paramPaletteData.getPixel(new RGB(m >> 16 & 0xFF, m >> 8 & 0xFF, m & 0xFF));
        paramImageData.setPixel(k, j, n);
        paramImageData.setAlpha(k, j, m >> 24 & 0xFF);
      }
    }
  }
  
  private int random(int paramInt)
  {
    paramInt += (int)(255.0F * (2.0F * randomNumbers.nextFloat() - 1.0F) * amount);
    if (paramInt < 0) {
      paramInt = 0;
    } else if (paramInt > 255) {
      paramInt = 255;
    }
    return paramInt;
  }
  
  private int clamp(int paramInt)
  {
    if (paramInt < 0) {
      return 0;
    }
    if (paramInt > 255) {
      return 255;
    }
    return paramInt;
  }
  
  private int[] blur(int[] paramArrayOfInt, int paramInt1, int paramInt2)
  {
    int[] arrayOfInt = new int[paramInt1];
    int i = paramInt1 - 1;
    int j = 2 * paramInt2 + 1;
    int k = 0;
    int m = 0;
    int n = 0;
    int i2;
    for (int i1 = -paramInt2; i1 <= paramInt2; i1++)
    {
      i2 = paramArrayOfInt[mod(i1, paramInt1)];
      k += (i2 >> 16 & 0xFF);
      m += (i2 >> 8 & 0xFF);
      n += (i2 & 0xFF);
    }
    for (i1 = 0; i1 < paramInt1; i1++)
    {
      arrayOfInt[i1] = (0xFF000000 | k / j << 16 | m / j << 8 | n / j);
      i2 = i1 + paramInt2 + 1;
      if (i2 > i) {
        i2 = mod(i2, paramInt1);
      }
      int i3 = i1 - paramInt2;
      if (i3 < 0) {
        i3 = mod(i3, paramInt1);
      }
      int i4 = paramArrayOfInt[i2];
      int i5 = paramArrayOfInt[i3];
      k += ((i4 & 0xFF0000) - (i5 & 0xFF0000) >> 16);
      m += ((i4 & 0xFF00) - (i5 & 0xFF00) >> 8);
      n += (i4 & 0xFF) - (i5 & 0xFF);
    }
    return arrayOfInt;
  }
  
  private int mod(int paramInt1, int paramInt2)
  {
    int i = paramInt1 / paramInt2;
    paramInt1 -= i * paramInt2;
    if (paramInt1 < 0) {
      return paramInt1 + paramInt2;
    }
    return paramInt1;
  }
  
  public int getRadius()
  {
    return radius;
  }
  
  public void setRadius(int paramInt)
  {
    radius = paramInt;
    redrawComposite();
  }
  
  public float getAmount()
  {
    return amount;
  }
  
  public void setAmount(float paramFloat)
  {
    if ((paramFloat < 0.0F) || (paramFloat > 1.0F)) {
      SWT.error(5);
    }
    amount = paramFloat;
    redrawComposite();
  }
  
  public Color getColor()
  {
    return new Color(getDisplay(), color >> 16 & 0xFF, color >> 8 & 0xFF, color & 0xFF);
  }
  
  public void setColor(Color paramColor)
  {
    if (paramColor == null) {
      SWT.error(4);
    }
    color = (0xFF000000 | paramColor.getRed() << 16 | paramColor.getGreen() << 8 | paramColor.getBlue());
    redrawComposite();
  }
  
  public float getShine()
  {
    return shine;
  }
  
  public void setShine(float paramFloat)
  {
    if ((amount < 0.0F) || (amount > 1.0F)) {
      SWT.error(5);
    }
    shine = paramFloat;
    redrawComposite();
  }
  
  public boolean isMonochrome()
  {
    return monochrome;
  }
  
  public void setMonochrome(boolean paramBoolean)
  {
    monochrome = paramBoolean;
    redrawComposite();
  }
}

/* Location:
 * Qualified Name:     org.mihalis.opal.brushedMetalComposite.BrushedMetalComposite
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.mihalis.opal.calculator;

import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd