diff m-toolbox/m/gui/gltpda/g_ResetButtonCallback.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/m/gui/gltpda/g_ResetButtonCallback.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,39 @@
+function g_ResetButtonCallback(hObject,varargin)
+   % Whenever the user click the Reset Parameters button
+   
+   global oldparams params paramEnabled oldparamEnabled functionName selBlocks
+   currPanel = get(hObject,'Parent');
+   
+   % Ask for confirmation:
+   screenSize = get(0,'ScreenSize');
+   backColor   = [1 1 1];
+   position   = [(screenSize(3)-250)/2,(screenSize(4)-160)/2,250,160];
+   confirmFig = figure('Position',position,'Name','Please confirm reset','Tag','ConfirmReset','Resize','off','NumberTitle','off','Toolbar','none','Menubar','none');
+   % Text
+   uicontrol('Parent',confirmFig,'BackgroundColor',backColor,'HorizontalAlignment','center','Position',[0 position(4)-40 position(3) 20],'String','Are you sure?','FontName','Times New Roman','FontSize',13,'FontWeight','normal','Visible','on','Style','text');
+   % Button Yes
+   dimension = position;
+   logosize = [77 95];
+   dimension = [50 , dimension(4)-logosize(2)-50 , logosize];
+   yesbut = axes('Parent',confirmFig,'Units','pixels','Position',dimension,'Tag','Yes');
+   image(imread('buttonyes2.jpg'),'Parent',yesbut,'ButtonDownFcn','set(findobj(''Tag'',''ConfirmReset''),''UserData'',0); uiresume;','Tag','YesButton');
+   axis(yesbut,'off');
+   % Button No
+   dimension = position;
+   logosize = [77 95];
+   dimension = [127 , dimension(4)-logosize(2)-50 , logosize];
+   nobut = axes('Parent',confirmFig,'Units','pixels','Position',dimension,'Tag','No');
+   image(imread('buttonno2.jpg'),'Parent',nobut,'ButtonDownFcn','set(findobj(''Tag'',''ConfirmReset''),''UserData'',1); uiresume;','Tag','NoButton');
+   axis(nobut,'off');
+   
+   uiwait;
+   
+   if get(confirmFig,'UserData'), delete(confirmFig); return; end
+   delete(confirmFig);
+   
+   for i=1:length(selBlocks), set_param(selBlocks(i),'Description',''); set_param(selBlocks(i),'AttributesFormatString',''); end
+   oldparams = []; params = []; paramEnabled = []; oldparamEnabled = []; functionName = '';
+   delete(findobj(gcf,'Parent',currPanel));
+   ltpdagui('Redraw',2)
+   
+end