Clipboard paste now works with Cocoa

slava 2006-06-03 06:55:57 +00:00
parent d9f076c73f
commit f71eeed3e3
5 changed files with 14 additions and 7 deletions

View File

@ -21,6 +21,7 @@
- get factor running on mac intel
- constant branch folding
- cocoa: starting the UI with +foo switches opens them as files
- pasting from clipboard on x11
+ refactor style stack code so that nested styles are handled at a lower-level
- in HTML, we can nest div tags, etc

View File

@ -1,7 +1,8 @@
! Copyright (C) 2006 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
IN: cocoa
USING: arrays gadgets kernel objc objc-classes sequences ;
USING: arrays gadgets kernel namespaces objc objc-classes
sequences ;
: NSStringPboardType "NSStringPboardType" ;
@ -27,3 +28,7 @@ M: pasteboard clipboard-contents ( pb -- str )
M: pasteboard set-clipboard-contents ( str pb -- )
pasteboard-handle set-pasteboard-string ;
: init-clipboard ( -- )
NSPasteboard -> generalPasteboard <pasteboard>
clipboard set-global ;

View File

@ -26,6 +26,7 @@ namespaces objc sequences errors freetype ;
reset-callbacks
install-app-delegate
register-services
init-clipboard
default-main-menu ;
: rect>NSRect

View File

@ -85,8 +85,8 @@ opengl sequences ;
[ -> deltaY 0 > ] 2keep mouse-location
rot window send-wheel ;
: send-action ( view event class -- f )
>r drop window r> handle-action f ;
: send-action ( view event gesture -- junk )
-rot drop window world-focus handle-gesture drop f ;
: add-resize-observer ( observer object -- )
>r "updateFactorGadgetSize:"
@ -163,15 +163,15 @@ opengl sequences ;
}
{ "cut:" "id" { "id" "SEL" "id" }
[ nip <cut-action> send-action ]
[ nip T{ cut-action } send-action ]
}
{ "copy:" "id" { "id" "SEL" "id" }
[ nip <copy-action> send-action ]
[ nip T{ copy-action } send-action ]
}
{ "paste:" "id" { "id" "SEL" "id" }
[ nip <paste-action> send-action ]
[ nip T{ paste-action } send-action ]
}
{ "updateFactorGadgetSize:" "void" { "id" "SEL" "id" }

View File

@ -49,7 +49,7 @@ TUPLE: slider-changed ;
] [
[ set-slider-value ] keep
dup slider-elevator relayout-1
<slider-changed> handle-action
T{ slider-changed } swap handle-gesture drop
] if ;
TUPLE: thumb ;