vfmg (DEVEL): vfmg - use recurrency for $level (tabs)

sparky sparky at pld-linux.org
Wed Nov 2 00:32:17 CET 2005


Author: sparky                       Date: Tue Nov  1 23:32:16 2005 GMT
Module: vfmg                          Tag: DEVEL
---- Log message:
- use recurrency for $level (tabs)

---- Files affected:
vfmg:
   vfmg (1.73.2.24 -> 1.73.2.25) 

---- Diffs:

================================================================
Index: vfmg/vfmg
diff -u vfmg/vfmg:1.73.2.24 vfmg/vfmg:1.73.2.25
--- vfmg/vfmg:1.73.2.24	Tue Nov  1 21:34:56 2005
+++ vfmg/vfmg	Wed Nov  2 00:32:11 2005
@@ -452,7 +452,6 @@
 my $parent="";
 my $dirfile;
 my $dir;
-my $icon_dir;
 my $include;
 my $tmpapps;
 my @menustack;
@@ -809,7 +808,8 @@
 use constant ICON		=> 2;
 use constant EXEC		=> 3;
 
-$level="";
+use constant step		=> "\t";
+
 sub cmpdname {
 	return lc($desktop{$a}[1]) cmp lc($desktop{$b}[1]);
 }
@@ -854,7 +854,7 @@
 				"-set-generic",$name);
 			
 			print "..DONE\n";
-			DR17($menu[$no]{$entry},$subdir,$tab."\t",$dr);
+			DR17($menu[$no]{$entry},$subdir,$tab.step,$dr);
 			$sort++;
 		}
 	}
@@ -864,7 +864,7 @@
 } # }}}
 
 sub icewm { # {{{
-	my $no=$_[0];
+	my ($no, $level)=@_;
 	my $apps="";
 	foreach my $entry (sort cmpdname keys %{$menu[$no]}) {
 		my $d = $desktop{$entry};
@@ -877,9 +877,7 @@
 		} else {
 			$icon = "folder" if not length $icon and $opt{icons};
 			print qq(${level}menu "$name" "$icon" {\n);
-			$level.="	";
-			icewm($menu[$no]{$entry});
-			$level=substr($level,1);
+			icewm($menu[$no]{$entry}, $level.step);
 			print "$level}\n";
 		}
 	}
@@ -887,7 +885,7 @@
 } # }}}
 
 sub blackbox { # {{{
-	my $no=$_[0];
+	my ($no, $level)=@_;
 	my $apps="";
 	foreach my $entry (sort cmpdname keys %{$menu[$no]}) {
 		my $d = $desktop{$entry};
@@ -895,9 +893,7 @@
 			$apps .= "$level"."[exec] ($$d[LOCALENAME]) {$$d[EXEC]}\n";
 		} else {
 			print "$level"."[submenu] ($$d[LOCALENAME])\n";
-			$level.="	";
-			blackbox($menu[$no]{$entry});
-			$level=substr($level,1);
+			blackbox($menu[$no]{$entry}, $level.step);
 			print "$level\[end]\n";
 		}
 	}
@@ -905,7 +901,7 @@
 } # }}}
 
 sub wmakerold { # {{{
-	my $no=$_[0];
+	my ($no, $level)=@_;
 	my $apps="";
 	foreach my $entry (sort cmpdname keys %{$menu[$no]}) {
 		my $d = $desktop{$entry};
@@ -915,9 +911,7 @@
 			$apps .= qq($level"$name" EXEC $$d[EXEC]\n);
 		} else {
 			print qq($level"$name" MENU\n);
-			$level.="	";
-			wmakerold($menu[$no]{$entry});
-			$level=substr($level,1);
+			wmakerold($menu[$no]{$entry}, $level.step);
 			print qq($level"$name" END\n);
 		}
 	}
