228
228
# Original input text field
229
229
my $original_label = Wx::StaticText->new( $self, -1, Wx::gettext('&Original text:') );
230
230
$self->{original_text} = Wx::TextCtrl->new(
231
$self, -1, '', Wx::wxDefaultPosition, Wx::wxDefaultSize,
232
Wx::wxTE_MULTILINE | Wx::wxNO_FULL_REPAINT_ON_RESIZE
231
$self, -1, '', Wx::DefaultPosition, Wx::DefaultSize,
232
Wx::TE_MULTILINE | Wx::NO_FULL_REPAINT_ON_RESIZE
235
235
# Matched readonly text field
236
236
my $matched_label = Wx::StaticText->new( $self, -1, Wx::gettext('Matched text:') );
237
237
$self->{matched_text} = Wx::RichTextCtrl->new(
238
$self, -1, '', Wx::wxDefaultPosition, Wx::wxDefaultSize,
239
Wx::wxRE_MULTILINE | Wx::wxRE_READONLY | Wx::wxWANTS_CHARS # Otherwise arrows will not work on win32
238
$self, -1, '', Wx::DefaultPosition, Wx::DefaultSize,
239
Wx::RE_MULTILINE | Wx::RE_READONLY | Wx::WANTS_CHARS # Otherwise arrows will not work on win32
242
242
# Toggle the visibility of the replace (substitution) fields
259
259
# Result from replace text field
260
260
$self->{result_label} = Wx::StaticText->new( $self, -1, Wx::gettext('&Result from replace:') );
261
261
$self->{result_text} = Wx::RichTextCtrl->new(
262
$self, -1, '', Wx::wxDefaultPosition, Wx::wxDefaultSize,
263
Wx::wxRE_MULTILINE | Wx::wxRE_READONLY | Wx::wxWANTS_CHARS # Otherwise arrows will not work on win32
262
$self, -1, '', Wx::DefaultPosition, Wx::DefaultSize,
263
Wx::RE_MULTILINE | Wx::RE_READONLY | Wx::WANTS_CHARS # otherwise arrows will not work on win32
266
266
$self->{result_label}->Hide;
267
267
$self->{result_text}->Hide;
269
# Insert regex into current document button_name
269
# Insert regex into current document
270
270
$self->{insert_button} = Wx::Button->new(
271
271
$self, -1, Wx::gettext('Insert'),
275
275
$self->{close_button} = Wx::Button->new(
276
$self, Wx::wxID_CANCEL, Wx::gettext('&Close'),
276
$self, Wx::ID_CANCEL, Wx::gettext('&Close'),
279
my $buttons = Wx::BoxSizer->new(Wx::wxHORIZONTAL);
279
my $buttons = Wx::BoxSizer->new(Wx::HORIZONTAL);
280
280
$buttons->AddStretchSpacer;
281
$buttons->Add( $self->{insert_button}, 0, Wx::wxALL, 1 );
282
$buttons->Add( $self->{close_button}, 0, Wx::wxALL, 1 );
281
$buttons->Add( $self->{insert_button}, 0, Wx::ALL, 1 );
282
$buttons->Add( $self->{close_button}, 0, Wx::ALL, 1 );
283
283
$buttons->AddStretchSpacer;
299
my $modifiers = Wx::BoxSizer->new(Wx::wxHORIZONTAL);
300
$modifiers->AddStretchSpacer;
301
$modifiers->Add( $self->{ignore_case}, 0, Wx::wxALL, 1 );
302
$modifiers->Add( $self->{single_line}, 0, Wx::wxALL, 1 );
303
$modifiers->Add( $self->{multi_line}, 0, Wx::wxALL, 1 );
304
$modifiers->Add( $self->{extended}, 0, Wx::wxALL, 1 );
305
$modifiers->Add( $self->{global}, 0, Wx::wxALL, 1 );
307
$modifiers->AddStretchSpacer;
309
my $regex = Wx::BoxSizer->new(Wx::wxVERTICAL);
310
$regex->Add( $self->{regex}, 1, Wx::wxALL | Wx::wxEXPAND, 1 );
312
my $regex_groups = Wx::BoxSizer->new(Wx::wxVERTICAL);
299
my $modifiers = Wx::BoxSizer->new(Wx::HORIZONTAL);
300
$modifiers->AddStretchSpacer;
301
$modifiers->Add( $self->{ignore_case}, 0, Wx::ALL, 1 );
302
$modifiers->Add( $self->{single_line}, 0, Wx::ALL, 1 );
303
$modifiers->Add( $self->{multi_line}, 0, Wx::ALL, 1 );
304
$modifiers->Add( $self->{extended}, 0, Wx::ALL, 1 );
305
$modifiers->Add( $self->{global}, 0, Wx::ALL, 1 );
307
$modifiers->AddStretchSpacer;
309
my $regex = Wx::BoxSizer->new(Wx::VERTICAL);
310
$regex->Add( $self->{regex}, 1, Wx::ALL | Wx::EXPAND, 1 );
312
my $regex_groups = Wx::BoxSizer->new(Wx::VERTICAL);
313
313
foreach my $code ( sort keys %regex_groups ) {
314
314
my $button_name = $code . '_button';
315
$regex_groups->Add( $self->{$button_name}, 0, Wx::wxEXPAND, 1 );
315
$regex_groups->Add( $self->{$button_name}, 0, Wx::EXPAND, 1 );
318
my $combined = Wx::BoxSizer->new(Wx::wxHORIZONTAL);
319
$combined->Add( $regex, 2, Wx::wxALL | Wx::wxEXPAND, 0 );
320
$combined->Add( $regex_groups, 0, Wx::wxALL | Wx::wxEXPAND, 0 );
318
my $combined = Wx::BoxSizer->new(Wx::HORIZONTAL);
319
$combined->Add( $regex, 2, Wx::ALL | Wx::EXPAND, 0 );
320
$combined->Add( $regex_groups, 0, Wx::ALL | Wx::EXPAND, 0 );
322
322
# Vertical layout of the left hand side
323
my $left = Wx::BoxSizer->new(Wx::wxVERTICAL);
324
$left->Add( $modifiers, 0, Wx::wxALL | Wx::wxEXPAND, 2 );
326
$left->Add( $regex_label, 0, Wx::wxALL | Wx::wxEXPAND, 1 );
327
$left->Add( $combined, 0, Wx::wxALL | Wx::wxEXPAND, 2 );
329
$left->Add( $self->{description_checkbox}, 0, Wx::wxALL | Wx::wxEXPAND, 1 );
330
$left->Add( $self->{description_text}, 2, Wx::wxALL | Wx::wxEXPAND, 1 );
332
$left->Add( $original_label, 0, Wx::wxALL | Wx::wxEXPAND, 1 );
333
$left->Add( $self->{original_text}, 1, Wx::wxALL | Wx::wxEXPAND, 1 );
334
$left->Add( $matched_label, 0, Wx::wxALL | Wx::wxEXPAND, 1 );
335
$left->Add( $self->{matched_text}, 1, Wx::wxALL | Wx::wxEXPAND, 1 );
337
$left->Add( $self->{replace_checkbox}, 0, Wx::wxALL | Wx::wxEXPAND, 1 );
338
$left->Add( $self->{replace_label}, 0, Wx::wxALL | Wx::wxEXPAND, 1 );
339
$left->Add( $self->{replace_text}, 1, Wx::wxALL | Wx::wxEXPAND, 1 );
340
$left->Add( $self->{result_label}, 0, Wx::wxALL | Wx::wxEXPAND, 1 );
341
$left->Add( $self->{result_text}, 1, Wx::wxALL | Wx::wxEXPAND, 1 );
344
$left->Add( $buttons, 0, Wx::wxALL | Wx::wxEXPAND, 1 );
323
my $left = Wx::BoxSizer->new(Wx::VERTICAL);
324
$left->Add( $modifiers, 0, Wx::ALL | Wx::EXPAND, 2 );
326
$left->Add( $regex_label, 0, Wx::ALL | Wx::EXPAND, 1 );
327
$left->Add( $combined, 0, Wx::ALL | Wx::EXPAND, 2 );
329
$left->Add( $self->{description_checkbox}, 0, Wx::ALL | Wx::EXPAND, 1 );
330
$left->Add( $self->{description_text}, 2, Wx::ALL | Wx::EXPAND, 1 );
332
$left->Add( $original_label, 0, Wx::ALL | Wx::EXPAND, 1 );
333
$left->Add( $self->{original_text}, 1, Wx::ALL | Wx::EXPAND, 1 );
334
$left->Add( $matched_label, 0, Wx::ALL | Wx::EXPAND, 1 );
335
$left->Add( $self->{matched_text}, 1, Wx::ALL | Wx::EXPAND, 1 );
337
$left->Add( $self->{replace_checkbox}, 0, Wx::ALL | Wx::EXPAND, 1 );
338
$left->Add( $self->{replace_label}, 0, Wx::ALL | Wx::EXPAND, 1 );
339
$left->Add( $self->{replace_text}, 1, Wx::ALL | Wx::EXPAND, 1 );
340
$left->Add( $self->{result_label}, 0, Wx::ALL | Wx::EXPAND, 1 );
341
$left->Add( $self->{result_text}, 1, Wx::ALL | Wx::EXPAND, 1 );
344
$left->Add( $buttons, 0, Wx::ALL | Wx::EXPAND, 1 );
347
$sizer->Add( $left, 1, Wx::wxALL | Wx::wxEXPAND, 5 );
347
$sizer->Add( $left, 1, Wx::ALL | Wx::EXPAND, 5 );
350
350
sub _bind_events {