No BSD License  

Highlights from
aot

image thumbnail
from aot by PAUL koch
Makes the current figure/gui stay on top of all other figures(allways on top, AOT)

aot(varargin)
% function aot(mode, guiname)  
%  Makes the current figure stay on top of all other figures(allways on top, aot)
%  and adds a pushtool to the figure toolbar. With the pushtool the aot-mode
%  can be changed. Also works for guis and guis without toolbar.
%  For guis without toolbar use the commandline to set the aot/normal-mode
%  Rationale: 
%    - This function might be usefull if you want to modify lots of figures with a
%      control(gui) without repeated search for the gui behind the figures.
%    - a clock in front of all new created figures 
%    - info/messages how to handle another gui
%
%  USAGE:
%  aot(mode, guiname)
%  inputs:
%  mode [0,1] : normal mode or allways on top
%  guiname: full or partial name/title of the GUI  [*** not needed for figures ***]
% 
%  EXAMPLES:
% %__ FIGURES _____
%       figure; plot(sin(1:30));aot;         % adds a AlwaysONtop-pushtool  
%
%       aot(1);                              % Fig is AlwaysONtop 
%       aot    ; %%[same as]  aot(0)         % FIG is in NORMAL mode [not AOT ]
% 
% %__ GUIS _____
%       wrldtrv; aot(1,'World') ;            % GUI is AOT
%       aot(0,'World') ;                     % GUI is in NORMAL mode again [not AOT ]     
%  
%     %% another example
%       h = waitbar(0,'Please wait...','name','wb');
%           figure;  
%           set(gcf,'position',[1          65        1400         912]);
%           aot(1,'wb');
%           plot(rand(100));
%             for i=1:50,
%                 plot(1:100, rand(100,1),'color','r','linewidth',2);
%                 pause(.1);
%                 waitbar(i/50,h);
%             end
% 
% needed file: 
% [1] aot.exe ,this file was created with the open-source software AUTOHOTKEY 
% (Version 1.0.47.06,  Chris Malletts, www.autohotkey.com).
% tested on MATLAB Version 7.4.0.287 (R2007a)  and MATLAB Version
% 6.5.0.180913a (R13) under OS Microsoft Windows XP Version 5.1 /SP2
% ----------------------------------------------------------------------                     
% Author: S.P.Koch, BNIC 2008 [paulekoch@ymail.com]
% ----------------------------------------------------------------------


%============================================
%        		
%============================================


function aot(varargin)

