[LON-CAPA-cvs] cvs: loncom /homework randomlabel.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Sat, 04 Dec 2004 01:15:41 -0000
albertel Fri Dec 3 20:15:41 2004 EDT
Modified files:
/loncom/homework randomlabel.pm
Log:
- allow font size on randomlabel images to be adjusted BUG#3624
Index: loncom/homework/randomlabel.pm
diff -u loncom/homework/randomlabel.pm:1.62 loncom/homework/randomlabel.pm:1.63
--- loncom/homework/randomlabel.pm:1.62 Sat Nov 13 14:39:45 2004
+++ loncom/homework/randomlabel.pm Fri Dec 3 20:15:41 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# random labelling tool
#
-# $Id: randomlabel.pm,v 1.62 2004/11/13 19:39:45 albertel Exp $
+# $Id: randomlabel.pm,v 1.63 2004/12/04 01:15:41 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -246,11 +246,21 @@
} elsif ($target eq 'edit') {
$result.=&Apache::edit::tag_start($target,$token);
$result.=&Apache::edit::text_arg('Name:','name',$token).
- &Apache::edit::select_arg('Type:','type',['text','image'],$token).
- &Apache::edit::end_row().&Apache::edit::start_spanning_row();
+ &Apache::edit::select_arg('Type:','type',['text','image'],$token);
+ if (!defined($token->[2]{'TeXsize'})) {
+ $token->[2]{'TeXsize'}='\normalsize';
+ }
+ $result.=&Apache::edit::select_arg('TeX font size:','TeXsize',
+ ['\tiny','\scriptsize',
+ '\footnotesize','\small',
+ '\normalsize','\large','\Large',
+ '\LARGE','\huge','\Huge'],
+ $token);
+ $result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
} elsif ($target eq 'modified') {
my $constructtag=&Apache::edit::get_new_args($token,$parstack,
- $safeeval,'name','type');
+ $safeeval,'name','type',
+ 'TeXsize');
if ($constructtag) {
$result = &Apache::edit::rebuild_tag($token);
$result.=&Apache::edit::handle_insert();
@@ -316,6 +326,8 @@
my $wwidth=&Apache::lonxml::get_param('width',$parstack,$safeeval,-2);
my $wheight=&Apache::lonxml::get_param('height',$parstack,$safeeval,-2);
my $texwidth=&adjust_textwidth(&Apache::lonxml::get_param('texwidth',$parstack,$safeeval,-2,1));
+ my $TeXsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval);
+ if (!defined($TeXsize)) { $TeXsize='\\normalsize'; }
if (!$texwidth) { $texwidth=90; }
my $texheight=$texwidth*($wheight/$wwidth);
@@ -336,7 +348,7 @@
my $tcY=$texheight-$y*($texheight/$wheight);
$tcX=sprintf('%.2f',$tcX);
$tcY=sprintf('%.2f',$tcY);
- $result.='\put('.$tcX.','.$tcY.'){\normalsize \bf '.$label.'}'."\n";
+ $result.='\put('.$tcX.','.$tcY.'){'.$TeXsize.' \bf '.$label.'}'."\n";
if( $type eq 'text') {
&add_vars($gname,$i,$label,$idx_arr[$i],$value,'',$safeeval);
} elsif ( $type eq 'image') {