Add common tool commands: F2, A+l, A+L, A+b, A+B
parent
632b21159d
commit
2fd234ac62
basis/ui/tools
browser
common
inspector
listener
operations
profiler
walker
|
@ -9,9 +9,9 @@ ui.gadgets.editors ui.gadgets.labels ui.gadgets.status-bar
|
|||
ui.tools.common ui ;
|
||||
IN: ui.tools.browser
|
||||
|
||||
TUPLE: browser-gadget < track pane scroller search-field ;
|
||||
TUPLE: browser-gadget < tool pane scroller search-field ;
|
||||
|
||||
TOOL: browser-gadget { 550 400 }
|
||||
{ 550 400 } browser-gadget set-tool-dim
|
||||
|
||||
: show-help ( link browser-gadget -- )
|
||||
model>> dup add-history
|
||||
|
@ -63,10 +63,22 @@ M: browser-gadget definitions-changed ( assoc browser -- )
|
|||
|
||||
M: browser-gadget focusable-child* search-field>> ;
|
||||
|
||||
: (browser-window) ( topic -- )
|
||||
<browser-gadget> "Browser" open-status-window ;
|
||||
|
||||
: browser-window ( -- )
|
||||
"handbook" (browser-window) ;
|
||||
|
||||
\ browser-window H{ { +nullary+ t } } define-command
|
||||
|
||||
: com-follow ( link -- )
|
||||
[ browser-gadget? ] find-window
|
||||
[ [ raise-window ] [ gadget-child show-help ] bi ]
|
||||
[ <browser-gadget> "Browser" open-status-window ] if* ;
|
||||
[ (browser-window) ] if* ;
|
||||
|
||||
: show-browser ( -- ) "handbook" com-follow ;
|
||||
|
||||
\ show-browser H{ { +nullary+ t } } define-command
|
||||
|
||||
: com-back ( browser -- ) model>> go-back ;
|
||||
|
||||
|
@ -99,7 +111,4 @@ browser-gadget "scrolling"
|
|||
{ T{ key-down f f "PAGE_DOWN" } com-page-down }
|
||||
} define-command-map
|
||||
|
||||
: browser-window ( -- )
|
||||
[ "handbook" com-follow ] with-ui ;
|
||||
|
||||
MAIN: browser-window
|
|
@ -1,14 +1,14 @@
|
|||
! Copyright (C) 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors assocs classes classes.mixin kernel namespaces
|
||||
parser ui.gadgets ui.gadgets.scrollers ;
|
||||
parser ui.gadgets ui.gadgets.scrollers ui.gadgets.tracks ;
|
||||
IN: ui.tools.common
|
||||
|
||||
SYMBOL: tool-dims
|
||||
|
||||
tool-dims global [ H{ } clone or ] change-at
|
||||
|
||||
MIXIN: tool
|
||||
TUPLE: tool < track ;
|
||||
|
||||
M: tool pref-dim*
|
||||
class tool-dims get at ;
|
||||
|
@ -18,11 +18,7 @@ M: tool layout*
|
|||
[ [ dim>> ] [ class ] bi tool-dims get set-at ]
|
||||
bi ;
|
||||
|
||||
: TOOL:
|
||||
scan-word
|
||||
[ tool add-mixin-instance ]
|
||||
[ scan-object swap tool-dims get set-at ]
|
||||
bi ; parsing
|
||||
: set-tool-dim ( dim class -- ) tool-dims get set-at ;
|
||||
|
||||
SLOT: scroller
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ ui.gadgets.status-bar ui.gadgets.theme ui.gadgets.labelled
|
|||
ui.tools.common ui ;
|
||||
IN: ui.tools.inspector
|
||||
|
||||
TUPLE: inspector-gadget < track table ;
|
||||
TUPLE: inspector-gadget < tool table ;
|
||||
|
||||
TOOL: inspector-gadget { 500 300 }
|
||||
{ 500 300 } inspector-gadget set-tool-dim
|
||||
|
||||
TUPLE: slot-description key key-string value value-string ;
|
||||
|
||||
|
|
|
@ -149,9 +149,9 @@ M: interactor dispose drop ;
|
|||
over set-caret
|
||||
mark>caret ;
|
||||
|
||||
TUPLE: listener-gadget < track input output scroller popup ;
|
||||
TUPLE: listener-gadget < tool input output scroller popup ;
|
||||
|
||||
TOOL: listener-gadget { 550 700 }
|
||||
{ 550 700 } listener-gadget set-tool-dim
|
||||
|
||||
: find-listener ( gadget -- listener )
|
||||
[ listener-gadget? ] find-parent ;
|
||||
|
@ -196,13 +196,21 @@ M: listener-gadget focusable-child*
|
|||
: listener-window ( -- )
|
||||
[ listener-window* drop ] with-ui ;
|
||||
|
||||
\ listener-window H{ { +nullary+ t } } define-command
|
||||
|
||||
: (get-listener) ( quot -- listener )
|
||||
find-window
|
||||
[ gadget-child ] [ listener-window* ] if* ; inline
|
||||
[ [ raise-window ] [ gadget-child ] bi ]
|
||||
[ listener-window* ] if* ; inline
|
||||
|
||||
: get-listener ( -- listener )
|
||||
[ listener-gadget? ] (get-listener) ;
|
||||
|
||||
: show-listener ( -- )
|
||||
get-listener drop ;
|
||||
|
||||
\ show-listener H{ { +nullary+ t } } define-command
|
||||
|
||||
: get-ready-listener ( -- listener )
|
||||
[
|
||||
{
|
||||
|
@ -398,16 +406,12 @@ listener-gadget "scrolling"
|
|||
{ T{ key-down f { A+ } "PAGE_DOWN" } com-page-down }
|
||||
} define-command-map
|
||||
|
||||
\ refresh-all
|
||||
H{ { +nullary+ t } { +listener+ t } } define-command
|
||||
|
||||
listener-gadget "multi-touch" f {
|
||||
{ T{ up-action } refresh-all }
|
||||
} define-command-map
|
||||
|
||||
listener-gadget "workflow" f {
|
||||
listener-gadget "other" f {
|
||||
{ T{ key-down f f "ESC" } hide-popup }
|
||||
{ T{ key-down f f "F2" } refresh-all }
|
||||
} define-command-map
|
||||
|
||||
M: listener-gadget graft*
|
||||
|
|
|
@ -62,7 +62,7 @@ V{ } clone operations set-global
|
|||
: edit-file ( pathname -- ) edit ;
|
||||
|
||||
[ pathname? ] \ edit-file H{
|
||||
{ +keyboard+ T{ key-down f { C+ } "E" } }
|
||||
{ +keyboard+ T{ key-down f { C+ } "e" } }
|
||||
{ +primary+ t }
|
||||
{ +secondary+ t }
|
||||
{ +listener+ t }
|
||||
|
@ -71,7 +71,7 @@ V{ } clone operations set-global
|
|||
UNION: definition word method-spec link vocab vocab-link ;
|
||||
|
||||
[ definition? ] \ edit H{
|
||||
{ +keyboard+ T{ key-down f { C+ } "E" } }
|
||||
{ +keyboard+ T{ key-down f { C+ } "e" } }
|
||||
{ +listener+ t }
|
||||
} define-operation
|
||||
|
||||
|
@ -86,7 +86,7 @@ UNION: definition word method-spec link vocab vocab-link ;
|
|||
} define-operation
|
||||
|
||||
[ topic? ] \ com-follow H{
|
||||
{ +keyboard+ T{ key-down f { C+ } "H" } }
|
||||
{ +keyboard+ T{ key-down f { C+ } "h" } }
|
||||
{ +primary+ t }
|
||||
} define-operation
|
||||
|
||||
|
@ -98,7 +98,7 @@ UNION: definition word method-spec link vocab vocab-link ;
|
|||
! } define-operation
|
||||
|
||||
[ word? ] \ fix H{
|
||||
{ +keyboard+ T{ key-down f { C+ } "F" } }
|
||||
{ +keyboard+ T{ key-down f { C+ } "f" } }
|
||||
{ +listener+ t }
|
||||
} define-operation
|
||||
|
||||
|
@ -128,7 +128,7 @@ M: word com-stack-effect def>> com-stack-effect ;
|
|||
: com-enter-in ( vocab -- ) vocab-name set-in ;
|
||||
|
||||
[ vocab? ] \ com-enter-in H{
|
||||
{ +keyboard+ T{ key-down f { C+ } "I" } }
|
||||
{ +keyboard+ T{ key-down f { C+ } "i" } }
|
||||
{ +listener+ t }
|
||||
} define-operation
|
||||
|
||||
|
@ -140,12 +140,12 @@ M: word com-stack-effect def>> com-stack-effect ;
|
|||
} define-operation
|
||||
|
||||
[ vocab-spec? ] \ run H{
|
||||
{ +keyboard+ T{ key-down f { C+ } "R" } }
|
||||
{ +keyboard+ T{ key-down f { C+ } "r" } }
|
||||
{ +listener+ t }
|
||||
} define-operation
|
||||
|
||||
[ vocab? ] \ test H{
|
||||
{ +keyboard+ T{ key-down f { C+ } "T" } }
|
||||
{ +keyboard+ T{ key-down f { C+ } "t" } }
|
||||
{ +listener+ t }
|
||||
} define-operation
|
||||
|
||||
|
|
|
@ -13,14 +13,14 @@ FROM: models.filter => <filter> ;
|
|||
FROM: models.compose => <compose> ;
|
||||
IN: ui.tools.profiler
|
||||
|
||||
TUPLE: profiler-gadget < track
|
||||
TUPLE: profiler-gadget < tool
|
||||
sort
|
||||
vocabs vocab
|
||||
words
|
||||
methods
|
||||
generic class ;
|
||||
|
||||
TOOL: profiler-gadget { 700 400 }
|
||||
{ 700 400 } profiler-gadget set-tool-dim
|
||||
|
||||
SINGLETON: word-renderer
|
||||
|
||||
|
|
|
@ -1,9 +1,20 @@
|
|||
! Copyright (C) 2006, 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: ui.tools.operations ui.tools.listener ui kernel ;
|
||||
USING: ui.tools.operations ui.tools.listener ui.tools.browser
|
||||
ui.tools.common ui.commands ui.gestures ui kernel tools.vocabs ;
|
||||
IN: ui.tools
|
||||
|
||||
: main ( -- )
|
||||
restore-windows? [ restore-windows ] [ listener-window ] if ;
|
||||
|
||||
MAIN: main
|
||||
MAIN: main
|
||||
|
||||
\ refresh-all H{ { +nullary+ t } { +listener+ t } } define-command
|
||||
|
||||
tool "common" "Common commands available in all UI tools" {
|
||||
{ T{ key-down f { A+ } "l" } show-listener }
|
||||
{ T{ key-down f { A+ } "L" } listener-window }
|
||||
{ T{ key-down f { A+ } "b" } show-browser }
|
||||
{ T{ key-down f { A+ } "B" } browser-window }
|
||||
{ T{ key-down f f "F2" } refresh-all }
|
||||
} define-command-map
|
|
@ -8,12 +8,12 @@ ui.gadgets.labels ui threads namespaces make tools.walker assocs
|
|||
combinators fry ;
|
||||
IN: ui.tools.walker
|
||||
|
||||
TUPLE: walker-gadget < track
|
||||
TUPLE: walker-gadget < tool
|
||||
status continuation thread
|
||||
traceback
|
||||
closing? ;
|
||||
|
||||
TOOL: walker-gadget { 620 620 }
|
||||
{ 620 620 } walker-gadget set-tool-dim
|
||||
|
||||
: walker-command ( walker msg -- )
|
||||
swap
|
||||
|
|
Loading…
Reference in New Issue