function varargout = dspblkmview2(action, varargin)
% DSPBLKMVIEW2 DSP Blockset matrix viewer block helper function.

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

% Params structure fields:
%
% (1) ImageProperties: checkbox
%  2  CMapStr: Nx3 colormap matrix (string)
%  3  YMin: minimum Z-limit
%  4  YMax: maximum Z-limit
%  5  AxisColorbar: checkbox
%
% (6) AxisParams: checkbox
%  7  AxisOrigin
%  8  XLabel
%  9  YLabel
% 10  ZLabel
% 11  FigPos: figure position
% 12  AxisZoom: checkbox

blk = gcb;

switch action
case 'init'

    % Copy all mask entries to structure:
    n = get_param(blk,'masknames');
    s = cell2struct(varargin,n,2);
    varargout{1} = s;
    
    % disp('dspblkmview: need to call DialogApply...');
	sdspmview2([],[],[],'DialogApply',s);


case 'dynamic'
   orig_vis = get_param(blk,'maskvisibilities');
   vis = orig_vis;
   
   switch varargin{1}
   case 'ImageParams'
      % Set visibility of main image parameters:
      if strcmp(get_param(blk,'ImageParams'),'on');
         vis(2:5)={'on'};
      else
         vis(2:5)={'off'};
      end
      
   case 'AxisParams'
      % Set visibility of axis parameters:
      if strcmp(get_param(blk,'AxisParams'),'on');
         vis(7:12)={'on'};
      else
         vis(7:12)={'off'};
      end
            
   otherwise
      error('Unknown dynamic dialog callback');
   end
   
   if ~isequal(vis,orig_vis),
      set_param(blk, 'maskvisibilities',vis);
   end
end

% [EOF] dspblkmview2.m
