Implemented class SplashScreen for using of text

This commit is contained in:
YuSanka 2020-09-04 20:25:27 +02:00
parent 9d786b5f88
commit 902de849c0
2 changed files with 51 additions and 4 deletions

View 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

View File

@ -77,6 +77,46 @@ namespace GUI {
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)
{
static const std::string defaults[FT_SIZE] = {
@ -390,6 +430,10 @@ bool GUI_App::on_init_inner()
app_config->set("version", SLIC3R_VERSION);
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();
@ -437,13 +481,11 @@ bool GUI_App::on_init_inner()
// Let the libslic3r know the callback, which will translate messages on demand.
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
if (wxImage::FindHandler(wxBITMAP_TYPE_PNG) == nullptr)
wxImage::AddHandler(new wxPNGHandler());
scrn->SetText(_L("Creating settings tabs..."));
mainframe = new MainFrame();
// hide settings tabs after first Layout
mainframe->select_tab(0);