[xiph-cvs] cvs commit: mgm/modules/linux wireless

Monty xiphmont at xiph.org
Wed Feb 20 15:07:43 PST 2002



xiphmont    02/02/20 15:07:42

  Added:       modules/linux wireless
  Log:
  It helps to add new files before a commit.
  
  Monty

Revision  Changes    Path
1.1                  mgm/modules/linux/wireless

Index: wireless
===================================================================
# -*-Perl-*-

# instances allowed: one 

# (single instance modules would be silly to use more than one of
# anyway, so we use package local storage.  This is faster and places
# less artificial load on the machine than doing everything through
# the object hash)

package MGMmodule::wireless;
use vars qw($xpath @if @keys $active $prompt $widget $graph $lastmod);

# class init
sub module_init{
    my$this=shift;
    my$toplevel=$this->{"toplevel"};
    my$xclass=$this->{"xclass"};

    # is the helper up and running?
    if(!$MGMmodule::helperST::wi_active){
        $toplevel->optionAdd("$xclass.active",'false',21);   
    }
    $toplevel->optionAdd("$xclass.order",21,21);   
    $this;
}

# instance init
sub module_instance{
    my$this=shift;
    my$toplevel=$this->{"toplevel"};
    return undef if(defined($xpath));
    $xpath=$this->{"xpath"};

    undef at keys;
    foreach my $key (keys %MGMmodule::helperST::wi){
        push @keys, $key if(defined($MGMmodule::helperST::wi{$key}));
    }
    $active=$MGMmodule::helperST::wi_count;
    
    $prompt=' dB';

    # modify defaults
    if($active){
        my$i=0;
        foreach my $key (@keys){
            $toplevel->optionAdd("$xpath.bar.$i.label", "$key signal",21);
            $i++;
        }
        
        $toplevel->optionAdd("$xpath.scalewidadj", 100*$i,21);  # narrower
        $toplevel->optionAdd("$xpath*litbackground",'#60c060',21); 
        
        # this relies on the above defaults
        
        my($minx,$miny)=MGM::Graph::calcxysize($this,50,
                                               $prompt,$active);
        
        $toplevel->optionAdd("$xpath.minx",        $minx,21);      
        $toplevel->optionAdd("$xpath.miny",        $miny,21);      
    }
    $this;
}

ub module_place_p{
    $active;
}

# instance widget build
sub module_run{
    my$this=shift;

    $lastmod=-1;
    $graph=MGM::Graph->new($this,num=>$active,
                               prompt=>$prompt,
                               minscale=>50,
                               fixed=>1);
        
    $widget=$graph->{"widget"};        # must return the widget
}

ub module_update{ 
    my$this=shift;
    
    # don't update unless the helper has
    if($lastmod!=$MGMmodule::helperST::lastmod){
        my$time=$MGMmodule::helperST::lastmod;
        my at vals;
        my$i=0;

        foreach my $key (@keys){
            return &reconfig if(!defined($MGMmodule::helperST::wi{$key}));
            my at temp=split ' ', $MGMmodule::helperST::wi{$key};
            $vals[$i]=$temp[1];
        }
            
        $graph->set(@vals);
        return &reconfig if($active!=$MGMmodule::helperST::wi_count);

        $lastmod=$time;
    }
}

ub reconfig{
    &main::reinstance() if($widget->optionGet("reconfig","") eq 'true');
}

ub destroy{
    undef $xpath;
}

bless {};

<p><p><p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list