Browse Source

Made Dark Monkey the default Look and Feel and applied some changes to the Editor Style and added two alternative color schemes for Dark Monkey

MeFisto94 9 years ago
parent
commit
cb9492785f

+ 2 - 2
jme3-dark-laf/nbproject/genfiles.properties

@@ -1,8 +1,8 @@
-build.xml.data.CRC32=c9f25988
+build.xml.data.CRC32=b21f09d2
 build.xml.script.CRC32=c15f5ee0
 build.xml.script.CRC32=c15f5ee0
 [email protected]
 [email protected]
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=c9f25988
+nbproject/build-impl.xml.data.CRC32=b21f09d2
 nbproject/build-impl.xml.script.CRC32=4524e469
 nbproject/build-impl.xml.script.CRC32=4524e469
 nbproject/[email protected]
 nbproject/[email protected]

+ 9 - 0
jme3-dark-laf/nbproject/project.xml

@@ -6,6 +6,15 @@
             <code-name-base>org.jme3.netbeans.plaf.darkmonkey</code-name-base>
             <code-name-base>org.jme3.netbeans.plaf.darkmonkey</code-name-base>
             <suite-component/>
             <suite-component/>
             <module-dependencies>
             <module-dependencies>
+                <dependency>
+                    <code-name-base>org.netbeans.modules.editor.settings.storage</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <release-version>1</release-version>
+                        <implementation-version/>
+                    </run-dependency>
+                </dependency>
                 <dependency>
                 <dependency>
                     <code-name-base>org.openide.awt</code-name-base>
                     <code-name-base>org.openide.awt</code-name-base>
                     <build-prerequisite/>
                     <build-prerequisite/>

+ 121 - 20
jme3-dark-laf/src/org/jme3/netbeans/plaf/darkmonkey/DarkMonkeyLookAndFeel.java

@@ -8,9 +8,9 @@ package org.jme3.netbeans.plaf.darkmonkey;
 import com.nilo.plaf.nimrod.NimRODTheme;
 import com.nilo.plaf.nimrod.NimRODTheme;
 import java.awt.Color;
 import java.awt.Color;
 import java.awt.Font;
 import java.awt.Font;
-import java.util.Enumeration;
-import javax.swing.ImageIcon;
 import javax.swing.UIDefaults;
 import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import org.openide.util.NbPreferences;
 
 
 /**
 /**
  * The DarkMonkey look and feel class Extends the Nimrod LAF, which in turn,
  * The DarkMonkey look and feel class Extends the Nimrod LAF, which in turn,
@@ -31,22 +31,40 @@ public class DarkMonkeyLookAndFeel extends com.nilo.plaf.nimrod.NimRODLookAndFee
         super();
         super();
         // Todo: replace following code with proper loading
         // Todo: replace following code with proper loading
         //  From DarkMonkey.theme
         //  From DarkMonkey.theme
-        NimRODTheme nt = new NimRODTheme();
-            
-        nt.setBlack(Color.decode("#E8EAE0"));
-        nt.setWhite(Color.decode("#262626"));
-        nt.setPrimary1(Color.decode("#77411D"));
-        nt.setPrimary2(Color.decode("#9E5F28"));
-        nt.setPrimary3(Color.decode("#948519"));
-        nt.setSecondary1(Color.decode("#303030"));
-        nt.setSecondary2(Color.decode("#3A3A3A"));
-        nt.setSecondary3(Color.decode("#515151"));
-        nt.setFrameOpacity(180);
-        nt.setMenuOpacity(219);
-        nt.setFont(Font.decode("DejaVu Sans Condensed-PLAIN-12"));
-        
-        setCurrentTheme(nt);
+        // This replaces getXYZTheme(), they will be seperate Files
         
         
+        try {
+            if (NbPreferences.root().nodeExists("laf")) {
+                String color = NbPreferences.root().node("laf").get("darkmonkey.color", null);
+                if (color == null) { /* Create key with default value */
+                    NbPreferences.root().node("laf").put("darkmonkey.color", "blue");
+                    color = "blue";
+                }
+                
+                switch (color.toLowerCase()) {
+                    case "blue":
+                        setCurrentTheme(getBlueTheme());
+                        break;
+                        
+                    case "yellow":
+                        setCurrentTheme(getYellowTheme());
+                        break;
+                        
+                    case "legacy":
+                        setCurrentTheme(getLegacyTheme());
+                        break;
+                        
+                    case "debug":
+                        setCurrentTheme(getDebugTheme());
+                        break;
+                }
+            } else {
+                setCurrentTheme(getBlueTheme());
+            }
+        } catch (Exception e) {
+            setCurrentTheme(getBlueTheme());
+        }
+
     }
     }
     
     
     /**
     /**
@@ -75,11 +93,11 @@ public class DarkMonkeyLookAndFeel extends com.nilo.plaf.nimrod.NimRODLookAndFee
      * "Look and Feel DarkMonkey - 2015, based on NimROD 2007" for 
      * "Look and Feel DarkMonkey - 2015, based on NimROD 2007" for 
      * instances of future programming that might use it as a tool tip or 
      * instances of future programming that might use it as a tool tip or 
      * small descriptor in their Look and Feel modules.
      * small descriptor in their Look and Feel modules.
-     * @return String "Look and Feel DarkMonkey - 2015, based on NimROD 2007"
+     * @return String "Look and Feel DarkMonkey - 2016, based on NimROD 2007"
      */
      */
     @Override
     @Override
     public String getDescription() {
     public String getDescription() {
-        return "Look and Feel DarkMonkey - 2015, based on NimROD 2007";
+        return "Look and Feel DarkMonkey - 2016, based on NimROD 2007";
     }
     }
     
     
        
        
