function opshapebtns
%
% Function: opshapebtns
% 
% Usage: opshapebtns
% 
% Description:
%    Initializes the Pick Peaks Window
%    Handles and graphics elements.
%    Returns a vector to those elements.
%
% Version SWD970804
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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

top=.95;
left=.84;
btnwd=.15;
btnht=.06;
spacing=.01;

%====================================
% Set up the console frame
%=====================================
frmborder=0.01;
ypos=.05-frmborder;
frmpos=[left-frmborder ypos btnwd+2*frmborder .9+2*frmborder];
HANDLES.hopshapeb(1)=uicontrol(HANDLES.hfigdmnd, ...
        'Style','Frame', ...
        'units','normalized', ...
        'Position',frmpos, ...
        'BackgroundColor',[.5 .5 .5]);



%====================================
% Set up the buttons
%=====================================
%  sliders
%
HANDLES.hopshapeb(2) = uicontrol(HANDLES.hfigdmnd, ...
   'style','slider', ...
   'pos',[.35 .01 .2 0.04], ...
   'back','w', ...
   'call',...
   ['f1_t=get(HANDLES.hopshapeb(2),''value'');',...
      'updatecursor(f1_t,1,HANDLES.hopshapeb(2)),',...
      'set(HANDLES.hopshapeb(4),''string'',num2str(DISPLAY{iaxes}.cursfreq{1}));']);


   HANDLES.hopshapeb(3)=uicontrol(HANDLES.hfigdmnd, ...
      'style','text', ...
	  'pos',[.35 .05 .1 .04], ...
     'string','Freq:');

HANDLES.hopshapeb(4) = uicontrol(HANDLES.hfigdmnd, ...
	'style','edit', ...
	'pos',[.45 .05 .1 .04], ...
   'back','w', ...
   'fore','r',...
   'callback',...
   ['f1_t=str2num(get(HANDLES.hopshapeb(4),''string''));', ...
      'updatecursor(f1_t,1,HANDLES.hopshapeb(2)),',...
      'set(HANDLES.hopshapeb(4),''string'',num2str(DISPLAY{iaxes}.cursfreq{1}));']);
     
%
%  Mouse-based cursor position
%

HANDLES.hopshapeb(19)=uicontrol(HANDLES.hfigdmnd, ...
   'style','pushbutton', ...
   'pos',[.35 .10 .2 .04], ...
   'string','Use Mouse', ...
   'callback',...
   ['[f1_t,temp] = ginput(1);',...
      'updatecursor(f1_t,1,HANDLES.hopshapeb(2)),',...
      'set(HANDLES.hopshapeb(4),''string'',num2str(DISPLAY{iaxes}.cursfreq{1}));']);

%
% Set up buttons on the console
%

%
%  Plot tools button
%

btnnum=0;
ypos=top-(btnnum)*(btnht+spacing);
btnpos=[left ypos-btnht btnwd btnht];
HANDLES.hopshapeb(10) = uicontrol(HANDLES.hfigdmnd,...
	'style','push',...
	'position',btnpos,...
	'string','Plot Tools',...
	'call','set(HANDLES.hplttl(1),''visible'',''on''),figure(HANDLES.hplttl(1))');

%====================================
% Set up the axes
%====================================

HANDLES.hopshapeb(14) = axes('position',[.1 .2 .7 .7],'visible','off');

%
% Define and view operating shape
%
btnnum=2;
ypos=top-(btnnum)*(btnht+spacing);
btnpos=[left ypos-btnht btnwd btnht];
HANDLES.hopshapeb(13)=uicontrol(HANDLES.hfigdmnd, ...
	'style','push', ...
	'pos',btnpos, ...
      	'string','Define Op Shape', ...
         'call',['i1=DISPLAY{iaxes}.cursfreq{1}/DISPLAY{iaxes}.dx+1;', ...
            'MODES.nmodes = MODES.nmodes + 1;',...
            'imode = MODES.nmodes;',...
            'defopshape(imode,i1),',...
            'if isstruct(GEOM),',...
            '   viewmode,',...
            'end,',...
            'set(HANDLES.hmmenu{6}(1),''enable'',''on'')']);

set(HANDLES.hopshapeb,'visible','off')

return