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/] [reposdlg.cpp] - Blame information for rev 502

Go to most recent revision | 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: reposdlg.cpp,v 1.1.1.1 2004-02-14 13:28:48 phoenix Exp $
34
// Purpose:
35
// Description: Implementation file for ecRepositoryInfoDialog
36
// Requires:
37
// Provides:
38
// See also:
39
// Known bugs:
40
// Usage:
41
//
42
//####DESCRIPTIONEND####
43
//
44
//===========================================================================
45
 
46
#ifdef __GNUG__
47
    #pragma implementation "reposdlg.cpp"
48
#endif
49
 
50
#include "ecpch.h"
51
 
52
#include "wx/wxhtml.h"
53
 
54
#ifdef __BORLANDC__
55
    #pragma hdrstop
56
#endif
57
 
58
#include "reposdlg.h"
59
#include "configtool.h"
60
#include "configtooldoc.h"
61
 
62
//----------------------------------------------------------------------------
63
// ecRepositoryInfoDialog
64
//----------------------------------------------------------------------------
65
 
66
// WDR: event table for ecRepositoryInfoDialog
67
 
68
BEGIN_EVENT_TABLE(ecRepositoryInfoDialog,wxDialog)
69
END_EVENT_TABLE()
70
 
71
ecRepositoryInfoDialog::ecRepositoryInfoDialog( wxWindow *parent, wxWindowID id, const wxString &title,
72
    const wxPoint &position, const wxSize& size, long style ) :
73
    wxDialog( parent, id, title, position, size, style )
74
{
75
    AddControls(this);
76
 
77
    Centre(wxBOTH);
78
}
79
 
80
bool ecRepositoryInfoDialog::AddControls(wxWindow* parent)
81
{
82
#if 0
83
    wxColour backgroundColour = * wxBLACK; // wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
84
    wxColour buttonBackgroundColour = * wxWHITE; // backgroundColour;
85
    wxColour buttonForegroundColour = * wxBLACK; // wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT);
86
 
87
    if (!wxGetApp().GetHiColour())
88
    {
89
        backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
90
        buttonBackgroundColour = backgroundColour;
91
        buttonForegroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT);
92
    }
93
 
94
    this->SetBackgroundColour(backgroundColour);
95
#endif
96
 
97
    wxSize htmlSize(440, 380);
98
 
99
    // Note: in later versions of wxWin this will be fixed so wxRAISED_BORDER
100
    // does the right thing. Meanwhile, this is a workaround.
101
#ifdef __WXMSW__
102
    long borderStyle = wxDOUBLE_BORDER;
103
#else
104
    long borderStyle = wxRAISED_BORDER;
105
#endif
106
 
107
    wxHtmlWindow* html = new wxHtmlWindow(this, ecID_REPOS_DIALOG_HTML_WINDOW, wxDefaultPosition, htmlSize,
108
        borderStyle);
109
    html -> SetBorders(5);
110
 
111
    wxString info;
112
    if (CreateHtmlInfo(info))
113
        html -> SetPage(info);
114
    else
115
    {
116
        wxString msg;
117
        msg.Printf(wxT("<html><head><title>Warning</title></head><body><P>Sorry, could not obtain repository information.<P></body></html>"));
118
        html->SetPage(msg);
119
    }
120
 
121
    //// Start of sizer-based control creation
122
 
123
    wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
124
 
125
    wxWindow *item1 = parent->FindWindow( ecID_REPOS_DIALOG_HTML_WINDOW );
126
    wxASSERT( item1 );
127
    item0->Add( item1, 0, wxALIGN_CENTRE|wxALL, 5 );
128
 
129
    wxButton *item2 = new wxButton( parent, wxID_CANCEL, "&OK", wxDefaultPosition, wxDefaultSize, 0 );
130
#if 0
131
    item2->SetBackgroundColour(buttonBackgroundColour);
132
    item2->SetForegroundColour(buttonForegroundColour);
133
#endif
134
    item2->SetDefault();
135
 
136
    //item0->Add( item2, 0, wxALIGN_CENTER|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
137
    //item0->Add( item2, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
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
bool ecRepositoryInfoDialog::CreateHtmlInfo(wxString& info)
149
{
150
    ecConfigToolDoc* doc = wxGetApp().GetConfigToolDoc();
151
 
152
    info += wxT("<html><head><title>Repository Information</title>\n");
153
    info += wxT("<body bgcolor=\"#FFFFE1\">\n");
154
 
155
    info += wxT("<table width=\"100%\">");
156
    info += wxT("<tr><td>\n");
157
    wxString s;
158
    s.Printf(wxT("<img src=\"memory:ecoslogosmall.png\" align=right vspace=8 border=0><p>"));
159
    info += s;
160
    info += wxT("</td><td>\n");
161
    info += wxT("<font size=+2><b>Repository Information</b></font>\n");
162
 
163
    info += wxT("</td></tr></table>\n");
164
 
165
    info += wxT("<hr>\n");
166
 
167
    ///////////////////////////////////////////////////
168
    info += wxT("<b>Repository path:</b><P>\n");
169
 
170
    info += wxT("<ul>");
171
 
172
    if (doc)
173
    {
174
        info += doc->GetRepository();
175
    }
176
    else
177
    {
178
        info += wxT("Not loaded.");
179
    }
180
 
181
    info += wxT("</ul><P>");
182
 
183
    ///////////////////////////////////////////////////
184
    info += wxT("<b>Save file:</b><P>\n");
185
 
186
    info += wxT("<ul>");
187
 
188
    if (doc)
189
    {
190
        info += doc->GetFilename();
191
    }
192
    else
193
    {
194
        info += wxT("Not loaded.");
195
    }
196
 
197
    info += wxT("</ul><p>");
198
 
199
    ///////////////////////////////////////////////////
200
    info += wxT("<b>Hardware template:</b><P>\n");
201
 
202
    info += wxT("<ul>");
203
 
204
    if (doc)
205
    {
206
        wxString hardware = doc->GetCdlConfig ()->get_hardware ().c_str();
207
 
208
        info += hardware;
209
        info += wxT(" ");
210
 
211
        info += doc->GetTemplateVersion () ;
212
    }
213
    else
214
    {
215
        info += wxT("Unknown.");
216
    }
217
 
218
    info += wxT("</ul><P>");
219
 
220
    ///////////////////////////////////////////////////
221
    info += wxT("<b>Default package:</b><P>\n");
222
 
223
    info += wxT("<ul>");
224
 
225
    if (doc)
226
    {
227
        wxString package = doc->GetCdlConfig ()->get_template ().c_str();
228
 
229
        info += package;
230
    }
231
    else
232
    {
233
        info += wxT("Unknown.");
234
    }
235
 
236
    info += wxT("</ul><P>");
237
 
238
    info += wxT("</body></html>");
239
 
240
    return TRUE;
241
}

powered by: WebSVN 2.1.0

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