Raw File
fig_placier.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This file is part of NS2DDV.                                                      %
%                                                                                   %
% Copyright(C) 2011-2018    C. Calgaro  (caterina.calgaro@math.univ-lille1.fr)      %
%                           E. Creusé   (emmanuel.creuse@math.univ-lille1.fr)       %
%                           T. Goudon   (thierry.goudon@inria.fr)                   %
%                           A. Mouton   (alexandre.mouton@math.univ-lille1.fr)      %
%                                                                                   %
% NS2DDV is free software: you can redistribute it and/or modify it under the terms %
% of the GNU General Public License as published by the Free Software Foundation,   %
% either version 3 of the License, or (at your option) any later version.           %
%                                                                                   %
% NS2DDV is distributed in the hope that it will be useful, but WITHOUT ANY         %
% WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A   %
% PARTICULAR PURPOSE. See the GNU General Public License for more details.          %
%                                                                                   %
% You should have received a copy of the GNU General Public License along with      %
% NS2DDV. If not, see <http://www.gnu.org/licenses/>.                               %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [] = fig_placier

% fig_placier; (ex position.m)
% Ce programme positionne les figures presentes dans l'ecran
%
% GGB 27-03-99, 2h12
% modif 16-08-2000 : tout ecran, autant de figures qu'il y en a
% adapt. s.felix, 2004.10
% modified 30-10-04 for pbg4 with screen 1280x854

set(0,'Units','normalized')
%Screen = get(0,'ScreenSize');
xyratio=1; %0.6672;
Screen=[0 0 xyratio 1];

% quelles figures sont ouvertes ?
if nargin<3
    fenetres = sort(get(0,'children'));
end

% combien de lignes, combien de colonnes pour les repartir ?
n_fig = length(fenetres);
if n_fig <= 6 nfigrow = 2;
else nfigrow = ceil(sqrt(n_fig));
end
nfigcol = ceil(n_fig/nfigrow);

% l'ordre de "fenetres" est modifie pour que les figures soit disposees "dans l'ordre"
for k = 1:nfigrow-1
    fenetres((k-1)*nfigcol+1:nfigcol+(k-1)*nfigcol) = fenetres(nfigcol+(k-1)*nfigcol:-1:(k-1)*nfigcol+1);
end
fenetres((nfigrow-1)*nfigcol+1:length(fenetres)) = fenetres(length(fenetres):-1:(nfigrow-1)*nfigcol+1);

% vecteur des positions
% Corrections pour ne pas que la fenetre sorte de l'ecran faite manuellement (_o_) 
border = 0;
header = 0.09;
xoffset = 0; % offset �� partir de la gauche
yoffset = 0.0; % ofset �� partir du bas

hspace = Screen(3)/100;
vspace = Screen(4)/100;

WinWd = (Screen(3)-xoffset)/nfigcol-2*(border+hspace);
WinHt = (Screen(4)-yoffset)/nfigrow-(header+2*vspace);

for k = 1:n_fig
    x = xyratio-(rem(k-1,nfigcol)+1)*(WinWd+2*border+hspace);
    y = 1-((1+floor((k-1)/nfigcol))*(WinHt+2*border+vspace+header));
    pos = [x y WinWd WinHt];
    set(fenetres(k),'Units','normalized')
    figure(fenetres(k));
    set(fenetres(k),'Position',pos);
end
back to top