Mail Archives: geda-user/2012/07/25/09:01:35
On Wed, Jul 25, 2012 at 12:26:52PM +0200, Karl Hammar wrote:
> --------
> Gabriel:
> ...
> > The most annoying issue is that, being an attribute, it is displayed
> > in a different color than the text associated with symbols which played
> > a similar role in the standard library. I don't think it is right now
> > possible to modify the colour depending on regexp matching on the attribute
> > name; otherwise it would be nice if attribute name matching ".*label.*"
> > would use text color (automatically atattribute promotion time).
> ...
Except that, attribute promotion does not respect colour in the symbol file,
so modifying the symbol files is useless.
Maybe this should be considered a bug.
>
> An attribute is simply a pair of lines:
>
> T 100 1300 5 10 0 0 0 0 1
> author=Karl Hammar
>
> where the "5" above is the colour, see [1] for details.
>
> If your program remembers the "previous" line, it can change the
> colour.
>
> Like in:
>
> $ ./ch_colour.pl refdes 3 < ../share/gschem/ellyt.sym > a.sym
> $ diff -u ../share/gschem/ellyt.sym a.sym
> --- ../share/gschem/ellyt.sym 2011-07-26 15:06:05.000000000 +0200
> +++ a.sym 2012-07-25 12:23:12.633211147 +0200
> @@ -26,7 +26,7 @@
> author=Karl Hammar
> T 100 1100 5 10 0 0 0 0 1
> device=POLARIZED_CAPACITOR
> -T 100 500 8 10 1 1 0 0 1
> +T 100 500 3 10 1 1 0 0 1
> refdes=C?
> T 100 1300 5 10 0 0 0 0 1
> description=polarized capacitor
> $ cat ./ch_colour.pl
> #!/usr/bin/perl -w
>
> use strict;
>
> my $attr = shift;
> my $colour = shift;
>
> my $save = "";
>
> while (<>) {
> if (m/^(T\s+\S+\s+\S+\s+)(\d+)(\s.*)$/) {
> $save = [ $_, $1, $2, $3 ];
> } elsif ($save) {
> if (m/^$attr=/) {
> print $$save[1], $colour, $$save[3], "\n";
> print;
> undef $save;
> } else {
> print $$save[0];
> print;
> undef $save;
> }
> } else {
> print;
> }
> }
> $
>
Thanks for the line noise^W^W Perl script, but as I said it's
useless.
Regards,
Gabriel
- Raw text -