[pa dum]=fileparts(which('aot.m'));
pa =[pa '\'];
q1 = 'dos(''' ;
q2 = ''');' ;
% --------first try to delete this----------------
if nargin<2 %otherwise a fig opens
    tb = findall(gcf,'Type','uitoolbar');
    delete(findobj(tb,'tag','aot'));
end
% ---------------------------
TOG='';
name='';
if nargin==1
    TOG=varargin{1};
end 
if nargin==2
    name=varargin{2};
end 


% ------------NOT-AOT---------------
if isempty(TOG) | TOG==0
 tmp=[q1  pa  'aot' ' ' num2str(1)  q2] ;       eval(tmp);
end

% ------------Ui-push---------------
 if nargin<=1
p=[];
%### icons      
p.c0=  repmat([ ...
      1     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294           1
0.75294     0.75294           1           1           1           1           1           1           1           1           1           1           1           1     0.75294     0.75294
0.75294           1           1           1           1           1           1           1           1           1           1           1           1           1           1     0.75294
0.75294           1           1           1           1           1           1           1           1           1           1           1           1           1           1     0.75294
0.75294           1           1           1           1           1           1           1           1           1           1           1           1           1           1     0.75294
0.75294           1           1           1           1           1           1           1           1           1           1           1           1           1           1     0.75294
0.75294           1           1           1           0           0           1           1           1           1           1           1           1           1           1     0.75294
0.75294           1           1           0           0           0           0           1           1           1           1           1           1           1           1     0.75294
0.75294           1           1           0           0           0           0           0           0           0           0           0           0           0           1     0.75294
0.75294           1           1           0           0           0           0           1           1           1           1           1           1           1           1     0.75294
0.75294           1           1           1           0           0           1           1           1           1           1           1           1           1           1     0.75294
0.75294           1           1           1           1           1           1           1           1           1           1           1           1           1           1     0.75294
0.75294           1           1           1           1           1           1           1           1           1           1           1           1           1           1     0.75294
0.75294           1           1           1           1           1           1           1           1           1           1           1           1           1           1     0.75294
0.75294     0.75294           1           1           1           1           1           1           1           1           1           1           1           1     0.75294     0.75294
      1     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294           1
         ],[1 1 3]);
     
 p.c1=repmat([ ...
      1     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294           1
0.75294     0.75294           1           1           1           1           1           1           1           1           1           1           1           1     0.75294     0.75294
0.75294           1           1           1           1           1           1           1           1           1           1           1           1           1           1     0.75294
0.75294           1           1           1           1           1           0           0           0           1           1           1           1           1           1     0.75294
0.75294           1           1           1           1           0           0           0           0           0           1           1           1           1           1     0.75294
0.75294           1           1           1           1           0           0           0           0           0           1           1           1           1           1     0.75294
0.75294           1           1           1           1           1           0           0           0           1           1           1           1           1           1     0.75294
0.75294           1           1           1           1           1           1           0           1           1           1           1           1           1           1     0.75294
0.75294           1           1           1           1           1           1           0           1           1           1           1           1           1           1     0.75294
0.75294           1           1           1           1           1           1           0           1           1           1           1           1           1           1     0.75294
0.75294           1           1           1           1           1           1           0           1           1           1           1           1           1           1     0.75294
0.75294           1           1           1           1           1           1           0           1           1           1           1           1           1           1     0.75294
0.75294           1           1           1           1           1           1           0           1           1           1           1           1           1           1     0.75294
0.75294           1           1           1           1           1           1           0           1           1           1           1           1           1           1     0.75294
0.75294     0.75294           1           1           1           1           1           1           1           1           1           1           1           1     0.75294     0.75294
      1     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294     0.75294           1
   ],[1 1 3]);    
set(gcf,'toolbar','figure');
tb = findall(gcf,'Type','uitoolbar');
pm=[];
    p.tgnow=0;
    mycdat=p.c0;
% ----------------------
p.hp= uipushtool(tb(1),'TooltipString', 'aot AlwaysOnTop', ...
            'CData', [mycdat], 'clickedcallback', {@limON, pm},...
            'userdata',p, 'tag', 'aot');%,'offcallback',@limOFF);

 end
% -------------------------
if nargin==1 & varargin{1}==1
    pause(.1);
  limON(p.hp, [], pm)
end

if nargin==2
    flag= varargin{1}  ;
    flag=flag+1  ;%littleBUGthere
    name=varargin{2}  ;
    tmp=[q1  pa  'aot' ' ' num2str(flag) ' ' name q2 ] ; eval(tmp);


end

%
%   subfuns
%

function limON(obj, event, pm)
[pa dum]=fileparts(which('aot.m'));
pa =[pa '\'];
q1 = 'dos(''' ;
q2 = ''');' ;

p=get(obj,'userdata');
if p.tgnow==0
    set(obj,'cdata',p.c1,'TooltipString','aotd');  %set to 'ALLWAYSONTOP'
     tmp=[q1  pa  'aot' ' 2'  q2] ; eval(tmp);
else
    set(obj,'cdata',p.c0,'TooltipString','unaotd');%normal mode
     tmp=[q1  pa  'aot' ' 1'  q2] ; eval(tmp);
end
p.tgnow = mod(p.tgnow+1,2) ;

set(obj,'userdata',p);





Contact us at files@mathworks.com