From 8c030b0c5aa1e825123898cc12d5e89c620ffb8d Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 13 Aug 2009 13:40:35 +0000 Subject: [PATCH] syncing uppdev git-svn-id: svn://ultimatepp.org/upp/trunk@1505 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppdev/DrawingReport/DrawingReport.upp | 10 +++ uppdev/DrawingReport/init | 5 ++ uppdev/DrawingReport/main.cpp | 43 +++++++++ uppdev/GuiMT/main.cpp | 87 ------------------- uppdev/{GuiMT => GuiMTtest}/Divisors.lay | 0 .../GuiMT.upp => GuiMTtest/GuiMTtest.upp} | 0 uppdev/GuiMTtest/main.cpp | 52 +++++++++++ 7 files changed, 110 insertions(+), 87 deletions(-) create mode 100644 uppdev/DrawingReport/DrawingReport.upp create mode 100644 uppdev/DrawingReport/init create mode 100644 uppdev/DrawingReport/main.cpp delete mode 100644 uppdev/GuiMT/main.cpp rename uppdev/{GuiMT => GuiMTtest}/Divisors.lay (100%) rename uppdev/{GuiMT/GuiMT.upp => GuiMTtest/GuiMTtest.upp} (100%) create mode 100644 uppdev/GuiMTtest/main.cpp diff --git a/uppdev/DrawingReport/DrawingReport.upp b/uppdev/DrawingReport/DrawingReport.upp new file mode 100644 index 000000000..14ccea71b --- /dev/null +++ b/uppdev/DrawingReport/DrawingReport.upp @@ -0,0 +1,10 @@ +uses + CtrlLib, + Report; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/uppdev/DrawingReport/init b/uppdev/DrawingReport/init new file mode 100644 index 000000000..68e889369 --- /dev/null +++ b/uppdev/DrawingReport/init @@ -0,0 +1,5 @@ +#ifndef _DrawingReport_icpp_init_stub +#define _DrawingReport_icpp_init_stub +#include "CtrlLib/init" +#include "Report/init" +#endif diff --git a/uppdev/DrawingReport/main.cpp b/uppdev/DrawingReport/main.cpp new file mode 100644 index 000000000..fbf0e06e6 --- /dev/null +++ b/uppdev/DrawingReport/main.cpp @@ -0,0 +1,43 @@ +#include +#include + +using namespace Upp; + +void Print(String text) +{ + int top = 1; + int left = 1; + int sizex = 4600; + int sizey = 6800; + + Size sz(sizex-(2*top),sizey-(2*left)); + + String txt = "[ $$0,0#00000000000000000000000000000000:Default]\n[{_} \n[s0; [*1 Seite $$P]&]\n[s0;*1 &]\n[ {{10000<64;h1;^t/13b/4@(229) [s0; [*1 Artikel]]\n::@2 [s0; [1 1]]\n:: [s0; [1 2]&]\n[s0; [1 3]]\n:: [s0; [1 040114]]\n:: [s0; [1 5]]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0; [1 xxx]]\n:: [s0; [1 xxx]]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]\n:: [s0;1 ]}}&]\n[s0;*2 ]"; + + Report rep; + rep.SetPageSize(sz); + + rep.Put(txt); + + Size size(rep.GetSize()); + Report report(size); + + Perform(rep,"Original"); + + const Array & aDw = rep.GetPages(); + + for(int i = 0; i < aDw.GetCount(); i++) + { + if(i>0) + report.NewPage(); + report.DrawDrawing(size,aDw[i]); + } + + Perform(report,"copy"); +} + +GUI_APP_MAIN +{ + Print("Just a test!"); +} + diff --git a/uppdev/GuiMT/main.cpp b/uppdev/GuiMT/main.cpp deleted file mode 100644 index d34a75ee8..000000000 --- a/uppdev/GuiMT/main.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include "CtrlLib/CtrlLib.h" - -#define LAYOUTFILE -#include - -struct Divisors : public WithDivisorsLayout { - typedef Divisors CLASSNAME; - - void TestNumber(); - void ShowResult(int line, String result); - void SetTitle(); - - Divisors(); - ~Divisors(); -}; - - -struct DivisorsInfo { - int line; - uint64 number; - Divisors *gui; -}; - -void WorkerThread(DivisorsInfo f) -{ - String r; - int divisors = 0; - uint64 max = (uint64)sqrt((double)f.number) + 1; - for(uint64 i = 1; i < max; i++) { - if(Thread::IsShutdownThreads()) - break; - if(f.number % i == 0) { - r << ' ' << i; - PostCallback(callback2(f.gui, &Divisors::ShowResult, f.line, "working..." + r)); - divisors++; - } - } - r << ' ' << f.number; - PostCallback(callback2(f.gui, &Divisors::ShowResult, f.line, AsString(divisors + 1) + ": " + r)); -} - -void Divisors::TestNumber() -{ - if(IsNull(editor)) - return; - DivisorsInfo f; - f.number = stou64((String)~editor); - f.line = table.GetCount(); - table.Add(AsString(f.number), "working..."); - f.gui = this; - Thread().Run(callback1(WorkerThread, f)); - SetTitle(); -} - -void Divisors::ShowResult(int line, String result) -{ - table.Set(line, 1, result); - SetTitle(); -} - -void Divisors::SetTitle() -{ - Title(AsString(Thread::GetCount()) + " threads"); -} - -Divisors::Divisors() -{ - CtrlLayout(*this, "Window title"); - Sizeable().Zoomable(); - push <<= THISBACK(TestNumber); - editor.SetFilter(CharFilterDigit); - table.AddColumn("Number"); - table.AddColumn("Divisors"); - table.ColumnWidths("135 527"); - table.NoCursor(); - SetTitle(); -} - -Divisors::~Divisors() -{ - Thread::ShutdownThreads(); -} - -GUI_APP_MAIN -{ - Divisors().Run(); -} diff --git a/uppdev/GuiMT/Divisors.lay b/uppdev/GuiMTtest/Divisors.lay similarity index 100% rename from uppdev/GuiMT/Divisors.lay rename to uppdev/GuiMTtest/Divisors.lay diff --git a/uppdev/GuiMT/GuiMT.upp b/uppdev/GuiMTtest/GuiMTtest.upp similarity index 100% rename from uppdev/GuiMT/GuiMT.upp rename to uppdev/GuiMTtest/GuiMTtest.upp diff --git a/uppdev/GuiMTtest/main.cpp b/uppdev/GuiMTtest/main.cpp new file mode 100644 index 000000000..75c0271ec --- /dev/null +++ b/uppdev/GuiMTtest/main.cpp @@ -0,0 +1,52 @@ +#include + +using namespace Upp; + +struct App : TopWindow { + Thread work; + + void Work(); + + ArrayCtrl list; + + typedef App CLASSNAME; + + App(); + ~App(); +}; + +void App::Work() +{ + int q = 0; + for(;;) { + Sleep(1); + GuiLock __; + if(Thread::IsShutdownThreads()) + break; + DLOG("BEGIN"); + if(list.GetCount() > 100) + list.Clear(); + list.Add((int64)Random()); + DLOG("END"); + } +} + +App::App() +{ + list.AddColumn("Test"); + list.AddColumn("Test2", 20); + Add(list.SizePos()); + work.Run(THISBACK(Work)); +} + +App::~App() +{ + Thread::ShutdownThreads(); + work.Wait(); +} + +GUI_APP_MAIN +{ + App app; + app.Run(); +}