Blimp v.1.3.4 (2008-09-14)
Christian Heimke

Christian Heimke commited on 2011-07-15 09:23:59
Showing 9 changed files, with 95 additions and 25 deletions.

... ...
@@ -3,6 +3,11 @@ Copyright (C) 2004-2008: Stefan Schuermans <stefan@schuermans.info>
3 3
 Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
4 4
 a blinkenarea.org project
5 5
 
6
+version 1.3.4 date 2008-09-14
7
+-----------------------------
8
+ - also setting aspect when resizing to a known format
9
+ - support for Blinkenlights Stereoscope formats
10
+
6 11
 version 1.3.3 date 2008-08-10
7 12
 -----------------------------
8 13
  - new release due to new BlinkenLib 0.1.2 (bug in resizing)
... ...
@@ -1,5 +1,5 @@
1 1
 # BlinkenLightsInteractiveMovieProgram
2
-# version 1.3.3 date 2008-08-10
2
+# version 1.3.4 date 2008-09-14
3 3
 # Copyright (C) 2004-2008: Stefan Schuermans <stefan@schuermans.info>
4 4
 # Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
 # a blinkenarea.org project
... ...
@@ -1,5 +1,5 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 1.3.3 date 2008-08-10
2
+ * version 1.3.4 date 2008-09-14
3 3
  * Copyright (C) 2004-2008: Stefan Schuermans <stefan@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
... ...
@@ -28,20 +28,25 @@ public class Blimp extends JApplet
28 28
   //configuration constants
29 29
   static final int constColorCntX = 2, constColorCntY = 4;
30 30
   static final int constColorCnt = constColorCntX * constColorCntY;
31
-  static final int defHeight = 8, defWidth = 8, defChannels = 1, defMaxval = 127, defDuration = 100;
31
+  static final int defHeight = 12, defWidth = 30, defChannels = 1, defMaxval = 15, defDuration = 100;
32
+  static final double defAspect = 0.65;
32 33
   static final int ZoomAspectResolution = 30;
33 34
 
34 35
   //known formats
35 36
   static final String[] knownFormats =
36 37
   {
37
-    "Blinkenlights (18x8-1/2)",
38
-    "Blinkenlights Arcade (26x20-1/16)",
39
-    "Blinkenlights reloaded (18x8-1/16)",
40
-    "bluebox (98x7-1/128)",
41
-    "PixelCurtain (18x8-3/256)",
42
-    "TROIA big walls (104x32-1/128)",
43
-    "TROIA ceiling (104x80-1/128)",
44
-    "TROIA small walls (80x32-1/128)",
38
+    "Blinkenlights (18x8-1/2) [a=0.55]",
39
+    "Blinkenlights Arcade (26x20-1/16) [a=0.5]",
40
+    "Blinkenlights reloaded (18x8-1/16) [a=0.55]",
41
+    "Blinkenlights Stereoscope West upper (22x8-1/16) [a=0.65]",
42
+    "Blinkenlights Stereoscope West lower (22x7-1/16) [a=0.65]",
43
+    "Blinkenlights Stereoscope East upper (30x12-1/16) [a=0.65]",
44
+    "Blinkenlights Stereoscope East lower (30x9-1/16) [a=0.65]",
45
+    "bluebox (98x7-1/128) [a=0.32]",
46
+    "ColorCurtain (18x8-3/256) [a=1.0]",
47
+    "TROIA big walls (104x32-1/128) [a=1.0]",
48
+    "TROIA ceiling (104x80-1/128) [a=1.0]",
49
+    "TROIA small walls (80x32-1/128) [a=1.0]",
45 50
   };
46 51
 
47 52
   //known sizes
... ...
@@ -49,6 +54,10 @@ public class Blimp extends JApplet
49 54
   {
50 55
     "Blinkenlights (18x8)",
51 56
     "Blinkenlights Arcade (26x20)",
57
+    "Blinkenlights Stereoscope West upper (22x8)",
58
+    "Blinkenlights Stereoscope West lower (22x7)",
59
+    "Blinkenlights Stereoscope East upper (30x12)",
60
+    "Blinkenlights Stereoscope East lower (30x9)",
52 61
     "bluebox (98x7)",
53 62
     "TROIA big walls (104x32)",
54 63
     "TROIA ceiling (104x80)",
... ...
@@ -201,7 +210,7 @@ public class Blimp extends JApplet
201 210
     labelStatus.setText( "new movie..." );
202 211
     curFile = null;
203 212
     curMovie = new BlinkenMovie( defHeight, defWidth, defChannels, defMaxval );
204
-    curMovie.insertInfo( 0, "creator", "Blimp (version 1.3.3 date 2008-08-10)" );
213
+    curMovie.insertInfo( 0, "creator", "Blimp (version 1.3.4 date 2008-09-14)" );
205 214
     curMovie.insertFrame( 0, new BlinkenFrame( defHeight, defWidth, defChannels, defMaxval, defDuration ) );
206 215
     curMovieChanged = false;
207 216
 
... ...
@@ -437,6 +446,19 @@ public class Blimp extends JApplet
437 446
       return "";
438 447
   }
