]> gitweb.factorcode.org Git - factor.git/commitdiff
Documentation updates, menus fix
authorslava <slava@factorcode.org>
Tue, 10 Oct 2006 03:57:32 +0000 (03:57 +0000)
committerslava <slava@factorcode.org>
Tue, 10 Oct 2006 03:57:32 +0000 (03:57 +0000)
18 files changed:
TODO.FACTOR.txt
doc/handbook/ui/tools.facts
library/tools/listener.factor
library/ui/cocoa/view-utils.factor
library/ui/cocoa/window-utils.factor
library/ui/gadgets/menus.factor
library/ui/load.factor
library/ui/text/commands.factor
library/ui/text/editor.facts [new file with mode: 0644]
library/ui/text/interactor.factor
library/ui/tools/browser.factor
library/ui/tools/dataflow.factor
library/ui/tools/listener.factor
library/ui/tools/operations.factor
library/ui/tools/walker.factor
library/ui/tools/workspace.factor
library/ui/ui.factor
library/ui/world.factor

index 7755e8159278673298d6cc4a3fbf8fea8efb33d4..77486288b665b5109a606e55d7909b0ccee27132 100644 (file)
@@ -2,8 +2,6 @@
 - fix alien-callback/SEH bug on win32
 - x11: scroll up/down wiggles caret
 - tab completion: add a USE: if necessary
-- cocoa: horizontal wheel scrolling
-- rollover is not updated on window focus changes
 - cocoa: windows are not updated while resizing
 
 + ui:
index e055225e135caacbe1e90465524f59046505bace..52ce942427c2024b242ad6aa4f24ef2033a9f493 100644 (file)
@@ -1,7 +1,7 @@
 USING: gadgets gadgets-listener gadgets-browser gadgets-help
 gadgets-presentations gadgets-walker gadgets-dataflow
 gadgets-workspace help gadgets-panes gadgets-text listener
-definitions prettyprint io parser ;
+definitions prettyprint io parser modules compiler ;
 
 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."
@@ -21,26 +21,38 @@ ARTICLE: "ui-listener" "UI listener"
     "Completion"
     { "Clickable presentations (see " { $link "ui-presentations" } ")" }
 }
-"The below completion commands display a gadget at the bottom of the listener, known as the mini-buffer. Typing more text narrows down the list of available items. The " { $snippet "UP" } " and " { $snippet "DOWN" } " arrow keys shift the selection between listed items, and the " { $snippet "RETURN" } " key invokes a default operation for the selected item."
-{ $commands listener-gadget }
-"The below word commands operate on the token at the caret position in the input area. The quotation commands operate on the entire contents of the input area."
-{ $commands interactor }
+{ $heading "Listener commands" }
+{ $commands listener-gadget "toolbar" }
+{ $heading "Interactor commands" }
+{ $commands interactor "interactor" }
+{ $heading "Completion" }
+"Completion commands display a gadget at the bottom of the listener, known as the mini-buffer. Typing more text narrows down the list of available items. The " { $snippet "UP" } " and " { $snippet "DOWN" } " arrow keys shift the selection between listed items, and the " { $snippet "RETURN" } " key invokes a default operation for the selected item."
+{ $commands listener-gadget "completion" }
+{ $heading "Word commands" }
+"These commands operate on the token at the caret position in the input area."
+{ $commands interactor "words" }
+{ $heading "Quotation commands" }
+"These commands operate on the entire contents of the input area."
+{ $commands interactor "quotations" }
+{ $heading "Editing commands" }
+"The text editing commands are standard and are documented in the " { $link editor } " class."
+{ $heading "Implementation" }
 "Listeners are instances of " { $link listener-gadget } ". The listener consists of an output area (instance of " { $link pane } "), an input area (instance of " { $link interactor } "), and a stack display kept up to date using a " { $link listener-hook } "." ;
 
 ARTICLE: "ui-browser" "UI definition browser"
-{ $commands browser }
+{ $commands browser "toolbar" }
 "Definition browsers are instances of " { $link browser } "." ;
 
 ARTICLE: "ui-help" "UI documentation browser"
 "The documentation browser is used to display Factor documentation, which is rooted at the " { $link "handbook" } " page."
