962
|
1 #!/usr/bin/perl
|
|
2 use strict;
|
|
3
|
|
4 my %funcs;
|
|
5
|
|
6 open(ACCELS, "<$ENV{HOME}/.geeqie/accels") or die "No accel file";
|
|
7 while (<ACCELS>)
|
|
8 {
|
|
9 if (/gtk_accel_path "([^"]*)" *"([^"]*)"/)
|
|
10 {
|
|
11 my $name = $1;
|
|
12 my $key = $2;
|
|
13 $name =~ s/.*\///;
|
|
14 $key =~ s/</</g;
|
|
15 $key =~ s/>/>/g;
|
|
16 $funcs{uc($key)} = $name;
|
|
17 }
|
|
18
|
|
19 }
|
|
20 close(ACCELS);
|
|
21
|
|
22 open(ACCELS, "<hardcoded_keys") or die "No hardcoded_keys file";
|
|
23 while (<ACCELS>)
|
|
24 {
|
|
25 if (/"([^"]*)" *"([^"]*)"/)
|
|
26 {
|
|
27 my $name = $1;
|
|
28 my $key = $2;
|
|
29 $name =~ s/.*\///;
|
|
30 $key =~ s/</</g;
|
|
31 $key =~ s/>/>/g;
|
|
32 $funcs{uc($key)} = $name;
|
|
33 }
|
|
34
|
|
35 }
|
|
36 close(ACCELS);
|
|
37
|
|
38 open(IN, "<keymap_template.svg") or die "No svg file";
|
|
39 open(OUT, ">keymap.svg") or die "Can't write output file";
|
|
40
|
|
41 while (<IN>)
|
|
42 {
|
|
43 if (/>key:([^<]*)</)
|
|
44 {
|
|
45 my $key = uc($1);
|
|
46 my $name = $funcs{$key};
|
|
47 s/>key:([^<]*)</>$name</;
|
|
48 delete $funcs{$key};
|
|
49 }
|
|
50 print OUT;
|
|
51 }
|
|
52
|
|
53 close(IN);
|
|
54 close(OUT);
|
|
55
|
|
56 for my $key (keys %funcs)
|
|
57 {
|
|
58 if ($key)
|
|
59 {
|
|
60 print STDERR "not found: '$key'\n";
|
|
61 }
|
|
62 }
|
|
63
|