(final Base base, String path, final EditorState state,
final Mode mode)
| 157 | |
| 158 | |
| 159 | protected Editor(final Base base, String path, final EditorState state, |
| 160 | final Mode mode) throws EditorException { |
| 161 | super("Processing", state.checkConfig()); |
| 162 | this.base = base; |
| 163 | this.state = state; |
| 164 | this.mode = mode; |
| 165 | |
| 166 | // Make sure Base.getActiveEditor() never returns null |
| 167 | base.checkFirstEditor(this); |
| 168 | |
| 169 | // This is a Processing window. Get rid of that ugly ass coffee cup. |
| 170 | Toolkit.setIcon(this); |
| 171 | |
| 172 | // add listener to handle window close box hit event |
| 173 | addWindowListener(new WindowAdapter() { |
| 174 | public void windowClosing(WindowEvent e) { |
| 175 | base.handleClose(Editor.this, false); |
| 176 | } |
| 177 | }); |
| 178 | // don't close the window when clicked, the app will take care |
| 179 | // of that via the handleQuitInternal() methods |
| 180 | // http://dev.processing.org/bugs/show_bug.cgi?id=440 |
| 181 | setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
| 182 | |
| 183 | // When bringing a window to front, let the Base know |
| 184 | addWindowListener(new WindowAdapter() { |
| 185 | |
| 186 | public void windowActivated(WindowEvent e) { |
| 187 | base.handleActivated(Editor.this); |
| 188 | fileMenu.insert(Recent.getMenu(), 2); |
| 189 | Toolkit.setMenuMnemsInside(fileMenu); |
| 190 | |
| 191 | mode.insertImportMenu(sketchMenu); |
| 192 | Toolkit.setMenuMnemsInside(sketchMenu); |
| 193 | mode.insertToolbarRecentMenu(); |
| 194 | } |
| 195 | |
| 196 | public void windowDeactivated(WindowEvent e) { |
| 197 | // TODO call handleActivated(null)? or do we run the risk of the |
| 198 | // deactivate call for old window being called after the activate? |
| 199 | fileMenu.remove(Recent.getMenu()); |
| 200 | mode.removeImportMenu(sketchMenu); |
| 201 | mode.removeToolbarRecentMenu(); |
| 202 | } |
| 203 | }); |
| 204 | |
| 205 | timer = new Timer(); |
| 206 | |
| 207 | buildMenuBar(); |
| 208 | |
| 209 | /* |
| 210 | //backgroundGradient = Toolkit.getLibImage("vertical-gradient.png"); |
| 211 | backgroundGradient = mode.getGradient("editor", 400, 400); |
| 212 | JPanel contentPain = new JPanel() { |
| 213 | @Override |
| 214 | public void paintComponent(Graphics g) { |
| 215 | // super.paintComponent(g); |
| 216 | Dimension dim = getSize(); |
nothing calls this directly
no test coverage detected