PreferencesDialog moved to C++ part
This commit is contained in:
parent
916378097c
commit
3d805a0f43
7 changed files with 45 additions and 3 deletions
|
@ -70,6 +70,8 @@ our $grey = Wx::Colour->new(200,200,200);
|
||||||
# Events to be sent from a C++ menu implementation:
|
# Events to be sent from a C++ menu implementation:
|
||||||
# 1) To inform about a change of the application language.
|
# 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 {
|
sub OnInit {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
@ -122,6 +124,7 @@ sub OnInit {
|
||||||
no_controller => $self->{app_config}->get('no_controller'),
|
no_controller => $self->{app_config}->get('no_controller'),
|
||||||
no_plater => $no_plater,
|
no_plater => $no_plater,
|
||||||
lang_ch_event => $LANGUAGE_CHANGE_EVENT,
|
lang_ch_event => $LANGUAGE_CHANGE_EVENT,
|
||||||
|
preferences_event => $PREFERENCES_EVENT,
|
||||||
);
|
);
|
||||||
$self->SetTopWindow($frame);
|
$self->SetTopWindow($frame);
|
||||||
|
|
||||||
|
@ -147,6 +150,11 @@ sub OnInit {
|
||||||
$self->recreate_GUI;
|
$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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +166,7 @@ sub recreate_GUI{
|
||||||
no_controller => $self->{app_config}->get('no_controller'),
|
no_controller => $self->{app_config}->get('no_controller'),
|
||||||
no_plater => $no_plater,
|
no_plater => $no_plater,
|
||||||
lang_ch_event => $LANGUAGE_CHANGE_EVENT,
|
lang_ch_event => $LANGUAGE_CHANGE_EVENT,
|
||||||
|
preferences_event => $PREFERENCES_EVENT,
|
||||||
);
|
);
|
||||||
|
|
||||||
if($topwindow)
|
if($topwindow)
|
||||||
|
|
|
@ -50,6 +50,7 @@ sub new {
|
||||||
$self->{no_plater} = $params{no_plater};
|
$self->{no_plater} = $params{no_plater};
|
||||||
$self->{loaded} = 0;
|
$self->{loaded} = 0;
|
||||||
$self->{lang_ch_event} = $params{lang_ch_event};
|
$self->{lang_ch_event} = $params{lang_ch_event};
|
||||||
|
$self->{preferences_event} = $params{preferences_event};
|
||||||
|
|
||||||
# initialize tabpanel and menubar
|
# initialize tabpanel and menubar
|
||||||
$self->_init_tabpanel;
|
$self->_init_tabpanel;
|
||||||
|
@ -296,7 +297,9 @@ sub _init_menubar {
|
||||||
$fileMenu->AppendSeparator();
|
$fileMenu->AppendSeparator();
|
||||||
# Cmd+, is standard on OS X - what about other operating systems?
|
# Cmd+, is standard on OS X - what about other operating systems?
|
||||||
$self->_append_menu_item($fileMenu, L("Preferences…\tCtrl+,"), L('Application preferences'), sub {
|
$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);
|
}, wxID_PREFERENCES);
|
||||||
$fileMenu->AppendSeparator();
|
$fileMenu->AppendSeparator();
|
||||||
$self->_append_menu_item($fileMenu, L("&Quit"), L('Quit Slic3r'), sub {
|
$self->_append_menu_item($fileMenu, L("&Quit"), L('Quit Slic3r'), sub {
|
||||||
|
|
Binary file not shown.
|
@ -44,6 +44,7 @@
|
||||||
#include "TabIface.hpp"
|
#include "TabIface.hpp"
|
||||||
#include "AppConfig.hpp"
|
#include "AppConfig.hpp"
|
||||||
#include "Utils.hpp"
|
#include "Utils.hpp"
|
||||||
|
#include "Preferences.hpp"
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
|
@ -342,6 +343,12 @@ void add_debug_menu(wxMenuBar *menu, int event_language_change)
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void open_preferences_dialog(int event_preferences)
|
||||||
|
{
|
||||||
|
auto dlg = new PreferencesDialog(g_wxMainFrame, event_preferences);
|
||||||
|
dlg->ShowModal();
|
||||||
|
}
|
||||||
|
|
||||||
void create_preset_tabs(PresetBundle *preset_bundle,
|
void create_preset_tabs(PresetBundle *preset_bundle,
|
||||||
bool no_controller, bool is_disabled_button_browse, bool is_user_agent,
|
bool no_controller, bool is_disabled_button_browse, bool is_user_agent,
|
||||||
int event_value_change, int event_presets_changed,
|
int event_value_change, int event_presets_changed,
|
||||||
|
@ -487,6 +494,13 @@ void show_info(wxWindow* parent, wxString message, wxString title){
|
||||||
msg_wingow->ShowModal();
|
msg_wingow->ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void warning_catcher(wxWindow* parent, wxString message){
|
||||||
|
if (message == _L("GLUquadricObjPtr | Attempt to free unreferenced scalar") )
|
||||||
|
return;
|
||||||
|
auto msg = new wxMessageDialog(parent, message, _L("Warning"), wxOK | wxICON_WARNING);
|
||||||
|
msg->ShowModal();
|
||||||
|
}
|
||||||
|
|
||||||
wxApp* get_app(){
|
wxApp* get_app(){
|
||||||
return g_wxApp;
|
return g_wxApp;
|
||||||
}
|
}
|
||||||
|
@ -536,4 +550,9 @@ int combochecklist_get_flags(wxComboCtrl* comboCtrl)
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AppConfig* get_app_config()
|
||||||
|
{
|
||||||
|
return g_AppConfig;
|
||||||
|
}
|
||||||
|
|
||||||
} }
|
} }
|
||||||
|
|
|
@ -66,7 +66,14 @@ void set_main_frame(wxFrame *main_frame);
|
||||||
void set_tab_panel(wxNotebook *tab_panel);
|
void set_tab_panel(wxNotebook *tab_panel);
|
||||||
void set_app_config(AppConfig *app_config);
|
void set_app_config(AppConfig *app_config);
|
||||||
|
|
||||||
|
AppConfig* get_app_config();
|
||||||
|
wxApp* get_app();
|
||||||
|
|
||||||
void add_debug_menu(wxMenuBar *menu, int event_language_change);
|
void add_debug_menu(wxMenuBar *menu, int event_language_change);
|
||||||
|
|
||||||
|
// Create "Preferences" dialog after selecting menu "Preferences" in Perl part
|
||||||
|
void open_preferences_dialog(int event_preferences);
|
||||||
|
|
||||||
// Create a new preset tab (print, filament and printer),
|
// Create a new preset tab (print, filament and printer),
|
||||||
void create_preset_tabs(PresetBundle *preset_bundle,
|
void create_preset_tabs(PresetBundle *preset_bundle,
|
||||||
bool no_controller, bool is_disabled_button_browse, bool is_user_agent,
|
bool no_controller, bool is_disabled_button_browse, bool is_user_agent,
|
||||||
|
@ -81,6 +88,7 @@ void change_opt_value(DynamicPrintConfig& config, t_config_option_key opt_key, b
|
||||||
|
|
||||||
void show_error(wxWindow* parent, wxString message);
|
void show_error(wxWindow* parent, wxString message);
|
||||||
void show_info(wxWindow* parent, wxString message, wxString title);
|
void show_info(wxWindow* parent, wxString message, wxString title);
|
||||||
|
void warning_catcher(wxWindow* parent, wxString message);
|
||||||
|
|
||||||
// load language saved at application config
|
// load language saved at application config
|
||||||
bool load_language();
|
bool load_language();
|
||||||
|
|
|
@ -904,7 +904,7 @@ void TabFilament::update()
|
||||||
|
|
||||||
void TabFilament::OnActivate()
|
void TabFilament::OnActivate()
|
||||||
{
|
{
|
||||||
m_volumetric_speed_description_line->SetText(PresetHints::maximum_volumetric_flow_description(*m_preset_bundle));
|
m_volumetric_speed_description_line->SetText(wxString::FromUTF8(PresetHints::maximum_volumetric_flow_description(*m_preset_bundle).c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSizer* Tab::description_line_widget(wxWindow* parent, ogStaticText* *StaticText)
|
wxSizer* Tab::description_line_widget(wxWindow* parent, ogStaticText* *StaticText)
|
||||||
|
|
|
@ -58,3 +58,6 @@ int combochecklist_get_flags(SV *ui)
|
||||||
|
|
||||||
void set_app_config(AppConfig *app_config)
|
void set_app_config(AppConfig *app_config)
|
||||||
%code%{ Slic3r::GUI::set_app_config(app_config); %};
|
%code%{ Slic3r::GUI::set_app_config(app_config); %};
|
||||||
|
|
||||||
|
void open_preferences_dialog(int preferences_event)
|
||||||
|
%code%{ Slic3r::GUI::open_preferences_dialog(preferences_event); %};
|
||||||
|
|
Loading…
Reference in a new issue