function fig = cmgtool()
% This is the machine-generated representation of a Handle Graphics object
% and its children.  Note that handle values may change when these objects
% are re-created. This may cause problems with any callbacks written to
% depend on the value of the handle at the time the object was saved.
%
% To reopen this object, just type the name of the M-file at the MATLAB
% prompt. The M-file and its associated MAT-file must be on your path.
global xhand xcount whichnew tdomain fdomain liststore xfnewstore whereatstore xcountstore
global ratiox ratioy ratioxy anachoice initialplot tflag initialsave

format short;
anachoice.tsd={'AnalyzeIt','Arithmetic','Filter-FILTFILT','Filter-PL33','Rotate',...
      'uv2speed','speed2uv','Average','SubSample','Merge','Inter-file calc.',...
      'Principal axis','Wind stress','Bridge','Statistics','Tidal Analysis'};
anachoice.freq={'AnalyzeIt','Spectrum','Xcov','Xcorr','CorrCoef'};

tflag={'_avg','_sub','_merg','_f33','_filt','_f2f','_fh','_brdg'};

set(0,'showhiddenhandles','on');
test=get(0,'children');
if any(strcmpi(get(test,'tag'),'fig-cmgtool')),
	errordlg('CMGTOOL is already running!','Error');
	set(0,'showhiddenhandles','off');
	return;
end;
bgdcolor=[.9 .9 .75];

set(0,'showhiddenhandles','off','units','points');
monitor=get(0,'screensize');
ratiox=0.8*monitor(3)/560;
ratioy=0.8*monitor(4)/420;
ratioxy=[ratiox ratioy ratiox ratioy];

xhand.main = figure('CloseRequestFcn','msgbox(''Use the QUIT button to close'',''Notes'')', ...
	'Color',bgdcolor, ...
	'WindowButtonDownFcn','cmgtoolfunc(''click'')',...
	'HandleVisibility', 'callback', ...
	'Integerhandle','off',...
	'Interruptible','off',...
	'Name','CMGTooL - TimeSeries', ...
	'NumberTitle','off', ...
	'units','points',...
	'Position',[0.1*monitor(3) 0.1*monitor(4) 560*ratiox 420*ratioy], ...
	'Resize','off', ...
	'Tag','fig-cmgtool');

%'MenuBar','none', ...

xhand.author(1) = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'HorizontalAlignment','center', ...
	'Fontsize', floor(24*ratiox),...
	'Position',[180 260 200 40].*ratioxy, ...
	'String','CMGTooL v1.0', ...
	'Style','text');
txt={'October, 1999','Jingping Xu, Anteon Corporation','by'};
for i=2:4
	xhand.author(i) = uicontrol('Parent',xhand.main, ...
		'Units','points', ...
		'BackgroundColor',[1 1 1], ...
		'HorizontalAlignment','center', ...
		'Fontsize', floor(10*ratiox),...
		'Position',[180 200+(i-2)*21 200 20].*ratioxy, ...
		'String',txt{i-1}, ...
		'Style','text');
end;
xhand.author(5) = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'HorizontalAlignment','center', ...
	'Fontsize', floor(8*ratiox),...
	'Position',[180 175 200 23].*ratioxy, ...
	'String','Collaborators: B. Bearsdley, C. Denham, H. Ryan, C. Sherwood, R. Signell', ...
	'Style','text');
xhand.figT=figure('visible','off',...
	'CloseRequestFcn','cmgtoolfunc(''figClose'')',...
	'Integerhandle','off',...
	'Interruptible','off',...
	'NumberTitle','off', ...
	'name','TDomain plot !!USE [Save As] MENU TO PRINT!!',...
	'Tag','timeplt figure 2');	
xhand.figF=figure('visible','off',...
	'CloseRequestFcn','cmgtoolfunc(''figClose'')',...
	'Integerhandle','off',...
	'Interruptible','off',...
	'NumberTitle','off', ...
	'name','FDomain plot',...
	'Tag','fig-Fdomainplot');	

h1 = uimenu('Parent',xhand.main, ...
	'Label','[Module]', ...
	'Tag','ModuleMenu');
xhand.ModuleTSD = uimenu('Parent',h1, ...
	'Label','Time-Series', ...
	'callback','cmgtoolfunc(''ModuleTSD'');', ...
	'checked','on',...
	'Tag','ModuleMenu_TSD');
