Bug fixing new browser code
parent
c0e3553dd2
commit
3537008608
|
@ -1,5 +1,3 @@
|
||||||
- redefine generic as tuple constructor -- still appears generic
|
|
||||||
|
|
||||||
- remove F_USERENV rel
|
- remove F_USERENV rel
|
||||||
- update walker for new interpreter
|
- update walker for new interpreter
|
||||||
- quotations should store their originating word
|
- quotations should store their originating word
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
! Copyright (C) 2005, 2006 Kevin Reid.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: cocoa compiler gadgets gadgets-browser gadgets-launchpad
|
USING: cocoa compiler gadgets gadgets-browser gadgets-launchpad
|
||||||
gadgets-layouts gadgets-listener kernel memory objc
|
gadgets-layouts gadgets-listener kernel memory objc
|
||||||
objc-FactorCallback objc-NSApplication objc-NSMenu
|
objc-FactorCallback objc-NSApplication objc-NSMenu
|
||||||
|
@ -9,10 +11,11 @@ IN: gadgets-cocoa
|
||||||
|
|
||||||
GENERIC: to-target-and-action ( spec -- target action )
|
GENERIC: to-target-and-action ( spec -- target action )
|
||||||
|
|
||||||
M: f to-target-and-action f ;
|
M: f to-target-and-action f swap ;
|
||||||
M: string to-target-and-action sel_registerName f swap ;
|
M: string to-target-and-action sel_registerName f ;
|
||||||
M: word to-target-and-action
|
M: word to-target-and-action unit to-target-and-action ;
|
||||||
unit <FactorCallback> "perform:" sel_registerName ;
|
M: quotation to-target-and-action
|
||||||
|
<FactorCallback> "perform:" sel_registerName swap ;
|
||||||
|
|
||||||
: <NSMenu> ( title -- )
|
: <NSMenu> ( title -- )
|
||||||
NSMenu [alloc]
|
NSMenu [alloc]
|
||||||
|
@ -29,8 +32,8 @@ M: word to-target-and-action
|
||||||
r> <NSString>
|
r> <NSString>
|
||||||
[initWithTitle:action:keyEquivalent:] [autorelease] ;
|
[initWithTitle:action:keyEquivalent:] [autorelease] ;
|
||||||
|
|
||||||
: make-menu-item-2 ( title spec -- item )
|
: make-menu-item ( title spec -- item )
|
||||||
swap to-target-and-action swap >r swap <NSMenuItem> dup r> [setTarget:] ;
|
to-target-and-action >r swap <NSMenuItem> dup r> [setTarget:] ;
|
||||||
|
|
||||||
: submenu-to-item ( menu -- item )
|
: submenu-to-item ( menu -- item )
|
||||||
dup [title] CF>string f "" <NSMenuItem> dup rot [setSubmenu:] ;
|
dup [title] CF>string f "" <NSMenuItem> dup rot [setSubmenu:] ;
|
||||||
|
@ -62,7 +65,7 @@ DEFER: described-menu
|
||||||
drop NSMenuItem [separatorItem]
|
drop NSMenuItem [separatorItem]
|
||||||
] [
|
] [
|
||||||
dup first string? [
|
dup first string? [
|
||||||
[ first3 make-menu-item-2 ] keep
|
[ first3 swap make-menu-item ] keep
|
||||||
dup length 4 = [ fourth call ] [ drop ] if
|
dup length 4 = [ fourth call ] [ drop ] if
|
||||||
] [
|
] [
|
||||||
[ first described-menu ] keep
|
[ first described-menu ] keep
|
||||||
|
@ -105,10 +108,11 @@ DEFER: described-menu
|
||||||
} [ NSApp over [setAppleMenu:] ] }
|
} [ NSApp over [setAppleMenu:] ] }
|
||||||
{ {
|
{ {
|
||||||
"File"
|
"File"
|
||||||
{ "Listener" listener-window "n" }
|
{ "New Listener" listener-window "n" }
|
||||||
|
{ "New Browser" [ f browser-window ] "b" }
|
||||||
|
{ }
|
||||||
{ "Run..." menu-run-file "o" }
|
{ "Run..." menu-run-file "o" }
|
||||||
{ }
|
{ }
|
||||||
{ "Browser" browser-window "b" }
|
|
||||||
{ "Apropos" apropos-window "r" }
|
{ "Apropos" apropos-window "r" }
|
||||||
{ "Globals" globals-window "" }
|
{ "Globals" globals-window "" }
|
||||||
{ "Memory" memory-window "" }
|
{ "Memory" memory-window "" }
|
||||||
|
|
|
@ -108,7 +108,8 @@ C: browser ( -- browser )
|
||||||
{ 1/4 1/4 1/2 } over set-track-sizes ;
|
{ 1/4 1/4 1/2 } over set-track-sizes ;
|
||||||
|
|
||||||
: browser-window ( word -- )
|
: browser-window ( word -- )
|
||||||
<browser> [ "Browser" open-window ] keep show-word ;
|
<browser> [ "Browser" open-window ] keep
|
||||||
|
over [ show-word ] [ 2drop ] if ;
|
||||||
|
|
||||||
M: word show-object ( word button -- )
|
M: word show-object ( word button -- )
|
||||||
find-browser [ show-word ] [ browser-window ] if* ;
|
find-browser [ show-word ] [ browser-window ] if* ;
|
||||||
|
|
|
@ -13,7 +13,7 @@ help inspector io kernel memory namespaces sequences ;
|
||||||
>r make-pane <scroller> r> open-window ;
|
>r make-pane <scroller> r> open-window ;
|
||||||
|
|
||||||
: handbook-window ( -- )
|
: handbook-window ( -- )
|
||||||
T{ link f "handbook" } browser-window ;
|
T{ link f "handbook" } inspector-window ;
|
||||||
|
|
||||||
: memory-window ( -- )
|
: memory-window ( -- )
|
||||||
[ heap-stats. terpri room. ] "Memory" pane-window ;
|
[ heap-stats. terpri room. ] "Memory" pane-window ;
|
||||||
|
@ -32,7 +32,7 @@ help inspector io kernel memory namespaces sequences ;
|
||||||
{ "Listener" [ listener-window ] }
|
{ "Listener" [ listener-window ] }
|
||||||
{ "Documentation" [ handbook-window ] }
|
{ "Documentation" [ handbook-window ] }
|
||||||
{ "Help index" [ articles-window ] }
|
{ "Help index" [ articles-window ] }
|
||||||
{ "Browser" [ browser-window ] }
|
{ "Browser" [ f browser-window ] }
|
||||||
{ "Apropos" [ apropos-window ] }
|
{ "Apropos" [ apropos-window ] }
|
||||||
{ "Globals" [ globals-window ] }
|
{ "Globals" [ globals-window ] }
|
||||||
{ "Memory" [ memory-window ] }
|
{ "Memory" [ memory-window ] }
|
||||||
|
|
Loading…
Reference in New Issue