Interface builder menu bar not works

slava 2006-10-14 02:49:14 +00:00
parent 45bf4f0bb9
commit 341caf245c
11 changed files with 54 additions and 18 deletions

View 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;
}

View 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>

View 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)

View File

@ -3,8 +3,8 @@
IN: objc-classes
DEFER: FactorCallback
IN: cocoa
USING: gadgets hashtables kernel namespaces objc ;
IN: cocoa-callbacks
USING: gadgets hashtables kernel namespaces objc cocoa ;
SYMBOL: callbacks
@ -29,4 +29,6 @@ reset-callbacks
: <FactorCallback> ( quot -- id )
FactorCallback -> alloc -> init
[ callbacks get set-hash ] keep ;
[ callbacks get set-hash ] keep ;
PROVIDE: callbacks ;

View 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

View File

@ -82,6 +82,12 @@ SYMBOL: parse-hook
: run-file ( file -- ) parse-file call ;
: run-files ( seq -- )
[
bootstrapping? get
[ parse-file % ] [ run-file ] ? each
] no-parse-hook ;
: no-parse-hook ( quot -- )
[ parse-hook off call ] with-scope ; inline

View 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"

View 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 ;

View 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 -- )

View 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