elem=$('<img src="'+$.glue.base_url+'modules/text/text-font-size.png" alt="btn" title="drag to change font size, click to reset to default one" width="32" height="32">');
$(elem).bind('glue-menu-activate',function(e){
varobj=$(this).data('owner');
$(this).attr('title','drag to change font size ('+$(obj).css('font-size')+'), click to reset to default one');
});
$(elem).bind('mousedown',function(e){
varobj=$(this).data('owner');
// we assume px here
varorig_val=parseInt($(obj).css('font-size'));
if(isNaN(orig_val)){
orig_val=10;
}
varno_change=true;
varthat=this;
$.glue.slider(e,function(x,y){
varval=Math.floor(orig_val+y/6);
if(val<0){
val=0;
}
$(obj).css('font-size',val+'px');
$(that).attr('title','drag to change font size ('+val+'px), click to reset to default one');
elem=$('<img src="'+$.glue.base_url+'modules/text/text-font-face.png" alt="btn" title="change typeface (click to cycle through available typefaces)" width="32" height="32">');
elem=$('<img src="'+$.glue.base_url+'modules/text/text-line-height.png" alt="btn" title="change line height, click to reset to default one" width="32" height="32">');
$(elem).bind('glue-menu-activate',function(e){
// TODO (later): my px to em calculation is not working perfectly, so leave this out for now
/*
var obj = $(this).data('owner');
if ($(obj).css('line-height').substr(-2) == 'em') {
$(this).attr('title', 'change line height ('+$(obj).css('line-height')+'), click to reset to default one');
} else if ($(obj).css('line-height').substr(-2) == 'px') {
$(this).attr('title', 'change line height ('+parseFloat($(obj).css('line-height'))/parseFloat($(obj).css('font-size'))+'em), click to reset to default one');
}
*/
});
$(elem).bind('mousedown',function(e){
varobj=$(this).data('owner');
// jquery seems to always return line-height in px
if ($(obj).css('line-height').substr(-2) == 'em') {
$(that).attr('title', 'change line height ('+$(obj).css('line-height')+'), click to reset to default one');
} else if ($(obj).css('line-height').substr(-2) == 'px') {
$(that).attr('title', 'change line height ('+parseFloat($(obj).css('line-height'))/parseFloat($(obj).css('font-size'))+'em), click to reset to default one');
elem=$('<img src="'+$.glue.base_url+'modules/text/text-letter-spacing.png" alt="btn" title="change letter spacing" width="32" height="32">');
$(elem).bind('glue-menu-activate',function(e){
// TODO (later): my px to em calculation is not working perfectly, so leave this out for now
/*
var obj = $(this).data('owner');
if ($(obj).css('letter-spacing').substr(-2) == 'em') {
$(this).attr('title', 'change letter spacing ('+$(obj).css('letter-spacing')+'), click to reset to default one');
} else if ($(obj).css('letter-spacing').substr(-2) == 'px') {
$(this).attr('title', 'change letter spacing ('+parseFloat($(obj).css('letter-spacing'))/parseFloat($(obj).css('font-size'))+'em), click to reset to default one');
}
*/
});
$(elem).bind('mousedown',function(e){
varobj=$(this).data('owner');
// jquery seems to always return letter-spacing in px
if ($(obj).css('letter-spacing').substr(-2) == 'em') {
$(that).attr('title', 'change letter spacing ('+$(obj).css('letter-spacing')+'), click to reset to default one');
} else if ($(obj).css('letter-spacing').substr(-2) == 'px') {
$(that).attr('title', 'change letter spacing ('+parseFloat($(obj).css('letter-spacing'))/parseFloat($(obj).css('font-size'))+'em), click to reset to default one');
elem=$('<img src="'+$.glue.base_url+'modules/text/text-word-spacing.png" alt="btn" title="change word spacing" width="32" height="32">');
$(elem).bind('glue-menu-activate',function(e){
// TODO (later): my px to em calculation is not working perfectly, so leave this out for now
/*
var obj = $(this).data('owner');
if ($(obj).css('word-spacing').substr(-2) == 'em') {
$(this).attr('title', 'change word spacing ('+$(obj).css('word-spacing')+'), click to reset to default one');
} else if ($(obj).css('word-spacing').substr(-2) == 'px') {
$(this).attr('title', 'change word spacing ('+parseFloat($(obj).css('word-spacing'))/parseFloat($(obj).css('font-size'))+'em), click to reset to default one');
}
*/
});
$(elem).bind('mousedown',function(e){
varobj=$(this).data('owner');
// jquery seems to always return word-spacing in px
if ($(obj).css('word-spacing').substr(-2) == 'em') {
$(that).attr('title', 'change word spacing ('+$(obj).css('word-spacing')+'), click to reset to default one');
} else if ($(obj).css('word-spacing').substr(-2) == 'px') {
$(that).attr('title', 'change word spacing ('+parseFloat($(obj).css('word-spacing'))/parseFloat($(obj).css('font-size'))+'em), click to reset to default one');