X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9b64e79868d4d32c3541bbd049d3f9f94c8edbfe..354aa1e366a57d896e2cf0943c687b24e8db688c:/src/html/m_tables.cpp diff --git a/src/html/m_tables.cpp b/src/html/m_tables.cpp index a93a089c9a..73c1fd651e 100644 --- a/src/html/m_tables.cpp +++ b/src/html/m_tables.cpp @@ -13,6 +13,7 @@ #include +#include "wx/defs.h" #if wxUSE_HTML #ifdef __BORDLANDC__ #pragma hdrstop @@ -113,7 +114,7 @@ class wxHtmlTableCell : public wxHtmlContainerCell wxHtmlTableCell::wxHtmlTableCell(wxHtmlContainerCell *parent, const wxHtmlTag& tag) : wxHtmlContainerCell(parent) { - m_HasBorders = tag.HasParam("BORDER"); + m_HasBorders = (tag.HasParam("BORDER") && tag.GetParam("BORDER") != "0"); m_ColsInfo = NULL; m_NumCols = m_NumRows = 0; m_CellInfo = NULL; @@ -121,10 +122,10 @@ wxHtmlTableCell::wxHtmlTableCell(wxHtmlContainerCell *parent, const wxHtmlTag& t /* scan params: */ m_tBkg = m_rBkg = -1; - if (tag.HasParam("BGCOLOR")) tag.ScanParam("BGCOLOR", "#%lX", &m_tBkg); - if (tag.HasParam("VALIGN")) m_tValign = tag.GetParam("VALIGN"); else m_tValign = wxEmptyString; - if (tag.HasParam("CELLSPACING") && tag.ScanParam("CELLSPACING", "%i", &m_Spacing) == 1) {} else m_Spacing = 2; - if (tag.HasParam("CELLPADDING") && tag.ScanParam("CELLPADDING", "%i", &m_Padding) == 1) {} else m_Padding = 3; + if (tag.HasParam(wxT("BGCOLOR"))) tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &m_tBkg); + if (tag.HasParam(wxT("VALIGN"))) m_tValign = tag.GetParam(wxT("VALIGN")); else m_tValign = wxEmptyString; + if (tag.HasParam(wxT("CELLSPACING")) && tag.ScanParam(wxT("CELLSPACING"), wxT("%i"), &m_Spacing) == 1) {} else m_Spacing = 2; + if (tag.HasParam(wxT("CELLPADDING")) && tag.ScanParam(wxT("CELLPADDING"), wxT("%i"), &m_Padding) == 1) {} else m_Padding = 3; if (m_HasBorders) SetBorder(TABLE_BORDER_CLR_1, TABLE_BORDER_CLR_2); @@ -157,7 +158,7 @@ void wxHtmlTableCell::ReallocCols(int cols) m_ColsInfo = (colStruct*) realloc(m_ColsInfo, sizeof(colStruct) * cols); for (j = m_NumCols; j < cols; j++) { m_ColsInfo[j].width = 0; - m_ColsInfo[j].units = HTML_UNITS_PERCENT; + m_ColsInfo[j].units = wxHTML_UNITS_PERCENT; } m_NumCols = cols; @@ -190,8 +191,8 @@ void wxHtmlTableCell::AddRow(const wxHtmlTag& tag) /* scan params: */ m_rBkg = m_tBkg; - if (tag.HasParam("BGCOLOR")) tag.ScanParam("BGCOLOR", "#%lX", &m_rBkg); - if (tag.HasParam("VALIGN")) m_rValign = tag.GetParam("VALIGN"); else m_rValign = m_tValign; + if (tag.HasParam(wxT("BGCOLOR"))) tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &m_rBkg); + if (tag.HasParam(wxT("VALIGN"))) m_rValign = tag.GetParam(wxT("VALIGN")); else m_rValign = m_tValign; } @@ -211,7 +212,7 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag) m_CellInfo[r][c].rowspan = 1; m_CellInfo[r][c].flag = cellUsed; m_CellInfo[r][c].minheight = 0; - m_CellInfo[r][c].valign = HTML_ALIGN_TOP; + m_CellInfo[r][c].valign = wxHTML_ALIGN_TOP; /* scan for parameters: */ @@ -221,12 +222,12 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag) wxString wd = tag.GetParam("WIDTH"); if (wd[wd.Length()-1] == '%') { - sscanf(wd.c_str(), "%i%%", &m_ColsInfo[c].width); - m_ColsInfo[c].units = HTML_UNITS_PERCENT; + wxSscanf(wd.c_str(), wxT("%i%%"), &m_ColsInfo[c].width); + m_ColsInfo[c].units = wxHTML_UNITS_PERCENT; } else { - sscanf(wd.c_str(), "%i", &m_ColsInfo[c].width); - m_ColsInfo[c].units = HTML_UNITS_PIXELS; + wxSscanf(wd.c_str(), wxT("%i"), &m_ColsInfo[c].width); + m_ColsInfo[c].units = wxHTML_UNITS_PIXELS; } } } @@ -234,8 +235,8 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag) // spanning: { - if (tag.HasParam("COLSPAN")) tag.ScanParam("COLSPAN", "%i", &m_CellInfo[r][c].colspan); - if (tag.HasParam("ROWSPAN")) tag.ScanParam("ROWSPAN", "%i", &m_CellInfo[r][c].rowspan); + if (tag.HasParam(wxT("COLSPAN"))) tag.ScanParam(wxT("COLSPAN"), wxT("%i"), &m_CellInfo[r][c].colspan); + if (tag.HasParam(wxT("ROWSPAN"))) tag.ScanParam(wxT("ROWSPAN"), wxT("%i"), &m_CellInfo[r][c].rowspan); if ((m_CellInfo[r][c].colspan != 1) || (m_CellInfo[r][c].rowspan != 1)) { int i, j; @@ -251,7 +252,7 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag) //background color: { int bk = m_rBkg; - if (tag.HasParam("BGCOLOR")) tag.ScanParam("BGCOLOR", "#%lX", &bk); + if (tag.HasParam(wxT("BGCOLOR"))) tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &bk); if (bk != -1) { wxColour clr = wxColour((bk & 0xFF0000) >> 16 , (bk & 0x00FF00) >> 8, (bk & 0x0000FF)); cell -> SetBackgroundColour(clr); @@ -265,12 +266,12 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag) wxString valign; if (tag.HasParam("VALIGN")) valign = tag.GetParam("VALIGN"); else valign = m_tValign; valign.MakeUpper(); - if (valign == "TOP") m_CellInfo[r][c].valign = HTML_ALIGN_TOP; - else if (valign == "BOTTOM") m_CellInfo[r][c].valign = HTML_ALIGN_BOTTOM; - else m_CellInfo[r][c].valign = HTML_ALIGN_CENTER; + if (valign == "TOP") m_CellInfo[r][c].valign = wxHTML_ALIGN_TOP; + else if (valign == "BOTTOM") m_CellInfo[r][c].valign = wxHTML_ALIGN_BOTTOM; + else m_CellInfo[r][c].valign = wxHTML_ALIGN_CENTER; } - cell -> SetIndent(m_Padding, HTML_INDENT_ALL, HTML_UNITS_PIXELS); + cell -> SetIndent(m_Padding, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS); } @@ -285,7 +286,7 @@ void wxHtmlTableCell::Layout(int w) */ - if (m_WidthFloatUnits == HTML_UNITS_PERCENT) { + if (m_WidthFloatUnits == wxHTML_UNITS_PERCENT) { if (m_WidthFloat < 0) m_Width = (100 + m_WidthFloat) * w / 100; else m_Width = m_WidthFloat * w / 100; } @@ -309,12 +310,12 @@ void wxHtmlTableCell::Layout(int w) // 1a. setup fixed-width columns: for (i = 0; i < m_NumCols; i++) - if (m_ColsInfo[i].units == HTML_UNITS_PIXELS) + if (m_ColsInfo[i].units == wxHTML_UNITS_PIXELS) wpix -= (m_ColsInfo[i].pixwidth = m_ColsInfo[i].width); // 1b. setup floating-width columns: for (i = 0; i < m_NumCols; i++) - if ((m_ColsInfo[i].units == HTML_UNITS_PERCENT) && (m_ColsInfo[i].width != 0)) + if ((m_ColsInfo[i].units == wxHTML_UNITS_PERCENT) && (m_ColsInfo[i].width != 0)) wtemp += (m_ColsInfo[i].pixwidth = m_ColsInfo[i].width * wpix / 100); wpix -= wtemp; @@ -411,7 +412,7 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH") { m_Table = NULL; m_tAlign = m_rAlign = wxEmptyString; - m_OldAlign = HTML_ALIGN_LEFT; + m_OldAlign = wxHTML_ALIGN_LEFT; } @@ -460,7 +461,7 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH") m_WParser -> OpenContainer(); if (tag.GetName() == "TH") /*header style*/ { - m_WParser -> SetAlign(HTML_ALIGN_CENTER); + m_WParser -> SetAlign(wxHTML_ALIGN_CENTER); } { @@ -469,8 +470,8 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH") als = m_rAlign; if (tag.HasParam("ALIGN")) als = tag.GetParam("ALIGN"); als.MakeUpper(); - if (als == "RIGHT") m_WParser -> SetAlign(HTML_ALIGN_RIGHT); - else if (als == "CENTER") m_WParser -> SetAlign(HTML_ALIGN_CENTER); + if (als == "RIGHT") m_WParser -> SetAlign(wxHTML_ALIGN_RIGHT); + else if (als == "CENTER") m_WParser -> SetAlign(wxHTML_ALIGN_CENTER); } m_WParser -> OpenContainer(); }