SVN: vfmg/trunk/VFMG/ascii_out.pm
sparky
sparky at pld-linux.org
Fri Jan 19 21:31:39 CET 2007
Author: sparky
Date: Fri Jan 19 21:31:39 2007
New Revision: 8179
Added:
vfmg/trunk/VFMG/ascii_out.pm (contents, props changed)
Log:
- simple ascii output (no colors, no graph):
[Menu]
+-[Accessories]
| +-[Accessibility]
| | +-Dasher (Dasher Text Entry) [Predictive Text Entry]
| | `-X Magnifier (Desktop Magnifier) [Magnify parts of the screen]
| +-[Calculators]
| | +-Calculator [Perform calculations]
| | `-X Calc (Calculator) [Scientific calculator for X]
[...]
Added: vfmg/trunk/VFMG/ascii_out.pm
==============================================================================
--- (empty file)
+++ vfmg/trunk/VFMG/ascii_out.pm Fri Jan 19 21:31:39 2007
@@ -0,0 +1,59 @@
+package VFMG::Output;
+
+use strict;
+use warnings;
+
+sub decode_tags() {
+ return qw(GenericName Comment);
+}
+
+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 = " | ";
+ print "$level |\n";
+ if ($num >= $all and ( $#apps < 0 )) {
+ $step = " ";
+ print "$level `-[$$d{Name}]";
+ } else {
+ print "$level +-[$$d{Name}]";
+ }
+ print " ($$d{GenericName})" if $$d{GenericName};
+ print " [$$d{Comment}]" if $$d{Comment};
+ print "\n";
+ ASCII($main::menu[$no]{$entry},$level.$step, $cnext);
+ }
+ }
+ $num = 0;
+ foreach my $d (@apps) {
+ if ($num >= $#apps) {
+ print "$level `-$$d{Name}";
+ } else {
+ print "$level +-$$d{Name}";
+ }
+ print " ($$d{GenericName})" if $$d{GenericName};
+ print " [$$d{Comment}]" if $$d{Comment};
+ print "\n";
+ $num++;
+ }
+}
+
+sub do_menu() {
+ print "\n[Menu]\n";
+ ASCII($main::opt{strip},"", 31);
+}
+
+1;
+
+# vi: ts=4 sw=4 noet fdm=marker
More information about the pld-cvs-commit
mailing list