Code::Blocks  SVN r11506
splashscreen.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3  * http://www.gnu.org/licenses/gpl-3.0.html
4  *
5  * $Revision: 11394 $
6  * $Id: splashscreen.cpp 11394 2018-05-01 15:38:22Z fuscated $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/src/splashscreen.cpp $
8  */
9 
10 #include "splashscreen.h"
11 
12 #include <wx/dc.h>
13 
14 #include "appglobals.h"
15 #include "configmanager.h"
16 #include "pluginmanager.h"
17 
18 BEGIN_EVENT_TABLE(cbSplashScreen, wxSplashScreen)
20 END_EVENT_TABLE()
21 
23  : wxSplashScreen(bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT,
24  0, nullptr, wxID_ANY, wxDefaultPosition, wxDefaultSize,
25  wxBORDER_NONE | wxFRAME_NO_TASKBAR | wxFRAME_SHAPED)
26 {
27 }
28 
30 {
31  static const wxString release(wxT(RELEASE));
32  static const wxString revision = wxT(" ")+ ConfigManager::GetRevisionString();
33 
36 
37  wxCoord lf_width, lf_height, lf_descend;
38  dc.GetTextExtent(release, &lf_width, &lf_height, &lf_descend, nullptr, &largeFont);
39 
40  wxCoord sf_width, sf_height, sf_descend;
41  dc.GetTextExtent(release + revision, &sf_width, &sf_height, &sf_descend, nullptr, &smallFont);
42 
43  int text_center = 450;
44  int x_offset = text_center;
45  int y = 220;
46 
47  dc.SetTextForeground(*wxBLACK);
48 
49 #if SVN_BUILD
50  // only render SVN revision when not building official release
51  x_offset = text_center - (sf_width)/2;
52  dc.SetFont(smallFont);
53  dc.DrawText(release + revision, x_offset, (y - sf_height + sf_descend));
54 #else
55  x_offset = text_center - (lf_width)/2;
56  dc.SetFont(largeFont);
57  dc.DrawText(release, x_offset, (y - lf_height + lf_descend));
58 #endif
59 
61  {
62  wxCoord sm_width, sm_height, sm_descend;
63  dc.GetTextExtent(_("SAFE MODE"), &sm_width, &sm_height, &sm_descend, nullptr, &smallFont);
64  dc.SetFont(smallFont);
65  dc.SetTextForeground(*wxRED);
66  x_offset = text_center - (sm_width)/2;
67  dc.DrawText(_("SAFE MODE"), x_offset, (y - sm_height + sm_descend + lf_height+10));
68  dc.SetTextForeground(*wxBLACK);
69  }
70 }
71 
73 {
74  // Don't destroy it here. It creates a dangling pointer in app.cpp and crashes C::B
75  Hide();
76 }
static bool GetSafeMode()
wxColour * wxBLACK
#define wxT(string)
wxColour * wxRED
const wxString & _(const wxString &string)
static wxString GetRevisionString()
static void DrawReleaseInfo(class wxDC &dc)
void OnCloseWindow(wxCloseEvent &event)
int wxCoord
#define RELEASE
Definition: appglobals.h:15