wdfigutl.m
上传用户:haiyisale
上传日期:2013-01-09
资源大小:3246k
文件大小:3k
源码类别:

波变换

开发平台:

Matlab

  1. function varargout = wdfigutl(option,varargin)
  2. %WDFIGUTL Utilities for Wavelet Toolbox demos figures.
  3. %   VARARGOUT = WDFIGUTL(OPTION,VARARGIN)
  4. %   M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 12-Nov-96.
  5. %   Last Revision: 22-May-1999.
  6. %   Copyright 1995-2002 The MathWorks, Inc.
  7. % $Revision: 1.12 $
  8. scrSize = get(0,'ScreenSize');
  9. switch option
  10.     case 'menu'
  11.         % Global variables initialization.
  12.         %---------------------------------
  13.         [ShiftTop_Fig,Btn_Height,Btn_Width] = ...
  14.             mextglob('get','ShiftTop_Fig','Def_Btn_Height','Def_Btn_Width');
  15.         figname = varargin{1};
  16.         nbW     = varargin{2}(1);
  17.         nbH     = varargin{2}(2);
  18.         tag     = varargin{3};
  19.         win_units = 'pixels';
  20.         if scrSize(4)<700
  21.            Btn_Height = 0.9*Btn_Height;
  22.            Btn_Width  = 0.9*Btn_Width;
  23.         end
  24.         win_width  = ceil(nbW*Btn_Width);
  25.         win_height = ceil(nbH*Btn_Height);
  26.         pos_win    = [ scrSize(3)*0.01, ...
  27.                        scrSize(4)-win_height-ShiftTop_Fig, ...
  28.                        win_width, ...
  29.                        win_height ...
  30.                        ];
  31.         fig = wfigmngr('init',        ...
  32.                   'Name',figname,     ...
  33.                   'Unit',win_units,   ...
  34.                   'Position',pos_win, ...
  35.                   'Tag',tag           ...
  36.                   );
  37.         varargout = {fig,pos_win,Btn_Width,Btn_Height,win_units};
  38.     case 'create'
  39.         [ShiftTop_Fig,Def_DefColor,Def_FigColor] = ...
  40.                 mextglob('get','ShiftTop_Fig','Def_DefColor','Def_FigColor');
  41.         active_fig = colordef('new',Def_DefColor);
  42.         titre   = varargin{1};
  43.         H_Fig   = 500;
  44.         YD_Fig  = scrSize(4)-H_Fig-ShiftTop_Fig;
  45.         pos     = [380 YD_Fig 400 H_Fig];
  46.         ftnsize = wdftnsiz(scrSize(4));
  47.         set(active_fig,...
  48.                 'MenuBar','none',                    ...
  49.                 'visible','on',                      ...
  50.                 'Name',titre,                        ...
  51.                 'NumberTitle','off',                 ...
  52.                 'Unit','Pixels',                     ...
  53.                 'Position',pos,                      ...
  54.                 'DefaultAxesFontSize',ftnsize,       ...
  55.                 'DefaultTextFontSize',ftnsize,       ...
  56.                 'Color',Def_FigColor,                ...
  57.                 'DefaultUicontrolFontWeight','bold', ...
  58.                 'DefaultAxesFontWeight','bold',      ...
  59.                 'DefaultTextFontWeight','bold'       ...
  60.                 );
  61.         set(active_fig,'Units','Normalized');
  62.         varargout{1} = active_fig;
  63.     case 'fontsize'
  64.         varargout{1} = wdftnsiz(scrSize(4));
  65. end
  66. %------------------------------------
  67. function siz = wdftnsiz(scr4)
  68. if scr4<600
  69.     siz = 9;
  70. elseif scr4<=700
  71.     siz = 10;
  72. elseif scr4>700
  73.     siz = 12;
  74. end
  75. CurScrPixPerInch = get(0,'ScreenPixelsPerInch');
  76. StdScrPixPerInch = 72;
  77. RatScrPixPerInch = StdScrPixPerInch / CurScrPixPerInch;
  78. siz = floor(siz*RatScrPixPerInch);
  79. %------------------------------------