function vpsetup
%
%  Name: vpsetup
% 
%  Usage: vpsetup
% 
%   Description:
%     Sets up the figure window for the comparative
%     viewports
%
%     Called by diamond.m
%

%
%  Version SWD970902
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This matlab source code was originally     %
% developed as part of "DIAMOND" at          %
% Los Alamos National Laboratory. It may     %
% be copied, modified, and distributed in    %
% any form, provided:                        %
%  a) This notice accompanies the files and  %
%     appears near the top of all source     %
%     code files.                            %
%  b) No payment or commercial services are  %
%     received in exchange for the code.     %
%                                            %
% Original copyright is reserved by the      %
% Regents of the University of California,   %
% in addition to Scott W. Doebling, Phillip  %
% J. Cornwell, Erik G. Straser, and Charles  %
% R. Farrar.                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

global HANDLES

%  Define the figure window

HANDLES.hvpfig = figure('units','normal','position',[0 0 0.95 0.95],...
   'resize','on','visible','off','menubar','none',...
   'numbertitle','off','name','DIAMOND: Comparative Viewports',...
   'closerequestfcn','errordlg(''Do not attempt to close DIAMOND windows improperly'')');

%  Define the graphics and legend axes for each viewport

HANDLES.hvpdataax(1) = axes('position',[0.05 0.60 0.4 0.3],'visible','off');
HANDLES.hvplegax(1) = axes('position',[0.05 0.5 0.4 0.05],'visible','off');
HANDLES.hvpinfobut(1) = uicontrol('position',[0.45 0.90 0.10 0.05],'style','pushbutton',...
   'string','Plot Info','callback','set(HANDLES.hvpinfofig,''visible'',''on'')');
HANDLES.hvplabel(1) = uicontrol('position',[0.15 0.91 0.20 0.025],'style','text',...
   'string','VIEWPORT 1');

HANDLES.hvpdataax(2) = axes('position',[0.55 0.60 0.4 0.3],'visible','off');
HANDLES.hvplegax(2) = axes('position',[0.55 0.5 0.4 0.05],'visible','off');
HANDLES.hvplabel(2) = uicontrol('position',[0.65 0.91 0.20 0.025],'style','text',...
   'string','VIEWPORT 2');

HANDLES.hvpdataax(3) = axes('position',[0.05 0.1 0.4 0.3],'visible','off');
HANDLES.hvplegax(3) = axes('position',[0.05 0.0 0.4 0.05],'visible','off');
HANDLES.hvplabel(3) = uicontrol('position',[0.15 0.41 0.20 0.025],'style','text',...
   'string','VIEWPORT 3');

HANDLES.hvpdataax(4) = axes('position',[0.55 0.1 0.4 0.3],'visible','off');
HANDLES.hvplegax(4) = axes('position',[0.55 0.0 0.4 0.05],'visible','off');
HANDLES.hvplabel(4) = uicontrol('position',[0.65 0.41 0.20 0.025],'style','text',...
   'string','VIEWPORT 4');

%  Define hide button

uicontrol('position',[0.45 0.05 0.1 0.05],'style','pushbutton',...
   'string','Hide','callback','set(HANDLES.hvpfig,''visible'',''off'')')

uicontrol('position',[0.45 0.1 0.1 0.05],'style','pushbutton',...
   'string','Clear All',...
   'callback',[...
      'clear DAMAGEID.vpinfostr,',...
      'for i = 1:4,',...
         'axes(HANDLES.hvpdataax(i)), cla reset, axis off,',...
         'axes(HANDLES.hvplegax(i)), cla reset, axis off,',...
         'set(HANDLES.hvpinfotext(i),''value'',1),',...
         'set(HANDLES.hvpinfotext(i),''string'','' ''),',...
      'end'])

%  ALL DONE

return