.developing rainbow

git-svn-id: svn://ultimatepp.org/upp/trunk@3667 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-07-16 13:52:05 +00:00
parent 69cba3db25
commit 6442323c2e
3 changed files with 50 additions and 8 deletions

View file

@ -624,8 +624,46 @@ void Ctrl::WndSetPos0(const Rect& rect)
void Ctrl::WndScrollView0(const Rect& r, int dx, int dy)
{
GuiLock __;
Refresh(r);
_DBG_ // add real scroll
if(dx == 0 && dy == 0)
return;
if(dx && dy) {
Refresh(r);
return;
}
RemoveCursor();
RemoveCaret();
Rect sr = r.Offseted(GetScreenView().TopLeft());
Vector<Rect> pr = Intersection(GetPaintRects(), sr);
for(int i = 0; i < pr.GetCount(); i++) {
Rect r = pr[i];
if(dx) {
int n = r.GetWidth() - abs(dx);
if(n > 0) {
int to = r.left + dx * (dx > 0);
int from = r.left - dx * (dx < 0);
for(int y = r.top; y < r.bottom; y++)
memmove(framebuffer[y] + to, framebuffer[y] + from, n * sizeof(RGBA));
}
n = min(abs(dx), r.GetWidth());
Refresh(dx < 0 ? r.left : r.right - n, r.top, n, r.GetHeight());
}
else {
int n = r.GetHeight() - abs(dy);
for(int y = 0; y < n; y++)
memmove(framebuffer[dy < 0 ? r.top + y : r.bottom - 1 - y] + r.left,
framebuffer[dy < 0 ? r.top + y - dy : r.bottom - 1 - y - dy] + r.left,
r.GetWidth() * sizeof(RGBA));
n = min(abs(dy), r.GetHeight());
Refresh(r.left, dy < 0 ? r.bottom - n : r.top, r.GetWidth(), n);
}
}
Vector<Rect> ur;
for(int i = 0; i < invalid.GetCount(); i++)
if(invalid[i].Intersects(sr))
ur.Add(invalid[i]);
for(int i = 0; i < ur.GetCount(); i++)
AddInvalid(ur[i].Offseted(dx, dy));
}
void Ctrl::PopUp(Ctrl *owner, bool savebits, bool activate, bool dropshadow, bool topmost)

View file

@ -7,6 +7,7 @@ struct App : public Ctrl {
EditString x, y;
ArrayCtrl a, b;
DropList dl;
LineEdit editor;
StaticRect popup;
StaticRect popup2;
@ -41,7 +42,7 @@ struct App : public Ctrl {
void LeftDown(Point p, dword)
{
popup.SetRect(p.x, p.y, 300, 400);
popup.SetRect(p.x, p.y, 100, 100);
popup.SetForeground();
}
@ -71,7 +72,7 @@ struct App : public Ctrl {
popup.Add(b.HSizePos(10, 200).VSizePos(10, 10));
b.SetFrame(ViewFrame());
popup.Add(y.HSizePos(210, 10).TopPos(10, 30));
popup.SetRect(800, 100, 300, 400);
popup.SetRect(800, 100, 100, 100);
popup2.SetRect(500, 50, 300, 400);
popup2.SetFrame(BlackFrame());
@ -79,6 +80,9 @@ struct App : public Ctrl {
win.Title("Title of the window !");
Add(editor.LeftPos(500, 300).TopPos(100, 300));
editor <<= LoadFile("U:/scorpio.txt");;
// Add(popup);
for(int i = 0; i < 100; i++)
@ -87,7 +91,7 @@ struct App : public Ctrl {
}
};
#define EDITOR 1
#define EDITOR 0
GUI_APP_MAIN
{
@ -97,8 +101,8 @@ GUI_APP_MAIN
#else
App app;
app.popup.PopUp();
app.popup2.PopUp(&app.popup);
app.win.Open();
// app.popup2.PopUp(&app.popup);
// app.win.Open();
#endif
ChStdSkin();

View file

@ -93,7 +93,7 @@ void FBUpdate(const Rect& r)
if(fbHWND) {
HDC hdc = GetDC(fbHWND);
fbUpdate(hdc, r);
#if 0
#if 1
::PatBlt(hdc, r.left, r.top, r.GetWidth(), r.GetHeight(), DSTINVERT);
Sleep(40);
::PatBlt(hdc, r.left, r.top, r.GetWidth(), r.GetHeight(), DSTINVERT);