wxHTML src code indentation now conforms (more) to wxWin coding style

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8694 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2000-11-05 14:59:59 +00:00
parent 1da7aa8c4a
commit 4f9297b0ee
23 changed files with 1437 additions and 1115 deletions

View File

@@ -79,7 +79,8 @@ bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg)
#if wxUSE_BUSYINFO
wxBusyInfo* busy = NULL;
wxString info;
if (show_wait_msg) {
if (show_wait_msg)
{
info.Printf(_("Adding book %s"), book.c_str());
busy = new wxBusyInfo(info);
}
@@ -102,7 +103,8 @@ wxHtmlHelpFrame *wxHtmlHelpController::CreateHelpFrame(wxHtmlHelpData *data)
void wxHtmlHelpController::CreateHelpWindow()
{
if (m_helpFrame) {
if (m_helpFrame)
{
m_helpFrame->Raise();
return ;
}

View File

@@ -93,7 +93,9 @@ class HP_TagHandler : public wxHtmlTagHandler
wxHtmlBookRecord *m_Book;
public:
HP_TagHandler(wxHtmlBookRecord *b) : wxHtmlTagHandler() {m_Book = b; m_Items = NULL; m_ItemsCnt = 0; m_Name = m_Page = wxEmptyString; m_Level = 0; m_ID = -1; }
HP_TagHandler(wxHtmlBookRecord *b) : wxHtmlTagHandler()
{ m_Book = b; m_Items = NULL; m_ItemsCnt = 0; m_Name = m_Page = wxEmptyString;
m_Level = 0; m_ID = -1; }
wxString GetSupportedTags() { return wxT("UL,OBJECT,PARAM"); }
bool HandleTag(const wxHtmlTag& tag);
void WriteOut(wxHtmlContentsItem*& array, int& size);
@@ -103,13 +105,15 @@ class HP_TagHandler : public wxHtmlTagHandler
bool HP_TagHandler::HandleTag(const wxHtmlTag& tag)
{
if (tag.GetName() == wxT("UL")) {
if (tag.GetName() == wxT("UL"))
{
m_Level++;
ParseInner(tag);
m_Level--;
return TRUE;
}
else if (tag.GetName() == wxT("OBJECT")) {
else if (tag.GetName() == wxT("OBJECT"))
{
m_Name = m_Page = wxEmptyString;
ParseInner(tag);
@@ -147,7 +151,8 @@ bool HP_TagHandler::HandleTag(const wxHtmlTag& tag)
return TRUE;
}
else { // "PARAM"
else
{ // "PARAM"
if (m_Name == wxEmptyString && tag.GetParam(wxT("NAME")) == wxT("Name"))
{
m_Name = tag.GetParam(wxT("VALUE"));
@@ -310,15 +315,19 @@ wxHtmlHelpData::~wxHtmlHelpData()
int i;
m_BookRecords.Empty();
if (m_Contents) {
for (i = 0; i < m_ContentsCnt; i++) {
if (m_Contents)
{
for (i = 0; i < m_ContentsCnt; i++)
{
delete[] m_Contents[i].m_Page;
delete[] m_Contents[i].m_Name;
}
free(m_Contents);
}
if (m_Index) {
for (i = 0; i < m_IndexCnt; i++) {
if (m_Index)
{
for (i = 0; i < m_IndexCnt; i++)
{
delete[] m_Index[i].m_Page;
delete[] m_Index[i].m_Name;
}
@@ -338,7 +347,8 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c
parser.AddTagHandler(handler);
f = ( contentsfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(contentsfile) );
if (f) {
if (f)
{
sz = f->GetStream()->GetSize();
buf = new char[sz + 1];
buf[sz] = 0;
@@ -353,7 +363,8 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c
wxLogError(_("Cannot open contents file: %s"), contentsfile.c_str());
f = ( indexfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(indexfile) );
if (f) {
if (f)
{
sz = f->GetStream()->GetSize();
buf = new char[sz + 1];
buf[sz] = 0;
@@ -413,7 +424,8 @@ bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f)
m_Contents = (wxHtmlContentsItem*) realloc(m_Contents,
(m_ContentsCnt / wxHTML_REALLOC_STEP + 1) *
wxHTML_REALLOC_STEP * sizeof(wxHtmlContentsItem));
for (i = st; i < m_ContentsCnt; i++) {
for (i = st; i < m_ContentsCnt; i++)
{
f->Read(&x, sizeof(x));
m_Contents[i].m_Level = wxINT32_SWAP_ON_BE(x);
f->Read(&x, sizeof(x));
@@ -434,7 +446,8 @@ bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f)
m_IndexCnt += wxINT32_SWAP_ON_BE(x);
m_Index = (wxHtmlContentsItem*) realloc(m_Index, (m_IndexCnt / wxHTML_REALLOC_STEP + 1) *
wxHTML_REALLOC_STEP * sizeof(wxHtmlContentsItem));
for (i = st; i < m_IndexCnt; i++) {
for (i = st; i < m_IndexCnt; i++)
{
f->Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x);
m_Index[i].m_Name = new wxChar[x];
READ_STRING(f, m_Index[i].m_Name, x);
@@ -463,7 +476,8 @@ bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f)
for (i = 0; i < m_ContentsCnt; i++) if (m_Contents[i].m_Book == book && m_Contents[i].m_Level > 0) x++;
x = wxINT32_SWAP_ON_BE(x);
f->Write(&x, sizeof(x));
for (i = 0; i < m_ContentsCnt; i++) {
for (i = 0; i < m_ContentsCnt; i++)
{
if (m_Contents[i].m_Book != book || m_Contents[i].m_Level == 0) continue;
x = wxINT32_SWAP_ON_BE(m_Contents[i].m_Level);
f->Write(&x, sizeof(x));
@@ -483,7 +497,8 @@ bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f)
for (i = 0; i < m_IndexCnt; i++) if (m_Index[i].m_Book == book && m_Index[i].m_Level > 0) x++;
x = wxINT32_SWAP_ON_BE(x);
f->Write(&x, sizeof(x));
for (i = 0; i < m_IndexCnt; i++) {
for (i = 0; i < m_IndexCnt; i++)
{
if (m_Index[i].m_Book != book || m_Index[i].m_Level == 0) continue;
x = wxINT32_SWAP_ON_BE(wxStrlen(m_Index[i].m_Name) + 1);
f->Write(&x, sizeof(x));
@@ -499,7 +514,8 @@ bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f)
void wxHtmlHelpData::SetTempDir(const wxString& path)
{
if (path == wxEmptyString) m_TempPath = path;
else {
else
{
if (wxIsAbsolutePath(path)) m_TempPath = path;
else m_TempPath = wxGetCwd() + _T("/") + path;
@@ -702,9 +718,11 @@ wxString wxHtmlHelpData::FindPageByName(const wxString& x)
/* 1. try to open given file: */
cnt = m_BookRecords.GetCount();
for (i = 0; i < cnt; i++) {
for (i = 0; i < cnt; i++)
{
f = fsys.OpenFile(m_BookRecords[i].GetBasePath() + x);
if (f) {
if (f)
{
url = m_BookRecords[i].GetBasePath() + x;
delete f;
return url;
@@ -714,8 +732,10 @@ wxString wxHtmlHelpData::FindPageByName(const wxString& x)
/* 2. try to find a book: */
for (i = 0; i < cnt; i++) {
if (m_BookRecords[i].GetTitle() == x) {
for (i = 0; i < cnt; i++)
{
if (m_BookRecords[i].GetTitle() == x)
{
url = m_BookRecords[i].GetBasePath() + m_BookRecords[i].GetStart();
return url;
}
@@ -724,8 +744,10 @@ wxString wxHtmlHelpData::FindPageByName(const wxString& x)
/* 3. try to find in contents: */
cnt = m_ContentsCnt;
for (i = 0; i < cnt; i++) {
if (wxStrcmp(m_Contents[i].m_Name, x) == 0) {
for (i = 0; i < cnt; i++)
{
if (wxStrcmp(m_Contents[i].m_Name, x) == 0)
{
url = m_Contents[i].m_Book->GetBasePath() + m_Contents[i].m_Page;
return url;
}
@@ -735,8 +757,10 @@ wxString wxHtmlHelpData::FindPageByName(const wxString& x)
/* 4. try to find in index: */
cnt = m_IndexCnt;
for (i = 0; i < cnt; i++) {
if (wxStrcmp(m_Index[i].m_Name, x) == 0) {
for (i = 0; i < cnt; i++)
{
if (wxStrcmp(m_Index[i].m_Name, x) == 0)
{
url = m_Index[i].m_Book->GetBasePath() + m_Index[i].m_Page;
return url;
}
@@ -750,8 +774,10 @@ wxString wxHtmlHelpData::FindPageById(int id)
int i;
wxString url(wxEmptyString);
for (i = 0; i < m_ContentsCnt; i++) {
if (m_Contents[i].m_ID == id) {
for (i = 0; i < m_ContentsCnt; i++)
{
if (m_Contents[i].m_ID == id)
{
url = m_Contents[i].m_Book->GetBasePath() + m_Contents[i].m_Page;
return url;
}
@@ -771,11 +797,13 @@ wxHtmlSearchStatus::wxHtmlSearchStatus(wxHtmlHelpData* data, const wxString& key
m_Data = data;
m_Keyword = keyword;
wxHtmlBookRecord* bookr = NULL;
if (book != wxEmptyString) {
if (book != wxEmptyString)
{
// we have to search in a specific book. Find it first
int i, cnt = data->m_BookRecords.GetCount();
for (i = 0; i < cnt; i++)
if (data->m_BookRecords[i].GetTitle() == book) {
if (data->m_BookRecords[i].GetTitle() == book)
{
bookr = &(data->m_BookRecords[i]);
m_CurIndex = bookr->GetContentsStart();
m_MaxIndex = bookr->GetContentsEnd();
@@ -784,7 +812,8 @@ wxHtmlSearchStatus::wxHtmlSearchStatus(wxHtmlHelpData* data, const wxString& key
// check; we won't crash if the book doesn't exist, but it's Bad Anyway.
wxASSERT(bookr);
}
if (! bookr) {
if (! bookr)
{
// no book specified; search all books
m_CurIndex = 0;
m_MaxIndex = m_Data->m_ContentsCnt;
@@ -801,7 +830,8 @@ bool wxHtmlSearchStatus::Search()
bool found = FALSE;
wxChar *thepage;
if (!m_Active) {
if (!m_Active)
{
// sanity check. Illegal use, but we'll try to prevent a crash anyway
wxASSERT(m_Active);
return FALSE;
@@ -860,10 +890,14 @@ void wxSearchEngine::LookFor(const wxString& keyword, bool case_sensitive, bool
wxStrcpy(m_Keyword, keyword.c_str());
if (!m_CaseSensitive)
{
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');
}
}
}
@@ -887,7 +921,8 @@ bool wxSearchEngine::Scan(wxInputStream *stream)
if (m_WholeWords)
{
for (i = 0; i < lng - wrd; i++) {
for (i = 0; i < lng - wrd; i++)
{
if (WHITESPACE(buf[i])) continue;
j = 0;
while ((j < wrd) && (buf[i + j] == m_Keyword[j])) j++;
@@ -897,7 +932,8 @@ bool wxSearchEngine::Scan(wxInputStream *stream)
else
{
for (i = 0; i < lng - wrd; i++) {
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; }

View File

@@ -135,10 +135,12 @@ wxHtmlHelpFrame::wxHtmlHelpFrame(wxWindow* parent, wxWindowID id, const wxString
void wxHtmlHelpFrame::Init(wxHtmlHelpData* data)
{
if (data) {
if (data)
{
m_Data = data;
m_DataCreated = FALSE;
} else {
} else
{
m_Data = new wxHtmlHelpData();
m_DataCreated = TRUE;
}
@@ -216,7 +218,8 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti
CreateStatusBar();
// toolbar?
if (style & (wxHF_TOOLBAR | wxHF_FLATTOOLBAR)) {
if (style & (wxHF_TOOLBAR | wxHF_FLATTOOLBAR))
{
wxToolBar *toolBar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL |
wxTB_DOCKABLE |
(style & wxHF_FLATTOOLBAR ? wxTB_FLAT : 0));
@@ -225,7 +228,8 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti
toolBar->Realize();
}
if (style & (wxHF_CONTENTS | wxHF_INDEX | wxHF_SEARCH)) {
if (style & (wxHF_CONTENTS | wxHF_INDEX | wxHF_SEARCH))
{
// traditional help controller; splitter window with html page on the
// right and a notebook containing various pages on the left
m_Splitter = new wxSplitterWindow(this);
@@ -233,7 +237,9 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti
m_HtmlWin = new wxHtmlHelpHtmlWindow(this, m_Splitter);
m_NavigPan = new wxNotebook(m_Splitter, wxID_HTML_NOTEBOOK,
wxDefaultPosition, wxDefaultSize);
} else { // only html window, no notebook with index,contents etc
}
else
{ // only html window, no notebook with index,contents etc
m_HtmlWin = new wxHtmlWindow(this);
}
@@ -243,10 +249,12 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti
m_HtmlWin->ReadCustomization(m_Config, m_ConfigRoot);
// contents tree panel?
if (style & wxHF_CONTENTS) {
if (style & wxHF_CONTENTS)
{
wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE);
if (style & wxHF_BOOKMARKS) {
if (style & wxHF_BOOKMARKS)
{
wxLayoutConstraints *b1 = new wxLayoutConstraints;
wxBitmapButton *bmpbt = new wxBitmapButton(dummy, wxID_HTML_BOOKMARKSREMOVE, wxBITMAP(wbkdel), wxDefaultPosition, wxSize(20,20));
@@ -316,7 +324,8 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti
}
// index listbox panel?
if (style & wxHF_INDEX) {
if (style & wxHF_INDEX)
{
wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE);
wxLayoutConstraints *b1 = new wxLayoutConstraints;
@@ -374,7 +383,8 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti
}
// search list panel?
if (style & wxHF_SEARCH) {
if (style & wxHF_SEARCH)
{
wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_SEARCHPAGE);
wxLayoutConstraints *b1 = new wxLayoutConstraints;
@@ -439,19 +449,24 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti
RefreshLists();
// showtime
if (m_NavigPan && m_Splitter) {
if (m_NavigPan && m_Splitter)
{
m_Splitter->SetMinimumPaneSize(20);
if (m_Cfg.navig_on)
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
else {
else
{
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
m_Splitter->Unsplit();
}
if (m_Cfg.navig_on) {
if (m_Cfg.navig_on)
{
m_NavigPan->Show(TRUE);
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
}
else {
else
{
m_NavigPan->Show(FALSE);
m_Splitter->Initialize(m_HtmlWin);
}
@@ -546,7 +561,8 @@ void wxHtmlHelpFrame::SetTitleFormat(const wxString& format)
bool wxHtmlHelpFrame::Display(const wxString& x)
{
wxString url = m_Data->FindPageByName(x);
if (! url.IsEmpty()) {
if (!url.IsEmpty())
{
m_HtmlWin->LoadPage(url);
NotifyPageChanged();
return TRUE;
@@ -557,7 +573,8 @@ bool wxHtmlHelpFrame::Display(const wxString& x)
bool wxHtmlHelpFrame::Display(const int id)
{
wxString url = m_Data->FindPageById(id);
if (! url.IsEmpty()) {
if (!url.IsEmpty())
{
m_HtmlWin->LoadPage(url);
NotifyPageChanged();
return TRUE;
@@ -571,7 +588,8 @@ bool wxHtmlHelpFrame::DisplayContents()
{
if (! m_ContentsBox)
return FALSE;
if (!m_Splitter -> IsSplit()) {
if (!m_Splitter->IsSplit())
{
m_NavigPan->Show(TRUE);
m_HtmlWin->Show(TRUE);
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
@@ -587,7 +605,8 @@ bool wxHtmlHelpFrame::DisplayIndex()
{
if (! m_IndexList)
return FALSE;
if (!m_Splitter -> IsSplit()) {
if (!m_Splitter->IsSplit())
{
m_NavigPan->Show(TRUE);
m_HtmlWin->Show(TRUE);
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
@@ -607,7 +626,8 @@ bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword)
wxString foundstr;
wxString book = wxEmptyString;
if (!m_Splitter -> IsSplit()) {
if (!m_Splitter->IsSplit())
{
m_NavigPan->Show(TRUE);
m_HtmlWin->Show(TRUE);
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
@@ -628,11 +648,13 @@ bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword)
status.GetMaxIndex(), this,
wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE);
while (status.IsActive()) {
while (status.IsActive())
{
curi = status.GetCurIndex();
if (curi % 32 == 0 && progress.Update(curi) == FALSE)
break;
if (status.Search()) {
if (status.Search())
{
foundstr.Printf(_("Found %i matches"), ++foundcnt);
progress.Update(status.GetCurIndex(), foundstr);
m_SearchList->Append(status.GetName(), status.GetContentsItem());
@@ -642,7 +664,8 @@ bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword)
m_SearchButton->Enable(TRUE);
m_SearchText->SetSelection(0, keyword.Length());
m_SearchText->SetFocus();
if (foundcnt) {
if (foundcnt)
{
wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList->GetClientData(0);
if (it)
{
@@ -680,21 +703,26 @@ void wxHtmlHelpFrame::CreateContents()
m_ContentsBox->SetItemSelectedImage(roots[0], IMG_RootFolder);
imaged[0] = TRUE;
for (it = m_Data->GetContents(), i = 0; i < cnt; i++, it++) {
for (it = m_Data->GetContents(), i = 0; i < cnt; i++, it++)
{
roots[it->m_Level + 1] = m_ContentsBox->AppendItem(
roots[it->m_Level], it->m_Name, IMG_Page, -1,
new wxHtmlHelpTreeItemData(i));
m_PagesHash->Put(it->m_Book->GetBasePath() + it->m_Page,
new wxHtmlHelpHashData(i, roots[it->m_Level + 1]));
if (it -> m_Level == 0) {
if (it->m_Level == 0)
{
m_ContentsBox->SetItemBold(roots[1], TRUE);
m_ContentsBox->SetItemImage(roots[1], IMG_Book);
m_ContentsBox->SetItemSelectedImage(roots[1], IMG_Book);
imaged[1] = TRUE;
} else imaged[it -> m_Level + 1] = FALSE;
}
else
imaged[it->m_Level + 1] = FALSE;
if (!imaged[it -> m_Level]) {
if (!imaged[it->m_Level])
{
m_ContentsBox->SetItemImage(roots[it->m_Level], IMG_Folder);
m_ContentsBox->SetItemSelectedImage(roots[it->m_Level], IMG_Folder);
imaged[it->m_Level] = TRUE;
@@ -752,7 +780,8 @@ void wxHtmlHelpFrame::ReadCustomization(wxConfigBase *cfg, const wxString& path)
wxString oldpath;
wxString tmp;
if (path != wxEmptyString) {
if (path != wxEmptyString)
{
oldpath = cfg->GetPath();
cfg->SetPath(_T("/") + path);
}
@@ -774,15 +803,18 @@ void wxHtmlHelpFrame::ReadCustomization(wxConfigBase *cfg, const wxString& path)
wxString val, s;
cnt = cfg->Read(wxT("hcBookmarksCnt"), 0L);
if (cnt != 0) {
if (cnt != 0)
{
m_BookmarksNames.Clear();
m_BookmarksPages.Clear();
if (m_Bookmarks) {
if (m_Bookmarks)
{
m_Bookmarks->Clear();
m_Bookmarks->Append(_("(bookmarks)"));
}
for (i = 0; i < cnt; i++) {
for (i = 0; i < cnt; i++)
{
val.Printf(wxT("hcBookmark_%i"), i);
s = cfg->Read(val);
m_BookmarksNames.Add(s);
@@ -806,7 +838,8 @@ void wxHtmlHelpFrame::WriteCustomization(wxConfigBase *cfg, const wxString& path
wxString oldpath;
wxString tmp;
if (path != wxEmptyString) {
if (path != wxEmptyString)
{
oldpath = cfg->GetPath();
cfg->SetPath(_T("/") + path);
}
@@ -821,13 +854,15 @@ void wxHtmlHelpFrame::WriteCustomization(wxConfigBase *cfg, const wxString& path
cfg->Write(wxT("hcNormalFace"), m_NormalFace);
cfg->Write(wxT("hcFontSize"), (long)m_FontSize);
if (m_Bookmarks) {
if (m_Bookmarks)
{
int i;
int cnt = m_BookmarksNames.GetCount();
wxString val;
cfg->Write(wxT("hcBookmarksCnt"), (long)cnt);
for (i = 0; i < cnt; i++) {
for (i = 0; i < cnt; i++)
{
val.Printf(wxT("hcBookmark_%i"), i);
cfg->Write(val, m_BookmarksNames[i]);
val.Printf(wxT("hcBookmark_%i_url"), i);
@@ -967,14 +1002,16 @@ void wxHtmlHelpFrame::OptionsDialog()
wxHtmlHelpFrameOptionsDialog dlg(this);
unsigned i;
if (m_NormalFonts == NULL) {
if (m_NormalFonts == NULL)
{
wxFontEnumerator enu;
enu.EnumerateFacenames();
m_NormalFonts = new wxArrayString;
*m_NormalFonts = *enu.GetFacenames();
m_NormalFonts->Sort();
}
if (m_FixedFonts == NULL) {
if (m_FixedFonts == NULL)
{
wxFontEnumerator enu;
enu.EnumerateFacenames(wxFONTENCODING_SYSTEM, TRUE);
m_FixedFonts = new wxArrayString;
@@ -993,7 +1030,8 @@ void wxHtmlHelpFrame::OptionsDialog()
dlg.RadioBox->SetSelection(m_FontSize);
dlg.UpdateTestWin();
if (dlg.ShowModal() == wxID_OK) {
if (dlg.ShowModal() == wxID_OK)
{
m_NormalFace = dlg.NormalFont->GetStringSelection();
m_FixedFace = dlg.FixedFont->GetStringSelection();
m_FontSize = dlg.RadioBox->GetSelection();
@@ -1033,8 +1071,8 @@ EVENT HANDLING :
void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event)
{
switch (event.GetId()) {
switch (event.GetId())
{
case wxID_HTML_BACK :
m_HtmlWin->HistoryBack();
NotifyPageChanged();
@@ -1116,11 +1154,14 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event)
{
if (! (m_Splitter && m_NavigPan))
return ;
if (m_Splitter -> IsSplit()) {
if (m_Splitter->IsSplit())
{
m_Cfg.sashpos = m_Splitter->GetSashPosition();
m_Splitter->Unsplit(m_NavigPan);
m_Cfg.navig_on = FALSE;
} else {
}
else
{
m_NavigPan->Show(TRUE);
m_HtmlWin->Show(TRUE);
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
@@ -1140,8 +1181,10 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event)
item = m_HtmlWin->GetOpenedPageTitle();
url = m_HtmlWin->GetOpenedPage();
if (item == wxEmptyString) item = url.AfterLast(wxT('/'));
if (m_BookmarksPages.Index(url) == wxNOT_FOUND) {
if (item == wxEmptyString)
item = url.AfterLast(wxT('/'));
if (m_BookmarksPages.Index(url) == wxNOT_FOUND)
{
m_Bookmarks->Append(item);
m_BookmarksNames.Add(item);
m_BookmarksPages.Add(url);
@@ -1156,7 +1199,8 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event)
item = m_Bookmarks->GetStringSelection();
pos = m_BookmarksNames.Index(item);
if (pos != wxNOT_FOUND) {
if (pos != wxNOT_FOUND)
{
m_BookmarksNames.Remove(pos);
m_BookmarksPages.Remove(pos);
m_Bookmarks->Delete(m_Bookmarks->GetSelection());
@@ -1241,9 +1285,11 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event)
wxString sr = m_IndexText->GetLineText(0);
sr.MakeLower();
if (sr == wxEmptyString)
{
OnIndexAll(event);
else {
}
else
{
wxBusyCursor bcur;
const wxChar *cstr = sr.c_str();
wxChar mybuff[512], *ptr;
@@ -1261,10 +1307,12 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event)
for (ptr = mybuff; *ptr != 0; ptr++)
if (*ptr >= _T('A') && *ptr <= _T('Z'))
*ptr -= (wxChar)(_T('A') - _T('a'));
if (wxStrstr(mybuff, cstr) != NULL) {
if (wxStrstr(mybuff, cstr) != NULL)
{
m_IndexList->Append(index[i].m_Name, (char*)(index + i));
displ++;
if (first) {
if (first)
{
m_HtmlWin->LoadPage(index[i].m_Book->GetBasePath() + index[i].m_Page);
NotifyPageChanged();
first = FALSE;
@@ -1290,9 +1338,11 @@ void wxHtmlHelpFrame::OnIndexAll(wxCommandEvent& WXUNUSED(event))
bool first = TRUE;
wxHtmlContentsItem* index = m_Data->GetIndex();
for (int i = 0; i < cnt; i++) {
for (int i = 0; i < cnt; i++)
{
m_IndexList->Append(index[i].m_Name, (char*)(index + i));
if (first) {
if (first)
{
m_HtmlWin->LoadPage(index[i].m_Book->GetBasePath() + index[i].m_Page);
NotifyPageChanged();
first = FALSE;

View File

@@ -69,13 +69,15 @@ void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y,
bool wxHtmlCell::AdjustPagebreak(int *pagebreak) const
{
if ((!m_CanLiveOnPagebreak) &&
m_PosY < *pagebreak && m_PosY + m_Height > *pagebreak) {
m_PosY < *pagebreak && m_PosY + m_Height > *pagebreak)
{
*pagebreak = m_PosY;
if (m_Next != NULL) m_Next->AdjustPagebreak(pagebreak);
return TRUE;
}
else {
else
{
if (m_Next != NULL) return m_Next->AdjustPagebreak(pagebreak);
else return FALSE;
}
@@ -327,12 +329,14 @@ bool wxHtmlContainerCell::AdjustPagebreak(int *pagebreak) const
if (!m_CanLiveOnPagebreak)
return wxHtmlCell::AdjustPagebreak(pagebreak);
else {
else
{
wxHtmlCell *c = GetFirstCell();
bool rt = FALSE;
int pbrk = *pagebreak - m_PosY;
while (c) {
while (c)
{
if (c->AdjustPagebreak(&pbrk)) rt = TRUE;
c = c->GetNext();
}
@@ -345,7 +349,8 @@ bool wxHtmlContainerCell::AdjustPagebreak(int *pagebreak) const
void wxHtmlContainerCell::Layout(int w)
{
if (m_LastLayout == w) {
if (m_LastLayout == w)
{
wxHtmlCell::Layout(w);
return;
}
@@ -365,16 +370,19 @@ void wxHtmlContainerCell::Layout(int w)
*/
if (m_WidthFloatUnits == wxHTML_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;
}
else {
else
{
if (m_WidthFloat < 0) m_Width = w + m_WidthFloat;
else m_Width = m_WidthFloat;
}
if (m_Cells) {
if (m_Cells)
{
int l = (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
int r = (m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight;
m_Cells->Layout(m_Width - (l + r));
@@ -391,8 +399,10 @@ void wxHtmlContainerCell::Layout(int w)
s_width = m_Width - s_indent - ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
// my own layouting:
while (cell != NULL) {
switch (m_AlignVer) {
while (cell != NULL)
{
switch (m_AlignVer)
{
case wxHTML_ALIGN_TOP : ybasicpos = 0; break;
case wxHTML_ALIGN_BOTTOM : ybasicpos = - cell->GetHeight(); break;
case wxHTML_ALIGN_CENTER : ybasicpos = - cell->GetHeight() / 2; break;
@@ -408,7 +418,8 @@ void wxHtmlContainerCell::Layout(int w)
xcnt++;
// force new line if occured:
if ((cell == NULL) || (xpos + cell -> GetWidth() > s_width)) {
if ((cell == NULL) || (xpos + cell->GetWidth() > s_width))
{
if (xpos > MaxLineWidth) MaxLineWidth = xpos;
if (ysizeup < 0) ysizeup = 0;
if (ysizedown < 0) ysizedown = 0;
@@ -430,7 +441,8 @@ void wxHtmlContainerCell::Layout(int w)
ypos += ysizeup;
if (m_AlignHor != wxHTML_ALIGN_JUSTIFY || cell == NULL)
while (line != cell) {
while (line != cell)
{
line->SetPos(line->GetPosX() + xdelta,
ypos + line->GetPosY());
line = line->GetNext();
@@ -441,7 +453,8 @@ void wxHtmlContainerCell::Layout(int w)
int step = (s_width - xpos);
if (step < 0) step = 0;
xcnt--;
if (xcnt > 0) while (line != cell) {
if (xcnt > 0) while (line != cell)
{
line->SetPos(line->GetPosX() + s_indent +
(counter++ * step / xcnt),
ypos + line->GetPosY());
@@ -460,12 +473,15 @@ void wxHtmlContainerCell::Layout(int w)
// setup height & width, depending on container layout:
m_Height = ypos + (ysizedown + ysizeup) + m_IndentBottom;
if (m_Height < m_MinHeight) {
if (m_MinHeightAlign != wxHTML_ALIGN_TOP) {
if (m_Height < m_MinHeight)
{
if (m_MinHeightAlign != wxHTML_ALIGN_TOP)
{
int diff = m_MinHeight - m_Height;
if (m_MinHeightAlign == wxHTML_ALIGN_CENTER) diff /= 2;
cell = m_Cells;
while (cell) {
while (cell)
{
cell->SetPos(cell->GetPosX(), cell->GetPosY() + diff);
cell = cell->GetNext();
}
@@ -488,9 +504,11 @@ void wxHtmlContainerCell::Layout(int w)
void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
{
// container visible, draw it:
if ((y + m_PosY < view_y2) && (y + m_PosY + m_Height > view_y1)) {
if ((y + m_PosY < view_y2) && (y + m_PosY + m_Height > view_y1))
{
if (m_UseBkColour) {
if (m_UseBkColour)
{
wxBrush myb = wxBrush(m_BkColour, wxSOLID);
int real_y1 = mMax(y + m_PosY, view_y1);
@@ -501,7 +519,8 @@ void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
dc.DrawRectangle(x + m_PosX, real_y1, m_Width, real_y2 - real_y1 + 1);
}
if (m_UseBorder) {
if (m_UseBorder)
{
wxPen mypen1(m_BorderColour1, 1, wxSOLID);
wxPen mypen2(m_BorderColour2, 1, wxSOLID);
@@ -516,7 +535,8 @@ void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
if (m_Cells) m_Cells->Draw(dc, x + m_PosX, y + m_PosY, view_y1, view_y2);
}
// container invisible, just proceed font+color changing:
else {
else
{
if (m_Cells) m_Cells->DrawInvisible(dc, x + m_PosX, y + m_PosY);
}
@@ -538,7 +558,8 @@ wxHtmlLinkInfo *wxHtmlContainerCell::GetLink(int x, int y) const
wxHtmlCell *c = m_Cells;
int cx, cy, cw, ch;
while (c) {
while (c)
{
cx = c->GetPosX(), cy = c->GetPosY();
cw = c->GetWidth(), ch = c->GetHeight();
if ((x >= cx) && (x < cx + cw) && (y >= cy) && (y < cy + ch))
@@ -553,7 +574,8 @@ wxHtmlLinkInfo *wxHtmlContainerCell::GetLink(int x, int y) const
void wxHtmlContainerCell::InsertCell(wxHtmlCell *f)
{
if (!m_Cells) m_Cells = m_LastCell = f;
else {
else
{
m_LastCell->SetNext(f);
m_LastCell = f;
if (m_LastCell) while (m_LastCell->GetNext()) m_LastCell = m_LastCell->GetNext();
@@ -566,7 +588,8 @@ void wxHtmlContainerCell::InsertCell(wxHtmlCell *f)
void wxHtmlContainerCell::SetAlign(const wxHtmlTag& tag)
{
if (tag.HasParam(wxT("ALIGN"))) {
if (tag.HasParam(wxT("ALIGN")))
{
wxString alg = tag.GetParam(wxT("ALIGN"));
alg.MakeUpper();
if (alg == wxT("CENTER"))
@@ -585,15 +608,18 @@ void wxHtmlContainerCell::SetAlign(const wxHtmlTag& tag)
void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag, double pixel_scale)
{
if (tag.HasParam(wxT("WIDTH"))) {
if (tag.HasParam(wxT("WIDTH")))
{
int wdi;
wxString wd = tag.GetParam(wxT("WIDTH"));
if (wd[wd.Length()-1] == wxT('%')) {
if (wd[wd.Length()-1] == wxT('%'))
{
wxSscanf(wd.c_str(), wxT("%i%%"), &wdi);
SetWidthFloat(wdi, wxHTML_UNITS_PERCENT);
}
else {
else
{
wxSscanf(wd.c_str(), wxT("%i"), &wdi);
SetWidthFloat((int)(pixel_scale * (double)wdi), wxHTML_UNITS_PIXELS);
}
@@ -607,7 +633,8 @@ const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) co
{
const wxHtmlCell *r = NULL;
if (m_Cells) {
if (m_Cells)
{
r = m_Cells->Find(condition, param);
if (r) return r;
}
@@ -619,13 +646,16 @@ const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) co
void wxHtmlContainerCell::OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event)
{
if (m_Cells) {
if (m_Cells)
{
wxHtmlCell *c = m_Cells;
while (c) {
while (c)
{
if ( (c->GetPosX() <= x) &&
(c->GetPosY() <= y) &&
(c->GetPosX() + c->GetWidth() > x) &&
(c -> GetPosY() + c -> GetHeight() > y)) {
(c->GetPosY() + c->GetHeight() > y))
{
c->OnMouseClick(parent, x - c->GetPosX(), y - c->GetPosY(), event);
break;
}
@@ -646,7 +676,8 @@ void wxHtmlColourCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
{
if (m_Flags & wxHTML_CLR_FOREGROUND)
dc.SetTextForeground(m_Colour);
if (m_Flags & wxHTML_CLR_BACKGROUND) {
if (m_Flags & wxHTML_CLR_BACKGROUND)
{
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
dc.SetTextBackground(m_Colour);
}
@@ -657,7 +688,8 @@ void wxHtmlColourCell::DrawInvisible(wxDC& dc, int x, int y)
{
if (m_Flags & wxHTML_CLR_FOREGROUND)
dc.SetTextForeground(m_Colour);
if (m_Flags & wxHTML_CLR_BACKGROUND) {
if (m_Flags & wxHTML_CLR_BACKGROUND)
{
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
dc.SetTextBackground(m_Colour);
}
@@ -709,7 +741,8 @@ void wxHtmlWidgetCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
int absx = 0, absy = 0, stx, sty;
wxHtmlCell *c = this;
while (c) {
while (c)
{
absx += c->GetPosX();
absy += c->GetPosY();
c = c->GetParent();
@@ -728,7 +761,8 @@ void wxHtmlWidgetCell::DrawInvisible(wxDC& dc, int x, int y)
int absx = 0, absy = 0, stx, sty;
wxHtmlCell *c = this;
while (c) {
while (c)
{
absx += c->GetPosX();
absy += c->GetPosY();
c = c->GetParent();
@@ -744,7 +778,8 @@ void wxHtmlWidgetCell::DrawInvisible(wxDC& dc, int x, int y)
void wxHtmlWidgetCell::Layout(int w)
{
if (m_WidthFloat != 0) {
if (m_WidthFloat != 0)
{
m_Width = (w * m_WidthFloat) / 100;
m_Wnd->SetSize(m_Width, m_Height);
}

View File

@@ -82,19 +82,23 @@ void wxHtmlParser::DoParsing(int begin_pos, int end_pos)
templen = 0;
i = begin_pos;
while (i < end_pos) {
while (i < end_pos)
{
c = m_Source[(unsigned int) i];
// continue building word:
if (c != '<') {
if (c != '<')
{
temp[templen++] = c;
i++;
}
else if (c == '<') {
else if (c == '<')
{
wxHtmlTag tag(m_Source, i, end_pos, m_Cache);
if (templen) {
if (templen)
{
temp[templen] = 0;
AddText(temp);
templen = 0;
@@ -105,7 +109,8 @@ void wxHtmlParser::DoParsing(int begin_pos, int end_pos)
}
}
if (templen) { // last word of block :-(
if (templen)
{ // last word of block :-(
temp[templen] = 0;
AddText(temp);
}
@@ -122,7 +127,8 @@ void wxHtmlParser::AddTag(const wxHtmlTag& tag)
h = (wxHtmlTagHandler*) m_HandlersHash.Get(tag.GetName());
if (h)
inner = h->HandleTag(tag);
if (!inner) {
if (!inner)
{
if (tag.HasEnding())
DoParsing(tag.GetBeginPos(), tag.GetEndPos1());
}
@@ -151,14 +157,16 @@ void wxHtmlParser::PushTagHandler(wxHtmlTagHandler *handler, wxString tags)
wxStringTokenizer tokenizer(tags, ", ");
wxString key;
if (m_HandlersStack == NULL) {
if (m_HandlersStack == NULL)
{
m_HandlersStack = new wxList;
m_HandlersStack->DeleteContents(TRUE);
}
m_HandlersStack->Insert(new wxHashTable(m_HandlersHash));
while (tokenizer.HasMoreTokens()) {
while (tokenizer.HasMoreTokens())
{
key = tokenizer.NextToken();
m_HandlersHash.Delete(key);
m_HandlersHash.Put(key, handler);

View File

@@ -52,8 +52,10 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
m_CachePos = 0;
pos = 0;
while (pos < lng) {
if (src[pos] == wxT('<')) { // tag found:
while (pos < lng)
{
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++;
@@ -62,7 +64,8 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
while (pos < lng &&
src[pos] != wxT('>') &&
src[pos] != wxT(' ') && src[pos] != wxT('\r') &&
src[pos] != wxT('\n') && src[pos] != wxT('\t')) {
src[pos] != wxT('\n') && src[pos] != wxT('\t'))
{
dummy[i] = src[pos++];
if ((dummy[i] >= wxT('a')) && (dummy[i] <= wxT('z'))) dummy[i] -= (wxT('a') - wxT('A'));
i++;
@@ -73,17 +76,20 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
while (pos < lng && src[pos] != wxT('>')) pos++;
if (src[stpos+1] == wxT('/')) { // 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) && (wxStrcmp(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;
}
}
else {
else
{
m_Cache[tg].End1 = m_Cache[tg].End2 = -1;
}
}
@@ -92,7 +98,8 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
}
// ok, we're done, now we'll free .Name members of cache - we don't need it anymore:
for (i = 0; i < m_CacheSize; i++) {
for (i = 0; i < m_CacheSize; i++)
{
delete[] m_Cache[i].Name;
m_Cache[i].Name = NULL;
}
@@ -103,7 +110,8 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
void wxHtmlTagsCache::QueryTag(int at, int* end1, int* end2)
{
if (m_Cache == NULL) return;
if (m_Cache[m_CachePos].Key != at) {
if (m_Cache[m_CachePos].Key != at)
{
int delta = (at < m_Cache[m_CachePos].Key) ? -1 : 1;
do {m_CachePos += delta;} while (m_Cache[m_CachePos].Key != at);
}
@@ -133,21 +141,25 @@ wxHtmlTag::wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCac
while ((i < end_pos) &&
((c = source[i++]) != ' ' && c != '\r' && c != '\n' && c != '\t' &&
c != '>')) {
c != '>'))
{
if ((c >= 'a') && (c <= 'z')) c -= ('a' - 'A');
m_Name += c;
}
if (source[i-1] != '>')
while ((i < end_pos) && ((c = source[i++]) != '>')) {
while ((i < end_pos) && ((c = source[i++]) != '>'))
{
if ((c >= 'a') && (c <= 'z')) c -= ('a' - 'A');
if (c == '\r' || c == '\n' || c == '\t') c = ' '; // make future parsing a bit simpler
m_Params += c;
if (c == '"') {
if (c == '"')
{
while ((i < end_pos) && ((c = source[i++]) != '"')) m_Params += c;
m_Params += c;
}
else if (c == '\'') {
else if (c == '\'')
{
while ((i < end_pos) && ((c = source[i++]) != '\'')) m_Params += c;
m_Params += c;
}
@@ -168,16 +180,20 @@ bool wxHtmlTag::HasParam(const wxString& par) const
if (*st == 0) return FALSE;
if (*p == 0) return FALSE;
for (st2 = st, p2 = p; ; st2++) {
for (st2 = st, p2 = p; ; st2++)
{
if (*p2 == 0) return TRUE;
if (*st2 == 0) return FALSE;
if (*p2 != *st2) p2 = p;
if (*p2 == *st2) p2++;
if (*st2 == ' ') p2 = p;
else if (*st2 == '=') {
else if (*st2 == '=')
{
p2 = p;
while (*st2 != ' ') {
if (*st2 == '"') {
while (*st2 != ' ')
{
if (*st2 == '"')
{
st2++;
while (*st2 != '"') st2++;
}
@@ -199,23 +215,29 @@ wxString wxHtmlTag::GetParam(const wxString& par, bool with_commas) const
if (*st == 0) return "";
if (*p == 0) return "";
for (st2 = st, p2 = p; ; st2++) {
if (*p2 == 0) { // found
for (st2 = st, p2 = p; ; st2++)
{
if (*p2 == 0) // found
{
wxString fnd = "";
st2++; // '=' character
comma = FALSE;
comma_char = '\0';
if (!with_commas && (*(st2) == '"')) {
if (!with_commas && (*(st2) == '"'))
{
st2++;
comma = TRUE;
comma_char = '"';
}
else if (!with_commas && (*(st2) == '\'')) {
else if (!with_commas && (*(st2) == '\''))
{
st2++;
comma = TRUE;
comma_char = '\'';
}
while (*st2 != 0) {
while (*st2 != 0)
{
if (comma && *st2 == comma_char) comma = FALSE;
else if ((*st2 == ' ') && (!comma)) break;
fnd += (*(st2++));
@@ -227,14 +249,18 @@ wxString wxHtmlTag::GetParam(const wxString& par, bool with_commas) const
if (*p2 != *st2) p2 = p;
if (*p2 == *st2) p2++;
if (*st2 == ' ') p2 = p;
else if (*st2 == '=') {
else if (*st2 == '=')
{
p2 = p;
while (*st2 != ' ') {
if (*st2 == '"') {
while (*st2 != ' ')
{
if (*st2 == '"')
{
st2++;
while (*st2 != '"') st2++;
}
else if (*st2 == '\'') {
else if (*st2 == '\'')
{
st2++;
while (*st2 != '\'') st2++;
}

View File

@@ -58,7 +58,7 @@ wxHtmlWindow::wxHtmlWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos,
m_HistoryPos = -1;
m_HistoryOn = TRUE;
m_Style = style;
SetPage("<html><body></body></html>");
SetPage(wxT("<html><body></body></html>"));
}
@@ -109,7 +109,8 @@ bool wxHtmlWindow::SetPage(const wxString& source)
SetBackgroundColour(wxColour(0xFF, 0xFF, 0xFF));
m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString;
m_Parser->SetDC(dc);
if (m_Cell) {
if (m_Cell)
{
delete m_Cell;
m_Cell = NULL;
}
@@ -133,43 +134,50 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
wxYield(); Refresh(FALSE);
m_tmpCanDrawLocks++;
if (m_HistoryOn && (m_HistoryPos != -1)) { // store scroll position into history item
if (m_HistoryOn && (m_HistoryPos != -1)) // store scroll position into history item
{
int x, y;
ViewStart(&x, &y);
m_History[m_HistoryPos].SetPos(y);
}
if (location[0] == wxT('#')) { // local anchor
if (location[0] == wxT('#')) // local anchor
{
wxString anch = location.Mid(1) /*1 to end*/;
m_tmpCanDrawLocks--;
rt_val = ScrollToAnchor(anch);
m_tmpCanDrawLocks++;
}
else if (location.Find(wxT('#')) != wxNOT_FOUND && location.BeforeFirst(wxT('#')) == m_OpenedPage) {
else if (location.Find(wxT('#')) != wxNOT_FOUND && location.BeforeFirst(wxT('#')) == m_OpenedPage)
{
wxString anch = location.AfterFirst(wxT('#'));
m_tmpCanDrawLocks--;
rt_val = ScrollToAnchor(anch);
m_tmpCanDrawLocks++;
}
else if (location.Find(wxT('#')) != wxNOT_FOUND &&
(m_FS -> GetPath() + location.BeforeFirst(wxT('#'))) == m_OpenedPage) {
(m_FS->GetPath() + location.BeforeFirst(wxT('#'))) == m_OpenedPage)
{
wxString anch = location.AfterFirst(wxT('#'));
m_tmpCanDrawLocks--;
rt_val = ScrollToAnchor(anch);
m_tmpCanDrawLocks++;
}
else {
else
{
needs_refresh = TRUE;
// load&display it:
if (m_RelatedStatusBar != -1) {
if (m_RelatedStatusBar != -1)
{
m_RelatedFrame->SetStatusText(_("Connecting..."), m_RelatedStatusBar);
Refresh(FALSE);
}
f = m_FS->OpenFile(location);
if (f == NULL) {
if (f == NULL)
{
wxString err;
wxLogError(_("Unable to open requested HTML document: %s"), location.c_str());
@@ -179,26 +187,31 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
return FALSE;
}
else {
else
{
wxNode *node;
wxString src = wxEmptyString;
if (m_RelatedStatusBar != -1) {
if (m_RelatedStatusBar != -1)
{
wxString msg = _("Loading : ") + location;
m_RelatedFrame->SetStatusText(msg, m_RelatedStatusBar);
Refresh(FALSE);
}
node = m_Filters.GetFirst();
while (node){
while (node)
{
wxHtmlFilter *h = (wxHtmlFilter*) node->GetData();
if (h -> CanRead(*f)) {
if (h->CanRead(*f))
{
src = h->ReadFile(*f);
break;
}
node = node->GetNext();
}
if (src == wxEmptyString) {
if (src == wxEmptyString)
{
if (m_DefaultFilter == NULL) m_DefaultFilter = GetDefaultFilter();
src = m_DefaultFilter->ReadFile(*f);
}
@@ -206,7 +219,8 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
m_FS->ChangePathTo(f->GetLocation());
rt_val = SetPage(src);
m_OpenedPage = f->GetLocation();
if (f -> GetAnchor() != wxEmptyString) {
if (f->GetAnchor() != wxEmptyString)
{
wxYield();
ScrollToAnchor(f->GetAnchor());
}
@@ -217,7 +231,8 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
}
}
if (m_HistoryOn) { // add this page to history there:
if (m_HistoryOn) // add this page to history there:
{
int c = m_History.GetCount() - (m_HistoryPos + 1);
m_HistoryPos++;
@@ -230,7 +245,8 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
OnSetTitle(wxFileNameFromPath(m_OpenedPage));
SetCursor(*wxSTANDARD_CURSOR);
if (needs_refresh) {
if (needs_refresh)
{
wxYield();
m_tmpCanDrawLocks--;
Refresh();
@@ -251,7 +267,8 @@ bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor)
wxLogWarning(_("HTML anchor %s does not exist."), anchor.c_str());
return FALSE;
}
else {
else
{
int y;
for (y = 0; c != NULL; c = c->GetParent()) y += c->GetPosY();
@@ -264,7 +281,8 @@ bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor)
void wxHtmlWindow::OnSetTitle(const wxString& title)
{
if (m_RelatedFrame) {
if (m_RelatedFrame)
{
wxString tit;
tit.Printf(m_TitleFormat, title.c_str());
m_RelatedFrame->SetTitle(tit);
@@ -282,7 +300,8 @@ void wxHtmlWindow::CreateLayout()
if (!m_Cell) return;
if (m_Style & wxHW_SCROLLBAR_NEVER) {
if (m_Style & wxHW_SCROLLBAR_NEVER)
{
SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell->GetWidth() / wxHTML_SCROLL_STEP, 0); // always off
GetClientSize(&ClientWidth, &ClientHeight);
m_Cell->Layout(ClientWidth);
@@ -291,14 +310,16 @@ void wxHtmlWindow::CreateLayout()
else {
GetClientSize(&ClientWidth, &ClientHeight);
m_Cell->Layout(ClientWidth);
if (ClientHeight < m_Cell -> GetHeight() + GetCharHeight()) {
if (ClientHeight < m_Cell->GetHeight() + GetCharHeight())
{
SetScrollbars(
wxHTML_SCROLL_STEP, wxHTML_SCROLL_STEP,
m_Cell->GetWidth() / wxHTML_SCROLL_STEP,
(m_Cell->GetHeight() + GetCharHeight()) / wxHTML_SCROLL_STEP
/*cheat: top-level frag is always container*/);
}
else { /* we fit into window, no need for scrollbars */
else /* we fit into window, no need for scrollbars */
{
SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell->GetWidth() / wxHTML_SCROLL_STEP, 0); // disable...
GetClientSize(&ClientWidth, &ClientHeight);
m_Cell->Layout(ClientWidth); // ...and relayout
@@ -315,7 +336,8 @@ void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path)
int p_fontsizes[7];
wxString p_fff, p_ffn;
if (path != wxEmptyString) {
if (path != wxEmptyString)
{
oldpath = cfg->GetPath();
cfg->SetPath(path);
}
@@ -323,7 +345,8 @@ void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path)
m_Borders = cfg->Read("wxHtmlWindow/Borders", m_Borders);
p_fff = cfg->Read("wxHtmlWindow/FontFaceFixed", m_Parser->m_FontFaceFixed);
p_ffn = cfg->Read("wxHtmlWindow/FontFaceNormal", m_Parser->m_FontFaceNormal);
for (int i = 0; i < 7; i++) {
for (int i = 0; i < 7; i++)
{
tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i);
p_fontsizes[i] = cfg->Read(tmp, m_Parser->m_FontsSizes[i]);
}
@@ -340,7 +363,8 @@ void wxHtmlWindow::WriteCustomization(wxConfigBase *cfg, wxString path)
wxString oldpath;
wxString tmp;
if (path != wxEmptyString) {
if (path != wxEmptyString)
{
oldpath = cfg->GetPath();
cfg->SetPath(path);
}
@@ -348,7 +372,8 @@ void wxHtmlWindow::WriteCustomization(wxConfigBase *cfg, wxString path)
cfg->Write("wxHtmlWindow/Borders", (long) m_Borders);
cfg->Write("wxHtmlWindow/FontFaceFixed", m_Parser->m_FontFaceFixed);
cfg->Write("wxHtmlWindow/FontFaceNormal", m_Parser->m_FontFaceNormal);
for (int i = 0; i < 7; i++) {
for (int i = 0; i < 7; i++)
{
tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i);
cfg->Write(tmp, (long) m_Parser->m_FontsSizes[i]);
}
@@ -485,7 +510,8 @@ void wxHtmlWindow::OnDraw(wxDC& dc)
dc.SetBackgroundMode(wxTRANSPARENT);
ViewStart(&x, &y);
while (upd) {
while (upd)
{
v_y = upd.GetY();
v_h = upd.GetH();
if (m_Cell) m_Cell->Draw(dc, 0, 0, y * wxHTML_SCROLL_STEP + v_y, y * wxHTML_SCROLL_STEP + v_h + v_y);
@@ -508,7 +534,8 @@ void wxHtmlWindow::OnMouseEvent(wxMouseEvent& event)
{
m_tmpMouseMoved = TRUE;
if (event.ButtonDown()) {
if (event.ButtonDown())
{
int sx, sy;
wxPoint pos;
wxString lnk;
@@ -531,7 +558,8 @@ void wxHtmlWindow::OnIdle(wxIdleEvent& event)
s_cur_arrow = new wxCursor(wxCURSOR_ARROW);
}
if (m_tmpMouseMoved && (m_Cell != NULL)) {
if (m_tmpMouseMoved && (m_Cell != NULL))
{
int sx, sy;
int x, y;
wxHtmlLinkInfo *lnk;
@@ -541,12 +569,15 @@ void wxHtmlWindow::OnIdle(wxIdleEvent& event)
ScreenToClient(&x, &y);
lnk = m_Cell->GetLink(sx + x, sy + y);
if (lnk != m_tmpLastLink) {
if (lnk == NULL) {
if (lnk != m_tmpLastLink)
{
if (lnk == NULL)
{
SetCursor(*s_cur_arrow);
if (m_RelatedStatusBar != -1) m_RelatedFrame->SetStatusText(wxEmptyString, m_RelatedStatusBar);
}
else {
else
{
SetCursor(*s_cur_hand);
if (m_RelatedStatusBar != -1)
m_RelatedFrame->SetStatusText(lnk->GetHref(), m_RelatedStatusBar);

View File

@@ -101,7 +101,8 @@ int wxHtmlDCRenderer::Render(int x, int y, int from, int dont_render)
while (m_Cells->AdjustPagebreak(&pbreak)) {}
hght = pbreak - from;
if (!dont_render) {
if (!dont_render)
{
m_DC->SetBrush(*wxWHITE_BRUSH);
m_DC->SetClippingRegion(x, y, m_Width, hght);
@@ -193,19 +194,23 @@ bool wxHtmlPrintout::OnBeginDocument(int startPage, int endPage)
m_RendererHdr->SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY);
m_RendererHdr->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginTop)),
(int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom)));
if (m_Headers[0] != wxEmptyString) {
if (m_Headers[0] != wxEmptyString)
{
m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[0], 1));
m_HeaderHeight = m_RendererHdr->GetTotalHeight();
}
else if (m_Headers[1] != wxEmptyString) {
else if (m_Headers[1] != wxEmptyString)
{
m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[1], 1));
m_HeaderHeight = m_RendererHdr->GetTotalHeight();
}
if (m_Footers[0] != wxEmptyString) {
if (m_Footers[0] != wxEmptyString)
{
m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[0], 1));
m_FooterHeight = m_RendererHdr->GetTotalHeight();
}
else if (m_Footers[1] != wxEmptyString) {
else if (m_Footers[1] != wxEmptyString)
{
m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[1], 1));
m_FooterHeight = m_RendererHdr->GetTotalHeight();
}
@@ -227,12 +232,13 @@ bool wxHtmlPrintout::OnBeginDocument(int startPage, int endPage)
bool wxHtmlPrintout::OnPrintPage(int page)
{
wxDC *dc = GetDC();
if (dc) {
if (dc)
{
if (HasPage(page))
RenderPage(dc, page);
return TRUE;
} else
return FALSE;
}
else return FALSE;
}
@@ -323,7 +329,8 @@ void wxHtmlPrintout::CountPages()
m_NumPages = 0;
m_PageBreaks[0] = 0;
do {
do
{
pos = m_Renderer->Render((int)( ppmm_h * m_MarginLeft),
(int) (ppmm_v * (m_MarginTop + (m_HeaderHeight == 0 ? 0 : m_MarginSpace)) + m_HeaderHeight),
pos, TRUE);
@@ -363,11 +370,13 @@ void wxHtmlPrintout::RenderPage(wxDC *dc, int page)
m_PageBreaks[page-1]);
m_RendererHdr->SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY);
if (m_Headers[page % 2] != wxEmptyString) {
if (m_Headers[page % 2] != wxEmptyString)
{
m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[page % 2], page));
m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (ppmm_v * m_MarginTop));
}
if (m_Footers[page % 2] != wxEmptyString) {
if (m_Footers[page % 2] != wxEmptyString)
{
m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[page % 2], page));
m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (pageHeight - ppmm_v * m_MarginBottom - m_FooterHeight));
}
@@ -481,7 +490,8 @@ bool wxHtmlEasyPrinting::DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *pr
// Pass two printout objects: for preview, and possible printing.
wxPrintDialogData printDialogData(*m_PrintData);
wxPrintPreview *preview = new wxPrintPreview(printout1, printout2, &printDialogData);
if (!preview -> Ok()) {
if (!preview->Ok())
{
delete preview;
return FALSE;
}
@@ -531,7 +541,8 @@ void wxHtmlEasyPrinting::PageSetup()
m_PageSetupData->SetPrintData(*m_PrintData);
wxPageSetupDialog pageSetupDialog(m_Frame, m_PageSetupData);
if (pageSetupDialog.ShowModal() == wxID_OK) {
if (pageSetupDialog.ShowModal() == wxID_OK)
{
(*m_PrintData) = pageSetupDialog.GetPageSetupData().GetPrintData();
(*m_PageSetupData) = pageSetupDialog.GetPageSetupData();
}

View File

@@ -43,8 +43,10 @@ TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD")
wxHtmlContainerCell *c;
if (tag.GetName() == wxT("DL")) {
if (m_WParser -> GetContainer() -> GetFirstCell() != NULL) {
if (tag.GetName() == wxT("DL"))
{
if (m_WParser->GetContainer()->GetFirstCell() != NULL)
{
m_WParser->CloseContainer();
m_WParser->OpenContainer();
}
@@ -52,7 +54,8 @@ TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD")
ParseInner(tag);
if (m_WParser -> GetContainer() -> GetFirstCell() != NULL) {
if (m_WParser->GetContainer()->GetFirstCell() != NULL)
{
m_WParser->CloseContainer();
m_WParser->OpenContainer();
}
@@ -61,8 +64,10 @@ TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD")
return TRUE;
}
else if (tag.GetName() == wxT("DT")) {
if (!tag.IsEnding()) {
else if (tag.GetName() == wxT("DT"))
{
if (!tag.IsEnding())
{
m_WParser->CloseContainer();
c = m_WParser->OpenContainer();
c->SetAlignHor(wxHTML_ALIGN_LEFT);
@@ -71,7 +76,8 @@ TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD")
return FALSE;
}
else if (!tag.IsEnding()) { // "DD"
else if (!tag.IsEnding()) // "DD"
{
m_WParser->CloseContainer();
c = m_WParser->OpenContainer();
c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_LEFT);

View File

@@ -43,20 +43,24 @@ TAG_HANDLER_BEGIN(FONT, "FONT")
int oldsize = m_WParser->GetFontSize();
wxString oldface = m_WParser->GetFontFace();
if (tag.HasParam(wxT("COLOR"))) {
if (tag.HasParam(wxT("COLOR")))
{
unsigned long tmp = 0;
wxColour clr;
if (tag.ScanParam(wxT("COLOR"), wxT("#%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(wxT("SIZE"))) {
if (tag.HasParam(wxT("SIZE")))
{
long tmp = 0;
wxChar c = tag.GetParam(wxT("SIZE"))[(unsigned int) 0];
if (tag.ScanParam(wxT("SIZE"), wxT("%li"), &tmp) == 1) {
if (tag.ScanParam(wxT("SIZE"), wxT("%li"), &tmp) == 1)
{
if (c == '+' || c == '-')
m_WParser->SetFontSize(oldsize+tmp);
else
@@ -65,8 +69,10 @@ TAG_HANDLER_BEGIN(FONT, "FONT")
}
}
if (tag.HasParam(wxT("FACE"))) {
if (m_Faces.GetCount() == 0) {
if (tag.HasParam(wxT("FACE")))
{
if (m_Faces.GetCount() == 0)
{
wxFontEnumerator enu;
enu.EnumerateFacenames();
m_Faces = *enu.GetFacenames();
@@ -75,24 +81,30 @@ TAG_HANDLER_BEGIN(FONT, "FONT")
int index;
while (tk.HasMoreTokens())
if ((index = m_Faces.Index(tk.GetNextToken())) != wxNOT_FOUND) {
{
if ((index = m_Faces.Index(tk.GetNextToken())) != wxNOT_FOUND)
{
m_WParser->SetFontFace(m_Faces[index]);
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
break;
}
}
}
ParseInner(tag);
if (oldface != m_WParser -> GetFontFace()) {
if (oldface != m_WParser->GetFontFace())
{
m_WParser->SetFontFace(oldface);
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
}
if (oldsize != m_WParser -> GetFontSize()) {
if (oldsize != m_WParser->GetFontSize())
{
m_WParser->SetFontSize(oldsize);
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
}
if (oldclr != m_WParser -> GetActualColor()) {
if (oldclr != m_WParser->GetActualColor())
{
m_WParser->SetActualColor(oldclr);
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(oldclr));
}
@@ -212,21 +224,24 @@ TAG_HANDLER_BEGIN(Hx, "H1,H2,H3,H4,H5,H6")
m_WParser->SetFontSize(6);
else if (tag.GetName() == wxT("H3"))
m_WParser->SetFontSize(5);
else if (tag.GetName() == wxT("H4")) {
else if (tag.GetName() == wxT("H4"))
{
m_WParser->SetFontSize(5);
m_WParser->SetFontItalic(TRUE);
m_WParser->SetFontBold(FALSE);
}
else if (tag.GetName() == wxT("H5"))
m_WParser->SetFontSize(4);
else if (tag.GetName() == wxT("H6")) {
else if (tag.GetName() == wxT("H6"))
{
m_WParser->SetFontSize(4);
m_WParser->SetFontItalic(TRUE);
m_WParser->SetFontBold(FALSE);
}
c = m_WParser->GetContainer();
if (c -> GetFirstCell()) {
if (c->GetFirstCell())
{
m_WParser->CloseContainer();
m_WParser->OpenContainer();
c = m_WParser->GetContainer();

View File

@@ -73,7 +73,8 @@ wxHtmlImageMapAreaCell::wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::celltype
wxString x = incoords, y;
type = t;
while ((i = x.Find( ',' )) != -1) {
while ((i = x.Find( ',' )) != -1)
{
coords.Add( (int)(pixel_scale * (double)wxAtoi( x.Left( i ).c_str())) );
x = x.Mid( i + 1 );
}
@@ -82,7 +83,8 @@ wxHtmlImageMapAreaCell::wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::celltype
wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
{
switch (type) {
switch (type)
{
case RECT:
{
int l, t, r, b;
@@ -91,7 +93,8 @@ wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
t = coords[ 1 ];
r = coords[ 2 ];
b = coords[ 3 ];
if (x >= l && x <= r && y >= t && y <= b) {
if (x >= l && x <= r && y >= t && y <= b)
{
return m_Link;
}
break;
@@ -105,14 +108,16 @@ wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
t = coords[ 1 ];
r = coords[ 2 ];
d = sqrt( (double) (((x - l) * (x - l)) + ((y - t) * (y - t))) );
if (d < (double)r) {
if (d < (double)r)
{
return m_Link;
}
}
break;
case POLY:
{
if (coords.GetCount() >= 6) {
if (coords.GetCount() >= 6)
{
int intersects = 0;
int wherex = x;
int wherey = y;
@@ -123,46 +128,63 @@ wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
int end = totalc;
int pointer = 1;
if ((yval >= wherey) != (coords[pointer] >= wherey)) {
if ((xval >= wherex) == (coords[0] >= wherex)) {
if ((yval >= wherey) != (coords[pointer] >= wherey))
{
if ((xval >= wherex) == (coords[0] >= wherex))
{
intersects += (xval >= wherex) ? 1 : 0;
} else {
}
else
{
intersects += ((xval - (yval - wherey) *
(coords[0] - xval) /
(coords[pointer] - yval)) >= wherex) ? 1 : 0;
}
}
while (pointer < end) {
while (pointer < end)
{
yval = coords[pointer];
pointer += 2;
if (yval >= wherey) {
while ((pointer < end) && (coords[pointer] >= wherey)) {
if (yval >= wherey)
{
while ((pointer < end) && (coords[pointer] >= wherey))
{
pointer += 2;
}
if (pointer >= end) {
if (pointer >= end)
{
break;
}
if ((coords[pointer - 3] >= wherex) ==
(coords[pointer - 1] >= wherex)) {
intersects += (coords[pointer - 3] >= wherex) ? 1 : 0;
} else {
}
else
{
intersects +=
((coords[pointer - 3] - (coords[pointer - 2] - wherey) *
(coords[pointer - 1] - coords[pointer - 3]) /
(coords[pointer] - coords[pointer - 2])) >= wherex) ? 1 : 0;
}
} else {
while ((pointer < end) && (coords[pointer] < wherey)) {
}
else
{
while ((pointer < end) && (coords[pointer] < wherey))
{
pointer += 2;
}
if (pointer >= end) {
if (pointer >= end)
{
break;
}
if ((coords[pointer - 3] >= wherex) ==
(coords[pointer - 1] >= wherex)) {
(coords[pointer - 1] >= wherex))
{
intersects += (coords[pointer - 3] >= wherex) ? 1 : 0;
} else {
}
else
{
intersects +=
((coords[pointer - 3] - (coords[pointer - 2] - wherey) *
(coords[pointer - 1] - coords[pointer - 3]) /
@@ -170,14 +192,17 @@ wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
}
}
}
if ((intersects & 1) != 0) {
if ((intersects & 1) != 0)
{
return m_Link;
}
}
}
break;
}
if (m_Next) {
if (m_Next)
{
wxHtmlImageMapAreaCell *a = (wxHtmlImageMapAreaCell*)m_Next;
return a->GetLink( x, y );
}
@@ -226,7 +251,8 @@ wxHtmlLinkInfo *wxHtmlImageMapCell::GetLink( int x, int y ) const
const wxHtmlCell *wxHtmlImageMapCell::Find( int cond, const void *param ) const
{
if (cond == wxHTML_COND_ISIMAGEMAP) {
if (cond == wxHTML_COND_ISIMAGEMAP)
{
if (m_Name == *((wxString*)(param)))
return this;
}
@@ -271,7 +297,8 @@ wxHtmlImageCell::wxHtmlImageCell(wxFSFile *input, int w, int h, double scale, in
img = new wxImage(*s, wxBITMAP_TYPE_ANY);
m_Image = NULL;
if (img && (img -> Ok())) {
if (img && (img->Ok()))
{
ww = img->GetWidth();
hh = img->GetHeight();
if (w != -1) m_Width = w; else m_Width = ww;
@@ -280,14 +307,17 @@ wxHtmlImageCell::wxHtmlImageCell(wxFSFile *input, int w, int h, double scale, in
m_Width = (int)(scale * (double)m_Width);
m_Height = (int)(scale * (double)m_Height);
if ((m_Width != ww) || (m_Height != hh)) {
if ((m_Width != ww) || (m_Height != hh))
{
wxImage img2 = img->Scale(m_Width, m_Height);
m_Image = new wxBitmap(img2.ConvertToBitmap());
} else
}
else
m_Image = new wxBitmap(img->ConvertToBitmap());
delete img;
}
switch (align) {
switch (align)
{
case wxHTML_ALIGN_TOP :
m_Descent = m_Height;
break;
@@ -319,16 +349,19 @@ wxHtmlLinkInfo *wxHtmlImageCell::GetLink( int x, int y ) const
{
if (m_MapName.IsEmpty())
return wxHtmlCell::GetLink( x, y );
if (!m_ImageMap) {
if (!m_ImageMap)
{
wxHtmlContainerCell *p, *op;
op = p = GetParent();
while (p) {
while (p)
{
op = p;
p = p->GetParent();
}
p = op;
wxHtmlCell *cell = (wxHtmlCell*)p->Find( wxHTML_COND_ISIMAGEMAP, (const void*)(&m_MapName));
if (!cell) {
if (!cell)
{
((wxString&)m_MapName).Clear();
return wxHtmlCell::GetLink( x, y );
}
@@ -351,8 +384,10 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA")
TAG_HANDLER_PROC(tag)
{
if (tag.GetName() == wxT("IMG")) {
if (tag.HasParam(wxT("SRC"))) {
if (tag.GetName() == wxT("IMG"))
{
if (tag.HasParam(wxT("SRC")))
{
int w = -1, h = -1;
int al;
wxFSFile *str;
@@ -363,20 +398,24 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA")
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(wxT("ALIGN"))) {
if (tag.HasParam(wxT("ALIGN")))
{
wxString alstr = tag.GetParam(wxT("ALIGN"));
alstr.MakeUpper(); // for the case alignment was in ".."
if (alstr == wxT("TEXTTOP")) al = wxHTML_ALIGN_TOP;
else if ((alstr == wxT("CENTER")) || (alstr == wxT("ABSCENTER"))) al = wxHTML_ALIGN_CENTER;
}
if (tag.HasParam(wxT("USEMAP"))) {
if (tag.HasParam(wxT("USEMAP")))
{
mn = tag.GetParam( wxT("USEMAP") );
if (mn[ (unsigned int) 0 ] == wxT('#')) {
if (mn[ (unsigned int) 0 ] == wxT('#'))
{
mn = mn.Mid( 1 );
}
}
wxHtmlImageCell *cel = NULL;
if (str) {
if (str)
{
cel = new wxHtmlImageCell(str, w, h, m_WParser->GetPixelScale(), al, mn);
cel->SetLink(m_WParser->GetLink());
m_WParser->GetContainer()->InsertCell(cel);
@@ -384,10 +423,12 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA")
}
}
}
if (tag.GetName() == wxT("MAP")) {
if (tag.GetName() == wxT("MAP"))
{
m_WParser->CloseContainer();
m_WParser->OpenContainer();
if (tag.HasParam(wxT("NAME"))) {
if (tag.HasParam(wxT("NAME")))
{
wxString tmp = tag.GetParam(wxT("NAME"));
wxHtmlImageMapCell *cel = new wxHtmlImageMapCell( tmp );
m_WParser->GetContainer()->InsertCell( cel );
@@ -396,23 +437,32 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA")
m_WParser->CloseContainer();
m_WParser->OpenContainer();
}
if (tag.GetName() == wxT("AREA")) {
if (tag.HasParam(wxT("SHAPE"))) {
if (tag.GetName() == wxT("AREA"))
{
if (tag.HasParam(wxT("SHAPE")))
{
wxString tmp = tag.GetParam(wxT("SHAPE"));
wxString coords = wxEmptyString;
tmp.MakeUpper();
wxHtmlImageMapAreaCell *cel = NULL;
if (tag.HasParam(wxT("COORDS"))) {
if (tag.HasParam(wxT("COORDS")))
{
coords = tag.GetParam(wxT("COORDS"));
}
if (tmp == wxT("POLY")) {
if (tmp == wxT("POLY"))
{
cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::POLY, coords, m_WParser->GetPixelScale() );
} else if (tmp == wxT("CIRCLE")) {
}
else if (tmp == wxT("CIRCLE"))
{
cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::CIRCLE, coords, m_WParser->GetPixelScale() );
} else if (tmp == wxT("RECT")) {
}
else if (tmp == wxT("RECT"))
{
cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::RECT, coords, m_WParser->GetPixelScale() );
}
if (cel != NULL && tag.HasParam(wxT("HREF"))) {
if (cel != NULL && tag.HasParam(wxT("HREF")))
{
wxString tmp = tag.GetParam(wxT("HREF"));
wxString target = wxEmptyString;
if (tag.HasParam(wxT("TARGET"))) target = tag.GetParam(wxT("TARGET"));

View File

@@ -36,7 +36,8 @@ TAG_HANDLER_BEGIN(P, "P")
TAG_HANDLER_PROC(tag)
{
if (m_WParser -> GetContainer() -> GetFirstCell() != NULL) {
if (m_WParser->GetContainer()->GetFirstCell() != NULL)
{
m_WParser->CloseContainer();
m_WParser->OpenContainer();
}
@@ -76,18 +77,21 @@ TAG_HANDLER_BEGIN(CENTER, "CENTER")
wxHtmlContainerCell *c = m_WParser->GetContainer();
m_WParser->SetAlign(wxHTML_ALIGN_CENTER);
if (c -> GetFirstCell() != NULL) {
if (c->GetFirstCell() != NULL)
{
m_WParser->CloseContainer();
m_WParser->OpenContainer();
}
else
c->SetAlignHor(wxHTML_ALIGN_CENTER);
if (tag.HasEnding()) {
if (tag.HasEnding())
{
ParseInner(tag);
m_WParser->SetAlign(old);
if (c -> GetFirstCell() != NULL) {
if (c->GetFirstCell() != NULL)
{
m_WParser->CloseContainer();
m_WParser->OpenContainer();
}
@@ -109,14 +113,16 @@ TAG_HANDLER_BEGIN(DIV, "DIV")
{
int old = m_WParser->GetAlign();
wxHtmlContainerCell *c = m_WParser->GetContainer();
if (c -> GetFirstCell() != NULL) {
if (c->GetFirstCell() != NULL)
{
m_WParser->CloseContainer();
m_WParser->OpenContainer();
c = m_WParser->GetContainer();
c->SetAlign(tag);
m_WParser->SetAlign(c->GetAlignHor());
}
else {
else
{
c->SetAlign(tag);
m_WParser->SetAlign(c->GetAlignHor());
}
@@ -124,7 +130,8 @@ TAG_HANDLER_BEGIN(DIV, "DIV")
ParseInner(tag);
m_WParser->SetAlign(old);
if (c -> GetFirstCell() != NULL) {
if (c->GetFirstCell() != NULL)
{
m_WParser->CloseContainer();
m_WParser->OpenContainer();
}
@@ -143,9 +150,11 @@ TAG_HANDLER_BEGIN(TITLE, "TITLE")
TAG_HANDLER_PROC(tag)
{
if (m_WParser -> GetWindow()) {
if (m_WParser->GetWindow())
{
wxHtmlWindow *wfr = (wxHtmlWindow*)(m_WParser->GetWindow());
if (wfr) {
if (wfr)
{
wxString title = "";
wxString *src = m_WParser->GetSource();
@@ -168,23 +177,29 @@ TAG_HANDLER_BEGIN(BODY, "BODY")
unsigned long tmp;
wxColour clr;
if (tag.HasParam(wxT("TEXT"))) {
if (tag.ScanParam(wxT("TEXT"), wxT("#%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(wxT("LINK"))) {
if (tag.ScanParam(wxT("LINK"), wxT("#%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(wxT("BGCOLOR"))) {
if (tag.ScanParam(wxT("BGCOLOR"), wxT("#%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)
@@ -206,10 +221,12 @@ TAG_HANDLER_BEGIN(BLOCKQUOTE, "BLOCKQUOTE")
m_WParser->CloseContainer();
c = m_WParser->OpenContainer();
if (c->GetAlignHor() == wxHTML_ALIGN_RIGHT)
c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_RIGHT);
else
c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_LEFT);
c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
m_WParser->OpenContainer();
ParseInner(tag);

View File

@@ -54,11 +54,13 @@ TAG_HANDLER_BEGIN(A, "A")
TAG_HANDLER_PROC(tag)
{
if (tag.HasParam("NAME")) {
if (tag.HasParam("NAME"))
{
m_WParser->GetContainer()->InsertCell(new wxHtmlAnchorCell(tag.GetParam("NAME")));
}
if (tag.HasParam("HREF")) {
if (tag.HasParam("HREF"))
{
wxHtmlLinkInfo oldlnk = m_WParser->GetLink();
wxColour oldclr = m_WParser->GetActualColor();
int oldund = m_WParser->GetFontUnderlined();

View File

@@ -68,7 +68,8 @@ wxHtmlPRECell::wxHtmlPRECell(const wxString& s, wxDC& dc) : wxHtmlCell()
m_Width = m_Height = 0;
i = 0;
while (tokenizer.HasMoreTokens()) {
while (tokenizer.HasMoreTokens())
{
if (i % 10 == 0) m_Text = (wxString**) realloc(m_Text, sizeof(wxString*) * (i + 10));
tmp = tokenizer.NextToken();
tmp.Replace(wxT("&copy;"), wxT("(c)"), TRUE);

View File

@@ -141,7 +141,8 @@ wxHtmlTableCell::wxHtmlTableCell(wxHtmlContainerCell *parent, const wxHtmlTag& t
wxHtmlTableCell::~wxHtmlTableCell()
{
if (m_ColsInfo) free(m_ColsInfo);
if (m_CellInfo) {
if (m_CellInfo)
{
for (int i = 0; i < m_NumRows; i++)
free(m_CellInfo[i]);
free(m_CellInfo);
@@ -154,14 +155,16 @@ void wxHtmlTableCell::ReallocCols(int cols)
{
int i,j;
for (i = 0; i < m_NumRows; i++) {
for (i = 0; i < m_NumRows; i++)
{
m_CellInfo[i] = (cellStruct*) realloc(m_CellInfo[i], sizeof(cellStruct) * cols);
for (j = m_NumCols; j < cols; j++)
m_CellInfo[i][j].flag = cellFree;
}
m_ColsInfo = (colStruct*) realloc(m_ColsInfo, sizeof(colStruct) * cols);
for (j = m_NumCols; j < cols; j++) {
for (j = m_NumCols; j < cols; j++)
{
m_ColsInfo[j].width = 0;
m_ColsInfo[j].units = wxHTML_UNITS_PERCENT;
}
@@ -206,9 +209,11 @@ void wxHtmlTableCell::AddRow(const wxHtmlTag& tag)
void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
{
do {
do
{
m_ActualCol++;
} while ((m_ActualCol < m_NumCols) && (m_CellInfo[m_ActualRow][m_ActualCol].flag != cellFree));
if (m_ActualCol > m_NumCols - 1)
ReallocCols(m_ActualCol + 1);
@@ -225,14 +230,17 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
// width:
{
if (tag.HasParam("WIDTH")) {
if (tag.HasParam("WIDTH"))
{
wxString wd = tag.GetParam("WIDTH");
if (wd[wd.Length()-1] == '%') {
if (wd[wd.Length()-1] == '%')
{
wxSscanf(wd.c_str(), wxT("%i%%"), &m_ColsInfo[c].width);
m_ColsInfo[c].units = wxHTML_UNITS_PERCENT;
}
else {
else
{
wxSscanf(wd.c_str(), wxT("%i"), &m_ColsInfo[c].width);
m_ColsInfo[c].width = (int)(m_PixelScale * (double)m_ColsInfo[c].width);
m_ColsInfo[c].units = wxHTML_UNITS_PIXELS;
@@ -245,7 +253,8 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
{
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)) {
if ((m_CellInfo[r][c].colspan != 1) || (m_CellInfo[r][c].rowspan != 1))
{
int i, j;
if (r + m_CellInfo[r][c].rowspan > m_NumRows) ReallocRows(r + m_CellInfo[r][c].rowspan);
@@ -261,7 +270,8 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
{
int bk = m_rBkg;
if (tag.HasParam(wxT("BGCOLOR"))) tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &bk);
if (bk != -1) {
if (bk != -1)
{
wxColour clr = wxColour((bk & 0xFF0000) >> 16 , (bk & 0x00FF00) >> 8, (bk & 0x0000FF));
cell->SetBackgroundColour(clr);
}
@@ -294,11 +304,13 @@ void wxHtmlTableCell::Layout(int w)
*/
if (m_WidthFloatUnits == wxHTML_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;
}
else {
else
{
if (m_WidthFloat < 0) m_Width = w + m_WidthFloat;
else m_Width = m_WidthFloat;
}
@@ -340,7 +352,8 @@ void wxHtmlTableCell::Layout(int w)
/* 2. compute positions of columns: */
{
int wpos = m_Spacing;
for (int i = 0; i < m_NumCols; i++) {
for (int i = 0; i < m_NumCols; i++)
{
m_ColsInfo[i].leftpos = wpos;
wpos += m_ColsInfo[i].pixwidth + m_Spacing;
}
@@ -356,7 +369,8 @@ void wxHtmlTableCell::Layout(int w)
for (actrow = 0; actrow <= m_NumRows; actrow++) ypos[actrow] = m_Spacing;
for (actrow = 0; actrow < m_NumRows; actrow++) {
for (actrow = 0; actrow < m_NumRows; actrow++)
{
// 3a. sub-layout and detect max height:
@@ -377,11 +391,13 @@ void wxHtmlTableCell::Layout(int w)
}
for (actrow = 0; actrow < m_NumRows; actrow++) {
for (actrow = 0; actrow < m_NumRows; actrow++)
{
// 3b. place cells in row & let'em all have same height:
for (actcol = 0; actcol < m_NumCols; actcol++) {
for (actcol = 0; actcol < m_NumCols; actcol++)
{
if (m_CellInfo[actrow][actcol].flag != cellUsed) continue;
actcell = m_CellInfo[actrow][actcol].cont;
actcell->SetMinHeight(
@@ -431,7 +447,8 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH")
wxHtmlContainerCell *c;
// new table started, backup upper-level table (if any) and create new:
if (tag.GetName() == wxT("TABLE")) {
if (tag.GetName() == wxT("TABLE"))
{
wxHtmlTableCell *oldt = m_Table;
wxHtmlContainerCell *oldcont;
int m_OldAlign;
@@ -454,23 +471,27 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH")
}
else if (m_Table && !tag.IsEnding()) {
else if (m_Table && !tag.IsEnding())
{
// new row in table
if (tag.GetName() == wxT("TR")) {
if (tag.GetName() == wxT("TR"))
{
m_Table->AddRow(tag);
m_rAlign = m_tAlign;
if (tag.HasParam(wxT("ALIGN"))) m_rAlign = tag.GetParam(wxT("ALIGN"));
}
// new cell
else {
else
{
m_WParser->SetAlign(m_OldAlign);
c = m_WParser->SetContainer(new wxHtmlContainerCell(m_Table));
m_Table->AddCell(c, tag);
m_WParser->OpenContainer();
if (tag.GetName() == wxT("TH")) /*header style*/ {
if (tag.GetName() == wxT("TH")) /*header style*/
{
m_WParser->SetAlign(wxHTML_ALIGN_CENTER);
}

View File

@@ -55,7 +55,8 @@ wxHtmlWinParser::wxHtmlWinParser(wxWindow *wnd) : wxHtmlParser()
for (j = 0; j < 2; j++)
for (k = 0; k < 2; k++)
for (l = 0; l < 2; l++)
for (m = 0; m < 7; m++) {
for (m = 0; m < 7; m++)
{
m_FontsTable[i][j][k][l][m] = NULL;
m_FontsFacesTable[i][j][k][l][m] = wxEmptyString;
m_FontsEncTable[i][j][k][l][m] = wxFONTENCODING_DEFAULT;
@@ -72,7 +73,8 @@ wxHtmlWinParser::wxHtmlWinParser(wxWindow *wnd) : wxHtmlParser()
// fill in wxHtmlParser's tables:
wxNode *node = m_Modules.GetFirst();
while (node) {
while (node)
{
wxHtmlTagsModule *mod = (wxHtmlTagsModule*) node->GetData();
mod->FillHandlersTable(this);
node = node->GetNext();
@@ -88,7 +90,8 @@ wxHtmlWinParser::~wxHtmlWinParser()
for (j = 0; j < 2; j++)
for (k = 0; k < 2; k++)
for (l = 0; l < 2; l++)
for (m = 0; m < 7; m++) {
for (m = 0; m < 7; m++)
{
if (m_FontsTable[i][j][k][l][m] != NULL)
delete m_FontsTable[i][j][k][l][m];
}
@@ -125,7 +128,8 @@ void wxHtmlWinParser::SetFonts(wxString normal_face, wxString fixed_face, const
for (k = 0; k < 2; k++)
for (l = 0; l < 2; l++)
for (m = 0; m < 7; m++) {
if (m_FontsTable[i][j][k][l][m] != NULL) {
if (m_FontsTable[i][j][k][l][m] != NULL)
{
delete m_FontsTable[i][j][k][l][m];
m_FontsTable[i][j][k][l][m] = NULL;
}
@@ -194,20 +198,24 @@ void wxHtmlWinParser::AddText(const char* txt)
register char d;
int templen = 0;
if (m_tmpLastWasSpace) {
if (m_tmpLastWasSpace)
{
while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') || (txt[i] == '\t'))) i++;
}
while (i < lng) {
while (i < lng)
{
x = 0;
d = temp[templen++] = txt[i];
if ((d == '\n') || (d == '\r') || (d == ' ') || (d == '\t')) {
if ((d == '\n') || (d == '\r') || (d == ' ') || (d == '\t'))
{
i++, x++;
while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') || (txt[i] == '\t'))) i++, x++;
}
else i++;
if (x) {
if (x)
{
temp[templen-1] = ' ';
temp[templen] = 0;
templen = 0;
@@ -218,7 +226,8 @@ void wxHtmlWinParser::AddText(const char* txt)
m_tmpLastWasSpace = TRUE;
}
}
if (templen) {
if (templen)
{
temp[templen] = 0;
if (m_EncConv) m_EncConv->Convert(temp);
c = new wxHtmlWordCell(temp, *(GetDC()));
@@ -279,12 +288,14 @@ wxFont* wxHtmlWinParser::CreateCurrentFont()
wxFont **fontptr = &(m_FontsTable[fb][fi][fu][ff][fs]);
wxFontEncoding *encptr = &(m_FontsEncTable[fb][fi][fu][ff][fs]);
if (*fontptr != NULL && (*faceptr != face || *encptr != m_OutputEnc)) {
if (*fontptr != NULL && (*faceptr != face || *encptr != m_OutputEnc))
{
delete *fontptr;
*fontptr = NULL;
}
if (*fontptr == NULL) {
if (*fontptr == NULL)
{
*faceptr = face;
*encptr = m_OutputEnc;
*fontptr = new wxFont(