]> gitweb.factorcode.org Git - factor.git/commitdiff
Interface builder menu bar not works
authorslava <slava@factorcode.org>
Sat, 14 Oct 2006 02:49:14 +0000 (02:49 +0000)
committerslava <slava@factorcode.org>
Sat, 14 Oct 2006 02:49:14 +0000 (02:49 +0000)
12 files changed:
Factor.app/Contents/Resources/English.lproj/Factor.nib/classes.nib
Factor.app/Contents/Resources/English.lproj/Factor.nib/info.nib
Factor.app/Contents/Resources/English.lproj/Factor.nib/keyedobjects.nib
contrib/README.txt
contrib/cocoa-callbacks.factor [new file with mode: 0644]
library/modules.factor
library/syntax/parse-stream.factor
library/ui/cocoa/callback.factor [deleted file]
library/ui/cocoa/load.factor
library/ui/cocoa/ui.factor
library/ui/tools/listener.factor
vm/Config.macosx

index b9b4b09f6b0d4e35bcaea7125d83273d98cf12dd..bf3d2a65608e45f465b0ee815204720924a36609 100644 (file)
@@ -1,4 +1,17 @@
 {
-    IBClasses = ({CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }); 
+    IBClasses = (
+        {
+            ACTIONS = {
+                newFactorWorkspace = id; 
+                runFactorFile = id; 
+                saveFactorImage = id; 
+                saveFactorImageAs = id; 
+                showFactorHelp = id; 
+            }; 
+            CLASS = FirstResponder; 
+            LANGUAGE = ObjC; 
+            SUPERCLASS = NSObject; 
+        }
+    ); 
     IBVersion = 1; 
 }
\ No newline at end of file
index bcc1ea3254de5d41fd3d1c456b1cd988c182de52..68d7cbf92554c93b0b52229ee421d9ce8dc20df1 100644 (file)
@@ -3,11 +3,11 @@
 <plist version="1.0">
 <dict>
        <key>IBDocumentLocation</key>
-       <string>1622 173 356 240 0 0 2560 1578 </string>
+       <string>1207 49 525 491 0 0 2560 1578 </string>
        <key>IBEditorPositions</key>
        <dict>
                <key>29</key>
-               <string>524 461 270 44 0 0 2560 1578 </string>
+               <string>1771 315 420 44 0 0 2560 1578 </string>
        </dict>
        <key>IBFramework Version</key>
        <string>439.0</string>
index ea37efcd1784ed0251f1ee6e1fe6b386ae176521..a51fdd87814a2d97f698d22bccdfe660a16f3574 100644 (file)
Binary files a/Factor.app/Contents/Resources/English.lproj/Factor.nib/keyedobjects.nib and b/Factor.app/Contents/Resources/English.lproj/Factor.nib/keyedobjects.nib differ
index 92dfa1dba1bda297dfd463fed0385baf524cb60a..c372d72f492001393fc70c4e31981e3fb0b7e9f5 100644 (file)
@@ -14,6 +14,7 @@ Available libraries:
 - boids -- Graphics demo for the UI (Eduardo Cavazos)
 - cairo -- cairo bindings (Sampo Vuori)
 - calendar -- timestamp/calendar with timezones (Doug Coleman)
+- cocoa-callbacks -- Allows you to use Factor quotations as actions (Slava Pestov)
 - concurrency -- Erlang/Termite-style distibuted concurrency (Chris Double)
 - coroutines -- coroutines (Chris Double)
 - crypto -- Various cryptographic algorithms (Doug Coleman)
diff --git a/contrib/cocoa-callbacks.factor b/contrib/cocoa-callbacks.factor
new file mode 100644 (file)
index 0000000..e4aa8c0
--- /dev/null
@@ -0,0 +1,34 @@
+! Copyright (C) 2005, 2006 Kevin Reid.
+! See http://factorcode.org/license.txt for BSD license.
+IN: objc-classes
+DEFER: FactorCallback
+
+IN: cocoa-callbacks
+USING: gadgets hashtables kernel namespaces objc cocoa ;
+
+SYMBOL: callbacks
+
+: reset-callbacks ( -- )
+    H{ } clone callbacks set-global ;
+
+reset-callbacks
+
+"NSObject" "FactorCallback" {
+    { "perform:" "void" { "id" "SEL" "id" }
+        [ 2drop callbacks get hash ui-try ]
+    }
+    
+    { "dealloc" "void" { "id" "SEL" }
+        [
+            drop
+            dup callbacks get remove-hash
+            SUPER-> dealloc
+        ]
+    }
+} define-objc-class
+
+: <FactorCallback> ( quot -- id )
+    FactorCallback -> alloc -> init
+    [ callbacks get set-hash ] keep ;
+
+PROVIDE: callbacks ;
index 99569de7879e71df6774cde28d5a4daf92aef147..78361b91544285313f70a2b8473e3e1dcfd8528c 100644 (file)
@@ -35,12 +35,6 @@ C: module ( name files tests -- module )
 : require ( name -- )
     dup module [ drop ] [ load-module ] if do-parse-hook ;
 
-: run-files ( seq -- )
-    [
-        bootstrapping? get
-        [ parse-file % ] [ run-file ] ? each
-    ] no-parse-hook ;
-
 : process-files ( seq -- newseq )
     [ dup string? [ [ t ] 2array ] when ] map
     [ second call ] subset
