function dummy = print(sisodb,request)
%PRINT  Prints SISO Tool Editors to hard copy or separate figure.

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

% REVISIT
dummy = [];

SISOfig = sisodb.Figure;
% Find visible editor axes
HG = get(sisodb.PlotEditors(1),'HG');
RLocAxes = findobj(HG.PlotAxes,'flat','Visible','on');
HG = get(sisodb.PlotEditors(2),'HG');
BodeAxes = findobj(HG.PlotAxes(:),'flat','Visible','on');
CopyAx = [RLocAxes ; BodeAxes];

% Prints only the Editor views...
printfig = figure('Visible','off','IntegerHandle','off');  % target figure
h = copyobj(CopyAx,printfig);
set(h,'Xcolor',[0 0 0],'Ycolor',[0 0 0])

%---Get current position of all axes
%pos = get(0,'defaultaxesposition');
set(h,'unit','norm');
AllPos = get(h,{'Position'});
AllPos = cat(1,AllPos{:});
[MaxStartX,IndMaxX] = max(AllPos(:,1));
[MinStartX,IndMinX] = min(AllPos(:,1));
[MaxStartY,IndMaxY] = max(AllPos(:,2));
[MinStartY,IndMinY] = min(AllPos(:,2));
CurrentPos(1,1) = AllPos(IndMinX,1);
CurrentPos(1,2) = AllPos(IndMinY,2);
CurrentPos(1,3) = AllPos(IndMaxX,1)+AllPos(IndMaxX,3)-AllPos(IndMinX,1);
CurrentPos(1,4) = AllPos(IndMaxY,2)+AllPos(IndMaxY,4)-AllPos(IndMinY,2);

% Resize axes to fill rectangle TargetPos
TargetPos = [0.10 0.12 0.85 0.8];
remapfig(CurrentPos,TargetPos,printfig,h)

% Label visibility
T = get(h,{'Title'});
X = get(h,{'Xlabel'});
Y = get(h,{'Ylabel'});
set([T{:} X{:} Y{:}],'visible','on');
% Fine tune label visibility for Bode Editor
if length(BodeAxes)==2
   im = find(BodeAxes(1)==CopyAx);
   ip = find(BodeAxes(2)==CopyAx);
   set([X{im} T{ip}],'visible','off')
end

%---Turn any buttondown functions off.
set(findobj(printfig,'type','line'),'ButtonDownFcn','');

% Process request
switch lower(request)
case 'print'
   set(h,'Box','on')  % box around axis
   printdlg(printfig);
   close(printfig)
case 'print2fig'
   set(printfig,'visible','on')
end
