diff --git a/uppsrc/Core/JSON.h b/uppsrc/Core/JSON.h index b3d8f1c5b..572794e61 100644 --- a/uppsrc/Core/JSON.h +++ b/uppsrc/Core/JSON.h @@ -201,7 +201,7 @@ template<> void Jsonize(JsonIO& io, WString& var); template<> void Jsonize(JsonIO& io, Date& var); template<> void Jsonize(JsonIO& io, Time& var); -template +template void JsonizeArray(JsonIO& io, T& array) { if(io.IsLoading()) { diff --git a/uppsrc/Core/Vcont.hpp b/uppsrc/Core/Vcont.hpp index 6ea220571..636d7c9fc 100644 --- a/uppsrc/Core/Vcont.hpp +++ b/uppsrc/Core/Vcont.hpp @@ -400,7 +400,7 @@ void Vector::Xmlize(XmlIO& xio, const char *itemtag) template void Vector::Jsonize(JsonIO& jio) { - JsonizeArray, T>(jio, *this); + JsonizeArray>(jio, *this); } template @@ -603,7 +603,7 @@ void Array::Xmlize(XmlIO& xio, const char *itemtag) template void Array::Jsonize(JsonIO& jio) { - JsonizeArray, T>(jio, *this); + JsonizeArray>(jio, *this); } template diff --git a/uppsrc/ide/LayDes/LayDes.lay b/uppsrc/ide/LayDes/LayDes.lay index a0bdb0083..21e45af88 100644 --- a/uppsrc/ide/LayDes/LayDes.lay +++ b/uppsrc/ide/LayDes/LayDes.lay @@ -79,7 +79,8 @@ LAYOUT(VisGenLayout, 724, 488) ITEM(Option, name2, SetLabel(t_("name.")).LeftPosZ(88, 68).TopPosZ(304, 15)) ITEM(Option, dname2, SetLabel(t_(".name")).LeftPosZ(88, 68).TopPosZ(320, 15)) ITEM(Option, quotes2, SetLabel(t_("Quotes")).LeftPosZ(88, 68).TopPosZ(336, 15)) - ITEM(Option, buttons, SetLabel(t_("Create button events")).LeftPosZ(4, 152).TopPosZ(368, 16)) + ITEM(Option, buttons, SetLabel(t_("Create button events")).LeftPosZ(4, 156).TopPosZ(368, 16)) + ITEM(Option, lambdas, SetLabel(t_("Assign lambdas to buttons")).LeftPosZ(4, 156).TopPosZ(388, 16)) ITEM(CodeEditor, view, LeftPosZ(172, 544).TopPosZ(8, 440)) ITEM(Button, ok, SetLabel(t_("Copy to clipboard")).LeftPosZ(524, 124).TopPosZ(456, 24)) ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(652, 64).TopPosZ(456, 24)) diff --git a/uppsrc/ide/LayDes/visgen.cpp b/uppsrc/ide/LayDes/visgen.cpp index f6997a5cd..8dcf0da52 100644 --- a/uppsrc/ide/LayDes/visgen.cpp +++ b/uppsrc/ide/LayDes/visgen.cpp @@ -75,6 +75,16 @@ void VisGenDlg::Refresh() n = GetName(); String b1, b2, b3; + if(lambdas) { + for(int i = 0; i < layout.item.GetCount(); i++) { + String bn = layout.item[i].variable; + if(layout.item[i].type == "Button" && findarg(bn, "cancel", "ok", "exit") < 0) { + if(b2.GetCount() == 0) + b2 = "\n"; + b2 << '\t' << bn << " << [=] { };\n"; + } + } + } if(buttons) { for(int i = 0; i < layout.item.GetCount(); i++) { String bn = layout.item[i].variable; @@ -82,9 +92,11 @@ void VisGenDlg::Refresh() String mn = IdInitCaps(bn); mn.Replace("_", ""); if(b1.GetCount() == 0) - b1 = b2 = "\n"; + b1 = "\n"; + if(b2.GetCount() == 0) + b2 = "\n"; b1 << '\t' << "void " << mn << "();\n"; - b2 << '\t' << bn << " << [=] { " << mn << "};\n"; + b2 << '\t' << bn << " << [=] { " << mn << "(); };\n"; b3 << '\n' << "void " << n << "::" << mn << "()\n{\n}\n"; } }