<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package HTMLProjectCreator;

# ************************************************************
# Description   : An HTML project creator to display all settings
# Author        : Justin Michel &amp; Chad Elliott
# Create Date   : 8/25/2003
# ************************************************************

# ************************************************************
# Pragmas
# ************************************************************

use strict;
use File::Basename;

use ProjectCreator;

use vars qw(@ISA);
@ISA = qw(ProjectCreator);

# ************************************************************
# Data Section
# ************************************************************

my($style_indent) = .5;

# ************************************************************
# Subroutine Section
# ************************************************************

sub file_sorter {
  my($self)  = shift;
  my($left)  = shift;
  my($right) = shift;
  return lc($left) cmp lc($right);
}


sub convert_slashes {
  #my($self) = shift;
  return 0;
}


sub label_nodes {
  my($self)  = shift;
  my($hash)  = shift;
  my($nodes) = shift;
  my($level) = shift;

  foreach my $key (sort keys %$hash) {
    push(@$nodes, [$level, $key]);
    $self-&gt;label_nodes($$hash{$key}, $nodes, $level + 1);
  }
}


sub count_levels {
  my($self)    = shift;
  my($hash)    = shift;
  my($current) = shift;
  my($count)   = shift;

  foreach my $key (keys %$hash) {
    $self-&gt;count_levels($$hash{$key}, $current + 1, $count);
  }
  if ($current &gt; $$count) {
    $$count = $current;
  }
}


sub fill_value {
  my($self)  = shift;
  my($name)  = shift;
  my($value) = undef;

  if ($name eq 'inheritance_nodes') {
    ## Get the nodes with numeric labels for the level
    my(@nodes) = ();
    $self-&gt;label_nodes($self-&gt;get_inheritance_tree(), \@nodes, 0);

    ## Push each node onto the value array
    $value = [];
    for(my $i = 0; $i &lt;= $#nodes; ++$i) {
      my($file) = $nodes[$i]-&gt;[1];
      my($dir)  = dirname($file);
      my($base) = basename($file);

      ## Relative paths do not work at all in a web browser
      if ($dir eq '.') {
        $file = $base;
      }

      my($path) = ($base eq $file ? $self-&gt;getcwd() . '/' : '');
      my($name) = undef;

      if ($i == 0) {
        ## If this is the first node, then replace the base filename
        ## with the actual project name.
        $name = $self-&gt;project_name();
      }
      else {
        ## This is a base project, so we use the basename and
        ## remove the file extension.
        $name = $base;
        $name =~ s/\.[^\.]+$//;
      }

      ## Create the div and a tags.
      push(@$value, '&lt;a href="file://' . $path . $file .
                    '" onClick="return popup(this, \'Project File\')" ' .
                    'target=_blank&gt;' .
                    '&lt;div class="tree' . $nodes[$i]-&gt;[0] . '"&gt;' .
                     $name . '&lt;/div&gt;&lt;/a&gt;');
    }
  }
  elsif ($name eq 'tree_styles') {
    ## Count the number of levels deep the inheritance goes
    my($count) = 0;
    $self-&gt;count_levels($self-&gt;get_inheritance_tree(), 0, \$count);

    my($margin) = 0;
    my($start)  = 100;
    my($max)    = 255;
    my($inc)    = ($count ne 0 ? int(($max - $start) / $count) : $max);

    ## Push each tree style onto the value array
    $value = [];
    for(my $i = 0; $i &lt; $count; ++$i) {
      push(@$value, ".tree$i { background-color: #" .
                    sprintf("%02x%02x%02x", 0, $start, $start) . ';' .
                    ($margin != 0 ? " margin-left: $margin" . 'in;' : '') .
                    ' }');
      $start += $inc;
      $margin += $style_indent;
    }
  }

  return $value;
}


sub project_file_name {
  my($self) = shift;
  my($name) = shift;

  if (!defined $name) {
    $name = $self-&gt;project_name();
  }

  return "$name.html";
}


sub get_template {
  #my($self) = shift;
  return 'html';
}


1;
</pre></body></html>