xhand.ModuleADCP = uimenu('Parent',h1, ...
	'Label','ADCP', ...
	'callback','cmgtoolfunc(''ModuleADCP'');', ...
	'checked','off',...
	'Tag','ModuleMenu_ADCP');
h1 = uimenu('Parent',xhand.main, ...
	'Label','[Tools]', ...
	'Tag','ToolMenu');
xhand.ToolMenuT = uimenu('Parent',h1, ...
	'Label','Time Domain', ...
	'callback','cmgtoolfunc(''ToolMenuT'');', ...
	'checked','on',...
	'Tag','ToolMenu_Time');
xhand.ToolMenuF = uimenu('Parent',h1, ...
	'Label','Frequency Domain', ...
	'callback','cmgtoolfunc(''ToolMenuF'');', ...
	'Separator','on', ...
	'checked','off',...
	'Tag','ToolMenu_Freq');

xhand.load = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',[0 0.7 0.7], ...
	'Callback','cmgtoolfunc(''load'');', ...
	'FontSize',floor(9*ratiox), ...
	'FontWeight','bold', ...
	'Position',[15 20 60 20].*ratioxy, ...
	'Style','pushbutton',...
	'String','LOAD FILE', ...
	'Tag','Pushbutton-load', ...
	'TooltipString','Load a NetCDF file');
xhand.quit = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',[0 0.7 0.7], ...
	'Callback','cmgtoolfunc(''quit'');', ...
	'FontSize',floor(9*ratiox), ...
	'FontWeight','bold', ...
	'Position',[470 20 60 20].*ratioxy, ...
	'Style','pushbutton',...
	'String','QUIT', ...
	'TooltipString','Quit CMG Tool');
xhand.reset = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',[0 0.7 0.7], ...
	'Callback','cmgtoolfunc(''reset'');', ...
	'FontSize',floor(9*ratiox), ...
	'FontWeight','bold', ...
	'Position',[390 20 60 20].*ratioxy, ...
	'Style','pushbutton',...
	'String','RESET', ...
	'TooltipString','Reset CMG Tool');
xhand.notes = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',bgdcolor, ...
	'ForegroundColor',[0.5 0 0], ...
	'HorizontalAlignment','left', ...
	'FontWeight','bold', ...
	'Position',[15 3 160 15].*ratioxy, ...
	'String','Ready - Waiting for command...', ...
	'Style','text');
xhand.varlist = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'Callback','cmgtoolfunc(''varlist'');', ...
	'Position',[430 215 120 165].*ratioxy, ...
	'String',' ', ...
	'FontSize',floor(10*ratiox), ...
	'Style','listbox', ...
	'Value',1, ...
	'Visible','off');
xhand.allvarname = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',bgdcolor, ...
	'FontWeight','bold', ...
	'Position',[430 382 65 10].*ratioxy, ...
	'String','Variables', ...
	'FontSize',floor(9*ratiox), ...
	'Style','text', ...
	'Visible','off');
xhand.filename = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'Callback','cmgtoolfunc(''pickfile'');', ...
	'ForegroundColor',[0 0 1], ...
	'HorizontalAlignment','left', ...
	'Position',[430 395 120 20].*ratioxy, ...
	'String','LOADED FILES', ...
	'FontSize',floor(10*ratiox), ...
	'Style','popupmenu', ...
	'Value',1, ...
	'Visible','off');
xhand.closefile = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'Callback','cmgtoolfunc(''closefile'');', ...
	'Position',[360 400 60 15].*ratioxy, ...
	'BackgroundColor',[0 0.7 0.7], ...
	'FontSize',floor(9*ratiox), ...
	'Style','pushbutton',...
	'String','Close File', ...
	'TooltipString','Close a file from workspace', ...
	'Visible','off','enable','off');
xhand.dt = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[480 190 70 15].*ratioxy, ...
	'String','', ...
	'FontSize',floor(10*ratiox), ...
	'Style','text', ...
	'Visible','off');
xhand.dttitle = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'FontWeight','bold', ...
	'ForegroundColor',[0 0 1], ...
	'HorizontalAlignment','left', ...
	'Position',[430 190 51 15].*ratioxy, ...
	'FontSize',floor(10*ratiox), ...
	'String','dT(sec): ', ...
	'Style','text', ...
	'Visible','off');
