]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/winpars.cpp
Added some placeholders...
[wxWidgets.git] / src / html / winpars.cpp
index d11a8ea9fde3fcf70ab9d3834f13f9632320cc4f..0709e7751890e91f071ef9132922793563d4d4aa 100644 (file)
@@ -8,7 +8,7 @@
 /////////////////////////////////////////////////////////////////////////////
 
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "winpars.h"
 #endif
 
@@ -31,6 +31,7 @@
 #include "wx/html/htmlwin.h"
 #include "wx/fontmap.h"
 #include "wx/log.h"
+#include "wx/settings.h"
 
 
 //-----------------------------------------------------------------------------
@@ -54,6 +55,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;
@@ -69,18 +71,12 @@ wxHtmlWinParser::wxHtmlWinParser(wxHtmlWindow *wnd) : wxHtmlParser()
                             m_FontsEncTable[i][j][k][l][m] = wxFONTENCODING_DEFAULT;
 #endif
                         }
-#ifdef __WXMSW__
-        static int default_sizes[7] = {7, 8, 10, 12, 16, 22, 30};
-#elif defined(__WXMAC__)
-        static int default_sizes[7] = {9, 12, 14, 18, 24, 30, 36};
-#else
-        static int default_sizes[7] = {10, 12, 14, 16, 19, 24, 32};
-#endif
-        SetFonts(wxT(""), wxT(""), default_sizes);
+
+        SetFonts(wxEmptyString, wxEmptyString, NULL);
     }
 
     // fill in wxHtmlParser's tables:
-    wxNode *node = m_Modules.GetFirst();
+    wxList::compatibility_iterator node = m_Modules.GetFirst();
     while (node)
     {
         wxHtmlTagsModule *mod = (wxHtmlTagsModule*) node->GetData();
@@ -118,8 +114,22 @@ void wxHtmlWinParser::RemoveModule(wxHtmlTagsModule *module)
     m_Modules.DeleteObject(module);
 }
 
-void wxHtmlWinParser::SetFonts(wxString normal_face, wxString fixed_face, const int *sizes)
+void wxHtmlWinParser::SetFonts(wxString normal_face, wxString fixed_face,
+                               const int *sizes)
 {
+    static int default_sizes[7] =
+        {
+            wxHTML_FONT_SIZE_1,
+                       wxHTML_FONT_SIZE_2,
+                       wxHTML_FONT_SIZE_3,
+                       wxHTML_FONT_SIZE_4,
+                       wxHTML_FONT_SIZE_5,
+                       wxHTML_FONT_SIZE_6,
+                       wxHTML_FONT_SIZE_7
+        };
+    
+    if (sizes == NULL) sizes = default_sizes;
+
     int i, j, k, l, m;
 
     for (i = 0; i < 7; i++) m_FontsSizes[i] = sizes[i];
@@ -162,11 +172,12 @@ 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();
 
-#if 0 //!wxUSE_UNICODE
+#if !wxUSE_UNICODE
     wxString charset = ExtractCharsetInformation(source);
     if (!charset.empty())
     {
@@ -177,6 +188,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()));
 }
 
@@ -198,6 +215,8 @@ wxObject* wxHtmlWinParser::GetProduct()
 
     top = m_Container;
     while (top->GetParent()) top = top->GetParent();
+    top->RemoveExtraSpacing(true, true);
+
     return top;
 }
 
@@ -270,9 +289,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)
@@ -286,6 +302,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;
         }
     }
@@ -305,6 +323,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;
     }
 }