Rainbow: WinGL..

git-svn-id: svn://ultimatepp.org/upp/trunk@3705 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
unodgs 2011-07-22 21:28:40 +00:00
parent d3d4804c34
commit 7e763026e1
12 changed files with 322 additions and 163 deletions

View file

@ -233,20 +233,6 @@ Vector<String> GetFiles(PasteClip& clip)
return f;
}
bool PasteClip::IsAvailable(const char *fmt) const
{
return IsClipboardAvailable(fmt);
}
String PasteClip::Get(const char *fmt) const
{
return ReadClipboard(fmt);
}
void PasteClip::GuiPlatformConstruct()
{
}
END_UPP_NAMESPACE
#endif

View file

@ -29,9 +29,13 @@
friend class TopWindowFrame;
friend class SystemDraw;
friend struct DnDLoop;
void SetOpen(bool b) { isopen = b; }
protected:
static int PaintLock;
public:
static Rect screenRect;
@ -52,4 +56,11 @@ public:
virtual void ApplyTransform(TransformState state) {}
void DragRectDraw(const Rect& rect1, const Rect& rect2, const Rect& clip, int n,
Color color, int type, int animation);
static Ctrl *FindMouseTopCtrl();
static bool FullWindowDrag;
enum { DRAWDRAGRECT_SCREEN = 0x8000 };
//$ };

View file

@ -15,22 +15,133 @@ Ctrl * Ctrl::GetDragAndDropSource()
return sDnDSource;
}
Image MakeDragImage(const Image& arrow, Image sample);
struct DnDLoop : LocalLoop {
const VectorMap<String, ClipData> *data;
Vector<String> fmts;
Image MakeDragImage(const Image& arrow, const Image& arrow98, Image sample)
Image move, copy, reject;
Ptr<Ctrl> target;
int action;
byte actions;
void Sync();
String GetData(const String& f);
void DnD(bool paste);
virtual void LeftUp(Point, dword);
virtual bool Key(dword, int);
virtual void MouseMove(Point p, dword);
virtual Image CursorImage(Point, dword);
};
Ptr<DnDLoop> dndloop;
bool PasteClip::IsAvailable(const char *fmt) const
{
#ifdef PLATFORM_WIN32
if(IsWin2K())
return MakeDragImage(arrow, sample);
GuiLock __;
return dnd ? dndloop && FindIndex(dndloop->fmts, fmt) >= 0
: IsClipboardAvailable(fmt);
}
String DnDLoop::GetData(const String& f)
{
GuiLock __;
int i = data->Find(f);
String d;
if(i >= 0)
d = (*data)[i].Render();
else
#endif
return arrow98;
if(sDnDSource)
d = sDnDSource->GetDropData(f);
return d;
}
String PasteClip::Get(const char *fmt) const
{
return dnd ? dndloop ? dndloop->GetData(fmt) : String() : ReadClipboard(fmt);
}
void PasteClip::GuiPlatformConstruct()
{
dnd = false;
}
void DnDLoop::DnD(bool paste)
{
PasteClip d;
d.paste = paste;
d.accepted = false;
d.allowed = (byte)actions;
d.action = GetCtrl() ? DND_COPY : DND_MOVE;
d.dnd = true;
if(target)
target->DnD(GetMousePos(), d);
action = d.IsAccepted() ? d.GetAction() : DND_NONE;
}
void DnDLoop::Sync()
{
GuiLock __;
Ptr<Ctrl> t = FindMouseTopCtrl();
if(t != target)
if(target)
target->DnDLeave();
target = t;
DnD(false);
}
void DnDLoop::LeftUp(Point, dword)
{
GuiLock __;
LLOG("DnDLoop::LeftUp");
DnD(true);
EndLoop();
}
void DnDLoop::MouseMove(Point p, dword)
{
GuiLock __;
LLOG("DnDLoop::MouseMove");
Sync();
}
bool DnDLoop::Key(dword, int)
{
GuiLock __;
LLOG("DnDLoop::Key");
Sync();
return false;
}
Image DnDLoop::CursorImage(Point, dword)
{
GuiLock __;
return action == DND_MOVE ? move : action == DND_COPY ? copy : reject;
}
int Ctrl::DoDragAndDrop(const char *fmts, const Image& sample, dword actions,
const VectorMap<String, ClipData>& data)
{
return DND_NONE;
GuiLock __;
DnDLoop d;
d.actions = (byte)actions;
d.reject = actions & DND_EXACTIMAGE ? CtrlCoreImg::DndNone() : MakeDragImage(CtrlCoreImg::DndNone(), sample);
if(actions & DND_COPY)
d.copy = actions & DND_EXACTIMAGE ? sample : MakeDragImage(CtrlCoreImg::DndCopy(), sample);
if(actions & DND_MOVE)
d.move = actions & DND_EXACTIMAGE ? sample : MakeDragImage(CtrlCoreImg::DndMoveX11(), sample);
d.SetMaster(*this);
d.data = &data;
d.action = DND_NONE;
d.fmts = Split(fmts, ';');
dndloop = &d;
sDnDSource = this;
d.Run();
sDnDSource = NULL;
SyncCaret();
LLOG("DoDragAndDrop finished");
return d.action;
}
void Ctrl::SetSelectionSource(const char *fmts) {}

