function setDIY(action)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% setting window
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if nargin<1
action='initilization';
%Obtain the handles of all GUI components of
%the main window for later use
MainHandles=get(gcf,'UserData');
else
%Get the handles of GUI components of
%the Setting window.
Sh=get(gcf,'UserData');
end
action=lower(action);
switch action
case 'initilization'
%Font Size
FontSize=8;
%%%%%%%%%%%%%%%%%%%%%%%%%%
%% INITIALIZATION
%%%%%%%%%%%%%%%%%%%%%%%%%%
%Restore the (default) DATA
DATA=get(MainHandles(3),'UserData');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Create the second window
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
hf2=figure('units','normalized',...
'position',[0.20 0.20 0.55 0.50],...
'menubar','none','numbertitle','off',...
'name','setting','color',[[0.513725 0.6 0.694118]],'visible','off');
htA=uicontrol('units','normalized','style','text',...
'position',[0.10 0.80 0.05 0.05],'string','a','fontsize',12);
heA=uicontrol('units','normalized','style','edit',...
'position',[0.15 0.80 0.25 0.05],'fontsize',10,'string',num2str(DATA(1)));
htB=uicontrol('units','normalized','style','text',...
'position',[0.55 0.80 0.05 0.05],'string','b','fontsize',12);
heB=uicontrol('units','normalized','style','edit',...
'position',[0.60 0.80 0.25 0.05],'fontsize',10,'string',num2str(DATA(2)));
htC=uicontrol('units','normalized','style','text',...
'position',[0.10 0.60 0.05 0.05],'string','c','fontsize',12);
heC=uicontrol('units','normalized','style','edit',...
'position',[0.15 0.60 0.25 0.05],'string',num2str(DATA(3)),'fontsize',9);
htD=uicontrol('units','normalized','style','text',...
'position',[0.55 0.60 0.05 0.05],'fontsize',12,'string','d');
heD=uicontrol('units','normalized','style','edit',...
'position',[0.60 0.60 0.25 0.05],'fontsize',10,'string',num2str(DATA(4)));
ht1=uicontrol('units','normalized','style','text',...
'position',[0.10 0.45 0.05 0.05],'string','线型','fontsize',FontSize);
hp1=uicontrol('units','normalized','style','pop',...
'position',[0.15 0.45 0.25 0.05],'fontsize',10,...
'string','o|+|*|-.|:|--','value',DATA(5));
ht2=uicontrol('units','normalized','style','text',...
'position',[0.55 0.45 0.05 0.05],'string','线宽','fontsize',FontSize);
hp2=uicontrol('units','normalized','style','pop',...
'position',[0.60 0.45 0.25 0.05],'string','1|2|3|4','value',DATA(6));
ht3=uicontrol('units','normalized','style','text',...
'position',[0.10 0.30 0.05 0.05],'string','标记大小','fontsize',FontSize);
hp3=uicontrol('units','normalized','style','pop',...
'position',[0.15 0.30 0.25 0.05],'string','9|12|15|18','value',DATA(7));
ht4=uicontrol('units','normalized','style','text',...
'position',[0.55 0.30 0.05 0.05],'string','颜色','fontsize',FontSize);
hp4=uicontrol('units','normalized','style','pop',...
'position',[0.60 0.30 0.25 0.05],'string','cyan|red|green|blue|magenta|yellow',...
'value',DATA(8));
hpus1=uicontrol('units','normalized','position',[0.15 0.12 0.20 0.08],...
'style','pushbutton','string','OK','callback','setDIY(''check'')');
hpus2=uicontrol('units','normalized','position',[0.55 0.12 0.20 0.08],...
'style','pushbutton','string','Cancel','callback','close');
set(hpus1,'userdata',MainHandles);
Sh=[heA,heB,heC,heD,hp1,hp2,hp3,hp4,hpus1];
% set the setting window as the current window.
set(hf2,'userdata',Sh,'visible','on');
case 'check'
checking(Sh);
end
%% Refresh the content of DATA
function checking(Sh)
outa=str2double(get(Sh(1),'string'));
outb=str2double(get(Sh(2),'string'));
outc=str2double(get(Sh(3),'string'));
outd=str2double(get(Sh(4),'string'));
outmak=single(get(Sh(5),'value'));
outlwidth=single(get(Sh(6),'value'));
outlmlen=single(get(Sh(7),'value'));
outcolor=single(get(Sh(8),'value'));
DATA=[outa,outb,outc,outd,outmak,outlwidth,outlmlen,outcolor]
MainHandles=get(Sh(9),'userdata')
set(MainHandles(3),'userdata',DATA);
close gcf;