diff --git a/benchmarks/PainterBench/PainterBench.upp b/benchmarks/PainterBench/PainterBench.upp new file mode 100644 index 000000000..fdcd3aa6b --- /dev/null +++ b/benchmarks/PainterBench/PainterBench.upp @@ -0,0 +1,11 @@ +uses + CtrlLib, + GLCtrl, + Painter; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/benchmarks/PainterBench/init b/benchmarks/PainterBench/init new file mode 100644 index 000000000..4ad9e5a64 --- /dev/null +++ b/benchmarks/PainterBench/init @@ -0,0 +1,6 @@ +#ifndef _PainterBench_icpp_init_stub +#define _PainterBench_icpp_init_stub +#include "CtrlLib/init" +#include "GLCtrl/init" +#include "Painter/init" +#endif diff --git a/benchmarks/PainterBench/main.cpp b/benchmarks/PainterBench/main.cpp new file mode 100644 index 000000000..6588339c2 --- /dev/null +++ b/benchmarks/PainterBench/main.cpp @@ -0,0 +1,140 @@ +#include +#include +#include + +using namespace Upp; + +#define LINE + +struct PainterExample : Ctrl { +public: + double delta; + virtual void Paint(Draw &draw) { + delta=0; + + ImageBuffer ib(draw.GetPagePixels()); + BufferPainter pntr(ib); + + dword begin=GetTickCount(); + + int reps=0; + for(reps=0;reps<5;reps++) for(int i=0;i<500;i++){ + #ifdef LINE + pntr.Move(i,0).Line(499,i).Line(499-i,499).Line(0,499-i).Close().Stroke(4,Red()); + #else + pntr.Move(i,0).Line(499,i).Line(499-i,499).Line(0,499-i).Close().Fill(Red()); + #endif + } + dword end=GetTickCount(); + delta=end-begin; + delta/=reps; + draw.DrawImage(0,0,ib); + } +}; + +struct DrawExample : Ctrl { +public: + double delta; + virtual void Paint(Draw &draw) { + delta=0; + + dword begin=GetTickCount(); + Rect rect(0,0,500,500); + + int reps=0; + for(reps=0;reps<5;reps++) for(int i=0;i<500;i++){ + Point v[5]={Point(i,0),Point(499,i),Point(499-i,499),Point(0,499-i),Point(i,0)}; + #ifdef LINE + draw.DrawPolyline(v,5,4,Green()); + #else + draw.DrawPolygon(v,5,Green()); + #endif + } + dword end=GetTickCount(); + delta=end-begin; + delta/=reps; + } + +}; + +struct OpenGLExample : GLCtrl { +public: + double delta; + virtual void GLPaint() { + delta=0; + Size sz=GetSize(); + dword begin=GetTickCount(); + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glViewport(0,0,sz.cx,sz.cy); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glPushMatrix(); + glOrtho(0,sz.cx,sz.cy,0,-1,1); + + + int reps=0; + for(reps=0;reps<10;reps++) for(int i=0;i<500;i++){ + #ifdef LINE + glBegin(GL_LINE_STRIP); // Polyline + #else + glBegin(GL_POLYGON); // Polygon + #endif + glColor3f(0.0f,0.0f,1.0f); // Blue + glVertex2f((float)i,(float)0); + glVertex2f((float)499,(float)i); + glVertex2f((float)499-i,(float)499); + glVertex2f((float)0,(float)499-i); + glVertex2f((float)i,(float)0); + glEnd(); + glFlush(); + } + + glPopMatrix(); + glFlush(); + + dword end=GetTickCount(); + delta=end-begin; + delta/=reps; + } +}; + +class ExampleTopWindow: public TopWindow{ +public: + PainterExample pr; + DrawExample dw; + OpenGLExample gl; + + ExampleTopWindow(){ + pr.SetRect(0,0,500,500); + dw.SetRect(500,0,500,500); + gl.SetRect(1000,0,500,500); + + pr.BackPaint(); + dw.BackPaint(); + gl.BackPaint(); + + pr.delta=0; + dw.delta=0; + gl.delta=0; + + Add(pr); + Add(dw); + Add(gl); + } + + virtual void LeftDown(Point p,dword keyflags){ + Title(Format("Painter/Draw/OpenGL: %.3f/%.3f/%.3f ms",pr.delta,dw.delta,gl.delta)); + Refresh(); + } + +}; + +GUI_APP_MAIN +{ + ExampleTopWindow win; + win.Sizeable().Zoomable(); + win.Open(); + win.Run(); +} diff --git a/uppbox/MakeInstall2/install.lay b/uppbox/MakeInstall2/install.lay index c1e2ec837..a9ec9cd01 100644 --- a/uppbox/MakeInstall2/install.lay +++ b/uppbox/MakeInstall2/install.lay @@ -7,7 +7,7 @@ LAYOUT(InstallLayout, 292, 308) ITEM(EditString, idedir, LeftPosZ(100, 184).TopPosZ(56, 19)) ITEM(Label, dv___6, SetLabel(t_("MinGWI directory")).LeftPosZ(8, 88).TopPosZ(80, 19)) ITEM(EditString, mingw, LeftPosZ(100, 184).TopPosZ(80, 19)) - ITEM(Label, dv___8, SetLabel(t_("U++ VERSION")).SetFont(StdFont(11).Bold()).LeftPosZ(8, 88).TopPosZ(120, 19)) + ITEM(Label, dv___8, SetLabel(t_("U++ VERSION")).SetFont(StdFontZ(11).Bold()).LeftPosZ(8, 88).TopPosZ(120, 19)) ITEM(EditString, version, LeftPosZ(100, 184).TopPosZ(120, 19)) ITEM(Option, make_mingw, SetLabel(t_("Create upp-mingw")).LeftPosZ(12, 216).TopPosZ(164, 15)) ITEM(Option, make_win, SetLabel(t_("Create upp-win")).LeftPosZ(12, 216).TopPosZ(184, 15)) diff --git a/uppbox/WinInstaller2/data.rc b/uppbox/WinInstaller2/data.rc index 2c58a68a1..8b8a0dd31 100644 --- a/uppbox/WinInstaller2/data.rc +++ b/uppbox/WinInstaller2/data.rc @@ -1 +1 @@ -1112 RCDATA MOVEABLE PURE "c:\\Dev\\upp.install.final\\upp-mingw.7z" \ No newline at end of file +1112 RCDATA MOVEABLE PURE "u:\\upp.tmp\\upp.7z" \ No newline at end of file diff --git a/uppdev/AggCtrl/AggCtrl.upp b/uppdev/AggCtrl/AggCtrl.upp index d199aa39f..df5db2501 100644 --- a/uppdev/AggCtrl/AggCtrl.upp +++ b/uppdev/AggCtrl/AggCtrl.upp @@ -26,6 +26,7 @@ file PixFmts.h, AggCtrl.h, AggCtrlWin32.cpp, + Test.cpp, AggCtrlX11.cpp; mainconfig diff --git a/uppdev/AggCtrl/Test.cpp b/uppdev/AggCtrl/Test.cpp new file mode 100644 index 000000000..0d4774e87 --- /dev/null +++ b/uppdev/AggCtrl/Test.cpp @@ -0,0 +1,150 @@ +#include "CtrlLib.h" + +NAMESPACE_UPP + +DropChoice::DropChoice() { + always_drop = false; + AddButton().Main() <<= THISBACK(Drop); + NoDisplay(); + list.Normal(); + list.WhenSelect = callback(this, &DropChoice::Select); + dropfocus = true; + EnableDrop(false); + dropwidth = 0; +} + +void DropChoice::EnableDrop(bool b) +{ + MainButton().Enable(b); +} + +void DropChoice::PseudoPush() +{ + MultiButton::PseudoPush(0); +} + +void DropChoice::Drop() { + if(!owner || owner->IsReadOnly() || list.GetCount() == 0 && !WhenDrop) return; + WhenDrop(); + if(dropfocus) + owner->SetWantFocus(); + if(!list.FindSetCursor(owner->GetData()) && list.GetCount() > 0) + list.SetCursor(0); + list.PopUp(owner,dropwidth); +} + +void DropChoice::Select() { + if(!owner || owner->IsReadOnly()) return; + WhenSelect(); +} + +Value DropChoice::Get() const { + if(!owner || owner->IsReadOnly()) return Value(); + int c = list.GetCursor(); + if(c < 0) return Value(); + return list.Get(c, 0); +} + +int DropChoice::GetIndex() const +{ + if(!owner || owner->IsReadOnly()) return -1; + return list.GetCursor(); +} + +bool DropChoice::DataSelect(Ctrl& owner, DropChoice& drop, const String& appends) { + Value g = drop.Get(); + if(g.IsVoid()) return false; + Value s = owner.GetData(); + if(!appends.IsVoid()) { + String txt = s; + if(!txt.IsEmpty()) txt.Cat(appends); + txt.Cat((String)g); + s = txt; + } + else + s = g; + owner.SetData(s); + owner.WhenAction(); + return true; +} + +bool DropChoice::DoKey(dword key) { + if(owner && !owner->IsReadOnly() && list.GetCount()) { + int q = list.GetCursor(); + switch(key) { + case K_ALT_DOWN: + PseudoPush(); + return true; + case K_DOWN: + if(appending) + PseudoPush(); + else { + list.SetCursor(q <= 0 ? list.GetCount() - 1 : q - 1); + Select(); + } + return true; + case K_UP: + if(appending) + PseudoPush(); + else { + list.SetCursor(q < 0 || q >= list.GetCount() - 1 ? 0 : q + 1); + Select(); + } + return true; + } + } + return false; +} + +void DropChoice::Add(const Value& s) { + list.Add(s); + EnableDrop(true); +} + +void DropChoice::Clear() { + list.Clear(); + EnableDrop(always_drop); +} + +void DropChoice::Serialize(Stream& s) { + int version = 0x00; + int n = list.GetCount(); + s / version / n; + Value v; + if(s.IsLoading()) { + Clear(); + for(int i = 0; i < n; i++) { + s % v; + Add(v); + } + } + else + for(int i = 0; i < n; i++) { + v = list.Get(i, 0); + s % v; + } + EnableDrop(list.GetCount() || always_drop); +} + +void DropChoice::AddHistory(const Value& v, int max) { + if(IsNull(v)) return; + for(int i = 0; i < list.GetCount(); i++) + if(list.Get(i, 0) == v) { + list.Remove(i); + break; + } + list.Insert(0, Vector() << v); + if(list.GetCount() > max) + list.SetCount(max); + EnableDrop(list.GetCount() || always_drop); + list.KillCursor(); +} + +DropChoice& DropChoice::AlwaysDrop(bool e) +{ + always_drop = e; + EnableDrop(list.GetCount() || always_drop); + return *this; +} + +END_UPP_NAMESPACE diff --git a/uppdev/CondVar/CondVar.cpp b/uppdev/CondVar/CondVar.cpp new file mode 100644 index 000000000..55a89737e --- /dev/null +++ b/uppdev/CondVar/CondVar.cpp @@ -0,0 +1,6 @@ +#include + +namespace Upp { + + +}; diff --git a/uppdev/CondVar/CondVar.upp b/uppdev/CondVar/CondVar.upp new file mode 100644 index 000000000..466dc972c --- /dev/null +++ b/uppdev/CondVar/CondVar.upp @@ -0,0 +1,9 @@ +uses + Core; + +file + CondVar.cpp; + +mainconfig + "" = "MT"; + diff --git a/uppdev/CondVar/init b/uppdev/CondVar/init new file mode 100644 index 000000000..d118e3d93 --- /dev/null +++ b/uppdev/CondVar/init @@ -0,0 +1,4 @@ +#ifndef _CondVar_icpp_init_stub +#define _CondVar_icpp_init_stub +#include "Core/init" +#endif diff --git a/uppdev/TextDiff/TextDiff.upp b/uppdev/TextDiff/TextDiff.upp new file mode 100644 index 000000000..bb6f6dc93 --- /dev/null +++ b/uppdev/TextDiff/TextDiff.upp @@ -0,0 +1,10 @@ +uses + CtrlLib, + TextDiffCtrl; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/uppdev/TextDiff/init b/uppdev/TextDiff/init new file mode 100644 index 000000000..ebd91911b --- /dev/null +++ b/uppdev/TextDiff/init @@ -0,0 +1,5 @@ +#ifndef _TextDiff_icpp_init_stub +#define _TextDiff_icpp_init_stub +#include "CtrlLib/init" +#include "TextDiffCtrl/init" +#endif diff --git a/uppdev/TextDiff/main.cpp b/uppdev/TextDiff/main.cpp new file mode 100644 index 000000000..554abc2f8 --- /dev/null +++ b/uppdev/TextDiff/main.cpp @@ -0,0 +1,12 @@ +#include + +using namespace Upp; + +GUI_APP_MAIN +{ + TopWindow win; + TextDiffCtrl ctrl; + win.Add(ctrl.SizePos()); + ctrl.Set(LoadFile("u:/file1.txt"), LoadFile("u:/file2.txt")); + win.Run(); +} diff --git a/uppsrc/assemblies b/uppsrc/assemblies new file mode 100644 index 000000000..6582a432d --- /dev/null +++ b/uppsrc/assemblies @@ -0,0 +1,4 @@ +examples +reference +tutorial +bazaar diff --git a/uppsrc/packages b/uppsrc/packages new file mode 100644 index 000000000..603ac1e12 --- /dev/null +++ b/uppsrc/packages @@ -0,0 +1,38 @@ +BuildAll +CbGen +CodeEditor +coff +Core +CppBase +Crypto +CtrlCore +CtrlLib +Draw +DropGrid +Esc +Geom +GLCtrl +GridCtrl +HexView +IconDes +ide +MySql +Ole +OleDB +Oracle +PdfDraw +plugin +PostgreSQL +Report +RichEdit +RichText +Sql +SqlCommander +SqlCtrl +umk +Updater +TextDiffCtrl +ODBC +usvn +art +Painter diff --git a/uppsrc/packages1 b/uppsrc/packages1 new file mode 100644 index 000000000..75ab9a829 --- /dev/null +++ b/uppsrc/packages1 @@ -0,0 +1,3 @@ +Web +Web/TServ +Web/SSL