mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.uppdev
git-svn-id: svn://ultimatepp.org/upp/trunk@7358 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
b1056e6479
commit
407eabd819
8 changed files with 133 additions and 88 deletions
|
|
@ -4,11 +4,7 @@ uses
|
|||
CtrlLib;
|
||||
|
||||
file
|
||||
app.tpp,
|
||||
ArrayCtrl.h,
|
||||
main.cpp optimize_speed,
|
||||
src.tpp,
|
||||
srcimp.tpp;
|
||||
main.cpp optimize_speed;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
|
|
|||
|
|
@ -3,78 +3,26 @@
|
|||
using namespace Upp;
|
||||
|
||||
struct App : TopWindow {
|
||||
ArrayCtrl a, b;
|
||||
Splitter s;
|
||||
|
||||
StatusBar status;
|
||||
|
||||
void DnD(PasteClip& d)
|
||||
{
|
||||
if(AcceptText(d))
|
||||
a.Add(GetString(d), GetString(d));
|
||||
ArrayCtrl a;
|
||||
|
||||
bool Order(int i1, int i2) {
|
||||
DDUMP(a.Get(i1, 0));
|
||||
DDUMP(a.Get(i2, 0));
|
||||
return a.Get(i1, 0) < a.Get(i2, 0);
|
||||
}
|
||||
|
||||
void DnDInsert(int line, PasteClip& d)
|
||||
{
|
||||
if(AcceptInternal<ArrayCtrl>(d, "array"))
|
||||
a.InsertDrop(line, d);
|
||||
if(AcceptText(d)) {
|
||||
a.Insert(line);
|
||||
a.Set(line, 0, GetString(d));
|
||||
a.SetCursor(line);
|
||||
}
|
||||
}
|
||||
|
||||
void DnDInsertB(int line, PasteClip& d)
|
||||
{
|
||||
}
|
||||
|
||||
void Drag()
|
||||
{
|
||||
}
|
||||
|
||||
void DragB()
|
||||
{
|
||||
}
|
||||
|
||||
void A()
|
||||
{
|
||||
Exclamation("LeftDouble");
|
||||
Exit();
|
||||
}
|
||||
|
||||
void B()
|
||||
{
|
||||
Exclamation("LeftClick");
|
||||
}
|
||||
|
||||
typedef App CLASSNAME;
|
||||
|
||||
App() {
|
||||
a.AddColumn("\1Text alsdfjla fdlajd flajd falsjkd fla fals fj").HeaderTab().WhenLeftDouble = THISBACK(A);
|
||||
a.AddColumn("asdf").HeaderTab().WhenLeftClick = THISBACK(B);
|
||||
a.MultiSelect();
|
||||
a.NoGrid();
|
||||
a.WhenDropInsert = THISBACK(DnDInsert);
|
||||
a.WhenDrop = THISBACK(DnD);
|
||||
a.WhenDrag = THISBACK(Drag);
|
||||
a.WhenLeftDouble = THISBACK(A);
|
||||
a.Removing();
|
||||
|
||||
b.AddColumn("Text");
|
||||
b.MultiSelect();
|
||||
b.WhenDropInsert = THISBACK(DnDInsertB);
|
||||
b.WhenDrag = THISBACK(DragB);
|
||||
Add(a.SizePos());
|
||||
Sizeable().Zoomable();
|
||||
|
||||
Add(s.Horz(a, b));
|
||||
a.AddColumn("Test");
|
||||
for(int i = 0; i < 200; i++) {
|
||||
a.Add(i);
|
||||
b.Add(FormatIntRoman(i, true));
|
||||
if((i & 3) == 0)
|
||||
a.AddSeparator();
|
||||
a.Add((int)Random(10000));
|
||||
}
|
||||
Sizeable();
|
||||
AddFrame(status);
|
||||
// a.Sort(THISBACK(Order));
|
||||
a.Sort();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -83,20 +31,3 @@ GUI_APP_MAIN
|
|||
DUMP("Test");
|
||||
App().Run();
|
||||
}
|
||||
|
||||
|
||||
String HttpResponse(int code, const char *phrase, const String& data, const char *content_type)
|
||||
{
|
||||
String r;
|
||||
r <<
|
||||
"HTTP/1.0 " << code << ' ' << phrase << "\r\n"
|
||||
"Date: " << WwwFormat(GetUtcTime()) << "\r\n"
|
||||
"Server: Centrum-Nos SaleCrm\r\n"
|
||||
"Content-Length: " << data.GetCount() << "\r\n"
|
||||
"Connection: close\r\n";
|
||||
if(content_type)
|
||||
r << "Content-Type: text/xml\r\n";
|
||||
r << "\r\n" << data;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,11 @@ class ArrayCtrlSort : public TopWindow {
|
|||
ArrayCtrl a;
|
||||
EditDouble ed1, ed2;
|
||||
|
||||
bool SortTest(int i1, int i2)
|
||||
{
|
||||
return a.Get(i1, 0) > a.Get(i2, 0);
|
||||
}
|
||||
|
||||
public:
|
||||
typedef ArrayCtrlSort CLASSNAME;
|
||||
ArrayCtrlSort();
|
||||
|
|
@ -27,7 +32,9 @@ ArrayCtrlSort::ArrayCtrlSort()
|
|||
for(int i = 0; i < 100; i++)
|
||||
a.Add(rand() % 20, rand() % 10);
|
||||
Add(a.SizePos());
|
||||
a.ColumnSort(3, StdValueOrder());
|
||||
// a.ColumnSort(3, StdValueOrder());
|
||||
|
||||
a.Sort(10, 40, THISBACK(SortTest));
|
||||
}
|
||||
|
||||
GUI_APP_MAIN
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ using namespace Upp;
|
|||
CONSOLE_APP_MAIN
|
||||
{
|
||||
String out;
|
||||
Sys("ls /sdf", out);
|
||||
Sys("c:/xxx/pdftoppm -r 100 \"C:/xxx/smlouva.pdf\" \"C:/xxx/out.ppm\"");
|
||||
DDUMP(out);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
- Velke hodnoty grid apod... (collapsed mode)
|
||||
- keep with next nechodi
|
||||
- Equalize columns
|
||||
|
|
|
|||
97
uppdev/ValuePath/ValuePath.cpp
Normal file
97
uppdev/ValuePath/ValuePath.cpp
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
class Path {
|
||||
bool index;
|
||||
Value key;
|
||||
Value value;
|
||||
Path *parent;
|
||||
Value *target;
|
||||
|
||||
Path() { target = NULL; }
|
||||
|
||||
public:
|
||||
Path operator()(const Value& key);
|
||||
Path operator[](int i);
|
||||
void Set(const Value& key, const Value& v, bool ndx);
|
||||
void operator=(const Value& v) { value = v; parent->Set(key, v, index); }
|
||||
|
||||
Path(Value& v) { target = &v; value = v; parent = NULL; index = false; }
|
||||
};
|
||||
|
||||
Path Path::operator()(const Value& k)
|
||||
{
|
||||
Path p;
|
||||
ValueMap m;
|
||||
if(IsValueMap(value))
|
||||
m = value;
|
||||
p.parent = this;
|
||||
p.key = k;
|
||||
// DLOG("operator()(" << key << ": " << m[key]);
|
||||
p.value = m.GetAndClear(k); // Optimize!
|
||||
p.index = false;
|
||||
return p;
|
||||
}
|
||||
|
||||
Path Path::operator[](int i)
|
||||
{
|
||||
ASSERT(i >= 0);
|
||||
Path p;
|
||||
ValueArray va;
|
||||
if(IsValueArray(value))
|
||||
va = value;
|
||||
p.parent = this;
|
||||
p.key = i;
|
||||
p.index = true;
|
||||
if(i < va.GetCount())
|
||||
p.value = va.GetAndClear(i);
|
||||
p.index = true;
|
||||
return p;
|
||||
}
|
||||
|
||||
void Path::Set(const Value& k, const Value& v, bool ndx)
|
||||
{
|
||||
// DLOG("Set(" << k << ": " << v << "), current key: " << key << ", value: " << value);
|
||||
if(ndx) {
|
||||
ValueArray va;
|
||||
if(IsValueArray(value))
|
||||
va = value;
|
||||
va.Set((int)k, v);
|
||||
value = va;
|
||||
}
|
||||
else {
|
||||
ValueMap m;
|
||||
if(IsValueMap(value))
|
||||
m = value;
|
||||
m.Set(k, v);
|
||||
value = m;
|
||||
}
|
||||
if(parent)
|
||||
parent->Set(key, value, index);
|
||||
if(target)
|
||||
*target = value;
|
||||
}
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
Value x;
|
||||
|
||||
Path(x)("hello")("world") = 555;
|
||||
DUMP(x);
|
||||
LOG("-------------------");
|
||||
Path(x)("hello")("you") = "this";
|
||||
DUMP(x);
|
||||
LOG("-------------------");
|
||||
Path(x)("hello")("x") = "y";
|
||||
DUMP(x);
|
||||
LOG("-------------------");
|
||||
for(int i = 0; i < 20; i++)
|
||||
Path(x)("hello")("array")[i] = i;
|
||||
DUMP(x);
|
||||
// Path p = Path(x)("hello")("array");
|
||||
// for(int i = 0; i < 20; i++)
|
||||
// p[i] = "*" + AsString(i);
|
||||
}
|
||||
9
uppdev/ValuePath/ValuePath.upp
Normal file
9
uppdev/ValuePath/ValuePath.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
ValuePath.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
4
uppdev/ValuePath/init
Normal file
4
uppdev/ValuePath/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _ValuePath_icpp_init_stub
|
||||
#define _ValuePath_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue