static wxString SafeFileName(const wxString& s)
{
wxString res = s;
- res.Replace(":", "_", TRUE);
- res.Replace(" ", "_", TRUE);
- res.Replace("/", "_", TRUE);
- res.Replace("\\", "_", TRUE);
- res.Replace("#", "_", TRUE);
- res.Replace(".", "_", TRUE);
+ res.Replace(wxT(":"), wxT("_"), TRUE);
+ res.Replace(wxT(" "), wxT("_"), TRUE);
+ res.Replace(wxT("/"), wxT("_"), TRUE);
+ res.Replace(wxT("\\"), wxT("_"), TRUE);
+ res.Replace(wxT("#"), wxT("_"), TRUE);
+ res.Replace(wxT("."), wxT("_"), TRUE);
return res;
}
static int LINKAGEMODE IndexCompareFunc(const void *a, const void *b)
{
- return strcmp(((wxHtmlContentsItem*)a) -> m_Name, ((wxHtmlContentsItem*)b) -> m_Name);
+ return wxStrcmp(((wxHtmlContentsItem*)a) -> m_Name, ((wxHtmlContentsItem*)b) -> m_Name);
}
public:
HP_TagHandler(wxHtmlBookRecord *b) : wxHtmlTagHandler() {m_Book = b; m_Items = NULL; m_ItemsCnt = 0; m_Name = m_Page = wxEmptyString; m_Level = 0; }
- wxString GetSupportedTags() { return "UL,OBJECT,PARAM"; }
+ wxString GetSupportedTags() { return wxT("UL,OBJECT,PARAM"); }
bool HandleTag(const wxHtmlTag& tag);
void WriteOut(wxHtmlContentsItem*& array, int& size);
void ReadIn(wxHtmlContentsItem* array, int size);
m_Level--;
return TRUE;
}
- else if (tag.GetName() == "OBJECT") {
+ else if (tag.GetName() == wxT("OBJECT")) {
m_Name = m_Page = wxEmptyString;
ParseInner(tag);
if (m_Page != wxEmptyString) {
m_Items = (wxHtmlContentsItem*) realloc(m_Items, (m_ItemsCnt + wxHTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem));
m_Items[m_ItemsCnt].m_Level = m_Level;
m_Items[m_ItemsCnt].m_ID = m_ID;
- m_Items[m_ItemsCnt].m_Page = new char[m_Page.Length() + 1];
- strcpy(m_Items[m_ItemsCnt].m_Page, m_Page.c_str());
- m_Items[m_ItemsCnt].m_Name = new char [m_Name.Length() + 1];
- strcpy(m_Items[m_ItemsCnt].m_Name, m_Name.c_str());
+ m_Items[m_ItemsCnt].m_Page = new wxChar[m_Page.Length() + 1];
+ wxStrcpy(m_Items[m_ItemsCnt].m_Page, m_Page.c_str());
+ m_Items[m_ItemsCnt].m_Name = new wxChar [m_Name.Length() + 1];
+ wxStrcpy(m_Items[m_ItemsCnt].m_Name, m_Name.c_str());
m_Items[m_ItemsCnt].m_Book = m_Book;
m_ItemsCnt++;
}
return TRUE;
}
else { // "PARAM"
- if (m_Name == wxEmptyString && tag.GetParam("NAME") == "Name") m_Name = tag.GetParam("VALUE");
- if (tag.GetParam("NAME") == "Local") m_Page = tag.GetParam("VALUE");
- if (tag.GetParam("NAME") == "ID") tag.ScanParam("VALUE", "%i", &m_ID);
+ if (m_Name == wxEmptyString && tag.GetParam(wxT("NAME")) == wxT("Name")) m_Name = tag.GetParam(wxT("VALUE"));
+ if (tag.GetParam(wxT("NAME")) == wxT("Local")) m_Page = tag.GetParam(wxT("VALUE"));
+ if (tag.GetParam(wxT("NAME")) == wxT("ID")) tag.ScanParam(wxT("VALUE"), wxT("%i"), &m_ID);
return FALSE;
}
}
f -> Read(&x, sizeof(x));
m_Contents[i].m_ID = x;
f -> Read(&x, sizeof(x));
- m_Contents[i].m_Name = new char[x];
- f -> Read(m_Contents[i].m_Name, x);
+ m_Contents[i].m_Name = new wxChar[x];
+ f -> Read(m_Contents[i].m_Name, x*sizeof(wxChar));
f -> Read(&x, sizeof(x));
- m_Contents[i].m_Page = new char[x];
- f -> Read(m_Contents[i].m_Page, x);
+ m_Contents[i].m_Page = new wxChar[x];
+ f -> Read(m_Contents[i].m_Page, x*sizeof(wxChar));
m_Contents[i].m_Book = book;
}
m_Index = (wxHtmlContentsItem*) realloc(m_Index, (m_IndexCnt / wxHTML_REALLOC_STEP + 1) * wxHTML_REALLOC_STEP * sizeof(wxHtmlContentsItem));
for (i = st; i < m_IndexCnt; i++) {
f -> Read(&x, sizeof(x));
- m_Index[i].m_Name = new char[x];
- f -> Read(m_Index[i].m_Name, x);
+ m_Index[i].m_Name = new wxChar[x];
+ f -> Read(m_Index[i].m_Name, x*sizeof(wxChar));
f -> Read(&x, sizeof(x));
- m_Index[i].m_Page = new char[x];
- f -> Read(m_Index[i].m_Page, x);
+ m_Index[i].m_Page = new wxChar[x];
+ f -> Read(m_Index[i].m_Page, x*sizeof(wxChar));
m_Index[i].m_Book = book;
}
return TRUE;
f -> Write(&x, sizeof(x));
x = m_Contents[i].m_ID;
f -> Write(&x, sizeof(x));
- x = strlen(m_Contents[i].m_Name) + 1;
+ x = wxStrlen(m_Contents[i].m_Name) + 1;
f -> Write(&x, sizeof(x));
- f -> Write(m_Contents[i].m_Name, x);
- x = strlen(m_Contents[i].m_Page) + 1;
+ f -> Write(m_Contents[i].m_Name, x*sizeof(wxChar));
+ x = wxStrlen(m_Contents[i].m_Page) + 1;
f -> Write(&x, sizeof(x));
- f -> Write(m_Contents[i].m_Page, x);
+ f -> Write(m_Contents[i].m_Page, x*sizeof(wxChar));
}
/* save index : */
f -> Write(&x, sizeof(x));
for (i = 0; i < m_IndexCnt; i++) {
if (m_Index[i].m_Book != book || m_Index[i].m_Level == 0) continue;
- x = strlen(m_Index[i].m_Name) + 1;
+ x = wxStrlen(m_Index[i].m_Name) + 1;
f -> Write(&x, sizeof(x));
- f -> Write(m_Index[i].m_Name, x);
- x = strlen(m_Index[i].m_Page) + 1;
+ f -> Write(m_Index[i].m_Name, x*sizeof(wxChar));
+ x = wxStrlen(m_Index[i].m_Page) + 1;
f -> Write(&x, sizeof(x));
- f -> Write(m_Index[i].m_Page, x);
+ f -> Write(m_Index[i].m_Page, x*sizeof(wxChar));
}
return TRUE;
}
m_Contents = (wxHtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt + wxHTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem));
m_Contents[m_ContentsCnt].m_Level = 0;
m_Contents[m_ContentsCnt].m_ID = 0;
- m_Contents[m_ContentsCnt].m_Page = new char[deftopic.Length() + 1];
- strcpy(m_Contents[m_ContentsCnt].m_Page, deftopic.c_str());
- m_Contents[m_ContentsCnt].m_Name = new char [title.Length() + 1];
- strcpy(m_Contents[m_ContentsCnt].m_Name, title.c_str());
+ m_Contents[m_ContentsCnt].m_Page = new wxChar[deftopic.Length() + 1];
+ wxStrcpy(m_Contents[m_ContentsCnt].m_Page, deftopic.c_str());
+ m_Contents[m_ContentsCnt].m_Name = new wxChar [title.Length() + 1];
+ wxStrcpy(m_Contents[m_ContentsCnt].m_Name, title.c_str());
m_Contents[m_ContentsCnt].m_Book = bookr;
// store the contents index for later
cnt = m_ContentsCnt;
for (i = 0; i < cnt; i++) {
- if (strcmp(m_Contents[i].m_Name, x) == 0) {
+ if (wxStrcmp(m_Contents[i].m_Name, x) == 0) {
url = m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page;
return url;
}
cnt = m_IndexCnt;
for (i = 0; i < cnt; i++) {
- if (strcmp(m_Index[i].m_Name, x) == 0) {
+ if (wxStrcmp(m_Index[i].m_Name, x) == 0) {
url = m_Index[i].m_Book -> GetBasePath() + m_Index[i].m_Page;
return url;
}
void wxSearchEngine::LookFor(const wxString& keyword)
{
if (m_Keyword) delete[] m_Keyword;
- m_Keyword = new char[keyword.Length() + 1];
- strcpy(m_Keyword, keyword.c_str());
- for (int i = strlen(m_Keyword) - 1; i >= 0; i--)
- if ((m_Keyword[i] >= 'A') && (m_Keyword[i] <= 'Z'))
- m_Keyword[i] += 'a' - 'A';
+ m_Keyword = new wxChar[keyword.Length() + 1];
+ wxStrcpy(m_Keyword, keyword.c_str());
+ for (int i = wxStrlen(m_Keyword) - 1; i >= 0; i--)
+ if ((m_Keyword[i] >= wxT('A')) && (m_Keyword[i] <= wxT('Z')))
+ m_Keyword[i] += wxT('a') - wxT('A');
}
int i, j;
int lng = stream ->GetSize();
- int wrd = strlen(m_Keyword);
+ int wrd = wxStrlen(m_Keyword);
bool found = FALSE;
char *buf = new char[lng + 1];
stream -> Read(buf, lng);
wxHtmlWordCell::wxHtmlWordCell(const wxString& word, wxDC& dc) : wxHtmlCell()
{
m_Word = word;
- m_Word.Replace(" ", " ", TRUE);
- m_Word.Replace(""", "\"", TRUE);
- m_Word.Replace("<", "<", TRUE);
- m_Word.Replace(">", ">", TRUE);
- m_Word.Replace("&", "&", TRUE);
+ m_Word.Replace(wxT(" "), wxT(" "), TRUE);
+ m_Word.Replace(wxT("""), wxT("\""), TRUE);
+ m_Word.Replace(wxT("<"), wxT("<"), TRUE);
+ m_Word.Replace(wxT(">"), wxT(">"), TRUE);
+ m_Word.Replace(wxT("&"), wxT("&"), TRUE);
dc.GetTextExtent(m_Word, &m_Width, &m_Height, &m_Descent);
SetCanLiveOnPagebreak(FALSE);
}
wxString wd = tag.GetParam("WIDTH");
if (wd[wd.Length()-1] == '%') {
- sscanf(wd.c_str(), "%i%%", &wdi);
+ wxSscanf(wd.c_str(), wxT("%i%%"), &wdi);
SetWidthFloat(wdi, wxHTML_UNITS_PERCENT);
}
else {
- sscanf(wd.c_str(), "%i", &wdi);
+ wxSscanf(wd.c_str(), wxT("%i"), &wdi);
SetWidthFloat(wdi, wxHTML_UNITS_PIXELS);
}
}
doc = src;
delete [] src;
- doc.Replace("<", "<", TRUE);
- doc.Replace(">", ">", TRUE);
+ doc.Replace(wxT("<"), wxT("<"), TRUE);
+ doc.Replace(wxT(">"), wxT(">"), TRUE);
doc2 = "<HTML><BODY><PRE>\n" + doc + "\n</PRE></BODY></HTML>";
return doc2;
}
wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
{
- const char *src = source.c_str();
+ const wxChar *src = source.c_str();
int i, tg, pos, stpos;
int lng = source.Length();
- char dummy[256];
+ wxChar dummy[256];
m_Cache = NULL;
m_CacheSize = 0;
pos = 0;
while (pos < lng) {
- if (src[pos] == '<') { // tag found:
+ if (src[pos] == wxT('<')) { // tag found:
if (m_CacheSize % CACHE_INCREMENT == 0)
m_Cache = (sCacheItem*) realloc(m_Cache, (m_CacheSize + CACHE_INCREMENT) * sizeof(sCacheItem));
tg = m_CacheSize++;
m_Cache[tg].Key = stpos = pos++;
dummy[0] = 0; i = 0;
- while ((src[pos] != '>') && (src[pos] != ' ')) {
+ while ((src[pos] != wxT('>')) && (src[pos] != wxT(' '))) {
dummy[i] = src[pos++];
- if ((dummy[i] >= 'a') && (dummy[i] <= 'z')) dummy[i] -= ('a' - 'A');
+ if ((dummy[i] >= wxT('a')) && (dummy[i] <= wxT('z'))) dummy[i] -= (wxT('a') - wxT('A'));
i++;
}
dummy[i] = 0;
- m_Cache[tg].Name = new char[i+1];
- memcpy(m_Cache[tg].Name, dummy, i+1);
+ m_Cache[tg].Name = new wxChar[i+1];
+ memcpy(m_Cache[tg].Name, dummy, (i+1)*sizeof(wxChar));
- while (src[pos] != '>') pos++;
+ while (src[pos] != wxT('>')) pos++;
- if (src[stpos+1] == '/') { // ending tag:
+ if (src[stpos+1] == wxT('/')) { // ending tag:
m_Cache[tg].End1 = m_Cache[tg].End2 = -2;
// find matching begin tag:
for (i = tg; i >= 0; i--)
- if ((m_Cache[i].End1 == -1) && (strcmp(m_Cache[i].Name, dummy+1) == 0)) {
+ if ((m_Cache[i].End1 == -1) && (wxStrcmp(m_Cache[i].Name, dummy+1) == 0)) {
m_Cache[i].End1 = stpos;
m_Cache[i].End2 = pos + 1;
break;
bool wxHtmlTag::HasParam(const wxString& par) const
{
- const char *st = m_Params, *p = par;
- const char *st2, *p2;
+ const wxChar *st = m_Params, *p = par;
+ const wxChar *st2, *p2;
if (*st == 0) return FALSE;
if (*p == 0) return FALSE;
wxString wxHtmlTag::GetParam(const wxString& par, bool with_commas) const
{
- const char *st = m_Params, *p = par;
- const char *st2, *p2;
+ const wxChar *st = m_Params, *p = par;
+ const wxChar *st2, *p2;
bool comma;
char comma_char;
-int wxHtmlTag::ScanParam(const wxString& par, char *format, void *param) const
+int wxHtmlTag::ScanParam(const wxString& par, wxChar *format, void *param) const
{
wxString parval = GetParam(par);
- return sscanf((const char*)parval, format, param);
+ return wxSscanf((const wxChar*)parval, format, param);
}
#endif
m_Parser -> m_ItalicModeFixed = cfg -> Read("wxHtmlWindow/ItalicModeFixed", m_Parser -> m_ItalicModeFixed);
m_Parser -> m_ItalicModeNormal = cfg -> Read("wxHtmlWindow/ItalicModeNormal", m_Parser -> m_ItalicModeNormal);
for (int i = 0; i < 7; i++) {
- tmp.Printf("wxHtmlWindow/FontsSize%i", i);
+ tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i);
m_Parser -> m_FontsSizes[i] = cfg -> Read(tmp, m_Parser -> m_FontsSizes[i]);
}
cfg -> Write("wxHtmlWindow/ItalicModeFixed", (long) m_Parser -> m_ItalicModeFixed);
cfg -> Write("wxHtmlWindow/ItalicModeNormal", (long) m_Parser -> m_ItalicModeNormal);
for (int i = 0; i < 7; i++) {
- tmp.Printf("wxHtmlWindow/FontsSize%i", i);
+ tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i);
cfg -> Write(tmp, (long) m_Parser -> m_FontsSizes[i]);
}
wxString r = instr;
wxString num;
- num.Printf("%i", page);
- r.Replace("@PAGENUM@", num);
+ num.Printf(wxT("%i"), page);
+ r.Replace(wxT("@PAGENUM@"), num);
- num.Printf("%i", m_NumPages);
- r.Replace("@PAGESCNT@", num);
+ num.Printf(wxT("%i"), m_NumPages);
+ r.Replace(wxT("@PAGESCNT@"), num);
return r;
}
wxColour oldclr = m_WParser -> GetActualColor();
int oldsize = m_WParser -> GetFontSize();
- if (tag.HasParam("COLOR")) {
+ if (tag.HasParam(wxT("COLOR"))) {
unsigned long tmp = 0;
wxColour clr;
- if (tag.ScanParam("COLOR", "#%lX", &tmp) == 1) {
+ if (tag.ScanParam(wxT("COLOR"), wxT("#%lX"), &tmp) == 1) {
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
m_WParser -> SetActualColor(clr);
m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(clr));
}
}
- if (tag.HasParam("SIZE")) {
+ if (tag.HasParam(wxT("SIZE"))) {
long tmp = 0;
- if (tag.ScanParam("SIZE", "%li", &tmp) == 1) {
+ if (tag.ScanParam(wxT("SIZE"), wxT("%li"), &tmp) == 1) {
m_WParser -> SetFontSize(oldsize+tmp);
m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
}
c -> SetAlignHor(wxHTML_ALIGN_CENTER);
c -> SetAlign(tag);
c -> SetWidthFloat(tag);
- if (tag.HasParam("SIZE") && tag.ScanParam("SIZE", "%i", &sz) == 1) {}
+ if (tag.HasParam(wxT("SIZE")) && tag.ScanParam(wxT("SIZE"), wxT("%i"), &sz) == 1) {}
else sz = 1;
c -> InsertCell(new wxHtmlLineCell(sz));
type = t;
while ((i = x.Find( ',' )) != -1)
{
- coords.Add( atoi( x.Left( i ).c_str() ) );
+ coords.Add( wxAtoi( x.Left( i ).c_str() ) );
x = x.Mid( i + 1 );
}
- coords.Add( atoi( x.c_str() ) );
+ coords.Add( wxAtoi( x.c_str() ) );
}
wxString wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
wxString mn = wxEmptyString;
str = m_WParser -> GetFS() -> OpenFile(tmp);
- if (tag.HasParam("WIDTH")) tag.ScanParam("WIDTH", "%i", &w);
- if (tag.HasParam("HEIGHT")) tag.ScanParam("HEIGHT", "%i", &h);
+ if (tag.HasParam(wxT("WIDTH"))) tag.ScanParam(wxT("WIDTH"), wxT("%i"), &w);
+ if (tag.HasParam(wxT("HEIGHT"))) tag.ScanParam(wxT("HEIGHT"), wxT("%i"), &h);
al = wxHTML_ALIGN_BOTTOM;
if (tag.HasParam("ALIGN")) {
wxString alstr = tag.GetParam("ALIGN");
unsigned long tmp;
wxColour clr;
- if (tag.HasParam("TEXT")) {
- if (tag.ScanParam("TEXT", "#%lX", &tmp) == 1) {
+ if (tag.HasParam(wxT("TEXT"))) {
+ if (tag.ScanParam(wxT("TEXT"), wxT("#%lX"), &tmp) == 1) {
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
m_WParser -> SetActualColor(clr);
m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(clr));
}
}
- if (tag.HasParam("LINK")) {
- if (tag.ScanParam("LINK", "#%lX", &tmp) == 1) {
+ if (tag.HasParam(wxT("LINK"))) {
+ if (tag.ScanParam(wxT("LINK"), wxT("#%lX"), &tmp) == 1) {
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
m_WParser -> SetLinkColor(clr);
}
}
- if (tag.HasParam("BGCOLOR")) {
- if (tag.ScanParam("BGCOLOR", "#%lX", &tmp) == 1) {
+ if (tag.HasParam(wxT("BGCOLOR"))) {
+ if (tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &tmp) == 1) {
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(clr, wxHTML_CLR_BACKGROUND));
if (m_WParser -> GetWindow() != NULL)
c -> InsertCell(new wxHtmlListmarkCell(m_WParser -> GetDC(), m_WParser -> GetActualColor()));
else {
wxString mark;
- mark.Printf("%i.", m_Numbering);
+ mark.Printf(wxT("%i."), m_Numbering);
c -> InsertCell(new wxHtmlWordCell(mark, *(m_WParser -> GetDC())));
}
m_WParser -> CloseContainer();
while (tokenizer.HasMoreTokens()) {
if (i % 10 == 0) m_Text = (wxString**) realloc(m_Text, sizeof(wxString*) * (i + 10));
tmp = tokenizer.NextToken();
- tmp.Replace(" ", " ", TRUE);
- tmp.Replace(""", "\"", TRUE);
- tmp.Replace("<", "<", TRUE);
- tmp.Replace(">", ">", TRUE);
- tmp.Replace("&", "&", TRUE);
- tmp.Replace("\t", " ", TRUE);
- tmp.Replace("\r", "", TRUE);
+ tmp.Replace(wxT(" "), wxT(" "), TRUE);
+ tmp.Replace(wxT("""), wxT("\""), TRUE);
+ tmp.Replace(wxT("<"), wxT("<"), TRUE);
+ tmp.Replace(wxT(">"), wxT(">"), TRUE);
+ tmp.Replace(wxT("&"), wxT("&"), TRUE);
+ tmp.Replace(wxT("\t"), wxT(" "), TRUE);
+ tmp.Replace(wxT("\r"), wxT(""), TRUE);
m_Text[i++] = new wxString(tmp);
dc.GetTextExtent(tmp, &x, &z, &z);
/* 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);
/* 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;
}
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;
}
}
// 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;
//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);
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: search.cpp
+// Purpose: search engine
+// Author: Vaclav Slavik
+// RCS-ID: $Id$
+// Copyright: (c) 1999 Vaclav Slavik
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "wx/wxprec.h"
+
+#include "wx/defs.h"
+#if wxUSE_HTML
+
+#ifdef __BORDLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WXPRECOMP
+#include <wx/wx.h>
+#endif
+
+#include "wx/html/helpdata.h"
+
+
+
+//--------------------------------------------------------------------------------
+// wxSearchEngine
+//--------------------------------------------------------------------------------
+
+void wxSearchEngine::LookFor(const wxString& keyword)
+{
+ if (m_Keyword) delete[] m_Keyword;
+ m_Keyword = new wxChar[keyword.Length() + 1];
+ wxStrcpy(m_Keyword, keyword.c_str());
+ for (int i = wxStrlen(m_Keyword) - 1; i >= 0; i--)
+ if ((m_Keyword[i] >= wxT('A')) && (m_Keyword[i] <= wxT('Z')))
+ m_Keyword[i] += wxT('a') - wxT('A');
+}
+
+
+
+bool wxSearchEngine::Scan(wxInputStream *stream)
+{
+ wxASSERT_MSG(m_Keyword != NULL, _("wxSearchEngine::LookFor must be called before scanning!"));
+
+ int i, j;
+ int lng = stream ->GetSize();
+ int wrd = wxStrlen(m_Keyword);
+ bool found = FALSE;
+ char *buf = new char[lng + 1];
+ stream -> Read(buf, lng);
+ buf[lng] = 0;
+
+ for (i = 0; i < lng; i++)
+ if ((buf[i] >= 'A') && (buf[i] <= 'Z')) buf[i] += 'a' - 'A';
+
+ for (i = 0; i < lng - wrd; i++) {
+ j = 0;
+ while ((j < wrd) && (buf[i + j] == m_Keyword[j])) j++;
+ if (j == wrd) {found = TRUE; break;}
+ }
+
+ delete[] buf;
+ return found;
+}
+
+#endif