KOffice – TDE office suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.2KB

  1. #!/usr/bin/perl -w
  2. # This file is part of Chalk
  3. #
  4. # Copyright (c) 2005 Sven Langkamp <longamp@reallygood.de>
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. use strict;
  20. use warnings;
  21. sub printi18n {
  22. print "i18n(\"".$_[0]."\");\n";
  23. }
  24. my @filenames = glob("./data/gradients/*.ggr");
  25. push( @filenames, glob("./data/palettes/*.gpl"));
  26. push( @filenames, glob("./data/brushes/*.gih"));
  27. push( @filenames, glob("./data/brushes/*.gbr"));
  28. push( @filenames, glob("./data/patterns/*.pat"));
  29. foreach my $filename (@filenames)
  30. {
  31. unless ( open(FILE, '<'.$filename) )
  32. {
  33. next;
  34. }
  35. if( $filename =~ /ggr/ || $filename =~ /gpl/ || $filename =~ /gih/ )
  36. {
  37. my @lines = <FILE>;
  38. close(FILE);
  39. if( $filename =~ /ggr/ || $filename =~ /gpl/ )
  40. {
  41. my @splited = split(/: /, $lines[1]);
  42. my $name = $splited[1];
  43. chomp($name);
  44. printi18n $name;
  45. }
  46. else
  47. {
  48. my $name = $lines[0];
  49. chomp($name);
  50. printi18n $name;
  51. }
  52. }
  53. else
  54. {
  55. if( $filename =~ /gbr/ )
  56. {
  57. read(FILE, my $bytes, 4);
  58. my $size = unpack("N", $bytes);
  59. read(FILE, $bytes, 4);
  60. my $version = unpack("N", $bytes);
  61. if( $version == 1 )
  62. {
  63. read(FILE, $bytes, 12);
  64. read(FILE, my $name, $size - 21);
  65. printi18n $name;
  66. }
  67. else
  68. {
  69. read(FILE, $bytes, 20);
  70. read(FILE, my $name, $size - 29);
  71. printi18n $name;
  72. }
  73. }
  74. else
  75. {
  76. read(FILE, my $bytes, 4);
  77. my $size = unpack("N", $bytes);
  78. read(FILE, $bytes, 20);
  79. read(FILE, my $name, $size - 25);
  80. printi18n $name;
  81. }
  82. }
  83. }