xhand.length = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[470 165 80 15].*ratioxy, ...
	'String','', ...
	'FontSize',floor(10*ratiox), ...
	'Style','text', ...
	'Visible','off');
xhand.lengthtitle = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'FontWeight','bold', ...
	'ForegroundColor',[0 0 1], ...
	'HorizontalAlignment','left', ...
	'Position',[430 165 40 15].*ratioxy, ...
	'FontSize',floor(10*ratiox), ...
	'String','SIZE: ', ...
	'Style','text', ...
	'Visible','off');
xhand.singlevaluetitle = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'FontWeight','bold', ...
	'ForegroundColor',[0 0 1], ...
	'HorizontalAlignment','left', ...
	'Position',[430 140 51 15].*ratioxy, ...
	'String','VALUE: ', ...
	'FontSize',floor(10*ratiox), ...
	'Style','text', ...
	'Visible','off');
xhand.singlevalue = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[480 140 70 15].*ratioxy, ...
	'String','', ...
	'FontSize',floor(10*ratiox), ...
	'Style','text', ...
	'Visible','off');
xhand.att = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'Callback','cmgtoolfunc(''popupmenu'');', ...
	'ForegroundColor',[0 0 1], ...
	'Position',[430 102 120 25].*ratioxy, ...
	'FontSize',floor(8*ratiox), ...
	'String','', ...
	'Style','popupmenu', ...
	'Value',1, ...
	'Visible','off');
xhand.attvalue = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'HorizontalAlignment','left', ...
	'Fontsize', floor(9*ratiox),...
	'Position',[430 70 120 35].*ratioxy, ...
	'String','Click Popup Menu to view properties...', ...
	'Style','text', ...
	'Visible','off');
xhand.radio = uicontrol('Parent',xhand.main, ...
	'Callback','cmgtoolfunc(''radio'');', ...
	'Units','points', ...
	'BackgroundColor',bgdcolor, ...
	'Position',[430 50 120 15].*ratioxy, ...
	'String','See file attributes', ...
	'FontSize',floor(8*ratiox), ...
	'Style','radio', ...
	'Value',1, ...
	'Visible','off');
xhand.checkbox = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',bgdcolor, ...
	'Position',[245 175 60 15].*ratioxy, ...
	'String','Plot (u,v)', ...
	'FontSize',floor(8*ratiox), ...
	'Style','checkbox', ...
	'Value',1, ...
	'Visible','off');
xhand.savevarlist = uicontrol('Parent',xhand.main, ...
	'Callback','cmgtoolfunc(''varlistsave'');', ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[235 300 120 80].*ratioxy, ...
	'FontSize',floor(10*ratiox), ...
	'String',' ', ...
	'Style','listbox', ...
	'Value',1, ...
	'Visible','off');
xhand.savevarname = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',bgdcolor, ...
	'FontWeight','bold', ...
	'Position',[235 382 70 10].*ratioxy, ...
	'HorizontalAlignment','left', ...
	'FontSize',floor(8*ratiox), ...
	'String','SAVE variables', ...
	'Style','text', ...
	'Visible','off');
xhand.newvarlist = uicontrol('Parent',xhand.main, ...
	'Callback','cmgtoolfunc(''varlistnew'');', ...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'ForegroundColor',[0 .4 0], ...
	'Position',[30 300 120 80].*ratioxy, ...
	'FontSize',floor(10*ratiox), ...
	'String',' ', ...
	'Style','listbox', ...
	'Value',1, ...
	'Visible','off');
xhand.newvarname = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',bgdcolor, ...
	'FontWeight','bold', ...
	'Position',[30 382 70 10].*ratioxy, ...
	'HorizontalAlignment','left', ...
	'FontSize',floor(8*ratiox), ...
	'String','NEW variables', ...
	'Style','text', ...
	'Visible','off');
xhand.remvarnew = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'Callback','cmgtoolfunc(''removevar'');', ...
	'Position',[97 382 15 15].*ratioxy, ...
	'BackgroundColor',[0 0.7 0.7], ...
	'FontSize',floor(9*ratiox), ...
	'Style','pushbutton',...
	'FontWeight','bold', ...
	'String','X', ...
	'TooltipString','Remove variable from NEW', ...
	'visible','off','enable','off');