@@ -925,7 +919,7 @@
 } # }}}
 
 sub wmaker { # {{{
-	my ($no, $coma)=@_;
+	my ($no, $coma, $level)=@_;
 	my $apps="";
 	foreach my $entry (sort cmpdname keys %{$menu[$no]}) {
 		my $d = $desktop{$entry};
@@ -938,9 +932,7 @@
 		} else {
 			print "$coma\n",
 				qq{$level("$name"};
-			$level.="	";
-			wmaker($menu[$no]{$entry},",");
-			$level=substr($level,1);
+			wmaker($menu[$no]{$entry},",",$level.step);
 			print "\n$level)";
 		}
 	}
@@ -957,7 +949,7 @@
 	return $_;
 }
 sub xfce4 {
-	my $no=$_[0];
+	my ($no, $level)=@_;
 	my $apps="";
 	foreach my $entry (sort cmpdname keys %{$menu[$no]}) {
 		my $d = $desktop{$entry};
@@ -971,9 +963,7 @@
 			$apps .= qq(" icon="$icon"/>\n);
 		} else {
 			print qq($level<menu name="$name" icon="$icon" visible="yes">\n);
-			$level.="	";
-			xfce4($menu[$no]{$entry});
-			$level=substr($level,1);
+			xfce4($menu[$no]{$entry},$level.step);
 			print "$level</menu>\n";
 		}
 	}
@@ -1027,7 +1017,7 @@
 } # }}}
 
 sub fvwm2 { # {{{
-	my $no=$_[0];
+	my ($no, $level)=@_;
 	my $apps="";
 	foreach my $entry (sort cmpdname keys %{$menu[$no]}) {
 		my $d = $desktop{$entry};
@@ -1040,12 +1030,10 @@
 		} else {
 			my $file = $$d[FILENAME];
 			$file =~ s/\s+/_/g;
-			$level .= ".$file";
-			print qq(AddToMenu $level	"$name"	Popup $level\n);
-			print "DestroyMenu recreate $level\n\n";
-			print qq(AddToMenu $level	"$name"	Title\n);
-			fvwm2($menu[$no]{$entry});
-			$level=~s/\.$file$//;
+			print qq(AddToMenu $level.$file	"$name"	Popup $level.$file\n);
+			print "DestroyMenu recreate $level.$file\n\n";
+			print qq(AddToMenu $level.$file	"$name"	Title\n);
+			fvwm2($menu[$no]{$entry},"$level.$file");
 		}
 	}
 	print $apps."\n";
@@ -1077,7 +1065,7 @@
 } # }}}
 
 sub olvwm { # {{{
-	my $no=$_[0];
+	my ($no, $level)=@_;
 	my $apps="";
 	foreach my $entry (sort cmpdname keys %{$menu[$no]}) {
 		my $d = $desktop{$entry};
@@ -1086,9 +1074,7 @@
 			$apps .= qq($level"$name"	exec $$d[EXEC]\n);
 		} else {
 			print qq($level"$name" MENU\n);
-			$level.="	";
-			olvwm($menu[$no]{$entry});
-			$level=substr($level,1);
+			olvwm($menu[$no]{$entry},$level.step);
 			print qq($level"$name" END PIN\n);
 		}
 	}
@@ -1096,7 +1082,7 @@
 } # }}}
 
 sub qvwm { # {{{
-	my $no=$_[0];
+	my ($no, $level)=@_;
 	my $apps="";
 	foreach my $entry (sort cmpdname keys %{$menu[$no]}) {
 		my $d = $desktop{$entry};
@@ -1109,9 +1095,7 @@
 		} else {
 			print qq($level"$name" "$icon"\n),
 				"$level+\n";
-			$level.="	";
-			qvwm($menu[$no]{$entry});
-			$level=substr($level,1);
+			qvwm($menu[$no]{$entry},$level.step);
 			print "$level-\n";
 		}
 	}
@@ -1119,8 +1103,7 @@
 } # }}}
 
 sub aewm { # {{{
-	my $no=$_[0];
-	my $name;
+	my ($no, $level)=@_;
 	my $apps="";
 	foreach my $entry (sort cmpdname keys %{$menu[$no]}) {
 		my $d = $desktop{$entry};
@@ -1130,9 +1113,7 @@
 			$apps .= qq(${level}cmd "$name" "$exec"\n);
 		} else {
 			print qq(${level}menu "$name"\n);
-			$level.="	";
-			aewm($menu[$no]{$entry});
-			$level=substr($level,1);
+			aewm($menu[$no]{$entry},$level.step);
 			print "${level}end\n";
 		}
 	}
