From f9e53ac7dd33e2c9d247e3bea67558f5c234ef8b Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 29 Mar 2021 11:59:15 +0000 Subject: [PATCH] .upptst git-svn-id: svn://ultimatepp.org/upp/trunk@15882 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- upptst/EditFieldRight/EditFieldRight.upp | 9 ++++ upptst/EditFieldRight/main.cpp | 16 ++++++ upptst/PenTest/main.cpp | 63 ++++++++++-------------- 3 files changed, 50 insertions(+), 38 deletions(-) create mode 100644 upptst/EditFieldRight/EditFieldRight.upp create mode 100644 upptst/EditFieldRight/main.cpp diff --git a/upptst/EditFieldRight/EditFieldRight.upp b/upptst/EditFieldRight/EditFieldRight.upp new file mode 100644 index 000000000..5c4f53e15 --- /dev/null +++ b/upptst/EditFieldRight/EditFieldRight.upp @@ -0,0 +1,9 @@ +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/upptst/EditFieldRight/main.cpp b/upptst/EditFieldRight/main.cpp new file mode 100644 index 000000000..7b74d6485 --- /dev/null +++ b/upptst/EditFieldRight/main.cpp @@ -0,0 +1,16 @@ +#include + +using namespace Upp; + +GUI_APP_MAIN +{ + EditDouble q, q1; + q.AlignRight(); + + q <<= 1.234; + + TopWindow win; + win.Add(q.LeftPosZ(10, 40).TopPosZ(10)); + win.Add(q1.LeftPosZ(10, 100).TopPosZ(40)); + win.Run(); +} diff --git a/upptst/PenTest/main.cpp b/upptst/PenTest/main.cpp index d2bafb83f..4a2f053d0 100644 --- a/upptst/PenTest/main.cpp +++ b/upptst/PenTest/main.cpp @@ -2,50 +2,39 @@ using namespace Upp; -#define LLOG(x) - struct MyApp : TopWindow { Point pos; Vector>> drawing; - bool pendown; + PenInfo pen; - MyApp(){ - pendown=false; - } - - virtual void LeftUp(Point p, dword) - { - if(IsPointerPen()) { - LLOG("End line"); - pendown=false; + virtual bool Pen(Point p, const PenInfo& pn, dword keyflags) { + if(keyflags&K_SHIFT) + return false; + if(pn.pressure) { + if((!!pn.pressure == !!pen.pressure) && drawing.GetCount()) + drawing.Top().Add(MakeTuple(pn.pressure, p)); + else + drawing.Add().Add(MakeTuple(pn.pressure, p)); } + pen = pn; Refresh(); + return true; } - virtual void LeftDown(Point p, dword) - { - if(IsPointerPen()) { - LLOG("Start line"); - pendown=true; - drawing.Add().Add(MakeTuple(GetPenPressure(), p)); + void LeftDown(Point p, dword keyflags) override { + if(keyflags & K_SHIFT) { + RectTracker tracker(*this); + tracker.MinSize(Size(-100000,-100000)); + tracker.Track(Rect(p,p)); } - Refresh(); - } - - virtual void MouseMove(Point p, dword keyflags) { - pos = p; - if(IsPointerPen() && drawing.GetCount() && pendown) { - LLOG("Drawing line, pressure: " << GetPenPressure()); - drawing.Top().Add(MakeTuple(GetPenPressure(), p)); - } - Refresh(); } - virtual void Paint(Draw& w0) - { + + virtual void Paint(Draw& w0) { DrawPainter w(w0, GetSize()); + w.Co(); w.Clear(SColorPaper()); w.LineCap(LINECAP_ROUND); @@ -64,14 +53,12 @@ struct MyApp : TopWindow { y += fcy; }; Text(AsString(pos)); - Text(String() << "Pen: " << IsPointerPen()); - Text(String() << "Pressure: " << GetPenPressure()); - Text(String() << "Rotation: " << GetPenRotation()); - Text(String() << "Tilt: " << GetPenTilt()); - Text(String() << "Barrel: " << IsPenBarrelPressed()); - Text(String() << "Inverted: " << IsPenInverted()); - Text(String() << "Eraser: " << IsPenEraserPressed()); // FIXED to IsPenEraserPressed() - //Refresh(); // REMOVED + Text(String() << "Pressure: " << pen.pressure); + Text(String() << "Rotation: " << pen.rotation); + Text(String() << "Tilt: " << pen.tilt); + Text(String() << "Barrel: " << pen.barrel); + Text(String() << "Inverted: " << pen.inverted); + Text(String() << "Eraser: " << pen.eraser); // FIXED to IsPenEraserPressed() } };