v_tilefigs

PURPOSE ^

V_TILEFIGS tile current figures

SYNOPSIS ^

function v_tilefigs(pos)

DESCRIPTION ^

V_TILEFIGS tile current figures
 Inputs: pos(1,4) Virtual screen: [xmin ymin width height] either in
                  pixels >=1 or normalized in the range 0 to 1

 Possible future options:
   (1) define screen region to place tiles
   (2) include/exclude window titles (except optionally first row)
   (3) preserve sizes and/or aspect ratios
   (4) place disparate sizes in the most efficient way
   (5) cascade instead of tile
   (6) superimpose instead of tile
   (7) cope with dual screens
   (8) should check that the units have not been changed from "pixels"
   (9) cope with virtual screen that has a different aspect ratio

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function v_tilefigs(pos)
0002 %V_TILEFIGS tile current figures
0003 % Inputs: pos(1,4) Virtual screen: [xmin ymin width height] either in
0004 %                  pixels >=1 or normalized in the range 0 to 1
0005 %
0006 % Possible future options:
0007 %   (1) define screen region to place tiles
0008 %   (2) include/exclude window titles (except optionally first row)
0009 %   (3) preserve sizes and/or aspect ratios
0010 %   (4) place disparate sizes in the most efficient way
0011 %   (5) cascade instead of tile
0012 %   (6) superimpose instead of tile
0013 %   (7) cope with dual screens
0014 %   (8) should check that the units have not been changed from "pixels"
0015 %   (9) cope with virtual screen that has a different aspect ratio
0016 
0017 %      Copyright (C) Mike Brookes 2014
0018 %      Version: $Id: v_tilefigs.m 10865 2018-09-21 17:22:45Z dmb $
0019 %
0020 %   VOICEBOX is a MATLAB toolbox for speech processing.
0021 %   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
0022 %
0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0024 %   This program is free software; you can redistribute it and/or modify
0025 %   it under the terms of the GNU General Public License as published by
0026 %   the Free Software Foundation; either version 2 of the License, or
0027 %   (at your option) any later version.
0028 %
0029 %   This program is distributed in the hope that it will be useful,
0030 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0031 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0032 %   GNU General Public License for more details.
0033 %
0034 %   You can obtain a copy of the GNU General Public License from
0035 %   http://www.gnu.org/copyleft/gpl.html or by writing to
0036 %   Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
0037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0038 
0039 starth=35; % height for start bar
0040 tith=78; % height for window title
0041 winb=8; % width of window border
0042 figl=get(0,'Children');
0043 nf=length(figl);
0044 if isnumeric(figl)  % old versions of MATLAB have numeric figure handles
0045     figl=sort(figl);
0046 else
0047     fign=zeros(1,nf);
0048     for i=1:nf
0049         fign(i)=figl(i).Number;
0050     end
0051     [fign,figj]=sort(fign);
0052     figl=figl(figj);
0053 end
0054 scr=get(0,'Screensize'); % [xmin xmax width height]
0055 if nargin==0 || isempty(pos)
0056     scr=scr+starth*[0 1 0 -1]; % leave space for the start bar at the bottom
0057 else
0058     if all(pos<2) % pos uses normalized units
0059         pos=[round(scr(1:2)+pos(1:2).*scr(3:4)) round(pos(3:4).*scr(3:4))]; % convert to pixels
0060     end
0061     scr=[max(pos(1:2),1) min(pos(3:4),scr(3:4)+scr(1:2)-max(pos(1:2),1))]; % clip to actual screen
0062 end
0063 nfh=1:nf; % possible number of columns
0064 nfv=ceil(nf./nfh); % corresponding number of rows
0065 asp=(floor(scr(3)./nfh)-2*winb)./(floor(scr(4)./nfv)-2*winb-tith); % corresponding aspect ratios
0066 [aa,ia]=min(abs(asp-4/3)); % target aspect ratio is 4/3
0067 nfv=nfv(ia);
0068 nfh=ceil(nf/nfv);
0069 hpix=floor(scr(3)/nfh); % horizontal pixels per graph available incl border
0070 vpix=floor(scr(4)/nfv); % vertical pixels per graph available incl border
0071 % fprintf('scr=[%d %d %d %d], [hpix vpix]=[%d %d]\n',scr,hpix,vpix);
0072 for i=nf:-1:1
0073     figure(figl(i));
0074     row=1+floor((i-1)/nfh); % row goes nvf:-1:1
0075     col=i-(row-1)*nfh;      % within each row col goes nfh:-1:1 except for last row
0076 % fprintf('Fig %d=(%d,%d): [xmin ymin width height] = [%d %d %d %d]\n',i,row,col,[hpix*(col-1)+1+winb scr(4)-vpix*row+1+winb hpix-2*winb vpix-2*winb-tith]);
0077     set(figl(i),'position',[hpix*(col-1)+1+winb scr(4)+scr(2)-vpix*row+winb hpix-2*winb vpix-2*winb-tith]);
0078 end

Generated by m2html © 2003