diff --git a/rainbow/Framebuffer/Wnd.cpp b/rainbow/Framebuffer/Wnd.cpp index 16e0cd2b2..e6bdd10d5 100644 --- a/rainbow/Framebuffer/Wnd.cpp +++ b/rainbow/Framebuffer/Wnd.cpp @@ -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 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 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) diff --git a/rainbow/Paint/Draw.cpp b/rainbow/Paint/Draw.cpp index 3ab21ba62..190707856 100644 --- a/rainbow/Paint/Draw.cpp +++ b/rainbow/Paint/Draw.cpp @@ -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(); diff --git a/rainbow/WinFb/Win.cpp b/rainbow/WinFb/Win.cpp index 79ef0b6ff..29299cbf0 100644 --- a/rainbow/WinFb/Win.cpp +++ b/rainbow/WinFb/Win.cpp @@ -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);