diff --git a/uppdev/Debug/Debug.cpp b/uppdev/Debug/Debug.cpp new file mode 100644 index 000000000..524db2378 --- /dev/null +++ b/uppdev/Debug/Debug.cpp @@ -0,0 +1,11 @@ +#include + +using namespace Upp; + +CONSOLE_APP_MAIN +{ + int a[3]; + a[0] = 2; + a[1] = 3; + Cout() << a[0]; +} diff --git a/uppdev/Debug/Debug.upp b/uppdev/Debug/Debug.upp new file mode 100644 index 000000000..5ba4cc901 --- /dev/null +++ b/uppdev/Debug/Debug.upp @@ -0,0 +1,9 @@ +uses + Core; + +file + Debug.cpp; + +mainconfig + "" = ""; + diff --git a/uppdev/EditField/main.cpp b/uppdev/EditField/main.cpp index 1974b9f4b..56e2d01bf 100644 --- a/uppdev/EditField/main.cpp +++ b/uppdev/EditField/main.cpp @@ -3,6 +3,7 @@ void EditFieldApp::Set() { ef1 <<= "Just a test!"; + ef1.SetReadOnly(); } EditFieldApp::EditFieldApp() diff --git a/uppdev/FileSel/main.cpp b/uppdev/FileSel/main.cpp index a66524200..bace7e90f 100644 --- a/uppdev/FileSel/main.cpp +++ b/uppdev/FileSel/main.cpp @@ -22,7 +22,8 @@ GUI_APP_MAIN fs.Multi(); // fs.ActiveDir("/usr/include"); // fs.NoEditFileName(); -// fs.PreSelect("U:/file1.txt"); + fs.ActiveDir("c:/"); + fs.PreSelect("U:/log.txt"); for(;;) { if(!fs.ExecuteSaveAs()) break; diff --git a/uppdev/MetricsIssue/MetricsIssue.upp b/uppdev/MetricsIssue/MetricsIssue.upp new file mode 100644 index 000000000..5872304d3 --- /dev/null +++ b/uppdev/MetricsIssue/MetricsIssue.upp @@ -0,0 +1,9 @@ +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/uppdev/MetricsIssue/main.cpp b/uppdev/MetricsIssue/main.cpp new file mode 100644 index 000000000..7f3036415 --- /dev/null +++ b/uppdev/MetricsIssue/main.cpp @@ -0,0 +1,27 @@ +#include + +using namespace Upp; + +struct Test : TopWindow { + virtual void Paint(Draw& w) { + w.DrawRect(GetSize(), White()); + w.DrawText(100, 100, WString(0x9500, 1)); + } +}; + +GUI_APP_MAIN +{ +/* Font f = Arial(40); + DDUMP(f[0xbd]); + DDUMP(f['X']); + + WString x("销"); + DDUMP(FormatIntHex(x[0])); + + for(int i = 1; i < Font::GetFaceCount(); i++) + if(Font(i, 10).IsNormal(0x9500)) + DDUMP(Font::GetFaceName(i)); +*/ + DDUMP(GetGlyphInfo(Font().FaceName("PMingLiU").Height(20), 0x9500).IsNormal()); + Test().Run(); +} diff --git a/uppdev/ScreenShotter/ScreenShotter.upp b/uppdev/ScreenShotter/ScreenShotter.upp new file mode 100644 index 000000000..5872304d3 --- /dev/null +++ b/uppdev/ScreenShotter/ScreenShotter.upp @@ -0,0 +1,9 @@ +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/uppdev/ScreenShotter/main.cpp b/uppdev/ScreenShotter/main.cpp new file mode 100644 index 000000000..a2974e2bf --- /dev/null +++ b/uppdev/ScreenShotter/main.cpp @@ -0,0 +1,46 @@ +#include + +using namespace Upp; + +Image ScreenShot(int x, int y, int cx, int cy) +{ + HDC dcScreen = CreateDC("DISPLAY", NULL, NULL, NULL); + + RGBA *pixels; + + Buffer data; + data.Alloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256); + BITMAPINFOHEADER *hi = (BITMAPINFOHEADER *) ~data;; + memset(hi, 0, sizeof(BITMAPINFOHEADER)); + hi->biSize = sizeof(BITMAPINFOHEADER); + hi->biPlanes = 1; + hi->biBitCount = 32; + hi->biCompression = BI_RGB; + hi->biSizeImage = 0; + hi->biClrUsed = 0; + hi->biClrImportant = 0; + hi->biWidth = cx; + hi->biHeight = -cy; + + HBITMAP hbmp = CreateDIBSection(dcScreen, (BITMAPINFO *)hi, DIB_RGB_COLORS, (void **)&pixels, NULL, 0); + HDC dcMem = ::CreateCompatibleDC(dcScreen); + HBITMAP hbmpOld = (HBITMAP) ::SelectObject(dcMem, hbmp); + HDC hdcCompatible = CreateCompatibleDC(dcScreen); + ::BitBlt(dcMem, 0, 0, cx, cy, dcScreen, x, y, SRCCOPY); + + ImageBuffer ib(cx, cy); + memcpy(~ib, pixels, cx * cy * sizeof(RGBA)); + + ::DeleteObject(::SelectObject(dcMem, hbmpOld)); + ::DeleteDC(dcMem); + ::DeleteDC(dcScreen); + + return ib; +}; + +GUI_APP_MAIN +{ + Image m = ScreenShot(100, 100, 300, 300); + PNGEncoder().SaveFile("u:/test.png", m); +} +Um2%+63FwV \ No newline at end of file