summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/ToolBar.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/ToolBar.java
downloadworlds.jar-main.tar.xz
worlds.jar-main.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/scape/ToolBar.java')
-rw-r--r--NET/worlds/scape/ToolBar.java265
1 files changed, 265 insertions, 0 deletions
diff --git a/NET/worlds/scape/ToolBar.java b/NET/worlds/scape/ToolBar.java
new file mode 100644
index 0000000..c20c983
--- /dev/null
+++ b/NET/worlds/scape/ToolBar.java
@@ -0,0 +1,265 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import NET.worlds.console.Console;
+/* */ import NET.worlds.console.DialogDisabled;
+/* */ import NET.worlds.console.ExposedPanel;
+/* */ import NET.worlds.console.GammaFrame;
+/* */ import NET.worlds.console.Main;
+/* */ import NET.worlds.console.MainCallback;
+/* */ import NET.worlds.console.Window;
+/* */ import java.awt.Color;
+/* */ import java.awt.Event;
+/* */ import java.awt.FlowLayout;
+/* */ import java.awt.Rectangle;
+/* */ import java.util.Enumeration;
+/* */ import java.util.Vector;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ class ToolBar
+/* */ extends ExposedPanel
+/* */ implements MainCallback, DialogDisabled
+/* */ {
+/* */ private static final long serialVersionUID = 1L;
+/* 31 */ private Vector<WidgetButton> buttons = new Vector();
+/* */ private WidgetButton active;
+/* */ private boolean activeDown;
+/* */ private WidgetButton entered;
+/* */ private WObject curWObj;
+/* 36 */ private boolean haveDelta = false;
+/* */ private WObjectHighlighter highlight;
+/* */ private boolean initialDrag;
+/* */ private boolean isDialogDisabled;
+/* */ private boolean testConstrained;
+/* */
+/* */ public ToolBar() {
+/* 43 */ setLayout(new FlowLayout(0, 1, 1));
+/* 44 */ addButton(new HTransWidget(this));
+/* 45 */ addButton(new VTransWidget(this));
+/* 46 */ addButton(new PitchWidget(this));
+/* 47 */ addButton(new RollWidget(this));
+/* 48 */ addButton(new YawWidget(this));
+/* 49 */ addButton(new ScaleWidget(this));
+/* 50 */ addButton(new CutWidget(this));
+/* 51 */ addButton(new CopyWidget(this));
+/* 52 */ addButton(new PasteWidget(this));
+/* 53 */ addButton(new SaveWidget(this));
+/* 54 */ addButton(new UndoWidget(this));
+/* 55 */ setBackground(Color.lightGray);
+/* */ }
+/* */
+/* */ public void done()
+/* */ {
+/* 60 */ if (this.highlight != null) {
+/* 61 */ this.highlight.stop();
+/* */ }
+/* */ }
+/* */
+/* */ private void addButton(WidgetButton button) {
+/* 66 */ add(button);
+/* 67 */ this.buttons.addElement(button);
+/* */ }
+/* */
+/* */ public void setCurrentObject(Object obj)
+/* */ {
+/* 72 */ this.curWObj = ((obj instanceof WObject) ? (WObject)obj : null);
+/* 73 */ if (this.highlight != null) {
+/* 74 */ this.highlight.stop();
+/* 75 */ this.highlight = null;
+/* */ }
+/* 77 */ if (this.curWObj != null)
+/* 78 */ this.highlight = new WObjectHighlighter(this.curWObj);
+/* 79 */ Enumeration<WidgetButton> e = this.buttons.elements();
+/* 80 */ clearPrompt();
+/* 81 */ while (e.hasMoreElements()) {
+/* 82 */ ((WidgetButton)e.nextElement()).repaint();
+/* */ }
+/* */ }
+/* */
+/* */ public WObject getCurrentWObject() {
+/* 87 */ return this.curWObj;
+/* */ }
+/* */
+/* */ public void dialogDisable(boolean disable)
+/* */ {
+/* 92 */ this.isDialogDisabled = disable;
+/* */ }
+/* */
+/* */ @Deprecated
+/* */ public boolean handleEvent(Event event)
+/* */ {
+/* 98 */ if (this.isDialogDisabled)
+/* 99 */ return false;
+/* 100 */ return super.handleEvent(event);
+/* */ }
+/* */
+/* */ @Deprecated
+/* */ public synchronized boolean mouseDown(Event event, int x, int y)
+/* */ {
+/* */ WidgetButton button;
+/* 107 */ if (((event.target instanceof WidgetButton)) &&
+/* 108 */ ((event.modifiers & 0x4) == 0) && (this.active == null) &&
+/* 109 */ ((button = (WidgetButton)event.target).available())) {
+/* 110 */ this.active = button;
+/* 111 */ this.active.draw(true);
+/* 112 */ if (this.active.usesDrag()) {
+/* 113 */ this.initialDrag = true;
+/* 114 */ this.highlight.stop();
+/* 115 */ Window.hideCursor();
+/* 116 */ Main.register(this);
+/* */
+/* */
+/* 119 */ this.haveDelta = true;
+/* */ }
+/* */ else {
+/* 122 */ this.activeDown = true;
+/* */ } }
+/* 124 */ return true;
+/* */ }
+/* */
+/* */ private boolean constrainToX;
+/* */ private boolean constrainToY;
+/* */ private int cumx;
+/* */ private int cumy;
+/* 131 */ private float motionDivisor = 1.0F;
+/* */ private static final int constrainThresh = 5;
+/* */
+/* */ @Deprecated
+/* */ public synchronized boolean mouseDrag(Event event, int x, int y)
+/* */ {
+/* 137 */ if (this.active != null) {
+/* 138 */ if (this.active.usesDrag())
+/* */ {
+/* 140 */ if (((event.modifiers & 0x1) != 0) &&
+/* 141 */ (!this.constrainToX) && (!this.constrainToY)) {
+/* 142 */ this.testConstrained = true;
+/* 143 */ this.cumx = (this.cumy = 0);
+/* */ }
+/* */
+/* 146 */ this.motionDivisor = ((event.modifiers & 0x2) != 0 ?
+/* 147 */ 10.0F : 1.0F);
+/* 148 */ this.haveDelta = true;
+/* */ }
+/* */ else {
+/* 151 */ boolean inside = this.active.getBounds().contains(x, y);
+/* 152 */ if (inside != this.activeDown)
+/* 153 */ this.active.draw(this.activeDown = inside);
+/* */ }
+/* */ }
+/* 156 */ return true;
+/* */ }
+/* */
+/* */ public synchronized void mainCallback()
+/* */ {
+/* 161 */ if ((this.haveDelta) && (this.active != null)) {
+/* 162 */ int[] pos = Window.getHiddenCursorDelta();
+/* 163 */ if (this.testConstrained) {
+/* 164 */ this.cumx += pos[0];
+/* 165 */ this.cumy += pos[1];
+/* 166 */ int acumx = Math.abs(this.cumx);
+/* 167 */ int acumy = Math.abs(this.cumy);
+/* 168 */ if (acumx > acumy + 5) {
+/* 169 */ this.constrainToX = true;
+/* 170 */ } else if (acumy > acumx + 5) {
+/* 171 */ this.constrainToY = true;
+/* */ } else
+/* 173 */ return;
+/* 174 */ this.testConstrained = false;
+/* */ }
+/* 176 */ if (this.constrainToX) {
+/* 177 */ pos[0] += this.cumx;
+/* 178 */ this.cumx = 0;
+/* 179 */ pos[1] = 0;
+/* */ }
+/* 181 */ else if (this.constrainToY) {
+/* 182 */ pos[1] += this.cumy;
+/* 183 */ this.cumy = 0;
+/* 184 */ pos[0] = 0;
+/* */ }
+/* 186 */ setPrompt(this.active.drag(this.initialDrag, pos[0] / this.motionDivisor,
+/* 187 */ -pos[1] / this.motionDivisor));
+/* 188 */ this.initialDrag = false;
+/* 189 */ this.haveDelta = false;
+/* */ }
+/* */ }
+/* */
+/* */ @Deprecated
+/* */ public synchronized boolean mouseUp(Event event, int x, int y)
+/* */ {
+/* 196 */ if (this.active != null) {
+/* 197 */ this.active.draw(false);
+/* 198 */ boolean needUpdate = true;
+/* 199 */ if (this.active.usesDrag()) {
+/* 200 */ this.highlight.start();
+/* 201 */ Main.unregister(this);
+/* 202 */ } else if (this.activeDown) {
+/* 203 */ this.active.perform();
+/* 204 */ this.activeDown = false;
+/* */ }
+/* */ else {
+/* 207 */ needUpdate = false; }
+/* 208 */ this.active = null;
+/* 209 */ if (needUpdate)
+/* 210 */ Console.getFrame().getEditTile().update();
+/* */ }
+/* 212 */ return true;
+/* */ }
+/* */
+/* */ @Deprecated
+/* */ public boolean mouseEnter(Event event, int x, int y)
+/* */ {
+/* */ WidgetButton button;
+/* 219 */ if ((this.active == null) && ((event.target instanceof WidgetButton)) &&
+/* 220 */ ((button = (WidgetButton)event.target).available())) {
+/* 221 */ this.entered = button;
+/* 222 */ setPrompt(this.entered.getPrompt());
+/* */ }
+/* 224 */ return true;
+/* */ }
+/* */
+/* */ @Deprecated
+/* */ public boolean mouseMove(Event event, int x, int y)
+/* */ {
+/* 230 */ return mouseEnter(event, x, y);
+/* */ }
+/* */
+/* */ @Deprecated
+/* */ public synchronized boolean keyUp(Event event, int key)
+/* */ {
+/* 236 */ if ((event.modifiers & 0x1) == 0)
+/* 237 */ this.testConstrained = (this.constrainToX = this.constrainToY = 0);
+/* 238 */ return true;
+/* */ }
+/* */
+/* */ public void setPrompt(String prompt)
+/* */ {
+/* 243 */ Console.getFrame().getEditTile().setPrompt(prompt);
+/* */ }
+/* */
+/* */ private void clearPrompt()
+/* */ {
+/* 248 */ this.entered = null;
+/* 249 */ Console.getFrame().getEditTile().setPrompt(null);
+/* */ }
+/* */
+/* */ @Deprecated
+/* */ public boolean mouseExit(Event event, int x, int y)
+/* */ {
+/* 255 */ if ((this.active == null) && (event.target == this.entered))
+/* 256 */ clearPrompt();
+/* 257 */ return true;
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\ToolBar.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file