Subject: | 10:09:14 AM: Can't load image from file '...bin/icons/save.xpm': file does not exist. |
bin/icons don't get installed, but thats ok since bin directory isn't
the right spot for icons, you should use File::ShareDir
File::ShareDir::Install or inline the icons. Examples
# add this to App-Wx-PodEditor-0.01/Makefile.PL before WriteMakefile
use File::ShareDir::Install;
{ package MY; use File::ShareDir::Install qw(postamble); }
install_share dist => 'bin/icons';
# edit App-Wx-PodEditor-0.01/lib/App/Wx/PodEditor/Frame.pm
sub _icon {
my ($file) = @_;
use File::SharedDir 'dist_file';
my $icon = dist_file( 'App-Wx-PodEditor', $file . '.xpm' );
my $xpm = Wx::Bitmap->new( $icon, wxBITMAP_TYPE_XPM );
return $xpm;
}
Another alternative is to inline the files like so
# edit App-Wx-PodEditor-0.01/lib/App/Wx/PodEditor/Frame.pm
my( %icons ) = (
'print.xpm' => <<'__XPM__',
/* XPM */
static char *print_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 5 1",
" c None",
". c Black",
"X c Gray100",
"o c #808000",
"O c Yellow",
/* pixels */
" ",
" ......... ",
" .XXXXXXXX. ",
" .X.....X. ",
" .XXXXXXXX. ",
" .X.....X.... ",
" .XXXXXXXX. . .",
" .......... . ..",
". . . .",
"............. .",
". ooo . . ",
". OOO ... ",
"............. . ",
" . . . ",
" ........... "
};
__XPM__
'redo.xpm' => <<'__XPM__',
/* XPM */
static char *redo_xpm[] = {
/* width height num_colors chars_per_pixel */
" 16 15 3 1",
/* colors */
". c #000080",
"# c None",
"a c #808080",
/* pixels */
"################",
"################",
"################",
"################",
"###a....########",
"##a.####..###.##",
"##.#######.#..##",
"##.########...##",
"##.#######....##",
"##a.#####.....##",
"###.a###########",
"################",
"################",
"################",
"################"
};
__XPM__
'save.xpm' => <<'__XPM__',
/* XPM */
static char *save_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c None",
". c Black",
"X c #808000",
"o c #808080",
/* pixels */
" ",
" .............. ",
" .X. . . ",
" .X. ... ",
" .X. .X. ",
" .X. .X. ",
" .X. .X. ",
" .X. .X. ",
" .XX........oX. ",
" .XXXXXXXXXXXX. ",
" .XX.........X. ",
" .XX...... .X. ",
" .XX...... .X. ",
" .XX...... .X. ",
" ............. "
};
__XPM__
'save_as.xpm' => <<'__XPM__',
/* XPM */
static char * save_as_xpm[] = {
"16 16 6 1",
" c None",
". c #000000",
"+ c #808000",
"@ c #C0C0C0",
"# c #FFFFFF",
"$ c #808080",
" ",
" ",
"........... ",
".+.@#@#@.@. ",
".+.#@...........",
".+.@#.+.@#@#@.@.",
".+.#$.+.#@#@#...",
".+....+.@#@#@.+.",
".+++$.+.#@#@#.+.",
".+....+.......+.",
".+.$$.+++++++++.",
".+.$$.+.......+.",
" .....+.$$$.@.+.",
" $.+.$$$.@.+.",
" $$..........",
" "};
__XPM__
'undo.xpm' => <<'__XPM__',
/* XPM */
static char *undo_xpm[] = {
/* width height num_colors chars_per_pixel */
" 16 15 3 1",
/* colors */
". c #000080",
"# c None",
"a c #808080",
/* pixels */
"################",
"################",
"################",
"################",
"########....a###",
"##.###..####.a##",
"##..#.#######.##",
"##...########.##",
"##....#######.##",
"##.....#####.a##",
"###########a.###",
"################",
"################",
"################",
"################"
};
__XPM__
);
sub _icon {
my ($file) = @_;
my $icon = $icons{$file . '.xpm' };
return $icon if ref $icon;
my $xpm = Wx::Bitmap->newFromXPM( [ map { m/^"(.*)"/ ? ( $1 ) :
() } split /\n/, $icon] );
$icons{$file . '.xpm' } = $xpm;
return $xpm;
}