Normand Briere
2019-12-25 3d30e720e6f012f2d9996b136154dd551844998a
Conditional key pressed to support print screen.
5 files modified
90 ■■■■■ changed files
Camera.java 24 ●●●● patch | view | raw | blame | history
CameraPane.java 44 ●●●●● patch | view | raw | blame | history
GroupEditor.java 17 ●●●●● patch | view | raw | blame | history
Object3D.java 3 ●●●● patch | view | raw | blame | history
iCameraPane.java 2 ●●● patch | view | raw | blame | history
Camera.java
....@@ -99,6 +99,13 @@
9999 perspective = true;
100100 }
101101
102
+ private void Swap(cVector loc, cVector lat)
103
+ {
104
+ cStatic.point1.set(loc);
105
+ loc.set(lat);
106
+ lat.set(cStatic.point1);
107
+ }
108
+
102109 private void initCamera()
103110 {
104111 focalLength = 1;
....@@ -326,32 +333,23 @@
326333 {
327334 right.mul(-1);
328335
329
- cStatic.point1.set(location);
330
- location.set(lookAt);
331
- lookAt.set(cStatic.point1);
336
+ Swap(location, lookAt);
332337
333338 if (viewCode == 0 && locationBuf != null)
334339 {
335
- cStatic.point1.set(locationBuf);
336
- locationBuf.set(lookAtBuf);
337
- lookAtBuf.set(cStatic.point1);
340
+ Swap(locationBuf, lookAtBuf);
338341 }
339
- // UP.mul(-1);
340342
341343 RotatePosition(dx,-dy);
342344
343345 // UP.mul(-1);
344346 right.mul(-1);
345347
346
- cStatic.point1.set(location);
347
- location.set(lookAt);
348
- lookAt.set(cStatic.point1);
348
+ Swap(location, lookAt);
349349
350350 if (viewCode == 0 && locationBuf != null)
351351 {
352
- cStatic.point1.set(locationBuf);
353
- locationBuf.set(lookAtBuf);
354
- lookAtBuf.set(cStatic.point1);
352
+ Swap(locationBuf, lookAtBuf);
355353 }
356354
357355 computeTransform();
CameraPane.java
....@@ -15639,7 +15639,7 @@
1563915639 */
1564015640 }
1564115641
15642
- void keyPressed(int key, int modifiers)
15642
+ boolean keyPressed(int key, int modifiers)
1564315643 {
1564415644 //if(!isRenderer)
1564515645 // return;
....@@ -15651,7 +15651,7 @@
1565115651 SetMouseMode(0, modifiers);
1565215652 }
1565315653
15654
- Globals.theRenderer.keyPressed(key);
15654
+ return Globals.theRenderer.keyPressed(key);
1565515655 }
1565615656
1565715657 int kompactbit = 4; // power bit
....@@ -15669,7 +15669,7 @@
1566915669 static Cursor blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(
1567015670 cursorImg, new Point(0, 0), "blank cursor");
1567115671
15672
- public void keyPressed(int key)
15672
+ public boolean keyPressed(int key)
1567315673 {
1567415674 // Set the blank cursor to the JFrame.
1567515675 //object.editWindow.frame.
....@@ -16146,18 +16146,20 @@
1614616146 Globals.ONESTEP = true;
1614716147 repaint();
1614816148 break;
16149
- case BACKSPACE:
16150
- // almost working enablebackspace = true;
16151
- Globals.WALK ^= true;
16152
-
16153
- // SwitchCameras(false);
16154
- repaint();
16155
- break;
16149
+// case BACKSPACE:
16150
+// // almost working enablebackspace = true;
16151
+// Globals.WALK ^= true;
16152
+//
16153
+// // SwitchCameras(false);
16154
+// repaint();
16155
+// break;
1615616156
1615716157 default:
16158
- break;
16158
+ return (false);
1615916159 }
1616016160 //System.out.println("shaper_fovy = " + manipCamera.shaper_fovy);
16161
+
16162
+ return (true);
1616116163 }
1616216164
1616316165 static double OCCLUSIONBOOST = 1; // 0.5;
....@@ -16180,6 +16182,7 @@
1618016182 switch (e.getID())
1618116183 {
1618216184 case KeyEvent.KEY_PRESSED:
16185
+ boolean repaintit = false;
1618316186
1618416187 if (capsLocked)
1618516188 {
....@@ -16187,6 +16190,7 @@
1618716190 modifiers = e.getModifiersEx();
1618816191 keyPressed(e.getKeyChar(), modifiers);
1618916192 //Globals.theRenderer.keyPressed(e.getKeyChar());
16193
+ repaintit = true;
1619016194 }
1619116195 else
1619216196 {
....@@ -16196,17 +16200,23 @@
1619616200 {
1619716201 case DOWN_ARROW:
1619816202 lightCamera.DECAL /= 2;
16203
+ repaintit = true;
1619916204 break;
1620016205 case UP_ARROW:
1620116206 lightCamera.DECAL *= 2;
16207
+ repaintit = true;
1620216208 break;
1620316209 case LEFT_ARROW:
1620416210 lightCamera.SCALE /= 2;
16211
+ repaintit = true;
1620516212 break;
1620616213 case RIGHT_ARROW:
1620716214 lightCamera.SCALE *= 2;
16215
+ repaintit = true;
1620816216 break;
1620916217 default:
16218
+ modifiers = e.getModifiersEx();
16219
+ repaintit = keyPressed(e.getKeyChar(), modifiers);
1621016220 break;
1621116221 }
1621216222
....@@ -16217,25 +16227,30 @@
1621716227 {
1621816228 case DOWN_ARROW:
1621916229 GoDown(e.getModifiersEx());
16230
+ repaintit = true;
1622016231 break;
1622116232 case UP_ARROW:
1622216233 GoUp(e.getModifiersEx());
16234
+ repaintit = true;
1622316235 break;
1622416236 case LEFT_ARROW:
1622516237 GoLeft(e.getModifiersEx());
16238
+ repaintit = true;
1622616239 break;
1622716240 case RIGHT_ARROW:
1622816241 GoRight(e.getModifiersEx());
16242
+ repaintit = true;
1622916243 break;
1623016244 default:
1623116245 modifiers = e.getModifiersEx();
16232
- keyPressed(e.getKeyChar(), modifiers);
16246
+ repaintit = keyPressed(e.getKeyChar(), modifiers);
1623316247 break;
1623416248 }
1623516249 }
1623616250 }
1623716251
16238
- repaint();
16252
+ if (repaintit)
16253
+ repaint();
1623916254 break;
1624016255 // if (!autorepeat)
1624116256 // {
....@@ -16311,7 +16326,8 @@
1631116326 keys[e.getKeyCode()] = false;
1631216327 modifiers = e.getModifiersEx();
1631316328 keyReleased(e.getKeyChar(), e.getModifiersEx());
16314
- repaint();
16329
+ //if (e.getKeyCode() != 65535)
16330
+ // repaint();
1631516331 break;
1631616332 // {
1631716333 // switch (e.getKeyCode())
GroupEditor.java
....@@ -1119,13 +1119,17 @@
11191119 antialiasCB.setToolTipText("Final render");
11201120 antialiasCB.addItemListener(this);
11211121
1122
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1123
+ restoreCameraButton.setToolTipText("Restore viewpoint");
1124
+ restoreCameraButton.addActionListener(this);
1125
+
11221126 oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11231127 screenfitButton.setToolTipText("Screen fit");
11241128 screenfitButton.addActionListener(this);
11251129
1126
- oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1127
- restoreCameraButton.setToolTipText("Restore viewpoint");
1128
- restoreCameraButton.addActionListener(this);
1130
+ oe.toolbarPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1131
+ flashSelectionButton.setToolTipText("Highlight selection");
1132
+ flashSelectionButton.addActionListener(this);
11291133
11301134 versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
11311135 saveVersionButton.setToolTipText("Duplicate current version");
....@@ -1314,9 +1318,9 @@
13141318 //unselectButton.setToolTipText("Unselect");
13151319 //unselectButton.addActionListener(this);
13161320
1317
- editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1318
- flashSelectionButton.setToolTipText("Highlight selection");
1319
- flashSelectionButton.addActionListener(this);
1321
+// editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
1322
+// flashSelectionButton.setToolTipText("Highlight selection");
1323
+// flashSelectionButton.addActionListener(this);
13201324
13211325 editCommandsPanel.preferredHeight = 1;
13221326
....@@ -5587,6 +5591,7 @@
55875591 editButton.setEnabled(enabled);
55885592 uneditButton.setEnabled(enabled);
55895593 //unselectButton.setEnabled(enabled);
5594
+ screenfitButton.setEnabled(enabled);
55905595 flashSelectionButton.setEnabled(enabled);
55915596
55925597 clearPanelButton.setEnabled(!listUI.isEmpty());
Object3D.java
....@@ -1204,7 +1204,8 @@
12041204 if (maxcount == 0)
12051205 {
12061206 System.out.println("maxcount == 0");
1207
- System.exit(0); // maxcount = 128; // 2048; // 4;
1207
+ //System.exit(0);
1208
+ maxcount = 128; // 2048; // 4;
12081209 }
12091210 // if (acceleration == 0)
12101211 // acceleration = 10;
iCameraPane.java
....@@ -92,7 +92,7 @@
9292
9393 void processKeyEvent(java.awt.event.KeyEvent e);
9494
95
- void keyPressed(int key);
95
+ boolean keyPressed(int key);
9696
9797 // For scripts
9898 void ToggleLive();