OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [tools/] [configtool/] [standalone/] [wxwin/] [aboutdlg.cpp] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 26 unneback
//####COPYRIGHTBEGIN####
2
//
3
// ----------------------------------------------------------------------------
4
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5
//
6
// This program is part of the eCos host tools.
7
//
8
// This program is free software; you can redistribute it and/or modify it
9
// under the terms of the GNU General Public License as published by the Free
10
// Software Foundation; either version 2 of the License, or (at your option)
11
// any later version.
12
//
13
// This program is distributed in the hope that it will be useful, but WITHOUT
14
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
16
// more details.
17
//
18
// You should have received a copy of the GNU General Public License along with
19
// this program; if not, write to the Free Software Foundation, Inc.,
20
// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21
//
22
// ----------------------------------------------------------------------------
23
//
24
//####COPYRIGHTEND####
25
// appsettings.cpp :
26
//
27
//===========================================================================
28
//#####DESCRIPTIONBEGIN####
29
//
30
// Author(s):   julians
31
// Contact(s):  julians
32
// Date:        2000/09/11
33
// Version:     $Id: aboutdlg.cpp,v 1.1.1.1 2004-02-14 13:28:49 phoenix Exp $
34
// Purpose:
35
// Description: Implementation file for ecAboutDialog
36
// Requires:
37
// Provides:
38
// See also:
39
// Known bugs:
40
// Usage:
41
//
42
//####DESCRIPTIONEND####
43
//
44
//===========================================================================
45
 
46
#ifdef __GNUG__
47
    #pragma implementation "aboutdlg.cpp"
48
#endif
49
 
50
#include "ecpch.h"
51
 
52
#include "wx/wxhtml.h"
53
#include "wx/datetime.h"
54
#include "wx/file.h"
55
#include "wx/fs_mem.h"
56
 
57
#ifdef __BORLANDC__
58
    #pragma hdrstop
59
#endif
60
 
61
#include "aboutdlg.h"
62
#include "configtool.h"
63
#include "symbols.h"
64
 
65
//----------------------------------------------------------------------------
66
// ecAboutDialog
67
//----------------------------------------------------------------------------
68
 
69
// WDR: event table for ecAboutDialog
70
 
71
BEGIN_EVENT_TABLE(ecAboutDialog,wxDialog)
72
END_EVENT_TABLE()
73
 
74
ecAboutDialog::ecAboutDialog( wxWindow *parent, wxWindowID id, const wxString &title,
75
    const wxPoint &position, const wxSize& size, long style ) :
76
    wxDialog( parent, id, title, position, size, style )
77
{
78
    AddControls(this);
79
 
80
    Centre(wxBOTH);
81
}
82
 
83
bool ecAboutDialog::AddControls(wxWindow* parent)
84
{
85
    wxString htmlText;
86
 
87
    if (!wxGetApp().GetMemoryTextResource(wxT("about.htm"), htmlText))
88
    {
89
        wxSetWorkingDirectory(wxGetApp().GetAppDir());
90
        wxString htmlFile(wxGetApp().GetFullAppPath(wxT("about.htm")));
91
 
92
        if (wxFileExists(htmlFile))
93
        {
94
            wxFile file;
95
            file.Open(htmlFile, wxFile::read);
96
            long len = file.Length();
97
            char* buf = htmlText.GetWriteBuf(len + 1);
98
            file.Read(buf, len);
99
            buf[len] = 0;
100
            htmlText.UngetWriteBuf();
101
        }
102
    }
103
 
104
    if (htmlText.IsEmpty())
105
    {
106
        htmlText.Printf(wxT("<html><head><title>Warning</title></head><body><P>Sorry, could not find resource for About dialog<P></body></html>"));
107
    }
108
 
109
    // Customize the HTML
110
    htmlText.Replace(wxT("$VERSION$"), ecCONFIGURATION_TOOL_VERSION);
111
    htmlText.Replace(wxT("$DATE$"), __DATE__);
112
 
113
    wxSize htmlSize(420, 390);
114
 
115
    // Note: in later versions of wxWin this will be fixed so wxRAISED_BORDER
116
    // does the right thing. Meanwhile, this is a workaround.
117
#ifdef __WXMSW__
118
    long borderStyle = wxDOUBLE_BORDER;
119
#else
120
    long borderStyle = wxRAISED_BORDER;
121
#endif
122
 
123
    wxHtmlWindow* html = new wxHtmlWindow(this, ecID_ABOUT_DIALOG_HTML_WINDOW, wxDefaultPosition, htmlSize, borderStyle);
124
    html -> SetBorders(0);
125
    html -> SetPage(htmlText);
126
 
127
    //// Start of sizer-based control creation
128
 
129
    wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
130
 
131
    wxWindow *item1 = parent->FindWindow( ecID_ABOUT_DIALOG_HTML_WINDOW );
132
    wxASSERT( item1 );
133
    item0->Add( item1, 0, wxALIGN_CENTRE|wxALL, 5 );
134
 
135
    wxButton *item2 = new wxButton( parent, wxID_CANCEL, "&OK", wxDefaultPosition, wxDefaultSize, 0 );
136
    item2->SetDefault();
137
 
138
    item0->Add( item2, 0, wxALIGN_RIGHT|wxALL, 10 );
139
 
140
    parent->SetAutoLayout( TRUE );
141
    parent->SetSizer( item0 );
142
    parent->Layout();
143
    item0->Fit( parent );
144
    item0->SetSizeHints( parent );
145
    return TRUE;
146
}
147
 
148
/*
149
 * ecSplashScreen.
150
 */
151
 
152
 
153
ecSplashScreen::ecSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style):
154
    wxSplashScreen(bitmap, splashStyle, milliseconds, parent, id, pos, size, style)
155
{
156
}
157
 
158
ecSplashScreen::~ecSplashScreen()
159
{
160
    wxGetApp().m_splashScreen = NULL;
161
}
162
 
163
 
164
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.