%
%  Name: editstr.m
%
%  Usage: strout = editstr(strin)
%
%  Edits the DIAMOND geometry lists
%

%
%  Version SWD970707
%
%  Author(s): Scott W. Doebling, doebling@lanl.gov
%
%  Institution: Los Alamos National Laboratory,
%               ESA-EA
%
%  Copyright (c) 1997, The Regents of the University
%       of California. (See top level of code for
%       full copyright statement.)
%

%
%  Define uicontrols
%

hesfig = figure('Name','DIAMOND: EditString', ...
   'units','normal',...
	'NumberTitle','off', ...
   'menubar','none',...
   'Position',[0.25 0.4 0.5 0.25]);

hestitle = uicontrol('style','text',...
   'position',[0.02 0.90 0.96 0.10],...
   'horizontalalignment','left');

hesstr = uicontrol('style','edit',...
   'position',[0.02 0.15 0.96 0.75],...
   'horizontalalignment','left',...
   'max',2);

uicontrol('style','pushbutton',...
   'position',[0.80 0.01 0.15 0.14],...
   'string','Close',...
   'callback',[...
      'switch nselsw,',...
      '	case 1, Nodes = str2num(get(hesstr,''string'')); listnode,',...
      '	case 2, Bars  = str2num(get(hesstr,''string'')); listbars,',...
      '	case 3, Shells = str2num(get(hesstr,''string'')); listshls,',...
      '  case 4, tempstr = get(hesstr,''string''); clear SEMbeams, for i =1:size(tempstr,1), tempnum = str2num(tempstr(i,:)); if ~isempty(tempnum), SEMbeams{i} = tempnum; end, end, listSEMbeams,',...
      '  case 5, tempstr = get(hesstr,''string''); clear SEMquads, for i =1:size(tempstr,1), tempnum = str2num(tempstr(i,:)); if ~isempty(tempnum), SEMquads{i} = tempnum; end, end, listSEMquads,',...
      'end,',...
      'delete(hesfig)']);

%
%  Set title string and editor string
%

switch nselsw
   case 1, titlestr = nodetstr(1,1:end-1); bodystr = num2str(Nodes);
   case 2, titlestr = bartstr(1,1:end-1); bodystr = num2str(Bars);
   case 3, titlestr = shltstr(1,1:end-1); bodystr = num2str(Shells);
   case 4, titlestr = sbtstr(1,1:end-1); bodystr  = ''; for i = 1:length(SEMbeams), bodystr = strvcat(bodystr,num2str(SEMbeams{i})); end
   case 5, titlestr = sqtstr(1,1:end-1); bodystr  = ''; for i = 1:length(SEMquads), bodystr = strvcat(bodystr,num2str(SEMquads{i})); end
end

set(hestitle,'string',titlestr)
set(hesstr,'string',bodystr)

uiwait(hesfig)