Add A+n, A+p, A+u to navigate hierarchy in browser tool; add common shortcuts to all tools, like F2, A+s, A+q, ...

db4
Slava Pestov 2009-01-08 19:30:58 -06:00
parent 996b2ef939
commit 6ddf6af2e7
4 changed files with 48 additions and 11 deletions

View File

@ -7,6 +7,7 @@ ARTICLE: "ui-browser" "UI browser"
{ $subsection browser-window }
{ $command-map browser-gadget "toolbar" }
{ $command-map browser-gadget "scrolling" }
{ $command-map browser-gadget "navigation" }
{ $command-map browser-gadget "multi-touch" }
"Browsers are instances of " { $link browser-gadget } "." ;

View File

@ -1,6 +1,6 @@
! Copyright (C) 2006, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: debugger help help.topics kernel models compiler.units
USING: debugger help help.topics help.crossref kernel models compiler.units
assocs words vocabs accessors fry combinators.short-circuit
sequences models models.history tools.apropos
ui.commands ui.gadgets ui.gadgets.panes ui.gadgets.scrollers
@ -37,7 +37,7 @@ TUPLE: browser-gadget < tool pane scroller search-field ;
: <browser-gadget> ( link -- gadget )
{ 0 1 } browser-gadget new-track
swap <history> >>model
swap >link <history> >>model
dup <search-field> >>search-field
dup <browser-toolbar> f track-add
dup <help-pane> >>pane
@ -97,6 +97,24 @@ browser-gadget "toolbar" f {
{ T{ key-down f f "F1" } browser-help }
} define-command-map
: ?show-help ( link browser -- )
over [ show-help ] [ 2drop ] if ;
: navigate ( browser quot -- )
'[ control-value @ ] keep ?show-help ;
: com-up ( browser -- ) [ article-parent ] navigate ;
: com-prev ( browser -- ) [ prev-article ] navigate ;
: com-next ( browser -- ) [ next-article ] navigate ;
browser-gadget "navigation" "Commands for navigating in the article hierarchy" {
{ T{ key-down f { A+ } "u" } com-up }
{ T{ key-down f { A+ } "p" } com-prev }
{ T{ key-down f { A+ } "n" } com-next }
} define-command-map
browser-gadget "multi-touch" f {
{ T{ left-action } com-back }
{ T{ right-action } com-forward }

View File

@ -1,10 +1,9 @@
USING: editors help.markup help.syntax summary inspector io
io.styles listener parser prettyprint tools.profiler
tools.walker ui.commands ui.gadgets.editors ui.gadgets.panes
ui.gadgets.presentations ui.gadgets.slots ui.operations
ui.tools.browser ui.tools.inspector
ui.tools.listener ui.tools.operations ui.tools.profiler
ui.tools.walker vocabs ;
tools.walker ui.commands ui.gadgets.panes
ui.gadgets.presentations ui.operations
ui.tools.operations ui.tools.profiler
ui.tools.common vocabs ;
IN: ui.tools
ARTICLE: "starting-ui-tools" "Starting the UI tools"
@ -17,6 +16,11 @@ ARTICLE: "starting-ui-tools" "Starting the UI tools"
"In all cases, passing the " { $snippet "-run=listener" } " command line switch starts the terminal listener instead. The UI can be started from the terminal by issuing the following command:"
{ $code "USE: threads" "[ \"ui.tools\" run ] in-thread" } ;
ARTICLE: "ui-shortcuts" "UI tool keyboard shortcuts"
"Every UI tool has its own set of keyboard shortcuts; press " { $snippet "F1" } " inside a tool to see help. Some common shortcuts are also supported by all tools:"
{ $command-map tool "tool-switching" }
{ $command-map tool "common" } ;
ARTICLE: "ui-presentations" "Presentations in the UI"
"A " { $emphasis "presentation" } " is a graphical view of an object which is directly linked to the object in some way. The help article links you see in the documentation browser are presentations; and if you " { $link see } " a word in the UI listener, all words in the definition will themselves be presentations."
$nl
@ -26,7 +30,7 @@ $nl
$nl
"Clicking and holding the right mouse button on a presentation displays a popup menu listing available operations."
$nl
"Presentation gadgets can be constructed directly using the " { $link <presentation> } " word, and they can also be written to " { $link pane } " gadgets using the " { $link write-object } " word." ;
"For more about presentation gadgets, see " { $link "ui.gadgets.presentations" } "." ;
ARTICLE: "ui-profiler" "UI profiler"
"The graphical profiler is based on the terminal profiler (see " { $link "profiling" } ") and adds more convenient browsing of profiler results."
@ -54,6 +58,7 @@ ARTICLE: "ui-tools" "UI developer tools"
"The " { $vocab-link "ui.tools" } " vocabulary hierarchy implements a collection of simple developer tools."
$nl
"To take full advantage of the UI tools, you should be using a supported text editor. See " { $link "editor" } "."
{ $subsection "ui-shortcuts" }
{ $subsection "ui-presentations" }
{ $subsection "ui-listener" }
{ $subsection "ui-browser" }

View File

@ -1,7 +1,8 @@
! Copyright (C) 2006, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: ui.tools.operations ui.tools.listener ui.tools.browser
ui.tools.common ui.commands ui.gestures ui kernel tools.vocabs ;
USING: memory system kernel tools.vocabs ui.tools.operations
ui.tools.listener ui.tools.browser ui.tools.common ui.commands
ui.gestures ui ;
IN: ui.tools
: main ( -- )
@ -11,10 +12,22 @@ MAIN: main
\ refresh-all H{ { +nullary+ t } { +listener+ t } } define-command
tool "common" "Common commands available in all UI tools" {
\ save H{ { +nullary+ t } } define-command
: com-exit ( -- ) 0 exit ;
\ com-exit H{ { +nullary+ t } } define-command
tool "tool-switching" f {
{ 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 }
} define-command-map
tool "common" f {
{ T{ key-down f { A+ } "s" } save }
{ T{ key-down f { A+ } "w" } close-window }
{ T{ key-down f { A+ } "q" } com-exit }
{ T{ key-down f f "F2" } refresh-all }
} define-command-map