From 8088590686a45e71278f9a52bb9cc37943dc0c37 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sun, 23 Jun 2019 08:18:35 -0400 Subject: [PATCH] Full-screen mode. --- GroupEditor.java | 218 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 189 insertions(+), 29 deletions(-) diff --git a/GroupEditor.java b/GroupEditor.java index 3fdc5c4..14b61ed 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -154,11 +154,12 @@ oe.menuBar.add(menu = new Menu("Edit")); //editItem = menu.add(new MenuItem("Edit")); //editItem.addActionListener(this); - undoItem = menu.add(new MenuItem("Undo")); - undoItem.addActionListener(this); - redoItem = menu.add(new MenuItem("Redo")); - redoItem.addActionListener(this); - menu.add("-"); + +// undoItem = menu.add(new MenuItem("Undo")); +// undoItem.addActionListener(this); +// redoItem = menu.add(new MenuItem("Redo")); +// redoItem.addActionListener(this); +// menu.add("-"); duplicateItem = menu.add(new MenuItem("Duplicate")); duplicateItem.addActionListener(this); cloneItem = menu.add(new MenuItem("Clone")); @@ -202,7 +203,7 @@ //zBufferItem.addActionListener(this); //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens")); //normalLensItem.addActionListener(this); - cameraMenu.add(revertCameraItem = new MenuItem("Restore Camera")); + cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint")); revertCameraItem.addActionListener(this); cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen")); @@ -245,7 +246,7 @@ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); toggleDebugItem.addItemListener(this); - toggleDebugItem.setState(CameraPane.DEBUG); + toggleDebugItem.setState(Globals.DEBUG); cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); toggleFrustumItem.addItemListener(this); @@ -266,7 +267,7 @@ // animationItem.addItemListener(this); // animationItem.setState(CameraPane.ANIMATION); cameraMenu.add("-"); - cameraMenu.add(editCameraItem = new MenuItem("Save Camera")); + cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint")); editCameraItem.addActionListener(this); if (Globals.ADVANCED) @@ -469,6 +470,14 @@ markleavesItem.addActionListener(this); unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves")); unmarkleavesItem.addActionListener(this); + rewindleavesItem = menu.add(new MenuItem("Rewind Leaves")); + rewindleavesItem.addActionListener(this); + unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves")); + unrewindleavesItem.addActionListener(this); + randomleavesItem = menu.add(new MenuItem("Random Leaves")); + randomleavesItem.addActionListener(this); + unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves")); + unrandomleavesItem.addActionListener(this); menu.add("-"); flipVItem = menu.add(new MenuItem("Flip V")); flipVItem.addActionListener(this); @@ -526,6 +535,18 @@ void SetupUI2(ObjEditor oe) { + // June 2019 + if (oe == null) + { + //super.SetupUI2(this); + //return; + } + + if (copy != group) + { + //super.SetupUI2(this); + } + //new Exception().printStackTrace(); oe.radioPanel = new JPanel(new GridBagLayout()); @@ -556,11 +577,35 @@ */ //this.AddOptions(oe.toolbarPanel, oe.aConstraints); + //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + //minButton.setToolTipText("Minimize window"); + //minButton.addActionListener(this); + + oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + maxButton.setToolTipText("Maximize window"); + maxButton.addActionListener(this); + + oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + fullButton.setToolTipText("Full-screen window"); + fullButton.addActionListener(this); + + oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + undoButton.setToolTipText("Undo changes"); + undoButton.addActionListener(this); + + oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + redoButton.setToolTipText("Redo changes"); + redoButton.addActionListener(this); + + oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + saveButton.setToolTipText("Save changes"); + saveButton.addActionListener(this); + oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints); liveCB.setToolTipText("Enable animation"); liveCB.addItemListener(this); - oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); oneStepButton.setToolTipText("Animate one step forward"); oneStepButton.addActionListener(this); @@ -568,7 +613,7 @@ fastCB.setToolTipText("Fast mode"); fastCB.addItemListener(this); - oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints); + oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints); trackCB.setToolTipText("Enable tracking"); trackCB.addItemListener(this); @@ -796,6 +841,8 @@ void SetupViews(ObjEditor oe) { + theFrame = this; + oe.SetupViews(); System.out.println("SetupViews"); @@ -858,6 +905,7 @@ } else if(e.getSource() == liveCB) { cameraView.ToggleLive(); + refreshContents(false); } else if(e.getSource() == supportCB) { @@ -1265,7 +1313,7 @@ memoryItem.addActionListener(this); menu.add(analyzeItem = new MenuItem("Analyze")); analyzeItem.addActionListener(this); - menu.add(dumpItem = new MenuItem("Dump")); + menu.add(dumpItem = new MenuItem("Print")); dumpItem.addActionListener(this); // menu.add(pathItem = new MenuItem("From-to path")); // pathItem.addActionListener(this); @@ -1956,6 +2004,30 @@ { DumpObject(); } else + if (source == minButton) + { + Minimize(); + } else + if (source == maxButton) + { + Maximize(); + } else + if (source == fullButton) + { + ToggleFullScreen(); + } else + if (source == undoButton) + { + Undo(); + } else + if (source == redoButton) + { + Redo(); + } else + if (source == saveButton) + { + Save(); + } else if (source == oneStepButton) { Globals.ONESTEP = true; @@ -2517,7 +2589,7 @@ } else if (source == genNormalsMESHItem) { - GenNormals(true); // TODO + GenNormalsMESH(); } else if (source == genNormalsORGANItem) { @@ -2582,6 +2654,22 @@ if (source == unmarkleavesItem) { MarkLeaves(false); + } else + if (source == rewindleavesItem) + { + RewindLeaves(true); + } else + if (source == unrewindleavesItem) + { + RewindLeaves(false); + } else + if (source == randomleavesItem) + { + RandomLeaves(true); + } else + if (source == unrandomleavesItem) + { + RandomLeaves(false); } else if (source == flipVItem) { @@ -2849,6 +2937,24 @@ bigThree.ClearUI(); bigThree.add(centralPanel); bigThree.FlushUI(); + + cameraView.requestFocusInWindow(); + +// refreshContents(true); +// +// try +// { +// java.awt.Robot bot = new java.awt.Robot(); +// int mask = InputEvent.BUTTON1_MASK; +// bot.mouseMove(100, 100); +// bot.mousePress(mask); +// bot.mouseRelease(mask); +// } +// catch (Exception e) +// { +// +// } + } else if (source == threeButton) { @@ -2885,6 +2991,8 @@ bigThree.add(centralPanel); bigThree.add(XYZPanel); bigThree.FlushUI(); + + cameraView.requestFocusInWindow(); } else if (source == fourButton) { @@ -2920,6 +3028,8 @@ bigThree.ClearUI(); bigThree.add(scenePanel); bigThree.FlushUI(); + + cameraView.requestFocusInWindow(); } else if (source == sixButton) { @@ -2956,6 +3066,8 @@ bigThree.add(scenePanel); bigThree.add(centralPanel); bigThree.FlushUI(); + + cameraView.requestFocusInWindow(); } else if (source == sevenButton) { @@ -2993,6 +3105,8 @@ bigThree.add(centralPanel); bigThree.add(XYZPanel); bigThree.FlushUI(); + + cameraView.requestFocusInWindow(); } else if (source == rootButton) { @@ -3004,6 +3118,7 @@ EditObject(obj); } + cameraView.requestFocusInWindow(); refreshContents(true); } else if (source == closeButton) @@ -3025,6 +3140,8 @@ break; } } + + cameraView.requestFocusInWindow(); refreshContents(true); } else if (source == editItem || source == editButton) @@ -3128,7 +3245,8 @@ sideView.object = group; } -// fix "+" issue group.editWindow = this; +// fix "+" issue + //group.editWindow = this; /* currentLayout = radio.layout; @@ -3141,6 +3259,8 @@ //group.parent = null; // ROOT //group.attributes = -1; ResetModel(); + + cameraView.requestFocusInWindow(); refreshContents(true); } else if (event.getSource() == editCameraItem) { @@ -3164,7 +3284,6 @@ } boolean useclient = false; - cRadio radio; void ToggleRoot() { @@ -3403,7 +3522,8 @@ int size = obj.MemorySize(); - System.err.println((size/1024) + " KB is the size of " + obj); + //System.err.println((size/1024) + " KB is the size of " + obj); + System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)"); } } catch (Exception e) @@ -3484,6 +3604,13 @@ void GenNormals(boolean crease) { group.GenNormalsS(crease); + + refreshContents(); + } + + void GenNormalsMESH() + { + group.GenNormalsMeshS(); refreshContents(); } @@ -4111,6 +4238,18 @@ refreshContents(); } + void RewindLeaves(boolean hide) + { + group.selection.RewindLeaves(hide); + refreshContents(); + } + + void RandomLeaves(boolean hide) + { + group.selection.RandomLeaves(hide); + refreshContents(); + } + void SetTexRes(int tr) { group.selection.SetTexRes(tr); @@ -4286,7 +4425,6 @@ //case 702: // Event.LIST_DESELECT group.deselectAll(); TreePath tps[] = objEditor.jTree.getSelectionPaths(); - objEditor.ClearInfo(); // .GetMaterial()); if (tps != null) { for (int i=0; i < tps.length; i++) @@ -4295,10 +4433,8 @@ //if (child.parent != null) //child.parent.addSelectee(child); + objEditor.SetMaterial(child); group.addSelectee(child); - objEditor.SetMaterial(child); // .GetMaterial()); - objEditor.AddInfo(child, this, true); // .GetMaterial()); - System.err.println("info : " + child.GetPath()); } } // else @@ -4308,8 +4444,6 @@ // System.err.println("info : " + group.GetPath()); // } - objEditor.SetText(); // jan 2014 - if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera)) CameraPane.flash = true; @@ -4333,6 +4467,26 @@ freezemodel = false; } + + void refreshContents(boolean cp) + { + if (!Globals.MOUSEDRAGGED) + { + objEditor.ClearInfo(); // .GetMaterial()); + + for (int i=0; i < group.selection.Size(); i++) + { + Object3D child = (Object3D) group.selection.get(i); + + objEditor.AddInfo(child, this, true); + System.err.println("info : " + child.GetPath()); + } + + objEditor.SetText(); // jan 2014 + } + + super.refreshContents(cp); + } void linkSomething(Object3D thing) { @@ -4404,6 +4558,7 @@ { if (group.selection.isEmpty()) return; + Grafreed.clipboardIsTempGroup = false; Composite tGroup = null; if (group.selection.size() > 0) // 1) @@ -4414,6 +4569,7 @@ if (cut) { + Save(); //int indices[] = jList.getSelectedIndices(); //for (int i = indices.length - 1; i >= 0; i--) //jList.remove(indices[i]); @@ -4503,8 +4659,10 @@ } } + if (Grafreed.clipboardIsTempGroup) Grafreed.clipboard = tGroup; + if (cut) { ResetModel(); @@ -5129,6 +5287,12 @@ cButton clearpanelButton; cButton unselectButton; + cButton minButton; + cButton maxButton; + cButton fullButton; + cButton undoButton; + cButton redoButton; + cButton saveButton; cButton oneStepButton; cButton screenfitButton; @@ -5141,14 +5305,6 @@ cButton closeButton; cButton setsupportButton; - - cButton twoButton; - cButton sixButton; - cButton threeButton; - cButton sevenButton; - cButton fourButton; // full panel - cButton oneButton; // full XYZ - //cButton currentLayout; // //Composite @@ -5226,6 +5382,10 @@ private MenuItem showleavesItem; private MenuItem markleavesItem; private MenuItem unmarkleavesItem; + private MenuItem rewindleavesItem; + private MenuItem unrewindleavesItem; + private MenuItem randomleavesItem; + private MenuItem unrandomleavesItem; private MenuItem flipVItem; private MenuItem unflipVItem; -- Gitblit v1.6.2