EDITORSgit add .!
authorMart Lubbers <mart@martlubbers.net>
Mon, 13 Mar 2017 13:34:13 +0000 (14:34 +0100)
committerMart Lubbers <mart@martlubbers.net>
Mon, 13 Mar 2017 13:34:13 +0000 (14:34 +0100)
Shares/mTaskShare.icl
mTaskInterpret.icl

index 0999cc2..cddc903 100644 (file)
@@ -34,7 +34,6 @@ manageShares shares =
 //     >>= sendMessages [MTUpd identifier $ toString $ toByteCode a]
 //     >>| treturn sh
 
-
 viewShares :: [MTaskShare] -> Task MTaskShare
 viewShares sh = anyTask (map viewShare sh) <<@ ArrangeHorizontal
        >>| return (hd sh)
@@ -44,11 +43,11 @@ viewShare m = viewSharedInformation "" [] (getSDSShare m)
        <<@ Title ("SDS: " +++ toString m.identifier)
 
 getSDSShare :: MTaskShare -> Shared BCValue
-getSDSShare s=:{realShare=(MTaskWithShare id)}
-       = memoryShare id s.MTaskShare.value
+getSDSShare s=:{realShare=(MTaskWithShare id),value}
+       = memoryShare id value//s.MTaskShare.value
 
 makeShare :: String Int BCValue -> Task MTaskShare
-makeShare withTask identifier value = treturn 
+makeShare withTask identifier value=:(BCValue v) = treturn 
                {MTaskShare
                |withTask=withTask
                ,identifier=identifier
index 8da4585..538a5a9 100644 (file)
@@ -2,7 +2,8 @@ implementation module mTaskInterpret
 
 import Generics.gCons
 
-from iTasks.UI.Editor.Common import emptyEditor
+import iTasks.UI.Editor.Common
+import iTasks.UI.Editor
 
 import GenEq, StdMisc, StdArray, GenBimap
 import GenPrint
@@ -129,7 +130,7 @@ instance toByteCode UserLED where toByteCode s = {'L','\0',toChar $ consIndex{|*
 instance toByteCode BCValue where toByteCode (BCValue v) = toByteCode v
 
 instance fromByteCode Bool where fromByteCode s = fromByteCode s == 1
-instance fromByteCode Int where fromByteCode s = (toInt s.[0])*256 + toInt s.[1]
+instance fromByteCode Int where fromByteCode s = (toInt s.[1])*256 + toInt s.[2]
 instance fromByteCode Long where fromByteCode s = L $ fromByteCode s
 instance fromByteCode Char where fromByteCode s = fromInt $ fromByteCode s
 instance fromByteCode String where fromByteCode s = abort $ "Undef on fromBytecode String" +++ s
@@ -161,7 +162,15 @@ conses{|BCValue|} = [BCValue 0]
 consNum{|BCValue|} _ = 1
 gPrint{|BCValue|} v ps = gPrint{|*|} (readable $ BCPush v) ps
 
-gEditor{|BCValue|} = emptyEditor
+gEditor{|BCValue|} = {Editor|genUI=genUI`,onEdit=onEdit`,onRefresh=onRefresh`}
+       where
+               genUI` dp (BCValue a) vst = (castEditor a).Editor.genUI dp a vst
+               onEdit` dp jsn (BCValue a) em vst = appSnd3 BCValue $ (castEditor a).Editor.onEdit dp jsn a em vst
+               onRefresh` dp (BCValue a) (BCValue a`) em vst = appSnd3 BCValue $ (castEditor a).Editor.onRefresh dp a (fromByteCode $ toByteCode a`) em vst
+
+               castEditor :: a -> (Editor a) | mTaskType a
+               castEditor _ = gEditor{|*|}
+
 gText{|BCValue|} fm Nothing = []
 gText{|BCValue|} fm (Just (BCValue e)) = gText{|*|} fm (Just e)
 JSONEncode{|BCValue|} b (BCValue e) = JSONEncode{|*|} b (toByteCode e)