OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [host/] [tools/] [configtool/] [standalone/] [wxwin/] [reposdlg.cpp] - Blame information for rev 817

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
// ####ECOSHOSTGPLCOPYRIGHTBEGIN####                                        
2
// -------------------------------------------                              
3
// This file is part of the eCos host tools.                                
4
// Copyright (C) 1998, 1999, 2000, 2006 Free Software Foundation, Inc.      
5
//
6
// This program is free software; you can redistribute it and/or modify     
7
// it under the terms of the GNU General Public License as published by     
8
// the Free Software Foundation; either version 2 or (at your option) any   
9
// later version.                                                           
10
//
11
// This program is distributed in the hope that it will be useful, but      
12
// WITHOUT ANY WARRANTY; without even the implied warranty of               
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        
14
// General Public License for more details.                                 
15
//
16
// You should have received a copy of the GNU General Public License        
17
// along with this program; if not, write to the                            
18
// Free Software Foundation, Inc., 51 Franklin Street,                      
19
// Fifth Floor, Boston, MA  02110-1301, USA.                                
20
// -------------------------------------------                              
21
// ####ECOSHOSTGPLCOPYRIGHTEND####                                          
22
// appsettings.cpp :
23
//
24
//===========================================================================
25
//#####DESCRIPTIONBEGIN####
26
//
27
// Author(s):   julians
28
// Contact(s):  julians
29
// Date:        2000/09/11
30
// Version:     $Id: reposdlg.cpp,v 1.5 2002/01/02 14:28:55 julians Exp $
31
// Purpose:
32
// Description: Implementation file for ecRepositoryInfoDialog
33
// Requires:
34
// Provides:
35
// See also:
36
// Known bugs:
37
// Usage:
38
//
39
//####DESCRIPTIONEND####
40
//
41
//===========================================================================
42
 
43
#ifdef __GNUG__
44
    #pragma implementation "reposdlg.cpp"
45
#endif
46
 
47
#include "ecpch.h"
48
 
49
#include "wx/wxhtml.h"
50
 
51
#ifdef __BORLANDC__
52
    #pragma hdrstop
53
#endif
54
 
55
#include "reposdlg.h"
56
#include "configtool.h"
57
#include "configtooldoc.h"
58
 
59
//----------------------------------------------------------------------------
60
// ecRepositoryInfoDialog
61
//----------------------------------------------------------------------------
62
 
63
// WDR: event table for ecRepositoryInfoDialog
64
 
65
BEGIN_EVENT_TABLE(ecRepositoryInfoDialog,wxDialog)
66
END_EVENT_TABLE()
67
 
68
ecRepositoryInfoDialog::ecRepositoryInfoDialog( wxWindow *parent, wxWindowID id, const wxString &title,
69
    const wxPoint &position, const wxSize& size, long style ) :
70
    wxDialog( parent, id, title, position, size, style )
71
{
72
    AddControls(this);
73
 
74
    Centre(wxBOTH);
75
}
76
 
77
bool ecRepositoryInfoDialog::AddControls(wxWindow* parent)
78
{
79
#if 0
80
    wxColour backgroundColour = * wxBLACK; // wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
81
    wxColour buttonBackgroundColour = * wxWHITE; // backgroundColour;
82
    wxColour buttonForegroundColour = * wxBLACK; // wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT);
83
 
84
    if (!wxGetApp().GetHiColour())
85
    {
86
        backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
87
        buttonBackgroundColour = backgroundColour;
88
        buttonForegroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT);
89
    }
90
 
91
    this->SetBackgroundColour(backgroundColour);
92
#endif
93
 
94
    wxSize htmlSize(440, 380);
95
 
96
    // Note: in later versions of wxWin this will be fixed so wxRAISED_BORDER
97
    // does the right thing. Meanwhile, this is a workaround.
98
#ifdef __WXMSW__
99
    long borderStyle = wxDOUBLE_BORDER;
100
#else
101
    long borderStyle = wxRAISED_BORDER;
102
#endif
103
 
104
    wxHtmlWindow* html = new wxHtmlWindow(this, ecID_REPOS_DIALOG_HTML_WINDOW, wxDefaultPosition, htmlSize,
105
        borderStyle);
106
    html -> SetBorders(5);
107
 
108
    wxString info;
109
    if (CreateHtmlInfo(info))
