tomwalters@0: % support file for 'aim-mat' tomwalters@0: % tomwalters@0: % This external file is included as part of the 'aim-mat' distribution package bleeck@3: % (c) 2011, University of Southampton bleeck@3: % Maintained by Stefan Bleeck (bleeck@gmail.com) bleeck@3: % download of current version is on the soundsoftware site: bleeck@3: % http://code.soundsoftware.ac.uk/projects/aimmat bleeck@3: % documentation and everything is on http://www.acousticscale.org bleeck@3: tomwalters@0: tomwalters@0: function scalefigure(hand,x,y) tomwalters@0: % change the size of the window in hand by the factors in x and y without tomwalters@0: % changing the top left corner tomwalters@0: % checks that the graphic does not become bigger then the screen tomwalters@0: tomwalters@0: screensize=get(0,'ScreenSize'); tomwalters@0: sw=screensize(3); tomwalters@0: sh=screensize(4); tomwalters@0: tomwalters@0: np=get(hand,'pos'); tomwalters@0: % np comes as x,y,width,height tomwalters@0: newheigh=np(4)*y; tomwalters@0: newwidth=np(3)*x; tomwalters@0: heightdiff=np(4)-newheigh; tomwalters@0: widthdiff=np(3)-newwidth; tomwalters@0: % np(2)=np(2)-np(4)/1.5; tomwalters@0: % np(4)=np(4)*1.5; tomwalters@0: % np(2)=0; tomwalters@0: % nullp=get(0,'ScreenSize'); tomwalters@0: % np(4)=nullp(4); tomwalters@0: tomwalters@0: tomwalters@0: x=np(1); tomwalters@0: y=np(2)+heightdiff; tomwalters@0: w=newwidth; tomwalters@0: h=newheigh; tomwalters@0: % check for the screensize. If its too high then push it upwards. If its tomwalters@0: % still too high then make it smaller tomwalters@0: if y<0 tomwalters@0: % y=-62; % bug in version 7. Zero sits not at the bottom tomwalters@0: y=0; % bug in version 7. Zero sits not at the bottom tomwalters@0: if h>sh tomwalters@0: % h=sh-10; tomwalters@0: h=sh-62; tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: if x+w>sw tomwalters@0: x=sw-w; tomwalters@0: if x<0 tomwalters@0: x=0; tomwalters@0: w=sw; tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: newnp(1)=x; tomwalters@0: newnp(2)=y; tomwalters@0: newnp(3)=w; tomwalters@0: newnp(4)=h; tomwalters@0: tomwalters@0: set(hand,'pos',newnp); tomwalters@0: tomwalters@0: %and bring to front tomwalters@0: figure(gcf)