diff dwtx/jface/resource/FontRegistry.d @ 39:644f1334b451

fix anon classes
author Frank Benoit <benoit@tionex.de>
date Tue, 08 Apr 2008 22:05:42 +0200
parents 8a302fdb4140
children 1ab001d67011
line wrap: on
line diff
--- a/dwtx/jface/resource/FontRegistry.d	Sun Apr 06 14:15:58 2008 +0200
+++ b/dwtx/jface/resource/FontRegistry.d	Tue Apr 08 22:05:42 2008 +0200
@@ -328,36 +328,53 @@
      */
 
     private void readResourceBundle(String location) {
-        String osname = System.getProperty("os.name").trim(); //$NON-NLS-1$
-        String wsname = DWT.getPlatform();
-        osname = StringConverter.removeWhiteSpaces(osname).toLowerCase();
-        wsname = StringConverter.removeWhiteSpaces(wsname).toLowerCase();
-        String OSLocation = location;
-        String WSLocation = location;
+//         String osname = System.getProperty("os.name").trim(); //$NON-NLS-1$
+//         String wsname = DWT.getPlatform();
+//         osname = StringConverter.removeWhiteSpaces(osname).toLowerCase();
+//         wsname = StringConverter.removeWhiteSpaces(wsname).toLowerCase();
+//         String OSLocation = location;
+//         String WSLocation = location;
         ResourceBundle bundle = null;
-        if (osname !is null) {
-            OSLocation = location ~ "_" ~ osname; //$NON-NLS-1$
-            if (wsname !is null) {
-                WSLocation = OSLocation ~ "_" ~ wsname; //$NON-NLS-1$
-            }
+//         if (osname !is null) {
+//             OSLocation = location ~ "_" ~ osname; //$NON-NLS-1$
+//             if (wsname !is null) {
+//                 WSLocation = OSLocation ~ "_" ~ wsname; //$NON-NLS-1$
+//             }
+//         }
+        String errorLocation = "dwtx.jface.resource.FontRegistry properties";
+        const char[] prefix = "dwtx.jface.resource.jfacefonts_";
+        const char[] postfix = ".properties";
+        version( linux ){
+            char[] propdata = import( prefix ~ "linux_gtk" ~ postfix );
+        }
+        else version( Windows ){
+            char[] propdata;
+            static assert( false, "TODO: detect windows version" );
+            propdata = import( prefix ~ "windowsnt" ~ postfix );
+            propdata = import( prefix ~ "windows98" ~ postfix );
+            propdata = import( prefix ~ "windows2000" ~ postfix );
+            propdata = import( prefix ~ "windowsxp" ~ postfix );
+        }
+        else {
+            static assert( false, "unknown plattform" );
         }
 
-        try {
-            bundle = ResourceBundle.getBundle(WSLocation);
-            readResourceBundle(bundle, WSLocation);
-        } catch (MissingResourceException wsException) {
-            try {
-                bundle = ResourceBundle.getBundle(OSLocation);
-                readResourceBundle(bundle, WSLocation);
-            } catch (MissingResourceException osException) {
-                if (location !is OSLocation) {
-                    bundle = ResourceBundle.getBundle(location);
-                    readResourceBundle(bundle, WSLocation);
-                } else {
-                    throw osException;
-                }
-            }
-        }
+//         try {
+            bundle = ResourceBundle.getBundle(propdata);
+            readResourceBundle(bundle, errorLocation);
+//         } catch (MissingResourceException wsException) {
+//             try {
+//                 bundle = ResourceBundle.getBundle(OSLocation);
+//                 readResourceBundle(bundle, WSLocation);
+//             } catch (MissingResourceException osException) {
+//                 if (location !is OSLocation) {
+//                     bundle = ResourceBundle.getBundle(location);
+//                     readResourceBundle(bundle, WSLocation);
+//                 } else {
+//                     throw osException;
+//                 }
+//             }
+//         }
     }
 
     /**
@@ -699,23 +716,15 @@
         foreach( k,v; stringToFontRecord ){
             v.dispose();
         }
+        foreach( fnt; staleFonts.toArray ){
+            fnt.dispose();
+        }
 
-        disposeFonts(staleFonts);
         stringToFontRecord.clear();
         staleFonts.clear();
     }
 
     /**
-     * Dispose of all of the fonts in this iterator.
-     * @param iterator over Collection of Font
-     */
-    private void disposeFonts( Seq!(Font) list ) {
-        foreach( fnt; list ){
-            fnt.dispose();
-        }
-    }
-
-    /**
      * Hook a dispose listener on the DWT display.
      */
     private void hookDisplayDispose(Display display) {