Changeset 11089

Show
Ignore:
Timestamp:
03/13/10 00:33:54 (6 months ago)
Author:
adamk
Message:

Dumping display geometry works

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/Padre/lib/Padre/Plugin/Devel.pm

    r10997 r11089  
    6767                Wx::gettext('Dump Current PPI Tree') => 'dump_ppi', 
    6868                Wx::gettext('Dump %INC and @INC')    => 'dump_inc', 
    69                 Wx::gettext('Dump Display Data')    => 'dump_display', 
     69                Wx::gettext('Dump Display Geometry') => 'dump_display', 
    7070                Wx::gettext('Start/Stop sub trace')  => 'trace_sub_startstop', 
    7171 
     
    132132} 
    133133 
    134  
    135134sub dump_document { 
    136135        my $self     = shift; 
     
    183182sub dump_display { 
    184183        my $self     = shift; 
    185         my $count    = Wx::Display->GetCount; 
    186184        my @displays = (); 
    187         foreach ( 0 .. $count ) { 
    188                 my $display = Wx::Display->new($_); 
     185 
     186        # Due to the way it is mapped into Wx.pm 
     187        # this must NOT be called as a method. 
     188        my $count = Wx::Display::GetCount(); 
     189 
     190        foreach ( 0 .. $count - 1 ) { 
     191                my $display  = Wx::Display->new($_); 
    189192                push @displays, 
    190193                        { 
    191194                        IsPrimary     => $display->IsPrimary, 
    192                         GetGeometry   => $display->GetGeometry, 
    193                         GetClientArea => $display->GetClientArea, 
     195                        GetGeometry   => $self->_rect($display->GetGeometry), 
     196                        GetClientArea => $self->_rect($display->GetClientArea), 
    194197                        }; 
    195198        } 
    196199        $self->_dump( 
    197                 {   GetCount    => $count, 
     200                {  GetCount    => $count, 
    198201                        DisplayList => \@displays, 
    199202                } 
    200203        ); 
     204} 
     205 
     206sub _rect { 
     207        my $self = shift; 
     208        my $rect = shift; 
     209        my %hash = map { 
     210                $_ => $rect->$_() 
     211        } qw{ 
     212                GetTop 
     213                GetBottom 
     214                GetLeft 
     215                GetRight 
     216                GetHeight 
     217                GetWidth 
     218        }; 
     219        $hash{wx} = $rect; 
     220        return \%hash; 
    201221} 
    202222