index 4ec43ef586bcf11c75e82bcb726f3c7a6b0b7d57..4cc00f900351f907146357b9079ec1f0047f09dd 100644 (file)
@@ -82,6 +82,12 @@ SYMBOL: parse-hook
 \r
 : run-file ( file -- ) parse-file call ;\r
 \r
+: run-files ( seq -- )\r
+    [\r
+        bootstrapping? get\r
+        [ parse-file % ] [ run-file ] ? each\r
+    ] no-parse-hook ;\r
+\r
 : no-parse-hook ( quot -- )\r
     [ parse-hook off call ] with-scope ; inline\r
 \r
diff --git a/library/ui/cocoa/callback.factor b/library/ui/cocoa/callback.factor
deleted file mode 100644 (file)
index 0e1e126..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-! Copyright (C) 2005, 2006 Kevin Reid.
-! See http://factorcode.org/license.txt for BSD license.
-IN: objc-classes
-DEFER: FactorCallback
-
-IN: cocoa
-USING: gadgets hashtables kernel namespaces objc ;
-
-SYMBOL: callbacks
-
-: reset-callbacks ( -- )
-    H{ } clone callbacks set-global ;
-
-reset-callbacks
-
-"NSObject" "FactorCallback" {
-    { "perform:" "void" { "id" "SEL" "id" }
-        [ 2drop callbacks get hash ui-try ]
-    }
-    
-    { "dealloc" "void" { "id" "SEL" }
-        [
-            drop
-            dup callbacks get remove-hash
-            SUPER-> dealloc
-        ]
-    }
-} define-objc-class
-
-: <FactorCallback> ( quot -- id )
-    FactorCallback -> alloc -> init
-    [ callbacks get set-hash ] keep ;
\ No newline at end of file
index 73c470f2f5a49092a52730e0cf9f5df133476b2b..898e2331d79a82a35373d8eeae9c4396321cdb96 100644 (file)
@@ -6,7 +6,6 @@ PROVIDE: library/ui/cocoa {
     "core-foundation.factor"
     "types.factor"
     "init-cocoa.factor"
-    "callback.factor"
     "application-utils.factor"
     "pasteboard-utils.factor"
     "view-utils.factor"
index 0b06024e6d5f449eca71967b4ad6b54f59866d91..626006a41936e519434931a7460080dc600f1354 100644 (file)
@@ -4,8 +4,9 @@ IN: objc-classes
 DEFER: FactorApplicationDelegate
 
 IN: cocoa
-USING: arrays gadgets gadgets-listener gadgets-workspace
-hashtables kernel memory namespaces objc sequences errors freetype ;
+USING: arrays gadgets gadgets-listener gadgets-help
+gadgets-workspace hashtables kernel memory namespaces objc
+sequences errors freetype help ;
 
 : finder-run-files ( alien -- )
     #! We filter out the image name since that might be there on
@@ -14,18 +15,38 @@ hashtables kernel memory namespaces objc sequences errors freetype ;
     NSApp NSApplicationDelegateReplySuccess
     -> replyToOpenOrPrint: ;
 
+: menu-run-files ( -- )
+    open-panel [ listener-run-files ] when* ;
+
 ! Handle Open events from the Finder
 "NSObject" "FactorApplicationDelegate" {
     { "application:openFiles:" "void" { "id" "SEL" "id" "id" }
         [ >r 3drop r> finder-run-files ]
     }
+
+    { "runFactorFile:" "id" { "id" "SEL" "id" }
+        [ 3drop menu-run-files f ]
+    }
+
+    { "newFactorWorkspace:" "id" { "id" "SEL" "id" }
+        [ 3drop workspace-window f ]
+    }
+
+    { "showFactorHelp:" "id" { "id" "SEL" "id" }
+        [ 3drop "handbook" <link> help-gadget call-tool f ]
+    }
 } define-objc-class
 
 : install-app-delegate ( -- )
     NSApp FactorApplicationDelegate install-delegate ;
 
+: load-nib ( -- )
+    NSBundle
+    "Factor.nib" <NSString> NSApp -> loadNibNamed:owner:
+    drop ;
+
 : init-cocoa ( -- )
-    reset-callbacks
+    load-nib
     install-app-delegate
     register-services
     init-clipboard ;
index ba6fbdc5e9429f27391027d9724410e2e0ea58ce..f35189d5d7c980e699075377d1e86e8525647cf5 100644 (file)
@@ -89,7 +89,7 @@ M: listener-gadget tool-help
     dup empty? [
         drop
     ] [
-        [ [ run-file ] each ] curry call-listener
+        [ run-files ] curry call-listener
     ] if ;
 
 : listener-eof ( listener -- )
index de71d178cfdfca661efb93956fecb7a3040243e5..8e35a3a06a318bf526f3cfb5bf9df6546dc9facb 100644 (file)
@@ -1,3 +1,3 @@
 include vm/Config.unix
 PLAF_OBJS += vm/os-macosx.o vm/mach_signal.o
-LIBS= -lm -framework Cocoa -framework OpenGL -L/usr/X11R6/lib -lfreetype
+LIBS= -lm -framework Cocoa -framework OpenGL -framework AppKit -L/usr/X11R6/lib -lfreetype