Mercurial > hg > aimmat
annotate aim-mat/tools/scalefigure.m @ 4:537f939baef0 tip
various bug fixes and changed copyright message
author | Stefan Bleeck <bleeck@gmail.com> |
---|---|
date | Tue, 16 Aug 2011 14:37:17 +0100 |
parents | 20ada0af3d7d |
children |
rev | line source |
---|---|
tomwalters@0 | 1 % support file for 'aim-mat' |
tomwalters@0 | 2 % |
tomwalters@0 | 3 % This external file is included as part of the 'aim-mat' distribution package |
bleeck@3 | 4 % (c) 2011, University of Southampton |
bleeck@3 | 5 % Maintained by Stefan Bleeck (bleeck@gmail.com) |
bleeck@3 | 6 % download of current version is on the soundsoftware site: |
bleeck@3 | 7 % http://code.soundsoftware.ac.uk/projects/aimmat |
bleeck@3 | 8 % documentation and everything is on http://www.acousticscale.org |
bleeck@3 | 9 |
tomwalters@0 | 10 |
tomwalters@0 | 11 function scalefigure(hand,x,y) |
tomwalters@0 | 12 % change the size of the window in hand by the factors in x and y without |
tomwalters@0 | 13 % changing the top left corner |
tomwalters@0 | 14 % checks that the graphic does not become bigger then the screen |
tomwalters@0 | 15 |
tomwalters@0 | 16 screensize=get(0,'ScreenSize'); |
tomwalters@0 | 17 sw=screensize(3); |
tomwalters@0 | 18 sh=screensize(4); |
tomwalters@0 | 19 |
tomwalters@0 | 20 np=get(hand,'pos'); |
tomwalters@0 | 21 % np comes as x,y,width,height |
tomwalters@0 | 22 newheigh=np(4)*y; |
tomwalters@0 | 23 newwidth=np(3)*x; |
tomwalters@0 | 24 heightdiff=np(4)-newheigh; |
tomwalters@0 | 25 widthdiff=np(3)-newwidth; |
tomwalters@0 | 26 % np(2)=np(2)-np(4)/1.5; |
tomwalters@0 | 27 % np(4)=np(4)*1.5; |
tomwalters@0 | 28 % np(2)=0; |
tomwalters@0 | 29 % nullp=get(0,'ScreenSize'); |
tomwalters@0 | 30 % np(4)=nullp(4); |
tomwalters@0 | 31 |
tomwalters@0 | 32 |
tomwalters@0 | 33 x=np(1); |
tomwalters@0 | 34 y=np(2)+heightdiff; |
tomwalters@0 | 35 w=newwidth; |
tomwalters@0 | 36 h=newheigh; |
tomwalters@0 | 37 % check for the screensize. If its too high then push it upwards. If its |
tomwalters@0 | 38 % still too high then make it smaller |
tomwalters@0 | 39 if y<0 |
tomwalters@0 | 40 % y=-62; % bug in version 7. Zero sits not at the bottom |
tomwalters@0 | 41 y=0; % bug in version 7. Zero sits not at the bottom |
tomwalters@0 | 42 if h>sh |
tomwalters@0 | 43 % h=sh-10; |
tomwalters@0 | 44 h=sh-62; |
tomwalters@0 | 45 end |
tomwalters@0 | 46 end |
tomwalters@0 | 47 |
tomwalters@0 | 48 if x+w>sw |
tomwalters@0 | 49 x=sw-w; |
tomwalters@0 | 50 if x<0 |
tomwalters@0 | 51 x=0; |
tomwalters@0 | 52 w=sw; |
tomwalters@0 | 53 end |
tomwalters@0 | 54 end |
tomwalters@0 | 55 |
tomwalters@0 | 56 newnp(1)=x; |
tomwalters@0 | 57 newnp(2)=y; |
tomwalters@0 | 58 newnp(3)=w; |
tomwalters@0 | 59 newnp(4)=h; |
tomwalters@0 | 60 |
tomwalters@0 | 61 set(hand,'pos',newnp); |
tomwalters@0 | 62 |
tomwalters@0 | 63 %and bring to front |
tomwalters@0 | 64 figure(gcf) |