Changeset 461
- Timestamp:
- 10/25/08 09:09:15 (3 years ago)
- Location:
- trunk/lib/Padre
- Files:
-
- 2 edited
-
Document/Perl.pm (modified) (1 diff)
-
Wx.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Padre/Document/Perl.pm
r451 r461 81 81 82 82 sub keywords { 83 if (not $keywords) {84 my $dir = Padre::Wx::_dir();85 my $path = File::Spec->catfile($dir , 'languages', 'perl5', "perl5.yml");86 $keywords = YAML::Tiny::LoadFile($path);83 unless ( defined $keywords ) { 84 $keywords = YAML::Tiny::LoadFile( 85 Padre::Wx::sharefile( 'languages', 'perl5', 'perl5.yml' ) 86 ); 87 87 } 88 88 return $keywords; -
trunk/lib/Padre/Wx.pm
r433 r461 6 6 use strict; 7 7 use warnings; 8 use File::Spec; 9 use File::ShareDir; 10 use Wx qw{ 11 wxBITMAP_TYPE_XPM 12 }; 8 use FindBin; 9 use File::Spec (); 10 use File::ShareDir (); 11 12 # Load every exportable constant into here, so that they come into 13 # existance in the Wx:: package, allowing everywhere else in the code to 14 # use them without braces. 15 use Wx ':everything'; 13 16 14 17 our $VERSION = '0.12'; 15 18 16 sub _dir { 17 return $ENV{PADRE_DEV} ? File::Spec->catdir($FindBin::Bin, '..', 'share') 18 : $ENV{PADRE_PAR_PATH} ? File::Spec->catdir($ENV{PADRE_PAR_PATH}, 'inc', 'share') 19 : File::ShareDir::dist_dir('Padre') 20 ; 19 20 21 22 23 ##################################################################### 24 # Shared Resources 25 26 sub share () { 27 return File::Spec->catdir( $FindBin::Bin, File::Spec->updir, 'share' ) if $ENV{PADRE_DEV}; 28 return File::Spec->catdir( $ENV{PADRE_PAR_PATH}, 'inc', 'share' ) if $ENV{PADRE_PAR_PATH}; 29 return File::ShareDir::dist_dir('Padre'); 21 30 } 22 31 32 sub sharedir { 33 File::Spec->catdir( share, @_ ); 34 } 35 36 sub sharefile { 37 File::Spec->catfile( share, @_ ); 38 } 39 40 41 42 43 44 ##################################################################### 45 # Load Shared Resources 46 23 47 sub bitmap { 24 my $file = shift;25 my $dir = _dir();26 my $path = File::Spec->catfile($dir , 'docview', "$file.xpm");27 return Wx::Bitmap->new( $path, wxBITMAP_TYPE_XPM);48 Wx::Bitmap->new( 49 sharefile( 'docview', "$_[0].xpm" ), 50 Wx::wxBITMAP_TYPE_XPM, 51 ); 28 52 } 29 53 30 54 sub icon { 31 my $file = shift;32 my $dir = _dir();33 my $path = File::Spec->catfile($dir , 'docview', "$file.xpm");34 return Wx::Icon->new( $path, wxBITMAP_TYPE_XPM);55 Wx::Icon->new( 56 sharefile( 'docview', "$_[0].xpm" ), 57 Wx::wxBITMAP_TYPE_XPM, 58 ); 35 59 } 36 60
Note: See TracChangeset
for help on using the changeset viewer.