-{ $commands help-gadget }
+{ $commands help-gadget "toolbar" }
 "Documentation browsers are instances of " { $link help-gadget } "." ;
 
 ARTICLE: "ui-walker" "UI walker"
 "The walker single-steps through quotations. To use the walker, enter a piece of code in the listener's input area and press " { $snippet "C+A+w" } "."
 $terpri
 "The walker can travel backwards through time, and restore stacks. This does not undo side effects and therefore can only be used reliably on referentially transparent code."
-{ $commands walker-gadget }
+{ $commands walker-gadget "toolbar" }
 "Walkers are instances of " { $link walker-gadget } "." ;
 
 ARTICLE: "ui-dataflow" "UI dataflow tool"
@@ -49,7 +61,7 @@ $terpri
 "Only quotations and words for which a stack effect can be inferred can be viewed. See " { $link "inference" } "."
 $terpri
 "The dataflow viewer displays the dataflow intermediate representation output by the compiler's optimizer. Therefore inlining and various other optimizations will have already been performed, and the visual representation may not resemble your original code in many ways. An upside of this arrangement is that the dataflow viewer can be used to predict how fast the code will run, because you will see which layers of generic dispatch have been optimized out at compile time."
-{ $commands dataflow-gadget }
+{ $commands dataflow-gadget "toolbar" }
 "Dataflow viewers are instances of " { $link dataflow-gadget } "." ;
 
 ARTICLE: "ui-cocoa" "Functionality specific to Mac OS X"
@@ -77,9 +89,21 @@ $terpri
     { "Single stepping through the code makes the problem obvious, so you right-click on a presentation of the broken word in the stepper, and choose " { $strong "Edit" } " from the resulting popup menu." }
     { "After fixing the problem in the source editor, you right click on the word in the stepper and invoke " { $strong "Reload" } "." }
 }
-"All development tools are integrated into a single-window " { $emphasis "workspace" } ". Multiple workspaces can be open at once, and keyboard commands are provided for switching between tools."
-{ $commands workspace }
+{ $heading "Switching tools" }
+"All development tools are integrated into a single-window " { $emphasis "workspace" } "."
+{ $commands workspace "tool-switch" }
+{ $heading "Opening new windows" }
+"Multiple workspace windows can be open at once."
+{ $commands workspace "tool-window" }
+{ $heading "Scrolling" }
+"The current tool's scroll pane can be scrolled from the keyboard."
+{ $commands workspace "scrolling" }
+{ $heading "Workflow" }
+"A pair of commands for invoking " { $link reload-modules } " and " { $link recompile } "."
+{ $commands workspace "workflow" }
+{ $heading "Implementation" }
 "Workspaces are instances of " { $link workspace-window } "."
+{ $heading "Tools" }
 { $subsection "ui-presentations" }
 { $subsection "ui-listener" }
 { $subsection "ui-browser" }
index deb1e91c63864239dc63a9f5b5cebe0b56615d04..3c8e46be4e5d6178b5e2a229eaf986d864ca0048 100644 (file)
@@ -12,12 +12,12 @@ SYMBOL: listener-hook
 : (read-multiline) ( quot depth -- newquot ? )
     >r readln dup [
         (parse) depth r> dup >r <= [
-            ( we're done ) r> drop t
+            r> drop t
         ] [
-            ( more input needed ) r> (read-multiline)
+            r> (read-multiline)
         ] if
     ] [
-        ( EOF ) r> 2drop f
+        r> 2drop f
     ] if ;
 
 : read-multiline ( -- quot ? )
index 3d895f53c95b128b4f47607cd02d9d90fe4e9e82..50ed465501b056c27cce1386782c33bfb4230347 100644 (file)
@@ -246,6 +246,7 @@ opengl sequences ;
         [
             [
                 2drop dup view-dim swap window set-gadget-dim
+                ui-step
             ] ui-try
         ]
     }
index 88cd43b276383fbea10604cbd074700ee674dcd3..8752b579cd0f0790c568547ae87345f2dd38a789 100644 (file)
@@ -73,6 +73,7 @@ USING: arrays gadgets kernel math objc sequences ;
 
     {
         "windowDidResignKey:" "void" { "id" "SEL" "id" } [
+            forget-rollover
             2nip -> object -> contentView window unfocus-world
         ]
     }
