diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index b112dc5750..25179b9f0e 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -56,17 +56,38 @@ - prettyprinter's highlighting of non-leaves doesn't really work - rollover is not updated on window focus changes - x11 input methods -- new browser: - - browse generic words and classes - - need actions for reloading the source file and opening word in jEdit - - highlight showing panes in originating list -- reimplement tab completion - cocoa: - horizontal wheel scrolling - polish OS X menu bar code - variable width word wrap - slider needs to be modelized ++ module system: + +- 'see' should show tuple constructors +- forgetting a class should remove its methods from all generic words +- forgetting a tuple class should forget the constructor +- seeing a tuple class should show the constructor +- C types should be words + - TYPEDEF: float { ... } { ... } ; ==> \ float T{ c-type ... } "c-type" swp + - TYPEDEF: float FTFloat ; ==> \ float \ FTFloat "c-type" swp + - make typedef aliasing explicit +- seeing a C struct word should show its def +- see by itself only shows the G: def +- { class generic } see supports forms: + { f generic } to show all methods + { class f } to show all methods +- modularize core +- TUPLE: module files tests articles article main ; +- methods: remember their file/line +- { class generic } jedit, reload DTRT +- requesting a list of assets loaded from a specific file +- T{ link f "foo" "bar" } see +- T{ link f "foo" "bar" } jedit +- T{ link f "foo" "bar" } reload +- file out +- make 'forget' generic + + compiler/ffi: - mac intel: struct returns from objc methods diff --git a/library/ui/backend.factor b/library/ui/backend.factor index eb5431844d..a09826ea0b 100644 --- a/library/ui/backend.factor +++ b/library/ui/backend.factor @@ -25,9 +25,13 @@ C: clipboard "" over set-clipboard-contents ; GENERIC: paste-clipboard ( gadget clipboard -- ) -M: object paste-clipboard ( gadget clipboard -- ) +M: object paste-clipboard clipboard-contents dup [ swap user-input ] [ 2drop ] if ; +GENERIC: copy-clipboard ( string gadget clipboard -- ) + +M: object copy-clipboard nip set-clipboard-contents ; + SYMBOL: clipboard SYMBOL: selection diff --git a/library/ui/text/commands.factor b/library/ui/text/commands.factor index 87b939901c..4231a2f0c3 100644 --- a/library/ui/text/commands.factor +++ b/library/ui/text/commands.factor @@ -15,7 +15,7 @@ sequences ; : editor-copy ( editor clipboard -- ) over editor-selection? [ - >r editor-selection r> set-clipboard-contents + >r [ editor-selection ] keep r> copy-clipboard ] [ 2drop ] if ; diff --git a/library/ui/x11/clipboard.factor b/library/ui/x11/clipboard.factor index 4520178db0..acfa87b763 100644 --- a/library/ui/x11/clipboard.factor +++ b/library/ui/x11/clipboard.factor @@ -27,7 +27,17 @@ IN: x11 r> selection-property 1 window-property ] if ; -TUPLE: x-clipboard atom ; +: own-selection ( prop win -- ) + dpy get -rot CurrentTime XSetSelectionOwner drop ; + +TUPLE: x-clipboard atom contents ; + +: x-clipboard@ ( gadget clipboard -- prop win ) + x-clipboard-atom swap find-world world-handle first ; + +M: x-clipboard copy-clipboard ( string gadget clipboard -- ) + [ x-clipboard@ own-selection ] keep + set-x-clipboard-contents ; M: x-clipboard paste-clipboard ( gadget clipboard -- ) >r find-world world-handle first r> x-clipboard-atom diff --git a/library/ui/x11/events.factor b/library/ui/x11/events.factor index e16e3c1c0f..932d743ca2 100644 --- a/library/ui/x11/events.factor +++ b/library/ui/x11/events.factor @@ -28,7 +28,9 @@ GENERIC: focus-in-event ( event window -- ) GENERIC: focus-out-event ( event window -- ) -GENERIC: selection-event ( event window -- ) +GENERIC: selection-notify-event ( event window -- ) + +GENERIC: selection-request-event ( event window -- ) GENERIC: client-event ( event window -- ) @@ -65,7 +67,8 @@ GENERIC: client-event ( event window -- ) { [ dup KeyRelease = ] [ drop key-up-event ] } { [ dup FocusIn = ] [ drop focus-in-event ] } { [ dup FocusOut = ] [ drop focus-out-event ] } - { [ dup SelectionNotify = ] [ drop selection-event ] } + { [ dup SelectionNotify = ] [ drop selection-notify-event ] } + { [ dup SelectionRequest = ] [ drop selection-request-event ] } { [ dup ClientMessage = ] [ drop client-event ] } { [ t ] [ 3drop ] } } cond ; diff --git a/library/ui/x11/ui.factor b/library/ui/x11/ui.factor index c0c7864d40..cd36000f30 100644 --- a/library/ui/x11/ui.factor +++ b/library/ui/x11/ui.factor @@ -102,10 +102,14 @@ M: world focus-in-event ( event world -- ) nip focus-world ; M: world focus-out-event ( event world -- ) nip unfocus-world ; -M: world selection-event ( event world -- ) +M: world selection-notify-event ( event world -- ) [ world-handle first selection-from-event ] keep world-focus user-input ; +M: world selection-request-event ( event world -- ) + USE: io + global [ "Hi" print flush ] bind ; + : close-box? ( event -- ? ) dup XClientMessageEvent-message_type "WM_PROTOCOLS" x-atom = swap XClientMessageEvent-data0 "WM_DELETE_WINDOW" x-atom =