This class installs and updates ImageJ's menus. Note that menu labels, even in submenus, must be unique. This is because ImageJ uses a single hash table for all menu labels. If you look closely, you will see that File->Import->Text Image... and File->Save As->Text Image... do not use the same label.
| 51 | */ |
| 52 | |
| 53 | public class Menus { |
| 54 | |
| 55 | public static final char PLUGINS_MENU = 'p'; |
| 56 | public static final char IMPORT_MENU = 'i'; |
| 57 | public static final char SAVE_AS_MENU = 's'; |
| 58 | public static final char SHORTCUTS_MENU = 'h'; // 'h'=hotkey |
| 59 | public static final char ABOUT_MENU = 'a'; |
| 60 | public static final char FILTERS_MENU = 'f'; |
| 61 | public static final char TOOLS_MENU = 't'; |
| 62 | public static final char UTILITIES_MENU = 'u'; |
| 63 | |
| 64 | public static final int WINDOW_MENU_ITEMS = 6; // fixed items at top of Window menu |
| 65 | |
| 66 | public static final int NORMAL_RETURN = 0; |
| 67 | public static final int COMMAND_IN_USE = -1; |
| 68 | public static final int INVALID_SHORTCUT = -2; |
| 69 | public static final int SHORTCUT_IN_USE = -3; |
| 70 | public static final int NOT_INSTALLED = -4; |
| 71 | public static final int COMMAND_NOT_FOUND = -5; |
| 72 | |
| 73 | public static final int MAX_OPEN_RECENT_ITEMS = 15; |
| 74 | |
| 75 | private static Menus instance; |
| 76 | private static MenuBar mbar; |
| 77 | private static CheckboxMenuItem gray8Item,gray16Item,gray32Item, |
| 78 | color256Item,colorRGBItem,RGBStackItem,HSBStackItem,LabStackItem,HSB32Item; |
| 79 | private static PopupMenu popup; |
| 80 | |
| 81 | private static ImageJ ij; |
| 82 | private static Applet applet; |
| 83 | private Hashtable demoImagesTable = new Hashtable(); |
| 84 | private static String ImageJPath, pluginsPath, macrosPath; |
| 85 | private static Properties menus; |
| 86 | private static Properties menuSeparators; |
| 87 | private static Menu pluginsMenu, saveAsMenu, shortcutsMenu, utilitiesMenu, macrosMenu; |
| 88 | static Menu window, openRecentMenu; |
| 89 | private static Hashtable pluginsTable; |
| 90 | |
| 91 | private static int nPlugins, nMacros; |
| 92 | private static Hashtable shortcuts; |
| 93 | private static Hashtable macroShortcuts; |
| 94 | private static Vector pluginsPrefs; // commands saved in IJ_Prefs |
| 95 | static int windowMenuItems2; // non-image windows listed in Window menu + separator |
| 96 | private String error; |
| 97 | private String jarError; |
| 98 | private String pluginError; |
| 99 | private boolean isJarErrorHeading; |
| 100 | private static boolean installingJars, duplicateCommand; |
| 101 | private static Vector jarFiles; // JAR files in plugins folder with "_" in their name |
| 102 | private Map menuEntry2jarFile = new HashMap(); |
| 103 | private static Vector macroFiles; // Macros and scripts in the plugins folder |
| 104 | private static int userPluginsIndex; // First user plugin or submenu in Plugins menu |
| 105 | private static boolean addSorted; |
| 106 | private static int defaultFontSize = IJ.isWindows()?15:0; |
| 107 | private static int fontSize; |
| 108 | private static double scale = 1.0; |
| 109 | private static Font cachedFont; |
| 110 |