439 448
 
449
+  //get aspect from square bracket in string
450
+  private String getAspect( String str )
451
+  {
452
+    Pattern pattern;
453
+    Matcher matcher;
454
+
455
+    pattern = Pattern.compile( "^.*\\[([^\\[\\]]*)\\]$" );
456
+    if( (matcher = pattern.matcher( str )).find( ) )
457
+      return matcher.group( 1 );
458
+    else
459
+      return "";
460
+  }
461
+
440 462
   //resize to format
441 463
   private boolean actionEditResizeToFormat( String format )
442 464
   {
... ...
@@ -466,6 +488,36 @@ public class Blimp extends JApplet
466 488
     return true;
467 489
   }
468 490
 
491
+  //set aspect (in context of resizing movie)
492
+  private boolean actionEditResizeSetAspect( String aspect )
493
+  {
494
+    Pattern aspectPattern;
495
+    Matcher aspectMatcher;
496
+    double aspectValue;
497
+
498
+    //initialize aspect pattern
499
+    aspectPattern = Pattern.compile( "^a=([0-9.]+)$" );
500
+
501
+    //check aspect
502
+    if( ! (aspectMatcher = aspectPattern.matcher( aspect )).find( ) ) //abort and return error if aspect not valid
503
+      return false;
504
+
505
+    //parse aspect if specified
506
+    try
507
+    {
508
+      aspectValue = Double.parseDouble( aspectMatcher.group( 1 ) );
509
+    }
510
+    catch( NumberFormatException e )
511
+    {
512
+      return false;
513
+    }
514
+
515
+    //set new aspect
516
+    sliderAspect.setValue( aspectZoomToSliderValue( aspectValue ) );
517
+
518
+    return true;
519
+  }
520
+
469 521
   //"Edit Resize Movie user defined format..." was chosen from menu
470 522
   private void actionEditResizeUser( )
471 523
   {
... ...
@@ -1030,7 +1082,7 @@ public class Blimp extends JApplet
1030 1082
   {
1031 1083
     JOptionPane.showMessageDialog( dialogParent,
1032 1084
                                    "BlinkenLightsInteractiveMovieProgram\n" +
1033
-                                   "version 1.3.3 date 2008-08-10\n" +
1085
+                                   "version 1.3.4 date 2008-09-14\n" +
1034 1086
                                    "Copyright (C) 2004-2008: Stefan Schuermans <stefan@schuermans.info>\n" +
1035 1087
                                    "Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" +
1036 1088
                                    "a blinkenarea.org project",
... ...
@@ -1144,6 +1196,18 @@ public class Blimp extends JApplet
1144 1196
     menuFrameSelDelete.setEnabled( valid );
1145 1197
   }
1146 1198
 
1199
+  //convert aspect or zoom to aspect or zoom slider value
1200
+  private int aspectZoomToSliderValue( double aspectZoom )
1201
+  {
1202
+    double value = Math.log( aspectZoom ) / Math.log( 2.0 );
1203
+    value *= (double)ZoomAspectResolution;
1204
+    if( value >= 0.0 )
1205
+      value += 0.5;
1206
+    else
1207
+      value -= 0.5;
1208
+    return (int)value;
1209
+  }
1210
+
1147 1211
   //set zoom and aspect value of frame
1148 1212
   private void setZoomAspect( )
1149 1213
   {
... ...
@@ -1202,7 +1266,7 @@ public class Blimp extends JApplet
1202 1266
 
1203 1267
       //set new zoom value without triggering events
1204 1268
       noRecurseZoomAspect = true;
1205
-      sliderZoom.setValue( (int)((Math.log( zoom ) / Math.log( 2.0 )) * (double)ZoomAspectResolution + 0.5) );
1269
+      sliderZoom.setValue( aspectZoomToSliderValue( zoom ) );
1206 1270
       noRecurseZoomAspect = false;
1207 1271
 
1208 1272
       //set zoom and aspect value of frame
... ...
@@ -1270,7 +1334,7 @@ public class Blimp extends JApplet
1270 1334
 
1271 1335
       //set new aspect value without triggering events
1272 1336
       noRecurseZoomAspect = true;
1273
-      sliderAspect.setValue( (int)((Math.log( aspect ) / Math.log( 2.0 )) * (double)ZoomAspectResolution + 0.5) );
1337
+      sliderAspect.setValue( aspectZoomToSliderValue( aspect ) );
1274 1338
       noRecurseZoomAspect = false;
1275 1339
 
1276 1340
       //set zoom and aspect value of frame
... ...
@@ -1870,6 +1934,7 @@ public class Blimp extends JApplet
1870 1934
         if( i < menuEditResizeKnown.length )
1871 1935
         {
1872 1936
           actionEditResizeToFormat( getFormatOrSize( knownFormats[i] ) );
1937
+          actionEditResizeSetAspect( getAspect( knownFormats[i] ) );
1873 1938
           break;
1874 1939
         }
1875 1940
 
... ...
@@ -2013,7 +2078,7 @@ public class Blimp extends JApplet
2013 2078
     //initialize current movie, frame
2014 2079
     curDir = new File( "." );
2015 2080
     curMovie = new BlinkenMovie( defHeight, defWidth, defChannels, defMaxval );
2016
-    curMovie.insertInfo( 0, "creator", "Blimp (version 1.3.3 date 2008-08-10)" );
2081
+    curMovie.insertInfo( 0, "creator", "Blimp (version 1.3.4 date 2008-09-14)" );
2017 2082
     curMovie.insertFrame( 0, new BlinkenFrame( defHeight, defWidth, defChannels, defMaxval, defDuration ) );
2018 2083
     curFrame = null;
2019 2084
 
... ...
@@ -2308,7 +2373,7 @@ public class Blimp extends JApplet
2308 2373
     panelAspectName.add( labelAspectName );
2309 2374
     labelAspect = new JLabel( "", JLabel.CENTER );
2310 2375
     panelAspectName.add( labelAspect );
2311
-    sliderAspect = new JSlider( JSlider.VERTICAL, -3 * ZoomAspectResolution, 3 * ZoomAspectResolution, 0 );
2376
+    sliderAspect = new JSlider( JSlider.VERTICAL, -3 * ZoomAspectResolution, 3 * ZoomAspectResolution, aspectZoomToSliderValue( defAspect ) );
2312 2377
     sliderAspect.setSnapToTicks( true );
2313 2378
     sliderAspect.addChangeListener( this );
2314 2379
     sliderAspect.setToolTipText( "aspect" );
... ...
@@ -2668,7 +2733,7 @@ public class Blimp extends JApplet
2668 2733
 
2669 2734
     //running as command line tool
2670 2735
     System.out.println( "BlinkenLightsInteractiveMovieProgram\n" +
2671
-                        "version 1.3.3 date 2008-08-10\n" +
2736
+                        "version 1.3.4 date 2008-09-14\n" +
2672 2737
                         "Copyright (C) 2004-2008: Stefan Schuermans <stefan@schuermans.info>\n" +
2673 2738
                         "Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" +
2674 2739
                         "a blinkenarea.org project\n" );
... ...
@@ -2679,7 +2744,7 @@ public class Blimp extends JApplet
2679 2744
 
2680 2745
     //get initial movie
2681 2746
     movie = new BlinkenMovie( defHeight, defWidth, defChannels, defMaxval );
2682
-    movie.insertInfo( 0, "creator", "Blimp (version 1.3.3 date 2008-08-10)" );
2747
+    movie.insertInfo( 0, "creator", "Blimp (version 1.3.4 date 2008-09-14)" );
2683 2748
     movie.insertFrame( 0, new BlinkenFrame( defHeight, defWidth, defChannels, defMaxval, defDuration ) );
2684 2749
 
2685 2750
     //process parameters
... ...
@@ -1,5 +1,5 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 1.3.3 date 2008-08-10
2
+ * version 1.3.4 date 2008-09-14
3 3
  * Copyright (C) 2004-2008: Stefan Schuermans <stefan@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
... ...
@@ -1,5 +1,5 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 1.3.3 date 2008-08-10
2
+ * version 1.3.4 date 2008-09-14
3 3
  * Copyright (C) 2004-2008: Stefan Schuermans <stefan@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
... ...
@@ -1,5 +1,5 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 1.3.3 date 2008-08-10
2
+ * version 1.3.4 date 2008-09-14
3 3
  * Copyright (C) 2004-2008: Stefan Schuermans <stefan@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
... ...
@@ -1,5 +1,5 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 1.3.3 date 2008-08-10
2
+ * version 1.3.4 date 2008-09-14
3 3
  * Copyright (C) 2004-2008: Stefan Schuermans <stefan@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
... ...
@@ -1,5 +1,5 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 1.3.3 date 2008-08-10
2
+ * version 1.3.4 date 2008-09-14
3 3
  * Copyright (C) 2004-2008: Stefan Schuermans <stefan@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
... ...
@@ -1,5 +1,5 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 1.3.3 date 2008-08-10
2
+ * version 1.3.4 date 2008-09-14
3 3
  * Copyright (C) 2004-2008: Stefan Schuermans <stefan@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
6 6