Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/m/gui/gltpda/welcome2LTPDA.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,89 @@ +function welcome2LTPDA(varargin) +% Introductory window for the LTPDA Toolbox. +% +% The animated GIF code is taken from 'gifplayer.m' by +% Vihang Patil, Oct 2006 +% Copyright 2006-2007 Vihang Patil +% Email: vihang_patil@yahoo.com +% Created: 17th Oct 2006 +% $Id: welcome2LTPDA.m,v 1.2 2009/01/23 12:40:51 nicola Exp $ + +global timePeriod + +timePeriod = 0; +screenSize = get(0,'ScreenSize'); + +try + guiName = varargin{1}; guiSize = varargin{2}; +catch + guiName = ''; guiSize = [1 1 450 500]; +end + +introSize = [(screenSize(3)-guiSize(3))/2 , (screenSize(4)-guiSize(4))/2 , guiSize(3) , guiSize(4)]; +introFig = figure('Position',introSize,'Resize','off','Name',guiName,'NumberTitle','off','Toolbar','none','Menubar','none','Tag','LTPDAGUI'); + + +logoSize = [303,303]; +introPosition = [(introSize(3)-logoSize(1))/2 , (introSize(4)-logoSize(2))/2 , logoSize]; +logo = axes('Parent',introFig,'Units','pixels','Position',introPosition); +image(imread('ltp.jpg'),'Parent',logo,'AlphaData',imread('ltpalpha.gif')); +axis(logo,'off'); axis(logo,'square'); +set(logo,'HandleVisibility','callback'); + +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'); +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'); + +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'); + + gif_image = 'loading.gif'; + delay_length = 0.1; + gifSize = [23 23]; + axes('Parent',introFig,'Units','pixels','Position',[(introSize(3)-gifSize(1))/2 50 gifSize]); + [handles.im,map] = imread(gif_image,'frames','all'); + handles.len = size(handles.im,4); + handles.h1 = image(handles.im(:,:,:,1)); + colormap(map); + axis normal; + axis off; + handles.guifig = gcf; + handles.count = 1; + handles.tmr = timer('TimerFcn', {@TmrFcn,handles.guifig},'BusyMode','Queue','ExecutionMode','FixedRate','Period',delay_length); + guidata(handles.guifig, handles); + start(handles.tmr); %starts Timer +guidata(handles.guifig, handles); + +set(loading,'DeleteFcn',{@DeleteFunction,handles.guifig}); + + +function TmrFcn(src,event,handles) +handles = guidata(handles); +set(handles.h1,'CData',handles.im(:,:,:,handles.count)); %update the frame in the axis +handles.count = handles.count + 1; %increment to next frame + +if handles.count > handles.len %if the last frame is achieved intialise to first frame + handles.count = 1; +end +guidata(handles.guifig, handles); + +loadingStr = get(findobj('Tag','loading'),'String'); +switch loadingStr + case 'loading.....', loadingStr = 'loading'; + otherwise, loadingStr = [loadingStr,'.']; +end + +if timePeriod == 2, set(findobj('Tag','loading'),'String',loadingStr); timePeriod = 0; +else timePeriod = timePeriod +1; +end +end + + +function DeleteFunction(src,event,handles) +handles = guidata(handles); +clear global timePeriod +try stop(handles.tmr);delete(handles.tmr); catch end +end + +end + + +