function status = TERNCommand(self, theCommand, theMessage)

% TERNCommand -- Command handler for TERN class.
%  TERNCommand(self, theCommand, theMessage) processes
%   theCommand and theMessage for self.
 
% Copyright (C) 1996 Dr. Charles R. Denham, ZYDECO.
% All Rights Reserved.
 
% Version of 17-Sep-96 at 13:39:54.24.

if nargin < 1, help TERNCommand, return, end
if nargin < 3, theMessage = []; end

if Verbose
   Begets('TERNCommand', 3, self, theCommand, theMessage)
end

if FSWCommand(self, theCommand, theMessage) == 0
   if strcmp(theCommand, 'Home')
      TernView(gca)
   end
   return
end

h = [];
if       strcmp(theCommand, 'Box')
   h = DoRecall(DoGet(self, 'itsBox'));
  elseif strcmp(theCommand, 'Grid')
   h = DoRecall(DoGet(self, 'itsGrid'));
  elseif strcmp(theCommand, 'Tics')
   h = DoRecall(DoGet(self, 'itsTics'));
end
if ~isempty(h)
   if strcmp(theMessage, 'on') | strcmp(theMessage, 'off')
      v = theMessage;
     else
      v = get(h(1), 'Visible');
      if strcmp(v, 'on')
         v = 'off';
       else
         v = 'on';
      end
   end
   set(h, 'Visible', v)
   return
end

if strcmp(theCommand, 'CCW3')
   TernRot(gca, +3)
  elseif strcmp(theCommand, 'CW3')
   TernRot(gca, -3)
  elseif strcmp(theCommand, 'CCW4')
   TernRot(gca, +4)
  elseif strcmp(theCommand, 'CW4')
   TernRot(gca, -4)
  elseif strcmp(theCommand, 'Flip')
   TernRot(gca, 'flip')
  elseif strcmp(theCommand, 'TernaryView')
   TernView(gca)
end
