Mercurial > octave-nkf
diff scripts/plot/appearance/whitebg.m @ 19867:9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Try to trim long lines to < 80 chars.
Use '##' for single line comments.
Use '(...)' around tests for if/elseif/switch/while.
Abut cell indexing operator '{' next to variable.
Abut array indexing operator '(' next to variable.
Use space between negation operator '!' and following expression.
Use two newlines between endfunction and start of %!test or %!demo code.
Remove unnecessary parens grouping between short-circuit operators.
Remove stray extra spaces (typos) between variables and assignment operators.
Remove stray extra spaces from ends of lines.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 23 Feb 2015 14:54:39 -0800 |
parents | 4197fc428c7d |
children |
line wrap: on
line diff
--- a/scripts/plot/appearance/whitebg.m Mon Feb 23 16:42:25 2015 +0000 +++ b/scripts/plot/appearance/whitebg.m Mon Feb 23 14:54:39 2015 -0800 @@ -75,15 +75,15 @@ if (isroot) fac = get (0, "factory"); fields = fieldnames (fac); - fieldindex = intersect (find (!cellfun ("isempty", regexp (fields, 'color'))), union (find (!cellfun ("isempty", regexp (fields, 'factoryaxes.*'))), find (!cellfun ("isempty", regexp (fields, 'factoryfigure.*'))))); + fieldindex = intersect (find (! cellfun ("isempty", regexp (fields, 'color'))), union (find (! cellfun ("isempty", regexp (fields, 'factoryaxes.*'))), find (!cellfun ("isempty", regexp (fields, 'factoryfigure.*'))))); ## Check whether the factory value has been replaced for nf = 1 : numel (fieldindex); - defaultfield = strrep (fields {fieldindex (nf)}, "factory", "default"); + defaultfield = strrep (fields{fieldindex(nf)}, "factory", "default"); try - defaultvalue = 1 - get (0, defaultfield {n}); + defaultvalue = 1 - get (0, defaultfield{n}); catch - field = fields {fieldindex (nf)}; + field = fields{fieldindex(nf)}; defaultvalue = 1 - subsref (fac, struct ("type", ".", "subs", field)); end_try_catch set (0, defaultfield, defaultvalue); @@ -108,7 +108,7 @@ fieldindex = find (!cellfun ("isempty", regexp (fields, 'color'))); if (numel (fieldindex)) for nf = 1 : numel (fieldindex); - field = fields {fieldindex (nf)}; + field = fields{fieldindex(nf)}; c = subsref (p, struct ("type", ".", "subs", field)); if (! ischar (c) && columns (c) == 3) set (h (nh), field, 1 - c); @@ -122,10 +122,11 @@ def = get (h (nh), "default"); fields = fieldnames (def); if (! isempty (fields)) - fieldindex = find (!cellfun ("isempty", regexp (fields, 'color'))); + fieldindex = find (! cellfun ("isempty", regexp (fields, 'color'))); for nf = 1 : numel (fieldindex) - defaultfield = fields {fieldindex (nf)}; - defaultvalue = 1 - subsref (def, struct ("type", ".", "subs", defaultfield)); + defaultfield = fields{fieldindex(nf)}; + defaultvalue = ... + 1 - subsref (def, struct ("type", ".", "subs", defaultfield)); set (h (nh), defaultfield, defaultvalue); endfor endif