scripts/plot/__add_datasource__.m
author David Bateman <dbateman@free.fr>
Mon Aug 24 10:02:47 2009 +0200 (2009-08-24)
changeset 9411 d208ae6e9d74
parent 8920 eb63fbe60fab
permissions -rw-r--r--
Fix test for setting of datasource properties. Add the edgecolor property to contours
jwe@8920
     1
## Copyright (C) 2008, 2009 David Bateman
dbateman@8070
     2
##
dbateman@8070
     3
## This file is part of Octave.
dbateman@8070
     4
##
dbateman@8070
     5
## Octave is free software; you can redistribute it and/or modify it
dbateman@8070
     6
## under the terms of the GNU General Public License as published by
dbateman@8070
     7
## the Free Software Foundation; either version 3 of the License, or (at
dbateman@8070
     8
## your option) any later version.
dbateman@8070
     9
##
dbateman@8070
    10
## Octave is distributed in the hope that it will be useful, but
dbateman@8070
    11
## WITHOUT ANY WARRANTY; without even the implied warranty of
dbateman@8070
    12
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dbateman@8070
    13
## General Public License for more details.
dbateman@8070
    14
##
dbateman@8070
    15
## You should have received a copy of the GNU General Public License
dbateman@8070
    16
## along with Octave; see the file COPYING.  If not, see
dbateman@8070
    17
## <http://www.gnu.org/licenses/>.
dbateman@8070
    18
jwe@8812
    19
## -*- texinfo -*-
jwe@8812
    20
## @deftypefn {Function File} {@var{newargs} =} __add_datasource__ (@var{fcn}, @var{h}, @var{data}, @var{varargin})
jwe@8812
    21
## Undocumented internal function.
jwe@8812
    22
## @end deftypefn
dbateman@8070
    23
dbateman@8070
    24
function newargs = __add_datasource__ (fcn, h, data, varargin)
dbateman@8070
    25
dbateman@8070
    26
  if (nargin < 3)
dbateman@8070
    27
    error ("internal error");
dbateman@8070
    28
  endif
dbateman@8070
    29
dbateman@8070
    30
  if (ischar (data))
dbateman@8070
    31
    data = {data};
dbateman@8070
    32
  endif
dbateman@8070
    33
dbateman@8070
    34
  for i = 1 : numel (data)
dbateman@8070
    35
    addproperty (strcat (data{i}, "datasource"), h, "string", "");
dbateman@8070
    36
  endfor
dbateman@8070
    37
David@8080
    38
  i = 0;
dbateman@8070
    39
  newargs = {};
dbateman@8070
    40
  while (i < numel (varargin))
David@8080
    41
    arg = varargin{++i};
jwe@8190
    42
    if (i != numel(varargin) && ischar (arg)
dbateman@9411
    43
	&& length (arg) > 9 && strcmpi (arg(end-9:end), "datasource"))
dbateman@8070
    44
      arg = tolower (arg);
David@8080
    45
      val = varargin{++i};
David@8080
    46
      if (ischar (val))
jwe@8190
    47
	set (h, arg, val);
dbateman@8070
    48
      else
jwe@8190
    49
	error ("%s: expecting data source to be a string", fcn);
dbateman@8070
    50
      endif
dbateman@8070
    51
    else
dbateman@8070
    52
      newargs{end + 1} = arg;
dbateman@8070
    53
    endif
dbateman@8070
    54
  endwhile
dbateman@8070
    55
endfunction