9 changed files with 202 additions and 167 deletions
@ -0,0 +1,15 @@ |
|||||||
|
PREFIX = /usr/local
|
||||||
|
|
||||||
|
SUBDIRS = plugins \
|
||||||
|
sounds \
|
||||||
|
images \
|
||||||
|
lib
|
||||||
|
|
||||||
|
install: |
||||||
|
mkdir -p $(DESTDIR)/$(PREFIX)/share/milkbone
|
||||||
|
cp -r *.p* $(SUBDIRS) $(DESTDIR)/$(PREFIX)/share/milkbone
|
||||||
|
mkdir -p $(DESTDIR)/$(PREFIX)/share/doc/milkbone/
|
||||||
|
cp -r docs/* $(DESTDIR)/$(PREFIX)/share/doc/milkbone
|
||||||
|
mkdir -p $(DESTDIR)/$(PREFIX)/bin/
|
||||||
|
echo -e "#!/bin/sh \n cd ${PREFIX}/share/milkbone \n exec $(PREFIX)/share/milkbone/mos.pl \"\$$@\"\n" > $(DESTDIR)/$(PREFIX)/bin/milkbone
|
||||||
|
chmod +x $(DESTDIR)/$(PREFIX)/bin/milkbone
|
@ -0,0 +1,23 @@ |
|||||||
|
DESCRIPTION="IM client written in Perl/Tk" |
||||||
|
HOMEPAGE="http://www.milkbone.org" |
||||||
|
IUSE="" |
||||||
|
|
||||||
|
DEPEND=">=dev-lang/perl-5.6* |
||||||
|
>=dev-perl/perl-tk-800.02*" |
||||||
|
|
||||||
|
SLOT="0" |
||||||
|
LICENSE="GPL-2" |
||||||
|
KEYWORDS="~x86 ~ppc ~alpha ~sparc" |
||||||
|
|
||||||
|
MY_P="$(echo ${P}|sed 's/b$/beta/')" |
||||||
|
SRC_URI="mirror://sourceforge/gaim/${P}.tar.gz" |
||||||
|
S=${WORKDIR}/${MY_P} |
||||||
|
|
||||||
|
src_compile() { |
||||||
|
true |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
src_install() { |
||||||
|
einstall || die "Couldn't install |
||||||
|
} |
@ -1,184 +1,181 @@ |
|||||||
package Tk::BrowseEdit; |
package Tk::BrowseEdit; |
||||||
|
|
||||||
use Tk; |
use Tk; |
||||||
use Tk::Font; |
use Tk::Font; |
||||||
use base 'Tk::Frame'; |
use base 'Tk::Frame'; |
||||||
|
|
||||||
use strict; |
use strict; |
||||||
use warnings; |
use warnings; |
||||||
|
|
||||||
Construct Tk::Widget 'BrowseEdit'; |
Construct Tk::Widget 'BrowseEdit'; |
||||||
|
|
||||||
sub ClassInit |
sub ClassInit |
||||||
{ |
{ |
||||||
my ($class, $mw) = @_; |
my ($class, $mw) = @_; |
||||||
$class->SUPER::ClassInit($mw); |
$class->SUPER::ClassInit($mw); |
||||||
} |
} |
||||||
|
|
||||||
sub Populate |
sub Populate |
||||||
{ |
{ |
||||||
my ($self, $args) = @_; |
my ($self, $args) = @_; |
||||||
$self->SUPER::Populate($args); |
$self->SUPER::Populate($args); |
||||||
|
$self->{panel} = $self->Frame(-borderwidth => 0)->pack(-fill => 'both'); |
||||||
$self->{panel} = $self->Frame(-borderwidth => 0)->pack(-fill => 'both'); |
$self->{text} = $self->Text->pack(-expand => 1, -fill => 'both'); |
||||||
$self->{text} = $self->Text->pack(-expand => 1, -fill => 'both'); |
$self->{'<b>'} = $self->{panel}->Button(-text => 'B', -relief => 'flat', |
||||||
|
-font => $self->Font(-family => 'times', -weight => 'bold', -size => '8'), |
||||||
$self->{'<b>'} = $self->{panel}->Button(-text => 'B', -relief => 'flat', |
-command => [sub { |
||||||
-font => $self->Font(-family => 'times', -weight => 'bold', -size => '8'), |
my ($self) = @_; |
||||||
-command => [sub { |
$self->toggleTag('<b>'); |
||||||
my ($self) = @_; |
}, $self] |
||||||
$self->toggleTag('<b>'); |
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
||||||
}, $self] |
$self->{text}->bind('<Control-B>', [sub { shift->{'<b>'}->invoke; }, |
||||||
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
$self]); |
||||||
$self->{text}->tagConfigure('<b>', -font => $self->Font(-family => 'times', -weight => 'bold')); |
$self->{'<i>'} = $self->{panel}->Button(-text => 'I', -relief => 'flat', |
||||||
$self->{text}->bind('<Control-B>', [sub { shift->{'<b>'}->invoke; }, $self]); |
-font => $self->Font(-family => 'times', -slant => 'italic', -size => '8'), |
||||||
|
-command => [sub { |
||||||
$self->{'<i>'} = $self->{panel}->Button(-text => 'I', -relief => 'flat', |
my ($self) = @_; |
||||||
-font => $self->Font(-family => 'times', -slant => 'italic', -size => '8'), |
$self->toggleTag('<i>'); |
||||||
-command => [sub { |
}, $self] |
||||||
my ($self) = @_; |
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
||||||
$self->toggleTag('<i>'); |
$self->bind('<Control-I>', [sub { shift->{'<b>'}->invoke; }, $self]); |
||||||
}, $self] |
$self->{'<u>'} = $self->{panel}->Button(-text => 'U', -relief => 'flat', |
||||||
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
-font => $self->Font(-family => 'times', -underline => 1, -size => '8'), |
||||||
$self->{text}->tagConfigure('<i>', -font => $self->Font(-family => 'times', -slant => 'italic')); |
-command => [sub { |
||||||
$self->bind('<Control-I>', [sub { shift->{'<b>'}->invoke; }, $self]); |
my ($self) = @_; |
||||||
|
$self->toggleTag('<u>'); |
||||||
$self->{'<u>'} = $self->{panel}->Button(-text => 'U', -relief => 'flat', |
}, $self] |
||||||
-font => $self->Font(-family => 'times', -underline => 1, -size => '8'), |
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
||||||
-command => [sub { |
$self->bind('<Control-U>', [sub { shift->{'<b>'}->invoke; }, $self]); |
||||||
my ($self) = @_; |
$self->{text}->tagConfigure('elide', -elide => 1); |
||||||
$self->toggleTag('<u>'); |
$self->ConfigSpecs( |
||||||
}, $self] |
'DEFAULT' => [$self->{text}], |
||||||
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
-background => [$self] |
||||||
$self->{text}->tagConfigure('<u>', -font => $self->Font(-family => 'times', -underline => 1)); |
); |
||||||
|
$self->Delegates( |
||||||
$self->{text}->tagConfigure('elide', -elide => 1); |
'DEFAULT' => $self->{text}, |
||||||
$self->bind('<Control-U>', [sub { shift->{'<b>'}->invoke; }, $self]); |
'to_html' => $self, |
||||||
|
); |
||||||
$self->ConfigSpecs( |
$self->after(200, [$self, "init"]); |
||||||
'DEFAULT' => [$self->{text}], |
|
||||||
-background => [$self] |
|
||||||
); |
|
||||||
|
|
||||||
$self->Delegates( |
|
||||||
'DEFAULT' => $self->{text}, |
|
||||||
'to_html' => $self, |
|
||||||
); |
|
||||||
|
|
||||||
$self->after(200, [$self, "init"]); |
|
||||||
} |
} |
||||||
|
|
||||||
sub toggleTag |
sub toggleTag |
||||||
{ |
{ |
||||||
my ($self, $tag) = @_; |
my ($self, $tag) = @_; |
||||||
|
if(!defined($self->{text}->tagRanges('sel'))) |
||||||
if(!defined($self->{text}->tagRanges('sel'))) |
{ |
||||||
{ |
# no selection - modify current position |
||||||
if(!$self->{tags}->{$tag}) |
print "starting\n"; |
||||||
{ |
my $cur_tag = ($self->{text}->tagNames('insert'))[0] || ""; |
||||||
$self->{text}->insert('insert', '%ignore%', [$tag, 'elide']); |
print "tag names gotten\n"; |
||||||
$self->{text}->tagAdd($tag, 'insert'); |
if ($cur_tag =~ /$tag/i) |
||||||
$self->{tags}->{$tag} = 1; |
{ |
||||||
$self->{$tag}->configure(-relief => 'groove'); |
# tag is defined for this range - remove it from the composite tag name and then add the resulting |
||||||
} |
# tag, creating it if necessary |
||||||
else |
return unless $cur_tag ne ""; |
||||||
{ |
$self->{text}->tagRemove($cur_tag, 'insert'); |
||||||
$self->{text}->insert('insert', '%ignore%', ['elide']); |
$cur_tag =~ s/$tag//i; |
||||||
$self->{text}->tagRemove($tag, 'insert'); |
print "creating tag\n"; |
||||||
$self->{tags}->{$tag} = 0; |
$self->create_tag($cur_tag); |
||||||
$self->{$tag}->configure(-relief => 'flat'); |
print "tag created\n"; |
||||||
} |
$self->insert('insert', '%%%ignore%%%', [$cur_tag, 'elide']); |
||||||
} |
$self->tagAdd($cur_tag, 'insert'); |
||||||
else |
$self->{$tag}->configure(-relief => 'flat'); |
||||||
{ |
} |
||||||
my ($selstart, $selend) = $self->{text}->tagRanges('sel'); |
else |
||||||
my @tags = $self->{text}->tagRanges($tag); |
{ |
||||||
my (@starts, @ends); |
# tag not enabled for this range - add it |
||||||
|
$self->{text}->tagRemove($cur_tag, 'insert'); |
||||||
for(my $i = 0; $i < @tags; $i += 2) |
$cur_tag .= $tag; |
||||||
{ |
$self->create_tag($cur_tag); |
||||||
push @starts, $tags[$i]; |
$self->insert('insert', '%%%ignore%%%', [$cur_tag, 'elide']); |
||||||
push @ends, $tags[$i + 1]; |
$self->tagAdd($cur_tag, 'insert'); |
||||||
} |
$self->{$tag}->configure(-relief => 'sunken'); |
||||||
|
} |
||||||
for my $start (@starts) |
} |
||||||
{ |
else |
||||||
for my $end (@ends) |
{ |
||||||
{ |
my ($selstart, $selend) = $self->{text}->tagRanges('sel'); |
||||||
if($selstart >= $start and $selend <= $end) |
my @tags = $self->{text}->tagRanges($tag); |
||||||
{ |
my (@starts, @ends); |
||||||
$self->{text}->tagRemove($tag, $self->{text}->tagRanges('sel')); |
for(my $i = 0; $i < @tags; $i += 2) |
||||||
$self->{$tag}->configure(-relief => 'raised'); |
{ |
||||||
return; |
push @starts, $tags[$i]; |
||||||
} |
push @ends, $tags[$i + 1]; |
||||||
} |
} |
||||||
} |
for my $start (@starts) |
||||||
|
{ |
||||||
$self->{text}->tagAdd($tag, $self->{text}->tagRanges('sel')); |
for my $end (@ends) |
||||||
$self->{$tag}->configure(-relief => 'sunken'); |
{ |
||||||
} |
if($selstart >= $start and $selend <= $end) |
||||||
|
{ |
||||||
|
$self->{text}->tagRemove($tag, $self->{text}->tagRanges('sel')); |
||||||
|
$self->{$tag}->configure(-relief => 'flat'); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
$self->{text}->tagAdd($tag, $self->{text}->tagRanges('sel')); |
||||||
|
$self->{$tag}->configure(-relief => 'sunken'); |
||||||
|
} |
||||||
|
} |
||||||
|
sub create_tag |
||||||
|
{ |
||||||
|
my ($self, $tag) = @_; |
||||||
|
return if $self->{created_tags}->{$tag}; |
||||||
|
my (%tagparams, %fontparams); |
||||||
|
if($tag =~ /<u>/) |
||||||
|
{ |
||||||
|
$fontparams{-underline} = 1; |
||||||
|
} |
||||||
|
if($tag =~ /<b>/) |
||||||
|
{ |
||||||
|
$fontparams{-weight} = 'bold'; |
||||||
|
} |
||||||
|
if($tag =~ /<i>/) |
||||||
|
{ |
||||||
|
$fontparams{-slant} = 'italic'; |
||||||
|
} |
||||||
|
$self->tagConfigure($tag, %tagparams, -font => $self->Font(%fontparams)); |
||||||
} |
} |
||||||
|
|
||||||
sub to_html |
sub to_html |
||||||
{ |
{ |
||||||
my ($self, $start, $end) = @_; |
my ($self, $start, $end) = @_; |
||||||
|
$start ||= '0.0'; |
||||||
$start ||= '0.0'; |
$end ||= 'end'; |
||||||
$end ||= 'end'; |
my @tags = $self->{text}->tagNames; |
||||||
|
my $res; |
||||||
my @tags = $self->{text}->tagNames; |
my $pos = '1.0'; |
||||||
|
my $chars; |
||||||
my $res; |
my %curtags; |
||||||
|
my %chartags; |
||||||
my $pos = '1.0'; |
my (@addtags, @deltags); |
||||||
my $chars; |
while($self->{text}->index($pos) != $self->{text}->index('end')) |
||||||
my %curtags; |
{ |
||||||
my %chartags; |
%chartags = (); |
||||||
my (@addtags, @deltags); |
$chartags{$_} = 1 for $self->{text}->tagNames($pos); |
||||||
|
delete $chartags{'elide'}; |
||||||
while($self->{text}->index($pos) != $self->{text}->index('end')) |
delete $chartags{'sel'}; |
||||||
{ |
for (keys %chartags) |
||||||
%chartags = (); |
{ |
||||||
$chartags{$_} = 1 for $self->{text}->tagNames($pos); |
push @addtags, $_ unless $curtags{$_} |
||||||
delete $chartags{'elide'}; |
} |
||||||
delete $chartags{'sel'}; |
for (keys %curtags) |
||||||
|
{ |
||||||
|
push @deltags, $_ if !$chartags{$_}; |
||||||
for (keys %chartags) |
} |
||||||
{ |
%curtags = (); |
||||||
push @addtags, $_ unless $curtags{$_} |
$curtags{$_} = 1 for keys %chartags; |
||||||
} |
$res .= $_ for @addtags; |
||||||
|
$res .= end_tag($_) for @deltags; |
||||||
for (keys %curtags) |
@deltags = @addtags = (); |
||||||
{ |
$res .= $self->{text}->get($pos); |
||||||
push @deltags, $_ if !$chartags{$_}; |
$pos = $self->{text}->index('0.0 + ' . ++$chars . " chars"); |
||||||
} |
} |
||||||
|
$res =~ s/\%*ignore\%*//g; |
||||||
%curtags = (); |
return $res; |
||||||
$curtags{$_} = 1 for keys %chartags; |
|
||||||
|
|
||||||
$res .= $_ for @addtags; |
|
||||||
$res .= end_tag($_) for @deltags; |
|
||||||
|
|
||||||
@deltags = @addtags = (); |
|
||||||
|
|
||||||
$res .= $self->{text}->get($pos); |
|
||||||
$pos = $self->{text}->index('0.0 + ' . ++$chars . " chars"); |
|
||||||
} |
|
||||||
|
|
||||||
return $res; |
|
||||||
} |
} |
||||||
|
|
||||||
sub end_tag |
sub end_tag |
||||||
{ |
{ |
||||||
my ($tag) = @_; |
my ($tag) = @_; |
||||||
$tag =~ s/^</<\//; |
$tag =~ s/^</<\//; |
||||||
return $tag; |
return $tag; |
||||||
} |
} |
||||||
|
|
||||||
sub init |
sub init |
||||||
{ |
{ |
||||||
my ($self) = @_; |
my ($self) = @_; |
||||||
} |
} |
||||||
|
|
||||||
1; |
1; |
||||||
|
Loading…
Reference in new issue