%function [PointerType,Status] = hoverstatus(Editor,Axes,CP,Status)
function out = hoverstatus(Editor,Axes,CP,Status)
%HOVERSTATUS  Sets pointer type and status when hovering editor.

%   Author(s): P. Gahinet
%   Copyright 1986-2000 The MathWorks, Inc. 
%   $Revision: 1.12 $  $Date: 2000/07/24 20:53:19 $

% RE: AXES is the axis on which zoom is occurring

HG = Editor.HG;
SISOfig = get(HG.PlotAxes(1),'Parent');

% Get handles of movable markers and lines
ih = find(HG.PlotAxes==Axes);  % 1->mag, 2->phase
if ih==1
    MovableMarkers = comphandles(Editor,'mag');
    NWM = strcmp(get(MovableMarkers,{'Tag'}),'NotchWidthMarker');
else
    MovableMarkers = comphandles(Editor,'phase');
    NWM = logical(zeros(size(MovableMarkers)));
end
PlotLine = HG.BodePlot(ih);

% Get currently hovered object
HitObject = hittest(SISOfig);   

% Set pointer and status
if HitObject==PlotLine
    if ih==1
        % Bode curve in focus
        PointerType = 'hand';
        Status = sprintf('Magnitude plot. Left click and move up or down to adjust the loop gain.');
    else
        PointerType = 'arrow';
        Status = sprintf('Phase plot.  Right click for design options.');  
    end
elseif any(HitObject==MovableMarkers(NWM,:)),
    % Notch width marker is in focus
    PointerType = 'lrdrag';
    Status = sprintf('Left click and move left or right to adjust the notch filter width');
elseif any(HitObject==MovableMarkers(~NWM,:))
    % Pole or zero in focus
    PointerType = 'hand';
    Status = sprintf('Left click to grab and move this compensator pole/zero.');
else
    PointerType = 'arrow';
end

% REVISIT
out = {PointerType Status};