]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/ui/operations/operations.factor
Fix conflict
[factor.git] / basis / ui / operations / operations.factor
index b938c2dc95050055dae1e0748909e06c122231ff..aa81899462bbb79e620491d0a84906a5ace57789 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays definitions kernel ui.commands
 ui.gestures sequences strings math words generic namespaces
-hashtables help.markup quotations assocs fry call ;
+hashtables help.markup quotations assocs fry call linked-assocs ;
 IN: ui.operations
 
 SYMBOL: +keyboard+
@@ -33,8 +33,11 @@ M: operation command-word command>> command-word ;
 
 SYMBOL: operations
 
+operations [ <linked-hash> ] initialize
+
 : object-operations ( obj -- operations )
-    operations get [ predicate>> call( obj -- ? ) ] with filter ;
+    operations get values
+    [ predicate>> call( obj -- ? ) ] with filter ;
 
 : gesture>operation ( gesture object -- operation/f )
     object-operations [ operation-gesture = ] with find nip ;
@@ -53,10 +56,14 @@ SYMBOL: operations
 : default-flags ( -- assoc )
     H{ { +keyboard+ f } { +primary+ f } { +secondary+ f } } ;
 
+: (define-operation) ( operation -- )
+    dup [ command>> ] [ predicate>> ] bi
+    2array operations get set-at ;
+
 : define-operation ( pred command flags -- )
     default-flags swap assoc-union
     dupd define-command <operation>
-    operations get push ;
+    (define-operation) ;
 
 : modify-operation ( translator operation -- operation )
     clone