Changeset 12406
- Timestamp:
- 08/30/10 09:35:04 (18 months ago)
- Location:
- trunk/Padre
- Files:
-
- 3 deleted
- 2 edited
-
lib/Padre/Wx/Directory.pm (modified) (4 diffs)
-
lib/Padre/Wx/Directory/Path.pm (modified) (1 diff)
-
lib/Padre/Wx/Directory/Task.pm (deleted)
-
t/62-directory-task.t (deleted)
-
t/63-directory-project.t (deleted)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/lib/Padre/Wx/Directory.pm
r12400 r12406 261 261 my @stack = (); 262 262 my $lock = $self->main->lock('UPDATE'); 263 foreach my $i ( 1 .. $#$files ) { 264 my $path = $files->[$i]; 265 my $image = $path->type ? 'folder' : 'package'; 263 shift @$files; 264 foreach my $path ( @$files ) { 266 265 while (@stack) { 267 266 … … 283 282 # Add the next item to that parent 284 283 my $item = $tree->AppendItem( 285 $parent, # Parent node286 $path->name, # Label287 $tree->{images}->{ $image},# Icon288 -1, # Wx Identifier289 Wx::TreeItemData->new($path), # Embedded data284 $parent, # Parent 285 $path->name, # Label 286 $tree->{images}->{ $path->image }, # Icon 287 -1, # Icon (Selected) 288 Wx::TreeItemData->new($path), # Embedded data 290 289 ); 291 290 … … 429 428 } 430 429 431 # Temporarily skip if we've already filled this node. 432 # TODO: Upgrade this to make it update the list instead. 433 if ( $tree->GetChildrenCount($cursor) ) { 434 return; 435 } 436 437 # Add the files to the cursor 430 # Mix the returned files into the existing entries. 431 # If there aren't any existing entries, this shortcuts quite nicely. 432 my ($child, $cookie) = $tree->GetFirstChild($cursor); 433 my $position = 0; 438 434 while ( @_ ) { 439 my $path = shift; 440 my $image = $path->type ? 'folder' : 'package'; 441 442 # Add the child to the parent 443 $tree->AppendItem( 444 $cursor, # Parent node 445 $path->name, # Label 446 $tree->{images}->{$image}, # Icon 447 -1, # Wx Identifier 448 Wx::TreeItemData->new($path), # Embedded data 449 ); 435 if ( $child->IsOk ) { 436 437 # We are not past the last entry 438 my $current = $tree->GetPlData($child); 439 if ( $current->name eq $_[0]->name ) { 440 # Already exists, discard the duplicate 441 shift; 442 } elsif ( 443 $current->is_directory < $_[0]->is_directory 444 and 445 lc($current->name) gt lc($_[0]->name) 446 ) { 447 my $path = shift; 448 $tree->InsertItem( 449 $cursor, # Parent 450 $position, # Before 451 $path->name, # Label 452 $tree->{images}->{ $path->image }, # Icon 453 -1, # Icon (Selected) 454 Wx::TreeItemData->new($path), # Embedded data 455 ); 456 $position += 1; 457 } else { 458 ($child, $cookie) = $tree->GetNextChild($cursor, $cookie); 459 $position += 1; 460 } 461 462 } else { 463 464 # We are past the last entry 465 my $path = shift; 466 $tree->AppendItem( 467 $cursor, # Parent 468 $path->name, # Label 469 $tree->{images}->{ $path->image }, # Icon 470 -1, # Icon (Selected) 471 Wx::TreeItemData->new($path), # Embedded data 472 ); 473 } 450 474 } 451 475 … … 548 572 my $path = Padre::Wx::Directory::Path->directory( @base, $name ); 549 573 my $item = $tree->AppendItem( 550 $cursor, # Parent node574 $cursor, # Parent 551 575 $path->name, # Label 552 576 $tree->{images}->{folder}, # Icon -
trunk/Padre/lib/Padre/Wx/Directory/Path.pm
r12378 r12406 49 49 } 50 50 51 sub image { 52 $_[0]->[0] ? 'folder' : 'package'; 53 } 54 51 55 sub name { 52 56 $_[0]->[-1];
Note: See TracChangeset
for help on using the changeset viewer.
