diff --git a/uppsrc/CtrlLib/CtrlUtil.cpp b/uppsrc/CtrlLib/CtrlUtil.cpp index 1aca37b8b..1280f4fb0 100644 --- a/uppsrc/CtrlLib/CtrlUtil.cpp +++ b/uppsrc/CtrlLib/CtrlUtil.cpp @@ -274,6 +274,12 @@ Event<> CtrlRetriever::operator<<(Event<> cb) return cb; } +void CtrlRetriever::Set() +{ + for(int i = 0; i < item.GetCount(); i++) + item[i].Set(); +} + void CtrlRetriever::Retrieve() { for(int i = 0; i < item.GetCount(); i++) diff --git a/uppsrc/CtrlLib/CtrlUtil.h b/uppsrc/CtrlLib/CtrlUtil.h index f56527a7c..bc99102a0 100644 --- a/uppsrc/CtrlLib/CtrlUtil.h +++ b/uppsrc/CtrlLib/CtrlUtil.h @@ -394,6 +394,7 @@ public: class CtrlRetriever { public: struct Item { + virtual void Set() = 0; virtual void Retrieve() = 0; virtual ~Item() {} }; @@ -407,6 +408,7 @@ private: struct CtrlItem : CtrlItem0 { T *value; + virtual void Set() { *ctrl <<= *value; } virtual void Retrieve() { *value = ~*ctrl; } virtual ~CtrlItem() {} }; @@ -422,6 +424,7 @@ public: template CtrlRetriever& operator()(Ctrl& ctrl, T& val) { Put(ctrl, val); return *this; } + void Set(); void Retrieve(); Event<> operator^=(Event<> cb); @@ -439,7 +442,7 @@ void CtrlRetriever::Put(Ctrl& ctrl, T& val) CtrlItem *m = new CtrlItem(); m->ctrl = &ctrl; m->value = &val; - ctrl <<= val; + m->Set(); Put(m); } diff --git a/uppsrc/CtrlLib/src.tpp/CtrlRetriever_en-us.tpp b/uppsrc/CtrlLib/src.tpp/CtrlRetriever_en-us.tpp index 9b11747a1..e0993c807 100644 --- a/uppsrc/CtrlLib/src.tpp/CtrlRetriever_en-us.tpp +++ b/uppsrc/CtrlLib/src.tpp/CtrlRetriever_en-us.tpp @@ -1,5 +1,4 @@ topic "CtrlRetriever"; -[2 $$0,0#00000000000000000000000000000000:Default] [i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class] [l288;2 $$2,2#27521748481378242620020725143825:desc] [0 $$3,0#96390100711032703541132217272105:end] @@ -9,6 +8,7 @@ topic "CtrlRetriever"; [l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param] [i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam] [b42;2 $$9,9#13035079074754324216151401829390:normal] +[2 $$0,0#00000000000000000000000000000000:Default] [{_} [ {{10000@(113.42.0) [s0;%% [*@7;4 CtrlRetriever]]}}&] [s0; &] @@ -33,6 +33,10 @@ ator()]([_^Upp`:`:Ctrl^ Ctrl][@(0.0.255) `&]_[*@3 ctrl], [*@4 T][@(0.0.255) `&]_ data mappings (to be used by Retrieve).&] [s3;%% &] [s4; &] +[s5;:Upp`:`:CtrlRetriever`:`:Set`(`): [@(0.0.255) void]_[* Set]()&] +[s2;%% Reassigns values to widgets.&] +[s3; &] +[s4; &] [s5;:Upp`:`:CtrlRetriever`:`:Retrieve`(`): [@(0.0.255) void]_[* Retrieve]()&] [s2;%% Moves data mapped using Put from widgets back to variables.&] [s3; &]