110
        html -> SetPage(info);
111
    else
112
    {
113
        wxString msg;
114
        msg.Printf(wxT("<html><head><title>Warning</title></head><body><P>Sorry, could not obtain repository information.<P></body></html>"));
115
        html->SetPage(msg);
116
    }
117
 
118
    //// Start of sizer-based control creation
119
 
120
    wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
121
 
122
    wxWindow *item1 = parent->FindWindow( ecID_REPOS_DIALOG_HTML_WINDOW );
123
    wxASSERT( item1 );
124
    item0->Add( item1, 0, wxALIGN_CENTRE|wxALL, 5 );
125
 
126
    wxButton *item2 = new wxButton( parent, wxID_CANCEL, "&OK", wxDefaultPosition, wxDefaultSize, 0 );
127
#if 0
128
    item2->SetBackgroundColour(buttonBackgroundColour);
129
    item2->SetForegroundColour(buttonForegroundColour);
130
#endif
131
    item2->SetDefault();
132
 
133
    //item0->Add( item2, 0, wxALIGN_CENTER|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
134
    //item0->Add( item2, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
135
    item0->Add( item2, 0, wxALIGN_RIGHT|wxALL, 10 );
136
 
137
    parent->SetAutoLayout( TRUE );
138
    parent->SetSizer( item0 );
139
    parent->Layout();
140
    item0->Fit( parent );
141
    item0->SetSizeHints( parent );
142
    return TRUE;
143
}
144
 
145
bool ecRepositoryInfoDialog::CreateHtmlInfo(wxString& info)
146
{
147
    ecConfigToolDoc* doc = wxGetApp().GetConfigToolDoc();
148
 
149
    info += wxT("<html><head><title>Repository Information</title>\n");
150
    info += wxT("<body bgcolor=\"#FFFFE1\">\n");
151
 
152
    info += wxT("<table width=\"100%\">");
153
    info += wxT("<tr><td>\n");
154
    wxString s;
155
    s.Printf(wxT("<img src=\"memory:ecoslogosmall.png\" align=right vspace=8 border=0><p>"));
156
    info += s;
157
    info += wxT("</td><td>\n");
158
    info += wxT("<font size=+2><b>Repository Information</b></font>\n");
159
 
160
    info += wxT("</td></tr></table>\n");
161
 
162
    info += wxT("<hr>\n");
163
 
164
    ///////////////////////////////////////////////////
165
    info += wxT("<b>Repository path:</b><P>\n");
166
 
167
    info += wxT("<ul>");
168
 
169
    if (doc)
170
    {
171
        info += doc->GetRepository();
172
    }
173
    else
174
    {
175
        info += wxT("Not loaded.");
176
    }
177
 
178
    info += wxT("</ul><P>");
179
 
180
    ///////////////////////////////////////////////////
181
    info += wxT("<b>Save file:</b><P>\n");
182
 
183
    info += wxT("<ul>");
184
 
185
    if (doc)
186
    {
187
        info += doc->GetFilename();
188
    }
189
    else
190
    {
191
        info += wxT("Not loaded.");
192
    }
193
 
194
    info += wxT("</ul><p>");
195
 
196
    ///////////////////////////////////////////////////
197
    info += wxT("<b>Hardware template:</b><P>\n");
198
 
199
    info += wxT("<ul>");
200
 
201
    if (doc)
202
    {
203
        wxString hardware = doc->GetCdlConfig ()->get_hardware ().c_str();
204
 
205
        info += hardware;
206
        info += wxT(" ");
207
 
208
        info += doc->GetTemplateVersion () ;
209
    }
210
    else
211
    {
212
        info += wxT("Unknown.");
213
    }
214
 
215
    info += wxT("</ul><P>");
216
 
217
    ///////////////////////////////////////////////////
218
    info += wxT("<b>Packages template:</b><P>\n");
219
 
220
    info += wxT("<ul>");
221
 
222
    if (doc)
223
    {
224
        wxString package = doc->GetCdlConfig ()->get_template ().c_str();
225
 
226
        info += package;
227
    }
228
    else
229
    {
230
        info += wxT("Unknown.");
231
    }
232
 
233
    info += wxT("</ul><P>");
234
 
235
    info += wxT("</body></html>");
236
 
237
    return TRUE;
238
}

powered by: WebSVN 2.1.0

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