rri_zoom_menu.m 770 B

123456789101112131415161718192021222324252627282930313233
  1. % Imbed a zoom menu to any figure.
  2. %
  3. % Usage: rri_zoom_menu(fig);
  4. %
  5. % - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
  6. %
  7. %--------------------------------------------------------------------
  8. function menu_hdl = rri_zoom_menu(fig)
  9. if isnumeric(fig)
  10. menu_hdl = uimenu('Parent',fig, ...
  11. 'Label','Zoom on', ...
  12. 'Userdata', 1, ...
  13. 'Callback','rri_zoom_menu(''zoom'');');
  14. return;
  15. end
  16. zoom_on_state = get(gcbo,'Userdata');
  17. if (zoom_on_state == 1)
  18. zoom on;
  19. set(gcbo,'Userdata',0,'Label','Zoom off');
  20. set(gcbf,'pointer','crosshair');
  21. else
  22. zoom off;
  23. set(gcbo,'Userdata',1,'Label','Zoom on');
  24. set(gcbf,'pointer','arrow');
  25. end
  26. return % rri_zoom_menu