GIF support
Stefan Schuermans

Stefan Schuermans commited on 2018-09-18 20:45:17
Showing 2 changed files, with 21 additions and 5 deletions.

... ...
@@ -213,6 +213,7 @@ public class Blimp extends JApplet
213 213
     fileChooser.addChoosableFileFilter( new BlinkenFileFilter( "bmm" ) );
214 214
     fileChooser.addChoosableFileFilter( new BlinkenFileFilter( "bml" ) );
215 215
     fileChooser.addChoosableFileFilter( new BlinkenFileFilter( "bbm" ) );
216
+    fileChooser.addChoosableFileFilter( new BlinkenFileFilter( "gif" ) );
216 217
     fileChooser.setFileFilter( blinkenFileFilter );
217 218
   }
218 219
 
... ...
@@ -252,7 +253,8 @@ public class Blimp extends JApplet
252 253
       warn = ! ending.equals(".blm") &&
253 254
              ! ending.equals(".bmm") &&
254 255
              ! ending.equals(".bml") &&
255
-             ! ending.equals(".bbm");
256
+             ! ending.equals(".bbm") &&
257
+             ! ending.equals(".gif");
256 258
     }
257 259
     if( warn ) {
258 260
       JOptionPane.showMessageDialog( dialogParent,
... ...
@@ -261,6 +263,7 @@ public class Blimp extends JApplet
261 263
                                      "*.bmm: BLINKENmini Movie\n" + 
262 264
                                      "*.bml: Blinkenlights Markup Language (newer XML format)\n" +
263 265
                                      "*.bbm: Binary Blinken Movie (smaller and faster)\n" +
266
+                                     "*.gif: Graphics Interchange Format (common format for animated images)\n" +
264 267
                                      "Please make sure your filename has one of those endings!\n",
265 268
                                      "Blimp - Supported File Types...",
266 269
                                      JOptionPane.INFORMATION_MESSAGE );
... ...
@@ -10,12 +10,20 @@ import java.io.*;
10 10
 
11 11
 public class BlinkenFileFilter extends javax.swing.filechooser.FileFilter
12 12
 {
13
-  boolean m_use_blm = true, m_use_bmm = true, m_use_bml = true, m_use_bbm = true;
14
-  String m_def_ext = "bml";
15
-  String m_descr = "all Blimp movie files (*.blm, *.bmm, *.bml, *.bbm)";
13
+  boolean m_use_blm = false, m_use_bmm = false, m_use_bml = false,
14
+          m_use_bbm = false, m_use_gif = false;
15
+  String m_def_ext;
16
+  String m_descr;
16 17
 
17 18
   public BlinkenFileFilter( )
18 19
   {
20
+    m_use_blm = true;
21
+    m_use_bmm = true;
22
+    m_use_bml = true;
23
+    m_use_bbm = true;
24
+    m_use_gif = true;
25
+    m_def_ext = "bbm";
26
+    m_descr = "all Blimp movie files (*.blm, *.bmm, *.bml, *.bbm, *.gif)";
19 27
   }
20 28
 
21 29
   public BlinkenFileFilter( String type )
... ...
@@ -36,6 +44,10 @@ public class BlinkenFileFilter extends javax.swing.filechooser.FileFilter
36 44
       m_use_bbm = true;
37 45
       m_def_ext = "bbm";
38 46
       m_descr = "Binary Blinken Movie files (*.bbm)";
47
+    } else if( type.equals( "gif" ) ) {
48
+      m_use_gif = true;
49
+      m_def_ext = "gif";
50
+      m_descr = "Graphics Interchange Format (*.gif)";
39 51
     }
40 52
   }
41 53
 
... ...
@@ -47,7 +59,8 @@ public class BlinkenFileFilter extends javax.swing.filechooser.FileFilter
47 59
     return (m_use_blm && fileName.endsWith( ".blm" )) ||
48 60
            (m_use_bmm && fileName.endsWith( ".bmm" )) ||
49 61
            (m_use_bml && fileName.endsWith( ".bml" )) ||
50
-           (m_use_bbm && fileName.endsWith( ".bbm" ));
62
+           (m_use_bbm && fileName.endsWith( ".bbm" )) ||
63
+           (m_use_gif && fileName.endsWith( ".gif" ));
51 64
   }
52 65
 
53 66
   public String getDescription( )
54 67