2 eval 'exec perl -S $0 ${1+"$@"}'
4 #*************************************************************************
6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 # Copyright 2008 by Sun Microsystems, Inc.
10 # OpenOffice.org - a multi-platform office productivity suite
12 # $RCSfile: hicontrast-to-theme.pl,v $
16 # This file is part of OpenOffice.org.
18 # OpenOffice.org is free software: you can redistribute it and/or modify
19 # it under the terms of the GNU Lesser General Public License version 3
20 # only, as published by the Free Software Foundation.
22 # OpenOffice.org is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU Lesser General Public License version 3 for more details
26 # (a copy is included in the LICENSE file that accompanied this code).
28 # You should have received a copy of the GNU Lesser General Public License
29 # version 3 along with OpenOffice.org. If not, see
30 # <http://www.openoffice.org/license.html>
31 # for a copy of the LGPLv3 License.
33 #*************************************************************************
35 # Create ordinary theme from HiContrast images.
43 ( $src, $dst ) = @ARGV;
45 if ( $src eq "" || $dst eq "" ) {
46 print STDERR
"Usage: hicontrast-to-theme.pl src dest\n\n";
47 print STDERR
"Create ordinary theme from HiContrast images.\n";
51 $dst = File
::Spec
->rel2abs( $dst );
54 [ ".*_h.png", "_h.png", ".png" ],
55 [ ".*_sch.png", "_sch.png", ".png" ],
56 [ ".*_hc.png", "_hc.png", ".png" ],
57 [ "lch_.*.png", "lch_", "lc_" ],
58 [ "sch_.*.png", "sch_", "sc_" ],
59 [ "lch[0-9].*.png", "lch", "lc" ],
60 [ "sch[0-9].*.png", "sch", "sc" ],
61 [ "loh[0-9].*.png", "loh", "lo" ],
62 [ "lxh[0-9].*.png", "lxh", "lx" ],
63 [ "sxh[0-9].*.png", "sxh", "sx" ],
64 [ "avh[0-9].*.png", "avh", "av" ],
65 [ "avlh[0-9].*.png", "avlh", "avl" ],
66 [ "idh[0-9].*.png", "idh", "id" ],
67 [ "imh[0-9].*.png", "imh", "im" ],
68 [ "mih[0-9].*.png", "mih", "mi" ],
69 [ "tbh[0-9].*.png", "tbh", "tb" ],
70 [ "nah[0-9].*.png", "nah", "na" ],
71 [ "nch[0-9].*.png", "nch", "nc" ],
72 [ "nvh[0-9].*.png", "nvh", "nv" ],
73 [ "ouh[0-9].*.png", "ouh", "ou" ],
74 [ "ddh[0-9].*.png", "ddh", "dd" ],
75 [ "sfh[0-9].*.png", "sfh", "sf" ],
76 [ "srh[0-9].*.png", "srh", "sr" ],
77 [ "wrh[0-9].*.png", "wrh", "wr" ],
78 [ "alh[0-9].*.png", "alh", "al" ],
79 [ "ath[0-9].*.png", "ath", "at" ],
80 [ "bih[0-9].*.png", "bih", "bi" ],
81 [ "coh[0-9].*.png", "coh", "co" ],
82 [ "foh[0-9].*.png", "foh", "fo" ],
83 [ "fuh[0-9].*.png", "fuh", "fu" ],
84 [ "oph[0-9].*.png", "oph", "op" ],
85 [ "unh[0-9].*.png", "unh", "un" ],
86 [ "edh[0-9].*.png", "edh", "ed" ],
87 [ "cdh[0-9].*.png", "cdh", "cd" ],
88 [ "frh[0-9].*.png", "frh", "fr" ],
89 [ "fwh[0-9].*.png", "fwh", "fw" ],
90 [ "nuh[0-9].*.png", "nuh", "nu" ],
91 [ "prh[0-9].*.png", "prh", "pr" ],
92 [ "shh[0-9].*.png", "shh", "sh" ],
93 [ "trh[0-9].*.png", "trh", "tr" ],
94 [ "reh[0-9].*.png", "reh", "re" ],
95 [ "joh[0-9].*.png", "joh", "jo" ],
96 [ "fph[0-9].*.png", "fph", "fp" ],
97 [ "dah[0-9].*.png", "dah", "da" ]
100 my (@from_stat, @to_stat);
102 sub copy_normalized
{
104 for $hc ( @hc_table ) {
105 ( $what, $from, $to ) = @
$hc;
106 if ( $file =~ /$what/&&!($file=~/\.svn/) ) {
107 my $dir = File
::Spec
->catdir( $dst, $File::Find
::dir
);
113 ( my $copy = $file ) =~ s/$from/$to/;
114 $copy = File
::Spec
->catfile( $dir, $copy );
116 @from_stat = stat($file);
117 @to_stat = stat($copy);
118 if ( $from_stat[9] > $to_stat[9] ) {
119 copy
( $file, $copy ) || die $!;
120 utime( $from_stat[9], $from_stat[9], $copy );
129 find
( \
©_normalized
, '.' );