@@ -1186,7 +1167,7 @@
 } # }}}
 
 sub fbpanel { # {{{
-	my $no=$_[0];
+	my ($no, $level)=@_;
 	my $apps="";
 	foreach my $entry (sort cmpdname keys %{$menu[$no]}) {
 		my $d = $desktop{$entry};
@@ -1203,9 +1184,7 @@
 			print "${level}menu {\n";
 			print "${level}	name = $$d[LOCALENAME]\n";
 			print "${level}	image = $icon\n";
-			$level.="	";
-			fbpanel($menu[$no]{$entry});
-			$level=substr($level,1);
+			fbpanel($menu[$no]{$entry},$level.step);
 			print "${level}}\n";
 		}
 	}
@@ -1213,7 +1192,7 @@
 } # }}}
 
 sub openbox { # {{{
-	my $no=$_[0];
+	my ($no, $level)=@_;
 	my $apps="";
 	foreach my $entry (sort cmpdname keys %{$menu[$no]}) {
 		my $d = $desktop{$entry};
@@ -1226,9 +1205,7 @@
 				qq($level</item>\n);
 		} else {
 			print qq($level<menu id="$$d[LOCALENAME]" label="$$d[LOCALENAME]">\n);
-			$level.="	";
-			openbox($menu[$no]{$entry});
-			$level=substr($level,1);
+			openbox($menu[$no]{$entry},$level.step);
 			print "$level</menu>\n";
 		}
 	}
@@ -1310,24 +1287,24 @@
 	exit;
 } # }}}
 if($o_output eq "icewm") {
-	icewm($opt{strip});
+	icewm($opt{strip},"");
 	exit;
 }
 if($o_output eq "blackbox") {
 	print "[begin] (Blackbox)\n" unless $opt{nomenu};
-	blackbox($opt{strip});
+	blackbox($opt{strip},"");
 	print "[end]\n" unless $opt{nomenu};
 	exit;
 }
 if($o_output eq "wmaker-old") {
-	wmakerold($opt{strip});
+	wmakerold($opt{strip},"");
 	exit;
 }
 if($o_output eq "wmaker") {
 	if($opt{strip}) {
-		wmaker(1,",");
+		wmaker(1,",","");
 	} else {
-		wmaker(0,"");
+		wmaker(0,"","");
 	}
 	print "\n";
 	exit;
@@ -1335,8 +1312,7 @@
 if($o_output eq "xfce4") {
 	print "<xfdesktop-menu>\n";
 	print qq(<title name="Desktop Menu" visible="yes"/>\n) unless $opt{nomenu};
-	$level.="	";
-	xfce4($opt{strip});
+	xfce4($opt{strip},step);
 	print "</xfdesktop-menu>\n";
 	exit;
 }
@@ -1355,8 +1331,7 @@
 	exit;
 }
 if($o_output eq "fvwm2") {
-	$level="fvwm2";
-	fvwm2($opt{strip});
+	fvwm2($opt{strip},"fvwm2");
 	exit;
 }
 if($o_output eq "metisse") {
@@ -1364,16 +1339,16 @@
 	exit;
 }
 if($o_output eq "olvwm") {
-	olvwm($opt{strip});
+	olvwm($opt{strip},"");
 	exit;
 }
 if($o_output eq "qvwm") {
 	print "[StartMenu]\n";
-	qvwm($opt{strip});
+	qvwm($opt{strip},"");
 	exit;
 }
 if($o_output eq "aewm") {
-	aewm($opt{strip});
+	aewm($opt{strip},"");
 	exit;
 }
 if($o_output eq "enlightenment") {
@@ -1385,13 +1360,13 @@
 	exit;
 }
 if($o_output eq "fbpanel") {
-	fbpanel($opt{strip});
+	fbpanel($opt{strip},"");
 	exit;
 }
 if($o_output eq "openbox") {
 	print "<openbox_menu>\n" unless $opt{nomenu};
 	print qq(<menu id="root-menu" label="PLD Linux">\n) unless $opt{nomenu};
-	openbox($opt{strip});
+	openbox($opt{strip},"");
 	print "</menu>\n" unless $opt{nomenu};
 	print "</openbox_menu>\n" unless $opt{nomenu};
 	exit;
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/vfmg/vfmg?r1=1.73.2.24&r2=1.73.2.25&f=u




More information about the pld-cvs-commit mailing list