Implemented class SplashScreen for using of text
This commit is contained in:
parent
9d786b5f88
commit
902de849c0
5
resources/icons/prusa_slicer_logo.svg
Normal file
5
resources/icons/prusa_slicer_logo.svg
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="800" height="800" viewBox="0 0 800 800">
|
||||||
|
<circle cx="400" cy="400" r="400" fill="#fff"/>
|
||||||
|
<path d="M599.3,186.8c-93.9-93.9-246.1-93.9-340,0s-93.9,246.1,0,340Z" transform="translate(0 0)" fill="#363636"/>
|
||||||
|
<path d="M202.7,612.5c93.9,93.9,246.1,93.9,340,0s93.9-246.1,0-340" transform="translate(0 0)" fill="#ed6b21"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 374 B |
@ -77,6 +77,46 @@ namespace GUI {
|
|||||||
|
|
||||||
class MainFrame;
|
class MainFrame;
|
||||||
|
|
||||||
|
class SplashScreen : public wxSplashScreen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, wxWindow* parent)
|
||||||
|
: wxSplashScreen(bitmap, splashStyle, milliseconds, parent, wxID_ANY)
|
||||||
|
{
|
||||||
|
wxASSERT(bitmap.IsOk());
|
||||||
|
m_main_bitmap = bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetText(const wxString& text)
|
||||||
|
{
|
||||||
|
SetBmp(m_main_bitmap);
|
||||||
|
if (!text.empty()) {
|
||||||
|
wxBitmap bitmap(m_main_bitmap);
|
||||||
|
wxMemoryDC memDC;
|
||||||
|
|
||||||
|
memDC.SelectObject(bitmap);
|
||||||
|
|
||||||
|
memDC.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold());
|
||||||
|
memDC.SetTextForeground(wxColour(237, 107, 33));
|
||||||
|
memDC.DrawText(text, 120, 120);
|
||||||
|
|
||||||
|
memDC.SelectObject(wxNullBitmap);
|
||||||
|
SetBmp(bitmap);
|
||||||
|
}
|
||||||
|
wxYield();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetBmp(wxBitmap& bmp)
|
||||||
|
{
|
||||||
|
m_window->SetBitmap(bmp);
|
||||||
|
m_window->Refresh();
|
||||||
|
m_window->Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxBitmap m_main_bitmap;
|
||||||
|
};
|
||||||
|
|
||||||
wxString file_wildcards(FileType file_type, const std::string &custom_extension)
|
wxString file_wildcards(FileType file_type, const std::string &custom_extension)
|
||||||
{
|
{
|
||||||
static const std::string defaults[FT_SIZE] = {
|
static const std::string defaults[FT_SIZE] = {
|
||||||
@ -391,6 +431,10 @@ bool GUI_App::on_init_inner()
|
|||||||
app_config->set("version", SLIC3R_VERSION);
|
app_config->set("version", SLIC3R_VERSION);
|
||||||
app_config->save();
|
app_config->save();
|
||||||
|
|
||||||
|
wxBitmap bitmap = create_scaled_bitmap("prusa_slicer_logo", nullptr, 400);
|
||||||
|
SplashScreen* scrn = new SplashScreen(bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT, 4000, nullptr);
|
||||||
|
scrn->SetText(_L("Loading configuration..."));
|
||||||
|
|
||||||
preset_bundle = new PresetBundle();
|
preset_bundle = new PresetBundle();
|
||||||
|
|
||||||
// just checking for existence of Slic3r::data_dir is not enough : it may be an empty directory
|
// just checking for existence of Slic3r::data_dir is not enough : it may be an empty directory
|
||||||
@ -437,13 +481,11 @@ bool GUI_App::on_init_inner()
|
|||||||
// Let the libslic3r know the callback, which will translate messages on demand.
|
// Let the libslic3r know the callback, which will translate messages on demand.
|
||||||
Slic3r::I18N::set_translate_callback(libslic3r_translate_callback);
|
Slic3r::I18N::set_translate_callback(libslic3r_translate_callback);
|
||||||
|
|
||||||
wxBitmap bitmap = create_scaled_bitmap("wrench", nullptr, 400);
|
|
||||||
wxSplashScreen* scrn = new wxSplashScreen(bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT, 2500, NULL, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFRAME_NO_TASKBAR | wxSIMPLE_BORDER | wxSTAY_ON_TOP);
|
|
||||||
wxYield();
|
|
||||||
|
|
||||||
// application frame
|
// application frame
|
||||||
if (wxImage::FindHandler(wxBITMAP_TYPE_PNG) == nullptr)
|
if (wxImage::FindHandler(wxBITMAP_TYPE_PNG) == nullptr)
|
||||||
wxImage::AddHandler(new wxPNGHandler());
|
wxImage::AddHandler(new wxPNGHandler());
|
||||||
|
scrn->SetText(_L("Creating settings tabs..."));
|
||||||
|
|
||||||
mainframe = new MainFrame();
|
mainframe = new MainFrame();
|
||||||
// hide settings tabs after first Layout
|
// hide settings tabs after first Layout
|
||||||
mainframe->select_tab(0);
|
mainframe->select_tab(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user