Normand Briere
2019-07-06 77633b188d01228383ced79c26b41ebb2989624c
CameraPane.java
....@@ -2065,7 +2065,7 @@
20652065 //System.err.println("Oeil on");
20662066 OEIL = true;
20672067 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
2068
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
2068
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
20692069 //pingthread.StepToTarget(true);
20702070 }
20712071
....@@ -2396,128 +2396,6 @@
23962396 public GL GetGL() // INTERFACE
23972397 {
23982398 return currentGL;
2399
- }
2400
-
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
-
25212399 }
25222400
25232401 /**/
....@@ -11649,7 +11527,7 @@
1164911527 if ((TRACK || SHADOWTRACK) || zoomonce)
1165011528 {
1165111529 if ((TRACK || SHADOWTRACK) && trackedobject != null && DrawMode() == SHADOW) // && !lightMode)
11652
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
11530
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1165311531 pingthread.StepToTarget(true); // true);
1165411532 // zoomonce = false;
1165511533 }
....@@ -14065,7 +13943,7 @@
1406513943
1406613944 // fev 2014???
1406713945 if ((TRACK || SHADOWTRACK) && trackedobject != null) // && DrawMode() == SHADOW) // && !lightMode)
14068
- object.editWindow.ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
13946
+ object.GetWindow().ScreenFit(trackedobject, SHADOWTRACK && !TRACK);
1406913947 pingthread.StepToTarget(true); // true);
1407013948 }
1407113949 // if (!LIVE)
....@@ -14726,7 +14604,8 @@
1472614604 Globals.MOUSEDRAGGED = false;
1472714605
1472814606 movingcamera = false;
14729
- X = Y = 0;
14607
+ X = 0; // getBounds().width/2;
14608
+ Y = 0; // getBounds().height/2;
1473014609 //System.out.println("mouseReleased: " + e);
1473114610 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1473214611 }
....@@ -15295,12 +15174,6 @@
1529515174 break;
1529615175 case '+':
1529715176
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
-
1530415177 /*
1530515178 //fontsize += 1;
1530615179 bbzoom *= 2;
....@@ -15318,17 +15191,17 @@
1531815191 case '=':
1531915192 IncDepth();
1532015193 //fontsize += 1;
15321
- object.editWindow.refreshContents(true);
15194
+ object.GetWindow().refreshContents(true);
1532215195 maskbit = 6;
1532315196 break;
1532415197 case '-': //if (PixelThreshold>1) PixelThreshold /= 2;
1532515198 DecDepth();
1532615199 maskbit = 5;
1532715200 //if(fontsize > 1) fontsize -= 1;
15328
- if (object.editWindow == null)
15329
- new Exception().printStackTrace();
15330
- else
15331
- object.editWindow.refreshContents(true);
15201
+// if (object.editWindow == null)
15202
+// new Exception().printStackTrace();
15203
+// else
15204
+ object.GetWindow().refreshContents(true);
1533215205 break;
1533315206 case '{':
1533415207 manipCamera.shaper_fovy /= 1.1;
....@@ -15552,7 +15425,7 @@
1555215425 }
1555315426 */
1555415427
15555
- object.editWindow.EditSelection(false);
15428
+ object.GetWindow().EditSelection(false);
1555615429 }
1555715430
1555815431 void SelectParent()
....@@ -15569,10 +15442,10 @@
1556915442 {
1557015443 //selectees.remove(i);
1557115444 System.out.println("select parent of " + elem);
15572
- group.editWindow.Select(elem.parent.GetTreePath(), first, true);
15445
+ group.GetWindow().Select(elem.parent.GetTreePath(), first, true);
1557315446 } else
1557415447 {
15575
- group.editWindow.Select(elem.GetTreePath(), first, true);
15448
+ group.GetWindow().Select(elem.GetTreePath(), first, true);
1557615449 }
1557715450
1557815451 first = false;
....@@ -15614,12 +15487,12 @@
1561415487 for (int j = 0; j < group.children.size(); j++)
1561515488 {
1561615489 elem = (Object3D) group.children.elementAt(j);
15617
- object.editWindow.Select(elem.GetTreePath(), first, true);
15490
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1561815491 first = false;
1561915492 }
1562015493 } else
1562115494 {
15622
- object.editWindow.Select(elem.GetTreePath(), first, true);
15495
+ object.GetWindow().Select(elem.GetTreePath(), first, true);
1562315496 }
1562415497
1562515498 first = false;
....@@ -15630,21 +15503,21 @@
1563015503 {
1563115504 //Composite group = (Composite) object;
1563215505 Object3D group = object;
15633
- group.editWindow.loadClipboard(true); // ClearSelection(false);
15506
+ group.GetWindow().loadClipboard(true); // ClearSelection(false);
1563415507 }
1563515508
1563615509 void ResetTransform(int mask)
1563715510 {
1563815511 //Composite group = (Composite) object;
1563915512 Object3D group = object;
15640
- group.editWindow.ResetTransform(mask);
15513
+ group.GetWindow().ResetTransform(mask);
1564115514 }
1564215515
1564315516 void FlipTransform()
1564415517 {
1564515518 //Composite group = (Composite) object;
1564615519 Object3D group = object;
15647
- group.editWindow.FlipTransform();
15520
+ group.GetWindow().FlipTransform();
1564815521 // group.editWindow.ReduceMesh(true);
1564915522 }
1565015523
....@@ -15652,7 +15525,7 @@
1565215525 {
1565315526 //Composite group = (Composite) object;
1565415527 Object3D group = object;
15655
- group.editWindow.PrintMemory();
15528
+ group.GetWindow().PrintMemory();
1565615529 // group.editWindow.ReduceMesh(true);
1565715530 }
1565815531
....@@ -15660,7 +15533,7 @@
1566015533 {
1566115534 //Composite group = (Composite) object;
1566215535 Object3D group = object;
15663
- group.editWindow.ResetCentroid();
15536
+ group.GetWindow().ResetCentroid();
1566415537 }
1566515538
1566615539 void IncDepth()
....@@ -15845,23 +15718,42 @@
1584515718 */
1584615719 if (!isRenderer)
1584715720 {
15848
- object.drawEditHandles(info, 0);
15849
-
15850
- if (drag && (X != 0 || Y != 0) && object.selection.Size() > 0)
15721
+ if (object.selection.Size() > 0)
1585115722 {
15852
- switch (object.selection.get(0).hitSomething)
15723
+ int hitSomething = object.selection.get(0).hitSomething;
15724
+
15725
+ info.DX = 0;
15726
+ info.DY = 0;
15727
+ info.W = 1;
15728
+ if (hitSomething == Object3D.hitCenter)
1585315729 {
15854
- case Object3D.hitCenter: gr.setColor(Color.pink);
15855
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15856
- break;
15857
- case Object3D.hitRotate: gr.setColor(Color.yellow);
15858
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15859
- break;
15860
- case Object3D.hitScale: gr.setColor(Color.cyan);
15861
- gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15862
- break;
15730
+ info.DX = X;
15731
+ if (X != 0)
15732
+ info.DX -= info.bounds.width/2;
15733
+
15734
+ info.DY = Y;
15735
+ if (Y != 0)
15736
+ info.DY -= info.bounds.height/2;
1586315737 }
15864
-
15738
+
15739
+ object.drawEditHandles(info, 0);
15740
+
15741
+ if (drag && (X != 0 || Y != 0))
15742
+ {
15743
+ switch (hitSomething)
15744
+ {
15745
+ case Object3D.hitCenter: gr.setColor(Color.pink);
15746
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15747
+ break;
15748
+ case Object3D.hitRotate: gr.setColor(Color.yellow);
15749
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15750
+ break;
15751
+ case Object3D.hitScale: gr.setColor(Color.cyan);
15752
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
15753
+ break;
15754
+ }
15755
+
15756
+ }
1586515757 }
1586615758 }
1586715759 }
....@@ -16852,7 +16744,7 @@
1685216744 }
1685316745
1685416746 if (!movingcamera && !PAINTMODE)
16855
- object.editWindow.ScreenFitPoint(); // fev 2014
16747
+ object.GetWindow().ScreenFitPoint(); // fev 2014
1685616748
1685716749 if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1685816750 {
....@@ -16864,17 +16756,17 @@
1686416756
1686516757 group.add(paintobj); // link
1686616758
16867
- object.editWindow.SnapObject(group);
16759
+ object.GetWindow().SnapObject(group);
1686816760
16869
- Object3D folder = object.editWindow.copy;
16761
+ Object3D folder = object.GetWindow().copy;
1687016762
16871
- if (object.editWindow.copy.selection.Size() > 0)
16872
- folder = object.editWindow.copy.selection.elementAt(0);
16763
+ if (object.GetWindow().copy.selection.Size() > 0)
16764
+ folder = object.GetWindow().copy.selection.elementAt(0);
1687316765
1687416766 folder.add(group);
1687516767
16876
- object.editWindow.ResetModel();
16877
- object.editWindow.refreshContents();
16768
+ object.GetWindow().ResetModel();
16769
+ object.GetWindow().refreshContents();
1687816770 }
1687916771 else
1688016772 paintcount = 0;