vfmg: VFMG/ASCII_out.pm (NEW) - first backend, color ASCII output

sparky sparky at pld-linux.org
Fri Dec 1 22:55:11 CET 2006


Author: sparky                       Date: Fri Dec  1 21:55:11 2006 GMT
Module: vfmg                          Tag: HEAD
---- Log message:
- first backend, color ASCII output

---- Files affected:
vfmg/VFMG:
   ASCII_out.pm (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: vfmg/VFMG/ASCII_out.pm
diff -u /dev/null vfmg/VFMG/ASCII_out.pm:1.1
--- /dev/null	Fri Dec  1 22:55:11 2006
+++ vfmg/VFMG/ASCII_out.pm	Fri Dec  1 22:55:06 2006
@@ -0,0 +1,52 @@
+package VFMG::Output;
+
+use strict;
+use warnings;
+
+sub ASCII {
+	my ($no, $level, $cnum)=@_;
+	my $cnext = $cnum + 1;
+	my @apps;
+	my @tmp = ();
+	@tmp = %{$main::menu[$no]} if defined %{$main::menu[$no]};
+	my $all = ($#tmp + 1) / 2;
+	my $num = 0;
+	foreach my $entry (sort main::cmpdname keys %{$main::menu[$no]}) {
+		my $d = $main::desktop[$entry];
+		$num++;
+		if($main::menu[$no]{$entry} < 0) {
+			push @apps, $d;
+		} else {
+			my $step = " \033[${cnum}m\033(0\017x\033(B\033[0m ";
+			if ($num >= $all and ( $#apps < 0 )) {
+				$step = "   ";
+				print "$level \033[${cnum}m\033(0mq\033(B\033[${cnext}m\033[1m[$$d{Name}]";
+			} else {
+				print "$level \033[${cnum}m\033(0tq\033(B\033[${cnext}m\033[1m[$$d{Name}]";
+			}
+			print " ($$d{GenericName})" if $$d{GenericName};
+			print " [$$d{Comment}]" if $$d{Comment};
+			print "\033[0m\n";
+			ASCII($main::menu[$no]{$entry},$level.$step, $cnext);
+		}
+	}
+	$num = 0;
+	foreach my $d (@apps) {
+		if ($num >= $#apps) {
+			print "$level \033[${cnum}m\033(0\017mq\033(B\033[${cnext}m$$d{Name}";
+		} else {
+			print "$level \033[${cnum}m\033(0\017tq\033(B\033[${cnext}m$$d{Name}";
+		}
+		print " ($$d{GenericName})" if $$d{GenericName};
+		print " [$$d{Comment}]" if $$d{Comment};
+		print "\033[0m\n";
+		$num++;
+	}
+}
+
+sub do_menu() {
+	print "\n\033[31m\033[1m[Menu]\033[0m\n";
+	ASCII($main::opt{strip},"", 31);
+}
+
+1;
================================================================


More information about the pld-cvs-commit mailing list