diff --git a/reference/CoPipe/CoPipe.cpp b/reference/CoPipe/CoPipe.cpp index 876335a0c..d3bd1f889 100644 --- a/reference/CoPipe/CoPipe.cpp +++ b/reference/CoPipe/CoPipe.cpp @@ -60,6 +60,4 @@ CONSOLE_APP_MAIN h.Do(fn); LOG(h.out); - - Thread::ShutdownThreads(); } diff --git a/reference/CoWork/main.cpp b/reference/CoWork/main.cpp index 9898e56e1..00fa28f61 100644 --- a/reference/CoWork/main.cpp +++ b/reference/CoWork/main.cpp @@ -60,22 +60,8 @@ void App::Paint(Draw& w) ImageBuffer ib(sz); if(cowork) { CoWork co; - for(int y = 0; y < sz.cy; y++) { - #ifdef CPP_11 - co & [=, &ib] { - RGBA *line = ib[y]; - Point c = sz / 2; - c = Point(int(sin((double)phase / 131) * c.x + c.x), int(sin((double)phase / 127) * c.y + c.y)); - int yy = (y - c.y) * (y - c.y); - for(int x = 0; x < sz.cx; x++) { - double d = (x - c.x) * (x - c.x) + yy; - line[x] = GrayColor((int)(120 + 120 * sin(d / 1000 - (double)phase / 5))); - } - }; - #else - co & callback4(DoLine, ib[y], phase, y, sz); - #endif - } + for(int y = 0; y < sz.cy; y++) + co & [=, &ib] { DoLine(ib[y], phase, y, sz); }; } else for(int y = 0; y < sz.cy; y++) diff --git a/reference/ColumnListDnD/main.cpp b/reference/ColumnListDnD/main.cpp index 110b6d4df..2d4557398 100644 --- a/reference/ColumnListDnD/main.cpp +++ b/reference/ColumnListDnD/main.cpp @@ -42,10 +42,10 @@ public: list.Columns(3); list.MultiSelect(); - list.WhenDropInsert = THISBACK(DropInsert); - list.WhenDropItem = THISBACK(DropSum); + list.WhenDropInsert = [=](int i, PasteClip& d) { DropInsert(i, d); }; + list.WhenDropItem = [=](int i, PasteClip& d) { DropSum(i, d); }; - list.WhenDrag = THISBACK(Drag); + list.WhenDrag = [=] { Drag(); }; for(int i = 0; i < 500; i++) list.Add(AsString(i)); diff --git a/reference/ConsoleDraw/main.cpp b/reference/ConsoleDraw/main.cpp index 614458148..228faa67b 100644 --- a/reference/ConsoleDraw/main.cpp +++ b/reference/ConsoleDraw/main.cpp @@ -17,7 +17,7 @@ CONSOLE_APP_MAIN { ImagePainter w(1500, 200); w.DrawRect(0, 0, 1500, 200, White()); txt.Paint(w, 0, 0, 1500); - PNGEncoder().SaveFile(GetHomeDirFile("richtext.png"), w); + PNGEncoder().SaveFile(GetHomeDirFile("richtext.png"), w); PdfDraw pdf; txt.Paint(pdf, 0, 0, 1000); diff --git a/reference/Convert/Convert.upp b/reference/Convert/Convert.upp index a59c8c2ac..dadf52263 100644 --- a/reference/Convert/Convert.upp +++ b/reference/Convert/Convert.upp @@ -1,4 +1,4 @@ -description "Using Convert to alter EditField for editing binary numbers"; +description "Using Convert to alter EditField for editing binary numbers\377"; uses CtrlLib; diff --git a/reference/Convert/init b/reference/Convert/init new file mode 100644 index 000000000..4e53fc16a --- /dev/null +++ b/reference/Convert/init @@ -0,0 +1,4 @@ +#ifndef _Convert_icpp_init_stub +#define _Convert_icpp_init_stub +#include "CtrlLib/init" +#endif diff --git a/reference/Convert/main.cpp b/reference/Convert/main.cpp index 21626749f..b1b76bdf3 100644 --- a/reference/Convert/main.cpp +++ b/reference/Convert/main.cpp @@ -31,19 +31,14 @@ struct App : TopWindow { EditField bin; EditInt dec; - void BinChanged() { dec <<= ~bin; } - void DecChanged() { bin <<= ~dec; } - - typedef App CLASSNAME; - App() { SetRect(0, 0, 200, 50); bin.SetConvert(Single()); Add(bin.HSizePos().TopPos(0, Ctrl::STDSIZE)); Add(dec.HSizePos().BottomPos(0, Ctrl::STDSIZE)); - bin <<= THISBACK(BinChanged); - dec <<= THISBACK(DecChanged); + bin << [=] { dec <<= ~bin; }; + dec << [=] { bin <<= ~dec; }; } }; diff --git a/reference/Cpp11/Cpp11.lay b/reference/Cpp11/Cpp11.lay deleted file mode 100644 index 6b9d268a2..000000000 --- a/reference/Cpp11/Cpp11.lay +++ /dev/null @@ -1,6 +0,0 @@ -LAYOUT(MyAppLayout, 212, 196) - ITEM(ArrayCtrl, list, LeftPosZ(4, 96).TopPosZ(4, 188)) - ITEM(EditInt, number, LeftPosZ(108, 96).TopPosZ(4, 19)) - ITEM(Button, add, SetLabel(t_("Add")).LeftPosZ(148, 56).TopPosZ(28, 20)) -END_LAYOUT - diff --git a/reference/Cpp11/Cpp11.upp b/reference/Cpp11/Cpp11.upp deleted file mode 100644 index fbd501ae2..000000000 --- a/reference/Cpp11/Cpp11.upp +++ /dev/null @@ -1,12 +0,0 @@ -description "Demostrates C++11 features\377"; - -uses - CtrlLib; - -file - main.cpp, - Cpp11.lay; - -mainconfig - "" = "GUI"; - diff --git a/reference/Cpp11/init b/reference/Cpp11/init deleted file mode 100644 index bc7d72d30..000000000 --- a/reference/Cpp11/init +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef _Cpp11_icpp_init_stub -#define _Cpp11_icpp_init_stub -#include "CtrlLib/init" -#endif diff --git a/reference/Cpp11/main.cpp b/reference/Cpp11/main.cpp deleted file mode 100644 index 0df8730f7..000000000 --- a/reference/Cpp11/main.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "CtrlLib/CtrlLib.h" - -using namespace Upp; - -#define LAYOUTFILE -#include - -#ifdef CPP_11 - -GUI_APP_MAIN -{ - WithMyAppLayout dlg; - CtrlLayout(dlg, "C++11 demo"); - dlg.list.NoHeader().AddColumn(); - Vector x = { 1, 2, 12, 34, 15, 11 }; - for(auto i : x) - dlg.list.Add(i); - dlg.add << [&] { - if(dlg.list.Find(~dlg.number) < 0) - dlg.list.Add(~dlg.number); - }; - dlg.list.WhenSel << [&] { - dlg.number <<= dlg.list.GetKey(); - }; - dlg.Execute(); -} - -#else - -struct MyApp : WithMyAppLayout { - typedef MyApp CLASSNAME; - - void Add() { - if(list.Find(~number) < 0) - list.Add(~number); - } - void Sel() { - number <<= list.GetKey(); - } - MyApp() { - CtrlLayout(*this, "C++ demo"); - list.NoHeader().AddColumn(); - Vector x; - x << 1 << 2 << 12 << 34 << 15 << 11; - for(int i = 0; i < x.GetCount(); i++) - list.Add(x[i]); - add <<= THISBACK(Add); - list.WhenSel = THISBACK(Sel); - } -}; - -GUI_APP_MAIN -{ - MyApp().Execute();; -} - -#endif