diff --git a/core/bootstrap/stage2.factor b/core/bootstrap/stage2.factor index 1a52781307..59daa3ab53 100755 --- a/core/bootstrap/stage2.factor +++ b/core/bootstrap/stage2.factor @@ -85,4 +85,6 @@ IN: bootstrap.stage2 "output-image" get resource-path save-image-and-exit ] if -] [ error-hook get call "listener" run ] recover +] [ + error-hook get call "listener" vocab-main execute +] recover diff --git a/extra/color-picker/color-picker.factor b/extra/color-picker/color-picker.factor old mode 100644 new mode 100755 index 62ea2e29ba..d8a18a6a8e --- a/extra/color-picker/color-picker.factor +++ b/extra/color-picker/color-picker.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2006, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel math math.functions math.parser models sequences -ui ui.gadgets ui.gadgets.controls ui.gadgets.frames +ui ui.gadgets ui.gadgets.frames ui.gadgets.labels ui.gadgets.packs ui.gadgets.sliders ui.render ; IN: color-picker @@ -11,9 +11,14 @@ IN: color-picker : ( model -- gadget ) 1 over set-slider-line ; +TUPLE: color-preview ; + : ( model -- gadget ) - { 100 100 } over set-rect-dim - [ set-gadget-interior ] ; + color-preview construct-control + { 100 100 } over set-rect-dim ; + +M: color-preview model-changed + dup control-value over set-gadget-interior relayout-1 ; : ( model -- model ) [ [ 256 /f ] map 1 add ] ; diff --git a/extra/destructors/destructors-docs.factor b/extra/destructors/destructors-docs.factor old mode 100644 new mode 100755 index dace054db8..695e3ed950 --- a/extra/destructors/destructors-docs.factor +++ b/extra/destructors/destructors-docs.factor @@ -23,7 +23,7 @@ HELP: close-later HELP: with-destructors { $values { "quot" "a quotation" } } -{ $description "Calls a quotation within a new dynamic scope. This quotation may register destructors, on any object, by wrapping the object in a destructor and implementing " { $link (destruct) } " on that object type. After the quotation finishes, if an error was thrown, all destructors are called and the error is then rethrown. However, if the quotation was successful, only those destructors created with an 'always cleanup' flag will be destroyed." } +{ $description "Calls a quotation within a new dynamic scope. This quotation may register destructors, on any object, by wrapping the object in a destructor and implementing " { $link destruct } " on that object type. After the quotation finishes, if an error was thrown, all destructors are called and the error is then rethrown. However, if the quotation was successful, only those destructors created with an 'always cleanup' flag will be destroyed." } { $notes "Destructors are not allowed to throw exceptions. No exceptions." } { $examples { $code "[ 10 malloc free-always ] with-destructors" } diff --git a/extra/io/windows/nt/backend/backend.factor b/extra/io/windows/nt/backend/backend.factor index c3a6bfd78b..2c6d152e3d 100755 --- a/extra/io/windows/nt/backend/backend.factor +++ b/extra/io/windows/nt/backend/backend.factor @@ -2,7 +2,8 @@ USING: alien alien.c-types arrays assocs combinators continuations destructors io io.backend io.nonblocking io.windows libc kernel math namespaces sequences threads tuples.lib windows windows.errors windows.kernel32 strings -splitting io.files windows.winsock ; +splitting io.files qualified ; +QUALIFIED: windows.winsock IN: io.windows.nt.backend : unicode-prefix ( -- seq ) @@ -62,14 +63,16 @@ C: io-callback : set-port-overlapped ( overlapped port -- ) port-handle set-win32-file-overlapped ; -: completion-port ( handle existing -- handle ) +: ( handle existing -- handle ) f 1 CreateIoCompletionPort dup win32-error=0/f ; -: master-completion-port ( -- handle ) - INVALID_HANDLE_VALUE f completion-port ; +SYMBOL: master-completion-port + +: ( -- handle ) + INVALID_HANDLE_VALUE f ; M: windows-nt-io add-completion ( handle -- ) - \ master-completion-port get-global completion-port drop ; + master-completion-port get-global drop ; TUPLE: GetOverlappedResult-args hFile* lpOverlapped* lpNumberOfBytesTransferred* bWait* port ; @@ -98,8 +101,8 @@ TUPLE: GetQueuedCompletionStatusParams hCompletionPort* lpNumberOfBytes* lpCompl C: GetQueuedCompletionStatusParams : wait-for-overlapped ( ms -- GetQueuedCompletionStatus-Params ret ) - >r \ master-completion-port get-global 0 - 0 0 r> [ + >r master-completion-port get-global 0 0 0 + r> [ GetQueuedCompletionStatusParams >tuple*< GetQueuedCompletionStatus ] keep swap ; @@ -146,7 +149,7 @@ M: windows-nt-io init-io ( -- ) #! Should only be called on startup. Calling this at any #! other time can have unintended consequences. global [ - master-completion-port \ master-completion-port set + master-completion-port set H{ } clone io-hash set - init-winsock + windows.winsock:init-winsock ] bind ; diff --git a/extra/models/models-docs.factor b/extra/models/models-docs.factor old mode 100644 new mode 100755 index 2b58381fe0..ace7a3ba03 --- a/extra/models/models-docs.factor +++ b/extra/models/models-docs.factor @@ -106,7 +106,7 @@ $nl ": 100 over set-slider-max ;" " 2array" "dup make-pile gadget." - "dup [ control-model ] map [ unparse ] " + "dup [ gadget-model ] map [ unparse ] " " gadget." } } ; @@ -146,7 +146,7 @@ HELP: delay ": " " 0 0 0 100 500 over set-slider-max ;" " dup gadget." - "control-model 500 [ number>string ] " + "gadget-model 500 [ number>string ] " " gadget." } } ; diff --git a/extra/slides/slides.factor b/extra/slides/slides.factor old mode 100644 new mode 100755 index 96ba21be1d..864361b302 --- a/extra/slides/slides.factor +++ b/extra/slides/slides.factor @@ -1,6 +1,6 @@ USING: arrays hashtables help.markup help.stylesheet io io.styles kernel math models namespaces sequences ui ui.gadgets -ui.gadgets.books ui.gadgets.controls ui.gadgets.panes +ui.gadgets.books ui.gadgets.panes ui.gestures ui.render ; IN: slides @@ -75,7 +75,7 @@ TUPLE: slides ; : change-page ( book n -- ) over control-value + over gadget-children length rem - swap control-model set-model ; + swap gadget-model set-model ; : next-page ( book -- ) 1 change-page ; diff --git a/extra/ui/gadgets/books/books-docs.factor b/extra/ui/gadgets/books/books-docs.factor old mode 100644 new mode 100755 index f253f0fc9d..14528cef07 --- a/extra/ui/gadgets/books/books-docs.factor +++ b/extra/ui/gadgets/books/books-docs.factor @@ -1,11 +1,11 @@ -USING: ui.gadgets.books ui.gadgets.controls help.markup +USING: ui.gadgets.books help.markup help.syntax ui.gadgets models ; HELP: book -{ $class-description "A book is a " { $link control } " containing one or more children. The " { $link control-value } " is the index of exactly one child to be visible at any one time, the rest being hidden by having their " { $link gadget-visible? } " slots set to " { $link f } ". The sole visible child assumes the dimensions of the book gadget." +{ $class-description "A book is a control containing one or more children. The " { $link control-value } " is the index of exactly one child to be visible at any one time, the rest being hidden by having their " { $link gadget-visible? } " slots set to " { $link f } ". The sole visible child assumes the dimensions of the book gadget." $nl "Books are created by calling " { $link } "." } ; HELP: { $values { "pages" "a sequence of gadgets" } { "model" model } { "book" book } } -{ $description "Creates a " { $link book } { $link control } ", which contains the gadgets in " { $snippet "pages" } ". A book shows one child at a time, determined by the value of the model, which must be an integer " } ; +{ $description "Creates a " { $link book } " control, which contains the gadgets in " { $snippet "pages" } ". A book shows one child at a time, determined by the value of the model, which must be an integer " } ; diff --git a/extra/ui/gadgets/books/books.factor b/extra/ui/gadgets/books/books.factor old mode 100644 new mode 100755 index 65dc138bf3..f9e3262e8e --- a/extra/ui/gadgets/books/books.factor +++ b/extra/ui/gadgets/books/books.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2006, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel sequences models ui.gadgets ui.gadgets.controls ; +USING: kernel sequences models ui.gadgets ; IN: ui.gadgets.books TUPLE: book ; diff --git a/extra/ui/gadgets/buttons/buttons-tests.factor b/extra/ui/gadgets/buttons/buttons-tests.factor old mode 100644 new mode 100755 index e093751fed..b8cf5892eb --- a/extra/ui/gadgets/buttons/buttons-tests.factor +++ b/extra/ui/gadgets/buttons/buttons-tests.factor @@ -1,6 +1,6 @@ IN: temporary USING: ui.commands ui.gadgets.buttons ui.gadgets.labels -ui.gadgets tools.test namespaces sequences kernel ; +ui.gadgets tools.test namespaces sequences kernel models ; TUPLE: foo-gadget ; @@ -17,3 +17,20 @@ T{ foo-gadget } "t" set [ 2 ] [ "t" get gadget-children length ] unit-test [ "Foo a" ] [ "t" get gadget-child gadget-child label-string ] unit-test + +[ ] [ + 2 { + { 0 "atheist" } + { 1 "christian" } + { 2 "muslim" } + { 3 "jewish" } + } "religion" set +] unit-test + +[ 0 ] [ + "religion" get gadget-child radio-control-value +] unit-test + +[ 2 ] [ + "religion" get gadget-child control-value +] unit-test diff --git a/extra/ui/gadgets/buttons/buttons.factor b/extra/ui/gadgets/buttons/buttons.factor old mode 100644 new mode 100755 index a4fc5a7c21..6c10a11d3c --- a/extra/ui/gadgets/buttons/buttons.factor +++ b/extra/ui/gadgets/buttons/buttons.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2005, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: arrays ui.commands ui.gadgets ui.gadgets.borders -ui.gadgets.controls ui.gadgets.labels ui.gadgets.theme +ui.gadgets.labels ui.gadgets.theme ui.gadgets.tracks ui.gadgets.packs ui.gadgets.worlds ui.gestures ui.render kernel math models namespaces sequences strings quotations assocs combinators classes colors tuples opengl @@ -131,13 +131,18 @@ M: checkmark-paint draw-interior { 5 5 } over set-pack-gap 1/2 swap set-pack-align ; +TUPLE: checkbox ; + : ( model label -- checkbox ) label-on-right over [ toggle-model drop ] curry