AAC-Pvoice
view release on metacpan or search on metacpan
0.2 0.1 didn't arrive on PAUSE correctly
0.3 minor documentation update in AAC::Pvoice::Bitmap
0.4 correction in AAC::Pvoice::Input to read individual bits
instead of the whole statusbyte from the parallel port
0.5 AAC::Pvoice::Input now no longer uses Win32::API. Now it uses
Device::ParallelPort, so it should be able to run on Linux now too.
0.6 AAC::Pvoice::Bitmap now returns a wxNullBitmap if the resize-factor
is 0 to prevent 'illegal division by zero'
AAC::Pvoice::EditableRow now has some sensible defaults to prevent
'Use of uninitialized value' warnings
AAC::Pvoice::Input can now handle one button input
0.7 AAC::Pvoice::Input
* now allows keyboard input
* now allows direct mouseclicks on the buttons
AAC::Pvoice::Panel
* now uses a round cornered background and
0.8 AAC::Pvoice::Input
* when keystrokes are used, alpha keys are now case-insensitive
Several bugfixes and therefore needed new methods (for most of you
probably not that important)
0.9 AAC::Pvoice::Bitmap
* We now use Image::Magick to create the bitmaps. It's a change to
the internals, so the methods and their parameters stay the same.
* Returned images are cached first (using File::Cache). If an image
has been processed before, it will be retrieved from the cache.
The cache never expires, but every combination of parameters
results in a new cached image (and of course the file modificationtime
of the image is also taken into account.
AAC::Pvoice::Dialog
* This is a newly added class. It's a subclass of Wx::Dialog and
allows you to create dialog boxes, using an AAC::Pvoice::Panel
AAC::Pvoice
* This module now provides the AAC::Pvoice::MessageBox function,
similar to Wx::MessageBox.
0.91 AAC::Pvoice
* Made a little more space between the text and the buttons in the MessageBox
function
covered by the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom
to distribute copies of free software (and charge for this service if you wish), that
you receive source code or can get it if you want it, that you can change the
software or use pieces of it in new free programs; and that you know you can do
these things.
To protect your rights, we need to make restrictions that forbid anyone to deny
you these rights or to ask you to surrender the rights. These restrictions
translate to certain responsibilities for you if you distribute copies of the
software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for a
fee, you must give the recipients all the rights that you have. You must make
sure that they, too, receive or can get the source code. And you must show
them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2) offer
you this license which gives you legal permission to copy, distribute and/or
modify the software.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
MODIFICATION
0. This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms of
this General Public License. The "Program", below, refers to any such program
or work, and a "work based on the Program" means either the Program or any
derivative work under copyright law: that is to say, a work containing the
Program or a portion of it, either verbatim or with modifications and/or translated
into another language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not covered by
this License; they are outside its scope. The act of running the Program is not
restricted, and the output from the Program is covered only if its contents
constitute a work based on the Program (independent of having been made by
running the Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's source code as
you receive it, in any medium, provided that you conspicuously and appropriately
publish on each copy an appropriate copyright notice and disclaimer of warranty;
keep intact all the notices that refer to this License and to the absence of any
warranty; and give any other recipients of the Program a copy of this License
along with the Program.
In addition, mere aggregation of another work not based on the Program with the
Program (or with a work based on the Program) on a volume of a storage or
distribution medium does not bring the other work under the scope of this
License.
3. You may copy and distribute the Program (or a work based on it, under
Section 2) in object code or executable form under the terms of Sections 1 and 2
above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source
code, which must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give any
third party, for a charge no more than your cost of physically performing source
distribution, a complete machine-readable copy of the corresponding source
code, to be distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute
corresponding source code. (This alternative is allowed only for noncommercial
distribution and only if you received the program in object code or executable
form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making
modifications to it. For an executable work, complete source code means all the
source code for all modules it contains, plus any associated interface definition
files, plus the scripts used to control compilation and installation of the
executable. However, as a special exception, the source code distributed need
not include anything that is normally distributed (in either source or binary form)
with the major components (compiler, kernel, and so on) of the operating system
on which the executable runs, unless that component itself accompanies the
executable.
If distribution of executable or object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the source
code from the same place counts as distribution of the source code, even though
third parties are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as
expressly provided under this License. Any attempt otherwise to copy, modify,
sublicense or distribute the Program is void, and will automatically terminate
your rights under this License. However, parties who have received copies, or
rights, from you under this License will not have their licenses terminated so long
as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it.
However, nothing else grants you permission to modify or distribute the Program
or its derivative works. These actions are prohibited by law if you do not accept
this License. Therefore, by modifying or distributing the Program (or any work
based on the Program), you indicate your acceptance of this License to do so,
and all its terms and conditions for copying, distributing or modifying the
Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program),
the recipient automatically receives a license from the original licensor to copy,
distribute or modify the Program subject to these terms and conditions. You
may not impose any further restrictions on the recipients' exercise of the rights
granted herein. You are not responsible for enforcing compliance by third parties
to this License.
7. If, as a consequence of a court judgment or allegation of patent infringement
or for any other reason (not limited to patent issues), conditions are imposed on
you (whether by court order, agreement or otherwise) that contradict the
conditions of this License, they do not excuse you from the conditions of this
License. If you cannot distribute so as to satisfy simultaneously your obligations
under this License and any other pertinent obligations, then as a consequence
you may not distribute the Program at all. For example, if a patent license would
not permit royalty-free redistribution of the Program by all those who receive
It is not the purpose of this section to induce you to infringe any patents or other
property right claims or to contest validity of any such claims; this section has
the sole purpose of protecting the integrity of the free software distribution
system, which is implemented by public license practices. Many people have
made generous contributions to the wide range of software distributed through
that system in reliance on consistent application of that system; it is up to the
author/donor to decide if he or she is willing to distribute software through any
other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain countries
either by patents or by copyrighted interfaces, the original copyright holder who
places the Program under this License may add an explicit geographical
distribution limitation excluding those countries, so that distribution is permitted
only in or among countries not thus excluded. In such case, this License
incorporates the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions of the
General Public License from time to time. Such new versions will be similar in
spirit to the present version, but may differ in detail to address new problems or
concerns.
Each version is given a distinguishing version number. If the Program specifies a
version number of this License which applies to it and "any later version", you
have the option of following the terms and conditions either of that version or of
any later version published by the Free Software Foundation. If the Program does
not specify a version number of this License, you may choose any version ever
published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs
whose distribution conditions are different, write to the author to ask for
permission. For software which is copyrighted by the Free Software Foundation,
write to the Free Software Foundation; we sometimes make exceptions for this.
Our decision will be guided by the two goals of preserving the free status of all
derivatives of our free software and of promoting the sharing and reuse of
software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS
NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
- "Reasonable copying fee" is whatever you can justify on the basis of
media cost, duplication charges, time of people involved, and so on. (You
will not be required to justify it to the Copyright Holder, but only to the
computing community at large as a market that must bear the fee.)
- "Freely Available" means that no fee is charged for the item itself, though
there may be fees involved in handling the item. It also means that
recipients of the item may redistribute it under the same conditions they
received it.
1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you duplicate
all of the original copyright notices and associated disclaimers.
2. You may apply bug fixes, portability fixes and other modifications derived from
the Public Domain or from the Copyright Holder. A Package modified in such a
way shall still be considered the Standard Version.
3. You may otherwise modify your copy of this Package in any way, provided
that you insert a prominent notice in each changed file stating how and when
you changed that file, and provided that you do at least ONE of the following:
form, provided that you do at least ONE of the following:
a) distribute a Standard Version of the executables and library
files, together with instructions (in the manual page or equivalent)
on where to get the Standard Version.
b) accompany the distribution with the machine-readable source of
the Package with your modifications.
c) accompany any non-standard executables with their
corresponding Standard Version executables, giving the
non-standard executables non-standard names, and clearly
documenting the differences in manual pages (or equivalent),
together with instructions on where to get the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
5. You may charge a reasonable copying fee for any distribution of this Package.
You may charge any fee you choose for support of this Package. You may not
charge a fee for this Package itself. However, you may distribute this Package in
aggregate with other (possibly commercial) programs as part of a larger
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: AAC-Pvoice
version: 0.91
version_from: lib/AAC/Pvoice.pm
installdirs: site
requires:
Device::ParallelPort: 0
Device::ParallelPort::drv::win32: 0
File::Cache: 0
File::stat: 0
File::Temp: 0
Image::Magick: 6
IO::Scalar: 0
Text::Wrap: 0
Wx: 0.15
lib/AAC/Pvoice/Bitmap.pm view on Meta::CPAN
}
1;
__END__
=pod
=head1 NAME
AAC::Pvoice::Bitmap - Easily create resized bitmaps with options
=head1 SYNOPSIS
use AAC::Pvoice::Bitmap;
my $bitmap = AAC::Pvoice::Bitmap->new('image.jpg', #image
100, #maxX
100, #maxY
'This is my image', #caption
wxWHITE, #background
1); #blowup?
=head1 DESCRIPTION
This module is a simpler interface to the Wx::Bitmap to do things with
images that I tend to do with almost every image I use in pVoice applications.
It's a subclass of Wx::Bitmap, so you can call any method that a Wx::Bitmap
can handle on the resulting AAC::Pvoice::Bitmap.
=head1 USAGE
=head2 new(image, maxX, maxY, caption, background, blowup, parentbackground)
This constructor returns a bitmap (useable as a normal Wx::Bitmap), that
has a size of maxX x maxY, the image drawn into it as large as possible.
If blowup has a true value, it will enlarge the image to try and match
the maxX and maxY. Any space not filled by the image will be the
specified background colour. A caption can be specified to draw under the
lib/AAC/Pvoice/Bitmap.pm view on Meta::CPAN
the user.
=over 4
=item image
This is the path to the image you want to have.
=item maxX, maxY
These are the maximum X and Y size of the resulting image. If the original
image is larger, it will be resized (maintaining the aspect ratio) to
match these values as closely as possible. If the 'blowup' parameter is
set to a true value, it will also enlarge images that are smaller than
maxX and maxY to get the largest possible image within these maximum values.
=item caption
This is an optional caption below the image. The caption's font is Comic Sans MS
and will have a pointsize that will make the caption fit within the maxX
of the image. The resulting height of the caption is subtracted from the
maxY
=item background
This is the background of the image, specified as either a constant
(i.e. wxWHITE) or as an arrayref of RGB colours (like [128,150,201] ).
=item blowup
This boolean parameter determines whether or not images that are smaller
lib/AAC/Pvoice/Input.pm view on Meta::CPAN
=head2 new($window)
This constructor takes the window (AAC::Pvoice::Panel typically) on which
the events and timer will be called as a parameter.
If the configuration (read using Wx::ConfigBase::Get) has a key called
'Device' (which can be set to 'icon', 'keys' , 'mouse' or 'adremo') is set to 'adremo', it
will start polling the parallel port every x milliseconds, where x is the
value of the configuration key 'Interval'. This setting is only useful if you connect
an "Adremo" electrical wheelchair to the parallel port of your PC (for more
information see http://www.adremo.nl).
If the key 'Device' is set to 'icon' it will respond to the left and right
mouse button, and if it's set to 'keys' it will respond to the configuration
keys 'SelectKey' and 'NextKey' (which are the keyboard codes for the 'select'
and 'next' events respectively.
AAC::Pvoice::Input has the ability to operate with either one or two buttons.
If you want to use only one button, you need to set the configuration key "Buttons"
to 1, and it will automatically invoke the subroutine you pass to Next()
at an interval of the value set in the configuration key OneButtonInterval (set in milliseconds).
The default for is to operate in two button mode, and if OneButtonInterval is not
set, it will use a default of 2000 milliseconds if "Buttons" is set to 1.
=head2 newchild($window)
lib/AAC/Pvoice/Input.pm view on Meta::CPAN
=head2 Next(sub)
This method takes a coderef as parameter. This coderef will be invoked when
the 'Next' event happens.
If the Device (see 'new') is set to 'icon', and a right mousebutton is
clicked, a 'Next' event is generated.
If the Device is set to 'adremo' and the headsupport of the wheelchair
is moved to the right, that will also generate a 'Next' event.
If the Device is set to 'keys' and a key is pressed that corresponds with the
keycode set in the 'NextKey', this will generate a 'Next' event too.
=head2 Select(sub)
This method takes a coderef as parameter. This coderef will be invoked when
the 'Select' event happens.
If the Device (see 'new') is set to 'icon', and a left mousebutton is
clicked, a 'Select' event is generated.
If the Device is set to 'adremo' and the headsupport of the wheelchair
is moved to the left, that will also generate a 'Select' event.
If the Device is set to 'keys' and a key is pressed that corresponds with the
keycode set in the 'SelectKey', this will generate a 'Select' event too.
=head2 GetDevice
This method will return the value of the configuration key called 'Device'
=head2 SetupMouse($window, $subgetfocus, $subup, $sublosefocus)
This method is used to setup a button for normal mouse input (when
configuration key 'Device' is set to 'mouse'). It takes the wxWindow
(typically a Wx::BitmapButton) that should respond to this way of
input as the first parameter.
$subgetfocus is the coderef that should be invoked when the mousecursor
hovers over this $window (EVT_ENTER).
$subup is the coderef that should be invoked when the left mousebutton
is released (EVT_LEFT_UP).
$sublosefocus is the coderef that should be invoked when the $window
loses focus (EVT_LEAVE).
=head2 StartMonitor
This method will start polling the the parallel port for input of the Adremo
Electrical Wheelchair.
=head2 QuitMonitor
This method will stop the timer that monitors the parallel port.
=head2 PauseMonitor($bool)
This method will pause ($bool is set to 1) or restart ($bool is set to 0)
the timer that monitors the parallel port.
=head2 StartAutoscan
This method will start the timer that invokes the Next() event every n milliseconds.
=head2 QuitAutoscan
This method will stop the timer that invokes the Next() method.
=head2 PauseAutoscan($bool)
This method will pause ($bool is set to 1) or restart ($bool is set to 0)
the timer that invokes the Next() method.
=head1 BUGS
probably a lot, patches welcome!
=head1 AUTHOR
lib/AAC/Pvoice/Panel.pm view on Meta::CPAN
$row->Destroy
}
$_->Destroy for @{$self->{unselectablerows}};
$self->{text}->Destroy if exists $self->{text};
$self->{title}->Destroy if exists $self->{title};
$self->{rows} = [];
$self->{unselectablerows} = [];
$self->SUPER::Clear();
$self->{totalrows} = 0;
$self->{lastrow} = 0;
$self->Refresh;
}
sub Finalize
{
my $self = shift;
my $dc = Wx::WindowDC->new($self);
$self->DrawBackground($dc);
unless ($self->{disabletextrow})
{
lib/AAC/Pvoice/Panel.pm view on Meta::CPAN
$self->{text}->SetDefaultStyle($self->{ta});
$rowsizer->Add($self->{text}, # what to add
0, # unused
wxALIGN_CENTRE|wxALL, # style
$self->{itemspacing}); # padding
$self->{tls}->Add($rowsizer, 0, wxALIGN_CENTRE, 0);
$self->{textrowsizer} = $rowsizer;
$self->{text}->SetValue(my $x = $self->RetrieveText);
$self->{text}->SetStyle(0, length($self->{text}->GetValue), $self->{ta});
$self->{text}->Refresh(); # Added to test it on the Mercury...added text
# isn't visible there...
}
$self->{title}->SetBackgroundColour($self->BackgroundColour) unless $self->{disabletitle};
$self->{tls}->AddGrowableCol(0);
$self->Layout;
# Select the first row
$self->{selectedrow} = 0;
$self->{selecteditem} = 0;
$self->SetSelectionBorder($self->{rows}->[$self->{selectedrow}]) if $self->{rowcolumnscanning} && not $self->{editmode};
$self->{rowselection} = 1;
$self->Refresh;
$self->Update();
$self->{unfinished} = 0;
}
sub Next
{
my $self = shift;
return if ($self->{editmode} || $self->{unfinished});
$self->{input}->QuitAutoscan;
if ($self->{rowselection})
lib/AAC/Pvoice/Panel.pm view on Meta::CPAN
$self->SetNormalBorder($self->{rows}->[$self->{selectedrow}]->{items}->[$self->{selecteditem}]) if $self->{rowcolumnscanning};
$self->SetSelectionBorder($self->{rows}->[$self->{selectedrow}]) if $self->{rowcolumnscanning};
$self->{rowselection} = 1;
}
sub DisplayAddText
{
my $self = shift;
push @{$self->{displaytextsave}}, $_[0];
$self->{text}->AppendText($_[0]);
$self->{text}->Refresh(); # Added to test it on the Mercury...added text
# isn't visible there...
}
sub SpeechAddText
{
my $self = shift;
push @{$self->{speechtextsave}}, $_[0];
}
sub RetrieveText
lib/AAC/Pvoice/Panel.pm view on Meta::CPAN
my $self = shift;
return wantarray ? @{$self->{displaytextsave}} : join('', @{$self->{displaytextsave}});
}
sub ClearText
{
my $self = shift;
$self->{displaytextsave}=[];
$self->{speechtextsave}=[];
$self->{text}->SetValue('');
$self->{text}->Refresh(); # Added to test it on the Mercury...added text
# isn't visible there...
}
sub BackspaceText
{
my $self = shift;
pop @{$self->{displaytextsave}};
pop @{$self->{speechtextsave}};
$self->{text}->SetValue(my $x = $self->RetrieveText);
$self->{text}->SetStyle(0, length($self->{text}->GetValue), $self->{ta});
$self->{text}->Refresh(); # Added to test it on the Mercury...added text
# isn't visible there...
}
sub SpeechRetrieveText
{
my $self = shift;
return wantarray ? @{$self->{speechtextsave}} : join('', @{$self->{speechtextsave}});
}
1;
lib/AAC/Pvoice/Panel.pm view on Meta::CPAN
This is the spacing used between the rows that are appended.
=item selectionborderwidth
This is the width of the border around a selected row or a selected item.
=item disabletitle
This is also a boolean (1 or 0), which determines if the panel should
reserve space for a title. If disabletitle is set to 1, AddTitle won't have
any effect at all.
=back
=head2 SetEditmode($onoff)
This sets Editmode on or off (depending on $onoff to be a true or false value).
Editmode means that the typical pVoice input doesn't work anymore, and is
typically used in combination with AAC::Pvoice::EditableRow...
lib/AAC/Pvoice/Panel.pm view on Meta::CPAN
This method removes the last text added to the speech *and* displaytext.
Make sure that both speechtext and displaytext have the same amount of
text added, because it just pops off the last item from both lists and
updates the textrow.
=head2 PauseInput($bool)
This method makes sure that the timers that are used for the input (using
AAC::Pvoice::Input) are paused if $bool is set to 1. If $bool is 0, they're
restarted.
=head1 BUGS
probably a lot, patches welcome!
=head1 AUTHOR
Jouke Visser
jouke@pvoice.org
( run in 1.023 second using v1.01-cache-2.11-cpan-49f99fa48dc )