AAC-Pvoice
view release on metacpan or search on metacpan
lib/AAC/Pvoice/Input.pm view on Meta::CPAN
package AAC::Pvoice::Input;
use strict;
use warnings;
use Wx qw(:everything);
use Wx::Perl::Carp;
BEGIN
{
use Device::ParallelPort;
if ($^O eq 'MSWin32')
{
require Device::ParallelPort::drv::win32;
}
else
{
require Device::ParallelPort::drv::parport;
}
}
use Wx::Event qw( EVT_TIMER
EVT_CHAR
EVT_MOUSE_EVENTS);
our $VERSION = sprintf("%d.%02d", q$Revision: 1.12 $=~/(\d+)\.(\d+)/);
sub new
{
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
bless $self, $class;
$self->{window} = shift;
# We get the configuration from the Windows registry
# If it's not initialized, we provide some defaults
$self->{window}->{config} = Wx::ConfigBase::Get || croak "Can't get Config";
# Get the input-device
# icon = mouse left/right buttons
# adremo = electric wheelchair adremo
# keys = keystrokes
$self->{window}->{Device} = $self->{window}->{config}->Read('Device', 'icon');
$self->{window}->{Interval} = $self->{window}->{config}->ReadInt('Interval', 10);
$self->{window}->{Buttons} = $self->{window}->{config}->ReadInt('Buttons', 2);
$self->{window}->{OneButtonInterval} = $self->{window}->{config}->ReadInt('OneButtonInterval', 2000);
$self->_initmonitor if $self->{window}->{Device} eq 'adremo';
$self->_initautoscan if $self->{window}->{config}->ReadInt('Buttons') == 1;
$self->_initkeys;
$self->_initicon;
$self->StartMonitor if $self->{window}->{Device} eq 'adremo';
$self->StartAutoscan if $self->{window}->{config}->ReadInt('Buttons') == 1;
return $self;
}
sub newchild
{
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
bless $self, $class;
$self->{window} = shift;
# We get the configuration from the Windows registry
# If it's not initialized, we provide some defaults
$self->{window}->{config} = Wx::ConfigBase::Get || croak "Can't get Config";
# Get the input-device
# icon = mouse left/right buttons
# adremo = electric wheelchair adremo
# keys = keystrokes
$self->{window}->{Device} = $self->{window}->{config}->Read('Device', 'icon');
$self->_initkeys;
$self->_initicon;
return $self;
}
sub _initkeys
{
( run in 1.413 second using v1.01-cache-2.11-cpan-d8267643d1d )