X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/efba2b89f15ba8757a722fc56c67f434cf960482..309689b214a464ee0a85a8a40c3042b564b6343d:/src/html/m_tables.cpp diff --git a/src/html/m_tables.cpp b/src/html/m_tables.cpp index 67c6df4161..33e24919fb 100644 --- a/src/html/m_tables.cpp +++ b/src/html/m_tables.cpp @@ -11,15 +11,16 @@ #pragma implementation #endif -#include +#include "wx/wxprec.h" +#include "wx/defs.h" #if wxUSE_HTML #ifdef __BORDLANDC__ #pragma hdrstop #endif #ifndef WXPRECOMP -#include +#include "wx/wx.h" #endif @@ -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); @@ -168,19 +169,21 @@ void wxHtmlTableCell::ReallocCols(int cols) void wxHtmlTableCell::ReallocRows(int rows) { m_CellInfo = (cellStruct**) realloc(m_CellInfo, sizeof(cellStruct*) * rows); - if (m_NumCols != 0) { - int x = rows - 1; - m_CellInfo[x] = (cellStruct*) malloc(sizeof(cellStruct) * m_NumCols); - for (int i = 0; i < m_NumCols; i++) - m_CellInfo[x][i].flag = cellFree; + for (int row = m_NumRows; row < rows ; row++) + { + if (m_NumCols == 0) + m_CellInfo[row] = NULL; + else + { + m_CellInfo[row] = (cellStruct*) malloc(sizeof(cellStruct) * m_NumCols); + for (int col = 0; col < m_NumCols; col++) + m_CellInfo[row][col].flag = cellFree; + } } - else - m_CellInfo[rows - 1] = NULL; m_NumRows = rows; } - void wxHtmlTableCell::AddRow(const wxHtmlTag& tag) { if (m_ActualRow + 1 > m_NumRows - 1) @@ -190,8 +193,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; } @@ -221,11 +224,11 @@ 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); + 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); + wxSscanf(wd.c_str(), wxT("%i"), &m_ColsInfo[c].width); m_ColsInfo[c].units = wxHTML_UNITS_PIXELS; } } @@ -234,8 +237,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 +254,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); @@ -410,8 +413,8 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH") TAG_HANDLER_CONSTR(TABLE) { m_Table = NULL; - m_tAlign = m_rAlign = wxEmptyString; - m_OldAlign = wxHTML_ALIGN_LEFT; + m_tAlign = m_rAlign = wxEmptyString; + m_OldAlign = wxHTML_ALIGN_LEFT; }