From 8c837a9e50c29e66bdf5bd7ea2fd15b1a7d5d598 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Mon, 29 Apr 2019 15:12:34 -0400 Subject: [PATCH] Use separators. --- ObjEditor.java | 693 +++++++++++++++++++++++---------------------------------- 1 files changed, 278 insertions(+), 415 deletions(-) diff --git a/ObjEditor.java b/ObjEditor.java index 0ea0e59..8a5cd39 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -355,9 +355,9 @@ toolbarPanel.setName("Toolbar"); treePanel = new JPanel(); treePanel.setName("Tree"); - ctrlPanel = new JPanel(); // new GridBagLayout()); + ctrlPanel = new cGridBag(); // new GridBagLayout()); ctrlPanel.setName("Edit"); - materialPanel = new JPanel(); + materialPanel = new cGridBag().setVertical(true); materialPanel.setName("Material"); /*JTextPane*/ infoarea = createTextPane(); @@ -387,7 +387,7 @@ toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); treePanel.setLayout(new GridBagLayout()); ctrlPanel.setLayout(new GridBagLayout()); - materialPanel.setLayout(new GridBagLayout()); + //materialPanel.setLayout(new GridBagLayout()); aConstraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0); @@ -814,65 +814,47 @@ return combo; } - NumberSlider AddSlider(JPanel ctrlPanel, String label, double min, double max, double current, double pow) + cNumberSlider AddSlider(cGridBag ctrlPanel, String label, double min, double max, double current, double pow) { - NumberSlider combo; + cGridBag control = new cGridBag(); + + cNumberSlider combo; JLabel jlabel = new JLabel(label); - - aConstraints.fill = GridBagConstraints.VERTICAL; jlabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.gridwidth = 1; - ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); - aConstraints.gridx += 1; - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(combo = new NumberSlider(min, max, pow), aConstraints); //, oe.ctrlPanel.getComponentCount()-1); - aConstraints.gridx += 1; - aConstraints.gridwidth = 1; - + control.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); + control.add(combo = new cNumberSlider(this, min, max, pow)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); combo.setFloat(current); - - combo.label = jlabel; - - combo.addChangeListener(this); - + + ctrlPanel.add(control); + return combo; } - NumberSlider AddSlider(JPanel ctrlPanel, String label, int min, int max, int current) + cNumberSlider AddSlider(cGridBag ctrlPanel, String label, int min, int max, int current) { - NumberSlider combo; + cGridBag control = new cGridBag(); + + cNumberSlider combo; JLabel jlabel = new JLabel(label); - - aConstraints.fill = GridBagConstraints.VERTICAL; jlabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.gridwidth = 2; - ctrlPanel.add(jlabel, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); - aConstraints.gridx += 1; - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(combo = new NumberSlider(min, max), aConstraints); //, oe.ctrlPanel.getComponentCount()-1); - aConstraints.gridx += 1; - aConstraints.gridwidth = 1; - + ctrlPanel.add(jlabel); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); + ctrlPanel.add(combo = new cNumberSlider(this, min, max)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); combo.setInteger(current); - combo.label = jlabel; - - combo.addChangeListener(this); - + ctrlPanel.add(control); + return combo; } - JTextArea AddText(JPanel ctrlPanel, String name) + JTextArea AddText(cGridBag ctrlPanel, String name) { JTextArea text; aConstraints.fill = GridBagConstraints.HORIZONTAL; aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(text = new JTextArea(name), aConstraints); //, oe.ctrlPanel.getComponentCount()-1); + ctrlPanel.add(text = new JTextArea(name)); //, aConstraints); //, oe.ctrlPanel.getComponentCount()-1); text.addCaretListener(this); aConstraints.gridx += 1; aConstraints.gridwidth = 1; @@ -902,6 +884,13 @@ { j.removeChangeListener(this); objEditor.ctrlPanel.remove(j.label); + objEditor.ctrlPanel.remove(j); + } + + void Remove(cNumberSlider j) + { + j.removeChangeListener(this); + //objEditor.ctrlPanel.remove(j.label); objEditor.ctrlPanel.remove(j); } @@ -989,10 +978,10 @@ fasterButton = AddButton(oe, "Fast"); remarkButton = AddButton(oe, "Rem"); - Return(); + //Return(); - normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1); - Return(); + //normalpushField = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, -1); + //Return(); // oe.ctrlPanel.add(stepButton = new cButton("Step"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount() - 2); // ObjEditor.aConstraints.gridx += 1; @@ -1189,7 +1178,8 @@ //JPanel worldPanel = // new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true); //worldPanel.setName("World"); - centralPanel = new JPanel(new BorderLayout()); + centralPanel = new cGridBag(); + centralPanel.preferredWidth = 20; timelinePanel = new JPanel(new BorderLayout()); timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); @@ -1222,6 +1212,7 @@ XYZPanel = new cGridBag().setVertical(true); //XYZPanel.setLayout(new GridLayout(3, 1, 5, 5)); + XYZPanel.preferredWidth = 5; XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); @@ -1286,19 +1277,23 @@ scrollpane.setWheelScrollingEnabled(true); scrollpane.addMouseWheelListener(this); // Default not fast enough - /*JTabbedPane*/ scenePanel = new JTabbedPane(); - scenePanel.add(scrollpane); + /*JTabbedPane*/ scenePanel = new cGridBag(); + scenePanel.preferredWidth = 7; + + JTabbedPane tabbedPane = new JTabbedPane(); + tabbedPane.add(scrollpane); - scenePanel.add(FSPane = new cFileSystemPane(this)); + tabbedPane.add(FSPane = new cFileSystemPane(this)); - optionsPanel = new JPanel(new GridBagLayout()); + optionsPanel = new cGridBag().setVertical(true); optionsPanel.setName("Options"); - AddOptions(optionsPanel, aConstraints); + AddOptions(optionsPanel); //, aConstraints); - scenePanel.add(optionsPanel); - + tabbedPane.add(optionsPanel); + + scenePanel.add(tabbedPane); /* cTree jTree = new cTree(null); @@ -1405,7 +1400,7 @@ }); } - void AddOptions(JPanel panel, GridBagConstraints constraints) + void AddOptions(cGridBag panel) //, GridBagConstraints constraints) { } @@ -1420,260 +1415,165 @@ ctrlPanel.removeAll(); } - void SetupMaterial(JPanel ctrlPanel) + void SetupMaterial(cGridBag ctrlPanel) { - aConstraints.weighty = 0; - //aConstraints.weightx = 1; - /* + /* ctrlPanel.add(materialLabel = new JLabel("MATERIAL : "), aConstraints); materialLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; */ - aConstraints.gridwidth = 1; - ctrlPanel.add(createMaterialButton = new cButton("Create"), aConstraints); - aConstraints.gridx += 1; - aConstraints.weighty = 0; - aConstraints.gridwidth = 1; + cGridBag editBar = new cGridBag().setVertical(false); + + editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints); /* ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints); - aConstraints.gridx += 1; - aConstraints.weighty = 0; - aConstraints.gridwidth = 1; */ - ctrlPanel.add(clearMaterialButton = new cButton("Clear"), aConstraints); - aConstraints.gridx += 1; + editBar.add(clearMaterialButton = new cButton("Clear")); // , aConstraints); + editBar.add(resetSlidersButton = new cButton("Reset")); // , aConstraints); + editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints); + editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints); - ctrlPanel.add(resetSlidersButton = new cButton("Reset"), aConstraints); - - aConstraints.gridx += 1; - - ctrlPanel.add(propagateToggle = new cCheckBox("Prop", propagate), aConstraints); - - aConstraints.gridx += 1; - - ctrlPanel.add(multiplyToggle = new cCheckBox("Mult", false), aConstraints); - - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.weighty = 0; - aConstraints.gridwidth = 1; + ctrlPanel.add(editBar); + /**/ //aConstraints.weighty = 0; ////aConstraints.weightx = 1; //aConstraints.weighty = 1; aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; //aConstraints.gridx += 1; - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); - aConstraints.weighty = 0; - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); - ctrlPanel.add(colorLabel = new JLabel("Color/hue"), aConstraints); - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - //aConstraints.weightx = 0; - ctrlPanel.add(colorField = new NumberSlider(0.001, 1, -0.5), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag colorSection = new cGridBag().setVertical(true); + + cGridBag color = new cGridBag(); + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); + color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + //colorField.preferredWidth = 200; + colorSection.add(color); - ctrlPanel.add(modulationLabel = new JLabel("Saturation"), aConstraints); - modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(modulationField = new NumberSlider(0.001, 1, -0.5), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag modulation = new cGridBag(); + modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); + modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); + modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + colorSection.add(modulation); - ctrlPanel.add(textureLabel = new JLabel("Texture"), aConstraints); - textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(textureField = new NumberSlider(0.001, 1, -0.5), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag texture = new cGridBag(); + texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); + textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); + texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + colorSection.add(texture); - ctrlPanel.add(anisoLabel = new JLabel("AnisoU"), aConstraints); - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(anisoField = new NumberSlider(0.001, 1, -0.5), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag anisoU = new cGridBag(); + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + colorSection.add(anisoU); - ctrlPanel.add(anisoVLabel = new JLabel("AnisoV"), aConstraints); - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(anisoVField = new NumberSlider(0.001, 1, -0.5), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag anisoV = new cGridBag(); + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + colorSection.add(anisoV); - ctrlPanel.add(shadowbiasLabel = new JLabel("Shadowbias"), aConstraints); - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(shadowbiasField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag shadowbias = new cGridBag(); + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + colorSection.add(shadowbias); - //aConstraints.weighty = 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; - //aConstraints.gridx += 1; - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); - aConstraints.weighty = 0; - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + ctrlPanel.add(new JSeparator()); + + ctrlPanel.add(colorSection); + + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); + + cGridBag diffuseSection = new cGridBag().setVertical(true); + + cGridBag diffuse = new cGridBag(); + diffuse.add(diffuseLabel = new JLabel("Diffuse")); // , aConstraints); + diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING); + diffuse.add(diffuseField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + diffuseSection.add(diffuse); - ctrlPanel.add(diffuseLabel = new JLabel("Diffuse"), aConstraints); - diffuseLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(diffuseField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag diffuseness = new cGridBag(); + diffuseness.add(diffusenessLabel = new JLabel("Diffusion")); // , aConstraints); + diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING); + diffuseness.add(diffusenessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + diffuseSection.add(diffuseness); - ctrlPanel.add(diffusenessLabel = new JLabel("Diffusion"), aConstraints); - diffusenessLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(diffusenessField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag selfshadow = new cGridBag(); + selfshadow.add(selfshadowLabel = new JLabel("Selfshadow")); // , aConstraints); + selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); + selfshadow.add(selfshadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + diffuseSection.add(selfshadow); - ctrlPanel.add(selfshadowLabel = new JLabel("Selfshadow"), aConstraints); - selfshadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(selfshadowField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag sheen = new cGridBag(); + sheen.add(sheenLabel = new JLabel("Sheen")); // , aConstraints); + sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING); + sheen.add(sheenField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + diffuseSection.add(sheen); - ctrlPanel.add(sheenLabel = new JLabel("Sheen"), aConstraints); - sheenLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(sheenField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag subsurface = new cGridBag(); + subsurface.add(subsurfaceLabel = new JLabel("Subsurface")); // , aConstraints); + subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING); + subsurface.add(subsurfaceField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + diffuseSection.add(subsurface); - ctrlPanel.add(subsurfaceLabel = new JLabel("Subsurface"), aConstraints); - subsurfaceLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(subsurfaceField = new NumberSlider(0.001, 1, -0.5), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag shadow = new cGridBag(); + shadow.add(shadowLabel = new JLabel("Shadowing")); // , aConstraints); + shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); + shadow.add(shadowField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + diffuseSection.add(shadow); - ctrlPanel.add(shadowLabel = new JLabel("Shadowing"), aConstraints); - shadowLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(shadowField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag fakedepth = new cGridBag(); + fakedepth.add(fakedepthLabel = new JLabel("Fakedepth")); // , aConstraints); + fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); + fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + diffuseSection.add(fakedepth); - ctrlPanel.add(fakedepthLabel = new JLabel("Fakedepth"), aConstraints); - fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(fakedepthField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + ctrlPanel.add(new JSeparator()); + + ctrlPanel.add(diffuseSection); + + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); + + cGridBag specularSection = new cGridBag().setVertical(true); - //aConstraints.weighty = 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; - //aConstraints.gridx += 1; - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); - aConstraints.weighty = 0; - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag specular = new cGridBag(); + specular.add(specularLabel = new JLabel("Specular")); // , aConstraints); + specularLabel.setHorizontalAlignment(SwingConstants.TRAILING); + specular.add(specularField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + specularSection.add(specular); - ctrlPanel.add(specularLabel = new JLabel("Specular"), aConstraints); - specularLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(specularField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag lightarea = new cGridBag(); + lightarea.add(lightareaLabel = new JLabel("Lightarea")); // , aConstraints); + lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING); + lightarea.add(lightareaField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + specularSection.add(lightarea); - ctrlPanel.add(lightareaLabel = new JLabel("Lightarea"), aConstraints); - lightareaLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(lightareaField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag shininess = new cGridBag(); + shininess.add(shininessLabel = new JLabel("Roughness")); // , aConstraints); + shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING); + shininess.add(shininessField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + specularSection.add(shininess); - ctrlPanel.add(shininessLabel = new JLabel("Roughness"), aConstraints); - shininessLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(shininessField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag metalness = new cGridBag(); + metalness.add(metalnessLabel = new JLabel("Metalness")); // , aConstraints); + metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING); + metalness.add(metalnessField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + specularSection.add(metalness); - ctrlPanel.add(metalnessLabel = new JLabel("Metalness"), aConstraints); - metalnessLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(metalnessField = new NumberSlider(0.001, 1, -0.5), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag velvet = new cGridBag(); + velvet.add(velvetLabel = new JLabel("Velvet")); // , aConstraints); + velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING); + velvet.add(velvetField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + specularSection.add(velvet); - ctrlPanel.add(velvetLabel = new JLabel("Velvet"), aConstraints); - velvetLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(velvetField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; - - shiftField = AddSlider(ctrlPanel, "Shift", 0.001, 50, copy.material.shift, -1); - Return(); + shiftField = AddSlider(specularSection, "Shift", 0.001, 50, copy.material.shift, -1); + //Return(); // ctrlPanel.add(shiftLabel = new JLabel("Shift"), aConstraints); // shiftLabel.setHorizontalAlignment(SwingConstants.TRAILING); // aConstraints.fill = GridBagConstraints.HORIZONTAL; @@ -1684,130 +1584,93 @@ // aConstraints.gridy += 1; // aConstraints.gridwidth = 1; - //aConstraints.weighty = 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; - //aConstraints.gridx += 1; - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); - aConstraints.weighty = 0; - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; - ctrlPanel.add(cameraLabel = new JLabel("GlobalLight"), aConstraints); - cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(cameraField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + ctrlPanel.add(new JSeparator()); + + ctrlPanel.add(specularSection); + + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); + + cGridBag globalSection = new cGridBag().setVertical(true); - ctrlPanel.add(ambientLabel = new JLabel("Ambient"), aConstraints); - ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(ambientField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag camera = new cGridBag(); + camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); + cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); + camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + globalSection.add(camera); - ctrlPanel.add(backlitLabel = new JLabel("Backlit"), aConstraints); - backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(backlitField = new NumberSlider(0.001, 50, -1), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag ambient = new cGridBag(); + ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); + ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); + ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + globalSection.add(ambient); - ctrlPanel.add(opacityLabel = new JLabel("Opacity"), aConstraints); - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(opacityField = new NumberSlider(0.001, 1, -0.5), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; - aConstraints.weighty = 0; + cGridBag backlit = new cGridBag(); + backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); + backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); + backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); + globalSection.add(backlit); - ctrlPanel.add(bumpLabel = new JLabel("Bump"), aConstraints); - bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(bumpField = new NumberSlider(0.0, 2), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag opacity = new cGridBag(); + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); + globalSection.add(opacity); - ctrlPanel.add(noiseLabel = new JLabel("Noise"), aConstraints); - noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(noiseField = new NumberSlider(0.0, 1/*5*/), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + ctrlPanel.add(new JSeparator()); + + ctrlPanel.add(globalSection); + + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); + + cGridBag textureSection = new cGridBag().setVertical(true); - ctrlPanel.add(powerLabel = new JLabel("Turbulance"), aConstraints); - powerLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(powerField = new NumberSlider(0.0, 5), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag bump = new cGridBag(); + bump.add(bumpLabel = new JLabel("Bump")); // , aConstraints); + bumpLabel.setHorizontalAlignment(SwingConstants.TRAILING); + bump.add(bumpField = new cNumberSlider(this, 0.0, 2)); // , aConstraints); + textureSection.add(bump); - ctrlPanel.add(borderfadeLabel = new JLabel("Borderfade"), aConstraints); - borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(borderfadeField = new NumberSlider(0.0, 2), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag noise = new cGridBag(); + noise.add(noiseLabel = new JLabel("Noise")); // , aConstraints); + noiseLabel.setHorizontalAlignment(SwingConstants.TRAILING); + noise.add(noiseField = new cNumberSlider(this, 0.0, 1/*5*/)); // , aConstraints); + textureSection.add(noise); - ctrlPanel.add(fogLabel = new JLabel("Punch"), aConstraints); - fogLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(fogField = new NumberSlider(0.0, 20), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag power = new cGridBag(); + power.add(powerLabel = new JLabel("Turbulance")); // , aConstraints); + powerLabel.setHorizontalAlignment(SwingConstants.TRAILING); + power.add(powerField = new cNumberSlider(this, 0.0, 5)); // , aConstraints); + textureSection.add(power); - ctrlPanel.add(opacityPowerLabel = new JLabel("Halo"), aConstraints); - opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING); - aConstraints.fill = GridBagConstraints.HORIZONTAL; - aConstraints.gridx += 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; - ctrlPanel.add(opacityPowerField = new NumberSlider(0.0, 10 /*10 dec 2013*/), aConstraints); - aConstraints.gridx = 0; - aConstraints.gridy += 1; - aConstraints.gridwidth = 1; + cGridBag borderfade = new cGridBag(); + borderfade.add(borderfadeLabel = new JLabel("Borderfade")); // , aConstraints); + borderfadeLabel.setHorizontalAlignment(SwingConstants.TRAILING); + borderfade.add(borderfadeField = new cNumberSlider(this, 0.0, 2)); // , aConstraints); + textureSection.add(borderfade); - //aConstraints.weighty = 1; - aConstraints.gridwidth = ObjEditor.GRIDWIDTH; // 100; - //aConstraints.gridx += 1; - ctrlPanel.add(new JLabel("----------------------------------"), aConstraints); - aConstraints.weighty = 0; + cGridBag fog = new cGridBag(); + fog.add(fogLabel = new JLabel("Punch")); // , aConstraints); + fogLabel.setHorizontalAlignment(SwingConstants.TRAILING); + fog.add(fogField = new cNumberSlider(this, 0.0, 20)); // , aConstraints); + textureSection.add(fog); - aConstraints.gridx = 0; - aConstraints.gridy = 0; - aConstraints.gridwidth = 1; + cGridBag opacityPower = new cGridBag(); + opacityPower.add(opacityPowerLabel = new JLabel("Halo")); // , aConstraints); + opacityPowerLabel.setHorizontalAlignment(SwingConstants.TRAILING); + opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); + textureSection.add(opacityPower); + + ctrlPanel.add(new JSeparator()); + + ctrlPanel.add(textureSection); + + //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); SetMaterial(copy); // .GetMaterial()); - colorField.addChangeListener(this); - modulationField.addChangeListener(this); + //colorField.addChangeListener(this); +// modulationField.addChangeListener(this); metalnessField.addChangeListener(this); diffuseField.addChangeListener(this); specularField.addChangeListener(this); @@ -3510,7 +3373,7 @@ current.fakedepth = (float) fakedepthField.getFloat(); current.shadowbias = (float) shadowbiasField.getFloat(); - if (!NumberSlider.frozen) + if (!cNumberSlider.frozen) { //System.out.println("Propagate = " + propagate); copy.UpdateMaterial(anchor, current, propagate); @@ -3883,7 +3746,7 @@ radioPanel.revalidate(); radioPanel.repaint(); - ctrlPanel.revalidate(); // ? new + ctrlPanel.validate(); // ? new ctrlPanel.repaint(); } } @@ -4550,17 +4413,17 @@ JPanel treePanel; JPanel radioPanel; ButtonGroup buttonGroup; - JPanel ctrlPanel; - JPanel materialPanel; + cGridBag ctrlPanel; + cGridBag materialPanel; JScrollPane infoPanel; - JPanel optionsPanel; + cGridBag optionsPanel; JTabbedPane objectPanel; cGridBag XYZPanel; JSplitPane gridPanel; JSplitPane bigPanel; cGridBag bigThree; - JTabbedPane scenePanel; - JPanel centralPanel; + cGridBag scenePanel; + cGridBag centralPanel; JSplitPane cameraPanel; JPanel timelinePanel; JMenuBar timelineMenubar; @@ -4613,67 +4476,67 @@ // MATERIAL JLabel materialLabel; JLabel colorLabel; - NumberSlider colorField; + cNumberSlider colorField; JLabel modulationLabel; - NumberSlider modulationField; + cNumberSlider modulationField; JLabel metalnessLabel; - NumberSlider metalnessField; + cNumberSlider metalnessField; JLabel diffuseLabel; - NumberSlider diffuseField; + cNumberSlider diffuseField; JLabel specularLabel; - NumberSlider specularField; + cNumberSlider specularField; JLabel shininessLabel; - NumberSlider shininessField; + cNumberSlider shininessField; JLabel shiftLabel; - NumberSlider shiftField; + cNumberSlider shiftField; JLabel ambientLabel; - NumberSlider ambientField; + cNumberSlider ambientField; JLabel lightareaLabel; - NumberSlider lightareaField; + cNumberSlider lightareaField; JLabel diffusenessLabel; - NumberSlider diffusenessField; + cNumberSlider diffusenessField; JLabel velvetLabel; - NumberSlider velvetField; + cNumberSlider velvetField; JLabel sheenLabel; - NumberSlider sheenField; + cNumberSlider sheenField; JLabel subsurfaceLabel; - NumberSlider subsurfaceField; + cNumberSlider subsurfaceField; //JLabel bumpLabel; //NumberSlider bumpField; JLabel backlitLabel; - NumberSlider backlitField; + cNumberSlider backlitField; JLabel anisoLabel; - NumberSlider anisoField; + cNumberSlider anisoField; JLabel anisoVLabel; - NumberSlider anisoVField; + cNumberSlider anisoVField; JLabel cameraLabel; - NumberSlider cameraField; + cNumberSlider cameraField; JLabel selfshadowLabel; - NumberSlider selfshadowField; + cNumberSlider selfshadowField; JLabel shadowLabel; - NumberSlider shadowField; + cNumberSlider shadowField; JLabel textureLabel; - NumberSlider textureField; + cNumberSlider textureField; JLabel opacityLabel; - NumberSlider opacityField; + cNumberSlider opacityField; JLabel fakedepthLabel; - NumberSlider fakedepthField; + cNumberSlider fakedepthField; JLabel shadowbiasLabel; - NumberSlider shadowbiasField; + cNumberSlider shadowbiasField; JLabel bumpLabel; - NumberSlider bumpField; + cNumberSlider bumpField; JLabel noiseLabel; - NumberSlider noiseField; + cNumberSlider noiseField; JLabel powerLabel; - NumberSlider powerField; + cNumberSlider powerField; JLabel borderfadeLabel; - NumberSlider borderfadeField; + cNumberSlider borderfadeField; JLabel fogLabel; - NumberSlider fogField; + cNumberSlider fogField; JLabel opacityPowerLabel; - NumberSlider opacityPowerField; + cNumberSlider opacityPowerField; JTree jTree; //ObjectUI parent; - NumberSlider normalpushField; + cNumberSlider normalpushField; } -- Gitblit v1.6.2