@@ -107,5 +125,88 @@ public class DarkMonkeyLookAndFeel extends com.nilo.plaf.nimrod.NimRODLookAndFee
         */
         */
              
              
     }
     }
-
+    
+    private NimRODTheme getBlueTheme() {
+        NimRODTheme nt = new NimRODTheme(); //nbres:/org.jme3.netbeans.plaf.darkmonkey
+        
+        nt.setBlack(Color.decode("#E8EAE0"));
+        nt.setWhite(Color.decode("#373737"));
+        nt.setPrimary1(Color.decode("#1A28BD"));
+        nt.setPrimary2(Color.decode("#233FB0"));
+        nt.setPrimary3(Color.decode("#3AA5F2"));
+        nt.setSecondary1(Color.decode("#303030"));
+        nt.setSecondary2(Color.decode("#3A3A3A"));
+        nt.setSecondary3(Color.decode("#515151"));
+        nt.setFrameOpacity(180);
+        nt.setMenuOpacity(219);
+        nt.setFont(Font.decode("DejaVu Sans Condensed-PLAIN-12"));
+        
+        return nt;
+    }
+    
+    /**
+     * This is the Yellow Theme. It's the new default one, since Bananas = Yellow
+     * @return 
+     */
+    private NimRODTheme getYellowTheme() {
+        NimRODTheme nt = new NimRODTheme(); //nbres:/org.jme3.netbeans.plaf.darkmonkey
+        
+        nt.setBlack(Color.decode("#E8EAE0"));
+        nt.setWhite(Color.decode("#262626"));
+        nt.setPrimary1(Color.decode("#F3EF02"));
+        nt.setPrimary2(Color.decode("#F3C802"));
+        nt.setPrimary3(Color.decode("#FFB54D"));
+        nt.setSecondary1(Color.decode("#303030"));
+        nt.setSecondary2(Color.decode("#3A3A3A"));
+        nt.setSecondary3(Color.decode("#515151"));
+        nt.setFrameOpacity(180);
+        nt.setMenuOpacity(219);
+        nt.setFont(Font.decode("DejaVu Sans Condensed-PLAIN-12"));
+        
+        return nt;
+    }
+    
+    /**
+     * This is the Legacy Theme. It's the one that DarkMonkey had before alpha-4
+     * @return 
+     */
+    private NimRODTheme getLegacyTheme() {
+        NimRODTheme nt = new NimRODTheme(); //nbres:/org.jme3.netbeans.plaf.darkmonkey
+        
+        nt.setBlack(Color.decode("#E8EAE0"));
+        nt.setWhite(Color.decode("#262626"));
+        nt.setPrimary1(Color.decode("#77411D"));
+        nt.setPrimary2(Color.decode("#9E5F28"));
+        nt.setPrimary3(Color.decode("#948519"));
+        nt.setSecondary1(Color.decode("#303030"));
+        nt.setSecondary2(Color.decode("#3A3A3A"));
+        nt.setSecondary3(Color.decode("#515151"));
+        nt.setFrameOpacity(180);
+        nt.setMenuOpacity(219);
+        nt.setFont(Font.decode("DejaVu Sans Condensed-PLAIN-12"));
+        
+        return nt;
+    }
+    
+    /**
+     * Return the Debug Theme (It will have R, G and B so you know what Primary1 means etc)
+     * @return 
+     */
+    private NimRODTheme getDebugTheme() {
+        NimRODTheme nt = new NimRODTheme(); //nbres:/org.jme3.netbeans.plaf.darkmonkey
+        
+        nt.setBlack(Color.decode("#000000")); // Font Foreground
+        nt.setWhite(Color.decode("#FFFFFF")); // Font Background
+        nt.setPrimary1(Color.decode("#FF0000")); // Surrounds Bars and Shortcuts
+        nt.setPrimary2(Color.decode("#00FF00")); // mainly used for bars 
+        nt.setPrimary3(Color.decode("#0000FF")); // e.g. for open tabs (Application)
+        nt.setSecondary1(Color.decode("#00FF00")); // Selected Things
+        nt.setSecondary2(Color.decode("#FF0000")); // Selected inactive Things
+        nt.setSecondary3(Color.decode("#0000FF")); // Unselected Frames
+        nt.setFrameOpacity(180);
+        nt.setMenuOpacity(219);
+        nt.setFont(Font.decode("DejaVu Sans Condensed-PLAIN-12"));
+        
+        return nt;
+    }
 }
 }