View file

@ -11,6 +11,7 @@ NAMESPACE_UPP
int64 Resources::currentSerialId = -1;
ArrayMap<int64, Texture> Resources::textures;
VectorMap<String, OpenGLFont> Resources::fonts;
Vector<DragRect> SystemDraw::dragRect;
float GetFps()
{

View file

@ -33,6 +33,16 @@ void Ctrl::MouseEventGl(Ptr<Ctrl> t, int event, Point p, int zdelta)
t->PostInput();
}
Ctrl *Ctrl::FindMouseTopCtrl()
{
for(int i = topctrl.GetCount() - 1; i >= 0; i--) {
Ctrl *t = topctrl[i];
if(t->GetRect().Contains(glmousepos))
return t->IsEnabled() ? t : NULL;
}
return desktop->IsEnabled() ? desktop : NULL;
}
void Ctrl::DoMouseGl(int event, Point p, int zdelta)
{
glmousepos = p;
@ -44,7 +54,7 @@ void Ctrl::DoMouseGl(int event, Point p, int zdelta)
else
if(a == Ctrl::DOWN && ignoreclick)
return;
LLOG("Mouse event: " << event << " position " << p << " zdelta " << zdelta << ", capture " << Upp::Name(captureCtrl));
LLOG("### Mouse event: " << event << " position " << p << " zdelta " << zdelta << ", capture " << Upp::Name(captureCtrl));
if(captureCtrl)
MouseEventGl(captureCtrl->GetTopCtrl(), event, p, zdelta);
else

View file

@ -116,6 +116,7 @@ Image Image::SizeRight() { return WinGlImg::sizeright(); }
Image Image::SizeBottomLeft() { return WinGlImg::sizebottomleft(); }
Image Image::SizeBottom() { return WinGlImg::sizebottom(); }
Image Image::SizeBottomRight() { return WinGlImg::sizebottomright(); }
Image Image::Hand() { return WinGlImg::hand(); }
END_UPP_NAMESPACE

View file

@ -137,9 +137,26 @@ void TopWindowFrame::StartDrag()
return;
if(!sizeable && (dir.x || dir.y))
return;
SetCapture();
startrect = GetRect();
startpos = GetMousePos();
if(FullWindowDrag) {
SetCapture();
startrect = GetRect();
startpos = GetMousePos();
}
else {
Rect r = GetScreenRect();
RectTracker tr(*this);
tr.SetCursorImage(GetDragImage(dir))
.MaxRect(screenRect.GetSize())
.MinSize(ComputeClient(minsize).GetSize())
.Pattern(DRAWDRAGRECT_DASHED | DRAWDRAGRECT_SCREEN)
.Animation();
PaintLock++;
r = tr.Track(r, dir.x < 0 ? ALIGN_LEFT : dir.x > 0 ? ALIGN_RIGHT : ALIGN_CENTER,
dir.y < 0 ? ALIGN_TOP : dir.y > 0 ? ALIGN_BOTTOM : ALIGN_CENTER);
PaintLock--;
SetRect(r);
}
LLOG("START DRAG ---------------");
}
void TopWindowFrame::GripResize()
@ -180,17 +197,21 @@ void TopWindowFrame::MouseMove(Point, dword)
SetRect(r);
}
Image TopWindowFrame::CursorImage(Point p, dword)
Image TopWindowFrame::GetDragImage(Point dir)
{
if(!sizeable)
return Image::Arrow();
p = HasCapture() ? dir : GetDragMode(p);
static Image (*im[9])() = {
Image::SizeTopLeft, Image::SizeLeft, Image::SizeBottomLeft,
Image::SizeTop, Image::Arrow, Image::SizeBottom,
Image::SizeTopRight, Image::SizeRight, Image::SizeBottomRight,
};
return (*im[(p.x + 1) * 3 + (p.y + 1)])();
return (*im[(dir.x + 1) * 3 + (dir.y + 1)])();
}
Image TopWindowFrame::CursorImage(Point p, dword)
{
if(!sizeable)
return Image::Arrow();
return GetDragImage(HasCapture() ? dir : GetDragMode(p));
}
END_UPP_NAMESPACE

