9 changed files with 202 additions and 167 deletions
@ -0,0 +1,15 @@
@@ -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 @@
@@ -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 @@
@@ -1,184 +1,181 @@
|
||||
package Tk::BrowseEdit; |
||||
|
||||
use Tk; |
||||
use Tk::Font; |
||||
use base 'Tk::Frame'; |
||||
|
||||
use strict; |
||||
use warnings; |
||||
|
||||
Construct Tk::Widget 'BrowseEdit'; |
||||
|
||||
sub ClassInit |
||||
{ |
||||
my ($class, $mw) = @_; |
||||
$class->SUPER::ClassInit($mw); |
||||
my ($class, $mw) = @_; |
||||
$class->SUPER::ClassInit($mw); |
||||
} |
||||
|
||||
sub Populate |
||||
{ |
||||
my ($self, $args) = @_; |
||||
$self->SUPER::Populate($args); |
||||
|
||||
$self->{panel} = $self->Frame(-borderwidth => 0)->pack(-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'), |
||||
-command => [sub { |
||||
my ($self) = @_; |
||||
$self->toggleTag('<b>'); |
||||
}, $self] |
||||
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
||||
$self->{text}->tagConfigure('<b>', -font => $self->Font(-family => 'times', -weight => 'bold')); |
||||
$self->{text}->bind('<Control-B>', [sub { shift->{'<b>'}->invoke; }, $self]); |
||||
|
||||
$self->{'<i>'} = $self->{panel}->Button(-text => 'I', -relief => 'flat', |
||||
-font => $self->Font(-family => 'times', -slant => 'italic', -size => '8'), |
||||
-command => [sub { |
||||
my ($self) = @_; |
||||
$self->toggleTag('<i>'); |
||||
}, $self] |
||||
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
||||
$self->{text}->tagConfigure('<i>', -font => $self->Font(-family => 'times', -slant => 'italic')); |
||||
$self->bind('<Control-I>', [sub { shift->{'<b>'}->invoke; }, $self]); |
||||
|
||||
$self->{'<u>'} = $self->{panel}->Button(-text => 'U', -relief => 'flat', |
||||
-font => $self->Font(-family => 'times', -underline => 1, -size => '8'), |
||||
-command => [sub { |
||||
my ($self) = @_; |
||||
$self->toggleTag('<u>'); |
||||
}, $self] |
||||
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
||||
$self->{text}->tagConfigure('<u>', -font => $self->Font(-family => 'times', -underline => 1)); |
||||
|
||||
$self->{text}->tagConfigure('elide', -elide => 1); |
||||
$self->bind('<Control-U>', [sub { shift->{'<b>'}->invoke; }, $self]); |
||||
|
||||
$self->ConfigSpecs( |
||||
'DEFAULT' => [$self->{text}], |
||||
-background => [$self] |
||||
); |
||||
|
||||
$self->Delegates( |
||||
'DEFAULT' => $self->{text}, |
||||
'to_html' => $self, |
||||
); |
||||
|
||||
$self->after(200, [$self, "init"]); |
||||
my ($self, $args) = @_; |
||||
$self->SUPER::Populate($args); |
||||
$self->{panel} = $self->Frame(-borderwidth => 0)->pack(-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'), |
||||
-command => [sub { |
||||
my ($self) = @_; |
||||
$self->toggleTag('<b>'); |
||||
}, $self] |
||||
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
||||
$self->{text}->bind('<Control-B>', [sub { shift->{'<b>'}->invoke; }, |
||||
$self]); |
||||
$self->{'<i>'} = $self->{panel}->Button(-text => 'I', -relief => 'flat', |
||||
-font => $self->Font(-family => 'times', -slant => 'italic', -size => '8'), |
||||
-command => [sub { |
||||
my ($self) = @_; |
||||
$self->toggleTag('<i>'); |
||||
}, $self] |
||||
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
||||
$self->bind('<Control-I>', [sub { shift->{'<b>'}->invoke; }, $self]); |
||||
$self->{'<u>'} = $self->{panel}->Button(-text => 'U', -relief => 'flat', |
||||
-font => $self->Font(-family => 'times', -underline => 1, -size => '8'), |
||||
-command => [sub { |
||||
my ($self) = @_; |
||||
$self->toggleTag('<u>'); |
||||
}, $self] |
||||
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
||||
$self->bind('<Control-U>', [sub { shift->{'<b>'}->invoke; }, $self]); |
||||
$self->{text}->tagConfigure('elide', -elide => 1); |
||||
$self->ConfigSpecs( |
||||
'DEFAULT' => [$self->{text}], |
||||
-background => [$self] |
||||
); |
||||
$self->Delegates( |
||||
'DEFAULT' => $self->{text}, |
||||
'to_html' => $self, |
||||
); |
||||
$self->after(200, [$self, "init"]); |
||||
} |
||||
|
||||
sub toggleTag |
||||
{ |
||||
my ($self, $tag) = @_; |
||||
|
||||
if(!defined($self->{text}->tagRanges('sel'))) |
||||
{ |
||||
if(!$self->{tags}->{$tag}) |
||||
{ |
||||
$self->{text}->insert('insert', '%ignore%', [$tag, 'elide']); |
||||
$self->{text}->tagAdd($tag, 'insert'); |
||||
$self->{tags}->{$tag} = 1; |
||||
$self->{$tag}->configure(-relief => 'groove'); |
||||
} |
||||
else |
||||
{ |
||||
$self->{text}->insert('insert', '%ignore%', ['elide']); |
||||
$self->{text}->tagRemove($tag, 'insert'); |
||||
$self->{tags}->{$tag} = 0; |
||||
$self->{$tag}->configure(-relief => 'flat'); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
my ($selstart, $selend) = $self->{text}->tagRanges('sel'); |
||||
my @tags = $self->{text}->tagRanges($tag); |
||||
my (@starts, @ends); |
||||
|
||||
for(my $i = 0; $i < @tags; $i += 2) |
||||
{ |
||||
push @starts, $tags[$i]; |
||||
push @ends, $tags[$i + 1]; |
||||
} |
||||
|
||||
for my $start (@starts) |
||||
{ |
||||
for my $end (@ends) |
||||
{ |
||||
if($selstart >= $start and $selend <= $end) |
||||
{ |
||||
$self->{text}->tagRemove($tag, $self->{text}->tagRanges('sel')); |
||||
$self->{$tag}->configure(-relief => 'raised'); |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
|
||||
$self->{text}->tagAdd($tag, $self->{text}->tagRanges('sel')); |
||||
$self->{$tag}->configure(-relief => 'sunken'); |
||||
} |
||||
my ($self, $tag) = @_; |
||||
if(!defined($self->{text}->tagRanges('sel'))) |
||||
{ |
||||
# no selection - modify current position |
||||
print "starting\n"; |
||||
my $cur_tag = ($self->{text}->tagNames('insert'))[0] || ""; |
||||
print "tag names gotten\n"; |
||||
if ($cur_tag =~ /$tag/i) |
||||
{ |
||||
# tag is defined for this range - remove it from the composite tag name and then add the resulting |
||||
# tag, creating it if necessary |
||||
return unless $cur_tag ne ""; |
||||
$self->{text}->tagRemove($cur_tag, 'insert'); |
||||
$cur_tag =~ s/$tag//i; |
||||
print "creating tag\n"; |
||||
$self->create_tag($cur_tag); |
||||
print "tag created\n"; |
||||
$self->insert('insert', '%%%ignore%%%', [$cur_tag, 'elide']); |
||||
$self->tagAdd($cur_tag, 'insert'); |
||||
$self->{$tag}->configure(-relief => 'flat'); |
||||
} |
||||
else |
||||
{ |
||||
# tag not enabled for this range - add it |
||||
$self->{text}->tagRemove($cur_tag, 'insert'); |
||||
$cur_tag .= $tag; |
||||
$self->create_tag($cur_tag); |
||||
$self->insert('insert', '%%%ignore%%%', [$cur_tag, 'elide']); |
||||
$self->tagAdd($cur_tag, 'insert'); |
||||
$self->{$tag}->configure(-relief => 'sunken'); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
my ($selstart, $selend) = $self->{text}->tagRanges('sel'); |
||||
my @tags = $self->{text}->tagRanges($tag); |
||||
my (@starts, @ends); |
||||
for(my $i = 0; $i < @tags; $i += 2) |
||||
{ |
||||
push @starts, $tags[$i]; |
||||
push @ends, $tags[$i + 1]; |
||||
} |
||||
for my $start (@starts) |
||||
{ |
||||
for my $end (@ends) |
||||
{ |
||||
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 |
||||
{ |
||||
my ($self, $start, $end) = @_; |
||||
|
||||
$start ||= '0.0'; |
||||
$end ||= 'end'; |
||||
|
||||
my @tags = $self->{text}->tagNames; |
||||
|
||||
my $res; |
||||
|
||||
my $pos = '1.0'; |
||||
my $chars; |
||||
my %curtags; |
||||
my %chartags; |
||||
my (@addtags, @deltags); |
||||
|
||||
while($self->{text}->index($pos) != $self->{text}->index('end')) |
||||
{ |
||||
%chartags = (); |
||||
$chartags{$_} = 1 for $self->{text}->tagNames($pos); |
||||
delete $chartags{'elide'}; |
||||
delete $chartags{'sel'}; |
||||
|
||||
|
||||
for (keys %chartags) |
||||
{ |
||||
push @addtags, $_ unless $curtags{$_} |
||||
} |
||||
|
||||
for (keys %curtags) |
||||
{ |
||||
push @deltags, $_ if !$chartags{$_}; |
||||
} |
||||
|
||||
%curtags = (); |
||||
$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; |
||||
my ($self, $start, $end) = @_; |
||||
$start ||= '0.0'; |
||||
$end ||= 'end'; |
||||
my @tags = $self->{text}->tagNames; |
||||
my $res; |
||||
my $pos = '1.0'; |
||||
my $chars; |
||||
my %curtags; |
||||
my %chartags; |
||||
my (@addtags, @deltags); |
||||
while($self->{text}->index($pos) != $self->{text}->index('end')) |
||||
{ |
||||
%chartags = (); |
||||
$chartags{$_} = 1 for $self->{text}->tagNames($pos); |
||||
delete $chartags{'elide'}; |
||||
delete $chartags{'sel'}; |
||||
for (keys %chartags) |
||||
{ |
||||
push @addtags, $_ unless $curtags{$_} |
||||
} |
||||
for (keys %curtags) |
||||
{ |
||||
push @deltags, $_ if !$chartags{$_}; |
||||
} |
||||
%curtags = (); |
||||
$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"); |
||||
} |
||||
$res =~ s/\%*ignore\%*//g; |
||||
return $res; |
||||
} |
||||
|
||||
sub end_tag |
||||
{ |
||||
my ($tag) = @_; |
||||
$tag =~ s/^</<\//; |
||||
return $tag; |
||||
my ($tag) = @_; |
||||
$tag =~ s/^</<\//; |
||||
return $tag; |
||||
} |
||||
|
||||
sub init |
||||
{ |
||||
my ($self) = @_; |
||||
my ($self) = @_; |
||||
} |
||||
|
||||
1; |
||||
|
Loading…
Reference in new issue