Padre
view release on metacpan or search on metacpan
lib/Padre/Wx/Main.pm view on Meta::CPAN
# Run the "relocale" process to update the GUI
$self->relocale;
# With language stuff updated, do a full refresh
# sweep to clean everything up.
$self->refresh;
return;
}
=pod
=head3 C<relocale>
$main->relocale;
The term and method C<relocale> is reserved for functionality intended
to run when the application wishes to change locale (and wishes to do so
without restarting).
Note at this point, that the new locale has already been fixed, and this
method is usually called by C<change_locale()>.
=cut
sub relocale {
my $self = shift;
# The find and replace dialogs don't support relocale
# (and they might currently be visible) so get rid of them.
if ( $self->has_find ) {
$self->{find}->Destroy;
delete $self->{find};
}
if ( $self->has_replace ) {
$self->{replace}->Destroy;
delete $self->{replace};
}
# Relocale the plug-ins
$self->ide->plugin_manager->relocale;
# The menu doesn't support relocale, replace it
# I wish this code didn't have to be so ugly, but we want to be
# sure we clean up all the menu memory properly.
SCOPE: {
delete $self->{menu};
$self->{menu} = Padre::Wx::Menubar->new($self);
my $old = $self->GetMenuBar;
$self->SetMenuBar( $self->menu->wx );
$old->Destroy;
}
# Refresh the plugins' menu entries
$self->refresh_menu_plugins;
# The toolbar doesn't support relocale, replace it
$self->rebuild_toolbar;
# Cascade relocation to AUI elements and other tools
$self->aui->relocale;
$self->left->relocale if $self->has_left;
$self->right->relocale if $self->has_right;
$self->bottom->relocale if $self->has_bottom;
$self->directory->relocale if $self->has_directory;
# Update the document titles (mostly for unnamed documents)
$self->notebook->relocale;
# Replace the regex editor, keep the data (if it exists)
if ( exists $self->{regex_editor} ) {
my $data_ref = $self->{regex_editor}->get_data;
my $was_visible = $self->{regex_editor}->Hide;
$self->{regex_editor} = Padre::Wx::Dialog::RegexEditor->new($self);
$self->{regex_editor}->show if $was_visible;
$self->{regex_editor}->set_data($data_ref);
}
return;
}
=pod
=head3 C<restyle>
$main->restyle;
The term and method C<restyle> is reserved for code that needs to be run when
the L<Padre::Wx::Theme|theme> of the editor has changed and the colouring of
the application needs to be changed without restarting.
Note that the new style must be applied to configuration before this method is
called, and this method is usually called by the C<apply> handler for the
C<editor_style> configuration setting.
=cut
sub restyle {
my $self = shift;
my $name = $self->config->editor_style;
my $style = $self->{theme} = Padre::Wx::Theme->find($name);
my $lock = $self->lock('UPDATE');
# Apply the new style to all current editors
foreach my $editor ( $self->editors ) {
$style->apply($editor);
}
return;
}
=pod
=head3 C<rebuild_toolbar>
$main->rebuild_toolbar;
Destroy and rebuild the toolbar. This method is useful because the
toolbar is not really flexible, and most of the time it's better to
( run in 1.623 second using v1.01-cache-2.11-cpan-71847e10f99 )