function varargout = dspblkmagfft2(action)
% DSPBLKMAGFFT2 Mask dynamic dialog function for
% Magnitude FFT power spectrum estimation block

% Copyright 1995-2000 The MathWorks, Inc.
% $Date: 2000/06/01 23:41:54 $ $Revision: 1.3 $

blk = gcb;
if nargin<1, action='dynamic'; end

% Determine "Inherit FFT length" checkbox setting
inhFftStr = get_param(blk,'fftLenInherit');

switch action
case 'dynamic'
    % Execute dynamic dialogs
    
    % Determine if FFT length edit box is visible
    iFFTedit = 2; fftEditBoxEnabled = strcmp(inhFftStr, 'off');

    % Cache original dialog mask enables
    ena_orig = get_param(blk,'maskenables');
    ena = ena_orig;
    enaopt = {'off','on'};
    ena([iFFTedit]) = enaopt([fftEditBoxEnabled]+1);
    
    % Map true/false to off/on strings, and place into visibilities array:
    if ~isequal(ena,ena_orig),
        % Only update if a change was really made:
        set_param(blk,'maskenables',ena);
    end
    
case 'init'
    % Make model changes here, in response to mask changes
    
    % Compare 'inherit' checkbox of this block
    % to the setting of the underlying zero-pad block
    %
    % If not the same, push the change through:
    zpadblk       = [blk '/Zero Pad'];
    zpadPopup     = get_param(zpadblk,'zpadAlong');
    changePending = ~(     (strcmp(inhFftStr,'on')  & strcmp(zpadPopup,'None'))    ...
                         | (strcmp(inhFftStr,'off') & strcmp(zpadPopup,'Columns')) ...
                     );
    if changePending,
        % Update the Zero Pad block underneath the top level
        if strcmp(inhFftStr, 'on'), str='None'; else str='Columns'; end
        set_param(zpadblk, 'zpadAlong', str);
    end
end

% [EOF] dspblkmagfft2.m
