From 45373ed8b8906f1a7e715b8c830f91fc1b46649a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Dec 2017 17:41:34 +0300 Subject: standard color table exported from core --- src/mir_app/src/colorchooser.cpp | 40 +++++++++++++++++++++------------------- src/mir_app/src/mir_app.def | 1 + src/mir_app/src/mir_app64.def | 1 + 3 files changed, 23 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/mir_app/src/colorchooser.cpp b/src/mir_app/src/colorchooser.cpp index e437c4a5a2..3d4f2004bc 100644 --- a/src/mir_app/src/colorchooser.cpp +++ b/src/mir_app/src/colorchooser.cpp @@ -32,6 +32,15 @@ static COLORREF colorTable[] = RGB(0,255,0), RGB(255,255,0), RGB(255,0,0), RGB(255,255,255) }; +MIR_APP_DLL(COLORREF*) Srmm_GetColorTable(int *pSize) +{ + if (pSize != nullptr) + *pSize = _countof(colorTable); + return colorTable; +} + +///////////////////////////////////////////////////////////////////////////////////////// + class CColorChooserDlg : public CDlgBase { CCtrlBase m_text; @@ -175,31 +184,26 @@ public: break; case WM_MOUSEMOVE: + if (iCurrentHotTrack == -2) + return 0; // prevent focussing when not drawn yet! { HDC hdc = GetDC(m_hwnd); - POINT pt; - RECT rect; - int but; + // weird stuff + POINT pt; pt.x = LOWORD(lParam); pt.y = HIWORD(lParam); - - if (iCurrentHotTrack == -2) - return 0; // prevent focussing when not drawn yet! - - but = CalculateCoordinatesToButton(pt); - - // weird stuff + int but = CalculateCoordinatesToButton(pt); if (but != iCurrentHotTrack) { if (iCurrentHotTrack >= 0) { - rect = CalculateButtonToCoordinates(iCurrentHotTrack); + RECT rect = CalculateButtonToCoordinates(iCurrentHotTrack); DrawFocusRect(hdc, &rect); iCurrentHotTrack = -1; } iCurrentHotTrack = but; if (iCurrentHotTrack >= 0) { - rect = CalculateButtonToCoordinates(iCurrentHotTrack); + RECT rect = CalculateButtonToCoordinates(iCurrentHotTrack); DrawFocusRect(hdc, &rect); } } @@ -208,20 +212,18 @@ public: break; case WM_PAINT: + RECT rc; + GetClientRect(m_hwnd, &rc); + rc.top += 20; { PAINTSTRUCT ps; - int iThisRow = 1; - int iThisColumn = 0; - - RECT rc; - GetClientRect(m_hwnd, &rc); - rc.top += 20; - HDC hdc = BeginPaint(m_hwnd, &ps); // fill background FillRect(hdc, &rc, GetSysColorBrush(COLOR_WINDOW)); + int iThisRow = 1; + int iThisColumn = 0; for (int i = 0; i < 16; i++) { // decide place to draw the color block in the window iThisColumn++; diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 055c4aa466..983061b83d 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -488,3 +488,4 @@ Clist_SetStatusMode @464 ?MetaSetDefault@MDatabaseCommon@@UAGHPAUDBCachedContact@@@Z @493 NONAME ?EnumResidentSettings@MDatabaseCommon@@UAGHP6AHPBDPAX@Z1@Z @494 NONAME KillModuleOptions @495 +Srmm_GetColorTable @496 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index fa96e4fb75..83a06250da 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -488,3 +488,4 @@ Clist_SetStatusMode @464 ?MetaSetDefault@MDatabaseCommon@@UEAAHPEAUDBCachedContact@@@Z @493 NONAME ?EnumResidentSettings@MDatabaseCommon@@UEAAHP6AHPEBDPEAX@Z1@Z @494 NONAME KillModuleOptions @495 +Srmm_GetColorTable @496 -- cgit v1.2.3