From cfd7a643cb5a445016ddb15595158ecc59b184fd Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 30 Jun 2019 18:18:44 -0400
Subject: [PATCH] Proto wget 3d models.
---
ObjEditor.java | 29 ++++++---
CameraPane.java | 129 +++++++++++++++++++++++++++++++++++++++++++
GroupEditor.java | 9 ++-
3 files changed, 155 insertions(+), 12 deletions(-)
diff --git a/CameraPane.java b/CameraPane.java
index 0f77a95..cdf2ce1 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -2398,6 +2398,128 @@
return currentGL;
}
+ private void GetRemoteZip(String url, String name, boolean unzip, boolean save)
+ {
+ java.net.URL u;
+ InputStream is = null;
+ DataInputStream dis;
+ java.util.zip.ZipInputStream zis;
+ //String s;
+
+ System.out.println("GetRemoteZip " + name);
+
+ int total = 0; // dis.available();
+
+ byte[] bytes = new byte[16384];
+
+ try
+ {
+ u = new java.net.URL(url + name);
+ is = u.openStream();
+
+ System.out.println(url + name);
+
+ if (unzip)
+ {
+ //dis = new DataInputStream(new BufferedInputStream(is));
+ zis = new java.util.zip.ZipInputStream(new BufferedInputStream(is));
+ //while ((s = dis.readLine()) != null)
+
+ if (save)
+ new java.io.File(name).mkdirs();
+
+ // FileOutputStream stream = new FileOutputStream("test.zip");
+ //
+ // int count;
+ //
+ // while ((count = dis.read(bytes)) != -1)
+ // {
+ // //System.out.println(s);
+ // System.out.println(count);
+ // total += count;
+ // stream.write(bytes);
+ // }
+ //
+ // stream.close();
+
+ // now iterate through each item in the stream. The get next
+ // entry call will return a ZipEntry for each file in the
+ // stream
+ java.util.zip.ZipEntry entry;
+ while((entry = zis.getNextEntry())!=null)
+ {
+ if (entry.getName().endsWith(".gsm"))
+ {
+ continue;
+ }
+
+ String s = String.format("Entry: %s len %d added %TD",
+ entry.getName(), entry.getSize(),
+ new java.util.Date(entry.getTime()));
+ System.out.println(s);
+
+ if (save)
+ {
+ // Once we get the entry from the stream, the stream is
+ // positioned read to read the raw data, and we keep
+ // reading until read returns 0 or less.
+ String outpath = name + "/" + entry.getName();
+ FileOutputStream output = null;
+ try
+ {
+ output = new FileOutputStream(outpath);
+ int len = 0;
+ while ((len = zis.read(bytes)) > 0)
+ {
+ output.write(bytes, 0, len);
+ }
+ }
+ finally
+ {
+ // we must always close the output file
+ if(output!=null) output.close();
+ }
+ }
+ }
+ }
+ }
+ catch (java.net.MalformedURLException mue)
+ {
+ System.err.println("Ouch - a MalformedURLException happened.");
+ mue.printStackTrace();
+ //System.exit(2);
+ }
+ catch (IOException ioe)
+ {
+ //System.err.println("Oops - an IOException happened.");
+ //ioe.printStackTrace();
+ //System.exit(3);
+ }
+ finally
+ {
+ try
+ {
+ if (is != null)
+ is.close();
+ }
+ catch (IOException ioe)
+ {
+ }
+ }
+
+ // System.out.println("length = " + total);
+
+// try
+// {
+// Runtime.getRuntime().exec("/usr/local/bin/wget https://archive3d.net/?a=download&do=get&id=7caca905");
+// }
+// catch (Exception e)
+// {
+// e.printStackTrace();
+// }
+
+ }
+
/**/
class CacheTexture
{
@@ -15172,6 +15294,13 @@
ClearSelection();
break;
case '+':
+
+ //for (int i=0; i<0x7FFFFFFF; i++)
+ {
+ //String.format("%08X", i); // "7caca905"
+ GetRemoteZip("https://archive3d.net/?a=download&do=get&id=", "7caca905", true, true);
+ }
+
/*
//fontsize += 1;
bbzoom *= 2;
diff --git a/GroupEditor.java b/GroupEditor.java
index 4fa246f..776ef38 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -590,9 +590,12 @@
//minButton.setToolTipText("Minimize window");
//minButton.addActionListener(this);
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
- maxButton.setToolTipText("Maximize window");
- maxButton.addActionListener(this);
+ if (Globals.ADVANCED)
+ {
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ maxButton.setToolTipText("Maximize window");
+ maxButton.addActionListener(this);
+ }
oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
fullButton.setToolTipText("Full-screen window");
diff --git a/ObjEditor.java b/ObjEditor.java
index b7cf47d..b938e7a 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -309,7 +309,7 @@
//localCopy.parent = null;
frame = new JFrame();
- frame.setUndecorated(true);
+ frame.setUndecorated(false);
objEditor = this;
this.callee = callee;
@@ -699,8 +699,8 @@
}
}
-static GraphicsDevice device = GraphicsEnvironment
- .getLocalGraphicsEnvironment().getScreenDevices()[0];
+//static GraphicsDevice device = GraphicsEnvironment
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
Rectangle keeprect;
cRadio radio;
@@ -741,10 +741,11 @@
else
{
keeprect = frame.getBounds();
- Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
- Dimension rect2 = frame.getToolkit().getScreenSize();
- frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
+// Dimension rect2 = frame.getToolkit().getScreenSize();
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
// frame.setState(Frame.MAXIMIZED_BOTH);
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
}
maximized ^= true;
@@ -758,12 +759,17 @@
void ToggleFullScreen()
{
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
+
cameraView.ToggleFullScreen();
if (!CameraPane.FULLSCREEN)
{
device.setFullScreenWindow(null);
+ frame.dispose();
+ frame.setUndecorated(false);
frame.validate();
+ frame.setVisible(true);
//frame.setVisible(false);
// frame.removeNotify();
@@ -789,8 +795,12 @@
// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
// frame.getToolkit().getScreenSize().height);
//frame.setVisible(false);
+
+ frame.dispose();
+ frame.setUndecorated(true);
device.setFullScreenWindow(frame);
frame.validate();
+ frame.setVisible(true);
// frame.removeNotify();
// frame.setUndecorated(true);
// frame.addNotify();
@@ -1613,12 +1623,13 @@
frame.setSize(1280, 860);
- frame.validate();
- frame.setVisible(true);
-
cameraView.requestFocusInWindow();
gridPanel.setDividerLocation(1.0);
+
+ frame.validate();
+
+ frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
frame.addWindowListener(new WindowAdapter()
--
Gitblit v1.6.2