12 open ($fileh, "$base_path/$fname") || die "Can't open $base_path/$fname: $!";
14 m/xlink:href=\"\.uno:(\S+)\"\s+/ || next;
22 # filter out already seen icons & do prefixing
23 sub read_new_icons
($$)
27 my @images = read_icons
($fname);
30 for my $icon (@images) {
31 my $iname = "res/commandimagelist/" . $prefix . $icon . ".png";
32 if (!defined $global_hash{$iname} &&
33 !defined $new_icons{$iname}) {
34 push @new_icons, $iname;
35 $new_icons{$iname} = 1;
48 # a very noddy sorting algorithm
49 for my $uiconfig (@uiconfigs) {
50 my @images = read_new_icons
($uiconfig, $prefix);
52 for my $icon (@images) {
53 if (!defined $group{$icon}) {
54 if (!defined $group{$prev}) {
55 $group{$icon} = $cur_max;
58 $group{$icon} = $group{$prev} + (1.0 - 0.5 / $cur_max);
63 for my $icon (sort { $group{$a} <=> $group{$b} } keys %group) {
64 push @global_list, $icon;
65 $global_hash{$icon} = 1;
71 my @images = read_new_icons
(shift, shift);
73 for my $icon (@images) {
74 push @global_list, $icon;
75 $global_hash{$icon} = 1;
79 sub chew_controlfile
($)
84 open ($fileh, $fname) || die "Can't open $fname: $!";
91 if ($line =~ s/^-- (\S+)\s*//) {
94 my $small = (lc ($line) eq 'small');
95 if (lc($code) eq 'group') {
96 if (!$small) { process_group
("lc_", @list); }
97 process_group
("sc_", @list);
98 } elsif (lc ($code) eq 'ordered') {
100 for my $file (@list) { process_file
($file, "lc_"); }
102 for my $file (@list) { process_file
($file, "sc_"); }
103 } elsif (lc ($code) eq 'literal') {
104 for my $file (@list) {
105 if (!defined $global_hash{$file}) {
106 push @global_list, $file;
107 $global_hash{$file} = 1;
111 die ("Unknown code '$code'");
122 print "image-sort <image-sort.lst> /path/to/OOOo/source/root\n";
126 # where the control file lives
127 my $control = shift @ARGV;
128 # where the uiconfigs live
129 $base_path = shift @ARGV;
132 my $outf = shift @ARGV;
133 open ($output, ">$outf") || die "Can't open $outf: $!";
140 chew_controlfile
($control);
142 for my $icon (@global_list) {
143 print $output $icon . "\n" if (!($icon =~ /^sc_/));
145 for my $icon (@global_list) {
146 print $output $icon . "\n" if ($icon =~ /^sc_/);
149 close $output if (!$stdout_out);