Normand Briere
2019-06-23 8088590686a45e71278f9a52bb9cc37943dc0c37
Full-screen mode.
6 files modified
270 ■■■■ changed files
BoundaryRep.java 2 ●●●●● patch | view | raw | blame | history
CameraPane.java 56 ●●●●● patch | view | raw | blame | history
Globals.java 3 ●●●● patch | view | raw | blame | history
GroupEditor.java 97 ●●●● patch | view | raw | blame | history
ObjEditor.java 99 ●●●●● patch | view | raw | blame | history
Object3D.java 13 ●●●●● patch | view | raw | blame | history
BoundaryRep.java
....@@ -4155,6 +4155,8 @@
41554155
41564156 void MergeNormals()
41574157 {
4158
+ assert(!trimmed);
4159
+
41584160 boolean smooth = Grafreed.smoothmode;
41594161 boolean link = Grafreed.linkUV;
41604162 Grafreed.smoothmode = true;
CameraPane.java
....@@ -37,7 +37,6 @@
3737 static boolean[] selectedstack = new boolean[65536];
3838 static int materialdepth = 0;
3939
40
- static boolean DEBUG = false;
4140 static boolean FRUSTUM = false; // still bogus true; // frustum culling
4241
4342 // camera change fix
....@@ -2267,7 +2266,7 @@
22672266
22682267 void ToggleDebug()
22692268 {
2270
- DEBUG ^= true;
2269
+ Globals.DEBUG ^= true;
22712270 }
22722271
22732272 void ToggleLookAt()
....@@ -11459,6 +11458,24 @@
1145911458
1146011459 static boolean zoomonce = false;
1146111460
11461
+ void CreateSelectedPoint()
11462
+ {
11463
+ if (selectedpoint == null)
11464
+ {
11465
+ debugpointG = new Sphere();
11466
+ debugpointP = new Sphere();
11467
+ debugpointC = new Sphere();
11468
+ debugpointR = new Sphere();
11469
+
11470
+ selectedpoint = new Superellipsoid();
11471
+
11472
+ for (int i=0; i<8; i++)
11473
+ {
11474
+ debugpoints[i] = new Sphere();
11475
+ }
11476
+ }
11477
+ }
11478
+
1146211479 void DrawObject(GL gl, boolean draw)
1146311480 {
1146411481 //System.out.println("DRAW OBJECT " + mouseDown);
....@@ -11539,8 +11556,9 @@
1153911556
1154011557 if (DrawMode() == DEFAULT)
1154111558 {
11542
- if (DEBUG)
11559
+ if (Globals.DEBUG)
1154311560 {
11561
+ CreateSelectedPoint();
1154411562 float radius = 0.05f;
1154511563 if (selectedpoint.radius != radius)
1154611564 {
....@@ -14902,8 +14920,14 @@
1490214920 RevertCamera();
1490314921 repaint();
1490414922 break;
14905
- case 'L':
1490614923 case 'l':
14924
+ lightMode ^= true;
14925
+ Globals.lighttouched = true;
14926
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14927
+ targetLookAt.set(manipCamera.lookAt);
14928
+ repaint();
14929
+ break;
14930
+ case 'L':
1490714931 if (lightMode)
1490814932 {
1490914933 lightMode = false;
....@@ -15050,16 +15074,14 @@
1505015074 kompactbit = 6;
1505115075 break;
1505215076 case ' ':
15053
- lightMode ^= true;
15054
- Globals.lighttouched = true;
15055
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15056
- targetLookAt.set(manipCamera.lookAt);
15077
+ ObjEditor.theFrame.ToggleFullScreen();
1505715078 repaint();
1505815079 break;
1505915080 //case '`' :
1506015081 case ESC:
1506115082 RENDERPROGRAM += 1;
1506215083 RENDERPROGRAM %= 3;
15084
+
1506315085 repaint();
1506415086 break;
1506515087 case 'Z':
....@@ -17235,23 +17257,15 @@
1723517257 int AAbuffersize = 0;
1723617258
1723717259 //double[] selectedpoint = new double[3];
17238
- static Superellipsoid selectedpoint = new Superellipsoid();
17260
+ static Superellipsoid selectedpoint;
1723917261 static Sphere previousselectedpoint = null;
17240
- static Sphere debugpointG = new Sphere();
17241
- static Sphere debugpointP = new Sphere();
17242
- static Sphere debugpointC = new Sphere();
17243
- static Sphere debugpointR = new Sphere();
17262
+ static Sphere debugpointG;
17263
+ static Sphere debugpointP;
17264
+ static Sphere debugpointC;
17265
+ static Sphere debugpointR;
1724417266
1724517267 static Sphere debugpoints[] = new Sphere[8];
1724617268
17247
- static
17248
- {
17249
- for (int i=0; i<8; i++)
17250
- {
17251
- debugpoints[i] = new Sphere();
17252
- }
17253
- }
17254
-
1725517269 static void InitPoints(float radius)
1725617270 {
1725717271 for (int i=0; i<8; i++)
Globals.java
....@@ -1,7 +1,8 @@
11
22 public class Globals
33 {
4
- public static boolean ADVANCED = true; //false;
4
+ public static boolean DEBUG = false;
5
+ public static boolean ADVANCED = false;
56
67 static iCameraPane theRenderer;
78
GroupEditor.java
....@@ -246,7 +246,7 @@
246246
247247 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248248 toggleDebugItem.addItemListener(this);
249
- toggleDebugItem.setState(CameraPane.DEBUG);
249
+ toggleDebugItem.setState(Globals.DEBUG);
250250
251251 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252252 toggleFrustumItem.addItemListener(this);
....@@ -535,6 +535,18 @@
535535
536536 void SetupUI2(ObjEditor oe)
537537 {
538
+ // June 2019
539
+ if (oe == null)
540
+ {
541
+ //super.SetupUI2(this);
542
+ //return;
543
+ }
544
+
545
+ if (copy != group)
546
+ {
547
+ //super.SetupUI2(this);
548
+ }
549
+
538550 //new Exception().printStackTrace();
539551
540552 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -565,15 +577,27 @@
565577 */
566578 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
567579
568
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
581
+ //minButton.setToolTipText("Minimize window");
582
+ //minButton.addActionListener(this);
583
+
584
+ oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
+ maxButton.setToolTipText("Maximize window");
586
+ maxButton.addActionListener(this);
587
+
588
+ oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589
+ fullButton.setToolTipText("Full-screen window");
590
+ fullButton.addActionListener(this);
591
+
592
+ oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569593 undoButton.setToolTipText("Undo changes");
570594 undoButton.addActionListener(this);
571595
572
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573597 redoButton.setToolTipText("Redo changes");
574598 redoButton.addActionListener(this);
575599
576
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577601 saveButton.setToolTipText("Save changes");
578602 saveButton.addActionListener(this);
579603
....@@ -581,7 +605,7 @@
581605 liveCB.setToolTipText("Enable animation");
582606 liveCB.addItemListener(this);
583607
584
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
+ oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585609 oneStepButton.setToolTipText("Animate one step forward");
586610 oneStepButton.addActionListener(this);
587611
....@@ -589,7 +613,7 @@
589613 fastCB.setToolTipText("Fast mode");
590614 fastCB.addItemListener(this);
591615
592
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
616
+ oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
593617 trackCB.setToolTipText("Enable tracking");
594618 trackCB.addItemListener(this);
595619
....@@ -817,6 +841,8 @@
817841
818842 void SetupViews(ObjEditor oe)
819843 {
844
+ theFrame = this;
845
+
820846 oe.SetupViews();
821847
822848 System.out.println("SetupViews");
....@@ -1978,6 +2004,18 @@
19782004 {
19792005 DumpObject();
19802006 } else
2007
+ if (source == minButton)
2008
+ {
2009
+ Minimize();
2010
+ } else
2011
+ if (source == maxButton)
2012
+ {
2013
+ Maximize();
2014
+ } else
2015
+ if (source == fullButton)
2016
+ {
2017
+ ToggleFullScreen();
2018
+ } else
19812019 if (source == undoButton)
19822020 {
19832021 Undo();
....@@ -2899,6 +2937,24 @@
28992937 bigThree.ClearUI();
29002938 bigThree.add(centralPanel);
29012939 bigThree.FlushUI();
2940
+
2941
+ cameraView.requestFocusInWindow();
2942
+
2943
+// refreshContents(true);
2944
+//
2945
+// try
2946
+// {
2947
+// java.awt.Robot bot = new java.awt.Robot();
2948
+// int mask = InputEvent.BUTTON1_MASK;
2949
+// bot.mouseMove(100, 100);
2950
+// bot.mousePress(mask);
2951
+// bot.mouseRelease(mask);
2952
+// }
2953
+// catch (Exception e)
2954
+// {
2955
+//
2956
+// }
2957
+
29022958 } else
29032959 if (source == threeButton)
29042960 {
....@@ -2935,6 +2991,8 @@
29352991 bigThree.add(centralPanel);
29362992 bigThree.add(XYZPanel);
29372993 bigThree.FlushUI();
2994
+
2995
+ cameraView.requestFocusInWindow();
29382996 } else
29392997 if (source == fourButton)
29402998 {
....@@ -2970,6 +3028,8 @@
29703028 bigThree.ClearUI();
29713029 bigThree.add(scenePanel);
29723030 bigThree.FlushUI();
3031
+
3032
+ cameraView.requestFocusInWindow();
29733033 } else
29743034 if (source == sixButton)
29753035 {
....@@ -3006,6 +3066,8 @@
30063066 bigThree.add(scenePanel);
30073067 bigThree.add(centralPanel);
30083068 bigThree.FlushUI();
3069
+
3070
+ cameraView.requestFocusInWindow();
30093071 } else
30103072 if (source == sevenButton)
30113073 {
....@@ -3043,6 +3105,8 @@
30433105 bigThree.add(centralPanel);
30443106 bigThree.add(XYZPanel);
30453107 bigThree.FlushUI();
3108
+
3109
+ cameraView.requestFocusInWindow();
30463110 } else
30473111 if (source == rootButton)
30483112 {
....@@ -3054,6 +3118,7 @@
30543118 EditObject(obj);
30553119 }
30563120
3121
+ cameraView.requestFocusInWindow();
30573122 refreshContents(true);
30583123 } else
30593124 if (source == closeButton)
....@@ -3075,6 +3140,8 @@
30753140 break;
30763141 }
30773142 }
3143
+
3144
+ cameraView.requestFocusInWindow();
30783145 refreshContents(true);
30793146 } else
30803147 if (source == editItem || source == editButton)
....@@ -3179,7 +3246,7 @@
31793246 }
31803247
31813248 // fix "+" issue
3182
- group.editWindow = this;
3249
+ //group.editWindow = this;
31833250
31843251 /*
31853252 currentLayout = radio.layout;
....@@ -3192,6 +3259,8 @@
31923259 //group.parent = null; // ROOT
31933260 //group.attributes = -1;
31943261 ResetModel();
3262
+
3263
+ cameraView.requestFocusInWindow();
31953264 refreshContents(true);
31963265 } else if (event.getSource() == editCameraItem)
31973266 {
....@@ -3215,7 +3284,6 @@
32153284 }
32163285
32173286 boolean useclient = false;
3218
- cRadio radio;
32193287
32203288 void ToggleRoot()
32213289 {
....@@ -5219,9 +5287,12 @@
52195287 cButton clearpanelButton;
52205288 cButton unselectButton;
52215289
5222
- cButton saveButton;
5290
+ cButton minButton;
5291
+ cButton maxButton;
5292
+ cButton fullButton;
52235293 cButton undoButton;
52245294 cButton redoButton;
5295
+ cButton saveButton;
52255296 cButton oneStepButton;
52265297
52275298 cButton screenfitButton;
....@@ -5234,14 +5305,6 @@
52345305 cButton closeButton;
52355306
52365307 cButton setsupportButton;
5237
-
5238
- cButton twoButton;
5239
- cButton sixButton;
5240
- cButton threeButton;
5241
- cButton sevenButton;
5242
- cButton fourButton; // full panel
5243
- cButton oneButton; // full XYZ
5244
- //cButton currentLayout;
52455308
52465309 //
52475310 //Composite
ObjEditor.java
....@@ -36,6 +36,8 @@
3636 GroupEditor callee;
3737 JFrame frame;
3838
39
+ static ObjEditor theFrame;
40
+
3941 // SCRIPT
4042
4143 transient JFrame textpanel = null;
....@@ -244,6 +246,7 @@
244246 //localCopy.parent = null;
245247
246248 frame = new JFrame();
249
+ frame.setUndecorated(true);
247250 objEditor = this;
248251 this.callee = callee;
249252
....@@ -583,19 +586,89 @@
583586 }
584587 }
585588
589
+static GraphicsDevice device = GraphicsEnvironment
590
+ .getLocalGraphicsEnvironment().getScreenDevices()[0];
591
+
592
+ Rectangle keeprect;
593
+ cRadio radio;
594
+
595
+cButton keepButton;
596
+ cButton twoButton; // Full 3D
597
+ cButton sixButton;
598
+ cButton threeButton;
599
+ cButton sevenButton;
600
+ cButton fourButton; // full panel
601
+ cButton oneButton; // full XYZ
602
+ //cButton currentLayout;
603
+
604
+ boolean maximized;
605
+
606
+ void Minimize()
607
+ {
608
+ frame.setState(Frame.ICONIFIED);
609
+ }
610
+
611
+ void Maximize()
612
+ {
613
+ if (maximized)
614
+ {
615
+ frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
616
+ }
617
+ else
618
+ {
619
+ keeprect = frame.getBounds();
620
+ Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
621
+ Dimension rect2 = frame.getToolkit().getScreenSize();
622
+ frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
623
+// frame.setState(Frame.MAXIMIZED_BOTH);
624
+ }
625
+
626
+ maximized ^= true;
627
+ }
628
+
586629 void ToggleFullScreen()
587630 {
588631 if (CameraPane.FULLSCREEN)
589632 {
590
- frame.getContentPane().remove(/*"Center",*/bigThree);
591
- framePanel.add(bigThree);
592
- frame.getContentPane().add(/*"Center",*/framePanel);
633
+ device.setFullScreenWindow(null);
634
+ //frame.setVisible(false);
635
+// frame.removeNotify();
636
+// frame.setUndecorated(false);
637
+// frame.addNotify();
638
+ //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
639
+
640
+// X frame.getContentPane().remove(/*"Center",*/bigThree);
641
+// X framePanel.add(bigThree);
642
+// X frame.getContentPane().add(/*"Center",*/framePanel);
643
+ framePanel.setDividerLocation(1);
644
+
645
+ //frame.setVisible(true);
646
+ radio.layout = keepButton;
647
+ //theFrame = null;
648
+ keepButton = null;
649
+ radio.layout.doClick();
650
+
593651 } else
594652 {
595
- frame.getContentPane().remove(/*"Center",*/framePanel);
596
- framePanel.remove(bigThree);
597
- frame.getContentPane().add(/*"Center",*/bigThree);
653
+ keepButton = radio.layout;
654
+ //keeprect = frame.getBounds();
655
+// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
656
+// frame.getToolkit().getScreenSize().height);
657
+ //frame.setVisible(false);
658
+ device.setFullScreenWindow(frame);
659
+// frame.removeNotify();
660
+// frame.setUndecorated(true);
661
+// frame.addNotify();
662
+// X frame.getContentPane().remove(/*"Center",*/framePanel);
663
+// X framePanel.remove(bigThree);
664
+// X frame.getContentPane().add(/*"Center",*/bigThree);
665
+ framePanel.setDividerLocation(0);
666
+
667
+ radio.layout = twoButton;
668
+ radio.layout.doClick();
669
+ //frame.setVisible(true);
598670 }
671
+
599672 cameraView.ToggleFullScreen();
600673 }
601674
....@@ -947,7 +1020,7 @@
9471020 rewindCB.setToolTipText("Rewind animation");
9481021
9491022 randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
950
- randomCB.setToolTipText("Rewind or Go back and forth randomly");
1023
+ randomCB.setToolTipText("Randomly Rewind or Go back and forth");
9511024
9521025 if (Globals.ADVANCED)
9531026 {
....@@ -1184,8 +1257,11 @@
11841257 //worldPanel.setName("World");
11851258 centralPanel = new cGridBag();
11861259 centralPanel.preferredWidth = 20;
1187
- timelinePanel = new JPanel(new BorderLayout());
1188
- timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
1260
+
1261
+ if (Globals.ADVANCED)
1262
+ {
1263
+ timelinePanel = new JPanel(new BorderLayout());
1264
+ timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
11891265
11901266 cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel);
11911267 cameraPanel.setContinuousLayout(true);
....@@ -1194,7 +1270,10 @@
11941270 // cameraPanel.setDividerSize(9);
11951271 cameraPanel.setResizeWeight(1.0);
11961272
1273
+ }
1274
+
11971275 centralPanel.add(cameraView);
1276
+ centralPanel.setFocusable(true);
11981277 //frame.setJMenuBar(timelineMenubar);
11991278 //centralPanel.add(timelinePanel);
12001279
....@@ -1392,6 +1471,8 @@
13921471 frame.setSize(1280, 860);
13931472 frame.setVisible(true);
13941473
1474
+ cameraView.requestFocusInWindow();
1475
+
13951476 gridPanel.setDividerLocation(1.0);
13961477
13971478 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
Object3D.java
....@@ -2387,6 +2387,10 @@
23872387 }
23882388 */
23892389 }
2390
+ else
2391
+ {
2392
+ //((ObjEditor)editWindow).SetupUI2(null);
2393
+ }
23902394 }
23912395
23922396 void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root)
....@@ -6361,6 +6365,11 @@
63616365 return;
63626366 }
63636367
6368
+ if (dontselect)
6369
+ {
6370
+ //bRep.GenerateNormalsMINE();
6371
+ }
6372
+
63646373 display.DrawGeometry(bRep, flipV, selectmode);
63656374 } else // catch (Error e)
63666375 {
....@@ -7796,6 +7805,10 @@
77967805 editWindow = null;
77977806 } // ?
77987807 }
7808
+ else
7809
+ {
7810
+ //editWindow.closeUI();
7811
+ }
77997812 }
78007813
78017814 boolean root; // patch for edit windows