added wxLogError/Warning into wxHTML
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
#include "wx/busyinfo.h"
|
#include "wx/busyinfo.h"
|
||||||
#include "wx/encconv.h"
|
#include "wx/encconv.h"
|
||||||
#include "wx/fontmap.h"
|
#include "wx/fontmap.h"
|
||||||
|
#include "wx/log.h"
|
||||||
#include "wx/html/htmlpars.h"
|
#include "wx/html/htmlpars.h"
|
||||||
#include "wx/html/htmldefs.h"
|
#include "wx/html/htmldefs.h"
|
||||||
|
|
||||||
@@ -233,6 +234,8 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c
|
|||||||
handler -> WriteOut(m_Contents, m_ContentsCnt);
|
handler -> WriteOut(m_Contents, m_ContentsCnt);
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
wxLogError(_("Cannot open contents file: %s"), contentsfile.mb_str());
|
||||||
|
|
||||||
f = ( indexfile.IsEmpty() ? 0 : fsys.OpenFile(indexfile) );
|
f = ( indexfile.IsEmpty() ? 0 : fsys.OpenFile(indexfile) );
|
||||||
if (f) {
|
if (f) {
|
||||||
@@ -246,6 +249,8 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c
|
|||||||
handler -> WriteOut(m_Index, m_IndexCnt);
|
handler -> WriteOut(m_Index, m_IndexCnt);
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
wxLogError(_("Cannot open index file: %s"), indexfile.mb_str());
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,9 +283,13 @@ bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f)
|
|||||||
f -> Read(&x, sizeof(x));
|
f -> Read(&x, sizeof(x));
|
||||||
version = wxINT32_SWAP_ON_BE(x);
|
version = wxINT32_SWAP_ON_BE(x);
|
||||||
|
|
||||||
if (version != CURRENT_CACHED_BOOK_VERSION) return FALSE;
|
if (version != CURRENT_CACHED_BOOK_VERSION)
|
||||||
|
{
|
||||||
|
wxLogError(_("Incorrect version of HTML help book"));
|
||||||
|
return FALSE;
|
||||||
// NOTE: when adding new version, please ensure backward compatibility!
|
// NOTE: when adding new version, please ensure backward compatibility!
|
||||||
|
}
|
||||||
|
|
||||||
/* load contents : */
|
/* load contents : */
|
||||||
|
|
||||||
f -> Read(&x, sizeof(x));
|
f -> Read(&x, sizeof(x));
|
||||||
@@ -517,7 +526,11 @@ bool wxHtmlHelpData::AddBook(const wxString& book)
|
|||||||
else bookFull = wxGetCwd() + "/" + book;
|
else bookFull = wxGetCwd() + "/" + book;
|
||||||
|
|
||||||
fi = fsys.OpenFile(bookFull);
|
fi = fsys.OpenFile(bookFull);
|
||||||
if (fi == NULL) return FALSE;
|
if (fi == NULL)
|
||||||
|
{
|
||||||
|
wxLogError(_("Cannot open HTML help book: %s"), bookFull.mb_str());
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
fsys.ChangePathTo(bookFull);
|
fsys.ChangePathTo(bookFull);
|
||||||
s = fi -> GetStream();
|
s = fi -> GetStream();
|
||||||
sz = s -> GetSize();
|
sz = s -> GetSize();
|
||||||
|
@@ -141,7 +141,11 @@ wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const
|
|||||||
char *src;
|
char *src;
|
||||||
wxString doc;
|
wxString doc;
|
||||||
|
|
||||||
if (s == NULL) return wxEmptyString;
|
if (s == NULL)
|
||||||
|
{
|
||||||
|
wxLogError(_("Cannot open HTML document: %s"), file.GetLocation().mb_str());
|
||||||
|
return wxEmptyString;
|
||||||
|
}
|
||||||
src = new char[s -> GetSize() + 1];
|
src = new char[s -> GetSize() + 1];
|
||||||
src[s -> GetSize()] = 0;
|
src[s -> GetSize()] = 0;
|
||||||
s -> Read(src, s -> GetSize());
|
s -> Read(src, s -> GetSize());
|
||||||
|
@@ -173,7 +173,12 @@ void wxHtmlParser::PopTagHandler()
|
|||||||
{
|
{
|
||||||
wxNode *first;
|
wxNode *first;
|
||||||
|
|
||||||
if (m_HandlersStack == NULL || (first = m_HandlersStack -> GetFirst()) == NULL) return;
|
if (m_HandlersStack == NULL ||
|
||||||
|
(first = m_HandlersStack -> GetFirst()) == NULL)
|
||||||
|
{
|
||||||
|
wxLogWarning(_("Warning: attempt to remove HTML tag handler from empty stack."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
m_HandlersHash = *((wxHashTable*) first -> GetData());
|
m_HandlersHash = *((wxHashTable*) first -> GetData());
|
||||||
m_HandlersStack -> DeleteNode(first);
|
m_HandlersStack -> DeleteNode(first);
|
||||||
}
|
}
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "wx/html/htmlwin.h"
|
#include "wx/html/htmlwin.h"
|
||||||
#include "wx/html/forcelnk.h"
|
#include "wx/html/forcelnk.h"
|
||||||
|
#include "wx/log.h"
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -154,10 +155,8 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
|||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
wxString err;
|
wxString err;
|
||||||
|
|
||||||
err.Printf(_("Unable to open requested location :\n\n%s"), WXSTRINGCAST location);
|
wxLogError(_("Unable to open requested HTML document: %s"), location.mb_str());
|
||||||
m_tmpCanDrawLocks--;
|
m_tmpCanDrawLocks--;
|
||||||
Refresh();
|
|
||||||
wxMessageBox(err, "Error");
|
|
||||||
|
|
||||||
SetCursor(*wxSTANDARD_CURSOR);
|
SetCursor(*wxSTANDARD_CURSOR);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -224,7 +223,11 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
|||||||
bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor)
|
bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor)
|
||||||
{
|
{
|
||||||
const wxHtmlCell *c = m_Cell -> Find(wxHTML_COND_ISANCHOR, &anchor);
|
const wxHtmlCell *c = m_Cell -> Find(wxHTML_COND_ISANCHOR, &anchor);
|
||||||
if (!c) return FALSE;
|
if (!c)
|
||||||
|
{
|
||||||
|
wxLogWarning(_("HTML anchor %s does not exist."), anchor.mb_str());
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
@@ -474,11 +477,11 @@ void wxHtmlWindow::OnKeyDown(wxKeyEvent& event)
|
|||||||
switch (event.KeyCode()) {
|
switch (event.KeyCode()) {
|
||||||
case WXK_PAGEUP :
|
case WXK_PAGEUP :
|
||||||
case WXK_PRIOR :
|
case WXK_PRIOR :
|
||||||
Scroll(-1, sty - (2 * cliy / 3));
|
Scroll(-1, sty - (5 * cliy / 6));
|
||||||
break;
|
break;
|
||||||
case WXK_PAGEDOWN :
|
case WXK_PAGEDOWN :
|
||||||
case WXK_NEXT :
|
case WXK_NEXT :
|
||||||
Scroll(-1, sty + (2 * cliy / 3));
|
Scroll(-1, sty + (5 * cliy / 6));
|
||||||
break;
|
break;
|
||||||
case WXK_HOME :
|
case WXK_HOME :
|
||||||
Scroll(-1, 0);
|
Scroll(-1, 0);
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "wx/html/winpars.h"
|
#include "wx/html/winpars.h"
|
||||||
#include "wx/html/htmlwin.h"
|
#include "wx/html/htmlwin.h"
|
||||||
#include "wx/fontmap.h"
|
#include "wx/fontmap.h"
|
||||||
|
#include "wx/log.h"
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -353,6 +354,8 @@ void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc)
|
|||||||
wxFONTENCODING_ISO8859_1 : m_OutputEnc,
|
wxFONTENCODING_ISO8859_1 : m_OutputEnc,
|
||||||
wxCONVERT_SUBSTITUTE))
|
wxCONVERT_SUBSTITUTE))
|
||||||
{ // total failture :-(
|
{ // total failture :-(
|
||||||
|
wxLogError(_("Failed to display HTML document in %s encoding"),
|
||||||
|
wxFontMapper::GetEncodingName(enc).mb_str());
|
||||||
m_InputEnc = m_OutputEnc = wxFONTENCODING_DEFAULT;
|
m_InputEnc = m_OutputEnc = wxFONTENCODING_DEFAULT;
|
||||||
delete m_EncConv;
|
delete m_EncConv;
|
||||||
m_EncConv = NULL;
|
m_EncConv = NULL;
|
||||||
|
Reference in New Issue
Block a user