Merge remote-tracking branch 'origin/ys_splashscreen_on_mac'
This commit is contained in:
commit
52557b4263
@ -588,6 +588,12 @@ int CLI::run(int argc, char **argv)
|
||||
|
||||
// gui->autosave = m_config.opt_string("autosave");
|
||||
GUI::GUI_App::SetInstance(gui);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
gui->m_after_init_loads.set_params(load_configs, m_extra_config, m_input_files, start_as_gcodeviewer);
|
||||
#else
|
||||
gui->m_after_init_loads.set_params(load_configs, m_extra_config, m_input_files);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
/*
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
gui->CallAfter([gui, this, &load_configs, start_as_gcodeviewer] {
|
||||
#else
|
||||
@ -625,6 +631,7 @@ int CLI::run(int argc, char **argv)
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
});
|
||||
*/
|
||||
int result = wxEntry(argc, argv);
|
||||
return result;
|
||||
#else /* SLIC3R_GUI */
|
||||
|
@ -123,6 +123,10 @@ public:
|
||||
|
||||
memDC.SelectObject(wxNullBitmap);
|
||||
set_bitmap(bitmap);
|
||||
#ifdef __WXOSX__
|
||||
// without this code splash screen wouldn't be updated under OSX
|
||||
wxYield();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -531,6 +535,41 @@ static void generic_exception_handle()
|
||||
}
|
||||
}
|
||||
|
||||
void GUI_App::AFTER_INIT_LOADS::on_loads(GUI_App* gui)
|
||||
{
|
||||
if (!gui->initialized())
|
||||
return;
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (m_start_as_gcodeviewer) {
|
||||
if (!m_input_files.empty())
|
||||
gui->plater()->load_gcode(wxString::FromUTF8(m_input_files[0].c_str()));
|
||||
}
|
||||
else {
|
||||
#endif // ENABLE_GCODE_VIEWER_AS
|
||||
#if 0
|
||||
// Load the cummulative config over the currently active profiles.
|
||||
//FIXME if multiple configs are loaded, only the last one will have an effect.
|
||||
// We need to decide what to do about loading of separate presets (just print preset, just filament preset etc).
|
||||
// As of now only the full configs are supported here.
|
||||
if (!m_print_config.empty())
|
||||
gui->mainframe->load_config(m_print_config);
|
||||
#endif
|
||||
if (!m_load_configs.empty())
|
||||
// Load the last config to give it a name at the UI. The name of the preset may be later
|
||||
// changed by loading an AMF or 3MF.
|
||||
//FIXME this is not strictly correct, as one may pass a print/filament/printer profile here instead of a full config.
|
||||
gui->mainframe->load_config_file(m_load_configs.back());
|
||||
// If loading a 3MF file, the config is loaded from the last one.
|
||||
if (!m_input_files.empty())
|
||||
gui->plater()->load_files(m_input_files, true, true);
|
||||
if (!m_extra_config.empty())
|
||||
gui->mainframe->load_config(m_extra_config);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
IMPLEMENT_APP(GUI_App)
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
@ -781,6 +820,13 @@ bool GUI_App::on_init_inner()
|
||||
|
||||
this->obj_manipul()->update_if_dirty();
|
||||
|
||||
static bool update_gui_after_init = true;
|
||||
if (update_gui_after_init)
|
||||
{
|
||||
update_gui_after_init = false;
|
||||
m_after_init_loads.on_loads(this);
|
||||
}
|
||||
|
||||
// Preset updating & Configwizard are done after the above initializations,
|
||||
// and after MainFrame is created & shown.
|
||||
// The extra CallAfter() is needed because of Mac, where this is the only way
|
||||
|
@ -140,6 +140,35 @@ private:
|
||||
std::string m_instance_hash_string;
|
||||
size_t m_instance_hash_int;
|
||||
|
||||
// parameters needed for the after OnInit() loads
|
||||
struct AFTER_INIT_LOADS
|
||||
{
|
||||
std::vector<std::string> m_load_configs;
|
||||
DynamicPrintConfig m_extra_config;
|
||||
std::vector<std::string> m_input_files;
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
bool m_start_as_gcodeviewer;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
void set_params(
|
||||
const std::vector<std::string>& load_configs,
|
||||
const DynamicPrintConfig& extra_config,
|
||||
const std::vector<std::string>& input_files,
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
bool start_as_gcodeviewer
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
) {
|
||||
m_load_configs = load_configs;
|
||||
m_extra_config = extra_config;
|
||||
m_input_files = input_files;
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
m_start_as_gcodeviewer = start_as_gcodeviewer;
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
void on_loads(GUI_App* gui);
|
||||
};
|
||||
|
||||
public:
|
||||
bool OnInit() override;
|
||||
bool initialized() const { return m_initialized; }
|
||||
@ -236,6 +265,7 @@ public:
|
||||
PresetUpdater* preset_updater{ nullptr };
|
||||
MainFrame* mainframe{ nullptr };
|
||||
Plater* plater_{ nullptr };
|
||||
AFTER_INIT_LOADS m_after_init_loads;
|
||||
|
||||
PresetUpdater* get_preset_updater() { return preset_updater; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user