Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
ee0cd0ba255637d545a4c416984e3e0bd0a1c4b6
[xestiacalendar/.git] / source / main.cpp
1 // main.cpp - Main subroutine (application start).
2 //
3 // (c) 2012-2017 Xestia Software Development.
4 //
5 // This file is part of Xestia Calendar.
6 //
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.
10 //
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.
15 //
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/> 
19 #include <stdlib.h>
21 #include <wx/wx.h>
22 #include <wx/icon.h>
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>
29 #include "version.h"
30 #include "bitmaps.h"
31 #include "forms/main/frmMain.h"
32 #include "forms/actmgr/frmActivityMgr.h"
33 #include "defaults.h"
35 class XestiaCALApp: public wxApp
36 {
37     virtual bool OnInit();
38 };
40 IMPLEMENT_APP(XestiaCALApp);
42 bool XestiaCALApp::OnInit()
43 {
45         wxInitAllImageHandlers();
46         
47         static const wxCmdLineEntryDesc g_cmdLineDesc [] =
48         {
49                 { wxCMD_LINE_SWITCH, "h", "help", "Displays help on command line parameters",
50                         wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
51                 { wxCMD_LINE_SWITCH, "v", "version", "Displays version number",
52                         wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
53                 { wxCMD_LINE_NONE }
54         };
55         
56         // Setup the locale.
58         wxLocale locale;
59         locale.Init(wxLANGUAGE_DEFAULT, wxLOCALE_LOAD_DEFAULT);
60         
61         wxCmdLineParser XCALArgs (g_cmdLineDesc, argc, argv);
62         XCALArgs.Parse();
63         
64         if (XCALArgs.Found(wxT("h"))){
65     
66                 // Print out the list of help commands.
67     
68                 return false;
69     
70         }
71         
72         if (XCALArgs.Found(wxT("v"))){
73     
74                 // Print out the version number.    
76                 wxPuts(XSDCAL_VERSION);
77                 return false;
78     
79         }
80         
81         // Setup the default accounts.
82         
83         SetupDirectories();
84         SetupDefaultSettings();
85         SetupDefaultCalendar();
86         
87         // Setup the main form.
88         
89         frmMain *frameMain = new frmMain( NULL );
90         
91         wxMemoryInputStream istream(bigimgs_appicon48_png, sizeof(bigimgs_appicon48_png));
92         wxImage bigimgs_appicon48i(istream, wxBITMAP_TYPE_PNG);
93         wxBitmap appIconBMP(bigimgs_appicon48i, -1);    
94         wxIcon appIcon;
95     
96         appIcon.CopyFromBitmap(appIconBMP);
97         
98         // Setup the activity manager.
99         
100         frmActivityMgr *frameActMgr = new frmActivityMgr ( frameMain );
101         
102         frameMain->SetIcon(appIcon);
103         frameMain->Show(true);
104         frameMain->SetupPointers(frameActMgr);
105         
106         SetTopWindow(frameMain);
107         
108         return true;
109         
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy