Changeset 467


Ignore:
Timestamp:
10/26/08 00:16:48 (3 years ago)
Author:
szabgab
Message:

stop importing Wx directly in the Padre::Wx:: modules

Location:
trunk/lib/Padre
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Padre/Wx.pm

    r461 r467  
    1414# use them without braces. 
    1515use Wx ':everything'; 
    16  
     16# the same with events in the Wx::Event:: package 
     17use Wx::Event ':everything'; 
    1718our $VERSION = '0.12'; 
    1819 
  • trunk/lib/Padre/Wx/Ack.pm

    r451 r467  
    33use strict; 
    44use warnings; 
    5 use Wx                      qw(:everything); 
    6 use Wx::Event               qw(:everything); 
    7 use Padre::Wx::Ack; 
     5use Data::Dumper            qw(Dumper); 
     6 
    87use App::Ack; 
    9 use Data::Dumper            qw(Dumper); 
     8 
     9use Padre::Wx; 
    1010 
    1111my $iter; 
     
    4747    $self->show_output(1); 
    4848 
    49     EVT_COMMAND( $self, -1, $DONE_EVENT, \&ack_done ); 
     49    Wx::Event::EVT_COMMAND( $self, -1, $DONE_EVENT, \&ack_done ); 
    5050 
    5151    my $worker = threads->create( \&on_ack_thread ); 
     
    5959    my $id     = -1; 
    6060    my $title  = "Ack"; 
    61     my $pos    = wxDefaultPosition; 
    62     my $size   = wxDefaultSize; 
     61    my $pos    = Wx::wxDefaultPosition; 
     62    my $size   = Wx::wxDefaultSize; 
    6363    my $name   = ""; 
    64     my $style = wxDEFAULT_FRAME_STYLE; 
     64    my $style = Wx::wxDEFAULT_FRAME_STYLE; 
    6565 
    6666    my $dialog        = Wx::Dialog->new( $win, $id, $title, $pos, $size, $style, $name ); 
    67     my $label_1       = Wx::StaticText->new($dialog, -1, "Term: ", wxDefaultPosition, wxDefaultSize, ); 
    68     my $term          = Wx::ComboBox->new($dialog, -1, "", wxDefaultPosition, wxDefaultSize, [], wxCB_DROPDOWN); 
    69     my $button_search = Wx::Button->new($dialog, wxID_FIND, ''); 
    70     my $label_2       = Wx::StaticText->new($dialog, -1, "Dir: ", wxDefaultPosition, wxDefaultSize, ); 
    71     my $dir           = Wx::ComboBox->new($dialog, -1, "", wxDefaultPosition, wxDefaultSize, [], wxCB_DROPDOWN); 
    72     my $button_cancel = Wx::Button->new($dialog, wxID_CANCEL, ''); 
    73     my $nothing_1     = Wx::StaticText->new($dialog, -1, "", wxDefaultPosition, wxDefaultSize, ); 
    74     my $nothing_2     = Wx::StaticText->new($dialog, -1, "", wxDefaultPosition, wxDefaultSize, ); 
     67    my $label_1       = Wx::StaticText->new($dialog, -1, "Term: ", Wx::wxDefaultPosition, Wx::wxDefaultSize, ); 
     68    my $term          = Wx::ComboBox->new($dialog, -1, "", Wx::wxDefaultPosition, Wx::wxDefaultSize, [], Wx::wxCB_DROPDOWN); 
     69    my $button_search = Wx::Button->new($dialog, Wx::wxID_FIND, ''); 
     70    my $label_2       = Wx::StaticText->new($dialog, -1, "Dir: ", Wx::wxDefaultPosition, Wx::wxDefaultSize, ); 
     71    my $dir           = Wx::ComboBox->new($dialog, -1, "", Wx::wxDefaultPosition, Wx::wxDefaultSize, [], Wx::wxCB_DROPDOWN); 
     72    my $button_cancel = Wx::Button->new($dialog, Wx::wxID_CANCEL, ''); 
     73    my $nothing_1     = Wx::StaticText->new($dialog, -1, "", Wx::wxDefaultPosition, Wx::wxDefaultSize, ); 
     74    my $nothing_2     = Wx::StaticText->new($dialog, -1, "", Wx::wxDefaultPosition, Wx::wxDefaultSize, ); 
    7575    my $button_dir    = Wx::Button->new($dialog, -1, "Pick &directory"); 
    7676 
    77     EVT_BUTTON( $dialog, $button_search, sub { $dialog->EndModal(wxID_FIND) } ); 
    78     EVT_BUTTON( $dialog, $button_dir,    sub { on_pick_dir($dir, @_) } ); 
    79     EVT_BUTTON( $dialog, $button_cancel, sub { $dialog->EndModal(wxID_CANCEL) } ); 
     77    Wx::Event::EVT_BUTTON( $dialog, $button_search, sub { $dialog->EndModal(Wx::wxID_FIND) } ); 
     78    Wx::Event::EVT_BUTTON( $dialog, $button_dir,    sub { on_pick_dir($dir, @_) } ); 
     79    Wx::Event::EVT_BUTTON( $dialog, $button_cancel, sub { $dialog->EndModal(Wx::wxID_CANCEL) } ); 
    8080 
    8181    #$dialog->SetTitle("frame_1"); 
     
    8585 
    8686    # layout 
    87     my $sizer_1 = Wx::BoxSizer->new(wxVERTICAL); 
     87    my $sizer_1 = Wx::BoxSizer->new(Wx::wxVERTICAL); 
    8888    my $grid_sizer_1 = Wx::GridSizer->new(4, 3, 0, 0); 
    8989    $grid_sizer_1->Add($label_1, 0, 0, 0); 
     
    9797    $grid_sizer_1->Add($button_cancel, 0, 0, 0); 
    9898 
    99     $sizer_1->Add($grid_sizer_1, 1, wxEXPAND, 0); 
     99    $sizer_1->Add($grid_sizer_1, 1, Wx::wxEXPAND, 0); 
    100100 
    101101    $dialog->SetSizer($sizer_1); 
     
    106106    my $ret = $dialog->ShowModal; 
    107107 
    108     if ($ret == wxID_CANCEL) { 
     108    if ($ret == Wx::wxID_CANCEL) { 
    109109         $dialog->Destroy; 
    110110        return; 
     
    123123 
    124124    my $dir_dialog = Wx::DirDialog->new( $self, "Select directory", ''); 
    125     if ($dir_dialog->ShowModal == wxID_CANCEL) { 
     125    if ($dir_dialog->ShowModal == Wx::wxID_CANCEL) { 
    126126        return; 
    127127    } 
  • trunk/lib/Padre/Wx/App.pm

    r433 r467  
    2626use strict; 
    2727use warnings; 
     28 
    2829use Wx::App (); 
    2930use Padre::Wx::MainWindow (); 
  • trunk/lib/Padre/Wx/Bookmarks.pm

    r433 r467  
    33use strict; 
    44use warnings; 
    5 use Wx           qw(wxID_OK wxID_CANCEL wxID_DELETE wxVERTICAL wxHORIZONTAL); 
    6 use Wx::Event    qw(EVT_BUTTON); 
     5 
    76use List::Util   qw(max); 
    87use Data::Dumper qw(Dumper); 
     8 
     9use Padre::Wx; 
    910 
    1011our $VERSION = '0.12'; 
     
    1516    my ($self, $text) = @_; 
    1617 
    17     my $box  = Wx::BoxSizer->new( wxVERTICAL ); 
     18    my $box  = Wx::BoxSizer->new( Wx::wxVERTICAL ); 
    1819    my @rows; 
    1920    for my $i (0..3) { 
    20         $rows[$i] = Wx::BoxSizer->new( wxHORIZONTAL ); 
     21        $rows[$i] = Wx::BoxSizer->new( Wx::wxHORIZONTAL ); 
    2122        $box->Add($rows[$i]); 
    2223    } 
     
    2627 
    2728 
    28     my $ok = Wx::Button->new( $dialog, wxID_OK, '' ); 
    29     EVT_BUTTON( $dialog, $ok, sub { $dialog->EndModal(wxID_OK) } ); 
     29    my $ok = Wx::Button->new( $dialog, Wx::wxID_OK, '' ); 
     30    Wx::Event::EVT_BUTTON( $dialog, $ok, sub { $dialog->EndModal(Wx::wxID_OK) } ); 
    3031    $ok->SetDefault; 
    3132 
    32     my $cancel  = Wx::Button->new( $dialog, wxID_CANCEL, '', [-1, -1], $ok->GetSize); 
    33     EVT_BUTTON( $dialog, $cancel,  sub { $dialog->EndModal(wxID_CANCEL) } ); 
     33    my $cancel  = Wx::Button->new( $dialog, Wx::wxID_CANCEL, '', [-1, -1], $ok->GetSize); 
     34    Wx::Event::EVT_BUTTON( $dialog, $cancel,  sub { $dialog->EndModal(Wx::wxID_CANCEL) } ); 
    3435 
    3536 
     
    5859 
    5960    my $ret = $dialog->ShowModal; 
    60     if ( $ret eq wxID_CANCEL ) { 
     61    if ( $ret eq Wx::wxID_CANCEL ) { 
    6162        $dialog->Destroy; 
    6263        return; 
     
    9596        $rows->[2]->Add( $tb ); 
    9697 
    97         my $delete  = Wx::Button->new( $dialog, wxID_DELETE, '', [-1, -1], $button_size ); 
    98         EVT_BUTTON( $dialog, $delete,  \&on_delete_bookmark ); 
     98        my $delete  = Wx::Button->new( $dialog, Wx::wxID_DELETE, '', [-1, -1], $button_size ); 
     99        Wx::Event::EVT_BUTTON( $dialog, $delete,  \&on_delete_bookmark ); 
    99100        $rows->[3]->Add( $delete ); 
    100101    } 
  • trunk/lib/Padre/Wx/Editor.pm

    r433 r467  
    1010use base 'Wx::StyledTextCtrl'; 
    1111 
    12 use Wx   qw( wxTELETYPE wxNORMAL wxSTC_STYLE_DEFAULT wxSTC_H_TAG wxLayout_LeftToRight ); 
     12use Padre::Wx; 
     13 
    1314sub new { 
    1415    my( $class, $parent ) = @_; 
     
    4647    my $self = shift; 
    4748 
    48     my $font = Wx::Font->new( 10, wxTELETYPE, wxNORMAL, wxNORMAL ); 
     49    my $font = Wx::Font->new( 10, Wx::wxTELETYPE, Wx::wxNORMAL, Wx::wxNORMAL ); 
    4950 
    5051    $self->SetFont( $font ); 
    5152 
    52     $self->StyleSetFont( wxSTC_STYLE_DEFAULT, $font ); 
     53    $self->StyleSetFont( Wx::wxSTC_STYLE_DEFAULT, $font ); 
    5354 
    5455    $self->StyleClearAll(); 
     
    105106        #define SCE_PL_FORMAT 42 
    106107    ); 
    107     Wx->import(keys %colors); 
    108108 
    109109    foreach my $k (keys %colors) { 
    110110        my @c = map {hex($_)} $colors{$k} =~ /(..)(..)(..)/; 
    111         $self->StyleSetForeground( $k->(), Wx::Colour->new(@c)); 
     111        my $f = 'Wx::' . $k; 
     112        $self->StyleSetForeground( $f->(), Wx::Colour->new(@c)); 
    112113    } 
    113114 
     
    116117 
    117118    # Apply tag style for selected lexer (blue) 
    118     $self->StyleSetSpec( wxSTC_H_TAG, "fore:#0000ff" ); 
     119    $self->StyleSetSpec( Wx::wxSTC_H_TAG, "fore:#0000ff" ); 
    119120 
    120121    if ( $self->can('SetLayoutDirection') ) { 
    121         $self->SetLayoutDirection( wxLayout_LeftToRight ); 
     122        $self->SetLayoutDirection( Wx::wxLayout_LeftToRight ); 
    122123    } 
    123124 
  • trunk/lib/Padre/Wx/FindDialog.pm

    r455 r467  
    77# Find and Replace widget of Padre 
    88 
    9 use Wx        qw( wxOK wxID_FIND wxID_CANCEL ); 
    10 use Wx::Event qw{ EVT_BUTTON EVT_CHECKBOX }; 
     9use Padre::Wx; 
    1110 
    1211our $VERSION = '0.12'; 
     
    3736 
    3837    foreach my $cb (@cbs) { 
    39         EVT_CHECKBOX( $dialog, $dialog->{$cb}, sub { $_[0]->{_find_choice_}->SetFocus; }); 
     38        Wx::Event::EVT_CHECKBOX( $dialog, $dialog->{$cb}, sub { $_[0]->{_find_choice_}->SetFocus; }); 
    4039    } 
    4140    $dialog->{_find_}->SetDefault; 
    42     EVT_BUTTON( $dialog, $dialog->{_find_},        \&find_clicked); 
    43     EVT_BUTTON( $dialog, $dialog->{_replace_},     \&replace_clicked     ); 
    44     EVT_BUTTON( $dialog, $dialog->{_replace_all_}, \&replace_all_clicked ); 
    45     EVT_BUTTON( $dialog, $dialog->{_cancel_},      \&cancel_clicked      ); 
     41    Wx::Event::EVT_BUTTON( $dialog, $dialog->{_find_},        \&find_clicked); 
     42    Wx::Event::EVT_BUTTON( $dialog, $dialog->{_replace_},     \&replace_clicked     ); 
     43    Wx::Event::EVT_BUTTON( $dialog, $dialog->{_replace_all_}, \&replace_all_clicked ); 
     44    Wx::Event::EVT_BUTTON( $dialog, $dialog->{_cancel_},      \&cancel_clicked      ); 
    4645 
    4746    $dialog->{_find_choice_}->SetFocus; 
Note: See TracChangeset for help on using the changeset viewer.