]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/winpars.cpp
Add wxFULL_REPAINT_ON_RESIZE
[wxWidgets.git] / src / html / winpars.cpp
index 8410b01988210c3b3a2e6eb868e1121d88ff8b96..0f7ee8027cf0aab0573417af525cfb481c3b993a 100644 (file)
@@ -8,7 +8,7 @@
 /////////////////////////////////////////////////////////////////////////////
 
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "winpars.h"
 #endif
 
 #include "wx/html/htmlwin.h"
 #include "wx/fontmap.h"
 #include "wx/log.h"
+#include "wx/settings.h"
 
 
 //-----------------------------------------------------------------------------
 // wxHtmlWinParser
 //-----------------------------------------------------------------------------
 
+IMPLEMENT_ABSTRACT_CLASS(wxHtmlWinParser, wxHtmlParser)
 
 wxList wxHtmlWinParser::m_Modules;
 
@@ -54,6 +56,7 @@ wxHtmlWinParser::wxHtmlWinParser(wxHtmlWindow *wnd) : wxHtmlParser()
     m_InputEnc = wxFONTENCODING_ISO8859_1;
     m_OutputEnc = wxFONTENCODING_DEFAULT;
 #endif
+    m_lastWordCell = NULL;
 
     {
         int i, j, k, l, m;
@@ -170,6 +173,7 @@ void wxHtmlWinParser::InitParser(const wxString& source)
     m_ActualColor.Set(0, 0, 0);
     m_Align = wxHTML_ALIGN_LEFT;
     m_tmpLastWasSpace = FALSE;
+    m_lastWordCell = NULL;
 
     OpenContainer();
     OpenContainer();
@@ -185,6 +189,12 @@ void wxHtmlWinParser::InitParser(const wxString& source)
 #endif
 
     m_Container->InsertCell(new wxHtmlColourCell(m_ActualColor));
+    wxColour windowColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) ;
+    m_Container->InsertCell(
+            new wxHtmlColourCell(GetWindow() ?
+                                     GetWindow()->GetBackgroundColour() :
+                                     windowColour,
+                                 wxHTML_CLR_BACKGROUND));
     m_Container->InsertCell(new wxHtmlFontCell(CreateCurrentFont()));
 }
 
@@ -206,6 +216,8 @@ wxObject* wxHtmlWinParser::GetProduct()
 
     top = m_Container;
     while (top->GetParent()) top = top->GetParent();
+    top->RemoveExtraSpacing(true, true);
+
     return top;
 }
 
@@ -278,9 +290,6 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
         {
             temp[templen-1] = wxT(' ');
             temp[templen] = 0;
-#if 0 // VS - WHY was this here?!
-            if (templen == 1) continue;
-#endif
             templen = 0;
 #if !wxUSE_UNICODE
             if (m_EncConv)
@@ -294,6 +303,8 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
             if (m_UseLink)
                 c->SetLink(m_Link);
             m_Container->InsertCell(c);
+            ((wxHtmlWordCell*)c)->SetPreviousWord(m_lastWordCell);
+            m_lastWordCell = (wxHtmlWordCell*)c;
             m_tmpLastWasSpace = TRUE;
         }
     }
@@ -313,6 +324,8 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
         if (m_UseLink)
             c->SetLink(m_Link);
         m_Container->InsertCell(c);
+        ((wxHtmlWordCell*)c)->SetPreviousWord(m_lastWordCell);
+        m_lastWordCell = (wxHtmlWordCell*)c;
         m_tmpLastWasSpace = FALSE;
     }
 }
@@ -455,9 +468,15 @@ void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc)
     else if (wxFontMapper::Get()->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, FALSE))
         m_OutputEnc = altnorm;
 
-    // okay, let convert to ISO_8859-1, available always
     else
+    {
+#ifndef __WXMAC__
+        // okay, let convert to ISO_8859-1, available always
         m_OutputEnc = wxFONTENCODING_DEFAULT;
+#else
+        m_OutputEnc = wxLocale::GetSystemEncoding() ;
+#endif
+    }
 
     m_InputEnc = enc;
     if (m_OutputEnc == wxFONTENCODING_DEFAULT)