1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
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)
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
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.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
27 //===========================================================================
28 //#####DESCRIPTIONBEGIN####
31 // Contact(s): julians
33 // Version: $Id: reposdlg.cpp,v 1.5 2002/01/02 14:28:55 julians Exp $
35 // Description: Implementation file for ecRepositoryInfoDialog
42 //####DESCRIPTIONEND####
44 //===========================================================================
47 #pragma implementation "reposdlg.cpp"
52 #include "wx/wxhtml.h"
59 #include "configtool.h"
60 #include "configtooldoc.h"
62 //----------------------------------------------------------------------------
63 // ecRepositoryInfoDialog
64 //----------------------------------------------------------------------------
66 // WDR: event table for ecRepositoryInfoDialog
68 BEGIN_EVENT_TABLE(ecRepositoryInfoDialog,wxDialog)
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 )
80 bool ecRepositoryInfoDialog::AddControls(wxWindow* parent)
83 wxColour backgroundColour = * wxBLACK; // wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
84 wxColour buttonBackgroundColour = * wxWHITE; // backgroundColour;
85 wxColour buttonForegroundColour = * wxBLACK; // wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT);
87 if (!wxGetApp().GetHiColour())
89 backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
90 buttonBackgroundColour = backgroundColour;
91 buttonForegroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNTEXT);
94 this->SetBackgroundColour(backgroundColour);
97 wxSize htmlSize(440, 380);
99 // Note: in later versions of wxWin this will be fixed so wxRAISED_BORDER
100 // does the right thing. Meanwhile, this is a workaround.
102 long borderStyle = wxDOUBLE_BORDER;
104 long borderStyle = wxRAISED_BORDER;
107 wxHtmlWindow* html = new wxHtmlWindow(this, ecID_REPOS_DIALOG_HTML_WINDOW, wxDefaultPosition, htmlSize,
109 html -> SetBorders(5);
112 if (CreateHtmlInfo(info))
113 html -> SetPage(info);
117 msg.Printf(wxT("<html><head><title>Warning</title></head><body><P>Sorry, could not obtain repository information.<P></body></html>"));
121 //// Start of sizer-based control creation
123 wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
125 wxWindow *item1 = parent->FindWindow( ecID_REPOS_DIALOG_HTML_WINDOW );
127 item0->Add( item1, 0, wxALIGN_CENTRE|wxALL, 5 );
129 wxButton *item2 = new wxButton( parent, wxID_CANCEL, "&OK", wxDefaultPosition, wxDefaultSize, 0 );
131 item2->SetBackgroundColour(buttonBackgroundColour);
132 item2->SetForegroundColour(buttonForegroundColour);
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 );
140 parent->SetAutoLayout( TRUE );
141 parent->SetSizer( item0 );
143 item0->Fit( parent );
144 item0->SetSizeHints( parent );
148 bool ecRepositoryInfoDialog::CreateHtmlInfo(wxString& info)
150 ecConfigToolDoc* doc = wxGetApp().GetConfigToolDoc();
152 info += wxT("<html><head><title>Repository Information</title>\n");
153 info += wxT("<body bgcolor=\"#FFFFE1\">\n");
155 info += wxT("<table width=\"100%\">");
156 info += wxT("<tr><td>\n");
158 s.Printf(wxT("<img src=\"memory:ecoslogosmall.png\" align=right vspace=8 border=0><p>"));
160 info += wxT("</td><td>\n");
161 info += wxT("<font size=+2><b>Repository Information</b></font>\n");
163 info += wxT("</td></tr></table>\n");
165 info += wxT("<hr>\n");
167 ///////////////////////////////////////////////////
168 info += wxT("<b>Repository path:</b><P>\n");
174 info += doc->GetRepository();
178 info += wxT("Not loaded.");
181 info += wxT("</ul><P>");
183 ///////////////////////////////////////////////////
184 info += wxT("<b>Save file:</b><P>\n");
190 info += doc->GetFilename();
194 info += wxT("Not loaded.");
197 info += wxT("</ul><p>");
199 ///////////////////////////////////////////////////
200 info += wxT("<b>Hardware template:</b><P>\n");
206 wxString hardware = doc->GetCdlConfig ()->get_hardware ().c_str();
211 info += doc->GetTemplateVersion () ;
215 info += wxT("Unknown.");
218 info += wxT("</ul><P>");
220 ///////////////////////////////////////////////////
221 info += wxT("<b>Default package:</b><P>\n");
227 wxString package = doc->GetCdlConfig ()->get_template ().c_str();
233 info += wxT("Unknown.");
236 info += wxT("</ul><P>");
238 info += wxT("</body></html>");