864 } |
864 } |
865 |
865 |
866 assert(w); |
866 assert(w); |
867 vp = w->viewport; |
867 vp = w->viewport; |
868 |
868 |
869 if (how == ZOOM_IN) { |
869 switch (how) { |
870 if (vp->zoom == 0) return false; |
870 case ZOOM_IN: |
871 vp->zoom--; |
871 if (vp->zoom == 0) return false; |
872 vp->virtual_width >>= 1; |
872 vp->zoom--; |
873 vp->virtual_height >>= 1; |
873 vp->virtual_width >>= 1; |
874 |
874 vp->virtual_height >>= 1; |
875 WP(w,vp_d).scrollpos_x += vp->virtual_width >> 1; |
875 |
876 WP(w,vp_d).scrollpos_y += vp->virtual_height >> 1; |
876 WP(w,vp_d).scrollpos_x += vp->virtual_width >> 1; |
877 |
877 WP(w,vp_d).scrollpos_y += vp->virtual_height >> 1; |
878 SetWindowDirty(w); |
878 break; |
879 } else if (how == ZOOM_OUT) { |
879 case ZOOM_OUT: |
880 if (vp->zoom == 2) return false; |
880 if (vp->zoom == 2) return false; |
881 vp->zoom++; |
881 vp->zoom++; |
882 |
882 |
883 WP(w,vp_d).scrollpos_x -= vp->virtual_width >> 1; |
883 WP(w,vp_d).scrollpos_x -= vp->virtual_width >> 1; |
884 WP(w,vp_d).scrollpos_y -= vp->virtual_height >> 1; |
884 WP(w,vp_d).scrollpos_y -= vp->virtual_height >> 1; |
885 |
885 |
886 vp->virtual_width <<= 1; |
886 vp->virtual_width <<= 1; |
887 vp->virtual_height <<= 1; |
887 vp->virtual_height <<= 1; |
888 |
888 break; |
889 SetWindowDirty(w); |
889 default: return false; |
890 } |
890 } |
|
891 |
|
892 SetWindowDirty(w); |
891 |
893 |
892 // routine to disable/enable the zoom buttons. Didn't know where to place these otherwise |
894 // routine to disable/enable the zoom buttons. Didn't know where to place these otherwise |
893 { |
895 { |
894 Window *wt = NULL; |
896 Window *wt = NULL; |
895 |
897 |