PreferencesDialog moved to C++ part

This commit is contained in:
YuSanka 2018-02-22 11:12:29 +01:00
parent 916378097c
commit 3d805a0f43
7 changed files with 45 additions and 3 deletions

View file

@ -69,7 +69,9 @@ our $grey = Wx::Colour->new(200,200,200);
# Events to be sent from a C++ menu implementation:
# 1) To inform about a change of the application language.
our $LANGUAGE_CHANGE_EVENT = Wx::NewEventType;
our $LANGUAGE_CHANGE_EVENT = Wx::NewEventType;
# 2) To inform about a change of Preferences.
our $PREFERENCES_EVENT = Wx::NewEventType;
sub OnInit {
my ($self) = @_;
@ -122,6 +124,7 @@ sub OnInit {
no_controller => $self->{app_config}->get('no_controller'),
no_plater => $no_plater,
lang_ch_event => $LANGUAGE_CHANGE_EVENT,
preferences_event => $PREFERENCES_EVENT,
);
$self->SetTopWindow($frame);
@ -146,6 +149,11 @@ sub OnInit {
EVT_COMMAND($self, -1, $LANGUAGE_CHANGE_EVENT, sub{
$self->recreate_GUI;
});
# The following event is emited by the C++ menu implementation of preferences change.
EVT_COMMAND($self, -1, $PREFERENCES_EVENT, sub{
$self->update_ui_from_settings;
});
return 1;
}
@ -158,6 +166,7 @@ sub recreate_GUI{
no_controller => $self->{app_config}->get('no_controller'),
no_plater => $no_plater,
lang_ch_event => $LANGUAGE_CHANGE_EVENT,
preferences_event => $PREFERENCES_EVENT,
);
if($topwindow)

View file

@ -50,6 +50,7 @@ sub new {
$self->{no_plater} = $params{no_plater};
$self->{loaded} = 0;
$self->{lang_ch_event} = $params{lang_ch_event};
$self->{preferences_event} = $params{preferences_event};
# initialize tabpanel and menubar
$self->_init_tabpanel;
@ -296,7 +297,9 @@ sub _init_menubar {
$fileMenu->AppendSeparator();
# Cmd+, is standard on OS X - what about other operating systems?
$self->_append_menu_item($fileMenu, L("Preferences…\tCtrl+,"), L('Application preferences'), sub {
Slic3r::GUI::Preferences->new($self)->ShowModal;
# Slic3r::GUI::Preferences->new($self)->ShowModal;
# It's in C++ part now
Slic3r::GUI::open_preferences_dialog($self->{preferences_event});
}, wxID_PREFERENCES);
$fileMenu->AppendSeparator();
$self->_append_menu_item($fileMenu, L("&Quit"), L('Quit Slic3r'), sub {