+ 26 - 3
jme3-dark-laf/src/org/jme3/netbeans/plaf/darkmonkey/Installer.java

@@ -5,11 +5,10 @@
  */
  */
 package org.jme3.netbeans.plaf.darkmonkey;
 package org.jme3.netbeans.plaf.darkmonkey;
 
 
-import java.awt.Font;
-import java.awt.GraphicsEnvironment;
-import java.io.File;
 import javax.swing.UIManager;
 import javax.swing.UIManager;
+import org.netbeans.modules.editor.settings.storage.api.EditorSettings;
 import org.openide.modules.ModuleInstall;
 import org.openide.modules.ModuleInstall;
+import org.openide.util.NbPreferences;
 
 
 public class Installer extends ModuleInstall {
 public class Installer extends ModuleInstall {
 
 
@@ -36,5 +35,29 @@ public class Installer extends ModuleInstall {
         };
         };
         DMUtils.loadFontsFromJar(this, fontsToLoad);
         DMUtils.loadFontsFromJar(this, fontsToLoad);
     }
     }
+    
+    static {
+        // Set DarkMonkey as the default LaF (Note: This code could also be placed inside the DarkMonkey LaF, so it'll be executed )
+        try {
+            if (NbPreferences.root().nodeExists("laf")) {
+                String LaF = NbPreferences.root().node("laf").get("laf", null);
+                if (LaF == null) { /* Did the user already set a LaF? */
+                   NbPreferences.root().node("laf").put("laf", "org.jme3.netbeans.plaf.darkmonkey.DarkMonkeyLookAndFeel"); // Set DarkMonkey as default LaF
+                    // TODO: Make this more generic and code independant. Read some other properties file
+                    
+                    /* The laf file is parsed before this code is executed so we set the LaF once programatically */
+                   UIManager.setLookAndFeel("org.jme3.netbeans.plaf.darkmonkey.DarkMonkeyLookAndFeel");
+                   
+                   /* Calling Netbeans Internal API, unfortunately there is no way around that, apart from manually fiddling with the config/.nbattrs file,
+                   which would need some parsing and a restart to take effect: <fileobject name=""> <attr name="Editors\currentFontColorProfile" stringvalue="Dark Monkey"/></fileobject>
+                   Also see http://www.netbeans.org/dtds/attributes-1_0.dtd
+                   */
+                   EditorSettings setting = org.netbeans.modules.editor.settings.storage.api.EditorSettings.getDefault();
+                   setting.setCurrentFontColorProfile("Dark Monkey");
+                }
+            }
+        } catch (Exception e) {}
+        
+    }
 
 
 }
 }

+ 7 - 5
jme3-dark-laf/src/org/jme3/netbeans/plaf/darkmonkey/fac/DarkMonkeyFAC-text-x-java-token.xml

@@ -5,7 +5,7 @@
     <fontcolor default="identifier" name="mod-parameter-declaration"/>
     <fontcolor default="identifier" name="mod-parameter-declaration"/>
     <fontcolor default="method" name="mod-method"/>
     <fontcolor default="method" name="mod-method"/>
     <fontcolor default="identifier" foreColor="ff6666ff" name="mod-annotation-type"/>
     <fontcolor default="identifier" foreColor="ff6666ff" name="mod-annotation-type"/>
