[SHIMGVW] Implement IDC_BEST_FIT

- Add two parameters to UpdateZoom.
- Enable/disable IDC_BEST_FIT and IDC_REAL_SIZE
  buttons in UpdateZoom.
- Call ResetZoom on IDC_BEST_FIT.
CORE-19358
This commit is contained in:
Katayama Hirofumi MZ 2023-12-08 11:44:03 +09:00
parent 02312c7bf1
commit 0f519a783c

View file

@ -242,7 +242,7 @@ BOOL Anime_Step(DWORD *pdwDelay)
return FALSE; return FALSE;
} }
static void UpdateZoom(UINT NewZoom) static void UpdateZoom(UINT NewZoom, BOOL bEnableBestFit, BOOL bEnableRealSize)
{ {
BOOL bEnableZoomIn, bEnableZoomOut; BOOL bEnableZoomIn, bEnableZoomOut;
@ -270,6 +270,10 @@ static void UpdateZoom(UINT NewZoom)
/* Redraw the display window */ /* Redraw the display window */
InvalidateRect(hDispWnd, NULL, FALSE); InvalidateRect(hDispWnd, NULL, FALSE);
/* Update toolbar buttons */
SendMessageW(hToolBar, TB_ENABLEBUTTON, IDC_BEST_FIT, bEnableBestFit);
SendMessageW(hToolBar, TB_ENABLEBUTTON, IDC_REAL_SIZE, bEnableRealSize);
} }
static void ZoomInOrOut(BOOL bZoomIn) static void ZoomInOrOut(BOOL bZoomIn)
@ -308,7 +312,7 @@ static void ZoomInOrOut(BOOL bZoomIn)
} }
/* Update toolbar and refresh screen */ /* Update toolbar and refresh screen */
UpdateZoom(NewZoom); UpdateZoom(NewZoom, TRUE, TRUE);
} }
static void ResetZoom(void) static void ResetZoom(void)
@ -353,7 +357,7 @@ static void ResetZoom(void)
} }
} }
UpdateZoom(NewZoom); UpdateZoom(NewZoom, FALSE, TRUE);
} }
static void pLoadImage(LPCWSTR szOpenFileName) static void pLoadImage(LPCWSTR szOpenFileName)
@ -1055,11 +1059,11 @@ ImageView_WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
break; break;
case IDC_BEST_FIT: case IDC_BEST_FIT:
DPRINT1("IDC_BEST_FIT unimplemented\n"); ResetZoom();
break; break;
case IDC_REAL_SIZE: case IDC_REAL_SIZE:
UpdateZoom(100); UpdateZoom(100, TRUE, FALSE);
return 0; return 0;
case IDC_SLIDE_SHOW: case IDC_SLIDE_SHOW: