|
|
@ -2,6 +2,7 @@ package Tk::BrowseEdit; |
|
|
|
|
|
|
|
|
|
|
|
use Tk; |
|
|
|
use Tk; |
|
|
|
use Tk::Font; |
|
|
|
use Tk::Font; |
|
|
|
|
|
|
|
use Tk::ColorChoice; |
|
|
|
use base 'Tk::Frame'; |
|
|
|
use base 'Tk::Frame'; |
|
|
|
|
|
|
|
|
|
|
|
use strict; |
|
|
|
use strict; |
|
|
@ -49,13 +50,12 @@ $self]); |
|
|
|
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
|
|
|
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
|
|
|
$self->bind('<Control-U>', [sub { shift->{'<b>'}->invoke; }, $self]); |
|
|
|
$self->bind('<Control-U>', [sub { shift->{'<b>'}->invoke; }, $self]); |
|
|
|
|
|
|
|
|
|
|
|
$self->{'<back>'} = $self->{panel}->Button(-text => 'U', -relief => 'flat', -background => 'green', |
|
|
|
$self->{'<back>'} = $self->{panel}->Button(-text => 'A', -relief => 'flat', -background => 'blue', |
|
|
|
-font => $self->Font(-family => 'times', -size => '8'), |
|
|
|
-font => $self->Font(-family => 'times', -size => '8'), |
|
|
|
-command => [sub { |
|
|
|
-command => [sub { |
|
|
|
my ($self) = @_; |
|
|
|
my ($self) = @_; |
|
|
|
my $color = $self->chooseColor( |
|
|
|
my $color = $self->pick_color; |
|
|
|
-initialcolor => 'black', -parent => $self, |
|
|
|
|
|
|
|
-title => 'Choose Background Color'); |
|
|
|
|
|
|
|
$self->toggleTag("<font back=\"$color\">", '<back>'); |
|
|
|
$self->toggleTag("<font back=\"$color\">", '<back>'); |
|
|
|
}, $self] |
|
|
|
}, $self] |
|
|
|
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
|
|
|
)->pack(-pady => 0, -side => 'left', -fill => 'both'); |
|
|
@ -169,6 +169,10 @@ sub create_tag |
|
|
|
{ |
|
|
|
{ |
|
|
|
$fontparams{-slant} = 'italic'; |
|
|
|
$fontparams{-slant} = 'italic'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if($tag =~ /<font back='(.*?)'>/) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$fontparams{-slant} = 'italic'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
my $font = $self->Font(%fontparams); |
|
|
|
my $font = $self->Font(%fontparams); |
|
|
|
$self->tagConfigure($tag, %tagparams, -font => $font); |
|
|
|
$self->tagConfigure($tag, %tagparams, -font => $font); |
|
|
@ -218,4 +222,17 @@ sub end_tag |
|
|
|
return $tag; |
|
|
|
return $tag; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub pick_color |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
my ($self) = @_; |
|
|
|
|
|
|
|
my $dlg = $self->Parent->DialogBox(-title => 'Choose Color', -buttons => |
|
|
|
|
|
|
|
['OK', 'Cancel'], -default_button => 'OK'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$dlg->ColorChoice->pack; |
|
|
|
|
|
|
|
my $res = $dlg->Show(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return unless $res eq "OK"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
1; |
|
|
|
1; |
|
|
|