/[svn]/jsampler/trunk/src/org/jsampler/view/fantasia/ViewConfig.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/view/fantasia/ViewConfig.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1863 by iliev, Wed Dec 24 17:29:47 2008 UTC revision 1864 by iliev, Sat Mar 14 20:44:58 2009 UTC
# Line 1  Line 1 
1  /*  /*
2   *   JSampler - a java front-end for LinuxSampler   *   JSampler - a java front-end for LinuxSampler
3   *   *
4   *   Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com>   *   Copyright (C) 2005-2009 Grigor Iliev <grigor@grigoriliev.com>
5   *   *
6   *   This file is part of JSampler.   *   This file is part of JSampler.
7   *   *
# Line 22  Line 22 
22    
23  package org.jsampler.view.fantasia;  package org.jsampler.view.fantasia;
24    
25    import java.util.HashMap;
26    import java.util.Map;
27    
28  import javax.swing.Icon;  import javax.swing.Icon;
29  import javax.swing.ImageIcon;  import javax.swing.ImageIcon;
30  import javax.swing.UIManager;  import javax.swing.UIManager;
# Line 47  public class ViewConfig extends JSViewCo Line 50  public class ViewConfig extends JSViewCo
50          private InstrumentsDbTreeView instrumentsDbTreeView = new TreeView();          private InstrumentsDbTreeView instrumentsDbTreeView = new TreeView();
51          private InstrumentsDbTableView instrumentsDbTableView = new TableView();          private InstrumentsDbTableView instrumentsDbTableView = new TableView();
52          private BasicIconSet basicIconSet = new IconSet();          private BasicIconSet basicIconSet = new IconSet();
53    
54            private Map nativeMenuPropsMap = null;
55            private Map menuPropsMap = null;
56                    
57          /** Creates a new instance of <code>ViewConfig</code> */          /** Creates a new instance of <code>ViewConfig</code> */
58          public          public
59          ViewConfig() {          ViewConfig() {
60                  try {                  try {
61                            if(CC.isMacOS()) {
62                                    // fix for setting the menu bar on top of the screen
63                                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
64                                    nativeMenuPropsMap = getMenuProperties();
65                            }
66                          UIManager.setLookAndFeel(new SubstanceRavenGraphiteLookAndFeel());                          UIManager.setLookAndFeel(new SubstanceRavenGraphiteLookAndFeel());
67                          UIManager.put(SubstanceLookAndFeel.WATERMARK_VISIBLE, Boolean.FALSE);                          UIManager.put(SubstanceLookAndFeel.WATERMARK_VISIBLE, Boolean.FALSE);
68                                                    
# Line 59  public class ViewConfig extends JSViewCo Line 70  public class ViewConfig extends JSViewCo
70                                  SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND,                                  SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND,
71                                  SubstanceConstants.TabContentPaneBorderKind.SINGLE_FULL                                  SubstanceConstants.TabContentPaneBorderKind.SINGLE_FULL
72                          );                          );
73    
74                            if(CC.isMacOS()) {
75                                    // fix for setting the menu bar on top of the screen
76                                    menuPropsMap = getMenuProperties();
77                                    setNativeMenuProperties();
78                            }
79                                                    
80                          if(!preferences().getBoolProperty("TurnOffCustomWindowDecoration")) {                          if(!preferences().getBoolProperty("TurnOffCustomWindowDecoration")) {
81                                  javax.swing.JFrame.setDefaultLookAndFeelDecorated(true);                                  javax.swing.JFrame.setDefaultLookAndFeelDecorated(true);
# Line 70  public class ViewConfig extends JSViewCo Line 87  public class ViewConfig extends JSViewCo
87                          e.printStackTrace();                          e.printStackTrace();
88                  }                  }
89          }          }
90    
91            /**
92             * If running on Mac OS and third party LaF is used
93             * certain properties from the system LaF should be set
94             * to be able to move the menu bar on top of the screen.
95             */
96            public void
97            setNativeMenuProperties() {
98                    setMenuProperties(nativeMenuPropsMap);
99            }
100    
101            /**
102             * If running on Mac OS and third party LaF is used
103             * certain properties from the system LaF should be set
104             * to be able to move the menu bar on top of the screen.
105             * This method is used to reverse them back to the LaF to be used.
106             */
107            public void
108            restoreMenuProperties() {
109                    setMenuProperties(menuPropsMap);
110            }
111    
112            private void
113            setMenuProperties(Map props) {
114                    if(props == null) return;
115                    for(Object o : props.keySet()) UIManager.put(o, props.get(o));
116            }
117    
118            public Map
119            getMenuProperties() {
120                    Map props = new HashMap();
121                    props.put("MenuBarUI", UIManager.get("MenuBarUI"));
122                    props.put("MenuUI", UIManager.get("MenuUI"));
123                    props.put("MenuItemUI", UIManager.get("MenuItemUI"));
124                    props.put("CheckBoxMenuItemUI", UIManager.get("CheckBoxMenuItemUI"));
125                    props.put("RadioButtonMenuItemUI", UIManager.get("RadioButtonMenuItemUI"));
126                    props.put("PopupMenuUI", UIManager.get("PopupMenuUI"));
127                    return props;
128            }
129                    
130          @Override          @Override
131          public JSPrefs          public JSPrefs

Legend:
Removed from v.1863  
changed lines
  Added in v.1864

  ViewVC Help
Powered by ViewVC