static VOID MonSelUpdateExtent(IN OUT PMONITORSELWND infoPtr) { DWORD Index; RECT rcMonitor; /* NOTE: This routine calculates the extent of all monitor coordinates. These are not control coordinates! */ if (infoPtr->MonitorsCount > 0) { MonSelMonInfoToRect(&infoPtr->MonitorInfo[0], &infoPtr->rcExtent); for (Index = 1; Index < infoPtr->MonitorsCount; Index++) { MonSelMonInfoToRect(&infoPtr->MonitorInfo[Index], &rcMonitor); UnionRect(&infoPtr->rcExtent, &infoPtr->rcExtent, &rcMonitor); } } else { ZeroMemory(&infoPtr->rcExtent, sizeof(infoPtr->rcExtent)); } }
static VOID MonSelUpdateMonitorsInfo(IN OUT PMONITORSELWND infoPtr, IN BOOL bRepaint) { RECT rcExtSurface, rcExtDisplay; DWORD Index; /* Recalculate rcExtent */ MonSelUpdateExtent(infoPtr); infoPtr-> CanDisplay = infoPtr->MonitorsCount != 0 && (infoPtr->ClientSize.cx > (2 * (infoPtr->Margin.cx + infoPtr->SelectionFrame.cx))) && (infoPtr->ClientSize.cy > (2 * (infoPtr->Margin.cy + infoPtr->SelectionFrame.cy))); if (infoPtr->CanDisplay) { /* Calculate the rectangle on the control in which may be painted */ rcExtSurface.left = infoPtr->Margin.cx; rcExtSurface.top = infoPtr->Margin.cy; rcExtSurface.right = rcExtSurface.left + infoPtr->ClientSize.cx - (2 * infoPtr->Margin.cx); rcExtSurface.bottom = rcExtSurface.top + infoPtr->ClientSize.cy - (2 * infoPtr->Margin.cy); /* Calculate the rectangle on the control that is actually painted on */ rcExtDisplay.left = rcExtDisplay.top = 0; rcExtDisplay.right = infoPtr->rcExtent.right - infoPtr->rcExtent.left; rcExtDisplay.bottom = infoPtr->rcExtent.bottom - infoPtr->rcExtent.top; ScaleRectSizeFit(&rcExtSurface, &rcExtDisplay); infoPtr->rcOldMonitors = infoPtr->rcMonitors; infoPtr->rcMonitors = rcExtDisplay; /* Now that we know in which area all monitors are located, calculate the monitors selection rectangles on the screen */ for (Index = 0; Index < infoPtr->MonitorsCount; Index++) { MonSelMonInfoToRect(&infoPtr->MonitorInfo[Index], &rcExtDisplay); MonSelScaleRectRelative(&infoPtr->rcExtent, &rcExtDisplay, &infoPtr->rcMonitors, &infoPtr->Monitors[Index].rc); } MonSelResetMonitors(infoPtr); if (bRepaint) MonSelRepaint(infoPtr); } else if (bRepaint) { InvalidateRect(infoPtr->hSelf, NULL, TRUE); } }