From: Giovanni Mascellani Subject: [PATCH] patch/no_mac Removes Mac OS X specific code. Signed-off-by: Giovanni Mascellani --- geogebra/gui/app/GeoGebraFrame.java | 23 +------ geogebra/gui/app/MacApplicationListener.java | 100 -------------------------- 2 files changed, 1 insertions(+), 122 deletions(-) diff --git a/geogebra/gui/app/GeoGebraFrame.java b/geogebra/gui/app/GeoGebraFrame.java index 87f02b5..809932e 100644 --- a/geogebra/gui/app/GeoGebraFrame.java +++ b/geogebra/gui/app/GeoGebraFrame.java @@ -250,9 +250,6 @@ public class GeoGebraFrame extends JFrame implements WindowFocusListener return; } - if (Application.MAC_OS) - initMacSpecifics(); - // set system look and feel try { if (Application.MAC_OS || Application.WINDOWS) @@ -277,24 +274,6 @@ public class GeoGebraFrame extends JFrame implements WindowFocusListener return activeInstance; } - /** - * MacOS X specific initing. Note: this method can only be run - * on a Mac! - */ - public static void initMacSpecifics() { - try { - // init mac application listener - MacApplicationListener.initMacApplicationListener(); - - //mac menu bar - //System.setProperty("com.apple.macos.useScreenMenuBar", "true"); - System.setProperty("apple.laf.useScreenMenuBar", "true"); - } catch (Exception e) { - Application.debug(e+""); - } - } - - //public abstract GeoGebra buildGeoGebra(); public static synchronized GeoGebraFrame createNewWindow(String[] args) { @@ -391,4 +370,4 @@ public class GeoGebraFrame extends JFrame implements WindowFocusListener -} \ No newline at end of file +} diff --git a/geogebra/gui/app/MacApplicationListener.java b/geogebra/gui/app/MacApplicationListener.java deleted file mode 100644 index c4d696f..0000000 --- a/geogebra/gui/app/MacApplicationListener.java +++ /dev/null @@ -1,100 +0,0 @@ -package geogebra.gui.app; - -import geogebra.main.Application; - -import java.io.File; - -public class MacApplicationListener implements com.apple.eawt.ApplicationListener { - - public static void initMacApplicationListener() { - com.apple.eawt.Application app = new com.apple.eawt.Application(); - app.addApplicationListener(new MacApplicationListener()); - } - - /** - * Gets active instance of GeoGebra window. This method waits - * until an active instance was created by GeoGebra.main() - * @return - */ - private synchronized GeoGebraFrame getGGBInstance() { - GeoGebraFrame wnd = null; - while (wnd == null) { - try { - Thread.sleep(100); - wnd = GeoGebraFrame.getActiveInstance(); - } catch (Exception e) { - Application.debug("MacApplicationListener.getGGBInstance(): " + e.getMessage()); - wnd = null; - } - } - return wnd; - } - - public synchronized void handleQuit(com.apple.eawt.ApplicationEvent ev) { - // quit all frames - Application app = getGGBInstance().getApplication(); - app.exitAll(); - } - - public synchronized void handleAbout(com.apple.eawt.ApplicationEvent event) { - event.setHandled(true); - Application app = getGGBInstance().getApplication(); - app.getGuiManager().showAboutDialog(); - } - - public synchronized void handleOpenFile(com.apple.eawt.ApplicationEvent ev) { - Application.debug("handleOpenFile event, filename: " + ev.getFilename()); - - // open file - String fileName = ev.getFilename(); - - if (fileName != null) { - File openFile = new File(fileName); - if (openFile.exists()) { - // get application instance - GeoGebraFrame ggb = getGGBInstance(); - Application app = ggb.getApplication(); - - // open file - File [] files = { openFile }; - boolean openInThisWindow = app.getCurrentFile() == null; - app.getGuiManager().doOpenFiles(files, openInThisWindow); - - // make sure window is visible - if (openInThisWindow) - ggb.setVisible(true); - } - } - } - - public synchronized void handlePrintFile(com.apple.eawt.ApplicationEvent event) { - Application.debug("handlePrintFile event, filename: " + event.getFilename()); - - handleOpenFile(event); - getGGBInstance().getApplication().getGuiManager().showPrintPreview(); - } - - public synchronized void handleOpenApplication(com.apple.eawt.ApplicationEvent ev) { - Application.debug("handleOpenApplication event, filename: " + ev.getFilename()); - - // open file - String fileName = ev.getFilename(); - if (fileName != null) { - handleOpenFile(ev); - } else { - GeoGebraFrame wnd = getGGBInstance(); - if (!wnd.isShowing()) - wnd.setVisible(true); - } - } - - public synchronized void handlePreferences(com.apple.eawt.ApplicationEvent arg0) { - Application.debug("handlePreferences event, filename: " + arg0.getFilename()); - } - - public synchronized void handleReOpenApplication(com.apple.eawt.ApplicationEvent arg0) { - Application.debug("handleReOpenApplication event, filename: " + arg0.getFilename()); - } - - -} -- tg: (6d6be1c..) patch/no_mac (depends on: master)