From 9d5bf81652aff2d499b4a117e1c8beafa0593865 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 2 Dec 2004 21:14:59 +0000 Subject: replace "policy => [ horizpolicy, vertpolicy ]" with "h_policy => ..., v_policy => ..." (both defaulting to "automatic") --- perl-install/unused/migrate-ugtk2-to-mygtk2.pl | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'perl-install/unused') diff --git a/perl-install/unused/migrate-ugtk2-to-mygtk2.pl b/perl-install/unused/migrate-ugtk2-to-mygtk2.pl index 8292e8aa6..ad98b61e2 100644 --- a/perl-install/unused/migrate-ugtk2-to-mygtk2.pl +++ b/perl-install/unused/migrate-ugtk2-to-mygtk2.pl @@ -1,3 +1,5 @@ +use MDK::Common; + BEGIN { @ARGV or warn(< @@ -103,8 +105,22 @@ while ($b) { $b = 1 if s/create_hbox\((['"].*?['"])\)/gtknew('HButtonBox', layout => $1)/ || s/create_hbox\(\)/gtknew('HButtonBox')/; - $b = 1 if s/create_scrolled_window\(($re)\s*,\s*($re)\)/gtknew('ScrolledWindow', policy => $2, child => $1)/ || - s/create_scrolled_window\(($re)\)/gtknew('ScrolledWindow', child => $1)/; + if (my ($arg) = /create_scrolled_window\(($re)\)/) { + my $val; + if (my ($child, $policy) = $arg =~ /^($re)\s*,\s*($re)$/) { + if (my ($h, $v) = $policy =~ /^\[\s*($re)\s*,\s*($re)\s*\]$/) { + foreach ($h, $v) { + $_ = /never/i ? 'never' : /always/ ? 'always' : ''; + } + $val = join(', ', if_($h, "h_policy => '$h'"), if_($v, "v_policy => '$v'"), "child => $child"); + } else { + #- ??? + } + } else { + $val = "child => $arg"; + } + $b = 1 if $val && s/create_scrolled_window\($re\)/gtknew('ScrolledWindow', $val)/; + } $b = 1 if s/create_packtable\(\{($re)\},/my $s = prepost_chomp($1); "gtknew('Table', " . ($s ? "$s, " : '') . "children => ["/e; -- cgit v1.2.1