comparison m-toolbox/m/gui/gltpda/welcome2LTPDA.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 function welcome2LTPDA(varargin)
2 % Introductory window for the LTPDA Toolbox.
3 %
4 % The animated GIF code is taken from 'gifplayer.m' by
5 % Vihang Patil, Oct 2006
6 % Copyright 2006-2007 Vihang Patil
7 % Email: vihang_patil@yahoo.com
8 % Created: 17th Oct 2006
9 % $Id: welcome2LTPDA.m,v 1.2 2009/01/23 12:40:51 nicola Exp $
10
11 global timePeriod
12
13 timePeriod = 0;
14 screenSize = get(0,'ScreenSize');
15
16 try
17 guiName = varargin{1}; guiSize = varargin{2};
18 catch
19 guiName = ''; guiSize = [1 1 450 500];
20 end
21
22 introSize = [(screenSize(3)-guiSize(3))/2 , (screenSize(4)-guiSize(4))/2 , guiSize(3) , guiSize(4)];
23 introFig = figure('Position',introSize,'Resize','off','Name',guiName,'NumberTitle','off','Toolbar','none','Menubar','none','Tag','LTPDAGUI');
24
25
26 logoSize = [303,303];
27 introPosition = [(introSize(3)-logoSize(1))/2 , (introSize(4)-logoSize(2))/2 , logoSize];
28 logo = axes('Parent',introFig,'Units','pixels','Position',introPosition);
29 image(imread('ltp.jpg'),'Parent',logo,'AlphaData',imread('ltpalpha.gif'));
30 axis(logo,'off'); axis(logo,'square');
31 set(logo,'HandleVisibility','callback');
32
33 uicontrol('Parent',introFig,'BackgroundColor',[1 1 1],'HorizontalAlignment','center','Position',[0 introSize(4)-50 introSize(3) 25],'String','Welcome to the LTP','FontName','Times New Roman','FontSize',18,'Visible','on','Style','text');
34 uicontrol('Parent',introFig,'BackgroundColor',[1 1 1],'HorizontalAlignment','center','Position',[0 introSize(4)-75 introSize(3) 25],'String','Data Analysis Toolbox','FontName','Times New Roman','FontSize',18,'Visible','on','Style','text');
35
36 loading = uicontrol('Parent',introFig,'BackgroundColor',[1 1 1],'HorizontalAlignment','left','Position',[(introSize(3)-50)/2 15 70 25],'String','loading','FontName','Times New Roman','FontSize',10,'fontAngle','italic','Visible','on','Style','text','Tag','loading');
37
38 gif_image = 'loading.gif';
39 delay_length = 0.1;
40 gifSize = [23 23];
41 axes('Parent',introFig,'Units','pixels','Position',[(introSize(3)-gifSize(1))/2 50 gifSize]);
42 [handles.im,map] = imread(gif_image,'frames','all');
43 handles.len = size(handles.im,4);
44 handles.h1 = image(handles.im(:,:,:,1));
45 colormap(map);
46 axis normal;
47 axis off;
48 handles.guifig = gcf;
49 handles.count = 1;
50 handles.tmr = timer('TimerFcn', {@TmrFcn,handles.guifig},'BusyMode','Queue','ExecutionMode','FixedRate','Period',delay_length);
51 guidata(handles.guifig, handles);
52 start(handles.tmr); %starts Timer
53 guidata(handles.guifig, handles);
54
55 set(loading,'DeleteFcn',{@DeleteFunction,handles.guifig});
56
57
58 function TmrFcn(src,event,handles)
59 handles = guidata(handles);
60 set(handles.h1,'CData',handles.im(:,:,:,handles.count)); %update the frame in the axis
61 handles.count = handles.count + 1; %increment to next frame
62
63 if handles.count > handles.len %if the last frame is achieved intialise to first frame
64 handles.count = 1;
65 end
66 guidata(handles.guifig, handles);
67
68 loadingStr = get(findobj('Tag','loading'),'String');
69 switch loadingStr
70 case 'loading.....', loadingStr = 'loading';
71 otherwise, loadingStr = [loadingStr,'.'];
72 end
73
74 if timePeriod == 2, set(findobj('Tag','loading'),'String',loadingStr); timePeriod = 0;
75 else timePeriod = timePeriod +1;
76 end
77 end
78
79
80 function DeleteFunction(src,event,handles)
81 handles = guidata(handles);
82 clear global timePeriod
83 try stop(handles.tmr);delete(handles.tmr); catch end
84 end
85
86 end
87
88
89