source: aedes_dialoglocation.m

Last change on this file was 155, checked in by tjniskan, 7 years ago
  • Added support for multiple monitor systems

M aedes_inputdlg.m
M aedes_roi_copy_gui.m
A aedes_dialoglocation.m
M aedes_readfidprefs.m
M aedes_rotateflip.m
M aedes_resviewer.m
M aedes.m
M aedes_helpabout.m
M plugins/fat_analysis.m
M plugins/copy_data_to_workspace.m
M aedes_export_gui.m
M aedes_headerbrowser.m
M aedes_revision.m
M aedes_juigetfiles.m
M aedes_editstack.m

File size: 1.4 KB
Line 
1function fig_pos=aedes_dialoglocation(figure_size)
2% AEDES_DIALOGLOCATION - Returns a good location for a dialog window
3%   
4%
5% Synopsis:
6%        fig_pos=aedes_dialoglocation([figure_width,figure_height]);
7%
8% Description:
9%       
10%
11% Examples:
12%
13% See also:
14%        AEDES
15
16% This function is a part of Aedes - A graphical tool for analyzing
17% medical images
18%
19% Copyright (C) 2006 Juha-Pekka Niskanen <Juha-Pekka.Niskanen@uef.fi>
20%
21% Department of Applied Physics, Department of Neurobiology
22% University of Eastern Finland, FINLAND
23%
24% This program may be used under the terms of the GNU General Public
25% License version 2.0 as published by the Free Software Foundation
26% and appearing in the file LICENSE.TXT included in the packaging of
27% this program.
28%
29% This program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
30% WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
31
32if nargin < 1
33        error('Too few input arguments!')
34end
35
36hFig = gcbf;
37
38% Get the primary display location
39try
40        scrsz = get(0,'MonitorPositions');
41        scrsz = scrsz(1,:);
42catch
43        scrsz = get(0,'ScreenSize');
44end
45
46if ~isempty(hFig)
47        old_units = get(hFig,'Units');
48        try
49                set(hFig,'Units','pixels');
50                contsz = get(hFig,'position');
51                set(hFig,'Units',old_units);
52        catch
53                set(hFig,'Units',old_units);
54                return
55        end
56else
57        contsz = scrsz;
58end
59fig_pos(1) = contsz(1)  + 1/2*(contsz(3) - figure_size(1));
60fig_pos(2) = contsz(2)  + 2/3*(contsz(4) - figure_size(2));
Note: See TracBrowser for help on using the repository browser.

Powered by Trac 1.0.9.Copyright © Juha-Pekka Niskanen 2008