dotReader

 view release on metacpan or  search on metacpan

client/app.pl  view on Meta::CPAN


#### PAR_LOADS_DEPS_HERE # don't mess with this, it is a token

use dtRdr;
dtRdr->init_app_dir(__FILE__); # requires us to be next to data/

use base 'dtRdr::GUI::Wx';

use dtRdr::GUI::Wx::Frame;
use Wx ();
use Wx::DND (); # clipboard+drag-n-drop support


# testing accessor:
my $frame_main;
sub _main_frame {$frame_main};

{
  my $on_first_idle;
  sub _on_first_idle {$on_first_idle};
  sub _set_on_first_idle {$on_first_idle = $_[1]};

lib/dtRdr/GUI/Wx/TextViewer.pm  view on Meta::CPAN

package dtRdr::GUI::Wx::TextViewer;
$VERSION = eval{require version}?version::qv($_):$_ for(0.10.1);

use warnings;
use strict;
use Carp;


use XML::Twig;

use Wx::DND; # clipboard+drag-n-drop support
use Wx qw(
  :dnd
  wxTheClipboard
);

use base 'dtRdr::GUI::Wx::TextViewer0';

use Wx::Event ();

use dtRdr::Logger;

lib/dtRdr/GUI/Wx/TextViewer.pm  view on Meta::CPAN

  html_widget
);
# TODO AUTOACCESSORS }}}

dtRdr::Accessor->rw qw(
  content
);

=head1 NAME

dtRdr::GUI::Wx::TextViewer - popup text viewer with clipboard

=head1 SYNOPSIS

=cut

=head2 init

  $viewer->init;

=cut

lib/dtRdr/GUI/Wx/TextViewer.pm  view on Meta::CPAN

      keep_encoding => 1,
    );
    $twig->parse($content);
    $text = $twig->root->text;
    # eek! this regex fixes the segfault????
    $text =~ s/(\n)*\s+$/$1/;
    # as does anything else?
    #$text .= " ";
  }
  #WARN("|$text|");
  # clipboard
  {
    my $copy = $text;
    my $cb = wxTheClipboard;
    my $data = Wx::TextDataObject->new($copy);
    $cb->UsePrimarySelection(1);
    if($cb->Open) {
      $cb->SetData($data) or warn "nope!";
      $cb->Close;
    }
    else {
      L->warn("could not open the clipboard");
    }
  }
  return($text);
} # end subroutine copy_all definition
########################################################################


=head1 AUTHOR

Eric Wilhelm <ewilhelm at cpan dot org>

lib/dtRdr/HTMLShim/WxMozilla.pm  view on Meta::CPAN

use strict;

BEGIN { # TODO fix this
  package Wx::MozillaBrowser;
  our @ISA = qw(Wx::ScrolledWindow);
}

use Wx qw(
  wxTheClipboard
);
use Wx::DND; # clipboard+drag-n-drop support
use Wx::Event qw(
  EVT_MOUSE_EVENTS
  EVT_KEY_UP
  );
use Wx::Html;
use Wx::Mozilla;
use Wx::Mozilla::Event qw(:all);

  sub base { 'Wx::MozillaBrowser' };
use base 'dtRdr::HTMLWidget';

lib/dtRdr/HTMLShim/WxMozilla.pm  view on Meta::CPAN


=head2 get_selection_context

  my ($pre, $str, $post) = $hw->get_selection_context($context_length);

=cut

sub get_selection_context {
  my $self = shift;
  my ($blength) = @_;
  # XXX ignoring that ATM because all I got is this stupid clipboard

  my $string = $self->GetSelection;
  return('',$string, '');
} # end subroutine get_selection_context definition
########################################################################

=head2 decrease_font

  $self->decrease_font;

lib/dtRdr/HTMLWidget.pm  view on Meta::CPAN

  my $self = shift;
  my ($html, $dh) = @_;
  return($html);
} # end subroutine filter_HTML definition
########################################################################

=head2 allow_copy

  $widget->allow_copy($bool)

Enable or disable OS copy-to-clipboard functionality

=cut

sub allow_copy {
  my ($self, $allow) = @_;
  my $style = $self->GetWindowStyleFlag();
  if (!$allow) {
    $style = $style | wxHW_NO_SELECTION;
    $self->SetWindowStyleFlag($style);
  } else {

t/_gui/text_viewer.gt  view on Meta::CPAN

  if($^O eq 'darwin' and not $ENV{MRSPERL}) {
    warn "\n\nTODO macs break here\n\n";
    # NOTE I'm very sad: this appears to work when in an appbundle
    skip('macs break here', 1);
    return;
  }
  my $viewer = $bv->show_literal_section('1');
  my $text = $viewer->copy_all;
  ok($text);
  } # end SKIP
  # TODO check the clipboard vs that
});
run();
# vim:ts=2:sw=2:et:sta



( run in 1.627 second using v1.01-cache-2.11-cpan-81fc1098f69 )