View file

@ -23,6 +23,7 @@ private:
Rect overlapped;
Point GetDragMode(Point p);
Image GetDragImage(Point dragmode);
void StartDrag();
Rect Margins() const;
Rect ComputeClient(Rect r);

View file

@ -4,63 +4,92 @@
NAMESPACE_UPP
/*
static void sRenderLine(SystemDraw& w, int x, int y, int dx, int dy, int cx, int cy, int len, byte pattern)
{
DLOG(len);
for(int i = 0; i < len; i++)
if((128 >> (i & 7)) & pattern)
w.DrawRect(x + dx * i, y + dy * i, cx, cy, Black);
DDUMP("~sRenderLine");
}
static void sRenderRect(SystemDraw& w, const Rect& r, int n, byte pattern)
{
sRenderLine(w, r.left, r.top, 1, 0, 1, n, r.GetWidth(), pattern);
sRenderLine(w, r.left, r.bottom - 1, 1, 0, 1, n, r.GetWidth(), pattern);
sRenderLine(w, r.left, r.top, 0, 1, n, 1, r.GetHeight(), pattern);
sRenderLine(w, r.right - 1, r.top, 0, 1, n, 1, r.GetHeight(), pattern);
}
void DrawDragRect(SystemDraw& w, const Rect& rect1, const Rect& rect2,
const Rect& clip, int n, Color color, uint64 pattern)
{
DLOG("@ DrawDragRect " << rect1 << " " << rect2 << ", clip: " << clip << ", pattern: " << pattern);
TIMING("DrawDrawRect");
w.Clip(clip);
w.Invert();
sRenderRect(w, rect1, n, (byte)pattern);
sRenderRect(w, rect2, n, (byte)pattern);
Ctrl::AddUpdate((rect1 | rect2).Offseted(w.GetOffset()));
// MemoryProfile mem;
// DDUMP(mem);
w.End();
}
static uint64 sGetAniPat(uint64 src, int pos)
{
uint64 out = 0;
pos &= 7;
for(int i = 8; --i >= 0;) {
byte sr = (byte)(src >> (8 * ((7 - i - pos) & 7)));
out = (out << 8) | (byte)((sr | (sr << 8)) >> pos);
}
return out;
}
*/
Size GetScreenSize()
{
return Ctrl::screenRect.GetSize();
}
void DDRect(RGBA *t, int dir, const byte *pattern, int pos, int count)
{
while(count-- > 0) {
byte p = pattern[7 & pos++];
t->r ^= p;
t->g ^= p;
t->b ^= p;
t += dir;
}
}
void DrawLine(const Vector<Rect>& clip, int x, int y, int cx, int cy, bool horz, const byte *pattern, int animation)
{
if(cx <= 0 || cy <= 0)
return;
/* Vector<Rect> rr = Intersection(clip, RectC(x, y, cx, cy));
for(int i = 0; i < rr.GetCount(); i++) {
Rect r = rr[i];
if(horz)
for(int y = r.top; y < r.bottom; y++)
DDRect(framebuffer[y] + r.left, 1, pattern, r.left + animation, r.GetWidth());
else
for(int x = r.left; x < r.right; x++)
DDRect(framebuffer[r.top] + x, framebuffer.GetWidth(), pattern, r.top + animation, r.GetHeight());
}*/
glColor4ub(255, 0, 0, 255);
//glEnable(GL_LINE_STIPPLE);
glBegin(GL_LINES);
glVertex2i(x, y);
glVertex2i(x + cx, y + cy);
//glVertex2i(10, 10);
//glVertex2i(100, 100);
glEnd();
glDisable(GL_LINE_STIPPLE);
}
void DragRectDraw0(const Vector<Rect>& clip, const Rect& rect, int n, const byte *pattern, int animation)
{
int hn = min(rect.GetHeight(), n);
int vn = min(rect.GetWidth(), n);
DrawLine(clip, rect.left, rect.top, rect.GetWidth(), hn, true, pattern, animation);
DrawLine(clip, rect.left, rect.top + hn, vn, rect.GetHeight() - hn, false, pattern, animation);
DrawLine(clip, rect.right - vn, rect.top + hn, vn, rect.GetHeight() - hn, false, pattern, animation);
DrawLine(clip, rect.left + vn, rect.bottom - hn, rect.GetWidth() - 2 * vn, hn, true, pattern, animation);
}
void DrawDragRect(SystemDraw& w, const Rect& rect1, const Rect& rect2, const Rect& clip, int n, Color color, int type, int animation)
{
static byte solid[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
static byte normal[] = { 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00 };
static byte dashed[] = { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 };
Point p = Ctrl::screenRect.TopLeft();
Vector<Rect> pr;
if(type & Ctrl::DRAWDRAGRECT_SCREEN) {
pr.Add(Rect(Ctrl::screenRect.GetSize()));
type &= ~Ctrl::DRAWDRAGRECT_SCREEN;
p = Point(0, 0);
}
else
//pr = Intersection(screenRect, clip.Offseted(p));
pr.Add(clip.Offseted(p));
const byte *pattern = type == DRAWDRAGRECT_DASHED ? dashed :
type == DRAWDRAGRECT_NORMAL ? normal : solid;
DragRectDraw0(pr, rect1.Offseted(p), n, pattern, animation);
DragRectDraw0(pr, rect2.Offseted(p), n, pattern, animation);
}
void DrawDragRect(Ctrl& q, const Rect& rect1, const Rect& rect2, const Rect& clip, int n,
Color color, int type, int animation)
{
DragRect r;
r.rect1 = rect1;
r.rect2 = rect2;
r.clip = clip;
r.n = n;
r.color = color;
r.type = type;
r.animation = animation;
SystemDraw::dragRect.Add(r);
//q.DragRectDraw(rect1, rect2, clip, n, color, type, animation);
}

View file

@ -52,6 +52,15 @@ enum TransformState {
TS_AFTER_PAINT
};
struct DragRect : Moveable<DragRect> {
Rect rect1, rect2;
Rect clip;
int n;
Color color;
int type;
int animation;
};
class SystemDraw : public Draw {
public:
virtual dword GetInfo() const;
@ -130,6 +139,8 @@ public:
float angle;
float scale;
static Vector<DragRect> dragRect;
private:
Array<Cloff> cloff;
int ci;
@ -207,8 +218,7 @@ public:
ImageDraw(int cx, int cy);
};
void DrawDragRect(SystemDraw& w, const Rect& rect1, const Rect& rect2, const Rect& clip, int n,
Color color, uint64 pattern);
void DrawDragRect(SystemDraw& w, const Rect& rect1, const Rect& rect2, const Rect& clip, int n, Color color, int type, int animation);
bool GlIsWaitingEvent();
bool GlProcessEvent(bool *quit);
@ -244,17 +254,12 @@ struct InfoPanel;
#define GUIPLATFORM_CTRL_TOP_DECLS Ctrl *owner_window;
#define GUIPLATFORM_CTRL_DECLS_INCLUDE <WinGl/Ctrl.h>
#define GUIPLATFORM_PASTECLIP_DECLS
#define GUIPLATFORM_PASTECLIP_DECLS \
bool dnd; \
friend struct DnDLoop;
#define GUIPLATFORM_TOPWINDOW_DECLS_INCLUDE <WinGl/Top.h>
//#include <CtrlCore/stdids.h>
/*#ifndef PLATFORM_WIN32
#include "vkcodes.h" //FIXME
#endif*/
#define GUIPLATFORM_INCLUDE_AFTER <WinGl/After.h>
END_UPP_NAMESPACE
#define GUIPLATFORM_INCLUDE_AFTER <WinGl/After.h>
#endif

View file

@ -20,37 +20,40 @@ IMAGE_ID(close)
IMAGE_ID(bgtitle)
IMAGE_ID(title)
IMAGE_ID(border)
IMAGE_ID(hand)
IMAGE_BEGIN_DATA
IMAGE_DATA(120,156,237,90,205,75,85,81,16,63,101,79,13,148,144,104,231,162,77,155,254,132,8,218,182,12,44,8,162,77,46,162)
IMAGE_DATA(69,187,90,68,153,47,136,8,34,52,200,146,176,180,44,80,179,22,111,35,162,162,46,252,64,240,3,63,64,68,17,68)
IMAGE_DATA(16,17,65,87,186,155,206,123,190,247,60,206,61,119,206,204,121,247,189,10,238,92,6,59,247,252,126,115,102,126,51,247)
IMAGE_DATA(94,163,84,149,186,160,210,86,174,78,165,127,128,146,25,8,57,0,32,226,192,225,225,69,56,56,184,196,229,192,254,254)
IMAGE_DATA(21,216,219,187,6,187,187,215,57,28,216,217,185,1,219,219,55,97,107,235,14,108,108,212,187,56,176,185,89,175,113,247)
IMAGE_DATA(97,125,253,33,172,173,61,130,229,229,167,20,7,86,87,31,195,202,202,19,141,107,132,197,197,87,48,63,255,22,102,103)
IMAGE_DATA(155,195,56,176,180,244,18,22,22,94,195,220,92,19,204,204,180,194,212,84,39,76,78,126,135,137,137,118,27,71,99,154)
IMAGE_DATA(97,122,250,189,198,181,193,248,120,55,140,140,140,100,253,23,12,15,119,98,142,142,213,170,113,109,48,54,214,9,163,163)
IMAGE_DATA(191,243,120,117,220,75,147,163,49,159,181,119,192,208,208,15,24,28,252,9,253,253,41,178,222,129,129,118,232,235,251,154)
IMAGE_DATA(143,147,74,117,147,248,84,234,75,32,199,174,174,111,161,250,216,52,232,232,248,68,225,173,231,182,180,188,19,205,97,83)
IMAGE_DATA(211,27,241,172,39,147,207,69,103,52,52,60,19,159,33,192,6,45,161,206,169,211,170,34,227,10,53,94,101,30,214,35)
IMAGE_DATA(67,127,206,31,142,214,255,253,189,144,122,3,186,168,42,45,92,66,139,150,56,41,28,215,51,156,218,158,15,164,27,216)
IMAGE_DATA(82,224,73,142,5,27,202,33,176,1,14,3,155,231,72,176,62,185,248,212,234,163,229,95,232,175,108,62,107,244,85,153)
IMAGE_DATA(189,40,225,44,206,53,238,67,194,225,23,178,47,201,179,80,126,160,129,140,24,246,183,143,63,63,44,47,41,159,27,67)
IMAGE_DATA(178,239,58,131,147,35,85,39,101,46,141,37,124,91,78,146,89,177,221,243,229,115,227,248,60,119,62,207,173,43,150,221)
IMAGE_DATA(152,47,164,163,168,193,207,187,200,204,207,127,33,252,156,75,227,96,190,79,28,48,12,45,157,49,48,206,166,7,21,43)
IMAGE_DATA(12,207,185,103,222,199,121,219,106,193,88,204,247,113,91,28,159,60,162,210,35,170,190,216,98,217,106,113,113,241,249,216)
IMAGE_DATA(37,49,108,113,164,124,28,199,151,143,226,208,86,163,127,237,175,84,101,25,199,100,87,0,10,195,45,34,12,71,13,173)
IMAGE_DATA(205,148,42,253,195,195,201,35,42,61,204,125,175,190,196,141,142,27,237,23,144,153,176,11,87,168,192,230,61,31,183,197)
IMAGE_DATA(241,201,35,42,61,204,125,175,190,84,232,86,151,101,91,109,57,144,157,8,22,214,37,184,77,32,180,118,22,254,175,239)
IMAGE_DATA(81,245,81,186,80,122,114,114,49,246,143,173,90,95,229,217,43,144,9,18,157,8,72,38,229,226,184,240,133,114,176,216)
IMAGE_DATA(46,14,110,22,247,188,176,179,11,229,73,250,32,169,213,228,169,34,246,194,119,70,172,179,24,191,153,138,183,71,213,71)
IMAGE_DATA(233,66,233,201,201,197,216,63,54,243,205,68,89,32,75,212,16,226,176,146,190,133,184,28,44,190,139,67,53,146,139,199)
IMAGE_DATA(251,56,150,36,7,14,222,228,168,18,235,207,205,77,58,83,241,192,198,3,91,20,14,55,55,241,192,198,159,210,226,237)
IMAGE_DATA(81,245,81,186,80,122,114,114,49,246,143,45,254,37,63,200,193,205,226,158,23,118,118,161,60,73,31,36,181,154,60,85)
IMAGE_DATA(196,94,248,206,136,117,22,171,244,21,145,89,159,52,195,109,120,42,150,47,158,147,7,198,187,206,140,10,207,209,167,88)
IMAGE_DATA(186,152,247,36,125,226,91,4,195,228,74,78,34,150,13,19,227,163,199,75,250,197,183,40,222,76,87,171,171,67,15,199)
IMAGE_DATA(123,233,117,206,109,88,219,158,237,62,21,7,239,187,176,97,28,10,43,197,75,242,145,212,235,171,39,149,39,85,7,105)
IMAGE_DATA(103,244,149,179,186,186,86,184,253,160,23,238,190,232,133,123,31,123,65,186,206,7,43,203,252,219,76,18,206,94,238,129)
IMAGE_DATA(243,183,150,160,182,49,253,17,22,174,211,99,158,208,87,246,239,178,220,231,233,196,151,223,101,230,255,167,206,173,41,79)
IMAGE_DATA(38,147,49,190,72,248,220,218,229,62,179,240,7,102,13,153,161,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
IMAGE_END_DATA(992, 21)
IMAGE_DATA(120,156,237,90,205,75,84,81,20,191,101,163,6,74,72,180,115,209,166,77,127,66,4,109,91,6,22,4,209,38,23,209)
IMAGE_DATA(162,93,45,162,204,9,34,130,8,13,178,36,44,45,11,212,172,197,108,68,84,212,133,31,8,126,224,7,12,162,8,34)
IMAGE_DATA(136,136,160,43,221,157,238,140,51,227,245,188,251,206,61,231,206,27,43,120,231,113,208,247,238,239,119,238,57,191,115,222)
IMAGE_DATA(123,227,135,170,82,23,84,198,202,213,169,204,23,80,50,3,33,7,0,68,28,56,56,184,8,251,251,151,184,28,216,219)
IMAGE_DATA(187,2,187,187,215,96,103,231,58,135,3,219,219,55,96,107,235,38,108,110,222,129,245,245,122,23,7,54,54,234,53,238)
IMAGE_DATA(62,172,173,61,132,213,213,71,144,78,63,165,56,176,178,242,24,150,151,159,104,92,35,44,46,190,130,249,249,183,48,59)
IMAGE_DATA(219,28,198,129,165,165,151,176,176,240,26,230,230,154,96,102,166,21,166,166,58,97,114,242,59,76,76,180,219,56,26,211)
IMAGE_DATA(12,211,211,239,53,174,13,198,199,187,97,100,100,36,231,191,96,120,184,19,115,116,172,86,141,107,131,177,177,78,24,29)
IMAGE_DATA(253,93,192,171,163,94,154,28,141,249,172,189,3,134,134,126,192,224,224,79,232,239,79,145,245,14,12,180,67,95,223,215)
IMAGE_DATA(66,156,84,170,155,196,167,82,95,2,57,118,117,125,11,213,199,166,65,71,199,39,10,111,221,183,165,229,157,104,14,155)
IMAGE_DATA(154,222,136,103,61,153,124,46,218,163,161,225,153,120,15,1,54,104,9,117,78,157,86,21,89,87,168,241,42,123,179,30)
IMAGE_DATA(26,250,190,176,57,58,255,239,175,133,212,27,208,69,85,105,225,18,90,180,196,113,225,184,158,229,212,246,124,32,221,192)
IMAGE_DATA(158,4,158,228,88,176,161,28,2,27,224,48,176,5,142,4,235,147,139,79,173,62,90,254,133,254,202,230,179,70,31,149)
IMAGE_DATA(185,131,18,206,226,92,227,222,36,28,126,49,235,146,60,139,229,7,26,200,136,97,127,250,248,243,195,242,146,242,185,49)
IMAGE_DATA(36,235,174,61,56,57,82,117,82,230,210,88,194,183,229,36,153,21,219,53,95,62,55,142,207,125,231,115,223,186,98,217)
IMAGE_DATA(141,249,64,58,140,26,124,189,139,204,124,253,23,195,207,187,52,14,230,251,196,1,195,208,169,51,6,198,217,244,160,98)
IMAGE_DATA(133,225,57,215,204,235,56,111,91,45,24,139,249,62,110,139,227,147,71,84,122,68,213,23,91,44,91,45,46,46,222,31)
IMAGE_DATA(187,36,134,45,142,148,143,227,248,242,81,28,218,106,244,199,254,74,85,150,117,76,118,5,160,48,220,34,194,112,212,208)
IMAGE_DATA(218,76,169,147,191,121,56,121,68,165,135,185,238,213,151,184,209,113,163,253,2,50,19,118,225,138,21,216,188,230,227,182)
IMAGE_DATA(56,62,121,68,165,135,185,238,213,151,10,221,234,178,92,171,45,27,178,19,193,194,186,4,183,9,132,206,157,133,255,235)
IMAGE_DATA(107,84,125,148,46,148,158,156,92,140,245,35,171,214,71,121,238,8,100,130,68,39,2,146,73,185,56,46,124,177,28,44)
IMAGE_DATA(182,139,131,155,197,221,47,108,239,98,121,146,62,72,106,53,121,170,132,189,240,157,17,235,44,198,79,166,210,173,81,245)
IMAGE_DATA(81,186,80,122,114,114,49,214,143,204,124,50,81,22,200,18,53,132,216,236,68,159,66,92,14,22,223,197,161,26,201,197)
IMAGE_DATA(227,117,28,75,146,3,7,111,114,212,9,235,207,205,77,58,83,241,192,198,3,91,18,14,55,55,241,192,198,175,210,210)
IMAGE_DATA(173,81,245,81,186,80,122,114,114,49,214,143,44,254,144,31,228,224,102,113,247,11,219,187,88,158,164,15,146,90,77,158)
IMAGE_DATA(42,97,47,124,103,196,58,139,85,250,136,200,172,119,154,225,54,60,21,203,23,207,201,3,227,93,123,70,133,231,232,83)
IMAGE_DATA(42,93,204,107,146,62,241,45,130,97,114,37,39,17,203,134,137,241,209,227,37,253,226,91,20,79,166,171,213,213,161,155)
IMAGE_DATA(227,181,204,121,222,109,88,219,154,237,58,21,7,175,187,176,97,28,10,43,197,75,242,145,212,235,171,39,149,39,85,7)
IMAGE_DATA(105,103,244,145,183,186,186,86,184,253,160,23,238,190,232,133,123,31,123,65,122,94,8,86,150,253,219,76,18,206,94,238)
IMAGE_DATA(129,243,183,150,160,182,49,243,18,22,158,103,198,60,161,143,220,207,178,220,251,233,216,155,223,101,230,255,83,231,207,41)
IMAGE_DATA(79,38,147,49,190,68,248,252,185,203,125,102,33,59,76,142,95,140,80,159,94,48,14,210,233,244,177,175,97,88,140,51)
IMAGE_DATA(240,214,79,32,97,120,180,79,33,6,23,239,194,217,240,121,151,226,195,28,213,44,197,59,57,148,166,76,44,11,255,7)
IMAGE_DATA(113,204,146,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
IMAGE_END_DATA(1056, 22)

View file

@ -5,7 +5,9 @@
NAMESPACE_UPP
#define LLOG(x)
#define LLOG(x) DLOG(x)
#define LDUMP(x) DDUMP(x)
#define LDUMPC(x) DDUMPC(x)
Ptr<Ctrl> Ctrl::desktop;
Vector<Ctrl *> Ctrl::topctrl;
@ -20,6 +22,8 @@ Rect Ctrl::glCaretRect;
int Ctrl::glCaretTm;
int64 Ctrl::glEventLoop = 0;
int64 Ctrl::glEndSessionLoop = 0;
bool Ctrl::FullWindowDrag = false;
int Ctrl::PaintLock;
void Ctrl::SetDesktop(Ctrl& q)
{
@ -199,6 +203,15 @@ void Ctrl::DrawScreen()
draw.End();
}
CursorSync(draw);
for(int i = 0; i < SystemDraw::dragRect.GetCount(); i++)
{
const DragRect& r = SystemDraw::dragRect[i];
DrawDragRect(draw, r.rect1, r.rect2, r.clip, r.n, r.color, r.type, r.animation);
}
SystemDraw::dragRect.Clear();
desktop->ApplyTransform(TS_AFTER_PAINT);
glLoadIdentity();
#if CLIP_MODE == 2
@ -217,38 +230,6 @@ void Ctrl::DrawScreen()
}
}
void Ctrl::DrawLine(const Vector<Rect>& clip, int x, int y, int cx, int cy, bool horz, const byte *pattern, int animation)
{
if(cx <= 0 || cy <= 0)
return;
}
void Ctrl::DragRectDraw0(const Vector<Rect>& clip, const Rect& rect, int n, const byte *pattern, int animation)
{
int hn = min(rect.GetHeight(), n);
int vn = min(rect.GetWidth(), n);
DrawLine(clip, rect.left, rect.top, rect.GetWidth(), hn, true, pattern, animation);
DrawLine(clip, rect.left, rect.top + hn, vn, rect.GetHeight() - hn, false, pattern, animation);
DrawLine(clip, rect.right - vn, rect.top + hn, vn, rect.GetHeight() - hn, false, pattern, animation);
DrawLine(clip, rect.left + vn, rect.bottom - hn, rect.GetWidth() - 2 * vn, hn, true, pattern, animation);
}
void Ctrl::DragRectDraw(const Rect& rect1, const Rect& rect2, const Rect& clip, int n,
Color color, int type, int animation)
{
static byte solid[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
static byte normal[] = { 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00 };
static byte dashed[] = { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 };
Point p = GetScreenView().TopLeft();
Vector<Rect> ir;
ir.Add(screenRect);
Vector<Rect> pr = Intersection(ir, clip.Offseted(p));
const byte *pattern = type == DRAWDRAGRECT_DASHED ? dashed :
type == DRAWDRAGRECT_NORMAL ? normal : solid;
DragRectDraw0(pr, rect1.Offseted(p), n, pattern, animation);
DragRectDraw0(pr, rect2.Offseted(p), n, pattern, animation);
}
void Ctrl::WndUpdate0r(const Rect& r)
{
GuiLock __;
@ -274,7 +255,7 @@ void Ctrl::EventLoop0(Ctrl *ctrl)
ASSERT(IsMainThread());
ASSERT(LoopLevel == 0 || ctrl);
LoopLevel++;
LLOG("Entering event loop at level " << LoopLevel << BeginIndent);
LLOG("Entering event loop at level " << LoopLevel << LOG_BEGIN);
Ptr<Ctrl> ploop;
if(ctrl) {
ploop = LoopCtrl;
@ -287,18 +268,14 @@ void Ctrl::EventLoop0(Ctrl *ctrl)
int64 loopno = ++glEventLoop;
while(loopno > glEndSessionLoop && !quit && (ctrl ? ctrl->IsOpen() && ctrl->InLoop() : GetTopCtrls().GetCount()))
{
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / GuiSleep");
SyncCaret();
GuiSleep(20);
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / ProcessEvents");
ProcessEvents(&quit);
// LLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": EventLoop / after ProcessEvents");
}
if(ctrl)
LoopCtrl = ploop;
LoopLevel--;
LLOG(EndIndent << "Leaving event loop ");
}
void Ctrl::GuiSleep0(int ms)
@ -426,10 +403,13 @@ void Ctrl::SetWndForeground0()
{
GuiLock __;
ASSERT(IsOpen());
if(top && top->owner_window && !IsWndForeground())
if(IsWndForeground())
return;
if(top && top->owner_window)
top->owner_window->PutForeground();
PutForeground();
ActivateWnd();
if(this != focusCtrl)
ActivateWnd();
}
bool Ctrl::IsWndForeground() const