1 // main.cpp - Main subroutine (application start).
3 // (c) 2012-2017 Xestia Software Development.
5 // This file is part of Xestia Calendar.
7 // Xestia Calendar is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Calendar is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
23 #include <wx/mstream.h>
24 #include <wx/cmdline.h>
25 #include <wx/wxprec.h>
26 #include <wx/filename.h>
27 #include <curl/curl.h>
31 #include "forms/main/frmMain.h"
32 #include "forms/actmgr/frmActivityMgr.h"
36 #include "common/win32ssl.h"
39 class XestiaCALApp: public wxApp
41 virtual bool OnInit();
44 IMPLEMENT_APP(XestiaCALApp);
46 bool XestiaCALApp::OnInit()
49 wxInitAllImageHandlers();
51 static const wxCmdLineEntryDesc g_cmdLineDesc [] =
53 { wxCMD_LINE_SWITCH, "h", "help", "Displays help on command line parameters",
54 wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
55 { wxCMD_LINE_SWITCH, "v", "version", "Displays version number",
56 wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
63 locale.Init(wxLANGUAGE_DEFAULT, wxLOCALE_LOAD_DEFAULT);
65 wxCmdLineParser XCALArgs (g_cmdLineDesc, argc, argv);
68 if (XCALArgs.Found(wxT("h"))){
70 // Print out the list of help commands.
76 if (XCALArgs.Found(wxT("v"))){
78 // Print out the version number.
80 wxPuts(XSDCAL_VERSION);
85 // Setup the default accounts.
88 SetupDefaultSettings();
89 SetupDefaultCalendar();
91 // Setup the main form.
93 frmMain *frameMain = new frmMain( NULL );
95 wxMemoryInputStream istream(bigimgs_appicon48_png, sizeof(bigimgs_appicon48_png));
96 wxImage bigimgs_appicon48i(istream, wxBITMAP_TYPE_PNG);
97 wxBitmap appIconBMP(bigimgs_appicon48i, -1);
100 appIcon.CopyFromBitmap(appIconBMP);
102 // Setup the activity manager.
104 frmActivityMgr *frameActMgr = new frmActivityMgr ( frameMain );
106 frameMain->SetIcon(appIcon);
107 frameMain->Show(true);
108 frameMain->SetupPointers(frameActMgr);
110 SetTopWindow(frameMain);