Changeset 10473
- Timestamp:
- 02/02/10 23:33:50 (6 months ago)
- Files:
-
- 1 modified
-
trunk/Padre/lib/Padre/Wx/Dialog/RegexEditor.pm (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/lib/Padre/Wx/Dialog/RegexEditor.pm
r10471 r10473 56 56 57 57 58 sub _regex_syntax { 58 # 59 # A private method that returns a hash of regex groups along with their meaning 60 # 61 sub _regex_groups { 59 62 my $self = shift; 60 63 … … 147 150 148 151 $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 my %regex_groups = $self->_regex_groups; 153 154 foreach my $code (keys %regex_groups) { 155 my %sub_group = %{$regex_groups{$code}}; 156 $self->{$code} = Wx::Button->new( 157 $self, -1, $sub_group{label}, 158 ); 152 159 # $self->{menu}->Append( -1, $subgroup{label} ); 153 160 # $self->{menu}->AppendSeparator(); … … 157 164 # $self->{menu}->AppendSeparator(); 158 165 # } 159 #}166 } 160 167 # Wx::Event::EVT_MENU( 161 168 # $self, … … 165 172 # ); 166 173 167 174 # Matching radio button 168 175 $self->{matching} = Wx::RadioButton->new( 169 $self, 170 -1,171 'Matching',172 );176 $self, -1, Wx::gettext('Matching'), 177 ); 178 179 # Substitution radio button 173 180 $self->{substituting} = Wx::RadioButton->new( 174 $self, 175 -1, 176 'Substituting', 177 ); 178 179 $self->{button_menu} = Wx::Button->new( 180 $self, 181 -1, 182 Wx::gettext('&Insert'), 183 ); 184 185 # Close Button 186 $self->{button_close} = Wx::Button->new( 187 $self, 188 Wx::wxID_CANCEL, 189 Wx::gettext('&Close'), 190 ); 191 181 $self, -1, Wx::gettext('Substituting'), 182 ); 183 184 # Close button 185 $self->{close_button} = Wx::Button->new( 186 $self, Wx::wxID_CANCEL, Wx::gettext('&Close'), 187 ); 192 188 193 189 # Dialog Layout … … 204 200 $operation->Add( $self->{matching}, 0, Wx::wxALL, 1 ); 205 201 $operation->Add( $self->{substituting}, 0, Wx::wxALL, 1 ); 202 $operation->AddStretchSpacer; 203 204 my $regex = Wx::BoxSizer->new(Wx::wxVERTICAL); 205 $regex->Add( 206 $self->{regex}, 207 1, 208 Wx::wxALL | Wx::wxALIGN_CENTER_HORIZONTAL | Wx::wxEXPAND, 209 1 210 ); 211 212 my $regex_groups = Wx::BoxSizer->new(Wx::wxVERTICAL); 213 foreach my $code (keys %regex_groups) { 214 $regex_groups->Add( $self->{$code}, 0, Wx::wxEXPAND | Wx::wxALIGN_CENTER_HORIZONTAL, 1 ); 215 } 216 217 my $combined = Wx::BoxSizer->new(Wx::wxHORIZONTAL); 218 $combined->Add( $regex, 2, Wx::wxALL | Wx::wxEXPAND, 0 ); 219 $combined->Add( $regex_groups, 0, Wx::wxALL | Wx::wxEXPAND, 0 ); 206 220 207 221 # Vertical layout of the left hand side 208 222 my $left = Wx::BoxSizer->new(Wx::wxVERTICAL); 209 $left->AddSpacer(3); 210 $left->Add( $modifiers, 0, Wx::wxALL | Wx::wxEXPAND, 1 ); 211 $left->Add( $operation, 0, Wx::wxALL | Wx::wxEXPAND, 1 ); 212 $left->Add( $self->{button_menu}, 0, Wx::wxALIGN_CENTER_HORIZONTAL, 1 ); 213 $left->Add( $regex_label, 0, Wx::wxALL | Wx::wxEXPAND, 1 ); 214 $left->Add( 215 $self->{regex}, 216 1, 217 Wx::wxALL | Wx::wxALIGN_TOP | Wx::wxALIGN_CENTER_HORIZONTAL | Wx::wxEXPAND, 218 1 219 ); 223 $left->Add( $operation, 0, Wx::wxALL | Wx::wxEXPAND, 2 ); 224 $left->Add( $modifiers, 0, Wx::wxALL | Wx::wxEXPAND, 2 ); 225 $left->AddSpacer(5); 226 $left->Add( $regex_label, 0, Wx::wxALL | Wx::wxEXPAND, 1 ); 227 $left->Add( $combined, 0, Wx::wxALL | Wx::wxEXPAND, 2 ); 228 220 229 $left->Add( $substitute_label, 0, Wx::wxALL | Wx::wxEXPAND, 1 ); 221 230 $left->Add( 222 231 $self->{substitute}, 223 232 1, 224 Wx::wxALL | Wx::wxALIGN_ TOP | Wx::wxALIGN_CENTER_HORIZONTAL | Wx::wxEXPAND,233 Wx::wxALL | Wx::wxALIGN_CENTER_HORIZONTAL | Wx::wxEXPAND, 225 234 1 226 235 ); … … 231 240 $self->{original_text}, 232 241 1, 233 Wx::wxALL | Wx::wxALIGN_ TOP | Wx::wxALIGN_CENTER_HORIZONTAL | Wx::wxEXPAND,242 Wx::wxALL | Wx::wxALIGN_CENTER_HORIZONTAL | Wx::wxEXPAND, 234 243 1 235 244 ); … … 238 247 $self->{matched_text}, 239 248 1, 240 Wx::wxALL | Wx::wxALIGN_ TOP | Wx::wxALIGN_CENTER_HORIZONTAL | Wx::wxEXPAND,249 Wx::wxALL | Wx::wxALIGN_CENTER_HORIZONTAL | Wx::wxEXPAND, 241 250 1 242 251 ); 243 252 $left->AddSpacer(5); 244 $left->Add( $self->{ button_close}, 0, Wx::wxALIGN_CENTER_HORIZONTAL, 1 );253 $left->Add( $self->{close_button}, 0, Wx::wxALIGN_CENTER_HORIZONTAL, 1 ); 245 254 246 255 # Main sizer … … 251 260 my $self = shift; 252 261 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 );261 262 Wx::Event::EVT_TEXT( 262 263 $self, … … 300 301 301 302 303 # 304 # A private method that returns a hash of regex modifiers 305 # 302 306 sub _modifiers { 303 307 my $self = shift;
