function [p, str] = dspblkfrmconv(action,varargin)
% DSPBLKFRMCONV is the mask function for the DSP Blockset Frame Status Conversion block

% Copyright 1995-2000 The MathWorks, Inc.
% $Revision: 1.4 $ $Date: 2000/06/07 16:50:18 $

if nargin==0
   action = 'dynamic';
else
   action = 'init';
end

% Cache the block handle once
blk = gcb;

switch action 
   case 'init',
      % Setup icon display

      % Setup Inport label(s). There could be one or two depending
      % on how the user sets up block for frame status conversion mode.
      % No matter what, the first inport is always the 'In' input.

      % Setup inport labels.  Either one or two exists.
      p.in1 = 'input';      % Choose the side of block to label
      p.in2 = 'input';      % Choose the side of block to label
      p.i1 = 1; p.i1s = '';
      p.i2 = 1; p.i2s = ''; % Assume ONE input only for now

      % Setup outport label.  Only one exists.
      p.out = 'output';     % Choose the side of block to label
      p.o1 = 1; p.o1s = '';

      % Readjust port labels for possible 2nd input port
      inheritFrameStatus = get_param(blk,'growRefPort');

      if strcmp(inheritFrameStatus, 'on'),
         % Setup the 1st input label to indicate input signal
         p.i1 = 1; p.i1s = 'In';
         % Setup the 2nd input label for reference input
         p.i2 = 2; p.i2s = 'Ref';
         % Setup icon display string
         str = sprintf('       Inherit\n       Frame\n      Status');
      elseif strcmp(get_param(blk,'outframe'), 'Frame-based'),
         % Setup icon display string
         str = sprintf('Frame-\nbased');
      else
         % Setup icon display string
         str = sprintf('Sample-\nbased');
      end

case 'dynamic',
      % Execute dynamic dialogs
      ena = get_param(blk, 'maskenables');
      
      inheritFrameStatus = get_param(blk,'growRefPort');
      
      if strcmp(inheritFrameStatus, 'on'),
          if ~strcmp(ena(2), 'off'),
              ena(2) = {'off'};
              set_param(blk, 'maskenables', ena);
          end
      else
          if ~strcmp(ena(2), 'on'),
              ena(2) = {'on'};
              set_param(blk, 'maskenables', ena);
          end
      end
end % end of function

% [EOF] dspblkfrmconv.m