xhand.graphit = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'ForegroundColor',[0 0 1], ...
	'Callback','cmgtoolfunc(''graphit'');', ...
	'FontSize',floor(9*ratiox), ...
	'HorizontalAlignment','left', ...
	'Position',[165 140 110 20].*ratioxy, ...
	'string',{'GraphIt','1 Panel','2 Panels','3 Panels','4 Panels','Scatter plot','ADCP VIEW'},...
	'Style','popupmenu',...
	'TooltipString','Generating plot', ...
	'Value',1, ...
	'Visible','off');
% junk={'1st','2nd','3rd','4th'};
for i=1:5,
	y=170+(i-1)*25;
	xhand.varpanedit(i) = uicontrol('Parent',xhand.main, ...
		'Callback',['analyses(''titlab' num2str(i) ''');'], ...
		'Units','points', ...
		'BackgroundColor',[1 1 1], ...
		'ForegroundColor',[0 .2 0], ...
		'HorizontalAlignment','left', ...
		'Position',[100 y 130 20].*ratioxy, ...
		'FontSize',floor(10*ratiox), ...
		'Style','edit', ...
		'Tag',['edit-varpan' num2str(i)], ...
		'Visible','off');
	xhand.titpanedit(i) = uicontrol('Parent',xhand.main, ...
		'Units','points', ...
		'BackgroundColor',[1 1 1], ...
		'ForegroundColor',[0 .2 0], ...
		'HorizontalAlignment','left', ...
		'Position',[235 y 70 20].*ratioxy, ...
		'FontSize',floor(10*ratiox), ...
		'Style','edit', ...
		'Tag',['edit-titpan' num2str(i)], ...
		'Visible','off');
	xhand.ypanedit(i) = uicontrol('Parent',xhand.main, ...
		'Units','points', ...
		'BackgroundColor',[1 1 1], ...
		'ForegroundColor',[0 .2 0], ...
		'HorizontalAlignment','left', ...
		'Position',[310 y 60 20].*ratioxy, ...
		'FontSize',floor(10*ratiox), ...
		'Style','edit', ...
		'Tag',['edit-ypan' num2str(i)], ...
		'Visible','off');
	xhand.panpush(i) = uicontrol('Parent',xhand.main, ...
		'Callback',['dragdrop(''graphit'');'], ...
		'Units','points', ...
		'BackgroundColor',[0 0.7 0.7], ...
		'String',['<< Add Var'], ...
		'FontSize',floor(9*ratiox), ...
		'Position',[371 y 55 20].*ratioxy, ...
		'Style','pushbutton', ...
		'visible','off',...
		'Tag',['push-pan' num2str(i)]);
	xhand.ylimedit(i) = uicontrol('Parent',xhand.main, ...
		'Units','points', ...
		'BackgroundColor',[1 1 1], ...
		'ForegroundColor',[0 .2 0], ...
		'FontSize',floor(9*ratiox), ...
		'HorizontalAlignment','left', ...
		'Position',[5 y 55 20].*ratioxy, ...
		'Style','edit', ...
		'string','',...
		'Tag',['edit-ylim' num2str(i)], ...
		'Visible','off');
	xhand.plotheader(i) = uicontrol('Parent',xhand.main, ...
		'Units','points', ...
		'BackgroundColor',bgdcolor, ...
		'HorizontalAlignment','left', ...
		'FontSize',floor(8*ratiox), ...
		'FontWeight','bold', ...
		'Style','text', ...
		'visible','off');
end;	
xhand.ylimheader = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',bgdcolor, ...
	'HorizontalAlignment','left', ...
	'String','Ylim', ...
	'FontSize',floor(9*ratiox), ...
	'FontWeight','bold', ...
	'Style','text', ...
	'visible','off');
xhand.plot = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'Callback','analyses(''plot'');', ...
	'BackgroundColor',[0 0.7 0.7], ...
	'Position',[60 170 35 20].*ratioxy, ...
	'FontSize',floor(9*ratiox), ...
	'Style','pushbutton',...
	'String','PLOT',...
	'Visible','off');
xhand.saveit = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'Callback','cmgtoolfunc(''saveit'');', ...
	'ForegroundColor',[0 0 1], ...
	'HorizontalAlignment','left', ...
	'FontSize',floor(9*ratiox), ...
	'Position',[290 140 110 20].*ratioxy, ...
	'Style','popupmenu', ...
	'String',{'SaveIt','ASCII','MATLAB','netCDF'}, ...
	'Value',1, ...
	'Visible','off');
xhand.addvar = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'Callback','cmgtoolfunc(''addvar'');', ...
	'Position',[363 330 60 15].*ratioxy, ...
	'Style','pushbutton',...
	'BackgroundColor',[0 0.7 0.7], ...
	'FontSize',floor(9*ratiox), ...
	'String','<< Add', ...
	'TooltipString','Add variables to save', ...
	'Visible','off','enable','off');
xhand.addnewvar = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'Callback','cmgtoolfunc(''addnewvar'');', ...
	'Position',[163 330 60 15].*ratioxy, ...
	'Style','pushbutton',...
	'BackgroundColor',[0 0.7 0.7], ...
	'FontSize',floor(9*ratiox), ...
	'String','Add >>', ...
	'TooltipString','Add variables to save', ...
	'Visible','off','enable','off');
xhand.remvar = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'Callback','cmgtoolfunc(''removevar'');', ...
	'Position',[305 382 15 15].*ratioxy, ...
	'BackgroundColor',[0 0.7 0.7], ...
	'FontSize',floor(9*ratiox), ...
	'Style','pushbutton',...
	'FontWeight','bold', ...
	'String','X', ...
	'TooltipString','Remove variable from SAVE', ...
	'Visible','off','enable','off');
xhand.rename = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'Callback','cmgtoolfunc(''rename'');', ...
	'Position',[323 382 45 15].*ratioxy, ...
	'BackgroundColor',[0 0.7 0.7], ...
	'FontSize',floor(9*ratiox), ...
	'Style','pushbutton',...
	'String','Rename', ...
	'TooltipString','Rename variable in SAVE', ...
	'visible','off','enable','off');
xhand.save = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'Callback','analyses(''save'');', ...
	'BackgroundColor',[0 0.7 0.7], ...
	'FontSize',floor(9*ratiox), ...
	'Position',[270 270 50 20].*ratioxy, ...
	'Style','pushbutton',...
	'String','SAVE',...
	'Visible','off');
xhand.analyzeit = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'Callback','cmgtoolfunc(''analyzeit'');', ...
	'ForegroundColor',[0 0 1], ...
	'HorizontalAlignment','left', ...
	'FontSize',floor(9*ratiox), ...
	'Position',[40 140 110 20].*ratioxy, ...
	'String',anachoice.tsd,...
	'Style','popupmenu', ...
	'Value',1, ...
	'Visible','off');
for i=1:5,
	xhand.ana(i) = uicontrol('Parent',xhand.main, ...
		'Units','points', ...
		'BackgroundColor',[1 1 1], ...
		'ForegroundColor',[0 .2 0], ...
		'FontSize',floor(10*ratiox), ...
		'HorizontalAlignment','left', ...
		'Style','edit', ...
		'Visible','off');
	xhand.anapush(i) = uicontrol('Parent',xhand.main, ...
		'Callback',['dragdrop(''analyzeit'');'], ...
		'Units','points', ...
		'BackgroundColor',[0 0.7 0.7], ...
		'FontSize',floor(9*ratiox), ...
		'Style','pushbutton', ...
		'Visible','off');
end;
xhand.anatext = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',bgdcolor, ...
	'FontSize',floor(10*ratiox), ...
	'HorizontalAlignment','right', ...
	'Style','text', ...
	'visible','off');
xhand.dof = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',bgdcolor, ...
	'ForegroundColor',[.5 0 0], ...
	'FontSize',floor(8*ratiox), ...
	'HorizontalAlignment','left', ...
	'Style','text', ...
	'visible','off');
xhand.run = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'Callback','analyses(''run'');', ...
	'BackgroundColor',[0 0.7 0.7], ...
	'FontSize',floor(9*ratiox), ...
	'Style','pushbutton',...
	'String','RUN',...
	'Visible','off');
xhand.zoomframe = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',bgdcolor, ...
	'Position',[130 55 285 70].*ratioxy, ...
	'FontWeight','bold', ...
	'FontSize',floor(8*ratiox), ...
	'Style','frame', ...
	'visible','off');
xhand.zoomtext(1) = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',bgdcolor, ...
	'HorizontalAlignment','left', ...
	'Position',[145 108 85 20].*ratioxy, ...
	'String','Zoom Properties', ...
	'FontWeight','bold', ...
	'FontSize',floor(8*ratiox), ...
	'Style','text', ...
	'visible','off');
xhand.zoomtext(2) = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',bgdcolor, ...
	'HorizontalAlignment','left', ...
	'Position',[145 88 30 20].*ratioxy, ...
	'FontWeight','bold', ...
	'FontSize',floor(8*ratiox), ...
	'String','From', ...
	'Style','text', ...
	'visible','off');
xhand.zoomtext(3) = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'BackgroundColor',bgdcolor, ...
	'HorizontalAlignment','left', ...
	'Position',[145 68 30 20].*ratioxy, ...
	'FontSize',floor(8*ratiox), ...
	'FontWeight','bold', ...
	'String','To', ...
	'Style','text', ...
	'visible','off');
xhand.zoomymdfrom = uicontrol('Parent',xhand.main, ...
	'callback','cmgtoolfunc(''ymdhmsfrom'');',...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[175 90 78 20].*ratioxy, ...
	'fontsize',floor(7*ratiox),...
	'FontWeight','bold', ...
	'HorizontalAlignment','left', ...
	'ForegroundColor',[0 .2 0], ...
	'Style','edit', ...
	'visible','off');
xhand.zoomhmsfrom = uicontrol('Parent',xhand.main, ...
	'callback','cmgtoolfunc(''ymdhmsfrom'');',...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[255 90 60 20].*ratioxy, ...
	'fontsize',floor(7*ratiox),...
	'FontWeight','bold', ...
	'HorizontalAlignment','left', ...
	'ForegroundColor',[0 .2 0], ...
	'Style','edit', ...
	'visible','off');
xhand.zoomymdto = uicontrol('Parent',xhand.main, ...
	'callback','cmgtoolfunc(''ymdhmsto'');',...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[175 70 78 20].*ratioxy, ...
	'fontsize',floor(7*ratiox),...
	'FontWeight','bold', ...
	'HorizontalAlignment','left', ...
	'ForegroundColor',[0 .2 0], ...
	'Style','edit', ...
	'visible','off');
xhand.zoomhmsto = uicontrol('Parent',xhand.main, ...
	'callback','cmgtoolfunc(''ymdhmsto'');',...
	'Units','points', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[255 70 60 20].*ratioxy, ...
	'fontsize',floor(7*ratiox),...
	'FontWeight','bold', ...
	'HorizontalAlignment','left', ...
	'ForegroundColor',[0 .2 0], ...
	'Style','edit', ...
	'visible','off');
xhand.zoomslidefrom = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'Position',[320 90 90 20].*ratioxy, ...
	'callback','cmgtoolfunc(''sliderfrom'');',...
	'FontSize',floor(8*ratiox), ...
	'Style','slider', ...
	'min',0,'max',1,'value',0,...
	'visible','off');
xhand.zoomslideto = uicontrol('Parent',xhand.main, ...
	'Units','points', ...
	'Position',[320 70 90 20].*ratioxy, ...
	'callback','cmgtoolfunc(''sliderto'');',...
	'Style','slider', ...
	'FontSize',floor(8*ratiox), ...
	'min',0,'max',1,'value',1,...
	'visible','off');
for i=1:4
	xhand.oprand(i) = uicontrol('Parent',xhand.main, ...
		'Units','points', ...
		'BackgroundColor',bgdcolor, ...
		'FontSize',floor(12*ratiox), ...
		'FontWeight','bold', ...
		'Style','text', ...
		'visible','off');
	xhand.options(i)=uicontrol('parent',xhand.main,...
		'units','points',...
		'BackgroundColor',bgdcolor, ...
		'style','radio',...
		'FontSize',floor(8*ratiox), ...
		'value',0,...
		'visible','off');
end;
for i=1:4
	set(xhand.options(i),'UserData',xhand.options(:,[1:i-1, i+1:4]));
end;
for i=1:2
	liststore{i}=[];
	xfnewstore{i}=[];
	whereatstore{i}=[];
	xcountstore{i}=0;
end;

xcount.file=0;
xcount.save=0;
xcount.new=0;
whichnew.save=[];
whichnew.graph=[];
whichnew.ana=[];
tdomain=1;fdomain=0;
initialsave=1;
