ide: Layout visgen improvements

git-svn-id: svn://ultimatepp.org/upp/trunk@10961 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2017-03-21 18:19:19 +00:00
parent 6e0ac3c1de
commit 148fcbc264
4 changed files with 19 additions and 6 deletions

View file

@ -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 <class T, class V>
template <class T>
void JsonizeArray(JsonIO& io, T& array)
{
if(io.IsLoading()) {

View file

@ -400,7 +400,7 @@ void Vector<T>::Xmlize(XmlIO& xio, const char *itemtag)
template <class T>
void Vector<T>::Jsonize(JsonIO& jio)
{
JsonizeArray<Vector<T>, T>(jio, *this);
JsonizeArray<Vector<T>>(jio, *this);
}
template <class C>
@ -603,7 +603,7 @@ void Array<T>::Xmlize(XmlIO& xio, const char *itemtag)
template <class T>
void Array<T>::Jsonize(JsonIO& jio)
{
JsonizeArray<Array<T>, T>(jio, *this);
JsonizeArray<Array<T>>(jio, *this);
}
template <class T>

View file

@ -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))

View file

@ -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";
}
}