Changeset 10477
- Timestamp:
- 02/03/10 00:22:25 (2 years ago)
- File:
-
- 1 edited
-
trunk/Padre/lib/Padre/Wx/Dialog/RegexEditor.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/lib/Padre/Wx/Dialog/RegexEditor.pm
r10476 r10477 158 158 159 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 } 169 170 # Matching radio button 171 $self->{matching} = Wx::RadioButton->new( 172 $self, -1, Wx::gettext('Matching'), 173 ); 174 175 # Substitution radio button 176 $self->{substituting} = Wx::RadioButton->new( 177 $self, -1, Wx::gettext('Substituting'), 178 ); 179 180 # Close button 181 $self->{close_button} = Wx::Button->new( 182 $self, Wx::wxID_CANCEL, Wx::gettext('&Close'), 183 ); 184 185 # Dialog Layout 186 187 my $modifiers = Wx::BoxSizer->new(Wx::wxHORIZONTAL); 188 $modifiers->AddStretchSpacer; 189 $modifiers->Add( $self->{ignore_case}, 0, Wx::wxALL, 1 ); 190 $modifiers->Add( $self->{single_line}, 0, Wx::wxALL, 1 ); 191 $modifiers->Add( $self->{multi_line}, 0, Wx::wxALL, 1 ); 192 $modifiers->Add( $self->{extended}, 0, Wx::wxALL, 1 ); 193 194 my $operation = Wx::BoxSizer->new(Wx::wxHORIZONTAL); 195 $operation->AddStretchSpacer; 196 $operation->Add( $self->{matching}, 0, Wx::wxALL, 1 ); 197 $operation->Add( $self->{substituting}, 0, Wx::wxALL, 1 ); 198 $operation->AddStretchSpacer; 199 200 my $regex = Wx::BoxSizer->new(Wx::wxVERTICAL); 201 $regex->Add( $self->{regex}, 1, Wx::wxALL | Wx::wxEXPAND, 1 ); 202 203 my $regex_groups = Wx::BoxSizer->new(Wx::wxVERTICAL); 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 ); 207 } 208 209 my $combined = Wx::BoxSizer->new(Wx::wxHORIZONTAL); 210 $combined->Add( $regex, 2, Wx::wxALL | Wx::wxEXPAND, 0 ); 211 $combined->Add( $regex_groups, 0, Wx::wxALL | Wx::wxEXPAND, 0 ); 212 213 # Vertical layout of the left hand side 214 my $left = Wx::BoxSizer->new(Wx::wxVERTICAL); 215 $left->Add( $operation, 0, Wx::wxALL | Wx::wxEXPAND, 2 ); 216 $left->Add( $modifiers, 0, Wx::wxALL | Wx::wxEXPAND, 2 ); 217 $left->AddSpacer(5); 218 $left->Add( $regex_label, 0, Wx::wxALL | Wx::wxEXPAND, 1 ); 219 $left->Add( $combined, 0, Wx::wxALL | Wx::wxEXPAND, 2 ); 220 221 $left->Add( $substitute_label, 0, Wx::wxALL | Wx::wxEXPAND, 1 ); 222 $left->Add( $self->{substitute}, 1, Wx::wxALL | Wx::wxEXPAND, 1 ); 223 224 $left->Add( $original_label, 0, Wx::wxALL | Wx::wxEXPAND, 1 ); 225 $left->Add( $self->{original_text}, 1, Wx::wxALL | Wx::wxEXPAND, 1 ); 226 $left->Add( $matched_label, 0, Wx::wxALL | Wx::wxEXPAND, 1 ); 227 $left->Add( $self->{matched_text}, 1, Wx::wxALL | Wx::wxEXPAND, 1 ); 228 $left->AddSpacer(5); 229 $left->Add( $self->{close_button}, 0, Wx::wxALIGN_CENTER_HORIZONTAL, 1 ); 230 231 # Main sizer 232 $sizer->Add( $left, 1, Wx::wxALL | Wx::wxEXPAND, 5 ); 233 } 234 235 sub _bind_events { 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'; 160 243 161 Wx::Event::EVT_BUTTON( 244 162 $self, … … 250 168 }, 251 169 ); 252 } 253 254 # Wx::Event::EVT_MENU( 255 # $self, 256 # $self->{menu}, 257 # sub { 258 # }, 259 # ); 170 171 $self->{$menu_name} = Wx::Menu->new; 172 my %sub_group_value = %{$sub_group{value}}; 173 foreach my $element (sort keys %sub_group_value) { 174 my $label = $element; 175 $label =~ s/^\d{2}//; 176 my $menu_item = $self->{$menu_name}->Append( 177 -1, $label . "\t" . $sub_group_value{$element} ); 178 179 Wx::Event::EVT_MENU( 180 $self, 181 $menu_item, 182 sub { 183 $_[0]->{regex}->WriteText($label); 184 }, 185 ); 186 } 187 } 188 189 # Matching radio button 190 $self->{matching} = Wx::RadioButton->new( 191 $self, -1, Wx::gettext('Matching'), 192 ); 193 194 # Substitution radio button 195 $self->{substituting} = Wx::RadioButton->new( 196 $self, -1, Wx::gettext('Substituting'), 197 ); 198 199 # Close button 200 $self->{close_button} = Wx::Button->new( 201 $self, Wx::wxID_CANCEL, Wx::gettext('&Close'), 202 ); 203 204 # Dialog Layout 205 206 my $modifiers = Wx::BoxSizer->new(Wx::wxHORIZONTAL); 207 $modifiers->AddStretchSpacer; 208 $modifiers->Add( $self->{ignore_case}, 0, Wx::wxALL, 1 ); 209 $modifiers->Add( $self->{single_line}, 0, Wx::wxALL, 1 ); 210 $modifiers->Add( $self->{multi_line}, 0, Wx::wxALL, 1 ); 211 $modifiers->Add( $self->{extended}, 0, Wx::wxALL, 1 ); 212 213 my $operation = Wx::BoxSizer->new(Wx::wxHORIZONTAL); 214 $operation->AddStretchSpacer; 215 $operation->Add( $self->{matching}, 0, Wx::wxALL, 1 ); 216 $operation->Add( $self->{substituting}, 0, Wx::wxALL, 1 ); 217 $operation->AddStretchSpacer; 218 219 my $regex = Wx::BoxSizer->new(Wx::wxVERTICAL); 220 $regex->Add( $self->{regex}, 1, Wx::wxALL | Wx::wxEXPAND, 1 ); 221 222 my $regex_groups = Wx::BoxSizer->new(Wx::wxVERTICAL); 223 foreach my $code ( sort keys %regex_groups ) { 224 my $button_name = $code . '_button'; 225 $regex_groups->Add( $self->{$button_name}, 0, Wx::wxEXPAND, 1 ); 226 } 227 228 my $combined = Wx::BoxSizer->new(Wx::wxHORIZONTAL); 229 $combined->Add( $regex, 2, Wx::wxALL | Wx::wxEXPAND, 0 ); 230 $combined->Add( $regex_groups, 0, Wx::wxALL | Wx::wxEXPAND, 0 ); 231 232 # Vertical layout of the left hand side 233 my $left = Wx::BoxSizer->new(Wx::wxVERTICAL); 234 $left->Add( $operation, 0, Wx::wxALL | Wx::wxEXPAND, 2 ); 235 $left->Add( $modifiers, 0, Wx::wxALL | Wx::wxEXPAND, 2 ); 236 $left->AddSpacer(5); 237 $left->Add( $regex_label, 0, Wx::wxALL | Wx::wxEXPAND, 1 ); 238 $left->Add( $combined, 0, Wx::wxALL | Wx::wxEXPAND, 2 ); 239 240 $left->Add( $substitute_label, 0, Wx::wxALL | Wx::wxEXPAND, 1 ); 241 $left->Add( $self->{substitute}, 1, Wx::wxALL | Wx::wxEXPAND, 1 ); 242 243 $left->Add( $original_label, 0, Wx::wxALL | Wx::wxEXPAND, 1 ); 244 $left->Add( $self->{original_text}, 1, Wx::wxALL | Wx::wxEXPAND, 1 ); 245 $left->Add( $matched_label, 0, Wx::wxALL | Wx::wxEXPAND, 1 ); 246 $left->Add( $self->{matched_text}, 1, Wx::wxALL | Wx::wxEXPAND, 1 ); 247 $left->AddSpacer(5); 248 $left->Add( $self->{close_button}, 0, Wx::wxALIGN_CENTER_HORIZONTAL, 1 ); 249 250 # Main sizer 251 $sizer->Add( $left, 1, Wx::wxALL | Wx::wxEXPAND, 5 ); 252 } 253 254 sub _bind_events { 255 my $self = shift; 260 256 261 257 Wx::Event::EVT_TEXT(
Note: See TracChangeset
for help on using the changeset viewer.
