@@ -895,6 +895,42 @@ void JsonViewDlg::EnableControls(const std::vector<DWORD>& ids, bool enable)
895895 EnableWindow (GetDlgItem (getHSelf (), id), enable ? TRUE : FALSE );
896896}
897897
898+ void JsonViewDlg::SetTreeViewZoom (double dwZoomFactor)
899+ {
900+ HWND hTreeView = GetDlgItem (getHSelf (), IDC_TREE);
901+ static HFONT hCurrentFont = reinterpret_cast <HFONT>(SendMessage (hTreeView, WM_GETFONT, 0 , 0 ));
902+
903+ LOGFONT logFont {};
904+ GetObject (hCurrentFont, sizeof (LOGFONT), &logFont);
905+ logFont.lfHeight = static_cast <LONG>(logFont.lfHeight * dwZoomFactor);
906+
907+ static HFONT hTreeFont = nullptr ;
908+ if (hTreeFont)
909+ {
910+ DeleteObject (hTreeFont);
911+ }
912+ hTreeFont = CreateFontIndirect (&logFont);
913+
914+ SendMessage (hTreeView, WM_SETFONT, reinterpret_cast <WPARAM>(hTreeFont), TRUE );
915+ InvalidateRect (hTreeView, nullptr , TRUE );
916+ }
917+
918+ void JsonViewDlg::HandleZoom (bool zoomIn)
919+ {
920+ static double zoomLevel = 1.0 ; // Start at 100% zoom (Max 300% and min 80%)
921+
922+ if (zoomIn && zoomLevel < 3.0 )
923+ {
924+ zoomLevel += 0.1 ; // Zoom in (max 300%)
925+ }
926+ else if (!zoomIn && zoomLevel > 0.8 )
927+ {
928+ zoomLevel -= 0.1 ; // Zoom out (min 80%)
929+ }
930+
931+ SetTreeViewZoom (zoomLevel);
932+ }
933+
898934void JsonViewDlg::HandleTreeEvents (LPARAM lParam) const
899935{
900936 LPNMHDR lpnmh = reinterpret_cast <LPNMHDR>(lParam);
@@ -1107,6 +1143,16 @@ INT_PTR JsonViewDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
11071143 return TRUE ;
11081144 }
11091145
1146+ case WM_MOUSEWHEEL:
1147+ {
1148+ if (GetKeyState (VK_CONTROL) & 0x8000 )
1149+ {
1150+ HandleZoom (GET_WHEEL_DELTA_WPARAM (wParam) > 0 );
1151+ return TRUE ;
1152+ }
1153+ return FALSE ;
1154+ }
1155+
11101156 default :
11111157 return DockingDlgInterface::run_dlgProc (message, wParam, lParam);
11121158 }
0 commit comments