2009-01-06 17:53:08 -05:00
|
|
|
! Copyright (C) 2006, 2009 Slava Pestov.
|
2007-09-20 18:09:08 -04:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
|
|
|
USING: continuations definitions ui.tools.browser
|
2009-01-07 16:06:43 -05:00
|
|
|
ui.tools.listener ui.tools.profiler
|
2009-01-07 16:21:51 -05:00
|
|
|
ui.tools.inspector ui.tools.traceback
|
2009-01-07 16:06:43 -05:00
|
|
|
generic help.topics stack-checker
|
2009-01-06 17:53:08 -05:00
|
|
|
summary io.pathnames io.styles kernel namespaces parser
|
|
|
|
prettyprint quotations tools.annotations editors
|
|
|
|
tools.profiler tools.test tools.time tools.walker
|
|
|
|
ui.commands ui.gadgets.editors ui.gestures
|
2008-08-12 04:31:48 -04:00
|
|
|
ui.operations ui.tools.deploy vocabs vocabs.loader words
|
2008-12-17 19:10:01 -05:00
|
|
|
sequences tools.vocabs classes compiler.units accessors
|
|
|
|
vocabs.parser ;
|
2007-09-20 18:09:08 -04:00
|
|
|
IN: ui.tools.operations
|
|
|
|
|
|
|
|
V{ } clone operations set-global
|
|
|
|
|
|
|
|
! Objects
|
2009-01-07 00:30:08 -05:00
|
|
|
[ drop t ] \ inspector H{
|
2007-09-20 18:09:08 -04:00
|
|
|
{ +primary+ t }
|
|
|
|
} define-operation
|
|
|
|
|
2008-06-08 16:32:55 -04:00
|
|
|
: com-prettyprint ( obj -- ) . ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
[ drop t ] \ com-prettyprint H{
|
|
|
|
{ +listener+ t }
|
|
|
|
} define-operation
|
|
|
|
|
2008-06-08 16:32:55 -04:00
|
|
|
: com-push ( obj -- obj ) ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
[ drop t ] \ com-push H{
|
|
|
|
{ +listener+ t }
|
|
|
|
} define-operation
|
|
|
|
|
2008-06-08 16:32:55 -04:00
|
|
|
: com-unparse ( obj -- ) unparse listener-input ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
[ drop t ] \ com-unparse H{ } define-operation
|
|
|
|
|
|
|
|
! Input
|
|
|
|
|
2008-06-08 16:32:55 -04:00
|
|
|
: com-input ( obj -- ) string>> listener-input ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
[ input? ] \ com-input H{
|
|
|
|
{ +primary+ t }
|
|
|
|
{ +secondary+ t }
|
|
|
|
} define-operation
|
|
|
|
|
|
|
|
! Restart
|
|
|
|
[ restart? ] \ restart H{
|
|
|
|
{ +primary+ t }
|
|
|
|
{ +secondary+ t }
|
|
|
|
{ +listener+ t }
|
|
|
|
} define-operation
|
|
|
|
|
|
|
|
! Continuation
|
|
|
|
[ continuation? ] \ traceback-window H{
|
|
|
|
{ +primary+ t }
|
|
|
|
{ +secondary+ t }
|
|
|
|
} define-operation
|
|
|
|
|
|
|
|
! Pathnames
|
2008-06-08 16:32:55 -04:00
|
|
|
: edit-file ( pathname -- ) edit ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
[ pathname? ] \ edit-file H{
|
2009-01-08 19:56:39 -05:00
|
|
|
{ +keyboard+ T{ key-down f { C+ } "e" } }
|
2007-09-20 18:09:08 -04:00
|
|
|
{ +primary+ t }
|
|
|
|
{ +secondary+ t }
|
2007-11-25 04:33:46 -05:00
|
|
|
{ +listener+ t }
|
2007-09-20 18:09:08 -04:00
|
|
|
} define-operation
|
|
|
|
|
2007-12-21 21:18:24 -05:00
|
|
|
UNION: definition word method-spec link vocab vocab-link ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2007-12-21 21:18:24 -05:00
|
|
|
[ definition? ] \ edit H{
|
2009-01-08 19:56:39 -05:00
|
|
|
{ +keyboard+ T{ key-down f { C+ } "e" } }
|
2007-11-25 04:33:46 -05:00
|
|
|
{ +listener+ t }
|
2007-09-20 18:09:08 -04:00
|
|
|
} define-operation
|
|
|
|
|
2007-12-24 17:32:41 -05:00
|
|
|
: com-forget ( defspec -- )
|
|
|
|
[ forget ] with-compilation-unit ;
|
|
|
|
|
|
|
|
[ definition? ] \ com-forget H{ } define-operation
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
! Words
|
|
|
|
[ word? ] \ insert-word H{
|
|
|
|
{ +secondary+ t }
|
|
|
|
} define-operation
|
|
|
|
|
2008-03-12 20:55:06 -04:00
|
|
|
[ topic? ] \ com-follow H{
|
2009-01-08 19:56:39 -05:00
|
|
|
{ +keyboard+ T{ key-down f { C+ } "h" } }
|
2007-09-20 18:09:08 -04:00
|
|
|
{ +primary+ t }
|
|
|
|
} define-operation
|
|
|
|
|
2009-01-07 16:06:43 -05:00
|
|
|
! : com-usage ( word -- )
|
|
|
|
! get-workspace swap show-word-usage ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2009-01-07 16:06:43 -05:00
|
|
|
! [ word? ] \ com-usage H{
|
|
|
|
! { +keyboard+ T{ key-down f { C+ } "U" } }
|
|
|
|
! } define-operation
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
[ word? ] \ fix H{
|
2009-01-08 19:56:39 -05:00
|
|
|
{ +keyboard+ T{ key-down f { C+ } "f" } }
|
2007-09-20 18:09:08 -04:00
|
|
|
{ +listener+ t }
|
|
|
|
} define-operation
|
|
|
|
|
|
|
|
[ word? ] \ watch H{ } define-operation
|
|
|
|
|
|
|
|
[ word? ] \ breakpoint H{ } define-operation
|
|
|
|
|
|
|
|
GENERIC: com-stack-effect ( obj -- )
|
|
|
|
|
|
|
|
M: quotation com-stack-effect infer. ;
|
|
|
|
|
2008-06-28 03:36:20 -04:00
|
|
|
M: word com-stack-effect def>> com-stack-effect ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2008-01-02 19:36:36 -05:00
|
|
|
[ word? ] \ com-stack-effect H{
|
2007-09-20 18:09:08 -04:00
|
|
|
{ +listener+ t }
|
|
|
|
} define-operation
|
|
|
|
|
|
|
|
! Vocabularies
|
2009-01-07 16:06:43 -05:00
|
|
|
! : com-vocab-words ( vocab -- )
|
|
|
|
! get-workspace swap show-vocab-words ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2009-01-07 16:06:43 -05:00
|
|
|
! [ vocab? ] \ com-vocab-words H{
|
|
|
|
! { +secondary+ t }
|
|
|
|
! { +keyboard+ T{ key-down f { C+ } "B" } }
|
|
|
|
! } define-operation
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2008-06-08 16:32:55 -04:00
|
|
|
: com-enter-in ( vocab -- ) vocab-name set-in ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
[ vocab? ] \ com-enter-in H{
|
2009-01-08 19:56:39 -05:00
|
|
|
{ +keyboard+ T{ key-down f { C+ } "i" } }
|
2007-09-20 18:09:08 -04:00
|
|
|
{ +listener+ t }
|
|
|
|
} define-operation
|
|
|
|
|
2008-06-08 16:32:55 -04:00
|
|
|
: com-use-vocab ( vocab -- ) vocab-name use+ ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
[ vocab-spec? ] \ com-use-vocab H{
|
|
|
|
{ +secondary+ t }
|
|
|
|
{ +listener+ t }
|
|
|
|
} define-operation
|
|
|
|
|
|
|
|
[ vocab-spec? ] \ run H{
|
2009-01-08 19:56:39 -05:00
|
|
|
{ +keyboard+ T{ key-down f { C+ } "r" } }
|
2007-09-20 18:09:08 -04:00
|
|
|
{ +listener+ t }
|
|
|
|
} define-operation
|
|
|
|
|
|
|
|
[ vocab? ] \ test H{
|
2009-01-08 19:56:39 -05:00
|
|
|
{ +keyboard+ T{ key-down f { C+ } "t" } }
|
2007-09-20 18:09:08 -04:00
|
|
|
{ +listener+ t }
|
|
|
|
} define-operation
|
|
|
|
|
2007-11-05 00:46:03 -05:00
|
|
|
[ vocab-spec? ] \ deploy-tool H{ } define-operation
|
|
|
|
|
2007-09-20 18:09:08 -04:00
|
|
|
! Quotations
|
|
|
|
[ quotation? ] \ com-stack-effect H{
|
|
|
|
{ +keyboard+ T{ key-down f { C+ } "i" } }
|
|
|
|
{ +listener+ t }
|
|
|
|
} define-operation
|
|
|
|
|
|
|
|
[ quotation? ] \ walk H{
|
|
|
|
{ +keyboard+ T{ key-down f { C+ } "w" } }
|
|
|
|
{ +listener+ t }
|
|
|
|
} define-operation
|
|
|
|
|
|
|
|
[ quotation? ] \ time H{
|
|
|
|
{ +keyboard+ T{ key-down f { C+ } "t" } }
|
|
|
|
{ +listener+ t }
|
|
|
|
} define-operation
|
|
|
|
|
2009-01-03 19:58:43 -05:00
|
|
|
: com-profile ( quot -- ) profile profiler-window ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
[ quotation? ] \ com-profile H{
|
|
|
|
{ +keyboard+ T{ key-down f { C+ } "r" } }
|
|
|
|
{ +listener+ t }
|
|
|
|
} define-operation
|
|
|
|
|
2009-01-15 02:33:35 -05:00
|
|
|
USE: ui.gadgets.tables
|
|
|
|
|
2007-09-20 18:09:08 -04:00
|
|
|
! Operations -> commands
|
|
|
|
source-editor
|
|
|
|
"word"
|
|
|
|
"These commands operate on the Factor word named by the token at the caret position."
|
|
|
|
\ selected-word
|
2009-01-15 14:02:31 -05:00
|
|
|
[ selected-word ]
|
2007-09-20 18:09:08 -04:00
|
|
|
define-operation-map
|
|
|
|
|
|
|
|
interactor
|
|
|
|
"quotation"
|
|
|
|
"These commands operate on the entire contents of the input area."
|
|
|
|
[ ]
|
2009-01-15 16:22:25 -05:00
|
|
|
[ quot-action [ parse-lines ] with-compilation-unit ]
|
2007-09-20 18:09:08 -04:00
|
|
|
define-operation-map
|