index d8860abe0c8365e9366d998eaa282b9e7ae9335a..267cb18feae341aee9b9a0df00292d8d3d815787 100644 (file)
@@ -23,11 +23,8 @@ M: menu-glass layout* gadget-child prefer ;
         hand-loc get-global swap find-world move-hand
     ] if ;
 
-: hide-menu ( -- )
-    find-world hide-glass f menu-mode? set-global ;
-
 \ menu-glass H{
-    { T{ button-up } [ hide-menu ] }
+    { T{ button-up } [ find-world hide-glass ] }
     { T{ drag } [ retarget-drag ] }
 } set-gestures
 
index 1bc8573397b18badd30810b03af0705a3ef54a36..821613e549b5863b30b53cc02d2074c7dd14ffa1 100644 (file)
@@ -47,6 +47,7 @@ PROVIDE: library/ui {
     "tools/dataflow.factor"
     "tools/workspace.factor"
     "tools/operations.factor"
+    "text/editor.facts"
 } {
     "test/gadgets.factor"
     "test/models.factor"
index b5409d342e8414100908c951186b4acde324607d..0f4e3f10935ce23afa016c4daa977883cfbe03a5 100644 (file)
@@ -70,7 +70,7 @@ USING: gadgets kernel models namespaces sequences ;
     [ dup T{ word-elt } select-elt ] unless
     gadget-selection ;
 
-editor "Editing commands" {
+editor "editing" {
     { "Insert newline" T{ key-down f f "RETURN" } [ "\n" swap user-input ] }
     { "Insert newline" T{ key-down f { S+ } "RETURN" } [ "\n" swap user-input ] }
     { "Insert newline" T{ key-down f f "ENTER" } [ "\n" swap user-input ] }
@@ -82,7 +82,7 @@ editor "Editing commands" {
     { "Delete to end of line" T{ key-down f { A+ } "BACKSPACE" } [ T{ one-line-elt } editor-backspace ] }
 } define-commands
 
-editor "Clipboard commands" {
+editor "clipboard" {
     { "Paste" T{ paste-action } [ clipboard get paste-clipboard ] }
     { "Paste selection" T{ button-up f f 2 } [ selection get paste-clipboard ] }
     { "Copy" T{ copy-action } [ clipboard get editor-copy ] }
@@ -90,7 +90,7 @@ editor "Clipboard commands" {
     { "Cut" T{ cut-action } [ clipboard get editor-cut ] }
 } define-commands
 
-editor "Caret motion commands" {
+editor "caret" {
     { "Position caret" T{ button-down } [ editor-mouse-down ] }
     { "Previous character" T{ key-down f f "LEFT" } [ T{ char-elt } editor-prev ] }
     { "Next character" T{ key-down f f "RIGHT" } [ T{ char-elt } editor-next ] }
@@ -104,7 +104,7 @@ editor "Caret motion commands" {
     { "End of document" T{ key-down f { C+ } "END" } [ editor-doc-end ] }
 } define-commands
     
-editor "Text selection commands" {
+editor "selection" {
     { "Extend selection" T{ button-down f { S+ } } [ editor-extend-selection ] }
     { "Start selection" T{ drag } [ editor-mouse-drag ] }
     { "Focus editor" T{ gain-focus } [ focus-editor ] }
diff --git a/library/ui/text/editor.facts b/library/ui/text/editor.facts
new file mode 100644 (file)
index 0000000..5e0e12d
--- /dev/null
@@ -0,0 +1,13 @@
+IN: gadgets-text
+USING: help gadgets ;
+
+HELP: editor
+{ $class-description "Instances of this class are multi-line text editors which edit an underlying " { $link document } " model."
+$terpri
+"The " { $link interactor } " gadget is built off the " { $link editor } " gadget and is used by the " { $link "ui-listener" } "." }
+{ $heading "General commands" }
+{ $commands editor "editing" }
+{ $heading "Caret motion commands" }
+{ $commands editor "caret" }
+{ $heading "Selection commands" }
+{ $commands editor "selection" } ;
index 7545f0b361273761de3d266fc8858dc2c44ea5d7..7a52067465f6df9180e3e8039ec101c2fa8d9b06 100644 (file)
@@ -58,7 +58,7 @@ M: interactor stream-readln
         [ over set-interactor-continuation stop ] callcc0
     ] when interactor-queue pop ;
 
-interactor "Interactor commands" {
+interactor "interactor" {
     { "Evaluate" T{ key-down f f "RETURN" } [ interactor-commit ] }
     { "Clear input" T{ key-down f { C+ } "k" } [ control-model clear-doc ] }
 } define-commands
index 5568b9be455cd433d0447e30cfe1e57bc6bd0c76..259488764f98e121513e68efb0634b4cb70ace5f 100644 (file)
@@ -115,7 +115,7 @@ M: browser focusable-child* browser-search ;
 : clear-browser ( browser -- )
     browser-definitions close-definitions ;
 
-browser "Toolbar" {
+browser "toolbar" {
     { "Clear" T{ key-down f f "CLEAR" } [ clear-browser ] }
 } define-commands
 
index 1d0258052e737414ff00cc562070dfb061425012..5965b08450d6ed6c9c8549217cfe73436b2a056f 100644 (file)
@@ -188,7 +188,7 @@ DEFER: (compute-heights)
 ! The UI tool
 TUPLE: dataflow-gadget history ;
 
-dataflow-gadget "Toolbar" {
+dataflow-gadget "toolbar" {
     { "Back" T{ key-down f { C+ } "b" } [ dataflow-gadget-history go-back ] }
     { "Forward" T{ key-down f { C+ } "f" } [ dataflow-gadget-history go-forward ] }
 } define-commands
index 1f89214f3b0f3728194ffb61ab40e2ee03b4b4f2..23aa5e485606112d8aa8fba4cc22dce976d2a567 100644 (file)
@@ -8,9 +8,10 @@ generic hashtables tools io kernel listener math models
 namespaces parser prettyprint sequences shells strings styles
 threads words definitions help ;
 
-TUPLE: listener-gadget input output stack minibuffer ;
+TUPLE: listener-gadget input output stack use minibuffer ;
 
 : ui-listener-hook ( listener -- )
+    use get over set-listener-gadget-use
     >r datastack r> listener-gadget-stack set-model ;
 
 : listener-stream ( listener -- stream )
@@ -151,7 +152,7 @@ M: listener-gadget tool-help
 : insert-completion ( completion -- )
     word-name find-listener listener-gadget-input user-input ;
 
-listener-gadget "Toolbar" {
+listener-gadget "toolbar" {
     { "Restart" T{ key-down f { C+ } "r" } [ start-listener ] }
     {
         "History"
@@ -171,7 +172,7 @@ listener-gadget "Toolbar" {
     { "Send EOF" T{ key-down f { C+ } "d" } [ listener-eof ] }
 } define-commands
 
-listener-gadget "Completion commands" {
+listener-gadget "completion" {
     {
         "Complete word"
         T{ key-down f f "TAB" }
index 65b1c6fd70fe3b4f5df88b73a71a7bf7af52d318..ea7935e1bc4008fb3c0caeb5effbc89cc4b8ad77 100644 (file)
@@ -187,7 +187,7 @@ M: operation invoke-command ( target operation -- )
 ! Define commands in terms of operations
 
 ! Tile commands
-tile "Toolbar"
+tile "toolbar"
 \ word class-operations [ tile-definition ] modify-operations
 [ command-name "Browse" = not ] subset
 { "Close" f [ close-tile ] } add*
@@ -200,17 +200,17 @@ define-commands
 : quot-action ( interactor -- quot )
     dup editor-text swap select-all parse ;
 
-interactor "Word commands"
+interactor "words"
 \ word class-operations
 [ word-action ] modify-listener-operations
 define-commands
 
-interactor "Quotation commands"
+interactor "quotations"
 quotation class-operations
 [ quot-action ] modify-listener-operations
 define-commands
 
-help-gadget "Toolbar" {
+help-gadget "toolbar" {
     { "Back" T{ key-down f { C+ } "b" } [ help-gadget-history go-back ] }
     { "Forward" T{ key-down f { C+ } "f" } [ help-gadget-history go-forward ] }
     { "Home" T{ key-down f { C+ } "h" } [ go-home ] }
index 05ec4b6701236aa7e29796ad0360ad512a7dd08a..5c79f2b55eaeb30bf3e20ffbfd8c1d7c7766beae 100644 (file)
@@ -77,7 +77,7 @@ M: walker-gadget tool-help drop "ui-walker" ;
     dup [ step-all ] walker-command reset-walker
     find-workspace listener-gadget select-tool ;
 
-walker-gadget "Toolbar" {
+walker-gadget "toolbar" {
     { "Step" T{ key-down f f "s" } [ walker-step ] }
     { "Step in" T{ key-down f f "i" } [ walker-step-in ] }
     { "Step out" T{ key-down f f "o" } [ walker-step-out ] }
index 8ea6ed68e566a5edbc219831eebe19513a4e6f9a..40aa5cac97a449ee9c764fec4720dc00109489ae 100644 (file)
@@ -40,7 +40,7 @@ M: tool tool-help tool-gadget tool-help ;
 : tool-help-window ( tool -- )
     tool-help [ help-window ] when* ;
 
-tool "Tool commands" {
+tool "toolbar" {
     { "Tool help" T{ key-down f f "F1" } [ tool-help-window ] }
 } define-commands
 
@@ -86,12 +86,12 @@ M: workspace pref-dim* delegate pref-dim* { 550 650 } vmax ;
 : tool-scroll-down ( workspace -- )
     current-page tool-scroller [ scroll-down-page ] when* ;
 
-workspace "Scrolling primary pane" {
+workspace "scrolling" {
     { "Scroll up" T{ key-down f { C+ } "PAGE_UP" } [ tool-scroll-up ] }
     { "Scroll down" T{ key-down f { C+ } "PAGE_DOWN" } [ tool-scroll-down ] }
 } define-commands
 
-workspace "Tool switching commands" {
+workspace "tool-switch" {
     { "Listener" T{ key-down f f "F2" } [ listener-gadget select-tool ] }
     { "Messages" T{ key-down f f "F3" } [ messages select-tool ] }
     { "Definitions" T{ key-down f f "F4" } [ browser select-tool ] }
@@ -100,13 +100,13 @@ workspace "Tool switching commands" {
     { "Dataflow" T{ key-down f f "F7" } [ dataflow-gadget select-tool ] }
 } define-commands
 
-workspace "Tool window commands" {
+workspace "tool-window" {
     { "New listener" T{ key-down f { S+ } "F2" } [ listener-gadget tool-window drop ] }
     { "New definitions" T{ key-down f { S+ } "F3" } [ browser tool-window drop ] }
     { "New documentation" T{ key-down f { S+ } "F4" } [ help-gadget tool-window drop ] }
 } define-commands
 
-workspace "Workflow commands" {
+workspace "workflow" {
     { "Reload changed sources" T{ key-down f f "F8" } [ drop [ reload-modules ] call-listener ] }
     { "Recompile changed words" T{ key-down f { S+ } "F8" } [ drop [ recompile ] call-listener ] }
 } define-commands
index 77bcb3ea241fb5b03c21ff46e84ca2ed35afcccc..7867beffffbc3817464c7f16481de724a4a96f24 100644 (file)
@@ -120,7 +120,7 @@ C: titled-gadget ( gadget title -- )
     windows get [ empty? not ] [ f ] if* ;
 
 : <toolbar> ( target classes -- toolbar )
-    [ commands "Toolbar" swap hash ] map concat
+    [ commands "toolbar" swap hash ] map concat
     [ <command-presentation> ] map-with
     make-shelf ;
 
@@ -128,19 +128,14 @@ C: titled-gadget ( gadget title -- )
     dup command-name swap command-gesture gesture>string
     2array ;
 
-: command-table. ( commands group -- )
-    $heading
+: commands. ( commands -- )
     [ command-gesture key-down? ] subset
     [ command-description ] map
-    { "Command" "Shortcut" } add* $table ;
-
-: commands. ( hash -- )
-    hash>alist
-    [ [ first ] 2apply <=> ] sort
-    [ first2 swap command-table. ] each ;
+    { { $strong "Command" } { $strong "Shortcut" } } add*
+    $table ;
 
 : $commands ( elt -- )
-    dup array? [ first ] when commands commands. ;
+    first2 swap commands hash commands. ;
 
 TUPLE: labelled-gadget content ;
 
index e1af1a43b35bae9cfe9120a2395a8fc7bc76712c..2846ac58746ab88d075354fe96189dd6786d0eca 100644 (file)
@@ -74,6 +74,7 @@ M: world layout*
     ] when* drop ;
 
 : hide-glass ( world -- )
+    f menu-mode? set-global
     dup world-glass [ unparent ] when*
     f swap set-world-glass ;