0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 function g_ResetButtonCallback(hObject,varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 % Whenever the user click the Reset Parameters button
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 global oldparams params paramEnabled oldparamEnabled functionName selBlocks
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 currPanel = get(hObject,'Parent');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 % Ask for confirmation:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 screenSize = get(0,'ScreenSize');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 backColor = [1 1 1];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 position = [(screenSize(3)-250)/2,(screenSize(4)-160)/2,250,160];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 confirmFig = figure('Position',position,'Name','Please confirm reset','Tag','ConfirmReset','Resize','off','NumberTitle','off','Toolbar','none','Menubar','none');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 % Text
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 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');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 % Button Yes
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 dimension = position;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 logosize = [77 95];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 dimension = [50 , dimension(4)-logosize(2)-50 , logosize];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 yesbut = axes('Parent',confirmFig,'Units','pixels','Position',dimension,'Tag','Yes');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 image(imread('buttonyes2.jpg'),'Parent',yesbut,'ButtonDownFcn','set(findobj(''Tag'',''ConfirmReset''),''UserData'',0); uiresume;','Tag','YesButton');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 axis(yesbut,'off');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 % Button No
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 dimension = position;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 logosize = [77 95];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 dimension = [127 , dimension(4)-logosize(2)-50 , logosize];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 nobut = axes('Parent',confirmFig,'Units','pixels','Position',dimension,'Tag','No');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 image(imread('buttonno2.jpg'),'Parent',nobut,'ButtonDownFcn','set(findobj(''Tag'',''ConfirmReset''),''UserData'',1); uiresume;','Tag','NoButton');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 axis(nobut,'off');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 uiwait;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 if get(confirmFig,'UserData'), delete(confirmFig); return; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 delete(confirmFig);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 for i=1:length(selBlocks), set_param(selBlocks(i),'Description',''); set_param(selBlocks(i),'AttributesFormatString',''); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 oldparams = []; params = []; paramEnabled = []; oldparamEnabled = []; functionName = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 delete(findobj(gcf,'Parent',currPanel));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 ltpdagui('Redraw',2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 end
|