diff --git a/uppsrc/CtrlCore/Ctrl.cpp b/uppsrc/CtrlCore/Ctrl.cpp index c8db90e33..10fd05a1d 100644 --- a/uppsrc/CtrlCore/Ctrl.cpp +++ b/uppsrc/CtrlCore/Ctrl.cpp @@ -296,6 +296,7 @@ void Ctrl::Show(bool ashow) { if(visible != ashow) { visible = true; fullrefresh = false; + erasebg = true; RefreshFrame(); visible = ashow; fullrefresh = false; @@ -552,6 +553,7 @@ Ctrl::Ctrl() { unicode = false; popupgrab = false; fullrefresh = false; + erasebg = false; akv = false; layout_id_literal = false; top = false; diff --git a/uppsrc/CtrlCore/CtrlCore.h b/uppsrc/CtrlCore/CtrlCore.h index 209942633..f90cf51cb 100644 --- a/uppsrc/CtrlCore/CtrlCore.h +++ b/uppsrc/CtrlCore/CtrlCore.h @@ -566,6 +566,7 @@ private: bool multi_frame:1; // there is more than single frame, they are stored in heap bool top:1; bool megarect:1; // support for large virtual screen area - SetRect.TopLeft > 16000 + bool erasebg:1; // true before first Paint (in Win32, do WM_ERASEBKGND to avoid flickering) static bool was_fullrefresh; // indicates that some widgets might have fullrefresh true diff --git a/uppsrc/CtrlCore/Win32Proc.cpp b/uppsrc/CtrlCore/Win32Proc.cpp index c92c9e3b8..a299162bc 100644 --- a/uppsrc/CtrlCore/Win32Proc.cpp +++ b/uppsrc/CtrlCore/Win32Proc.cpp @@ -235,6 +235,17 @@ LRESULT Ctrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { if(i) InvalidateRect(hwnd, NULL, TRUE); return i; } + case WM_ERASEBKGND: + if(erasebg) { + HDC hdc = (HDC)(wParam); + RECT rc; GetClientRect(hwnd, &rc); + Color c = SColorFace(); + HBRUSH brush = CreateSolidBrush(RGB(c.GetR(), c.GetG(), c.GetB())); + FillRect(hdc, &rc, brush); + DeleteObject(brush); + erasebg = false; + return 1L; + } case WM_PAINT: ASSERT_(!painting || IsPanicMode(), "WM_PAINT invoked for " + Name() + " while in Paint routine"); ASSERT(hwnd); @@ -512,8 +523,6 @@ LRESULT Ctrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { DispatchKey(K_MOUSE_BACKWARD|K_KEYUP, 1); return 0L; } - case WM_ERASEBKGND: - return 1L; case WM_DESTROY: PreDestroy(); break; diff --git a/uppsrc/CtrlCore/Win32Wnd.cpp b/uppsrc/CtrlCore/Win32Wnd.cpp index f647bf304..024fa9329 100644 --- a/uppsrc/CtrlCore/Win32Wnd.cpp +++ b/uppsrc/CtrlCore/Win32Wnd.cpp @@ -258,27 +258,6 @@ void Ctrl::InitWin32(HINSTANCE hInstance) wc.lpszClassName = L"UPP-CLASS-SB-DS-W"; RegisterClassW(&wc); } - { - ILOG("RegisterClassA"); - WNDCLASS wc; - Zero(wc); - wc.style = CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW; - wc.lpfnWndProc = (WNDPROC)Ctrl::WndProc; - wc.hInstance = hInstance; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = IsWinVista() ? (HBRUSH)(COLOR_WINDOW+1) : (HBRUSH)NULL; - wc.lpszClassName = L_("UPP-CLASS-A"); - RegisterClass(&wc); - wc.style = 0x20000|CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW; - wc.lpszClassName = L_("UPP-CLASS-DS-A"); - RegisterClass(&wc); - wc.style = CS_SAVEBITS|CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW; - wc.lpszClassName = L_("UPP-CLASS-SB-A"); - RegisterClass(&wc); - wc.style = 0x20000|CS_DBLCLKS|CS_HREDRAW|CS_VREDRAW|CS_SAVEBITS; - wc.lpszClassName = L_("UPP-CLASS-SB-DS-A"); - RegisterClass(&wc); - } WNDCLASS wca; Zero(wca); @@ -498,6 +477,7 @@ void Ctrl::Create(HWND parent, DWORD style, DWORD exstyle, bool savebits, int sh parent, NULL, hInstance, this); inloop = false; + erasebg = true; // avoid flickering ASSERT(top->hwnd); diff --git a/uppsrc/ide/LayDes/item.cpp b/uppsrc/ide/LayDes/item.cpp index a02fbedfb..48d6339e7 100644 --- a/uppsrc/ide/LayDes/item.cpp +++ b/uppsrc/ide/LayDes/item.cpp @@ -326,7 +326,7 @@ EscValue LayoutItem::CreateEsc() const if(IsNumber(v)) w = (double)v; if(v.Is()) - w = EscColor(v); + w = EscColor(AdjustIfDark(RealizeColor((Color)v))); ctrl.MapSet(property[q].name, w); } ctrl.MapSet("type", (WString)type); diff --git a/upptst/TestChStyle/TestChStyle.lay b/upptst/TestChStyle/TestChStyle.lay index 3fa71475b..ab7604588 100644 --- a/upptst/TestChStyle/TestChStyle.lay +++ b/upptst/TestChStyle/TestChStyle.lay @@ -55,7 +55,7 @@ LAYOUT(TestChStyleLayout, 972, 532) ITEM(Upp::ColorPusher, color, LeftPosZ(152, 64).TopPosZ(264, 24)) ITEM(Upp::DropTree, droptree, LeftPosZ(316, 120).TopPosZ(268, 19)) ITEM(Upp::TreeCtrl, dv___55, LeftPosZ(696, 152).TopPosZ(12, 196)) - ITEM(Upp::RichTextView, dv___56, LeftPosZ(696, 152).TopPosZ(348, 136)) + ITEM(Upp::RichTextView, dv___56, Background(Upp::SLtBlue).LeftPosZ(696, 152).TopPosZ(348, 136)) ITEM(Upp::ColumnList, dv___57, LeftPosZ(696, 152).TopPosZ(212, 132)) ITEM(Upp::DropList, skin, LeftPosZ(8, 140).TopPosZ(504, 19)) ITEM(Upp::Label, vslider_val, LeftPosZ(40, 40).TopPosZ(472, 19)) @@ -64,5 +64,6 @@ LAYOUT(TestChStyleLayout, 972, 532) ITEM(Upp::Label, hslider_val, LeftPosZ(92, 40).TopPosZ(344, 19)) ITEM(Upp::SliderCtrl, hslider2, SetFrame(Upp::BlackFrame()).LeftPosZ(16, 72).TopPosZ(372, 24)) ITEM(Upp::Label, hslider_val2, LeftPosZ(92, 40).TopPosZ(372, 19)) + ITEM(Upp::LabelBox, dv___65, SetLabel(t_("Test")).SetInk(Upp::Cyan).LeftPosZ(200, 64).TopPosZ(444, 80)) END_LAYOUT