CodeManager
view release on metacpan or search on metacpan
lib/Prima/CodeManager/CodeManager.pm view on Meta::CPAN
my $directory_if = 0;
while ( my $wiersz = <$FH> ) {
next if $wiersz =~ /^(;|#|--)/;
$wiersz =~ s/\n*//g;
$wiersz =~ s/\r*//g;
$wiersz =~ s/\t*//g;
next unless $wiersz;
$wiersz =~ s/^([^#]*)#.*$/$1/;
if ( $wiersz =~ /^\s*\[(.+)\]/ ) {
$group = $1;
if ( $group eq 'DIRECTORY' ) {
$directory_nr++;
$directory_if = "_$directory_nr";
} else {
$directory_if = '';
}
} else {
if ( $wiersz =~ /^([^=]+?)\s*=\s*(.*)$/ ) {
my $name = $1;
my $value = $2;
$value =~ s/%\[([^%]*)\]([^%]*)%/$self->{global}->{$1}->{$2}/g;
$self->{global}->{$group}->{$name.$directory_if} = $value if $group && $name;
}
}
}
CORE::close ($FH);
}
unless ( $self->{global}->{GLOBAL}->{name} ) {
$self->{global}->{GLOBAL}->{name} = $project_file;
$self->{global}->{GLOBAL}->{name} =~ s/\.cm$//;
}
$self->{mw}->set( text => $self->{global}->{GLOBAL}->{name});
$self->{global}->{GLOBAL}{notebook_fontSize} ||= 10;
$self->{global}->{extensions} = '';
my $i = 0;
while ( $self->{global}->{DIRECTORY}->{$_OS."_$i"} ) {
$self->{global}->{DIRECTORY}->{"directories_$i"} ||= '';
$self->{global}->{DIRECTORY}->{$_OS."_$i"} =~ s/\~/$home_directory/g;
$self->{global}->{DIRECTORY}->{"directory_$i"} = $self->{global}->{DIRECTORY}->{$_OS."_$i"};
$self->{global}->{DIRECTORY}->{"directory_$i"} =~ s/\%CodeManager\%/$CodeManager_directory/g;
$self->{global}->{DIRECTORY}->{"extensions_$i"} ||= '';
$self->{global}->{extensions} .= '|'.$self->{global}->{DIRECTORY}->{"extensions_$i"} if $self->{global}->{DIRECTORY}->{"extensions_$i"};
$self->{global}->{DIRECTORY}->{"sorting_$i"} ||= 'by extension';
$self->{BRANCH}->[$i]->{sao_library} = $self->{global}->{DIRECTORY}->{"sao_library_$i"} || '.';
$i++;
}
$self->{global}->{extensions} = 'nil|dir|'.$self->{global}->{extensions};
$self->{global}->{extensions} =~ s/\s+//g;
$self->{global}->{extensions} =~ s/\|+/\|/g;
my @exten = split '\|', $self->{global}->{extensions};
# for (@exten) {
# $self->{images}->{$_} = $self-> load_icon( "$CodeManager_directory/img/$_.png" );
# $self->{images}->{$_} = $self-> load_icon( "$CodeManager_directory/img/nil.png" ) unless $self->{images}->{$_};
# eval( $self->read_file( "$CodeManager_directory/hilite/hilite_$_.pl")) if -e "$CodeManager_directory/hilite/hilite_$_.pl";
# }
$self->{global}->{GLOBAL}->{CodeManager_encoding} ||= '';
$main::CodeManager_encoding = $self->{global}->{GLOBAL}->{CodeManager_encoding};
$self->{global}->{GLOBAL}->{backup} = 0 unless $self->{global}->{GLOBAL}->{backup};
$self-> make_tree;
$self-> make_notebook;
return;
}
####################################################################
sub make_tree
{
my ( $self ) = shift;
#we remember the topItem in the tree before refreshing:
$self->{expanded}->{topItem} = 0;
$self->{expanded}->{topItem} = $self->{tree}->topItem if $self->{tree};
$self->{global}->{GLOBAL}{tree_itemHeight} += 0;
$self->{global}->{GLOBAL}{tree_itemHeight} = 12 if $self->{global}->{GLOBAL}{tree_itemHeight} < 12;
$self->{global}->{GLOBAL}{tree_itemIndent} += 0;
$self->{global}->{GLOBAL}{tree_itemIndent} =
$self->{global}->{GLOBAL}{tree_itemIndent} < $self->{global}->{GLOBAL}{tree_itemHeight}
? $self->{global}->{GLOBAL}{tree_itemHeight}
: $self->{global}->{GLOBAL}{tree_itemIndent}
;
my ( $type_dimen, $font_dimen ) = ( 'size', int( 0.625 * $self->{global}->{GLOBAL}{tree_itemHeight}));
if ( $self->{global}->{GLOBAL}{tree_fontHeight} && $self->{global}->{GLOBAL}{tree_fontHeight} > 0 ) {
$type_dimen = 'height';
$font_dimen =
$self->{global}->{GLOBAL}{tree_fontHeight} < $self->{global}->{GLOBAL}{tree_itemHeight}
? $self->{global}->{GLOBAL}{tree_fontHeight}
: $self->{global}->{GLOBAL}{tree_itemHeight}
;
} elsif ( $self->{global}->{GLOBAL}{tree_fontSize} && $self->{global}->{GLOBAL}{tree_fontSize} > 0 ) {
$type_dimen = 'size';
$font_dimen =
$self->{global}->{GLOBAL}{tree_fontSize} < 0.625 * $self->{global}->{GLOBAL}{tree_itemHeight}
? $self->{global}->{GLOBAL}{tree_fontSize}
: 0.625 * $self->{global}->{GLOBAL}{tree_itemHeight}
;
}
$self->{global}->{GLOBAL}{tree_fontName} ||= 'DejaVu Sans Mono';
my @items = [];
my $i = 0;
while ( my $directory = $self->{global}->{DIRECTORY}->{"directory_$i"} ) {
$self->{global}->{DIRECTORY}->{"directory_$i"} .= '/' unless $self->{global}->{DIRECTORY}->{"directory_$i"} =~ /\/$/;
$self->{global}->{DIRECTORY}->{"image_$i"} = '' unless $self->{global}->{DIRECTORY}->{"image_$i"};
$self->{images}->{"dir_$i"} =
$self-> load_icon( $self->{global}->{DIRECTORY}->{"image_$i"} )
|| $self-> load_icon( "$CodeManager_directory/img/".$self->{global}->{DIRECTORY}->{"image_$i"} )
|| $self-> load_icon( "$CodeManager_directory/img/nil.png" );
my $name = $self->{global}->{DIRECTORY}->{"name_$i"};
$name = $self->{global}->{DIRECTORY}->{name}.'-'.$i unless $name;
$items[0]->[$i][0] = [ $name, $self->{images}->{"dir_$i"}, 0, '', $directory, $i, $name ];
( run in 3.335 seconds using v1.01-cache-2.11-cpan-d7f47b0818f )