function [] = nowzooming;
%NOWZOOMING - WindownButtonDownFcn callbcak for zooming within BST_MRIVIEWER 
% function [] = nowzooming;
% See BST_MRIVIEWER subfunction varargout = Zoom_Callback(h, eventdata, handles, varargin)
% for more details

%<autobegin> ---------------------- 23-Sep-2004 10:36:11 -----------------------
% --------- Automatically Generated Comments Block Using AUTO_COMMENTS ---------
%
% CATEGORY: GUI and Related
%
% At Check-in: $Author: Mosher $  $Revision: 2 $  $Date: 9/23/04 8:58a $
%
% This software is part of BrainStorm Toolbox Version 2.0 (Alpha) 23-Sep-2004
% 
% Principal Investigators and Developers:
% ** Richard M. Leahy, PhD, Signal & Image Processing Institute,
%    University of Southern California, Los Angeles, CA
% ** John C. Mosher, PhD, Biophysics Group,
%    Los Alamos National Laboratory, Los Alamos, NM
% ** Sylvain Baillet, PhD, Cognitive Neuroscience & Brain Imaging Laboratory,
%    CNRS, Hopital de la Salpetriere, Paris, France
% 
% See BrainStorm website at http://neuroimage.usc.edu for further information.
% 
% Copyright (c) 2004 BrainStorm by the University of Southern California
% This software distributed  under the terms of the GNU General Public License
% as published by the Free Software Foundation. Further details on the GPL
% license can be found at http://www.gnu.org/copyleft/gpl.html .
% 
% FOR RESEARCH PURPOSES ONLY. THE SOFTWARE IS PROVIDED "AS IS," AND THE
% UNIVERSITY OF SOUTHERN CALIFORNIA AND ITS COLLABORATORS DO NOT MAKE ANY
% WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
% MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, NOR DO THEY ASSUME ANY
% LIABILITY OR RESPONSIBILITY FOR THE USE OF THIS SOFTWARE.
%<autoend> ------------------------ 23-Sep-2004 10:36:11 -----------------------


% CATEGORY: GUI and Related

MRIfig = findobj(0,'Tag','MRIViewer','Type','figure');                  
handles = guihandles(MRIfig);



switch(gca)
    case handles.axa % Axial view
        set([handles.axc],'Xlimmode','manual','Ylimmode','auto')
        set([handles.axs],'Xlimmode','manual','Ylimmode','auto')
        
        Xlim = get(gca,'Xlim');
        set(handles.axc,'Xlim',Xlim)
        Ylim = get(gca,'Ylim');
        set(handles.axs,'Xlim',Ylim)
        
        
    case handles.axc
        set([handles.axa],'Xlimmode','manual','Ylimmode','auto')
        set([handles.axs],'Xlimmode','auto','Ylimmode','manual')
              
        Xlim = get(gca,'Xlim');
        set(handles.axa,'Xlim',Xlim)
        Ylim = get(gca,'Ylim');
        set(handles.axs,'Ylim',Ylim)
        
    case handles.axs
        set([handles.axa],'Xlimmode','auto','Ylimmode','manual')
        set([handles.axc],'Xlimmode','auto','Ylimmode','manual')
      
        Xlim = get(gca,'Xlim');
        set(handles.axa,'Ylim',Xlim)
        Ylim = get(gca,'Ylim');
        set(handles.axc,'Ylim',Ylim)
end

% % Update label locations
% set(findobj(gcf,'string','P'),'Visible','off')
% set(findobj(gcf,'string','A'),'Visible','off')
% set(findobj(gcf,'string','T'),'Visible','off')
% set(findobj(gcf,'string','B'),'Visible','off')
% set(findobj(gcf,'string','L'),'Visible','off')
% set(findobj(gcf,'string','R'),'Visible','off')
% axes(handles.axa)
% V = axis;
% %set(handles.axa,'Tag','axa','Xtick',[],'Ytick',[])
% text(V(1),V(4),'A','horizontalalignment','right',...
%     'verticalalignment','baseline','color','w');
% text(V(1),V(3),'P','horizontalalignment','right',...
%     'verticalalignment','baseline','color','w');
% text(V(1),V(3),'L','horizontalalignment','left',...
%     'verticalalignment','cap','color','w');
% text(V(2),V(3),'R','horizontalalignment','right',...
%     'verticalalignment','cap','color','w');
% 
% %% -- Sagittal view
% axes(handles.axs)
% V = axis;
% set(handles.axs,'Tag','axs','Xtick',[],'Ytick',[])
% text(V(1),V(4),'T','horizontalalignment','right',...
%     'verticalalignment','baseline','color','w');
% text(V(1),V(3),'B','horizontalalignment','right',...
%     'verticalalignment','baseline','color','w');
% text(V(1),V(3),'P','horizontalalignment','left',...
%     'verticalalignment','cap','color','w');
% text(V(2),V(3),'A','horizontalalignment','right',...
%     'verticalalignment','cap','color','w');
% 
% 
% %% -- Coronal view
% axes(handles.axc)
% V = axis;
% set(handles.axc,'Tag','axc','Xtick',[],'Ytick',[]);
% text(V(1),V(4),'T','horizontalalignment','right',...
%     'verticalalignment','baseline','color','w');
% text(V(1),V(3),'B','horizontalalignment','right',...
%     'verticalalignment','baseline','color','w');
% text(V(1),V(3),'L','horizontalalignment','left',...
%     'verticalalignment','cap','color','w');
% text(V(2),V(3),'R','horizontalalignment','right',...
%     'verticalalignment','cap','color','w');
% % 
% 
% set(MRIfig,'WindowButtonMotionFcn',mfilename,'WindowButtonUpFcn',mfilename)
