function [bool] = mcodeDefaultIgnoreProperty(hObj,hProp)
% Default implementation for m-code generation object interface
% Called by MAKEMCODE, the code generator engine

% Copyright 2003-2004 The MathWorks, Inc.

bool = false;

if isa(hObj,'hg.GObject')
  bool = localGenericHG_mcodeIgnoreProperty(hObj,hProp);  
  if bool, return, end
end

if isa(hObj,'hg.figure')
  bool = localHGFigure_mcodeIgnoreProperty(hObj,hProp);
elseif isa(hObj,'hg.axes')
  bool = localHGAxes_mcodeIgnoreProperty(hObj,hProp);
end

%----------------------------------------------------------%
function [bool] = localGenericHG_mcodeIgnoreProperty(hObj,hProp)

% Default implementation
prop_name = get(hProp,'Name');
ignore_props = {...
    'BeingDeleted',...
	'ButtonDownFcn',...
	'Children',...
	'Clipping',...
	'CreateFcn',...
	'DeleteFcn',... 
	'BusyAction',...
	'HandleVisibility',...
	'HitTest',...
	'Interruptible',...
	'Selected',...
	'SelectionHighlight',...
	'Tag',...
	'Type',...
	'UIContextMenu',...
	'UserData',...
	'Visible'};

bool = any(strcmp(ignore_props,prop_name));
   
%----------------------------------------------------------%
function [bool] = localHGFigure_mcodeIgnoreProperty(hObj,hProp)

% Default implementation
prop_name = get(hProp,'Name');

ignore_props = {...	
               'Alphamap',...
	           'BackingStore',...
               'CloseRequestFcn',... 
	           'CurrentAxes',...
	           'CurrentCharacter',... 
	           'CurrentObject',...
	           'CurrentPoint',...
 	           'DoubleBuffer',...
               'DockControls',...
	           'FixedColors',...
	           'KeyPressFcn',... 
	           'MenuBar',... 
	           'MinColormap',...
	           'NextPlot',...
	           'Pointer',...
	           'PointerShapeCData',... 
	           'PointerShapeHotSpot',...
	           'Position',...
	           'Renderer',... 
	           'RendererMode',... 
	           'Resize',...
	           'ResizeFcn',... 
	           'SelectionType',...
	           'ShareColors',...
	           'ToolBar',...
	           'Units',...
	           'WindowButtonDownFcn',... 
	           'WindowButtonMotionFcn',... 
	           'WindowButtonUpFcn',... 
	           'WindowStyle',...
	           'WVisual',...
	           'WVisualMode'};
 
is_ignore = any(strcmp(ignore_props,prop_name));
              
% Determine if property value was auto-generated 
is_auto = local_is_prop_auto_generated(hObj,prop_name);

bool =  is_ignore || is_auto;
   
%----------------------------------------------------------%
function [bool] = localHGAxes_mcodeIgnoreProperty(hObj,hProp)

% Default implementation
prop_name = get(hProp,'Name');

ignore_props = {...
     'Children',...
     'UIContextMenu',...
     'ColorOrder'};

is_ignore = any(strcmp(ignore_props,prop_name));
              
% Determine if property value was auto-generated 
is_auto = local_is_prop_auto_generated(hObj,prop_name);

bool =  is_ignore || is_auto;

%----------------------------------------------------------%
function [bool] = local_is_prop_auto_generated(h,prop_name)
% Determine if the input property was auto generated by the object

% Delegate to object here

% Default behavior for hg objects
bool = false;

if ~isa(h,'hg.GObject')
    return;
end

% Ignore Mode properties
if strncmpi(fliplr(prop_name),'edoM',4)
    bool = true;
end

% Ignore any property with a corresponding mode 
% property of the same name
mode_property_name = [prop_name,'Mode'];
if ~isempty(findprop(h,mode_property_name)) && strcmp(get(h,mode_property_name),'auto')
    bool = true;
end

% Check for special rules
type = get(h,'Type');
if strcmp(type,'line')
    
             
elseif strcmp(type,'surface')
    switch prop_name
        case 'VertexNormals'
            bool = strcmp(get(h,'NormalMode'),'auto');
    end
end




