From: Mart Lubbers Date: Mon, 13 Mar 2017 13:34:13 +0000 (+0100) Subject: EDITORSgit add .! X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=f0f7587b66378846c8d09ef044eae394bc250e53;p=mTask.git EDITORSgit add .! --- diff --git a/Shares/mTaskShare.icl b/Shares/mTaskShare.icl index 0999cc2..cddc903 100644 --- a/Shares/mTaskShare.icl +++ b/Shares/mTaskShare.icl @@ -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 diff --git a/mTaskInterpret.icl b/mTaskInterpret.icl index 8da4585..538a5a9 100644 --- a/mTaskInterpret.icl +++ b/mTaskInterpret.icl @@ -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)