Normand Briere
2019-06-24 47cd0f0a3870d843cb758535316060d30f15c811
GroupEditor.java
....@@ -150,6 +150,8 @@
150150
151151 void SetupMenu2(GroupEditor oe)
152152 {
153
+ oe.jTree = new cTree();
154
+
153155 Menu menu;
154156 oe.menuBar.add(menu = new Menu("Edit"));
155157 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +162,7 @@
160162 // redoItem = menu.add(new MenuItem("Redo"));
161163 // redoItem.addActionListener(this);
162164 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
165
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164166 duplicateItem.addActionListener(this);
165167 cloneItem = menu.add(new MenuItem("Clone"));
166168 cloneItem.addActionListener(this);
....@@ -334,13 +336,21 @@
334336 frontItem.addActionListener(this);
335337 compositeItem = menu.add(new MenuItem("Composite"));
336338 compositeItem.addActionListener(this);
339
+
340
+ if (Globals.ADVANCED)
341
+ {
337342 hideItem = menu.add(new MenuItem("Hidden Group"));
338343 hideItem.addActionListener(this);
344
+ }
339345 ungroupItem = menu.add(new MenuItem("Ungroup"));
340346 ungroupItem.addActionListener(this);
347
+
341348 menu.add("-");
349
+
342350 randomItem = menu.add(new MenuItem("Switch node"));
343351 randomItem.addActionListener(this);
352
+ if (Globals.ADVANCED)
353
+ {
344354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
345355 switchGeoItem.addActionListener(this);
346356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -348,8 +358,6 @@
348358 morphItem = menu.add(new MenuItem("Morph Group"));
349359 morphItem.addActionListener(this);
350360
351
- if (Globals.ADVANCED)
352
- {
353361 menu.add("-");
354362 physicsItem = menu.add(new MenuItem("Physics"));
355363 physicsItem.addActionListener(this);
....@@ -580,43 +588,45 @@
580588 //minButton.setToolTipText("Minimize window");
581589 //minButton.addActionListener(this);
582590
583
- oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
591
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584592 maxButton.setToolTipText("Maximize window");
585593 maxButton.addActionListener(this);
586594
587
- oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
595
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588596 fullButton.setToolTipText("Full-screen window");
589597 fullButton.addActionListener(this);
590598
591
- oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
599
+ oe.toolboxPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592600 undoButton.setToolTipText("Undo changes");
593601 undoButton.addActionListener(this);
594602
595
- oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
+ oe.toolboxPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596604 redoButton.setToolTipText("Redo changes");
597605 redoButton.addActionListener(this);
598606
599
- oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
607
+ oe.toolboxPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600608 saveButton.setToolTipText("Save changes");
601609 saveButton.addActionListener(this);
602610
603
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
611
+ oe.toolboxPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
604612 liveCB.setToolTipText("Enable animation");
605613 liveCB.addItemListener(this);
606614
607
- oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ oe.toolboxPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608616 oneStepButton.setToolTipText("Animate one step forward");
609617 oneStepButton.addActionListener(this);
610618
611
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
619
+ oe.toolboxPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
612620 fastCB.setToolTipText("Fast mode");
613621 fastCB.addItemListener(this);
614622
615
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
623
+ oe.toolboxPanel.Return();
624
+
625
+ oe.toolboxPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
616626 trackCB.setToolTipText("Enable tracking");
617627 trackCB.addItemListener(this);
618628
619
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ oe.toolboxPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620630 screenfitButton.setToolTipText("Screen fit");
621631 screenfitButton.addActionListener(this);
622632
....@@ -630,15 +640,17 @@
630640 snapobjectButton.setToolTipText("Snap Object");
631641 }
632642
633
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- flashSelectionButton.setToolTipText("Show selection");
643
+ oe.toolboxPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ flashSelectionButton.setToolTipText("Highlight selection");
635645 flashSelectionButton.addActionListener(this);
636646
637
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
647
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
638648
639649 oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
640650 twoButton.setToolTipText("Show center view only");
641651 twoButton.addActionListener(this);
652
+ this.fullscreenLayout = twoButton;
653
+
642654 oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
643655 fourButton.addActionListener(this);
644656 fourButton.setToolTipText("Show left panel only");
....@@ -653,16 +665,63 @@
653665 sevenButton.addActionListener(this);
654666 //
655667
656
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657669 rootButton.setToolTipText("Edit selection in new tab");
658670 rootButton.addActionListener(this);
659671
660
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
672
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
661673 closeButton.setToolTipText("Close tab");
662674 closeButton.addActionListener(this);
663675 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
664676 //clearButton.addActionListener(this);
665
-
677
+
678
+ // INSERT
679
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
680
+ gridButton.setToolTipText("Create grid");
681
+ gridButton.addActionListener(this);
682
+
683
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ boxButton.setToolTipText("Create box");
685
+ boxButton.addActionListener(this);
686
+
687
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ sphereButton.setToolTipText("Create sphere");
689
+ sphereButton.addActionListener(this);
690
+
691
+ oe.toolboxPanel.Return();
692
+
693
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694
+ coneButton.setToolTipText("Create cone");
695
+ coneButton.addActionListener(this);
696
+
697
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698
+ torusButton.setToolTipText("Create torus");
699
+ torusButton.addActionListener(this);
700
+
701
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
702
+ superButton.setToolTipText("Create superellipsoid");
703
+ superButton.addActionListener(this);
704
+
705
+ if (Globals.ADVANCED)
706
+ {
707
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ kleinButton.setToolTipText("Create Klein bottle");
709
+ kleinButton.addActionListener(this);
710
+ }
711
+
712
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ particlesButton.setToolTipText("Create particle system");
714
+ particlesButton.addActionListener(this);
715
+
716
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
717
+ overlayButton.setToolTipText("Create overlay");
718
+ overlayButton.addActionListener(this);
719
+
720
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
721
+ lightButton.setToolTipText("Create light");
722
+ lightButton.addActionListener(this);
723
+
724
+ // EDIT panel
666725 editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
667726 editButton.setToolTipText("Edit selection");
668727 editButton.addActionListener(this);
....@@ -703,7 +762,7 @@
703762
704763 JScrollPane jSP;
705764 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
706
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
765
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
707766 ResetModel();
708767
709768 oe.treePanel.add(jSPPanel);
....@@ -815,6 +874,10 @@
815874 shadowCB.setToolTipText("Compute shadows when live");
816875 shadowCB.addItemListener(this);
817876
877
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
878
+ autosaveCB.setToolTipText("Auto-save on structure change");
879
+ autosaveCB.addItemListener(this);
880
+
818881 if (Globals.ADVANCED)
819882 {
820883 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
....@@ -864,25 +927,26 @@
864927 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
865928 }
866929
867
- JCheckBox liveCB;
868
- JCheckBox supportCB;
869
- JCheckBox localCB;
870
- JCheckBox crowdCB;
871
- JCheckBox smoothCB;
872
- JCheckBox fastCB;
873
- JCheckBox slowCB;
874
- JCheckBox boxCB;
875
- JCheckBox zoomBoxCB;
876
- JCheckBox trackCB;
877
- JCheckBox smoothfocusCB;
930
+ cToggleButton liveCB;
931
+ cCheckBox supportCB;
932
+ cCheckBox localCB;
933
+ cCheckBox crowdCB;
934
+ cCheckBox smoothCB;
935
+ cToggleButton fastCB;
936
+ cCheckBox slowCB;
937
+ cCheckBox boxCB;
938
+ cCheckBox zoomBoxCB;
939
+ cToggleButton trackCB;
940
+ cCheckBox smoothfocusCB;
878941 // JCheckBox speakerMocapCB;
879
- JCheckBox speakerCameraCB;
880
- JCheckBox speakerFocusCB;
881
- JCheckBox debugCB;
942
+ cCheckBox speakerCameraCB;
943
+ cCheckBox speakerFocusCB;
944
+ cCheckBox debugCB;
882945
883
- JCheckBox oeilCB;
884
- JCheckBox shadowCB;
885
- JCheckBox lookAtCB;
946
+ cCheckBox oeilCB;
947
+ cCheckBox shadowCB;
948
+ cCheckBox autosaveCB;
949
+ cCheckBox lookAtCB;
886950
887951 // static int COLOR = 1;
888952 // static int MATERIAL = 2;
....@@ -890,9 +954,9 @@
890954
891955 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
892956
893
- JCheckBox colorCB;
894
- JCheckBox materialCB;
895
- JCheckBox textureCB;
957
+ cCheckBox colorCB;
958
+ cCheckBox materialCB;
959
+ cCheckBox textureCB;
896960
897961 public void itemStateChanged(ItemEvent e)
898962 {
....@@ -989,6 +1053,10 @@
9891053 {
9901054 Globals.COMPUTESHADOWWHENLIVE ^= true;
9911055 }
1056
+ else if(e.getSource() == autosaveCB)
1057
+ {
1058
+ Globals.SAVEONMAKE ^= true;
1059
+ }
9921060 else if(e.getSource() == lookAtCB)
9931061 {
9941062 cameraView.ToggleLookAt();
....@@ -1005,7 +1073,8 @@
10051073
10061074 /**/
10071075 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
1008
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1076
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1077
+ TreePath path = objEditor.jTree.getSelectionPath();
10091078 if ((path == null) || (path.getPathCount() <= 1)) {
10101079 // We can't move the root node or an empty selection
10111080 return;
....@@ -1129,16 +1198,16 @@
11291198 return;
11301199 }
11311200
1132
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1133
- {
1201
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1202
+// {
11341203 loadClipboard(true);
11351204 objEditor.jTree.setSelectionPath(destinationPath);
11361205 pasteInto(false, false);
1137
- } else {
1138
- loadClipboard(false);
1139
- objEditor.jTree.setSelectionPath(destinationPath);
1140
- pasteInto(false, false); // true); // ???
1141
- }
1206
+// } else {
1207
+// loadClipboard(false);
1208
+// objEditor.jTree.setSelectionPath(destinationPath);
1209
+// pasteInto(false, false); // true); // ???
1210
+// }
11421211 }
11431212 public void dropActionChanged(DropTargetDragEvent dtde)
11441213 // Called if the user has modified the current drop gesture
....@@ -1730,11 +1799,11 @@
17301799 objEditor.cameraView.renderCamera.setAim(v2, v1);
17311800 objEditor.cameraView.repaint();
17321801 } else
1733
- if (source == rectoidItem)
1802
+ if (source == rectoidItem || source == boxButton)
17341803 {
17351804 makeSomething(new Box());
17361805 } else
1737
- if (source == particleItem)
1806
+ if (source == particleItem || source == particlesButton)
17381807 {
17391808 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
17401809 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1813,27 +1882,27 @@
18131882
18141883 makeSomething(obj);
18151884 } else
1816
- if (source == gridItem)
1885
+ if (source == gridItem || source == gridButton)
18171886 {
18181887 makeSomething(new Grid());
18191888 } else
1820
- if (source == ellipsoidItem)
1889
+ if (source == ellipsoidItem || source == sphereButton)
18211890 {
18221891 makeSomething(new Sphere());
18231892 } else
1824
- if (source == coneItem)
1893
+ if (source == coneItem || source == coneButton)
18251894 {
18261895 makeSomething(new Cone());
18271896 } else
1828
- if (source == torusItem)
1897
+ if (source == torusItem || source == torusButton)
18291898 {
18301899 makeSomething(new Torus());
18311900 } else
1832
- if (source == superItem)
1901
+ if (source == superItem || source == superButton)
18331902 {
18341903 makeSomething(new Superellipsoid());
18351904 } else
1836
- if (source == kleinItem)
1905
+ if (source == kleinItem || source == kleinButton)
18371906 {
18381907 makeSomething(new Klein());
18391908 } else
....@@ -1853,7 +1922,7 @@
18531922 {
18541923 makeSomething(new BezierSurface());
18551924 } else
1856
- if (source == overlayItem)
1925
+ if (source == overlayItem || source == overlayButton)
18571926 {
18581927 /*
18591928 Object3D obj = new BezierSurface(5,8);
....@@ -1901,7 +1970,7 @@
19011970 s.setup();
19021971 makeSomething(s);
19031972 } else
1904
- if (source == lightItem)
1973
+ if (source == lightItem || source == lightButton)
19051974 {
19061975 makeSomething(new Light());
19071976 } else
....@@ -2587,7 +2656,7 @@
25872656 {
25882657 CastShadow(2);
25892658 } else
2590
- if (source == ungroupItem)
2659
+ if (source == ungroupItem || source == ungroupButton)
25912660 {
25922661 //ungroup();
25932662 for (int i=0; i<group.selection.size(); i++)
....@@ -2925,6 +2994,10 @@
29252994 if (source == twoButton)
29262995 {
29272996 radio.layout = twoButton;
2997
+
2998
+ if (CameraPane.FULLSCREEN)
2999
+ fullscreenLayout = radio.layout;
3000
+
29283001 // bug
29293002 //gridPanel.setDividerLocation(1.0);
29303003 //bigPanel.setDividerLocation(0.0);
....@@ -2980,6 +3053,9 @@
29803053 {
29813054 radio.layout = threeButton;
29823055
3056
+ if (CameraPane.FULLSCREEN)
3057
+ fullscreenLayout = radio.layout;
3058
+
29833059 // bigThree.remove(scenePanel);
29843060 // bigThree.remove(centralPanel);
29853061 // bigThree.remove(XYZPanel);
....@@ -3018,6 +3094,9 @@
30183094 {
30193095 radio.layout = fourButton;
30203096
3097
+ if (CameraPane.FULLSCREEN)
3098
+ fullscreenLayout = radio.layout;
3099
+
30213100 // bigThree.remove(scenePanel);
30223101 // bigThree.remove(centralPanel);
30233102 // bigThree.remove(XYZPanel);
....@@ -3054,6 +3133,9 @@
30543133 if (source == sixButton)
30553134 {
30563135 radio.layout = sixButton;
3136
+
3137
+ if (CameraPane.FULLSCREEN)
3138
+ fullscreenLayout = radio.layout;
30573139
30583140 // bigThree.remove(scenePanel);
30593141 // bigThree.remove(centralPanel);
....@@ -3092,6 +3174,9 @@
30923174 if (source == sevenButton)
30933175 {
30943176 radio.layout = sevenButton;
3177
+
3178
+ if (CameraPane.FULLSCREEN)
3179
+ fullscreenLayout = radio.layout;
30953180
30963181 // bigThree.remove(scenePanel);
30973182 // bigThree.remove(centralPanel);
....@@ -3159,7 +3244,8 @@
31593244 buttonGroup.remove(ab);
31603245 radioPanel.remove(ab);
31613246
3162
- ab.GetObject().editWindow = null;
3247
+ //ab.GetObject().editWindow = null;
3248
+ ab.GetObject().manipWindow = null;
31633249 // ab.GetObject().objectUI = null; // ?????????
31643250
31653251 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
....@@ -3273,6 +3359,7 @@
32733359
32743360 // fix "+" issue
32753361 //group.editWindow = this;
3362
+ group.manipWindow = this;
32763363
32773364 /*
32783365 currentLayout = radio.layout;
....@@ -4358,7 +4445,7 @@
43584445 {
43594446 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
43604447 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4361
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4448
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
43624449
43634450 Object3D elem = (Object3D)group.selection.elementAt(i);
43644451 if(elem != group || !newWindow)
....@@ -4595,6 +4682,7 @@
45954682
45964683 if (cut)
45974684 {
4685
+ if (Globals.SAVEONMAKE)
45984686 Save();
45994687 //int indices[] = jList.getSelectedIndices();
46004688 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -5321,6 +5409,21 @@
53215409 cButton saveButton;
53225410 cButton oneStepButton;
53235411
5412
+ cButton groupButton;
5413
+ cButton ungroupButton;
5414
+ cButton compositeButton;
5415
+
5416
+ cButton gridButton;
5417
+ cButton boxButton;
5418
+ cButton sphereButton;
5419
+ cButton coneButton;
5420
+ cButton torusButton;
5421
+ cButton superButton;
5422
+ cButton kleinButton;
5423
+ cButton particlesButton;
5424
+ cButton overlayButton;
5425
+ cButton lightButton;
5426
+
53245427 cButton screenfitButton;
53255428 cButton screenfitpointButton;
53265429 cButton snapobjectButton;
....@@ -5345,7 +5448,7 @@
53455448 private MenuItem cutItem;
53465449 private MenuItem undoItem;
53475450 private MenuItem redoItem;
5348
- private MenuItem duplicateItem;
5451
+ private JMenuItem duplicateItem;
53495452 private MenuItem cloneItem;
53505453 private MenuItem cloneSupportItem;
53515454 private MenuItem overwriteGeoItem;