Browse Source

DarkMonkey - Added Yellow-Two and Manual Theme. Improved GLSL Highlighting (you need the GLSL Plugin) and added some MenuBarUI Stub (the idea is to override the MenuBarUI so it works like native mac apps. Unfortunately this code doesn't compile and would need heavy refactoring)

MeFisto94 9 years ago
parent
commit
ace905c40b

+ 45 - 6
jme3-dark-laf/src/org/jme3/netbeans/plaf/darkmonkey/DarkMonkeyLookAndFeel.java

@@ -8,8 +8,8 @@ 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.prefs.Preferences;
 import javax.swing.UIDefaults;
 import javax.swing.UIDefaults;
-import javax.swing.UIManager;
 import org.openide.util.NbPreferences;
 import org.openide.util.NbPreferences;
 
 
 /**
 /**
@@ -49,6 +49,27 @@ public class DarkMonkeyLookAndFeel extends com.nilo.plaf.nimrod.NimRODLookAndFee
                     case "yellow":
                     case "yellow":
                         setCurrentTheme(getYellowTheme());
                         setCurrentTheme(getYellowTheme());
                         break;
                         break;
+                    
+                    case "yellow-two":
+                        setCurrentTheme(getYellowTwoTheme());
+                        break;
+                        
+                    case "manual":
+                        NimRODTheme nt = new NimRODTheme();
+                        Preferences pref = NbPreferences.root().node("laf");
+                        nt.setBlack(Color.decode(pref.get("darkmonkey.color.black", "#E8EAE0")));
+                        nt.setWhite(Color.decode(pref.get("darkmonkey.color.white", "#373737")));
+                        nt.setPrimary1(Color.decode(pref.get("darkmonkey.color.primary1", "#1A28BD")));
+                        nt.setPrimary2(Color.decode(pref.get("darkmonkey.color.primary2", "#233FB0")));
+                        nt.setPrimary3(Color.decode(pref.get("darkmonkey.color.primary3", "#3AA5F2")));
+                        nt.setSecondary1(Color.decode(pref.get("darkmonkey.color.secondary1", "#303030")));
+                        nt.setSecondary2(Color.decode(pref.get("darkmonkey.color.secondary2", "#3A3A3A")));
+                        nt.setSecondary3(Color.decode(pref.get("darkmonkey.color.secondary3", "#515151")));
+                        nt.setFrameOpacity(180);
+                        nt.setMenuOpacity(219);
+                        nt.setFont(Font.decode("DejaVu Sans Condensed-PLAIN-12"));
+                        setCurrentTheme(nt);
+                        break;
                         
                         
                     case "legacy":
                     case "legacy":
                         setCurrentTheme(getLegacyTheme());
                         setCurrentTheme(getLegacyTheme());
@@ -64,7 +85,6 @@ public class DarkMonkeyLookAndFeel extends com.nilo.plaf.nimrod.NimRODLookAndFee
         } catch (Exception e) {
         } catch (Exception e) {
             setCurrentTheme(getBlueTheme());
             setCurrentTheme(getBlueTheme());
         }
         }
-
     }
     }
     
     
     /**
     /**
@@ -90,7 +110,7 @@ public class DarkMonkeyLookAndFeel extends com.nilo.plaf.nimrod.NimRODLookAndFee
 
 
     /**
     /**
      * This method override, getDescription() returns the String 
      * This method override, getDescription() returns the String 
-     * "Look and Feel DarkMonkey - 2015, based on NimROD 2007" for 
+     * "Look and Feel DarkMonkey - 2016, 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 - 2016, based on NimROD 2007"
      * @return String "Look and Feel DarkMonkey - 2016, based on NimROD 2007"
@@ -104,6 +124,7 @@ public class DarkMonkeyLookAndFeel extends com.nilo.plaf.nimrod.NimRODLookAndFee
     @Override
     @Override
     protected void initClassDefaults( UIDefaults table) {
     protected void initClassDefaults( UIDefaults table) {
         super.initClassDefaults( table);
         super.initClassDefaults( table);
+        // MenuBarUI currently doesn't compile table.put("MenuBarUI", "org.jme3.netbeans.plaf.darkmonkey.components.MenuBarUI");
         /*
         /*
         for( Enumeration en = table.keys(); en.hasMoreElements(); ) {
         for( Enumeration en = table.keys(); en.hasMoreElements(); ) {
             System.out.println( "[" + en.nextElement() + "]");
             System.out.println( "[" + en.nextElement() + "]");
@@ -166,6 +187,24 @@ public class DarkMonkeyLookAndFeel extends com.nilo.plaf.nimrod.NimRODLookAndFee
         return nt;
         return nt;
     }
     }
     
     
+    private NimRODTheme getYellowTwoTheme() {
+        NimRODTheme nt = new NimRODTheme();
+        
+        nt.setBlack(Color.decode("#F3C802")); // Font Foreground
+        nt.setWhite(Color.decode("#262626")); // Font Background
+        nt.setPrimary1(Color.decode("#2040D0")); // Surrounds Bars and Shortcuts
+        nt.setPrimary2(Color.decode("#1D3DBF")); // mainly used for bars 
+        nt.setPrimary3(Color.decode("#1D3DBF")); // e.g. for open tabs (Application)
+        nt.setSecondary1(Color.decode("#000000")); // Outlines, some decoration and tooltips for disabled buttons
+        nt.setSecondary2(Color.decode("#A6A086")); // Selected inactive things (and disabled text)
+        nt.setSecondary3(Color.decode("#323232")); // Unselected Frames (and general background color)
+        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
      * This is the Legacy Theme. It's the one that DarkMonkey had before alpha-4
      * @return 
      * @return 
@@ -200,9 +239,9 @@ public class DarkMonkeyLookAndFeel extends com.nilo.plaf.nimrod.NimRODLookAndFee
         nt.setPrimary1(Color.decode("#FF0000")); // Surrounds Bars and Shortcuts
         nt.setPrimary1(Color.decode("#FF0000")); // Surrounds Bars and Shortcuts
         nt.setPrimary2(Color.decode("#00FF00")); // mainly used for bars 
         nt.setPrimary2(Color.decode("#00FF00")); // mainly used for bars 
         nt.setPrimary3(Color.decode("#0000FF")); // e.g. for open tabs (Application)
         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.setSecondary1(Color.decode("#FFFF00")); // Outlines, some decoration and tooltips for disabled buttons
+        nt.setSecondary2(Color.decode("#FF00FF")); // Selected inactive things (and disabled text)
+        nt.setSecondary3(Color.decode("#00FFFF")); // Unselected Frames
         nt.setFrameOpacity(180);
         nt.setFrameOpacity(180);
         nt.setMenuOpacity(219);
         nt.setMenuOpacity(219);
         nt.setFont(Font.decode("DejaVu Sans Condensed-PLAIN-12"));
         nt.setFont(Font.decode("DejaVu Sans Condensed-PLAIN-12"));

+ 53 - 0
jme3-dark-laf/src/org/jme3/netbeans/plaf/darkmonkey/components/MenuBarUI.java

@@ -0,0 +1,53 @@
+/*package org.jme3.netbeans.plaf.darkmonkey.components;
+
+import com.apple.laf.AquaMenuBarUI;
+import java.awt.*;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.*;
+import javax.swing.plaf.*;
+import org.jme3.netbeans.plaf.darkmonkey.DarkMonkeyLookAndFeel;
+
+public class MenuBarUI extends AquaMenuBarUI {
+  public static ComponentUI createUI( JComponent x) {
+    MenuBarUI a = new MenuBarUI();
+    a.ProcessAppleControl(null);
+    return a;
+  }
+  
+  // Thanks to bloodwalker for this
+  private void ProcessAppleControl(JMenuBar j)
+  {
+   try {
+        Class<?> clazz = Class.forName("com.apple.eawt.Application");
+        Method method = clazz.getMethod("getApplication");
+        Object obj = method.invoke(null);
+        method = clazz.getMethod("setDefaultMenuBar", JMenuBar.class);
+        method.invoke(obj, j); //Your custom MenuBar
+        method = clazz.getMethod("enableSuddenTermination");
+        method.invoke(obj);
+   } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
+        Logger.getLogger(DarkMonkeyLookAndFeel.class.getName()).log(Level.SEVERE, null, ex);
+    }
+}
+
+  public void paint( Graphics g, JComponent c) {
+    super.paint( g, c);
+  }
+
+    @Override
+    public void update(Graphics g, JComponent c) {
+        super.update(g, c);
+        if (c instanceof JMenuBar) {
+            ProcessAppleControl((JMenuBar)c); // For this to work, we HAVE TO extend AquaMenuBarUI
+        }
+    }
+  
+    /* Doesn't work since AquaMenuBarUI isn't found by the default Compiler
+    @Override
+    boolean setScreenMenuBar(final JFrame jframe) {
+        return false;
+    }*/
+//}

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

@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE fontscolors PUBLIC "-//NetBeans//DTD Editor Fonts and Colors settings 1.1//EN" "http://www.netbeans.org/dtds/EditorFontsColors-1_1.dtd">
 <!DOCTYPE fontscolors PUBLIC "-//NetBeans//DTD Editor Fonts and Colors settings 1.1//EN" "http://www.netbeans.org/dtds/EditorFontsColors-1_1.dtd">
 <fontscolors>
 <fontscolors>
-    <fontcolor default="preprocessor" foreColor="ffc46200" name="preprocessor"/>
+    <fontcolor default="preprocessor" foreColor="ffE67300" name="preprocessor"/>
     <fontcolor default="error" foreColor="white" name="error" waveUnderlined="ffff3300"/>
     <fontcolor default="error" foreColor="white" name="error" waveUnderlined="ffff3300"/>
-    <fontcolor default="basictype" foreColor="ff4b9393" name="basictype"/>
+    <fontcolor default="basictype" foreColor="ff46EBEB" name="basictype"/>
     <fontcolor default="builtinvar" foreColor="ff8080ff" name="builtinvar"/>
     <fontcolor default="builtinvar" foreColor="ff8080ff" name="builtinvar"/>
-    <fontcolor default="string" foreColor="ff808000" name="string"/>
-    <fontcolor default="keyword" foreColor="ff0080ff" name="keyword"/>
+    <fontcolor default="string" foreColor="ffFADD00" name="string"/>
+    <fontcolor default="keyword" foreColor="ff004CFF" name="keyword"/>
     <fontcolor default="whitespace" foreColor="black" name="whitespace"/>
     <fontcolor default="whitespace" foreColor="black" name="whitespace"/>
     <fontcolor default="number" foreColor="magenta" name="number"/>
     <fontcolor default="number" foreColor="magenta" name="number"/>
     <fontcolor default="comment" foreColor="ff00934a" name="comment"/>
     <fontcolor default="comment" foreColor="ff00934a" name="comment"/>
-    <fontcolor default="identifier" foreColor="lightGray" name="identifier"/>
+    <fontcolor default="identifier" foreColor="white" name="identifier"/>
     <fontcolor default="builtinfunc" foreColor="ffff8040" name="builtinfunc"/>
     <fontcolor default="builtinfunc" foreColor="ffff8040" name="builtinfunc"/>
     <fontcolor default="operator" foreColor="white" name="operator"/>
     <fontcolor default="operator" foreColor="white" name="operator"/>
 </fontscolors>
 </fontscolors>