[opendemo-cvs] CVS: opendemo/tools/odcut OdGui.pm,1.3,1.4
Status: Beta
Brought to you by:
girlich
From: Uwe G. <gi...@us...> - 2005-02-08 21:13:59
|
Update of /cvsroot/opendemo/opendemo/tools/odcut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv989 Modified Files: OdGui.pm Log Message: implement file->cut list cut list delete cut list copy Index: OdGui.pm =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/OdGui.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** OdGui.pm 8 Feb 2005 20:22:43 -0000 1.3 --- OdGui.pm 8 Feb 2005 21:13:26 -0000 1.4 *************** *** 41,44 **** --- 41,48 ---- EVT_CLOSE($self,\&OnClose); + EVT_BUTTON($self,$self->{cutListCopy},\&OnCutListCopy); + EVT_BUTTON($self,$self->{cutListDelete},\&OnCutListDelete); + + EVT_BUTTON($self,$self->{fileToCutList},\&OnFileToCutList); EVT_BUTTON($self,$self->{fileClose},\&OnFileClose); EVT_GRID_SELECT_CELL($self->{gridFiles},\&OnSelectFileCell); *************** *** 51,54 **** --- 55,109 ---- + sub OnCutListDelete($) + { + my $self = shift; + my $grid = $self->{gridCut}; + my $remove = 0; + do { + $remove = 0; + my @rows = $grid->GetSelectedRows(); + foreach my $row (@rows) { + $grid->DeleteRows($row,1,1); + $remove++; + # It is much to dangerous to delete more than + # one row. + last; + } + } while ($remove); + } + + + sub gridAddRow($@) + { + my $grid = shift; + $grid->AppendRows(1, 1); + my $row = $grid->GetNumberRows() - 1; + my $col = 0; + foreach my $value (@_) { + $grid->SetCellValue($row,$col,$value); + $col++; + } + $grid->SetReadOnly($row,0); + } + + + sub OnCutListCopy($) + { + my $self = shift; + my $grid = $self->{gridCut}; + my @rows = $grid->GetSelectedRows(); + if (@rows) { + my $row = $rows[0]; + gridAddRow($grid, + + $grid->GetCellValue($row,0), + $grid->GetCellValue($row,1), + $grid->GetCellValue($row,2), + $grid->GetCellValue($row,3) + ); + } + } + + { my $prevdir; *************** *** 103,110 **** ! sub OnFileClose($) { ! my ($self) = @_; ! my $grid = $self->{gridFiles}; my %files; my @rows = $grid->GetSelectedRows(); --- 158,164 ---- ! sub getSelectedFiles($) { ! my $grid = shift; my %files; my @rows = $grid->GetSelectedRows(); *************** *** 115,120 **** } } ! if (%files) { ! foreach my $file (keys %files) { # printf STDERR "close file: %s\n", $file; --- 169,201 ---- } } ! return keys %files; ! } ! ! ! sub OnFileToCutList($) ! { ! my $self = shift; ! my $gridFiles = $self->{gridFiles}; ! my $gridCut = $self->{gridCut}; ! my $output = $self->{output}; ! my @files = getSelectedFiles($gridFiles); ! foreach my $filename (@files) { ! printf STDERR "selected is $filename\n"; ! foreach my $file ($output->get_files()) { ! if ($filename eq $file->name()) { ! gridAddRow($gridCut, $file->name(),0,$file->snapshotc()-1,1); ! } ! } ! } ! } ! ! ! sub OnFileClose($) ! { ! my ($self) = @_; ! my $grid = $self->{gridFiles}; ! my @files = getSelectedFiles($grid); ! if (@files) { ! foreach my $file (@files) { # printf STDERR "close file: %s\n", $file; |