-    <fontcolor default="identifier" name="mod-interface"/>
+    <fontcolor default="identifier" name="mod-interface" foreColor="fff3e292"/>
     <fontcolor default="identifier" name="mod-enum-declaration">
     <fontcolor default="identifier" name="mod-enum-declaration">
         <font style="bold"/>
         <font style="bold"/>
     </fontcolor>
     </fontcolor>
@@ -14,7 +14,7 @@
     </fontcolor>
     </fontcolor>
     <fontcolor name="mod-private"/>
     <fontcolor name="mod-private"/>
     <fontcolor name="mod-protected"/>
     <fontcolor name="mod-protected"/>
-    <fontcolor name="mod-deprecated" strikeThrough="lightGray"/>
+    <fontcolor name="mod-deprecated" foreColor="ff72f5f7" strikeThrough="fff772b0"/>
     <fontcolor default="comment" name="javadoc-first-sentence">
     <fontcolor default="comment" name="javadoc-first-sentence">
         <font style="bold"/>
         <font style="bold"/>
     </fontcolor>
     </fontcolor>
@@ -24,6 +24,7 @@
     </fontcolor>
     </fontcolor>
     <fontcolor bgColor="ff6a86bb" foreColor="white" name="mark-occurrences"/>
     <fontcolor bgColor="ff6a86bb" foreColor="white" name="mark-occurrences"/>
     <fontcolor name="mod-abstract"/>
     <fontcolor name="mod-abstract"/>
+    <fontcolor name="field" foreColor="ff88ff4d"/>
     <fontcolor default="field" name="mod-field"/>
     <fontcolor default="field" name="mod-field"/>
     <fontcolor name="mod-public"/>
     <fontcolor name="mod-public"/>
     <fontcolor default="identifier" name="mod-constructor"/>
     <fontcolor default="identifier" name="mod-constructor"/>
@@ -51,7 +52,7 @@
         <font style="bold"/>
         <font style="bold"/>
     </fontcolor>
     </fontcolor>
     <fontcolor default="operator" name="operator"/>
     <fontcolor default="operator" name="operator"/>
-    <fontcolor default="identifier" name="mod-class"/>
+    <fontcolor default="identifier" name="mod-class" foreColor="fff3e292"/>
     <fontcolor name="mod-unused" waveUnderlined="ff999999"/>
     <fontcolor name="mod-unused" waveUnderlined="ff999999"/>
     <fontcolor default="string" name="string-escape-invalid" waveUnderlined="ffce7b00">
     <fontcolor default="string" name="string-escape-invalid" waveUnderlined="ffce7b00">
         <font style="bold"/>
         <font style="bold"/>
@@ -69,10 +70,11 @@
     <fontcolor default="method" name="mod-method-declaration">
     <fontcolor default="method" name="mod-method-declaration">
         <font style="bold"/>
         <font style="bold"/>
     </fontcolor>
     </fontcolor>
-    <fontcolor default="comment" name="comment"/>
+    <fontcolor default="comment" name="comment" foreColor="ff8fe3ff"/>
     <fontcolor default="comment" foreColor="lightGray" name="javadoc-identifier"/>
     <fontcolor default="comment" foreColor="lightGray" name="javadoc-identifier"/>
-    <fontcolor default="identifier" name="identifier"/>
+    <fontcolor default="identifier" name="identifier" foreColor="ffffffff"/>
     <fontcolor default="separator" name="separator"/>
     <fontcolor default="separator" name="separator"/>
     <fontcolor default="field" name="mod-field-declaration"/>
     <fontcolor default="field" name="mod-field-declaration"/>
     <fontcolor default="keyword" name="literal"/>
     <fontcolor default="keyword" name="literal"/>
+    <fontcolor name="method" foreColor="ffff4444"/>
 </fontscolors>
 </fontscolors>

+ 2 - 1
jme3-dark-laf/src/org/jme3/netbeans/plaf/darkmonkey/fac/README.txt

@@ -33,4 +33,5 @@ Tips for learners:
     all "names" need to be covered for completion. (You can look at the 
     all "names" need to be covered for completion. (You can look at the 
     <layer in context> from layer.xml and see how the various FAC .xml files 
     <layer in context> from layer.xml and see how the various FAC .xml files 
     work their way through to support the system.)
     work their way through to support the system.)
--   There is a video on the DarkMonkey Dev Blog over at the jMonkeyEngine Forums
+-   There is a video on the DarkMonkey Dev Blog over at the jMonkeyEngine Forums
+-   The RGB-ColorScheme is in ARGB Format, so always start with ff. (Alpha actually works :))