summaryrefslogtreecommitdiffstats
path: root/perl-install/ugtk2.pm
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-06-12 20:55:54 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-06-12 20:55:54 +0000
commitadacd16f063aa87662388e6810eed86ff659f4a0 (patch)
tree67a42aa069eed695474ee5e8d75f1e4aa329a280 /perl-install/ugtk2.pm
parent4239b13f2b4f972c37141f90a5495e70d454e4fc (diff)
downloaddrakx-backup-do-not-use-adacd16f063aa87662388e6810eed86ff659f4a0.tar
drakx-backup-do-not-use-adacd16f063aa87662388e6810eed86ff659f4a0.tar.gz
drakx-backup-do-not-use-adacd16f063aa87662388e6810eed86ff659f4a0.tar.bz2
drakx-backup-do-not-use-adacd16f063aa87662388e6810eed86ff659f4a0.tar.xz
drakx-backup-do-not-use-adacd16f063aa87662388e6810eed86ff659f4a0.zip
change a bit how strings are passed to advertising system
so that we don't specify absolute x,y positions for each paragraph, ending with overwritten text in some localizations
Diffstat (limited to 'perl-install/ugtk2.pm')
-rw-r--r--perl-install/ugtk2.pm30
1 files changed, 28 insertions, 2 deletions
diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm
index faa3f2503..bda3e7ad6 100644
--- a/perl-install/ugtk2.pm
+++ b/perl-install/ugtk2.pm
@@ -17,7 +17,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @icon_paths $force_center $force_focus
helpers => [ qw(add2notebook add_icon_path fill_tiled fill_tiled_coords get_text_coord gtkcolor gtkcreate_img
gtkcreate_pixbuf gtkfontinfo gtkset_background n_line_size set_back_pixbuf string_size
- string_width string_height) ],
+ string_width string_height wrap_paragraph) ],
create => [ qw(create_adjustment create_box_with_title create_dialog create_factory_menu create_factory_popup_menu
create_hbox create_hpaned create_menu create_notebook create_okcancel create_packtable
@@ -703,7 +703,33 @@ sub get_text_coord {
my $dh = ($height-$real_height)/2 + (string_height($widget4style, $lines[0]))/2;
@heights = map { $_ + $dh } @heights;
}
- ($width, $height, \@lines, \@widths, \@heights)
+ ($width, $height, \@lines, \@widths, \@heights);
+}
+
+sub wrap_paragraph {
+ my ($text, $widget4style, $max_width) = @_;
+
+ my ($width, @lines, @widths, @heights);
+ my $ydec;
+ foreach (@$text) {
+ if ($_ ne '') {
+ my ($width_, $height, $lines, $widths, $heights) = get_text_coord($_, $widget4style, $max_width, 0, 1, 0, 1, 0);
+ push @widths, @$widths;
+ push @heights, map { $_ + $ydec } @$heights;
+ push @lines, @$lines;
+ $width = max($width, $width_);
+ $ydec += $height + 1;
+ } else {
+ #- void line
+ my $yvoid = $ydec / @lines;
+ push @widths, 0;
+ push @heights, $yvoid;
+ push @lines, '';
+ $ydec += $yvoid;
+ }
+ }
+
+ ($width, \@lines, \@widths, \@heights);
}
sub gtkcolor {