macosx: Respond to apple messages in all apps
authorKeith Packard <keithp@keithp.com>
Wed, 18 Jun 2014 23:18:05 +0000 (16:18 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 18 Jun 2014 23:18:05 +0000 (16:18 -0700)
This connects the callbacks in AltosUIFrame to actually do something
useful with them.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosUI.java
micropeak/MicroPeak.java
telegps/TeleGPS.java

index 1eb038055af1c23e219d53c282c47dfc4e611c9c..0aa5d03ce142ef1a420b2c45d4d581b9654ac829 100644 (file)
@@ -99,10 +99,25 @@ public class AltosUI extends AltosUIFrame {
                return b;
        }
 
                return b;
        }
 
+       /* OSXAdapter interfaces */
+       public void macosx_file_handler(String path) {
+               process_graph(new File(path));
+       }
+
+       public void macosx_quit_handler() {
+               System.exit(0);
+       }
+
+       public void macosx_preferences_handler() {
+               ConfigureAltosUI();
+       }
+
        public AltosUI() {
 
                load_library(null);
 
        public AltosUI() {
 
                load_library(null);
 
+               register_for_macosx_events();
+
                AltosUIPreferences.set_component(this);
 
                pane = getContentPane();
                AltosUIPreferences.set_component(this);
 
                pane = getContentPane();
index d7d393ba123fefe24ff874333ba6b0c5bd503767..8bdf4b775fc0d08b457348053e775267f777a984 100644 (file)
@@ -190,10 +190,25 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene
        public void itemStateChanged(ItemEvent e) {
        }
 
        public void itemStateChanged(ItemEvent e) {
        }
 
+       /* OSXAdapter interfaces */
+       public void macosx_file_handler(String path) {
+               CommandGraph(new File(path));
+       }
+
+       public void macosx_quit_handler() {
+               System.exit(0);
+       }
+
+       public void macosx_preferences_handler() {
+               Preferences();
+       }
+
        public MicroPeak() {
 
                ++number_of_windows;
 
        public MicroPeak() {
 
                ++number_of_windows;
 
+               register_for_macosx_events();
+
                AltosUIPreferences.set_component(this);
 
                container = getContentPane();
                AltosUIPreferences.set_component(this);
 
                container = getContentPane();
index f765ee23e0d1a616917496abb8ec35de57e24cf2..e78c2124ab5142102b7a6da44fc55e49b720dc19 100644 (file)
@@ -410,16 +410,38 @@ public class TeleGPS
 
        private JMenu make_menu(String label, String[][] items) {
                JMenu   menu = new JMenu(label);
 
        private JMenu make_menu(String label, String[][] items) {
                JMenu   menu = new JMenu(label);
-               for (int i = 0; i < items.length; i++)
+               for (int i = 0; i < items.length; i++) {
+                       if (MAC_OS_X) {
+                               if (items[i][1].equals("exit"))
+                                       continue;
+                               if (items[i][1].equals("preferences"))
+                                       continue;
+                       }
                        add_menu(menu, items[i][0], items[i][1]);
                        add_menu(menu, items[i][0], items[i][1]);
+               }
                menu_bar.add(menu);
                return menu;
        }
 
                menu_bar.add(menu);
                return menu;
        }
 
+       /* OSXAdapter interfaces */
+       public void macosx_file_handler(String path) {
+               process_graph(new File(path));
+       }
+
+       public void macosx_quit_handler() {
+               System.exit(0);
+       }
+
+       public void macosx_preferences_handler() {
+               preferences();
+       }
+
        public TeleGPS() {
 
                AltosUIPreferences.set_component(this);
 
        public TeleGPS() {
 
                AltosUIPreferences.set_component(this);
 
+               register_for_macosx_events();
+
                reader = null;
 
                bag = getContentPane();
                reader = null;
 
                bag = getContentPane();