| 142 | } |
| 143 | |
| 144 | INT_PTR CALLBACK |
| 145 | NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
| 146 | { |
| 147 | PNHRIPWindow data = (PNHRIPWindow) GetWindowLongPtr(hWnd, GWLP_USERDATA); |
| 148 | switch (message) { |
| 149 | case WM_INITDIALOG: { |
| 150 | HDC hdc = GetDC(hWnd); |
| 151 | cached_font * font = mswin_get_font(NHW_TEXT, ATR_NONE, hdc, FALSE); |
| 152 | |
| 153 | /* set text control font */ |
| 154 | SendMessage(hWnd, WM_SETFONT, (WPARAM)font->hFont, 0); |
| 155 | ReleaseDC(hWnd, hdc); |
| 156 | |
| 157 | SetFocus(GetDlgItem(hWnd, IDOK)); |
| 158 | } break; |
| 159 | |
| 160 | case WM_MSNH_COMMAND: |
| 161 | onMSNHCommand(hWnd, wParam, lParam); |
| 162 | break; |
| 163 | |
| 164 | case WM_PAINT: { |
| 165 | int bitmap_offset; |
| 166 | RECT clientrect; |
| 167 | RECT textrect; |
| 168 | HDC hdcBitmap; |
| 169 | HANDLE OldBitmap; |
| 170 | PAINTSTRUCT ps; |
| 171 | HFONT OldFont; |
| 172 | HDC hdc = BeginPaint(hWnd, &ps); |
| 173 | cached_font * font = mswin_get_font(NHW_TEXT, ATR_NONE, hdc, FALSE); |
| 174 | |
| 175 | OldFont = SelectObject(hdc, font->hFont); |
| 176 | hdcBitmap = CreateCompatibleDC(hdc); |
| 177 | SetBkMode(hdc, TRANSPARENT); |
| 178 | GetClientRect(hWnd, &clientrect); |
| 179 | textrect = clientrect; |
| 180 | textrect.top += data->y; |
| 181 | textrect.left += data->x; |
| 182 | textrect.right -= data->x; |
| 183 | if (data->window_text) { |
| 184 | DrawText(hdc, data->window_text, strlen(data->window_text), |
| 185 | &textrect, DT_LEFT | DT_NOPREFIX | DT_CALCRECT); |
| 186 | DrawText(hdc, data->window_text, strlen(data->window_text), |
| 187 | &textrect, DT_LEFT | DT_NOPREFIX); |
| 188 | } |
| 189 | OldBitmap = SelectObject(hdcBitmap, GetNHApp()->bmpRip); |
| 190 | SetBkMode(hdc, OPAQUE); |
| 191 | bitmap_offset = (textrect.right - textrect.left - data->width) / 2; |
| 192 | StretchBlt(hdc, textrect.left + bitmap_offset, textrect.bottom, |
| 193 | data->width, data->height, |
| 194 | hdcBitmap, 0, 0, RIP_WIDTH, RIP_HEIGHT, SRCCOPY); |
| 195 | SetBkMode(hdc, TRANSPARENT); |
| 196 | if (data->rip_text) { |
| 197 | textrect.left += data->graveX + bitmap_offset; |
| 198 | textrect.top = textrect.bottom + data->graveY; |
| 199 | textrect.right = textrect.left + data->graveWidth; |
| 200 | textrect.bottom = textrect.top + data->graveHeight; |
| 201 | DrawText(hdc, data->rip_text, strlen(data->rip_text), &textrect, |
nothing calls this directly
no test coverage detected