diff --git a/rainbow/Framebuffer/ChSysInit.cpp b/rainbow/Framebuffer/ChSysInit.cpp index 1c4c8e266..e27a7685d 100644 --- a/rainbow/Framebuffer/ChSysInit.cpp +++ b/rainbow/Framebuffer/ChSysInit.cpp @@ -11,6 +11,11 @@ void ChSysInit() ChReset(); } +void ChHostSkin() +{ + ChSysInit(); +} + END_UPP_NAMESPACE #endif diff --git a/rainbow/Framebuffer/Ctrl.h b/rainbow/Framebuffer/Ctrl.h index 70b4c5642..b81ef334c 100644 --- a/rainbow/Framebuffer/Ctrl.h +++ b/rainbow/Framebuffer/Ctrl.h @@ -50,6 +50,9 @@ private: void SetOpen(bool b) { isopen = b; } +protected: + static int PaintLock; + public: static void DoMouseFB(int event, Point p, int zdelta = 0); static bool DoKeyFB(dword key, int cnt); @@ -71,4 +74,8 @@ public: void DragRectDraw(const Rect& rect1, const Rect& rect2, const Rect& clip, int n, Color color, int type, int animation); + static bool FullWindowDrag; + + enum { DRAWDRAGRECT_SCREEN = 0x8000 }; + //$ }; diff --git a/rainbow/Framebuffer/FB.iml b/rainbow/Framebuffer/FB.iml index 583de6ce7..08f565033 100644 --- a/rainbow/Framebuffer/FB.iml +++ b/rainbow/Framebuffer/FB.iml @@ -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) diff --git a/rainbow/Framebuffer/Fb.h b/rainbow/Framebuffer/Fb.h index 9204ac0c7..b4201a35c 100644 --- a/rainbow/Framebuffer/Fb.h +++ b/rainbow/Framebuffer/Fb.h @@ -23,6 +23,7 @@ private: Rect overlapped; Point GetDragMode(Point p); + Image GetDragImage(Point dragmode); void StartDrag(); Rect Margins() const; Rect ComputeClient(Rect r); diff --git a/rainbow/Framebuffer/Image.cpp b/rainbow/Framebuffer/Image.cpp index 3a1253eea..ec97c7b31 100644 --- a/rainbow/Framebuffer/Image.cpp +++ b/rainbow/Framebuffer/Image.cpp @@ -114,6 +114,7 @@ Image Image::SizeRight() { return FBImg::sizeright(); } Image Image::SizeBottomLeft() { return FBImg::sizebottomleft(); } Image Image::SizeBottom() { return FBImg::sizebottom(); } Image Image::SizeBottomRight() { return FBImg::sizebottomright(); } +Image Image::Hand() { return FBImg::hand(); } END_UPP_NAMESPACE diff --git a/rainbow/Framebuffer/TopFrame.cpp b/rainbow/Framebuffer/TopFrame.cpp index 744c0ebae..7863e5a77 100644 --- a/rainbow/Framebuffer/TopFrame.cpp +++ b/rainbow/Framebuffer/TopFrame.cpp @@ -138,9 +138,25 @@ 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(framebuffer.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 ---------------"); } @@ -184,17 +200,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 diff --git a/rainbow/Framebuffer/Wnd.cpp b/rainbow/Framebuffer/Wnd.cpp index 5832f93e1..94b2f58df 100644 --- a/rainbow/Framebuffer/Wnd.cpp +++ b/rainbow/Framebuffer/Wnd.cpp @@ -26,7 +26,8 @@ int Ctrl::renderingMode = MODE_ANTIALIASED; bool Ctrl::fbEndSession; int64 Ctrl::fbEventLoop; int64 Ctrl::fbEndSessionLoop; - +bool Ctrl::FullWindowDrag; +int Ctrl::PaintLock; void Ctrl::SetDesktop(Ctrl& q) { @@ -318,11 +319,23 @@ void Ctrl::DragRectDraw0(const Vector& clip, const Rect& rect, int n, cons void Ctrl::DragRectDraw(const Rect& rect1, const Rect& rect2, const Rect& clip, int n, Color color, int type, int animation) { + DDUMP(rect1); + DDUMP(rect2); + DDUMP(clip); + DDUMP(type); + DDUMP(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 pr = Intersection(GetPaintRects(), clip.Offseted(p)); + Vector pr; + if(type & DRAWDRAGRECT_SCREEN) { + pr.Add(Rect(framebuffer.GetSize())); + type &= ~DRAWDRAGRECT_SCREEN; + p = Point(0, 0); + } + else + pr = Intersection(GetPaintRects(), clip.Offseted(p)); const byte *pattern = type == DRAWDRAGRECT_DASHED ? dashed : type == DRAWDRAGRECT_NORMAL ? normal : solid; RemoveCursor(); @@ -334,6 +347,25 @@ void Ctrl::DragRectDraw(const Rect& rect1, const Rect& rect2, const Rect& clip, void Ctrl::DoPaint() { LLOG("@ DoPaint"); +<<<<<<< .mine + if(!PaintLock) { + bool scroll = false; + if(desktop) + desktop->SyncScroll(); + for(int i = 0; i < topctrl.GetCount(); i++) + topctrl[i]->SyncScroll(); + if((invalid.GetCount() || scroll) && desktop) { + RemoveCursor(); + RemoveCaret(); + for(int phase = 0; phase < 2; phase++) { + DLOG("DoPaint invalid phase " << phase); + DDUMPC(invalid); + SystemDraw painter; + painter.Begin(); + for(int i = 0; i < invalid.GetCount(); i++) { + painter.RectPath(invalid[i]); + AddUpdate(invalid[i]); +======= bool scroll = false; if(desktop) desktop->SyncScroll(); @@ -361,11 +393,24 @@ void Ctrl::DoPaint() painter.End(); Subtract(invalid, r); painter.ExcludeClip(r); +>>>>>>> .r3695 } + painter.Painter::Clip(); + for(int i = topctrl.GetCount() - 1; i >= 0; i--) { + Rect r = topctrl[i]->GetRect(); + Rect ri = GetClipBound(invalid, r); + if(!IsNull(ri)) { + painter.Clipoff(r); + topctrl[i]->UpdateArea(painter, ri - r.TopLeft()); + painter.End(); + Subtract(invalid, r); + painter.ExcludeClip(r); + } + } + Rect ri = GetClipBound(invalid, framebuffer.GetSize()); + if(!IsNull(ri)) + desktop->UpdateArea(painter, ri); } - Rect ri = GetClipBound(invalid, framebuffer.GetSize()); - if(!IsNull(ri)) - desktop->UpdateArea(painter, ri); } } DoUpdate(); @@ -389,7 +434,7 @@ void Ctrl::WndUpdate0r(const Rect& r) bool Ctrl::ProcessEvents(bool *quit) { //LOGBLOCK("@ ProcessEvents"); - MemoryCheckDebug(); +// MemoryCheckDebug(); if(!ProcessEvent(quit)) return false; while(ProcessEvent(quit) && (!LoopCtrl || LoopCtrl->InLoop())); @@ -569,10 +614,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 @@ -657,7 +705,7 @@ void Ctrl::WndScrollView0(const Rect& r, int dx, int dy) } RemoveCursor(); RemoveCaret(); - Rect sr = r.Offseted(GetScreenView().TopLeft()); + Rect sr = r.Offseted(GetScreenRect().TopLeft()); Vector pr = Intersection(GetPaintRects(), sr); for(int i = 0; i < pr.GetCount(); i++) { Rect r = pr[i]; diff --git a/rainbow/Paint/Draw.cpp b/rainbow/Paint/Draw.cpp index 190707856..ad34f9dd8 100644 --- a/rainbow/Paint/Draw.cpp +++ b/rainbow/Paint/Draw.cpp @@ -91,7 +91,7 @@ struct App : public Ctrl { } }; -#define EDITOR 0 +#define EDITOR 1 GUI_APP_MAIN {