X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/67a9999283b942053259fa418fe994eab8dd0b3b..701fb11eb5c1b04cd903e630e345c977a820e0b6:/demos/forty/forty.cpp diff --git a/demos/forty/forty.cpp b/demos/forty/forty.cpp index 82f6e11ae4..c71d8a241d 100644 --- a/demos/forty/forty.cpp +++ b/demos/forty/forty.cpp @@ -33,7 +33,7 @@ #include "scoredg.h" #if wxUSE_HTML -#include "wx/file.h" +#include "wx/textfile.h" #include "wx/html/htmlwin.h" #endif @@ -75,6 +75,13 @@ FortyApp::~FortyApp() bool FortyApp::OnInit() { bool largecards = false; +#ifndef __WXWINCE__ + m_helpFile = wxGetCwd() + wxFILE_SEP_PATH + wxT("about.htm"); + if (!wxFileExists(m_helpFile)) +#endif + { + m_helpFile = wxPathOnly(argv[0]) + wxFILE_SEP_PATH + wxT("about.htm"); + } wxSize size(668,510); @@ -233,7 +240,7 @@ void FortyFrame::Help(wxCommandEvent& event) { #if wxUSE_HTML - if (wxFileExists(wxT("about.htm"))) + if (wxFileExists(wxGetApp().GetHelpFile())) { FortyAboutDialog dialog(this, wxID_ANY, wxT("Forty Thieves Instructions")); if (dialog.ShowModal() == wxID_OK) @@ -324,22 +331,16 @@ bool FortyAboutDialog::AddControls(wxWindow* parent) { #if wxUSE_HTML wxString htmlText; - wxString htmlFile(wxT("about.htm")); + wxString htmlFile = wxGetApp().GetHelpFile(); - //if (!wxGetApp().GetMemoryTextResource(wxT("about.htm"), htmlText)) { -// wxSetWorkingDirectory(wxGetApp().GetAppDir()); -// wxString htmlFile(wxGetApp().GetFullAppPath(wxT("about.htm"))); - - if (wxFileExists(htmlFile)) + wxTextFile file(htmlFile); + if (file.Exists()) { - wxFile file; - file.Open(htmlFile, wxFile::read); - long len = file.Length(); - wxChar* buf = htmlText.GetWriteBuf(len + 1); - file.Read(buf, len); - buf[len] = 0; - htmlText.UngetWriteBuf(); + file.Open(); + for ( htmlText = file.GetFirstLine(); + !file.Eof(); + htmlText << file.GetNextLine() << _T("\n") ) ; } } @@ -349,11 +350,6 @@ bool FortyAboutDialog::AddControls(wxWindow* parent) } // Customize the HTML -#if 0 - wxString verString; - verString.Printf("%.2f", stVERSION_NUMBER); - htmlText.Replace(wxT("$VERSION$"), verString); -#endif htmlText.Replace(wxT("$DATE$"), _T(__DATE__)); wxSize htmlSize(400, 290);