Gtk2-CV

 view release on metacpan or  search on metacpan

lib/Gtk2/CV/Schnauzer.pm  view on Meta::CPAN


   $self->draw_entry ($_) for keys %{delete $self->{sel} || {}};

   $self->emit_sel_changed;
}

sub get_selection {
   my ($self) = @_;

   $self->{sel}
}

=item $schnauzer->rotate( degrees, idx[, idx...])

Rotate the raw images on the given entries.

=cut

sub rotate {
   my ($self, $degrees, @idx) = @_;

   Gtk2::CV::Jobber::inhibit {
      for (sort { $b <=> $a } @idx) {
         my $e = $self->{entry}[$_];
         Gtk2::CV::Jobber::submit rotate => "$e->[0]/$e->[1]", $degrees;
         delete $self->{sel}{$_};
      }

      $self->invalidate_all;
      $self->emit_sel_changed;
   };
}

=item $schnauzer->generate_thumbnails (idx[, idx...])

Generate (unconditionally) the thumbnails on the given entries.

=cut

sub generate_thumbnails {
   my ($self, @idx) = @_;

   Gtk2::CV::Jobber::inhibit {
      for (sort { $b <=> $a } @idx) {
         my $e = $self->{entry}[$_];
         Gtk2::CV::Jobber::submit gen_thumb => "$e->[0]/$e->[1]";
         delete $self->{sel}{$_};
      }

      $self->invalidate_all;
      $self->emit_sel_changed;
   };
}

=item $schnauzer->update_thumbnails (idx[, idx...])

Update (if needed) the thumbnails on the given entries.

=cut

sub update_thumbnails {
   my ($self, @idx) = @_;

   Gtk2::CV::Jobber::inhibit {
      for (sort { $b <=> $a } @idx) {
         my $e = $self->{entry}[$_];
         Gtk2::CV::Jobber::submit upd_thumb => "$e->[0]/$e->[1]";
         delete $self->{sel}{$_};
      }

      $self->invalidate_all;
      $self->emit_sel_changed;
   };
}

=item $schnauzer->unlink_thumbnails (idx[, idx...])

Physically remove the thumbnails on the given entries.

=cut

sub unlink_thumbnails {
   my ($self, @idx) = @_;

   Gtk2::CV::Jobber::inhibit {
      for (sort { $b <=> $a } @idx) {
         my $e = $self->{entry}[$_];
         Gtk2::CV::Jobber::submit unlink_thumb => "$e->[0]/$e->[1]";
         delete $self->{sel}{$_};
      }

      $self->invalidate_all;
      $self->emit_sel_changed;
   };
}

=item $schnauzer->selection_adjacent_dir

=cut

sub selection_adjacent_dir {
   my ($self) = @_;

   my $sel = $self->{sel} ||= {};
   my @keys = sort keys %$sel;
   my $entry = $self->{entry};

   my $same_prefix = sub {
      my ($idx, $pfx) = @_;

      $idx >= 0 && $idx <= $#$entry
         or return 0;

      $pfx eq substr "$entry->[$idx][E_DIR]/", 0, length $pfx
   };

   # frst arg may be out-of-range
   my $common_prefix = sub {
      my ($a, $b) = @_;

      $a >= 0 && $a <= $#$entry



( run in 1.725 second using v1.01-cache-2.11-cpan-39bf76dae61 )