Blame view

GUI/SW1/SRC/ABOUT.cpp 5.05 KB
886c558b   Steve Greedy   SACAMOS Public Re...
1
2
3
4
5
6
/////////////////////////////////////////////////////////////////////////////////
//
// This file is part of SACAMOS, cable models for EMI simulations in SPICE.
// It was developed by the University of Nottingham and the Netherlands Aerospace
// Centre (NLR) for ESA under contract number 4000112765/14/NL/HK.
//
7ba34678   Steve Greedy   Update Copyright ...
7
// Copyright (C) 2015 - 2018 University of Nottingham
886c558b   Steve Greedy   SACAMOS Public Re...
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// SACAMOS is free software: you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
// Foundation, either version 3 of the License, or (at your option) any later
// version.
//
// SACAMOS is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.
//
// A copy of the GNU General Public License version 3 can be found in the
// file GNU_GPL_v3 in the root or at <http://www.gnu.org/licenses/>.
//
// wxWidgets is currently licenced under the "wxWindows Library Licence".
// A copy of the wxWindows Library Licence, Version 3.1 can be found in the file
// wxWindows_Library_Licence_v3-1 in the root or at:
// <https://www.wxwidgets.org/about/licence/>
//
// The University of Nottingham can be contacted at: ggiemr@nottingham.ac.uk
//
// File Contents:
//
// NAME
//     ABOUT.cpp
//
// DESCRIPTION
//     About dialogue for SACAMOS
//
// AUTHOR(S)
//     Steve Greedy
//
/////////////////////////////////////////////////////////////////////////////////
#include "ABOUT.h"

#include <wx/textfile.h>
#include <wx/msgdlg.h>
#include <wx/hyperlink.h>

//(*InternalHeaders(ABOUT)
886c558b   Steve Greedy   SACAMOS Public Re...
48
#include <wx/intl.h>
886c558b   Steve Greedy   SACAMOS Public Re...
49
50
51
52
53
#include <wx/string.h>
//*)

//(*IdInit(ABOUT)
const long ABOUT::ID_STATICBITMAP1 = wxNewId();
2a0d305e   Steve Greedy   Modifications to ...
54
const long ABOUT::ID_PANEL1 = wxNewId();
886c558b   Steve Greedy   SACAMOS Public Re...
55
const long ABOUT::ID_TEXTCTRL1 = wxNewId();
2a0d305e   Steve Greedy   Modifications to ...
56
const long ABOUT::ID_TEXTCTRL2 = wxNewId();
886c558b   Steve Greedy   SACAMOS Public Re...
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//*)

BEGIN_EVENT_TABLE(ABOUT,wxDialog)
	//(*EventTable(ABOUT)
	//*)
END_EVENT_TABLE()

ABOUT::ABOUT(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
	//(*Initialize(ABOUT)
	wxStaticBoxSizer* StaticBoxSizer2;
	wxBoxSizer* BoxSizer1;
	wxStaticBoxSizer* StaticBoxSizer1;
	wxFlexGridSizer* FlexGridSizer1;

	Create(parent, wxID_ANY, _("ABOUT SACAMOS"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
	FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0);
	BoxSizer1 = new wxBoxSizer(wxVERTICAL);
2a0d305e   Steve Greedy   Modifications to ...
75
76
77
	Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxSize(400,137), wxTAB_TRAVERSAL, _T("ID_PANEL1"));
	StaticBitmap1 = new wxStaticBitmap(Panel1, ID_STATICBITMAP1, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER, _T("ID_STATICBITMAP1"));
	BoxSizer1->Add(Panel1, 1, wxALL|wxEXPAND, 5);
886c558b   Steve Greedy   SACAMOS Public Re...
78
79
80
81
	StaticBoxSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("LICENSE"));
	TextCtrl1 = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_AUTO_URL|wxTE_WORDWRAP, wxDefaultValidator, _T("ID_TEXTCTRL1"));
	StaticBoxSizer2->Add(TextCtrl1, 1, wxALL|wxEXPAND, 5);
	BoxSizer1->Add(StaticBoxSizer2, 1, wxALL|wxEXPAND, 5);
2a0d305e   Steve Greedy   Modifications to ...
82
83
84
85
	StaticBoxSizer1 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("BUILD"));
	TextCtrl2 = new wxTextCtrl(this, ID_TEXTCTRL2, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_AUTO_URL, wxDefaultValidator, _T("ID_TEXTCTRL2"));
	StaticBoxSizer1->Add(TextCtrl2, 1, wxALL|wxEXPAND, 5);
	BoxSizer1->Add(StaticBoxSizer1, 1, wxALL|wxEXPAND, 5);
886c558b   Steve Greedy   SACAMOS Public Re...
86
87
88
89
90
	FlexGridSizer1->Add(BoxSizer1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	SetSizer(FlexGridSizer1);
	FlexGridSizer1->Fit(this);
	FlexGridSizer1->SetSizeHints(this);

886c558b   Steve Greedy   SACAMOS Public Re...
91
	Connect(ID_TEXTCTRL1,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&ABOUT::OnTextCtrl1Text);
2a0d305e   Steve Greedy   Modifications to ...
92
	Connect(ID_TEXTCTRL2,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&ABOUT::OnTextCtrl2Text);
886c558b   Steve Greedy   SACAMOS Public Re...
93
94
	Connect(wxID_ANY,wxEVT_INIT_DIALOG,(wxObjectEventFunction)&ABOUT::OnInit);
	//*)
2a0d305e   Steve Greedy   Modifications to ...
95
96
97
98

	StaticBitmap1->SetBitmap(wxBitmap(wxImage(_T("resources/Sacamos_About.png"))));


886c558b   Steve Greedy   SACAMOS Public Re...
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
}

ABOUT::~ABOUT()
{
	//(*Destroy(ABOUT)
	//*)
}

void ABOUT::DisplayLicenseFile()
{
    wxString LicenseFileName = "resources/License";
    wxString text;
    wxTextFile LicenseFile;

    //int lineCount = LicenseFile.GetLineCount();

    if (LicenseFile.Open(LicenseFileName))
    {
        for (int i = 0; i<int(LicenseFile.GetLineCount()); i++)
        {
            text = text + LicenseFile[i];

            text = text + "\n";
        }
    TextCtrl1->SetValue(text);
    }

f309591f   Steve Greedy   Update to SW1
126
127
    LicenseFile.Close();

886c558b   Steve Greedy   SACAMOS Public Re...
128
129
130
131
132
133
134
135
136
137
}

void ABOUT::DisplayBuildFile()
{
    wxString BuildFileName = "resources/Build";
    wxString text;
    wxTextFile BuildFile;

    if (BuildFile.Open(BuildFileName))
    {
7ba34678   Steve Greedy   Update Copyright ...
138
        for (int i = 0; i<8; i++)
886c558b   Steve Greedy   SACAMOS Public Re...
139
140
141
142
143
144
        {
            text = text + BuildFile[i];

            text = text + "\n";
        }
    TextCtrl2->SetValue(text);
886c558b   Steve Greedy   SACAMOS Public Re...
145
    }
f309591f   Steve Greedy   Update to SW1
146
147

    BuildFile.Close();
886c558b   Steve Greedy   SACAMOS Public Re...
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
}

void ABOUT::OnInit(wxInitDialogEvent& event)
{

    DisplayLicenseFile();

    DisplayBuildFile();

}

void ABOUT::OnTextCtrl1Text(wxCommandEvent& event)
{

}

void ABOUT::OnTextCtrl2Text(wxCommandEvent& event)
{
}