Christian Heimke commited on 2011-07-15 09:23:00
Showing 9 changed files, with 86 additions and 23 deletions.
| ... | ... |
@@ -4,6 +4,10 @@ Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 4 | 4 |
a blinkenarea.org project |
| 5 | 5 |
powered by eventphone.de |
| 6 | 6 |
|
| 7 |
+version 1.3.1 date 2006-10-17 |
|
| 8 |
+----------------------------- |
|
| 9 |
+ - specific file filters for *.blm, *.bmm, *.bml, *.bmbm |
|
| 10 |
+ |
|
| 7 | 11 |
version 1.3 date 2006-10-10 |
| 8 | 12 |
--------------------------- |
| 9 | 13 |
- added support for aspect ratio |
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
# BlinkenLightsInteractiveMovieProgram |
| 2 |
-# version 1.3 date 2006-10-10 |
|
| 2 |
+# version 1.3.1 date 2006-10-17 |
|
| 3 | 3 |
# Copyright (C) 2004-2006: Stefan Schuermans <1stein@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 date 2006-10-10 |
|
| 2 |
+ * version 1.3.1 date 2006-10-17 |
|
| 3 | 3 |
* Copyright (C) 2004-2006: Stefan Schuermans <1stein@schuermans.info> |
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| ... | ... |
@@ -147,6 +147,21 @@ public class Blimp extends JApplet |
| 147 | 147 |
return false; |
| 148 | 148 |
} |
| 149 | 149 |
|
| 150 |
+ //set file filters for file chooser |
|
| 151 |
+ private void setFileFilters( JFileChooser fileChooser ) |
|
| 152 |
+ {
|
|
| 153 |
+ javax.swing.filechooser.FileFilter fileFilters[ ] = fileChooser.getChoosableFileFilters( ); |
|
| 154 |
+ for( int i = 0; i < fileFilters.length; i++ ) |
|
| 155 |
+ fileChooser.removeChoosableFileFilter( fileFilters[i] ); |
|
| 156 |
+ javax.swing.filechooser.FileFilter blinkenFileFilter = new BlinkenFileFilter( ); |
|
| 157 |
+ fileChooser.addChoosableFileFilter( blinkenFileFilter ); |
|
| 158 |
+ fileChooser.addChoosableFileFilter( new BlinkenFileFilter( "blm" ) ); |
|
| 159 |
+ fileChooser.addChoosableFileFilter( new BlinkenFileFilter( "bmm" ) ); |
|
| 160 |
+ fileChooser.addChoosableFileFilter( new BlinkenFileFilter( "bml" ) ); |
|
| 161 |
+ fileChooser.addChoosableFileFilter( new BlinkenFileFilter( "bbm" ) ); |
|
| 162 |
+ fileChooser.setFileFilter( blinkenFileFilter ); |
|
| 163 |
+ } |
|
| 164 |
+ |
|
| 150 | 165 |
//"File New" was chosen from menu |
| 151 | 166 |
private void actionFileNew( ) |
| 152 | 167 |
{
|
| ... | ... |
@@ -160,7 +175,7 @@ public class Blimp extends JApplet |
| 160 | 175 |
labelStatus.setText( "new movie..." ); |
| 161 | 176 |
curFile = null; |
| 162 | 177 |
curMovie = new BlinkenMovie( defHeight, defWidth, defChannels, defMaxval ); |
| 163 |
- curMovie.insertInfo( 0, "creator", "Blimp (version 1.3 date 2006-10-10)" ); |
|
| 178 |
+ curMovie.insertInfo( 0, "creator", "Blimp (version 1.3.1 date 2006-10-17)" ); |
|
| 164 | 179 |
curMovie.insertFrame( 0, new BlinkenFrame( defHeight, defWidth, defChannels, defMaxval, defDuration ) ); |
| 165 | 180 |
curMovieChanged = false; |
| 166 | 181 |
|
| ... | ... |
@@ -205,7 +220,7 @@ public class Blimp extends JApplet |
| 205 | 220 |
//show file select dialog |
| 206 | 221 |
fileChooser = new JFileChooser( ); |
| 207 | 222 |
fileChooser.setDialogTitle( "Blimp - Load..." ); |
| 208 |
- fileChooser.setFileFilter( new BlinkenFileFilter( ) ); |
|
| 223 |
+ setFileFilters( fileChooser ); |
|
| 209 | 224 |
if( curDir != null ) |
| 210 | 225 |
fileChooser.setCurrentDirectory( curDir ); |
| 211 | 226 |
if( fileChooser.showOpenDialog( dialogParent ) == JFileChooser.APPROVE_OPTION ) |
| ... | ... |
@@ -227,6 +242,21 @@ public class Blimp extends JApplet |
| 227 | 242 |
actionFileSaveAs( ); |
| 228 | 243 |
return; |
| 229 | 244 |
} |
| 245 |
+ //warn if selected format does not fully support current format |
|
| 246 |
+ if( curFile.getPath( ).endsWith( ".blm" ) && (curMovie.getChannels( ) > 1 || curMovie.getMaxval( ) > 1) ) |
|
| 247 |
+ {
|
|
| 248 |
+ JOptionPane.showMessageDialog( dialogParent, |
|
| 249 |
+ "The selected format \"BlinkenLights Movie (*.blm)\"\nonly supports one channel with two colors.\nFor not losing any information, please save\nyour movie as \"Blinkenlights Markup Language movie (*.bml)\"", |
|
| 250 |
+ "Blimp - Save - Warning", |
|
| 251 |
+ JOptionPane.WARNING_MESSAGE ); |
|
| 252 |
+ } |
|
| 253 |
+ if( curFile.getPath( ).endsWith( ".bmm" ) && curMovie.getChannels( ) > 1 ) |
|
| 254 |
+ {
|
|
| 255 |
+ JOptionPane.showMessageDialog( dialogParent, |
|
| 256 |
+ "The selected format \"BlinkenMini Movie (*.blm)\"\nonly supports one channel.\nFor not losing any information, please save\nyour movie as \"Blinkenlights Markup Language movie (*.bml)\"", |
|
| 257 |
+ "Blimp - Save - Warning", |
|
| 258 |
+ JOptionPane.WARNING_MESSAGE ); |
|
| 259 |
+ } |
|
| 230 | 260 |
//save file |
| 231 | 261 |
if( curMovie.save( curFile.getPath( ) ) ) |
| 232 | 262 |
{
|
| ... | ... |
@@ -249,7 +279,7 @@ public class Blimp extends JApplet |
| 249 | 279 |
//show file select dialog |
| 250 | 280 |
fileChooser = new JFileChooser( ); |
| 251 | 281 |
fileChooser.setDialogTitle( "Blimp - Save as..." ); |
| 252 |
- fileChooser.setFileFilter( new BlinkenFileFilter( ) ); |
|
| 282 |
+ setFileFilters( fileChooser ); |
|
| 253 | 283 |
if( curDir != null ) |
| 254 | 284 |
fileChooser.setCurrentDirectory( curDir ); |
| 255 | 285 |
if( curFile != null ) |
| ... | ... |
@@ -638,12 +668,12 @@ public class Blimp extends JApplet |
| 638 | 668 |
JFileChooser fileChooser; |
| 639 | 669 |
BlinkenMovie movie; |
| 640 | 670 |
BlinkenFrame newFrame; |
| 641 |
- int frameCnt, frameNo, cnt, i; |
|
| 671 |
+ int frameCnt, frameNo, cnt; |
|
| 642 | 672 |
|
| 643 | 673 |
//show file select dialog |
| 644 | 674 |
fileChooser = new JFileChooser( ); |
| 645 | 675 |
fileChooser.setDialogTitle( "Blimp - Import Movie..." ); |
| 646 |
- fileChooser.setFileFilter( new BlinkenFileFilter( ) ); |
|
| 676 |
+ setFileFilters( fileChooser ); |
|
| 647 | 677 |
if( curDir != null ) |
| 648 | 678 |
fileChooser.setCurrentDirectory( curDir ); |
| 649 | 679 |
if( fileChooser.showOpenDialog( dialogParent ) != JFileChooser.APPROVE_OPTION ) //not successful |
| ... | ... |
@@ -667,7 +697,7 @@ public class Blimp extends JApplet |
| 667 | 697 |
if( frameNo > frameCnt ) |
| 668 | 698 |
frameNo = frameCnt; |
| 669 | 699 |
cnt = movie.getFrameCnt( ); |
| 670 |
- for( i = 0; i < cnt; i++ ) |
|
| 700 |
+ for( int i = 0; i < cnt; i++ ) |
|
| 671 | 701 |
{
|
| 672 | 702 |
newFrame = new BlinkenFrame( movie.getFrame( i ) ); |
| 673 | 703 |
curMovie.insertFrame( frameNo + i, newFrame ); //this resizes the frame to fit the movie dimensions |
| ... | ... |
@@ -956,7 +986,7 @@ public class Blimp extends JApplet |
| 956 | 986 |
{
|
| 957 | 987 |
JOptionPane.showMessageDialog( dialogParent, |
| 958 | 988 |
"BlinkenLightsInteractiveMovieProgram\n" + |
| 959 |
- "version 1.3 date 2006-10-10\n" + |
|
| 989 |
+ "version 1.3.1 date 2006-10-17\n" + |
|
| 960 | 990 |
"Copyright (C) 2004-2006: Stefan Schuermans <1stein@schuermans.info>\n" + |
| 961 | 991 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" + |
| 962 | 992 |
"a blinkenarea.org project\n" + |
| ... | ... |
@@ -1821,7 +1851,7 @@ public class Blimp extends JApplet |
| 1821 | 1851 |
//initialize current movie, frame |
| 1822 | 1852 |
curDir = new File( "." ); |
| 1823 | 1853 |
curMovie = new BlinkenMovie( defHeight, defWidth, defChannels, defMaxval ); |
| 1824 |
- curMovie.insertInfo( 0, "creator", "Blimp (version 1.3 date 2006-10-10)" ); |
|
| 1854 |
+ curMovie.insertInfo( 0, "creator", "Blimp (version 1.3.1 date 2006-10-17)" ); |
|
| 1825 | 1855 |
curMovie.insertFrame( 0, new BlinkenFrame( defHeight, defWidth, defChannels, defMaxval, defDuration ) ); |
| 1826 | 1856 |
curFrame = null; |
| 1827 | 1857 |
|
| ... | ... |
@@ -2441,7 +2471,7 @@ public class Blimp extends JApplet |
| 2441 | 2471 |
|
| 2442 | 2472 |
//running as command line tool |
| 2443 | 2473 |
System.out.println( "BlinkenLightsInteractiveMovieProgram\n" + |
| 2444 |
- "version 1.3 date 2006-10-10\n" + |
|
| 2474 |
+ "version 1.3.1 date 2006-10-17\n" + |
|
| 2445 | 2475 |
"Copyright (C) 2004-2006: Stefan Schuermans <1stein@schuermans.info>\n" + |
| 2446 | 2476 |
"Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" + |
| 2447 | 2477 |
"a blinkenarea.org project\n" + |
| ... | ... |
@@ -2453,7 +2483,7 @@ public class Blimp extends JApplet |
| 2453 | 2483 |
|
| 2454 | 2484 |
//get initial movie |
| 2455 | 2485 |
movie = new BlinkenMovie( defHeight, defWidth, defChannels, defMaxval ); |
| 2456 |
- movie.insertInfo( 0, "creator", "Blimp (version 1.3 date 2006-10-10)" ); |
|
| 2486 |
+ movie.insertInfo( 0, "creator", "Blimp (version 1.3.1 date 2006-10-17)" ); |
|
| 2457 | 2487 |
movie.insertFrame( 0, new BlinkenFrame( defHeight, defWidth, defChannels, defMaxval, defDuration ) ); |
| 2458 | 2488 |
|
| 2459 | 2489 |
//process parameters |
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
/* BlinkenLightsInteractiveMovieProgram |
| 2 |
- * version 1.3 date 2006-10-10 |
|
| 2 |
+ * version 1.3.1 date 2006-10-17 |
|
| 3 | 3 |
* Copyright (C) 2004-2006: Stefan Schuermans <1stein@schuermans.info> |
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| ... | ... |
@@ -12,19 +12,48 @@ import java.io.*; |
| 12 | 12 |
|
| 13 | 13 |
public class BlinkenFileFilter extends javax.swing.filechooser.FileFilter |
| 14 | 14 |
{
|
| 15 |
+ boolean m_use_blm = true, m_use_bmm = true, m_use_bml = true, m_use_bbm = true; |
|
| 16 |
+ String m_def_ext = "bml"; |
|
| 17 |
+ String m_descr = "all Blimp movie files (*.blm, *.bmm, *.bml, *.bbm)"; |
|
| 18 |
+ |
|
| 19 |
+ public BlinkenFileFilter( ) |
|
| 20 |
+ {
|
|
| 21 |
+ } |
|
| 22 |
+ |
|
| 23 |
+ public BlinkenFileFilter( String type ) |
|
| 24 |
+ {
|
|
| 25 |
+ if( type.equals( "blm" ) ) {
|
|
| 26 |
+ m_use_blm = true; |
|
| 27 |
+ m_def_ext = "blm"; |
|
| 28 |
+ m_descr = "BlinkenLights Movie files (*.blm)"; |
|
| 29 |
+ } else if( type.equals( "bmm" ) ) {
|
|
| 30 |
+ m_use_bmm = true; |
|
| 31 |
+ m_def_ext = "bmm"; |
|
| 32 |
+ m_descr = "BlinkenMini Movie files (*.bmm)"; |
|
| 33 |
+ } else if( type.equals( "bml" ) ) {
|
|
| 34 |
+ m_use_bml = true; |
|
| 35 |
+ m_def_ext = "bml"; |
|
| 36 |
+ m_descr = "Blinkenlights Markup Language files (*.bml)"; |
|
| 37 |
+ } else if( type.equals( "bbm" ) ) {
|
|
| 38 |
+ m_use_bbm = true; |
|
| 39 |
+ m_def_ext = "bbm"; |
|
| 40 |
+ m_descr = "Binary Blinken Movie files (*.bbm)"; |
|
| 41 |
+ } |
|
| 42 |
+ } |
|
| 43 |
+ |
|
| 15 | 44 |
public boolean accept( File file ) |
| 16 | 45 |
{
|
| 17 | 46 |
if( file.isDirectory( ) ) |
| 18 | 47 |
return true; |
| 19 | 48 |
String fileName = file.getPath( ); |
| 20 |
- return fileName.endsWith( ".blm" ) || |
|
| 21 |
- fileName.endsWith( ".bmm" ) || |
|
| 22 |
- fileName.endsWith( ".bml" ) || |
|
| 23 |
- fileName.endsWith( ".bbm" ); |
|
| 49 |
+ return (m_use_blm && fileName.endsWith( ".blm" )) || |
|
| 50 |
+ (m_use_bmm && fileName.endsWith( ".bmm" )) || |
|
| 51 |
+ (m_use_bml && fileName.endsWith( ".bml" )) || |
|
| 52 |
+ (m_use_bbm && fileName.endsWith( ".bbm" )); |
|
| 24 | 53 |
} |
| 25 | 54 |
|
| 26 | 55 |
public String getDescription( ) |
| 27 | 56 |
{
|
| 28 |
- return "BlinkenLights movie files (*.blm, *.bmm, *.bml, *.bbm)"; |
|
| 57 |
+ return m_descr; |
|
| 29 | 58 |
} |
| 30 | 59 |
} |
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
/* BlinkenLightsInteractiveMovieProgram |
| 2 |
- * version 1.3 date 2006-10-10 |
|
| 2 |
+ * version 1.3.1 date 2006-10-17 |
|
| 3 | 3 |
* Copyright (C) 2004-2006: Stefan Schuermans <1stein@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 date 2006-10-10 |
|
| 2 |
+ * version 1.3.1 date 2006-10-17 |
|
| 3 | 3 |
* Copyright (C) 2004-2006: Stefan Schuermans <1stein@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 date 2006-10-10 |
|
| 2 |
+ * version 1.3.1 date 2006-10-17 |
|
| 3 | 3 |
* Copyright (C) 2004-2006: Stefan Schuermans <1stein@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 date 2006-10-10 |
|
| 2 |
+ * version 1.3.1 date 2006-10-17 |
|
| 3 | 3 |
* Copyright (C) 2004-2006: Stefan Schuermans <1stein@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 date 2006-10-10 |
|
| 2 |
+ * version 1.3.1 date 2006-10-17 |
|
| 3 | 3 |
* Copyright (C) 2004-2006: Stefan Schuermans <1stein@schuermans.info> |
| 4 | 4 |
* Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html |
| 5 | 5 |
* a blinkenarea.org project |
| 6 | 6 |