source: eviacam/trunk/fuentes/src/wabout.cpp @ 29

Last change on this file since 29 was 29, checked in by mabarracus, 4 years ago

added eviacam content

File size: 6.8 KB
Line 
1/////////////////////////////////////////////////////////////////////////////
2// Name:        wabout.cpp
3// Purpose: 
4// Author:      Cesar Mauri Loba (cesar at crea-si dot com)
5// Modified by:
6// Created:     
7// Copyright:   (C) 2008-11 Cesar Mauri Loba - CREA Software Systems
8//
9//  This program is free software: you can redistribute it and/or modify
10//  it under the terms of the GNU General Public License as published by
11//  the Free Software Foundation, either version 3 of the License, or
12//  (at your option) any later version.
13//
14//  This program is distributed in the hope that it will be useful,
15//  but WITHOUT ANY WARRANTY; without even the implied warranty of
16//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17//  GNU General Public License for more details.
18//
19//  You should have received a copy of the GNU General Public License
20//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21/////////////////////////////////////////////////////////////////////////////
22
23// For compilers that support precompilation, includes "wx/wx.h".
24#include "wx/wxprec.h"
25
26#ifdef __BORLANDC__
27#pragma hdrstop
28#endif
29
30#ifndef WX_PRECOMP
31#include "wx/wx.h"
32#endif
33
34////@begin includes
35////@end includes
36
37#include <wx/stdpaths.h>
38#include <wx/textfile.h>
39#include "wabout.h"
40#include "eviacamapp.h"
41#include "viacamcontroller.h"
42#include "version.h"
43#include "paths.h"
44#include "website.h"
45
46////@begin XPM images
47////@end XPM images
48
49
50/*!
51 * WAbout type definition
52 */
53
54IMPLEMENT_DYNAMIC_CLASS( WAbout, wxDialog )
55
56
57/*!
58 * WAbout event table definition
59 */
60
61BEGIN_EVENT_TABLE( WAbout, wxDialog )
62
63////@begin WAbout event table entries
64    EVT_HTML_LINK_CLICKED( ID_HTMLWINDOW, WAbout::OnHtmlwindowLinkClicked )
65
66    EVT_BUTTON( ID_BUTTON_CLOSE, WAbout::OnButtonCloseClick )
67
68////@end WAbout event table entries
69
70END_EVENT_TABLE()
71
72
73/*!
74 * WAbout constructors
75 */
76
77WAbout::WAbout()
78{
79    Init();
80}
81
82WAbout::WAbout( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
83{
84    Init();
85    Create(parent, id, caption, pos, size, style);
86}
87
88
89/*!
90 * WAbout creator
91 */
92
93bool WAbout::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
94{
95////@begin WAbout creation
96    SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
97    wxDialog::Create( parent, id, caption, pos, size, style );
98
99    CreateControls();
100    if (GetSizer())
101    {
102        GetSizer()->SetSizeHints(this);
103    }
104    Centre();
105////@end WAbout creation
106    return true;
107}
108
109
110/*!
111 * WAbout destructor
112 */
113
114WAbout::~WAbout()
115{
116////@begin WAbout destruction
117////@end WAbout destruction
118}
119
120
121/*!
122 * Member initialisation
123 */
124
125void WAbout::Init()
126{
127////@begin WAbout member initialisation
128////@end WAbout member initialisation
129}
130
131
132/*!
133 * Control creation for WAbout
134 */
135
136void WAbout::CreateControls()
137{   
138////@begin WAbout content construction
139    WAbout* itemDialog1 = this;
140
141    wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
142    itemDialog1->SetSizer(itemBoxSizer2);
143
144    wxHtmlWindow* itemHtmlWindow3 = new wxHtmlWindow( itemDialog1, ID_HTMLWINDOW, wxDefaultPosition, wxSize(600, 450), wxHW_SCROLLBAR_AUTO|wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
145    itemBoxSizer2->Add(itemHtmlWindow3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
146
147    wxButton* itemButton4 = new wxButton( itemDialog1, ID_BUTTON_CLOSE, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
148    itemBoxSizer2->Add(itemButton4, 0, wxALIGN_RIGHT|wxALL, 5);
149
150////@end WAbout content construction
151
152        wxString page(_T("\
153                <body bgcolor='#F8F8F8'> \
154                <font face='Arial, Helvetica, sans-serif' size='+1'> \
155                <img src='#DATA_PATH#/eviacam_logo.png' width='303' height='100'/> \
156                <hr align='center' size='1'/> \
157                <strong>Enable Viacam &mdash; v#APPVERSION#</strong><br> \
158        "));
159        page.Append(_("A webcam based mouse emulator"));
160        page.Append(_T("<p>"));
161        page.Append(wxString(COPYRIGHT, wxConvUTF8));
162        page.Append(_T(" "));
163        page.Append(wxString(PUBLISHER, wxConvUTF8));
164        page.Append(_T("<p>"));
165        page.Append(_("If you find this software useful then please consider \
166                <a href='donation'>making a small donation</a> to show your appreciation \
167                and help support the continued development. Thanks!\
168        "));
169        page.Append(_T("</p><p><a href='website'>"));
170        page.Append(_("Visit website"));
171        page.Append(_T("</a></p> \
172                <hr align='center' size='1'/> \
173                <strong> \
174        "));
175        page.Append(_("Thanks"));
176        page.Append(_T("</strong> \
177                <center><p><img src='#DATA_PATH#/fve.png' border='1' align='middle'> &nbsp;&nbsp; \
178                <img src='#DATA_PATH#/guadalinfo_logo.png' border='1' align='middle'></p></center> \
179                <center><p><img src='#DATA_PATH#/stsi_logo.png' width='200' height='57' border='1' align='middle'>&nbsp;&nbsp; \
180                <img src='#DATA_PATH#/appc_logo.png' width='200' height='57' border='1' align='middle'> </p></center> \
181                </font> \
182                <font size='+0'><p> \
183        "));
184
185        wxTextFile thanksFile(eviacam::GetDataDir() + wxString(_T("/THANKS")));
186
187        if (thanksFile.Open())
188        {
189                wxString str;
190
191                for ( str = thanksFile.GetFirstLine(); !thanksFile.Eof(); str = thanksFile.GetNextLine() )
192                {       page.Append (str);
193                        page.Append (_T("<br>"));
194                }
195        }
196       
197        page.Append(_T("</p></font> \
198                <hr align='center' size='1'/> \
199                <font face='Arial, Helvetica, sans-serif' size='+1'> \
200                <strong> \
201        "));
202        page.Append(_("License"));
203        page.Append(_T("</strong> \
204                <p>\
205        "));
206        page.Append(_("Released under the GNU/GPL v3 license. See COPYING file for details."));
207        page.Append(_T("</p> \
208                </font> \
209                </body> \
210        "));
211       
212        page.Replace (_T("#DATA_PATH#"), eviacam::GetDataDir(), true);
213        page.Replace (_T("#APPVERSION#"), _T(VERSION), true);
214
215        itemHtmlWindow3->SetPage(page);
216}
217
218
219/*!
220 * Should we show tooltips?
221 */
222
223bool WAbout::ShowToolTips()
224{
225    return true;
226}
227
228/*!
229 * Get bitmap resources
230 */
231
232wxBitmap WAbout::GetBitmapResource( const wxString& name )
233{
234    // Bitmap retrieval
235////@begin WAbout bitmap retrieval
236    wxUnusedVar(name);
237    return wxNullBitmap;
238////@end WAbout bitmap retrieval
239}
240
241/*!
242 * Get icon resources
243 */
244
245wxIcon WAbout::GetIconResource( const wxString& name )
246{
247    // Icon retrieval
248////@begin WAbout icon retrieval
249    wxUnusedVar(name);
250    return wxNullIcon;
251////@end WAbout icon retrieval
252}
253
254
255/*!
256 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_CLOSE
257 */
258
259void WAbout::OnButtonCloseClick( wxCommandEvent& WXUNUSED(event) )
260{
261////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_CLOSE in WAbout.
262    // Before editing this code, remove the block markers.
263    EndModal(ID_BUTTON_CLOSE);
264////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_CLOSE in WAbout.
265}
266
267
268
269
270/*!
271 * wxEVT_COMMAND_HTML_LINK_CLICKED event handler for ID_HTMLWINDOW
272 */
273
274void WAbout::OnHtmlwindowLinkClicked( wxHtmlLinkEvent& event )
275{
276        if (!event.GetLinkInfo().GetHref().CmpNoCase(_T("donation")))
277                eviacam::OpenDonationsEViacamWebsiteOnBrowser();
278        else
279                eviacam::OpenEViacamWebsiteOnBrowser();
280
281        event.Skip(false);
282}
283
Note: See TracBrowser for help on using the repository browser.