view release on metacpan or search on metacpan
1.18 2005-04-20
- Extend function of listboxes and outlines.
- Change syntax of Drawable:: text methods.
1.17 2005-01-27
- Add Window::onTop.
- Add =SYNOPSIS sections in selected modules.
1.16 2004-10-03
- Add Clipboard::UTF8 exchange format.
- Add Drawable ::lineJoin and ::fillWinding.
1.15 2004-05-05
- Add message hooks.
- Add DirectoryOutline widget.
- Add tying properties.
1.14 2004-02-12
- Add system-specific file dialogs.
- Add Edit::undo.
Makefile.PL view on Meta::CPAN
use File::Basename;
use File::Copy;
use vars qw(
$ARGV_STR
$COUTOFLAG
$COUTEXEFLAG
$CLIBPATHFLAG
$CLINKPREFIX
$LDLIBFLAG
$LDOUTFLAG
$TMPDIR
$NULLDEV
$SCRIPT_EXT
$LD_LIB_EXT
$LIB_EXT
$LIB_PREFIX
$LDFLAGS
$LDDLFLAGS
@LIBS
@INCPATH
Prima/Classes.pm view on Meta::CPAN
$clipboard->store($_, undef) for map { $_->{mime} } @{ $self-> {GTKImageClipboardFormats} // [] };
}
}
sub on_formatexists
{
my ( $self, $format, $clipboard, $ref) = @_;
if ( $format eq 'Text') {
if ( $self-> wantUnicodeInput) {
return $$ref = 'UTF8' if $clipboard-> format_exists( 'UTF8');
}
$$ref = $clipboard-> format_exists( $format ) ? $format : undef;
} elsif ( $format eq 'Image') {
$$ref = undef;
return $$ref = 'Image' if $clipboard-> format_exists( 'Image');
my $codecs = $self-> {GTKImageClipboardFormats} or return;
my %formats = map { $_ => 1 } $clipboard-> get_formats;
my @codecs = grep { $formats{$_->{mime}} } @$codecs or return;
$$ref = $codecs[0]->{mime} if $clipboard-> format_exists($codecs[0]->{mime});
} else {
Prima/Const.pm view on Meta::CPAN
sv::MouseButtons - number of the mouse buttons
sv::WheelPresent - 1 if the mouse wheel is present, 0 otherwise
sv::SubmenuDelay - timeout ( in ms ) before a sub-menu shows on
an implicit selection
sv::FullDrag - 1 if the top-level windows are dragged dynamically,
0 - with marquee mode
sv::DblClickDelay - mouse double-click timeout in milliseconds
sv::ShapeExtension - 1 if Prima::Widget::shape functionality is supported,
0 otherwise
sv::ColorPointer - 1 if system accepts color pointer icons.
sv::CanUTF8_Input - 1 if system can generate key codes in unicode
sv::CanUTF8_Output - 1 if system can output utf8 text
sv::CompositeDisplay - 1 if system uses double-buffering and alpha composition for the desktop,
0 if it doesn't, -1 if unknown
sv::LayeredWidgets - 1 if system supports layering
sv::FixedPointerSize - 0 if system doesn't support arbitrary sized pointers and will resize custom icons to the system size
sv::MenuCheckSize - width and height of default menu check icon
sv::FriBidi - 1 if Prima is compiled with libfribidi and full bidi unicode support is available
sv::Antialias - 1 if system supports antialiasing and alpha layer for primitives
sv::LibThai - 1 if Prima is compiled with libthai
=head2 ta:: - alignment constants
Prima/Drawable/Glyphs.pm view on Meta::CPAN
1;
=pod
=head1 NAME
Prima::Drawable::Glyphs - helper routines for bi-directional text input and complex scripts output
=head1 SYNOPSIS
=encoding utf-8
=for latex-makedoc header
\usepackage{amsmath,amssymb}
\DeclareFontFamily{U}{rcjhbltx}{}
\DeclareFontShape{U}{rcjhbltx}{m}{n}{<->rcjhbltx}{}
\DeclareSymbolFont{hebrewletters}{U}{rcjhbltx}{m}{n}
\DeclareMathSymbol{\alef}{\mathord}{hebrewletters}{39}
\DeclareMathSymbol{\pe}{\mathord}{hebrewletters}{112}
\DeclareMathSymbol{\samekh}{\mathord}{hebrewletters}{115}
Prima/Drawable/Path.pm view on Meta::CPAN
my ($self, $text, %opt) = @_;
return unless my $c = $self->{canvas};
my $state = $c->get_paint_state;
unless ($state) {
return unless $c->begin_paint_info;
}
$self->translate( 0, $c->font->descent )
unless $opt{baseline} // $c->textOutBaseline;
my $cache = $opt{cache} || {};
my $unicode = utf8::is_utf8($text);
for my $char ( split //, $text ) {
my $ix = ord($char);
$self->glyph($ix, %opt, unicode => $unicode);
my $r = $cache->{$char} //= do {
my $p = $c->get_font_abc($ix,$ix,$unicode);
$p->[0] + $p->[1] + $p->[2]
};
$self->translate($r,0);
}
Prima/Edit.pm view on Meta::CPAN
$self-> begin_undo_group;
my $block = $self-> has_selection;
$self-> delete_block if $block;
my @cs = $self-> cursor;
my $c = $self-> get_line( $cs[1]);
my $l = 0;
my $chr = chr $code;
utf8::upgrade($chr) if $mod & km::Unicode;
my $ll = $self-> get_chunk_cluster_length($cs[1]);
$c .= ' ' x ($cs[0] - $ll) if $cs[0] > $ll;
my $s = $self->get_shaped_chunk($cs[1]);
my ($new_text, $new_offset) = $self->handle_bidi_input(
action => (($block || $self->insertMode) ? q(insert) : q(overtype)),
at => $cs[0],
input => $chr x $repeat,
text => $c,
rtl => $self->textDirection,
glyphs => $s,
Prima/IniFile.pm view on Meta::CPAN
$self-> {fileName} = canonicalize_fname($fname);
eval
{
my $f;
open $f, "<", $fname or do
{
open $f, ">", $fname or die "Cannot create $fname: $!\n";
close $f;
open $f, "<", $fname or die "Cannot open $fname: $!\n";
};
binmode $f, ":utf8";
my @chunks;
my %sectionChunks = ('' => [0]);
my %sectionItems = ('' => []);
my $currentChunk = [];
my $items = {};
my $chunkNum = 0;
my $line = 0;
push @chunks, $currentChunk;
push @{$sectionItems{''}}, $items;
while (<$f>)
Prima/PS/PDF.pm view on Meta::CPAN
{
my ( $self, $docName) = @_;
return 0 if $self-> get_paint_state;
$self-> {ps_data} = '';
$self-> {can_draw} = 1;
$self-> {content_size} = 0;
$docName = $::application ? $::application-> name : "Prima::PS::PDF"
unless defined $docName;
$docName = Encode::encode('UTF-16', $docName)
if Encode::is_utf8($docName);
$self-> {fp_hash} = {};
$self-> {xref} = [];
my ($sec,$min,$hour,$mday,$mon,$year) = localtime;
my $date = sprintf("%04d%02d%02d%02d%02d%02d", $year + 1900, $mon, $mday, $hour, $min, $sec);
my $four = pack('C*', 0xde, 0xad, 0xbe, 0xef);
$self-> emit( <<PDFHEADER);
%PDF-1.4
%$four
PDFHEADER
Prima/PodView.pm view on Meta::CPAN
bigofs => 0,
wrapstate => '',
wrapindent => 0,
topicStack => [[-1]],
format => 1,
createIndex => 1,
encoding => undef,
bom => undef,
utf8 => undef,
verbatim => undef,
@opt,
};
}
sub load_image
{
my ( $self, $src, $frame, $rest ) = @_;
return Prima::Image::base64->load_icon($rest, index => $frame, iconUnmask => 1)
Prima/sys/FS.pm view on Meta::CPAN
sub _A ($) { __x sub { ( time - $_[8] ) / 86400 }, $_[0] }
sub _M ($) { __x sub { ( time - $_[9] ) / 86400 }, $_[0] }
sub _C ($) { __x sub { ( time - $_[10] ) / 86400 }, $_[0] }
# adapted from Cwd.pm
sub abs_path
{
unless ( $^O =~ /win32|cygwin/i ) {
require Cwd;
my $p = $_[0];
my $was_utf8 = Encode::is_utf8($p);
$p = Cwd::abs_path($p);
$p = Encode::decode('utf-8', $p) if $was_utf8;
return $p;
}
my $cwd = Prima::Utils::getcwd();
defined $cwd or return undef;
my $path = @_ ? shift : '.';
unless (_e $path) {
require Errno;
$! = Errno::ENOENT();
Prima/sys/Gencls.pm view on Meta::CPAN
sub type2sv
{
my ( $type, $name) = @_;
$type = $mapTypes{ $type} || $type;
if ( ref $type) {
return "sv_$type->[PROPS]->{name}2HV(&($name))";
} elsif ( $type eq 'Handle') {
return "( $name ? (( $incInst)$name)-> $hMate : &PL_sv_undef)";
} elsif ( $type eq 'string') {
my $fname = $name;
$fname =~ s/(.*)\b(\w+)$/${1}is_utf8.$2/;
return "prima_svpv_utf8($name, $fname)";
} elsif ( $type eq 'SV*') {
return $name;
} else {
return "new${xsConv{$type}[7]}( $name$xsConv{$type}[5])";
}
}
sub sv2type
{
my ( $type, $name) = @_;
Prima/sys/gtk/FileDialog.pm view on Meta::CPAN
return wantarray ? () : undef;
}
$self-> {directory} = Prima::Application-> sys_action( 'gtk.OpenFile.directory');
$self-> {directory} .= '/' unless $self-> {directory} =~ /\/$/;
$self-> {fileName} = $ret;
$self-> {filterIndex} = Prima::Application-> sys_action( 'gtk.OpenFile.filterindex');
for (qw(directory fileName)) {
local $SIG{__DIE__};
my $p;
eval { $p = Encode::decode('UTF-8', $self->{$_}, Encode::FB_CROAK ) };
next if $@;
$self->{$_} = $p;
}
# emulate some flags now
if ( $self-> {pathMustExist}) {
unless ( -d $self-> {directory}) {
message_box( $self-> text, "Directory $self->{directory} does not exist", mb::OK | mb::Error);
next DIALOG;
}
Prima/sys/win32/FileDialog.pm view on Meta::CPAN
sub showDotFiles { 1 }
# mere callbacks if someone wants these to inherit
sub ok {}
sub cancel {}
sub _set
{
my @cmd = @_;
for my $c ( @cmd ) {
unless ( Encode::is_utf8($c)) {
my $v = Prima::Utils::local2sv($c);
$c = $v if defined $v;
}
$c = Encode::encode('utf-8', $c);
}
my $cmd = shift @cmd;
Prima::Application-> sys_action( "win32.OpenFile.$cmd=".join('', @cmd));
}
sub _get
{
my $cmd = shift;
$cmd = Prima::Application-> sys_action( "win32.OpenFile.$cmd");
return Encode::decode('utf-8', $cmd);
}
sub execute
{
my $self = $_[0];
_set( flags => join(',', grep { $self->{flags}->{$_}} keys %{$self->{flags}}));
_set( filters => join("\0", map { "$$_[0] ($$_[1])\0$$_[1]" } @{$self->{filter}}) . "\0");
_set( filterindex => ($self->{filterIndex}+1));
my $dir = $self->{directory};
vmt = vmt-> base;
return vmt != NULL;
}
XS( Prima_message_FROMPERL)
{
dXSARGS;
(void)items;
if ( items != 1)
croak("Invalid usage of Prima::%s", "message");
apc_show_message((char*) SvPV_nolen( ST(0)), prima_is_utf8_sv(ST(0)));
XSRETURN_EMPTY;
}
XS( Prima_dl_export)
{
dXSARGS;
(void)items;
if ( items != 1)
croak("Invalid usage of Prima::%s", "dl_export");
apc_dl_export((char*) SvPV_nolen( ST(0)));
#include "apricot.h"
#include "guts.h"
#ifdef __cplusplus
extern "C" {
#endif
FILE*
prima_open_file( const char *text, Bool is_utf8, const char * mode)
{
int fd, o, m;
const char * omode = mode;
char *cwd = NULL;
FILE * ret;
(void)cwd;
switch ( *mode++ ) {
case 'r':
#include "apricot.h"
#include "guts.h"
#ifdef __cplusplus
extern "C" {
#endif
int
prima_utf8_length( const char * utf8, int maxlen)
{
int ulen = 0;
if ( maxlen < 0 ) maxlen = INT16_MAX;
while ( maxlen > 0 && *utf8 ) {
const char *u = (char*) utf8_hop(( U8*) utf8, 1);
ulen++;
maxlen -= u - utf8;
utf8 = u;
}
return ulen;
}
Bool
prima_is_utf8_sv( SV * sv)
{
/* from Encode.xs */
if (SvGMAGICAL(sv)) {
SV * sv2 = newSVsv(sv); /* GMAGIG will be done */
Bool ret = SvUTF8(sv2) ? 1 : 0;
SvREFCNT_dec(sv2); /* it was a temp copy */
return ret;
} else {
return SvUTF8(sv) ? 1 : 0;
}
}
SV*
prima_svpv_utf8( const char *text, int is_utf8)
{
SV *sv = newSVpv(text, 0);
if ( is_utf8 ) SvUTF8_on(sv);
return sv;
}
#ifdef __cplusplus
}
#endif
class/AbstractMenu.c view on Meta::CPAN
r-> flags. rightAdjust = rightAdjust ? 1 : 0;
r-> id = ++(var-> autoEnum);
#define a_get( l_, fl_, num) \
if ( num >= 0 ) { \
holder = av_fetch( item, num, 0); \
if ( holder) { \
if ( SvOK(*holder)) { \
l_ = duplicate_string( SvPV_nolen( *holder)); \
fl_ = prima_is_utf8_sv(*holder); \
} \
} else { \
warn("menu build error: array panic"); \
my-> dispose_menu( self, m); \
return NULL; \
} \
}
a_get( r-> accel , r-> flags. utf8_accel, l_accel);
a_get( r-> variable, r-> flags. utf8_variable, l_var);
if ( l_key >= 0) {
holder = av_fetch( item, l_key, 0);
if ( !holder) {
warn("menu build error: array panic");
my-> dispose_menu( self, m);
return NULL;
}
r-> key = key_normalize( SvPV_nolen( *holder));
}
class/Component.c view on Meta::CPAN
}
}
SV *
Component_name( Handle self, Bool set, SV * name)
{
if ( set) {
free( var-> name);
var-> name = NULL;
var-> name = duplicate_string( SvPV_nolen( name));
opt_assign( optUTF8_name, prima_is_utf8_sv(name));
if ( var-> stage >= csNormal)
apc_component_fullname_changed_notify( self);
} else {
name = newSVpv( var-> name ? var-> name : "", 0);
if ( is_opt( optUTF8_name)) SvUTF8_on( name);
return name;
}
return NULL_SV;
}
Handle
Component_owner( Handle self, Bool set, Handle owner)
{
HV * profile;
if ( !set)
class/Drawable/fonts.c view on Meta::CPAN
dest-> undef = source-> undef;
if ( useHeight) dest-> height = source-> height;
if ( useWidth ) dest-> width = source-> width;
if ( useDir ) dest-> direction = source-> direction;
if ( useStyle ) dest-> style = source-> style;
if ( usePitch ) dest-> pitch = source-> pitch;
if ( useSize ) dest-> size = source-> size;
if ( useVec ) dest-> vector = source-> vector;
if ( useName ) {
strcpy( dest-> name, source-> name);
dest->is_utf8.name = source->is_utf8.name;
}
if ( useEnc ) {
strcpy( dest-> encoding, source-> encoding);
dest->is_utf8.encoding = source->is_utf8.encoding;
}
}
/* nulling dependencies */
if ( !useHeight && useSize)
dest-> height = 0;
if ( !useWidth && ( usePitch || useHeight || useName || useSize || useDir || useStyle))
dest-> width = 0;
if ( !usePitch && ( useStyle || useName || useDir || useWidth))
dest-> pitch = fpDefault;
class/Drawable/shape.c view on Meta::CPAN
}
static uint32_t*
sv2uint32( SV * text, unsigned int * size, unsigned int * flags)
{
STRLEN dlen;
register char * src;
uint32_t *ret;
src = SvPV(text, dlen);
if (prima_is_utf8_sv(text)) {
*flags |= toUTF8;
*size = prima_utf8_length(src, dlen);
} else {
*size = dlen;
}
if (!(ret = ( uint32_t*) warn_malloc(sizeof(uint32_t) * (*size))))
return NULL;
if (*flags & toUTF8 ) {
uint32_t *dst = ret;
while ( dlen > 0 && dst - ret < *size) {
STRLEN charlen;
UV uv;
uv = prima_utf8_uvchr(src, dlen, &charlen);
if ( uv > 0x10FFFF ) uv = 0x10FFFF;
*(dst++) = uv;
if ( charlen == 0 ) break;
src += charlen;
dlen -= charlen;
}
*size = dst - ret;
} else {
register int i = *size;
register uint32_t *dst = ret;
view all matches for this distributionview release on metacpan - search on metacpan