function dummy = mouseevent(sisodb,EventName)
%MOUSEEVENT  Processes mouse events.

%   Author(s): P. Gahinet
%   Copyright 1986-2000 The MathWorks, Inc. 
%   $Revision: 1.4 $  $Date: 2000/06/14 20:22:14 $

% REVISIT
dummy = [];

% Notify plot editors of mouse event
% RE: Give priority to any engaged drag operation
GlobalModeOn = strcmp(sisodb.GlobalMode,'on');
InDragMode = LocalTestDragMode(sisodb.PlotEditors);
if any(InDragMode)
    % Send event to editor in drag mode
    mouseevent(sisodb.PlotEditors(InDragMode),EventName,...
        sisodb.Status,1,GlobalModeOn);
    return
else
    for ct=1:length(sisodb.PlotEditors)
        IsOwner = mouseevent(sisodb.PlotEditors(ct),EventName,...
            sisodb.Status,0,GlobalModeOn);
        if IsOwner
            % Owned and processed by some editor
            return
        end
    end
end

% Process GUI-wide event
switch EventName
case 'wbm'
    % Window button motion
    if ~strcmp(get(sisodb.Figure,'Pointer'),'arrow')
        set(sisodb.Figure,'Pointer','arrow');
    end
    
    % Customize status if above loop configuration diagram
    HG = sisodb.HG;
    CP = get(HG.LoopConfigFrame.ConfigAxes,'CurrentPoint');
    if CP(1,3)==1,
        % Above loop configuration diagram: temporarily override status
        hgset_status(sisodb,...
            sprintf('Click on G, H, F to show the system data.\nClick on C to edit the compensator.'));
    else
        hgset_status(sisodb,sisodb.Status);
    end
end


%-------------------------Local Functions-------------------------

%%%%%%%%%%%%%%%%%%%%%%%
%%% LocalInDragMode %%%
%%%%%%%%%%%%%%%%%%%%%%%
function boo = LocalTestDragMode(Editors)
% Tests for dynamic modes (drag or zooming)

EditModes = get(Editors,{'EditMode'});
ZoomModes = get(Editors,{'ZoomMode'});

boo = strcmp(EditModes,'drag') | ...
    (strcmp(EditModes,'zoom') & strcmp(ZoomModes,'zooming'));

