Changeset 10471


Ignore:
Timestamp:
02/02/10 13:41:54 (2 years ago)
Author:
azawawi
Message:

Added some code for safe keeping... i will continue it tomorrow... very sleepy :)

File:
1 edited

Legend:

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

    r10470 r10471  
    6060 
    6161    return ( 
    62         'Character Classes' => ( 
    63             '.'  => Wx::gettext('Any character except a newline'), 
    64             '\d' => Wx::gettext('Any decimal digit'), 
    65             '\D' => Wx::gettext('Any non-digit'), 
    66             '\s' => Wx::gettext('Any whitespace character'), 
    67             '\S' => Wx::gettext('Any non-whitespace character'), 
    68             '\w' => Wx::gettext('Any word character'), 
    69             '\W' => Wx::gettext('Any non-word character'), 
    70         ), 
    71         'Quantifiers' => ( 
    72             '*'     => Wx::gettext('Zero or more of the preceding block'), 
    73             '+'     => Wx::gettext('One or more of the preceding block'), 
    74             '?'     => Wx::gettext('Zero or one of the preceding block'), 
    75             '{m}'   => Wx::gettext('Exactly m of the preceding block'), 
    76             '{m,n}' => Wx::gettext('m to n of the preceding block'), 
    77         ), 
    78         'Miscellaneous' => ( 
    79             '|'   => Wx::gettext('Alternation'), 
    80             '[ ]' => 'Character set', 
    81             '^'   => 'Beginning of line', 
    82             '$'   => 'End of line', 
    83             '\b'  => 'A word boundary', 
    84             '\B'  => 'Not a word boundary', 
    85         ), 
    86         'Grouping constructs' => ( 
    87             '( )'   => Wx::gettext('A group'), 
    88             '(?: )' => 'Non-capturing group', 
    89             '(?= )' => 'Positive lookahead assertion', 
    90             '(?! )' => 'Negative lookahead assertion', 
    91             '\n'    => 'Backreference to the nth group', 
    92         ) 
     62        '01' => { 
     63            label => Wx::gettext('Character Classes'), 
     64            value => { 
     65                '.'  => Wx::gettext('Any character except a newline'), 
     66                '\d' => Wx::gettext('Any decimal digit'), 
     67                '\D' => Wx::gettext('Any non-digit'), 
     68                '\s' => Wx::gettext('Any whitespace character'), 
     69                '\S' => Wx::gettext('Any non-whitespace character'), 
     70                '\w' => Wx::gettext('Any word character'), 
     71                '\W' => Wx::gettext('Any non-word character'), 
     72            } 
     73        }, 
     74        '02' => { 
     75            label => Wx::gettext('Quantifiers'), 
     76            value => { 
     77                '*'     => Wx::gettext('Zero or more of the preceding block'), 
     78                '+'     => Wx::gettext('One or more of the preceding block'), 
     79                '?'     => Wx::gettext('Zero or one of the preceding block'), 
     80                '{m}'   => Wx::gettext('Exactly m of the preceding block'), 
     81                '{m,n}' => Wx::gettext('m to n of the preceding block'), 
     82            } 
     83        }, 
     84        '03' => { 
     85            label => Wx::gettext('Miscellaneous'), 
     86            value => { 
     87                '|'   => Wx::gettext('Alternation'), 
     88                '[ ]' => Wx::gettext('Character set'), 
     89                '^'   => Wx::gettext('Beginning of line'), 
     90                '$'   => Wx::gettext('End of line'), 
     91                '\b'  => Wx::gettext('A word boundary'), 
     92                '\B'  => Wx::gettext('Not a word boundary'), 
     93            } 
     94        }, 
     95        '04' => { 
     96            label => Wx::gettext('Grouping constructs'), 
     97            value => { 
     98                '( )'   => Wx::gettext('A group'), 
     99                '(?: )' => Wx::gettext('Non-capturing group'), 
     100                '(?= )' => Wx::gettext('Positive lookahead assertion'), 
     101                '(?! )' => Wx::gettext('Negative lookahead assertion'), 
     102                '\n'    => Wx::gettext('Backreference to the nth group'), 
     103            } 
     104        } 
    93105    ); 
    94106} 
     
    134146    } 
    135147 
     148    $self->{menu} = Wx::Menu->new; 
     149#   my %regex_syntax = $self->_regex_syntax; 
     150#   foreach my $name (keys %regex_syntax) { 
     151#       my %subgroup = $regex_syntax{$name}; 
     152#       $self->{menu}->Append( -1, $subgroup{label} ); 
     153#       $self->{menu}->AppendSeparator(); 
     154#       my $subgroup_value = $subgroup{value}; 
     155#       foreach my $name (keys %subgroup_value) { 
     156#           my $menu_item = $self->{menu}->Append( -1, $subgroup_value{$name} ); 
     157#           $self->{menu}->AppendSeparator(); 
     158#       } 
     159#   } 
     160#   Wx::Event::EVT_MENU( 
     161#       $self, 
     162#       $self->{menu}, 
     163#       sub { 
     164#       }, 
     165#   ); 
     166 
     167 
    136168    $self->{matching} = Wx::RadioButton->new( 
    137169        $self, 
     
    143175        -1, 
    144176        'Substituting', 
     177    ); 
     178 
     179    $self->{button_menu} = Wx::Button->new( 
     180        $self, 
     181        -1, 
     182        Wx::gettext('&Insert'), 
    145183    ); 
    146184 
     
    172210    $left->Add( $modifiers,   0, Wx::wxALL | Wx::wxEXPAND, 1 ); 
    173211    $left->Add( $operation,   0, Wx::wxALL | Wx::wxEXPAND, 1 ); 
     212    $left->Add( $self->{button_menu}, 0, Wx::wxALIGN_CENTER_HORIZONTAL, 1 ); 
    174213    $left->Add( $regex_label, 0, Wx::wxALL | Wx::wxEXPAND, 1 ); 
    175214    $left->Add( 
     
    212251    my $self = shift; 
    213252 
     253    Wx::Event::EVT_BUTTON( 
     254        $self, 
     255        $self->{button_menu}, 
     256        sub { 
     257            my ($self, $event) = @_; 
     258            $self->PopupMenu( $self->{menu}, 0, 0 ); 
     259        } 
     260    ); 
    214261    Wx::Event::EVT_TEXT( 
    215262        $self, 
     
    275322 
    276323    $self->Show; 
    277 } 
    278  
    279 # 
    280 # $self->button_match; 
    281 # 
    282 # handler called when the Match button has been clicked. 
    283 # 
    284 sub button_match { 
    285     my $self = shift; 
    286     $self->run(); 
    287     return; 
    288324} 
    289325 
Note: See TracChangeset for help on using the changeset viewer.