annotate toolboxes/MIRtoolbox1.3.2/somtoolbox/vis_footnoteButtonDownFcn.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function vis_footnoteButtonDownFcn
Daniel@0 2
Daniel@0 3 % VIS_FOOTNOTEBUTTONDOWNFCN Callback set by VIS_FOOTNOTE
Daniel@0 4 %
Daniel@0 5 % som_showtitleButtonDownFcn
Daniel@0 6 %
Daniel@0 7 % Moves the axis of current callback object using DRAGRECT
Daniel@0 8 % command. This callback is set to all texts added to figures by
Daniel@0 9 % VIS_FOOTNOTE function.
Daniel@0 10 %
Daniel@0 11 % See also DRAGRECT, SOM_SHOWTITLE.
Daniel@0 12
Daniel@0 13 % Copyright (c) 1997-2000 by the SOM toolbox programming team.
Daniel@0 14 % http://www.cis.hut.fi/projects/somtoolbox/
Daniel@0 15
Daniel@0 16 % Version 2.0beta Johan 080698
Daniel@0 17
Daniel@0 18 % Action
Daniel@0 19
Daniel@0 20 [txt,fig]=gcbo; % Get text and figure handles
Daniel@0 21 ax=get(txt,'parent'); % Get axis handle
Daniel@0 22
Daniel@0 23 memunits_fig=get(fig,'units'); % Get figure size in pixels
Daniel@0 24 set(gcf,'units','pixels');
Daniel@0 25 pos_fig=get(fig,'position');
Daniel@0 26
Daniel@0 27 memunits_txt=get(txt,'units'); % Get text field size in pixels
Daniel@0 28 set(txt,'units','pixels');
Daniel@0 29 text_size=get(txt,'extent');
Daniel@0 30
Daniel@0 31 memunits_ax=get(ax,'units'); % Get axis position in pixels
Daniel@0 32 set(ax,'units','pixels');
Daniel@0 33 pos_ax=get(ax,'position');
Daniel@0 34
Daniel@0 35 %%% Move text
Daniel@0 36
Daniel@0 37 pos_final=dragrect([pos_ax(1:2) text_size(3:4)]);
Daniel@0 38
Daniel@0 39 %%% Keep the text inside the figure!
Daniel@0 40
Daniel@0 41 pos_final(1)=max(pos_final(1),0);
Daniel@0 42 pos_final(2)=max(pos_final(2),0);
Daniel@0 43 pos_final(1)=min(pos_final(1),pos_fig(3)-text_size(3));
Daniel@0 44 pos_final(2)=min(pos_final(2),pos_fig(4)-text_size(4));
Daniel@0 45
Daniel@0 46 %%% Set new position
Daniel@0 47
Daniel@0 48 new_pos=[pos_final(1:2) pos_ax(3:4)];
Daniel@0 49 set(ax,'position', new_pos);
Daniel@0 50
Daniel@0 51 %%% Set the text on the top of the object stack
Daniel@0 52
Daniel@0 53 children=get(gcf,'children');
Daniel@0 54 i=find(ismember(children,ax));
Daniel@0 55 new_i=[i 1:i-1 i+1:length(children)];
Daniel@0 56 set(gcf,'children',children(new_i));
Daniel@0 57
Daniel@0 58 set(txt,'position',[0 0 0]);
Daniel@0 59 set(fig,'units',memunits_fig);
Daniel@0 60 set(ax,'units',memunits_ax);
Daniel@0 61 set(txt,'units',memunits_txt);
Daniel@0 62
Daniel@0 63
Daniel@0 64