From 637d06a4f85066c70142a0c9d52552601b1bdc65 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 24 Mar 2009 04:11:08 -0500 Subject: [PATCH] Add silly 'tip of the day' feature, and 'recently visited' list to UI browser home page --- basis/bootstrap/help/help.factor | 2 +- basis/bootstrap/tools/tools.factor | 1 - .../apropos/apropos-docs.factor | 6 ++- basis/help/apropos/apropos-tests.factor | 4 ++ basis/{tools => help}/apropos/apropos.factor | 8 +++- basis/help/handbook/handbook.factor | 14 +++---- basis/help/help-docs.factor | 1 + basis/help/home/authors.txt | 1 + basis/help/home/home-docs.factor | 19 +++++++++ basis/help/home/home.factor | 40 +++++++++++++++++++ basis/help/html/html.factor | 2 +- basis/help/tips/authors.txt | 1 + basis/help/tips/tips-docs.factor | 27 +++++++++++++ basis/help/tips/tips.factor | 38 ++++++++++++++++++ .../browser => help/vocabs}/authors.txt | 0 .../browser => help/vocabs}/summary.txt | 0 .../vocabs/browser => help/vocabs}/tags.txt | 0 .../vocabs/vocabs-docs.factor} | 2 +- basis/help/vocabs/vocabs-tests.factor | 5 +++ .../vocabs/vocabs.factor} | 17 ++++---- basis/tools/apropos/apropos-tests.factor | 4 -- .../tools/vocabs/browser/browser-tests.factor | 5 --- basis/ui/gadgets/editors/editors-docs.factor | 6 ++- basis/ui/tools/browser/browser.factor | 19 ++++----- basis/ui/tools/deploy/deploy-docs.factor | 4 +- .../listener/completion/completion.factor | 2 +- basis/ui/tools/listener/listener-docs.factor | 22 +++++++++- basis/ui/tools/listener/listener.factor | 22 +++++----- .../tools/operations/operations-docs.factor | 8 ++++ basis/ui/tools/operations/operations.factor | 4 +- basis/ui/tools/profiler/profiler-docs.factor | 11 +++++ basis/ui/tools/profiler/profiler.factor | 2 + basis/ui/tools/tools-docs.factor | 5 ++- core/parser/parser.factor | 2 +- core/strings/strings-docs.factor | 2 +- extra/demos/demos.factor | 2 +- extra/fuel/help/help.factor | 2 +- extra/galois-talk/galois-talk.factor | 2 +- .../google-tech-talk/google-tech-talk.factor | 2 +- extra/otug-talk/otug-talk.factor | 2 +- extra/vpri-talk/vpri-talk.factor | 2 +- 41 files changed, 245 insertions(+), 73 deletions(-) rename basis/{tools => help}/apropos/apropos-docs.factor (60%) create mode 100644 basis/help/apropos/apropos-tests.factor rename basis/{tools => help}/apropos/apropos.factor (94%) create mode 100644 basis/help/home/authors.txt create mode 100644 basis/help/home/home-docs.factor create mode 100644 basis/help/home/home.factor create mode 100644 basis/help/tips/authors.txt create mode 100644 basis/help/tips/tips-docs.factor create mode 100644 basis/help/tips/tips.factor rename basis/{tools/vocabs/browser => help/vocabs}/authors.txt (100%) rename basis/{tools/vocabs/browser => help/vocabs}/summary.txt (100%) rename basis/{tools/vocabs/browser => help/vocabs}/tags.txt (100%) rename basis/{tools/vocabs/browser/browser-docs.factor => help/vocabs/vocabs-docs.factor} (94%) create mode 100644 basis/help/vocabs/vocabs-tests.factor rename basis/{tools/vocabs/browser/browser.factor => help/vocabs/vocabs.factor} (96%) delete mode 100644 basis/tools/apropos/apropos-tests.factor delete mode 100644 basis/tools/vocabs/browser/browser-tests.factor create mode 100644 basis/ui/tools/operations/operations-docs.factor create mode 100644 basis/ui/tools/profiler/profiler-docs.factor diff --git a/basis/bootstrap/help/help.factor b/basis/bootstrap/help/help.factor index c3e74f7863..553b91a6ae 100644 --- a/basis/bootstrap/help/help.factor +++ b/basis/bootstrap/help/help.factor @@ -5,7 +5,7 @@ IN: bootstrap.help : load-help ( -- ) "help.lint" require - "tools.vocabs.browser" require + "help.vocabs" require "alien.syntax" require "compiler" require diff --git a/basis/bootstrap/tools/tools.factor b/basis/bootstrap/tools/tools.factor index c6ec7f0b99..b0afe4a1d9 100644 --- a/basis/bootstrap/tools/tools.factor +++ b/basis/bootstrap/tools/tools.factor @@ -14,7 +14,6 @@ IN: bootstrap.tools "tools.time" "tools.threads" "tools.vocabs" - "tools.vocabs.browser" "tools.vocabs.monitor" "editors" } [ require ] each diff --git a/basis/tools/apropos/apropos-docs.factor b/basis/help/apropos/apropos-docs.factor similarity index 60% rename from basis/tools/apropos/apropos-docs.factor rename to basis/help/apropos/apropos-docs.factor index b50b51b84f..4d774a75cb 100644 --- a/basis/tools/apropos/apropos-docs.factor +++ b/basis/help/apropos/apropos-docs.factor @@ -1,6 +1,8 @@ -IN: tools.apropos -USING: help.markup help.syntax strings ; +IN: help.apropos +USING: help.markup help.syntax strings help.tips ; HELP: apropos { $values { "str" string } } { $description "Lists all words, vocabularies and help articles whose name contains a subsequence equal to " { $snippet "str" } ". Results are ranked using a simple distance algorithm." } ; + +TIP: "Use " { $link apropos } " to search for words, vocabularies and help articles." ; \ No newline at end of file diff --git a/basis/help/apropos/apropos-tests.factor b/basis/help/apropos/apropos-tests.factor new file mode 100644 index 0000000000..3dbda475de --- /dev/null +++ b/basis/help/apropos/apropos-tests.factor @@ -0,0 +1,4 @@ +IN: help.apropos.tests +USING: help.apropos tools.test ; + +[ ] [ "swp" apropos ] unit-test diff --git a/basis/tools/apropos/apropos.factor b/basis/help/apropos/apropos.factor similarity index 94% rename from basis/tools/apropos/apropos.factor rename to basis/help/apropos/apropos.factor index c7126c10d0..b241db4c0e 100644 --- a/basis/tools/apropos/apropos.factor +++ b/basis/help/apropos/apropos.factor @@ -2,9 +2,9 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs fry help.markup help.topics io kernel make math math.parser namespaces sequences sorting -summary tools.completion tools.vocabs tools.vocabs.browser +summary tools.completion tools.vocabs help.vocabs vocabs words unicode.case help ; -IN: tools.apropos +IN: help.apropos : $completions ( seq -- ) dup [ word? ] all? [ words-table ] [ @@ -67,5 +67,9 @@ M: apropos article-name article-title ; M: apropos article-content search>> 1array \ $apropos prefix ; +M: apropos >link ; + +INSTANCE: apropos topic + : apropos ( str -- ) print-topic ; diff --git a/basis/help/handbook/handbook.factor b/basis/help/handbook/handbook.factor index e048b66b7c..ed2a14a2f2 100644 --- a/basis/help/handbook/handbook.factor +++ b/basis/help/handbook/handbook.factor @@ -4,7 +4,7 @@ prettyprint.backend prettyprint.custom kernel.private io generic math system strings sbufs vectors byte-arrays quotations io.streams.byte-array classes.builtin parser lexer classes.predicate classes.union classes.intersection -classes.singleton classes.tuple tools.vocabs.browser math.parser +classes.singleton classes.tuple help.vocabs math.parser accessors ; IN: help.handbook @@ -278,11 +278,7 @@ ARTICLE: "handbook-library-reference" "Library reference" "This index only includes articles from loaded vocabularies. To explore more vocabularies, see " { $link "vocab-index" } "." { $index [ "handbook" orphan-articles remove ] } ; -ARTICLE: "handbook" "Factor documentation" -"Welcome to Factor." -$nl -"Explore the code base:" -{ $subsection "vocab-index" } +ARTICLE: "handbook" "Factor handbook" "Learn the language:" { $subsection "cookbook" } { $subsection "first-program" } @@ -290,11 +286,13 @@ $nl { $subsection "handbook-environment-reference" } { $subsection "ui" } { $subsection "handbook-library-reference" } -"The below indices only include articles from loaded vocabularies. To explore more vocabularies, see " { $link "vocab-index" } "." +"Explore loaded libraries:" { $subsection "article-index" } { $subsection "primitive-index" } { $subsection "error-index" } { $subsection "type-index" } -{ $subsection "class-index" } ; +{ $subsection "class-index" } +"Explore the code base:" +{ $subsection "vocab-index" } ; ABOUT: "handbook" diff --git a/basis/help/help-docs.factor b/basis/help/help-docs.factor index 733199fc60..547ee871aa 100644 --- a/basis/help/help-docs.factor +++ b/basis/help/help-docs.factor @@ -127,6 +127,7 @@ ARTICLE: "help" "Help system" { $subsection "browsing-help" } { $subsection "writing-help" } { $subsection "help.lint" } +{ $subsection "tips-of-the-day" } { $subsection "help-impl" } ; IN: help diff --git a/basis/help/home/authors.txt b/basis/help/home/authors.txt new file mode 100644 index 0000000000..d4f5d6b3ae --- /dev/null +++ b/basis/help/home/authors.txt @@ -0,0 +1 @@ +Slava Pestov \ No newline at end of file diff --git a/basis/help/home/home-docs.factor b/basis/help/home/home-docs.factor new file mode 100644 index 0000000000..d4d8a6206d --- /dev/null +++ b/basis/help/home/home-docs.factor @@ -0,0 +1,19 @@ +IN: help.home +USING: help.markup help.syntax ; + +ARTICLE: "help.home" "Factor documentation" +{ $heading "Starting points" } +{ $list + { $link "ui-listener" } + { $link "handbook" } + { $link "vocab-index" } +} +{ $heading "Recently visited" } +{ $table + { "Words" "Articles" "Vocabs" } + { { $recent recent-words } { $recent recent-articles } { $recent recent-vocabs } } +} print-element +{ $heading "Recent searches" } +{ $recent-searches } ; + +ABOUT: "help.home" \ No newline at end of file diff --git a/basis/help/home/home.factor b/basis/help/home/home.factor new file mode 100644 index 0000000000..b1b938cb45 --- /dev/null +++ b/basis/help/home/home.factor @@ -0,0 +1,40 @@ +! Copyright (C) 2009 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: arrays compiler.units fry hashtables help.topics io +kernel math namespaces sequences sets help.vocabs +help.apropos vocabs help.markup ; +IN: help.home + +SYMBOLS: recent-words recent-articles recent-vocabs recent-searches ; + +CONSTANT: recent-count 10 + +{ recent-words recent-articles recent-vocabs recent-searches } +[ [ V{ } clone ] initialize ] each + +GENERIC: add-recent-where ( obj -- obj symbol ) + +M: link add-recent-where recent-articles ; +M: word-link add-recent-where recent-words ; +M: vocab-spec add-recent-where recent-vocabs ; +M: apropos add-recent-where recent-searches ; +M: object add-recent-where f ; + +: $recent ( element -- ) + first get [ nl ] [ 1array $pretty-link ] interleave ; + +: $recent-searches ( element -- ) + drop recent-searches get [ nl ] [ ($link) ] interleave ; + +: redisplay-recent-page ( -- ) + "help.home" >link dup associate + notify-definition-observers ; + +: expire ( seq -- ) + [ length recent-count - [ 0 > ] keep ] keep + '[ 0 _ _ delete-slice ] when ; + +: add-recent ( obj -- ) + add-recent-where dup + [ get [ adjoin ] [ expire ] bi ] [ 2drop ] if + redisplay-recent-page ; \ No newline at end of file diff --git a/basis/help/html/html.factor b/basis/help/html/html.factor index cbeb8b362e..66d864b2a0 100644 --- a/basis/help/html/html.factor +++ b/basis/help/html/html.factor @@ -3,7 +3,7 @@ USING: io.encodings.utf8 io.encodings.ascii io.encodings.binary io.files io.files.temp io.directories html.streams help kernel assocs sequences make words accessors arrays help.topics vocabs -tools.vocabs tools.vocabs.browser namespaces prettyprint io +tools.vocabs help.vocabs namespaces prettyprint io vocabs.loader serialize fry memoize unicode.case math.order sorting debugger html xml.syntax xml.writer ; IN: help.html diff --git a/basis/help/tips/authors.txt b/basis/help/tips/authors.txt new file mode 100644 index 0000000000..d4f5d6b3ae --- /dev/null +++ b/basis/help/tips/authors.txt @@ -0,0 +1 @@ +Slava Pestov \ No newline at end of file diff --git a/basis/help/tips/tips-docs.factor b/basis/help/tips/tips-docs.factor new file mode 100644 index 0000000000..7148b25a37 --- /dev/null +++ b/basis/help/tips/tips-docs.factor @@ -0,0 +1,27 @@ +IN: help.tips +USING: help.markup help.syntax debugger ; + +TIP: "To look at the most recent error, run " { $link :error } ". To look at the most recent error's callstack, run " { $link :c } "." ; + +TIP: "Learn to use " { $link "dataflow-combinators" } "." ; + +TIP: "Learn to use " { $link "editor" } " to be able to jump to the source code for word definitions from the listener." ; + +TIP: "Check out " { $url "http://concatenative.org/wiki/view/Factor/FAQ" } " to get answers to frequently-asked questions." ; + +TIP: "Drop by the " { $snippet "#concatenative" } " IRC channel on " { $snippet "irc.freenode.net" } " some time." ; + +TIP: "You can write documentation for your own code using the " { $link "help" } "." ; + +TIP: "You can write graphical applications using the " { $link "ui" } "." ; + +ARTICLE: "all-tips-of-the-day" "All tips of the day" +{ $tips-of-the-day } ; + +ARTICLE: "tips-of-the-day" "Tips of the day" +"The " { $vocab-link "help.tips" } " vocabulary provides a facility for displaying tips of the day in the " { $link "ui-listener" } ". Tips are defined with a parsing word:" +{ $subsection POSTPONE: TIP: } +"All tips defined so far:" +{ $subsection "all-tips-of-the-day" } ; + +ABOUT: "tips-of-the-day" \ No newline at end of file diff --git a/basis/help/tips/tips.factor b/basis/help/tips/tips.factor new file mode 100644 index 0000000000..8d173ce533 --- /dev/null +++ b/basis/help/tips/tips.factor @@ -0,0 +1,38 @@ +! Copyright (C) 2009 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: parser arrays namespaces sequences random help.markup kernel io +io.styles colors.constants ; +IN: help.tips + +SYMBOL: tips + +tips [ V{ } clone ] initialize + +SYNTAX: TIP: parse-definition >array tips get push ; + +: a-tip ( -- tip ) tips get random ; + +SYMBOL: tip-of-the-day-style + +H{ + { page-color COLOR: lavender } + { border-width 5 } + { wrap-margin 500 } +} tip-of-the-day-style set-global + +: $tip-of-the-day ( element -- ) + drop + [ + tip-of-the-day-style get + [ + last-element off + "Tip of the day" $heading a-tip print-element nl + "— " print-element "all-tips-of-the-day" ($link) + ] + with-nesting + ] ($heading) ; + +: tip-of-the-day. ( -- ) { $tip-of-the-day } print-content nl ; + +: $tips-of-the-day ( element -- ) + drop tips get [ nl nl ] [ print-element ] interleave ; \ No newline at end of file diff --git a/basis/tools/vocabs/browser/authors.txt b/basis/help/vocabs/authors.txt similarity index 100% rename from basis/tools/vocabs/browser/authors.txt rename to basis/help/vocabs/authors.txt diff --git a/basis/tools/vocabs/browser/summary.txt b/basis/help/vocabs/summary.txt similarity index 100% rename from basis/tools/vocabs/browser/summary.txt rename to basis/help/vocabs/summary.txt diff --git a/basis/tools/vocabs/browser/tags.txt b/basis/help/vocabs/tags.txt similarity index 100% rename from basis/tools/vocabs/browser/tags.txt rename to basis/help/vocabs/tags.txt diff --git a/basis/tools/vocabs/browser/browser-docs.factor b/basis/help/vocabs/vocabs-docs.factor similarity index 94% rename from basis/tools/vocabs/browser/browser-docs.factor rename to basis/help/vocabs/vocabs-docs.factor index 723c4ac483..5f1a97205e 100644 --- a/basis/tools/vocabs/browser/browser-docs.factor +++ b/basis/help/vocabs/vocabs-docs.factor @@ -1,5 +1,5 @@ USING: help.markup help.syntax io strings ; -IN: tools.vocabs.browser +IN: help.vocabs ARTICLE: "vocab-tags" "Vocabulary tags" { $all-tags } ; diff --git a/basis/help/vocabs/vocabs-tests.factor b/basis/help/vocabs/vocabs-tests.factor new file mode 100644 index 0000000000..f03e0b3337 --- /dev/null +++ b/basis/help/vocabs/vocabs-tests.factor @@ -0,0 +1,5 @@ +IN: help.vocabs.tests +USING: help.vocabs tools.test help.markup help vocabs ; + +[ ] [ { $vocab "scratchpad" } print-content ] unit-test +[ ] [ "classes" vocab print-topic ] unit-test \ No newline at end of file diff --git a/basis/tools/vocabs/browser/browser.factor b/basis/help/vocabs/vocabs.factor similarity index 96% rename from basis/tools/vocabs/browser/browser.factor rename to basis/help/vocabs/vocabs.factor index c9ade7aae2..13bb0cdf3e 100644 --- a/basis/tools/vocabs/browser/browser.factor +++ b/basis/help/vocabs/vocabs.factor @@ -6,17 +6,16 @@ classes.singleton classes.tuple classes.union combinators definitions effects fry generic help help.markup help.stylesheet help.topics io io.files io.pathnames io.styles kernel macros make namespaces prettyprint sequences sets sorting summary -tools.vocabs vocabs vocabs.loader words words.symbol -combinators.smart definitions.icons ; -IN: tools.vocabs.browser +tools.vocabs vocabs vocabs.loader words words.symbol definitions.icons ; +IN: help.vocabs + +: $pretty-link ( element -- ) + [ first definition-icon 1array $image " " print-element ] + [ $definition-link ] + bi ; : <$pretty-link> ( definition -- element ) - [ - [ definition-icon 1array \ $image prefix ] - [ drop " " ] - [ 1array \ $definition-link prefix ] - tri - ] output>array ; + 1array \ $pretty-link prefix ; : vocab-row ( vocab -- row ) [ <$pretty-link> ] [ vocab-summary ] bi 2array ; diff --git a/basis/tools/apropos/apropos-tests.factor b/basis/tools/apropos/apropos-tests.factor deleted file mode 100644 index 96ce9d3186..0000000000 --- a/basis/tools/apropos/apropos-tests.factor +++ /dev/null @@ -1,4 +0,0 @@ -IN: tools.apropos.tests -USING: tools.apropos tools.test ; - -[ ] [ "swp" apropos ] unit-test diff --git a/basis/tools/vocabs/browser/browser-tests.factor b/basis/tools/vocabs/browser/browser-tests.factor deleted file mode 100644 index 385d1b2d46..0000000000 --- a/basis/tools/vocabs/browser/browser-tests.factor +++ /dev/null @@ -1,5 +0,0 @@ -IN: tools.vocabs.browser.tests -USING: tools.vocabs.browser tools.test help.markup help vocabs ; - -[ ] [ { $vocab "scratchpad" } print-content ] unit-test -[ ] [ "classes" vocab print-topic ] unit-test \ No newline at end of file diff --git a/basis/ui/gadgets/editors/editors-docs.factor b/basis/ui/gadgets/editors/editors-docs.factor index 244e36d640..0ad37cb10f 100644 --- a/basis/ui/gadgets/editors/editors-docs.factor +++ b/basis/ui/gadgets/editors/editors-docs.factor @@ -1,6 +1,6 @@ USING: documents help.markup help.syntax ui.gadgets ui.gadgets.scrollers models strings ui.commands -ui.text colors fonts ; +ui.text colors fonts help.tips ; IN: ui.gadgets.editors HELP: editor @@ -109,4 +109,8 @@ ARTICLE: "ui.gadgets.editors" "Editor gadgets" "Editors edit " { $emphasis "documents" } ":" { $subsection "documents" } ; +TIP: "Editor gadgets support undo and redo; press " { $command editor "editing" com-undo } " and " { $command editor "editing" com-redo } "." ; + +TIP: "Learn the keyboard shortcuts used in " { $link "ui.gadgets.editors" } "." ; + ABOUT: "ui.gadgets.editors" diff --git a/basis/ui/tools/browser/browser.factor b/basis/ui/tools/browser/browser.factor index 078ece6546..e1dcba9910 100644 --- a/basis/ui/tools/browser/browser.factor +++ b/basis/ui/tools/browser/browser.factor @@ -1,10 +1,11 @@ ! Copyright (C) 2006, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -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 combinators -ui.commands ui.gadgets ui.gadgets.panes ui.gadgets.scrollers -ui.gadgets.tracks ui.gestures ui.gadgets.buttons ui.gadgets.packs +USING: debugger help help.topics help.crossref help.home kernel +models compiler.units assocs words vocabs accessors fry +combinators.short-circuit namespaces sequences models +models.history help.apropos combinators ui.commands ui.gadgets +ui.gadgets.panes ui.gadgets.scrollers ui.gadgets.tracks +ui.gestures ui.gadgets.buttons ui.gadgets.packs ui.gadgets.editors ui.gadgets.labels ui.gadgets.status-bar ui.gadgets.glass ui.gadgets.borders ui.tools.common ui.tools.browser.popups ui ; @@ -15,8 +16,8 @@ TUPLE: browser-gadget < tool pane scroller search-field popup ; { 650 400 } browser-gadget set-tool-dim : show-help ( link browser-gadget -- ) - model>> dup add-history - [ >link ] dip set-model ; + [ >link ] [ model>> ] bi* + [ [ add-recent ] [ add-history ] bi* ] [ set-model ] 2bi ; : ( browser-gadget -- gadget ) model>> [ '[ _ print-topic ] try ] ; @@ -96,7 +97,7 @@ M: browser-gadget focusable-child* search-field>> ; : com-forward ( browser -- ) model>> go-forward ; -: com-documentation ( browser -- ) "handbook" swap show-help ; +: com-documentation ( browser -- ) "help.home" swap show-help ; : browser-help ( -- ) "ui-browser" com-browse ; @@ -113,7 +114,7 @@ browser-gadget "toolbar" f { over [ show-help ] [ 2drop ] if ; : navigate ( browser quot -- ) - '[ control-value @ ] keep ?show-help ; + '[ control-value @ ] keep ?show-help ; inline : com-up ( browser -- ) [ article-parent ] navigate ; diff --git a/basis/ui/tools/deploy/deploy-docs.factor b/basis/ui/tools/deploy/deploy-docs.factor index e625d26c60..b0a2fb6cf9 100644 --- a/basis/ui/tools/deploy/deploy-docs.factor +++ b/basis/ui/tools/deploy/deploy-docs.factor @@ -1,4 +1,4 @@ -USING: help.markup help.syntax ; +USING: help.markup help.syntax help.tips ; IN: ui.tools.deploy HELP: deploy-tool @@ -14,4 +14,6 @@ $nl "Alternatively, right-click on a vocabulary presentation in the UI and choose " { $strong "Deploy tool" } " from the resulting popup menu." { $see-also "tools.deploy" } ; +TIP: "Generate stand-alone applications from vocabularies with the " { $link "ui.tools.deploy" } "." ; + ABOUT: "ui.tools.deploy" diff --git a/basis/ui/tools/listener/completion/completion.factor b/basis/ui/tools/listener/completion/completion.factor index 0f357cb0af..022a2daabf 100644 --- a/basis/ui/tools/listener/completion/completion.factor +++ b/basis/ui/tools/listener/completion/completion.factor @@ -3,7 +3,7 @@ USING: accessors arrays assocs calendar colors colors.constants documents documents.elements fry kernel words sets splitting math math.vectors models.delay models.arrow combinators.short-circuit -parser present sequences tools.completion tools.vocabs.browser generic +parser present sequences tools.completion help.vocabs generic generic.standard.engines.tuple fonts definitions.icons ui.images ui.commands ui.operations ui.gadgets ui.gadgets.editors ui.gadgets.glass ui.gadgets.scrollers ui.gadgets.tables diff --git a/basis/ui/tools/listener/listener-docs.factor b/basis/ui/tools/listener/listener-docs.factor index caff45e40e..afe890b9c5 100644 --- a/basis/ui/tools/listener/listener-docs.factor +++ b/basis/ui/tools/listener/listener-docs.factor @@ -1,5 +1,7 @@ USING: help.markup help.syntax ui.commands ui.operations -ui.gadgets.editors ui.gadgets.panes listener io words ; +ui.gadgets.editors ui.gadgets.panes listener io words +ui.tools.listener.completion ui.tools.common help.tips +tools.vocabs vocabs ; IN: ui.tools.listener HELP: interactor @@ -21,11 +23,27 @@ ARTICLE: "ui-listener" "UI listener" { $operations \ word } { $heading "Vocabulary commands" } "These words operate on the vocabulary at the cursor." -{ $operations \ word } +{ $operations T{ vocab-link f "kernel" } } { $command-map interactor "quotation" } { $heading "Editing commands" } "The text editing commands are standard; see " { $link "gadgets-editors-commands" } "." { $heading "Implementation" } "Listeners are instances of " { $link listener-gadget } ". The listener consists of an output area (instance of " { $link pane } ") and an input area (instance of " { $link interactor } "). Clickable presentations can also be printed to the listener; see " { $link "ui-presentations" } "." ; +TIP: "You can read documentation by pressing F1." ; + +TIP: "The listener tool remembers previous lines of input. Press " { $command interactor "completion" recall-previous } " and " { $command interactor "completion" recall-next } " to cycle through them." ; + +TIP: "When you mouse over certain objects, a block border will appear. Left-clicking on such an object will perform the default operation. Right-clicking will show a menu with all operations." ; + +TIP: "The status bar displays stack effects of recognized words as they are being typed in." ; + +TIP: "Press " { $command interactor "completion" code-completion-popup } " to complete word, vocabulary and Unicode character names. The latter two features become available if the cursor is after a " { $link POSTPONE: USE: } ", " { $link POSTPONE: USING: } " or " { $link POSTPONE: CHAR: } "." ; + +TIP: "If a word's vocabulary is loaded, but not in the search path, you can use restarts to add the vocabulary to the search path. Auto-use mode (" { $command listener-gadget "toolbar" com-auto-use } ") invokes restarts automatically if there is only one restart." ; + +TIP: "Scroll the listener from the keyboard by pressing " { $command listener-gadget "scrolling" com-page-up } " and " { $command listener-gadget "scrolling" com-page-down } "." ; + +TIP: "Press " { $command tool "common" refresh-all } " or run " { $link refresh-all } " to reload changed source files from disk. " ; + ABOUT: "ui-listener" \ No newline at end of file diff --git a/basis/ui/tools/listener/listener.factor b/basis/ui/tools/listener/listener.factor index 5efcd01eec..91448dfe10 100644 --- a/basis/ui/tools/listener/listener.factor +++ b/basis/ui/tools/listener/listener.factor @@ -2,12 +2,13 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs calendar combinators locals colors.constants combinators.short-circuit compiler.units -concurrency.flags concurrency.mailboxes continuations destructors -documents documents.elements fry hashtables help help.markup io -io.styles kernel lexer listener math models models.delay models.arrow -namespaces parser prettyprint quotations sequences strings threads -tools.vocabs vocabs vocabs.loader vocabs.parser words debugger ui ui.commands -ui.pens.solid ui.gadgets ui.gadgets.glass ui.gadgets.buttons ui.gadgets.editors +help.tips concurrency.flags concurrency.mailboxes continuations +destructors documents documents.elements fry hashtables help +help.markup io io.styles kernel lexer listener math models +models.delay models.arrow namespaces parser prettyprint quotations +sequences strings threads tools.vocabs vocabs vocabs.loader +vocabs.parser words debugger ui ui.commands ui.pens.solid ui.gadgets +ui.gadgets.glass ui.gadgets.buttons ui.gadgets.editors ui.gadgets.labeled ui.gadgets.panes ui.gadgets.scrollers ui.gadgets.status-bar ui.gadgets.tracks ui.gadgets.borders ui.gestures ui.operations ui.tools.browser ui.tools.common ui.tools.debugger @@ -354,16 +355,11 @@ interactor "completion" f { { T{ key-down f { C+ } "r" } history-completion-popup } } define-command-map -: welcome. ( -- ) - "If this is your first time with Factor, please read the " print - "handbook" ($link) ". To see a list of keyboard shortcuts," print - "press F1." print nl ; - : listener-thread ( listener -- ) dup listener-streams [ [ com-browse ] help-hook set '[ [ _ input>> ] 2dip debugger-popup ] error-hook set - welcome. + tip-of-the-day. nl listener ] with-streams* ; @@ -385,7 +381,7 @@ interactor "completion" f { [ wait-for-listener ] } cleave ; -: listener-help ( -- ) "ui-listener" com-browse ; +: listener-help ( -- ) "help.home" com-browse ; \ listener-help H{ { +nullary+ t } } define-command diff --git a/basis/ui/tools/operations/operations-docs.factor b/basis/ui/tools/operations/operations-docs.factor new file mode 100644 index 0000000000..455e4f5ccc --- /dev/null +++ b/basis/ui/tools/operations/operations-docs.factor @@ -0,0 +1,8 @@ +USING: help.tips help.markup help.syntax ui.operations +tools.walker tools.time tools.profiler ui.tools.operations ; + +TIP: "Press " { $operation com-stack-effect } " to print the stack effect of the code in the input field without executing it (" { $link "inference" } ")." ; + +TIP: "Press " { $operation walk } " to single-step through the code in the input field (" { $link "ui-walker" } ")." ; + +TIP: "Press " { $operation time } " to time execution of the code in the input field (" { $link "timing" } ")." ; diff --git a/basis/ui/tools/operations/operations.factor b/basis/ui/tools/operations/operations.factor index 6d6cda1dba..28781e24bb 100644 --- a/basis/ui/tools/operations/operations.factor +++ b/basis/ui/tools/operations/operations.factor @@ -9,7 +9,7 @@ compiler.units accessors vocabs.parser macros.expander ui ui.tools.browser ui.tools.listener ui.tools.listener.completion ui.tools.profiler ui.tools.inspector ui.tools.traceback ui.commands ui.gadgets.editors ui.gestures ui.operations -ui.tools.deploy models ; +ui.tools.deploy models help.tips ; IN: ui.tools.operations ! Objects @@ -157,8 +157,6 @@ M: word com-stack-effect 1quotation com-stack-effect ; { +listener+ t } } define-operation -: com-profile ( quot -- ) profile profiler-window ; - [ quotation? ] \ com-profile H{ { +keyboard+ T{ key-down f { C+ } "o" } } { +listener+ t } diff --git a/basis/ui/tools/profiler/profiler-docs.factor b/basis/ui/tools/profiler/profiler-docs.factor new file mode 100644 index 0000000000..a54a29c6a1 --- /dev/null +++ b/basis/ui/tools/profiler/profiler-docs.factor @@ -0,0 +1,11 @@ +IN: ui.tools.profiler +USING: help.markup help.syntax ui.operations help.tips ; + +ARTICLE: "ui.tools.profiler" "UI profiler tool" +"The " { $vocab-link "ui.tools.profiler" } " vocabulary implements a graphical tool for viewing profiling results (see " { $link "tools.profiler" } ")." +$nl +"To use the profiler, enter a piece of code in the listener's input area and press " { $operation com-profile } "." ; + +TIP: "Press " { $operation com-profile } " to run the code in the input field with profiling enabled (" { $link "ui.tools.profiler" } ")." ; + +ABOUT: "ui.tools.profiler" \ No newline at end of file diff --git a/basis/ui/tools/profiler/profiler.factor b/basis/ui/tools/profiler/profiler.factor index bbd9237c87..6bca4b40c4 100644 --- a/basis/ui/tools/profiler/profiler.factor +++ b/basis/ui/tools/profiler/profiler.factor @@ -208,4 +208,6 @@ profiler-gadget "toolbar" f { : profiler-window ( -- ) "Profiling results" open-status-window ; +: com-profile ( quot -- ) profile profiler-window ; + MAIN: profiler-window \ No newline at end of file diff --git a/basis/ui/tools/tools-docs.factor b/basis/ui/tools/tools-docs.factor index d3078cc178..c591775429 100644 --- a/basis/ui/tools/tools-docs.factor +++ b/basis/ui/tools/tools-docs.factor @@ -1,7 +1,8 @@ USING: editors help.markup help.syntax summary inspector io io.styles listener parser prettyprint tools.profiler tools.walker ui.commands ui.gadgets.panes ui.gadgets.presentations ui.operations -ui.tools.operations ui.tools.profiler ui.tools.common vocabs see ; +ui.tools.operations ui.tools.profiler ui.tools.common vocabs see +help.tips ; IN: ui.tools ARTICLE: "starting-ui-tools" "Starting the UI tools" @@ -67,4 +68,6 @@ $nl "Platform-specific features:" { $subsection "ui-cocoa" } ; +TIP: "All UI developer tools support a common set of " { $link "ui-shortcuts" } ". Each individual tool has its own shortcuts as well; the F1 key is context-sensitive." ; + ABOUT: "ui-tools" diff --git a/core/parser/parser.factor b/core/parser/parser.factor index 871f7c5321..b71f6ed3be 100644 --- a/core/parser/parser.factor +++ b/core/parser/parser.factor @@ -166,6 +166,7 @@ SYMBOL: interactive-vocabs "definitions" "editors" "help" + "help.apropos" "help.lint" "inspector" "io" @@ -186,7 +187,6 @@ SYMBOL: interactive-vocabs "strings" "syntax" "tools.annotations" - "tools.apropos" "tools.crossref" "tools.disassembler" "tools.memory" diff --git a/core/strings/strings-docs.factor b/core/strings/strings-docs.factor index 2aa8ef421c..22e8bfcb62 100644 --- a/core/strings/strings-docs.factor +++ b/core/strings/strings-docs.factor @@ -1,6 +1,6 @@ USING: arrays byte-arrays help.markup help.syntax kernel kernel.private strings.private sequences vectors -sbufs math tools.vocabs.browser ; +sbufs math help.vocabs ; IN: strings ARTICLE: "strings" "Strings" diff --git a/extra/demos/demos.factor b/extra/demos/demos.factor index fd7aafb601..8c55945105 100644 --- a/extra/demos/demos.factor +++ b/extra/demos/demos.factor @@ -1,6 +1,6 @@ USING: kernel fry sequences - vocabs.loader tools.vocabs.browser + vocabs.loader help.vocabs ui ui.gadgets ui.gadgets.buttons ui.gadgets.packs ui.gadgets.scrollers ui.tools.listener accessors ; diff --git a/extra/fuel/help/help.factor b/extra/fuel/help/help.factor index 6368e542a7..30d6845a9b 100644 --- a/extra/fuel/help/help.factor +++ b/extra/fuel/help/help.factor @@ -3,7 +3,7 @@ USING: accessors arrays assocs combinators help help.crossref help.markup help.topics io io.streams.string kernel make namespaces -parser prettyprint sequences summary tools.vocabs tools.vocabs.browser +parser prettyprint sequences summary tools.vocabs help.vocabs vocabs vocabs.loader words see ; IN: fuel.help diff --git a/extra/galois-talk/galois-talk.factor b/extra/galois-talk/galois-talk.factor index ccba90fb6f..be713542ed 100644 --- a/extra/galois-talk/galois-talk.factor +++ b/extra/galois-talk/galois-talk.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: slides help.markup math arrays hashtables namespaces sequences kernel sequences parser memoize io.encodings.binary -locals kernel.private tools.vocabs.browser assocs quotations +locals kernel.private help.vocabs assocs quotations urls peg.ebnf tools.vocabs tools.annotations tools.crossref help.topics math.functions compiler.tree.optimizer compiler.cfg.optimizer fry ; diff --git a/extra/google-tech-talk/google-tech-talk.factor b/extra/google-tech-talk/google-tech-talk.factor index 4d4e3b0507..ab8e72fc76 100644 --- a/extra/google-tech-talk/google-tech-talk.factor +++ b/extra/google-tech-talk/google-tech-talk.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: slides help.markup math arrays hashtables namespaces sequences kernel sequences parser memoize io.encodings.binary -locals kernel.private tools.vocabs.browser assocs quotations +locals kernel.private help.vocabs assocs quotations urls peg.ebnf tools.vocabs tools.annotations tools.crossref help.topics math.functions compiler.tree.optimizer compiler.cfg.optimizer fry ; diff --git a/extra/otug-talk/otug-talk.factor b/extra/otug-talk/otug-talk.factor index 2ce307ce20..b7256246fe 100644 --- a/extra/otug-talk/otug-talk.factor +++ b/extra/otug-talk/otug-talk.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: slides help.markup math arrays hashtables namespaces sequences kernel sequences parser memoize io.encodings.binary locals -kernel.private tools.vocabs.browser assocs quotations tools.vocabs +kernel.private help.vocabs assocs quotations tools.vocabs tools.annotations tools.crossref help.topics math.functions compiler.tree.optimizer compiler.cfg.optimizer fry ui.gadgets.panes tetris tetris.game combinators generalizations multiline diff --git a/extra/vpri-talk/vpri-talk.factor b/extra/vpri-talk/vpri-talk.factor index 5d7620101f..1e5c9602b9 100644 --- a/extra/vpri-talk/vpri-talk.factor +++ b/extra/vpri-talk/vpri-talk.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: slides help.markup math arrays hashtables namespaces sequences kernel sequences parser memoize io.encodings.binary -locals kernel.private tools.vocabs.browser assocs quotations +locals kernel.private help.vocabs assocs quotations urls peg.ebnf tools.vocabs tools.annotations tools.crossref help.topics math.functions compiler.tree.optimizer compiler.cfg.optimizer fry ; -- 2.34.1