Normand Briere
2019-06-30 cfd7a643cb5a445016ddb15595158ecc59b184fd
Proto wget 3d models.
3 files modified
167 ■■■■■ changed files
CameraPane.java 129 ●●●●● patch | view | raw | blame | history
GroupEditor.java 9 ●●●●● patch | view | raw | blame | history
ObjEditor.java 29 ●●●●● patch | view | raw | blame | history
CameraPane.java
....@@ -2398,6 +2398,128 @@
23982398 return currentGL;
23992399 }
24002400
2401
+ private void GetRemoteZip(String url, String name, boolean unzip, boolean save)
2402
+ {
2403
+ java.net.URL u;
2404
+ InputStream is = null;
2405
+ DataInputStream dis;
2406
+ java.util.zip.ZipInputStream zis;
2407
+ //String s;
2408
+
2409
+ System.out.println("GetRemoteZip " + name);
2410
+
2411
+ int total = 0; // dis.available();
2412
+
2413
+ byte[] bytes = new byte[16384];
2414
+
2415
+ try
2416
+ {
2417
+ u = new java.net.URL(url + name);
2418
+ is = u.openStream();
2419
+
2420
+ System.out.println(url + name);
2421
+
2422
+ if (unzip)
2423
+ {
2424
+ //dis = new DataInputStream(new BufferedInputStream(is));
2425
+ zis = new java.util.zip.ZipInputStream(new BufferedInputStream(is));
2426
+ //while ((s = dis.readLine()) != null)
2427
+
2428
+ if (save)
2429
+ new java.io.File(name).mkdirs();
2430
+
2431
+ // FileOutputStream stream = new FileOutputStream("test.zip");
2432
+ //
2433
+ // int count;
2434
+ //
2435
+ // while ((count = dis.read(bytes)) != -1)
2436
+ // {
2437
+ // //System.out.println(s);
2438
+ // System.out.println(count);
2439
+ // total += count;
2440
+ // stream.write(bytes);
2441
+ // }
2442
+ //
2443
+ // stream.close();
2444
+
2445
+ // now iterate through each item in the stream. The get next
2446
+ // entry call will return a ZipEntry for each file in the
2447
+ // stream
2448
+ java.util.zip.ZipEntry entry;
2449
+ while((entry = zis.getNextEntry())!=null)
2450
+ {
2451
+ if (entry.getName().endsWith(".gsm"))
2452
+ {
2453
+ continue;
2454
+ }
2455
+
2456
+ String s = String.format("Entry: %s len %d added %TD",
2457
+ entry.getName(), entry.getSize(),
2458
+ new java.util.Date(entry.getTime()));
2459
+ System.out.println(s);
2460
+
2461
+ if (save)
2462
+ {
2463
+ // Once we get the entry from the stream, the stream is
2464
+ // positioned read to read the raw data, and we keep
2465
+ // reading until read returns 0 or less.
2466
+ String outpath = name + "/" + entry.getName();
2467
+ FileOutputStream output = null;
2468
+ try
2469
+ {
2470
+ output = new FileOutputStream(outpath);
2471
+ int len = 0;
2472
+ while ((len = zis.read(bytes)) > 0)
2473
+ {
2474
+ output.write(bytes, 0, len);
2475
+ }
2476
+ }
2477
+ finally
2478
+ {
2479
+ // we must always close the output file
2480
+ if(output!=null) output.close();
2481
+ }
2482
+ }
2483
+ }
2484
+ }
2485
+ }
2486
+ catch (java.net.MalformedURLException mue)
2487
+ {
2488
+ System.err.println("Ouch - a MalformedURLException happened.");
2489
+ mue.printStackTrace();
2490
+ //System.exit(2);
2491
+ }
2492
+ catch (IOException ioe)
2493
+ {
2494
+ //System.err.println("Oops - an IOException happened.");
2495
+ //ioe.printStackTrace();
2496
+ //System.exit(3);
2497
+ }
2498
+ finally
2499
+ {
2500
+ try
2501
+ {
2502
+ if (is != null)
2503
+ is.close();
2504
+ }
2505
+ catch (IOException ioe)
2506
+ {
2507
+ }
2508
+ }
2509
+
2510
+ // System.out.println("length = " + total);
2511
+
2512
+// try
2513
+// {
2514
+// Runtime.getRuntime().exec("/usr/local/bin/wget https://archive3d.net/?a=download&do=get&id=7caca905");
2515
+// }
2516
+// catch (Exception e)
2517
+// {
2518
+// e.printStackTrace();
2519
+// }
2520
+
2521
+ }
2522
+
24012523 /**/
24022524 class CacheTexture
24032525 {
....@@ -15172,6 +15294,13 @@
1517215294 ClearSelection();
1517315295 break;
1517415296 case '+':
15297
+
15298
+ //for (int i=0; i<0x7FFFFFFF; i++)
15299
+ {
15300
+ //String.format("%08X", i); // "7caca905"
15301
+ GetRemoteZip("https://archive3d.net/?a=download&do=get&id=", "7caca905", true, true);
15302
+ }
15303
+
1517515304 /*
1517615305 //fontsize += 1;
1517715306 bbzoom *= 2;
GroupEditor.java
....@@ -590,9 +590,12 @@
590590 //minButton.setToolTipText("Minimize window");
591591 //minButton.addActionListener(this);
592592
593
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
- maxButton.setToolTipText("Maximize window");
595
- maxButton.addActionListener(this);
593
+ if (Globals.ADVANCED)
594
+ {
595
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ maxButton.setToolTipText("Maximize window");
597
+ maxButton.addActionListener(this);
598
+ }
596599
597600 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598601 fullButton.setToolTipText("Full-screen window");
ObjEditor.java
....@@ -309,7 +309,7 @@
309309 //localCopy.parent = null;
310310
311311 frame = new JFrame();
312
- frame.setUndecorated(true);
312
+ frame.setUndecorated(false);
313313 objEditor = this;
314314 this.callee = callee;
315315
....@@ -699,8 +699,8 @@
699699 }
700700 }
701701
702
-static GraphicsDevice device = GraphicsEnvironment
703
- .getLocalGraphicsEnvironment().getScreenDevices()[0];
702
+//static GraphicsDevice device = GraphicsEnvironment
703
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
704704
705705 Rectangle keeprect;
706706 cRadio radio;
....@@ -741,10 +741,11 @@
741741 else
742742 {
743743 keeprect = frame.getBounds();
744
- Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
745
- Dimension rect2 = frame.getToolkit().getScreenSize();
746
- frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
744
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
745
+// Dimension rect2 = frame.getToolkit().getScreenSize();
746
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
747747 // frame.setState(Frame.MAXIMIZED_BOTH);
748
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
748749 }
749750
750751 maximized ^= true;
....@@ -758,12 +759,17 @@
758759
759760 void ToggleFullScreen()
760761 {
762
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
763
+
761764 cameraView.ToggleFullScreen();
762765
763766 if (!CameraPane.FULLSCREEN)
764767 {
765768 device.setFullScreenWindow(null);
769
+ frame.dispose();
770
+ frame.setUndecorated(false);
766771 frame.validate();
772
+ frame.setVisible(true);
767773
768774 //frame.setVisible(false);
769775 // frame.removeNotify();
....@@ -789,8 +795,12 @@
789795 // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
790796 // frame.getToolkit().getScreenSize().height);
791797 //frame.setVisible(false);
798
+
799
+ frame.dispose();
800
+ frame.setUndecorated(true);
792801 device.setFullScreenWindow(frame);
793802 frame.validate();
803
+ frame.setVisible(true);
794804 // frame.removeNotify();
795805 // frame.setUndecorated(true);
796806 // frame.addNotify();
....@@ -1613,12 +1623,13 @@
16131623
16141624 frame.setSize(1280, 860);
16151625
1616
- frame.validate();
1617
- frame.setVisible(true);
1618
-
16191626 cameraView.requestFocusInWindow();
16201627
16211628 gridPanel.setDividerLocation(1.0);
1629
+
1630
+ frame.validate();
1631
+
1632
+ frame.setVisible(true);
16221633
16231634 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
16241635 frame.addWindowListener(new WindowAdapter()