Changeset 10476
- Timestamp:
- 02/03/10 00:01:33 (2 years ago)
- File:
-
- 1 edited
-
trunk/Padre/lib/Padre/Wx/Dialog/RegexEditor.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/lib/Padre/Wx/Dialog/RegexEditor.pm
r10475 r10476 63 63 64 64 return ( 65 '0 1' => {65 '00' => { 66 66 label => Wx::gettext('Character Classes'), 67 67 value => { 68 '.' => Wx::gettext('Any character except a newline'), 69 '\d' => Wx::gettext('Any decimal digit'), 70 '\D' => Wx::gettext('Any non-digit'), 71 '\s' => Wx::gettext('Any whitespace character'), 72 '\S' => Wx::gettext('Any non-whitespace character'), 73 '\w' => Wx::gettext('Any word character'), 74 '\W' => Wx::gettext('Any non-word character'), 68 '00.' => Wx::gettext('Any character except a newline'), 69 '01\d' => Wx::gettext('Any decimal digit'), 70 '02\D' => Wx::gettext('Any non-digit'), 71 '03\s' => Wx::gettext('Any whitespace character'), 72 '04\S' => Wx::gettext('Any non-whitespace character'), 73 '05\w' => Wx::gettext('Any word character'), 74 '06\W' => Wx::gettext('Any non-word character'), 75 } 76 }, 77 '01' => { 78 label => Wx::gettext('Quantifiers'), 79 value => { 80 '00*' => Wx::gettext('Zero or more of the preceding block'), 81 '01+' => Wx::gettext('One or more of the preceding block'), 82 '02?' => Wx::gettext('Zero or one of the preceding block'), 83 '03{m}' => Wx::gettext('Exactly m of the preceding block'), 84 '04{m,n}' => Wx::gettext('m to n of the preceding block'), 75 85 } 76 86 }, 77 87 '02' => { 78 label => Wx::gettext(' Quantifiers'),88 label => Wx::gettext('Miscellaneous'), 79 89 value => { 80 '*' => Wx::gettext('Zero or more of the preceding block'), 81 '+' => Wx::gettext('One or more of the preceding block'), 82 '?' => Wx::gettext('Zero or one of the preceding block'), 83 '{m}' => Wx::gettext('Exactly m of the preceding block'), 84 '{m,n}' => Wx::gettext('m to n of the preceding block'), 90 '00|' => Wx::gettext('Alternation'), 91 '01[ ]' => Wx::gettext('Character set'), 92 '02^' => Wx::gettext('Beginning of line'), 93 '03$' => Wx::gettext('End of line'), 94 '04\b' => Wx::gettext('A word boundary'), 95 '05\B' => Wx::gettext('Not a word boundary'), 85 96 } 86 97 }, 87 98 '03' => { 88 label => Wx::gettext('Miscellaneous'),89 value => {90 '|' => Wx::gettext('Alternation'),91 '[ ]' => Wx::gettext('Character set'),92 '^' => Wx::gettext('Beginning of line'),93 '$' => Wx::gettext('End of line'),94 '\b' => Wx::gettext('A word boundary'),95 '\B' => Wx::gettext('Not a word boundary'),96 }97 },98 '04' => {99 99 label => Wx::gettext('Grouping constructs'), 100 100 value => { 101 ' ( )' => Wx::gettext('A group'),102 ' (?: )' => Wx::gettext('Non-capturing group'),103 ' (?= )' => Wx::gettext('Positive lookahead assertion'),104 ' (?! )' => Wx::gettext('Negative lookahead assertion'),105 ' \n' => Wx::gettext('Backreference to the nth group'),101 '00( )' => Wx::gettext('A group'), 102 '01(?: )' => Wx::gettext('Non-capturing group'), 103 '02(?= )' => Wx::gettext('Positive lookahead assertion'), 104 '03(?! )' => Wx::gettext('Negative lookahead assertion'), 105 '04\n' => Wx::gettext('Backreference to the nth group'), 106 106 } 107 107 } … … 149 149 } 150 150 151 $self->{menu} = Wx::Menu->new;152 151 my %regex_groups = $self->_regex_groups; 153 154 foreach my $code ( keys %regex_groups ) { 152 foreach my $code ( sort keys %regex_groups ) { 155 153 my %sub_group = %{ $regex_groups{$code} }; 156 $self->{$code} = Wx::Button->new( 154 my $button_name = $code . '_button'; 155 $self->{$button_name} = Wx::Button->new( 157 156 $self, -1, $sub_group{label}, 158 157 ); 159 158 160 # $self->{menu}->Append( -1, $subgroup{label} ); 161 # $self->{menu}->AppendSeparator(); 162 # my $subgroup_value = $subgroup{value}; 163 # foreach my $name (keys %subgroup_value) { 164 # my $menu_item = $self->{menu}->Append( -1, $subgroup_value{$name} ); 165 # $self->{menu}->AppendSeparator(); 166 # } 167 } 168 169 # Wx::Event::EVT_MENU( 170 # $self, 171 # $self->{menu}, 172 # sub { 173 # }, 174 # ); 159 my $menu_name = $code . '_menu'; 160 $self->{$menu_name} = Wx::Menu->new; 161 my %sub_group_value = %{$sub_group{value}}; 162 foreach my $element (sort keys %sub_group_value) { 163 my $label = $element; 164 $label =~ s/^\d{2}//; 165 $self->{$menu_name}->Append( 166 -1, $label . "\t" . $sub_group_value{$element} ); 167 } 168 } 175 169 176 170 # Matching radio button … … 208 202 209 203 my $regex_groups = Wx::BoxSizer->new(Wx::wxVERTICAL); 210 foreach my $code ( keys %regex_groups ) { 211 $regex_groups->Add( $self->{$code}, 0, Wx::wxEXPAND, 1 ); 204 foreach my $code ( sort keys %regex_groups ) { 205 my $button_name = $code . '_button'; 206 $regex_groups->Add( $self->{$button_name}, 0, Wx::wxEXPAND, 1 ); 212 207 } 213 208 … … 240 235 sub _bind_events { 241 236 my $self = shift; 237 238 my %regex_groups = $self->_regex_groups; 239 foreach my $code ( keys %regex_groups ) { 240 my %sub_group = %{ $regex_groups{$code} }; 241 my $button_name = $code . '_button'; 242 my $menu_name = $code . '_menu'; 243 Wx::Event::EVT_BUTTON( 244 $self, 245 $self->{$button_name}, 246 sub { 247 my @pos = $self->{$button_name}->GetPositionXY; 248 my @size = $self->{$button_name}->GetSizeWH; 249 $self->PopupMenu($self->{$menu_name}, $pos[0], $pos[1] + $size[1]); 250 }, 251 ); 252 } 253 254 # Wx::Event::EVT_MENU( 255 # $self, 256 # $self->{menu}, 257 # sub { 258 # }, 259 # ); 242 260 243 261 Wx::Event::EVT_TEXT(
Note: See TracChangeset
for help on using the changeset viewer.
