From: Václav Slavík Date: Sun, 5 Nov 2000 14:59:59 +0000 (+0000) Subject: wxHTML src code indentation now conforms (more) to wxWin coding style X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4f9297b0eead20a0bfee71df18e0d8f0cbc402fb 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 --- diff --git a/include/wx/html/htmlcell.h b/include/wx/html/htmlcell.h index cf872a1def..0e56116edc 100644 --- a/include/wx/html/htmlcell.h +++ b/include/wx/html/htmlcell.h @@ -81,12 +81,12 @@ class WXDLLEXPORT wxHtmlCell : public wxObject // This method returns pointer to the FIRST cell for that // the condition // is true. It first checks if the condition is true for this - // cell and then calls m_Next -> Find(). (Note: it checks + // cell and then calls m_Next->Find(). (Note: it checks // all subcells if the cell is container) // Condition is unique condition identifier (see htmldefs.h) // (user-defined condition IDs should start from 10000) // and param is optional parameter - // Example : m_Cell -> Find(wxHTML_COND_ISANCHOR, "news"); + // Example : m_Cell->Find(wxHTML_COND_ISANCHOR, "news"); // returns pointer to anchor news virtual void OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event); @@ -289,7 +289,7 @@ class WXDLLEXPORT wxHtmlWidgetCell : public wxHtmlCell // if w != 0 then the m_Wnd has 'floating' width - it adjust // it's width according to parent container's width // (w is percent of parent's width) - ~wxHtmlWidgetCell() { m_Wnd -> Destroy(); } + ~wxHtmlWidgetCell() { m_Wnd->Destroy(); } virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2); virtual void DrawInvisible(wxDC& dc, int x, int y); virtual void Layout(int w); diff --git a/include/wx/html/htmlpars.h b/include/wx/html/htmlpars.h index e234456d43..77e091e5a3 100644 --- a/include/wx/html/htmlpars.h +++ b/include/wx/html/htmlpars.h @@ -174,7 +174,7 @@ class WXDLLEXPORT wxHtmlTagHandler : public wxObject // FALSE etherwise protected: - void ParseInner(const wxHtmlTag& tag) {m_Parser -> DoParsing(tag.GetBeginPos(), tag.GetEndPos1());} + void ParseInner(const wxHtmlTag& tag) {m_Parser->DoParsing(tag.GetBeginPos(), tag.GetEndPos1());} // parses input between beginning and ending tag. // m_Parser must be set. }; diff --git a/include/wx/html/m_templ.h b/include/wx/html/m_templ.h index a54725ee5f..4df782c6a2 100644 --- a/include/wx/html/m_templ.h +++ b/include/wx/html/m_templ.h @@ -87,7 +87,7 @@ I STRONGLY recommend reading and understanding these macros!! #define TAGS_MODULE_ADD(handler) \ - parser -> AddTagHandler(new HTML_Handler_##handler); + parser->AddTagHandler(new HTML_Handler_##handler); diff --git a/include/wx/html/winpars.h b/include/wx/html/winpars.h index 1d96d69de5..e44b2f5fba 100644 --- a/include/wx/html/winpars.h +++ b/include/wx/html/winpars.h @@ -57,7 +57,7 @@ class WXDLLEXPORT wxHtmlWinParser : public wxHtmlParser // NOTE : these functions do _not_ return _actual_ // height/width. They return h/w of default font // for this DC. If you want actual values, call - // GetDC() -> GetChar...() + // GetDC()->GetChar...() wxWindow *GetWindow() {return m_Window;} // returns associated wxWindow @@ -71,7 +71,7 @@ class WXDLLEXPORT wxHtmlWinParser : public wxHtmlParser // parsing-related methods. These methods are called by tag handlers: wxHtmlContainerCell *GetContainer() const {return m_Container;} // Returns pointer to actual container. Common use in tag handler is : - // m_WParser -> GetContainer() -> InsertCell(new ...); + // m_WParser->GetContainer()->InsertCell(new ...); wxHtmlContainerCell *OpenContainer(); // opens new container. This container is sub-container of opened // container. Sets GetContainer to newly created container diff --git a/src/html/helpctrl.cpp b/src/html/helpctrl.cpp index c8287af50e..26911db463 100644 --- a/src/html/helpctrl.cpp +++ b/src/html/helpctrl.cpp @@ -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 ; } @@ -144,7 +146,7 @@ void wxHtmlHelpController::UseConfig(wxConfigBase *config, const wxString& rootp { m_Config = config; m_ConfigRoot = rootpath; - if (m_helpFrame) m_helpFrame -> UseConfig(config, rootpath); + if (m_helpFrame) m_helpFrame->UseConfig(config, rootpath); ReadCustomization(config, rootpath); } diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index e234941cb8..7c362ef056 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -61,7 +61,7 @@ static char* ReadLine(char *line, char *buf) static int LINKAGEMODE IndexCompareFunc(const void *a, const void *b) { - return wxStrcmp(((wxHtmlContentsItem*)a) -> m_Name, ((wxHtmlContentsItem*)b) -> m_Name); + return wxStrcmp(((wxHtmlContentsItem*)a)->m_Name, ((wxHtmlContentsItem*)b)->m_Name); } @@ -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,30 +347,32 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c parser.AddTagHandler(handler); f = ( contentsfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(contentsfile) ); - if (f) { - sz = f -> GetStream() -> GetSize(); + if (f) + { + sz = f->GetStream()->GetSize(); buf = new char[sz + 1]; buf[sz] = 0; - f -> GetStream() -> Read(buf, sz); + f->GetStream()->Read(buf, sz); delete f; - handler -> ReadIn(m_Contents, m_ContentsCnt); + handler->ReadIn(m_Contents, m_ContentsCnt); parser.Parse(buf); - handler -> WriteOut(m_Contents, m_ContentsCnt); + handler->WriteOut(m_Contents, m_ContentsCnt); delete[] buf; } else wxLogError(_("Cannot open contents file: %s"), contentsfile.c_str()); f = ( indexfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(indexfile) ); - if (f) { - sz = f -> GetStream() -> GetSize(); + if (f) + { + sz = f->GetStream()->GetSize(); buf = new char[sz + 1]; buf[sz] = 0; - f -> GetStream() -> Read(buf, sz); + f->GetStream()->Read(buf, sz); delete f; - handler -> ReadIn(m_Index, m_IndexCnt); + handler->ReadIn(m_Index, m_IndexCnt); parser.Parse(buf); - handler -> WriteOut(m_Index, m_IndexCnt); + handler->WriteOut(m_Index, m_IndexCnt); delete[] buf; } else if (!indexfile.IsEmpty()) @@ -374,13 +385,13 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c #if wxUSE_UNICODE -#define READ_STRING(f, s, lng) { char tmpc; for (int i = 0; i < lng; i++) { f -> Read(&tmpc, 1); s[i] = (wxChar)tmpc;} } -#define WRITE_STRING(f, s, lng) { char tmpc; for (int i = 0; i < lng; i++) { tmpc = (char)s[i]; f -> Write(&tmpc, 1);} } +#define READ_STRING(f, s, lng) { char tmpc; for (int i = 0; i < lng; i++) { f->Read(&tmpc, 1); s[i] = (wxChar)tmpc;} } +#define WRITE_STRING(f, s, lng) { char tmpc; for (int i = 0; i < lng; i++) { tmpc = (char)s[i]; f->Write(&tmpc, 1);} } #else -#define READ_STRING(f, s, lng) f -> Read(s, lng * sizeof(char)); -#define WRITE_STRING(f, s, lng) f -> Write(s, lng * sizeof(char)); +#define READ_STRING(f, s, lng) f->Read(s, lng * sizeof(char)); +#define WRITE_STRING(f, s, lng) f->Write(s, lng * sizeof(char)); #endif @@ -395,7 +406,7 @@ bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f) /* load header - version info : */ - f -> Read(&x, sizeof(x)); + f->Read(&x, sizeof(x)); version = wxINT32_SWAP_ON_BE(x); if (version != CURRENT_CACHED_BOOK_VERSION) @@ -407,21 +418,22 @@ bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f) /* load contents : */ - f -> Read(&x, sizeof(x)); + f->Read(&x, sizeof(x)); st = m_ContentsCnt; m_ContentsCnt += wxINT32_SWAP_ON_BE(x); m_Contents = (wxHtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt / wxHTML_REALLOC_STEP + 1) * wxHTML_REALLOC_STEP * sizeof(wxHtmlContentsItem)); - for (i = st; i < m_ContentsCnt; i++) { - f -> Read(&x, sizeof(x)); + 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)); + f->Read(&x, sizeof(x)); m_Contents[i].m_ID = wxINT32_SWAP_ON_BE(x); - f -> Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x); + f->Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x); m_Contents[i].m_Name = new wxChar[x]; READ_STRING(f, m_Contents[i].m_Name, x); - f -> Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x); + f->Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x); m_Contents[i].m_Page = new wxChar[x]; READ_STRING(f, m_Contents[i].m_Page, x); m_Contents[i].m_Book = book; @@ -429,16 +441,17 @@ bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f) /* load index : */ - f -> Read(&x, sizeof(x)); + f->Read(&x, sizeof(x)); st = m_IndexCnt; 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++) { - f -> Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x); + 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); - f -> Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x); + f->Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x); m_Index[i].m_Page = new wxChar[x]; READ_STRING(f, m_Index[i].m_Page, x); m_Index[i].m_Book = book; @@ -455,25 +468,26 @@ bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f) /* save header - version info : */ x = wxINT32_SWAP_ON_BE(CURRENT_CACHED_BOOK_VERSION); - f -> Write(&x, sizeof(x)); + f->Write(&x, sizeof(x)); /* save contents : */ x = 0; 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++) { + f->Write(&x, sizeof(x)); + 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)); + f->Write(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(m_Contents[i].m_ID); - f -> Write(&x, sizeof(x)); + f->Write(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(wxStrlen(m_Contents[i].m_Name) + 1); - f -> Write(&x, sizeof(x)); + f->Write(&x, sizeof(x)); WRITE_STRING(f, m_Contents[i].m_Name, x); x = wxINT32_SWAP_ON_BE(wxStrlen(m_Contents[i].m_Page) + 1); - f -> Write(&x, sizeof(x)); + f->Write(&x, sizeof(x)); WRITE_STRING(f, m_Contents[i].m_Page, x); } @@ -482,14 +496,15 @@ bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f) x = 0; 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++) { + 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 = wxINT32_SWAP_ON_BE(wxStrlen(m_Index[i].m_Name) + 1); - f -> Write(&x, sizeof(x)); + f->Write(&x, sizeof(x)); WRITE_STRING(f, m_Index[i].m_Name, x); x = wxINT32_SWAP_ON_BE(wxStrlen(m_Index[i].m_Page) + 1); - f -> Write(&x, sizeof(x)); + f->Write(&x, sizeof(x)); WRITE_STRING(f, m_Index[i].m_Page, x); } return TRUE; @@ -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; @@ -559,14 +575,14 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile, fi = fsys.OpenFile(bookfile.GetLocation() + wxT(".cached")); if (fi == NULL || - fi -> GetModificationTime() < bookfile.GetModificationTime() || - !LoadCachedBook(bookr, fi -> GetStream())) + fi->GetModificationTime() < bookfile.GetModificationTime() || + !LoadCachedBook(bookr, fi->GetStream())) { if (fi != NULL) delete fi; fi = fsys.OpenFile(m_TempPath + wxFileNameFromPath(bookfile.GetLocation()) + wxT(".cached")); if (m_TempPath == wxEmptyString || fi == NULL || - fi -> GetModificationTime() < bookfile.GetModificationTime() || - !LoadCachedBook(bookr, fi -> GetStream())) + fi->GetModificationTime() < bookfile.GetModificationTime() || + !LoadCachedBook(bookr, fi->GetStream())) { LoadMSProject(bookr, fsys, indexfile, contfile); if (m_TempPath != wxEmptyString) @@ -658,11 +674,11 @@ bool wxHtmlHelpData::AddBook(const wxString& book) return FALSE; } fsys.ChangePathTo(bookFull); - s = fi -> GetStream(); - sz = s -> GetSize(); + s = fi->GetStream(); + sz = s->GetSize(); buff = new char[sz + 1]; buff[sz] = 0; - s -> Read(buff, sz); + s->Read(buff, sz); lineptr = buff; do { @@ -683,7 +699,7 @@ bool wxHtmlHelpData::AddBook(const wxString& book) wxFontEncoding enc; if (charset == wxEmptyString) enc = wxFONTENCODING_SYSTEM; - else enc = wxTheFontMapper -> CharsetToEncoding(charset); + else enc = wxTheFontMapper->CharsetToEncoding(charset); bool rtval = AddBookParam(*fi, enc, title, contents, index, start, fsys.GetPath()); delete fi; @@ -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,9 +744,11 @@ 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) { - url = m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page; + 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,9 +757,11 @@ 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) { - url = m_Index[i].m_Book -> GetBasePath() + m_Index[i].m_Page; + 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,9 +774,11 @@ wxString wxHtmlHelpData::FindPageById(int id) int i; wxString url(wxEmptyString); - 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; + 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; @@ -827,10 +857,10 @@ bool wxHtmlSearchStatus::Search() else m_LastPage = thepage; wxFileSystem fsys; - file = fsys.OpenFile(m_Data->m_Contents[i].m_Book -> GetBasePath() + thepage); + file = fsys.OpenFile(m_Data->m_Contents[i].m_Book->GetBasePath() + thepage); if (file) { - if (m_Engine.Scan(file -> GetStream())) { + if (m_Engine.Scan(file->GetStream())) { m_Name = m_Data->m_Contents[i].m_Name; m_ContentsItem = m_Data->m_Contents + i; found = TRUE; @@ -860,9 +890,13 @@ 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'); + } + } } @@ -878,7 +912,7 @@ bool wxSearchEngine::Scan(wxInputStream *stream) int wrd = wxStrlen(m_Keyword); bool found = FALSE; char *buf = new char[lng + 1]; - stream -> Read(buf, lng); + stream->Read(buf, lng); buf[lng] = 0; if (!m_CaseSensitive) @@ -887,20 +921,22 @@ 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++; - if (j == wrd && WHITESPACE(buf[i + j])) {found = TRUE; break; } + if (j == wrd && WHITESPACE(buf[i + j])) { found = TRUE; break; } } } 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; } + if (j == wrd) { found = TRUE; break; } } } diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index cf03e1065c..9bdb931126 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -111,7 +111,7 @@ class wxHtmlHelpHtmlWindow : public wxHtmlWindow virtual void OnLinkClicked(const wxHtmlLinkInfo& link) { wxHtmlWindow::OnLinkClicked(link); - m_Frame -> NotifyPageChanged(); + m_Frame->NotifyPageChanged(); } private: @@ -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,16 +218,18 @@ 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)); toolBar->SetMargins( 2, 2 ); AddToolbarButtons(toolBar, style); - toolBar -> Realize(); + 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,74 +237,78 @@ 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); } - m_HtmlWin -> SetRelatedFrame(this, m_TitleFormat); - m_HtmlWin -> SetRelatedStatusBar(0); + m_HtmlWin->SetRelatedFrame(this, m_TitleFormat); + m_HtmlWin->SetRelatedStatusBar(0); if (m_Config) - m_HtmlWin -> ReadCustomization(m_Config, m_ConfigRoot); + 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)); - b1 -> top.SameAs (dummy, wxTop, 10); - b1 -> right.SameAs (dummy, wxRight, 10); - b1 -> height.AsIs(); - b1 -> width.AsIs(); - bmpbt -> SetConstraints(b1); + b1->top.SameAs (dummy, wxTop, 10); + b1->right.SameAs (dummy, wxRight, 10); + b1->height.AsIs(); + b1->width.AsIs(); + bmpbt->SetConstraints(b1); wxLayoutConstraints *b2 = new wxLayoutConstraints; wxBitmapButton *bmpbt2 = new wxBitmapButton(dummy, wxID_HTML_BOOKMARKSADD, wxBITMAP(wbkadd), wxDefaultPosition, wxSize(20,20)); - b2 -> top.SameAs (dummy, wxTop, 10); - b2 -> right.LeftOf (bmpbt, 2); - b2 -> height.AsIs(); - b2 -> width.AsIs(); - bmpbt2 -> SetConstraints(b2); + b2->top.SameAs (dummy, wxTop, 10); + b2->right.LeftOf (bmpbt, 2); + b2->height.AsIs(); + b2->width.AsIs(); + bmpbt2->SetConstraints(b2); #if wxUSE_TOOLTIPS - bmpbt -> SetToolTip(_("Remove current page from bookmarks")); - bmpbt2 -> SetToolTip(_("Add current page to bookmarks")); + bmpbt->SetToolTip(_("Remove current page from bookmarks")); + bmpbt2->SetToolTip(_("Add current page to bookmarks")); #endif //wxUSE_TOOLTIPS wxLayoutConstraints *b3 = new wxLayoutConstraints; m_Bookmarks = new wxComboBox(dummy, wxID_HTML_BOOKMARKSLIST, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY | wxCB_SORT); - m_Bookmarks -> Append(_("(bookmarks)")); + m_Bookmarks->Append(_("(bookmarks)")); for (unsigned i = 0; i < m_BookmarksNames.GetCount(); i++) - m_Bookmarks -> Append(m_BookmarksNames[i]); - m_Bookmarks -> SetSelection(0); + m_Bookmarks->Append(m_BookmarksNames[i]); + m_Bookmarks->SetSelection(0); - b3 -> centreY.SameAs (bmpbt2, wxCentreY); - b3 -> left.SameAs (dummy, wxLeft, 10); - b3 -> right.LeftOf (bmpbt2, 5); - b3 -> height.AsIs(); - m_Bookmarks -> SetConstraints(b3); + b3->centreY.SameAs (bmpbt2, wxCentreY); + b3->left.SameAs (dummy, wxLeft, 10); + b3->right.LeftOf (bmpbt2, 5); + b3->height.AsIs(); + m_Bookmarks->SetConstraints(b3); wxLayoutConstraints *b4 = new wxLayoutConstraints; m_ContentsBox = new wxTreeCtrl(dummy, wxID_HTML_TREECTRL, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS | wxSUNKEN_BORDER); - m_ContentsBox -> AssignImageList(ContentsImageList); + m_ContentsBox->AssignImageList(ContentsImageList); - b4 -> top.Below (m_Bookmarks, 10); - b4 -> left.SameAs (dummy, wxLeft, 0); - b4 -> right.SameAs (dummy, wxRight, 0); - b4 -> bottom.SameAs (dummy, wxBottom, 0); - m_ContentsBox -> SetConstraints(b4); + b4->top.Below (m_Bookmarks, 10); + b4->left.SameAs (dummy, wxLeft, 0); + b4->right.SameAs (dummy, wxRight, 0); + b4->bottom.SameAs (dummy, wxBottom, 0); + m_ContentsBox->SetConstraints(b4); - dummy -> SetAutoLayout(TRUE); - dummy -> Layout(); + dummy->SetAutoLayout(TRUE); + dummy->Layout(); - m_NavigPan -> AddPage(dummy, _("Contents")); + m_NavigPan->AddPage(dummy, _("Contents")); } else @@ -308,152 +316,159 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti m_ContentsBox = new wxTreeCtrl(m_NavigPan, wxID_HTML_TREECTRL, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS | wxSUNKEN_BORDER); - m_ContentsBox -> AssignImageList(ContentsImageList); - m_NavigPan -> AddPage(m_ContentsBox, _("Contents")); + m_ContentsBox->AssignImageList(ContentsImageList); + m_NavigPan->AddPage(m_ContentsBox, _("Contents")); } m_ContentsPage = notebook_page++; } // index listbox panel? - if (style & wxHF_INDEX) { + if (style & wxHF_INDEX) + { wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE); wxLayoutConstraints *b1 = new wxLayoutConstraints; m_IndexText = new wxTextCtrl(dummy, wxID_HTML_INDEXTEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER); - b1 -> top.SameAs (dummy, wxTop, 10); - b1 -> left.SameAs (dummy, wxLeft, 10); - b1 -> right.SameAs (dummy, wxRight, 10); - b1 -> height.AsIs(); - m_IndexText -> SetConstraints(b1); + b1->top.SameAs (dummy, wxTop, 10); + b1->left.SameAs (dummy, wxLeft, 10); + b1->right.SameAs (dummy, wxRight, 10); + b1->height.AsIs(); + m_IndexText->SetConstraints(b1); wxLayoutConstraints *b4 = new wxLayoutConstraints; m_IndexButtonAll = new wxButton(dummy, wxID_HTML_INDEXBUTTONALL, _("Show all")); - b4 -> top.Below (m_IndexText, 10); - b4 -> right.SameAs (dummy, wxRight, 10); - b4 -> width.AsIs(); - b4 -> height.AsIs(); - m_IndexButtonAll -> SetConstraints(b4); + b4->top.Below (m_IndexText, 10); + b4->right.SameAs (dummy, wxRight, 10); + b4->width.AsIs(); + b4->height.AsIs(); + m_IndexButtonAll->SetConstraints(b4); wxLayoutConstraints *b2 = new wxLayoutConstraints; m_IndexButton = new wxButton(dummy, wxID_HTML_INDEXBUTTON, _("Find")); - b2 -> top.Below (m_IndexText, 10); - b2 -> right.LeftOf (m_IndexButtonAll, 10); - b2 -> width.AsIs(); - b2 -> height.AsIs(); - m_IndexButton -> SetConstraints(b2); + b2->top.Below (m_IndexText, 10); + b2->right.LeftOf (m_IndexButtonAll, 10); + b2->width.AsIs(); + b2->height.AsIs(); + m_IndexButton->SetConstraints(b2); wxLayoutConstraints *b5 = new wxLayoutConstraints; m_IndexCountInfo = new wxStaticText(dummy, wxID_HTML_COUNTINFO, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT | wxST_NO_AUTORESIZE); - b5 -> top.Below (m_IndexButton, 5); - b5 -> right.SameAs (dummy, wxRight, 10); - b5 -> left.SameAs (dummy, wxLeft, 10); - b5 -> height.AsIs(); - m_IndexCountInfo -> SetConstraints(b5); + b5->top.Below (m_IndexButton, 5); + b5->right.SameAs (dummy, wxRight, 10); + b5->left.SameAs (dummy, wxLeft, 10); + b5->height.AsIs(); + m_IndexCountInfo->SetConstraints(b5); wxLayoutConstraints *b3 = new wxLayoutConstraints; m_IndexList = new wxListBox(dummy, wxID_HTML_INDEXLIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE); - b3 -> top.Below (m_IndexCountInfo, 5); - b3 -> left.SameAs (dummy, wxLeft, 0); - b3 -> right.SameAs (dummy, wxRight, 0); - b3 -> bottom.SameAs (dummy, wxBottom, 0); - m_IndexList -> SetConstraints(b3); + b3->top.Below (m_IndexCountInfo, 5); + b3->left.SameAs (dummy, wxLeft, 0); + b3->right.SameAs (dummy, wxRight, 0); + b3->bottom.SameAs (dummy, wxBottom, 0); + m_IndexList->SetConstraints(b3); #if wxUSE_TOOLTIPS - m_IndexButtonAll -> SetToolTip(_("Show all items in index")); - m_IndexButton -> SetToolTip(_("Display all index items that contain given substring. Search is case insensitive.")); + m_IndexButtonAll->SetToolTip(_("Show all items in index")); + m_IndexButton->SetToolTip(_("Display all index items that contain given substring. Search is case insensitive.")); #endif //wxUSE_TOOLTIPS - dummy -> SetAutoLayout(TRUE); - dummy -> Layout(); + dummy->SetAutoLayout(TRUE); + dummy->Layout(); - m_NavigPan -> AddPage(dummy, _("Index")); + m_NavigPan->AddPage(dummy, _("Index")); m_IndexPage = notebook_page++; } // search list panel? - if (style & wxHF_SEARCH) { + if (style & wxHF_SEARCH) + { wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_SEARCHPAGE); wxLayoutConstraints *b1 = new wxLayoutConstraints; m_SearchText = new wxTextCtrl(dummy, wxID_HTML_SEARCHTEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER); - b1 -> top.SameAs (dummy, wxTop, 10); - b1 -> left.SameAs (dummy, wxLeft, 10); - b1 -> right.SameAs (dummy, wxRight, 10); - b1 -> height.AsIs(); - m_SearchText -> SetConstraints(b1); + b1->top.SameAs (dummy, wxTop, 10); + b1->left.SameAs (dummy, wxLeft, 10); + b1->right.SameAs (dummy, wxRight, 10); + b1->height.AsIs(); + m_SearchText->SetConstraints(b1); wxLayoutConstraints *b4 = new wxLayoutConstraints; m_SearchChoice = new wxChoice(dummy, wxID_HTML_SEARCHCHOICE, wxDefaultPosition, wxDefaultSize); - b4 -> top.Below (m_SearchText, 10); - b4 -> left.SameAs (dummy, wxLeft, 10); - b4 -> right.SameAs (dummy, wxRight, 10); - b4 -> height.AsIs(); - m_SearchChoice -> SetConstraints(b4); + b4->top.Below (m_SearchText, 10); + b4->left.SameAs (dummy, wxLeft, 10); + b4->right.SameAs (dummy, wxRight, 10); + b4->height.AsIs(); + m_SearchChoice->SetConstraints(b4); wxLayoutConstraints *b5 = new wxLayoutConstraints; m_SearchCaseSensitive = new wxCheckBox(dummy, -1, _("Case sensitive")); - b5 -> top.Below (m_SearchChoice, 10); - b5 -> left.SameAs (dummy, wxLeft, 10); - b5 -> width.AsIs(); - b5 -> height.AsIs (); - m_SearchCaseSensitive -> SetConstraints(b5); + b5->top.Below (m_SearchChoice, 10); + b5->left.SameAs (dummy, wxLeft, 10); + b5->width.AsIs(); + b5->height.AsIs (); + m_SearchCaseSensitive->SetConstraints(b5); wxLayoutConstraints *b6 = new wxLayoutConstraints; m_SearchWholeWords = new wxCheckBox(dummy, -1, _("Whole words only")); - b6 -> top.Below (m_SearchCaseSensitive, 0); - b6 -> left.SameAs (dummy, wxLeft, 10); - b6 -> width.AsIs(); - b6 -> height.AsIs (); - m_SearchWholeWords -> SetConstraints(b6); + b6->top.Below (m_SearchCaseSensitive, 0); + b6->left.SameAs (dummy, wxLeft, 10); + b6->width.AsIs(); + b6->height.AsIs (); + m_SearchWholeWords->SetConstraints(b6); wxLayoutConstraints *b2 = new wxLayoutConstraints; m_SearchButton = new wxButton(dummy, wxID_HTML_SEARCHBUTTON, _("Search")); #if wxUSE_TOOLTIPS - m_SearchButton -> SetToolTip(_("Search contents of help book(s) for all occurences of the text you typed above")); + m_SearchButton->SetToolTip(_("Search contents of help book(s) for all occurences of the text you typed above")); #endif //wxUSE_TOOLTIPS - b2 -> top.Below (m_SearchWholeWords, 0); - b2 -> right.SameAs (dummy, wxRight, 10); - b2 -> width.AsIs(); - b2 -> height.AsIs(); - m_SearchButton -> SetConstraints(b2); + b2->top.Below (m_SearchWholeWords, 0); + b2->right.SameAs (dummy, wxRight, 10); + b2->width.AsIs(); + b2->height.AsIs(); + m_SearchButton->SetConstraints(b2); wxLayoutConstraints *b3 = new wxLayoutConstraints; m_SearchList = new wxListBox(dummy, wxID_HTML_SEARCHLIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE); - b3 -> top.Below (m_SearchButton, 10); - b3 -> left.SameAs (dummy, wxLeft, 0); - b3 -> right.SameAs (dummy, wxRight, 0); - b3 -> bottom.SameAs (dummy, wxBottom, 0); - m_SearchList -> SetConstraints(b3); - - dummy -> SetAutoLayout(TRUE); - dummy -> Layout(); - m_NavigPan -> AddPage(dummy, _("Search")); + b3->top.Below (m_SearchButton, 10); + b3->left.SameAs (dummy, wxLeft, 0); + b3->right.SameAs (dummy, wxRight, 0); + b3->bottom.SameAs (dummy, wxBottom, 0); + m_SearchList->SetConstraints(b3); + + dummy->SetAutoLayout(TRUE); + dummy->Layout(); + m_NavigPan->AddPage(dummy, _("Search")); m_SearchPage = notebook_page++; } - m_HtmlWin -> Show(TRUE); + m_HtmlWin->Show(TRUE); RefreshLists(); // showtime - if (m_NavigPan && m_Splitter) { - m_Splitter -> SetMinimumPaneSize(20); + 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 { - m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); - m_Splitter -> Unsplit(); + m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); + else + { + m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); + m_Splitter->Unsplit(); } - if (m_Cfg.navig_on) { - m_NavigPan -> Show(TRUE); - m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); + + if (m_Cfg.navig_on) + { + m_NavigPan->Show(TRUE); + m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); } - else { - m_NavigPan -> Show(FALSE); - m_Splitter -> Initialize(m_HtmlWin); + else + { + m_NavigPan->Show(FALSE); + m_Splitter->Initialize(m_HtmlWin); } } return TRUE; @@ -490,46 +505,46 @@ void wxHtmlHelpFrame::AddToolbarButtons(wxToolBar *toolBar, int style) wxT("One or more HTML help frame toolbar bitmap could not be loaded.")) ; - toolBar -> AddTool(wxID_HTML_PANEL, wpanelBitmap, wxNullBitmap, + toolBar->AddTool(wxID_HTML_PANEL, wpanelBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Show/hide navigation panel")); - toolBar -> AddSeparator(); - toolBar -> AddTool(wxID_HTML_BACK, wbackBitmap, wxNullBitmap, + toolBar->AddSeparator(); + toolBar->AddTool(wxID_HTML_BACK, wbackBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Go back")); - toolBar -> AddTool(wxID_HTML_FORWARD, wforwardBitmap, wxNullBitmap, + toolBar->AddTool(wxID_HTML_FORWARD, wforwardBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Go forward")); - toolBar -> AddSeparator(); + toolBar->AddSeparator(); - toolBar -> AddTool(wxID_HTML_UPNODE, wupnodeBitmap, wxNullBitmap, + toolBar->AddTool(wxID_HTML_UPNODE, wupnodeBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Go one level up in document hierarchy")); - toolBar -> AddTool(wxID_HTML_UP, wupBitmap, wxNullBitmap, + toolBar->AddTool(wxID_HTML_UP, wupBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Previous page")); - toolBar -> AddTool(wxID_HTML_DOWN, wdownBitmap, wxNullBitmap, + toolBar->AddTool(wxID_HTML_DOWN, wdownBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Next page")); if ((style & wxHF_PRINT) || (style & wxHF_OPENFILES)) - toolBar -> AddSeparator(); + toolBar->AddSeparator(); if (style & wxHF_OPENFILES) - toolBar -> AddTool(wxID_HTML_OPENFILE, wopenBitmap, wxNullBitmap, + toolBar->AddTool(wxID_HTML_OPENFILE, wopenBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Open HTML document")); #if wxUSE_PRINTING_ARCHITECTURE if (style & wxHF_PRINT) - toolBar -> AddTool(wxID_HTML_PRINT, wprintBitmap, wxNullBitmap, + toolBar->AddTool(wxID_HTML_PRINT, wprintBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Print this page")); #endif - toolBar -> AddSeparator(); - toolBar -> AddTool(wxID_HTML_OPTIONS, woptionsBitmap, wxNullBitmap, + toolBar->AddSeparator(); + toolBar->AddTool(wxID_HTML_OPTIONS, woptionsBitmap, wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, _("Display options dialog")); } @@ -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,13 +588,14 @@ bool wxHtmlHelpFrame::DisplayContents() { if (! m_ContentsBox) return FALSE; - if (!m_Splitter -> IsSplit()) { - m_NavigPan -> Show(TRUE); - m_HtmlWin -> Show(TRUE); - m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); + if (!m_Splitter->IsSplit()) + { + m_NavigPan->Show(TRUE); + m_HtmlWin->Show(TRUE); + m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); m_Cfg.navig_on = TRUE; } - m_NavigPan -> SetSelection(0); + m_NavigPan->SetSelection(0); return TRUE; } @@ -587,12 +605,13 @@ bool wxHtmlHelpFrame::DisplayIndex() { if (! m_IndexList) return FALSE; - if (!m_Splitter -> IsSplit()) { - m_NavigPan -> Show(TRUE); - m_HtmlWin -> Show(TRUE); - m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); + if (!m_Splitter->IsSplit()) + { + m_NavigPan->Show(TRUE); + m_HtmlWin->Show(TRUE); + m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); } - m_NavigPan -> SetSelection(1); + m_NavigPan->SetSelection(1); return TRUE; } @@ -607,46 +626,50 @@ bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword) wxString foundstr; wxString book = wxEmptyString; - if (!m_Splitter -> IsSplit()) { - m_NavigPan -> Show(TRUE); - m_HtmlWin -> Show(TRUE); - m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); + if (!m_Splitter->IsSplit()) + { + m_NavigPan->Show(TRUE); + m_HtmlWin->Show(TRUE); + m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); } - m_NavigPan -> SetSelection(m_SearchPage); - m_SearchList -> Clear(); - m_SearchText -> SetValue(keyword); - m_SearchButton -> Enable(FALSE); + m_NavigPan->SetSelection(m_SearchPage); + m_SearchList->Clear(); + m_SearchText->SetValue(keyword); + m_SearchButton->Enable(FALSE); if (m_SearchChoice->GetSelection() != 0) book = m_SearchChoice->GetStringSelection(); wxHtmlSearchStatus status(m_Data, keyword, - m_SearchCaseSensitive -> GetValue(), m_SearchWholeWords -> GetValue(), + m_SearchCaseSensitive->GetValue(), m_SearchWholeWords->GetValue(), book); wxProgressDialog progress(_("Searching..."), _("No matching page found yet"), 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()); + m_SearchList->Append(status.GetName(), status.GetContentsItem()); } } - m_SearchButton -> Enable(TRUE); - m_SearchText -> SetSelection(0, keyword.Length()); - m_SearchText -> SetFocus(); - if (foundcnt) { - wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList -> GetClientData(0); + m_SearchButton->Enable(TRUE); + m_SearchText->SetSelection(0, keyword.Length()); + m_SearchText->SetFocus(); + if (foundcnt) + { + wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList->GetClientData(0); if (it) { - m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); + m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page); NotifyPageChanged(); } } @@ -663,8 +686,8 @@ void wxHtmlHelpFrame::CreateContents() m_ContentsBox->Clear(); if (m_PagesHash) delete m_PagesHash; - m_PagesHash = new wxHashTable(wxKEY_STRING, 2 * m_Data -> GetContentsCnt()); - m_PagesHash -> DeleteContents(TRUE); + m_PagesHash = new wxHashTable(wxKEY_STRING, 2 * m_Data->GetContentsCnt()); + m_PagesHash->DeleteContents(TRUE); int cnt = m_Data->GetContentsCnt(); int i; @@ -674,33 +697,38 @@ void wxHtmlHelpFrame::CreateContents() wxTreeItemId roots[MAX_ROOTS]; bool imaged[MAX_ROOTS]; - m_ContentsBox -> DeleteAllItems(); - roots[0] = m_ContentsBox -> AddRoot(_("(Help)")); - m_ContentsBox -> SetItemImage(roots[0], IMG_RootFolder); - m_ContentsBox -> SetItemSelectedImage(roots[0], IMG_RootFolder); + m_ContentsBox->DeleteAllItems(); + roots[0] = m_ContentsBox->AddRoot(_("(Help)")); + m_ContentsBox->SetItemImage(roots[0], IMG_RootFolder); + m_ContentsBox->SetItemSelectedImage(roots[0], IMG_RootFolder); imaged[0] = TRUE; - 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, + 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) { - m_ContentsBox -> SetItemBold(roots[1], TRUE); - m_ContentsBox -> SetItemImage(roots[1], IMG_Book); - m_ContentsBox -> SetItemSelectedImage(roots[1], IMG_Book); + m_PagesHash->Put(it->m_Book->GetBasePath() + it->m_Page, + new wxHtmlHelpHashData(i, roots[it->m_Level + 1])); + + 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; - - 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; + } + else + imaged[it->m_Level + 1] = FALSE; + + 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; } } - m_ContentsBox -> Expand(roots[0]); + m_ContentsBox->Expand(roots[0]); } @@ -716,22 +744,22 @@ void wxHtmlHelpFrame::CreateIndex() wxString cnttext; if (cnt > INDEX_IS_SMALL) cnttext.Printf(_("%i of %i"), 0, cnt); else cnttext.Printf(_("%i of %i"), cnt, cnt); - m_IndexCountInfo -> SetLabel(cnttext); + m_IndexCountInfo->SetLabel(cnttext); if (cnt > INDEX_IS_SMALL) return; wxHtmlContentsItem* index = m_Data->GetIndex(); for (int i = 0; i < cnt; i++) - m_IndexList -> Append(index[i].m_Name, (char*)(index + i)); + m_IndexList->Append(index[i].m_Name, (char*)(index + i)); } void wxHtmlHelpFrame::CreateSearch() { if (! (m_SearchList && m_SearchChoice)) return ; - m_SearchList -> Clear(); - m_SearchChoice -> Clear(); - m_SearchChoice -> Append(_("Search in all books")); + m_SearchList->Clear(); + m_SearchChoice->Clear(); + m_SearchChoice->Append(_("Search in all books")); const wxHtmlBookRecArray& bookrec = m_Data->GetBookRecArray(); int i, cnt = bookrec.GetCount(); for (i = 0; i < cnt; i++) @@ -752,43 +780,47 @@ void wxHtmlHelpFrame::ReadCustomization(wxConfigBase *cfg, const wxString& path) wxString oldpath; wxString tmp; - if (path != wxEmptyString) { - oldpath = cfg -> GetPath(); - cfg -> SetPath(_T("/") + path); + if (path != wxEmptyString) + { + oldpath = cfg->GetPath(); + cfg->SetPath(_T("/") + path); } - m_Cfg.navig_on = cfg -> Read(wxT("hcNavigPanel"), m_Cfg.navig_on) != 0; - m_Cfg.sashpos = cfg -> Read(wxT("hcSashPos"), m_Cfg.sashpos); - m_Cfg.x = cfg -> Read(wxT("hcX"), m_Cfg.x); - m_Cfg.y = cfg -> Read(wxT("hcY"), m_Cfg.y); - m_Cfg.w = cfg -> Read(wxT("hcW"), m_Cfg.w); - m_Cfg.h = cfg -> Read(wxT("hcH"), m_Cfg.h); + m_Cfg.navig_on = cfg->Read(wxT("hcNavigPanel"), m_Cfg.navig_on) != 0; + m_Cfg.sashpos = cfg->Read(wxT("hcSashPos"), m_Cfg.sashpos); + m_Cfg.x = cfg->Read(wxT("hcX"), m_Cfg.x); + m_Cfg.y = cfg->Read(wxT("hcY"), m_Cfg.y); + m_Cfg.w = cfg->Read(wxT("hcW"), m_Cfg.w); + m_Cfg.h = cfg->Read(wxT("hcH"), m_Cfg.h); - m_FixedFace = cfg -> Read(wxT("hcFixedFace"), m_FixedFace); - m_NormalFace = cfg -> Read(wxT("hcNormalFace"), m_NormalFace); - m_FontSize = cfg -> Read(wxT("hcFontSize"), m_FontSize); + m_FixedFace = cfg->Read(wxT("hcFixedFace"), m_FixedFace); + m_NormalFace = cfg->Read(wxT("hcNormalFace"), m_NormalFace); + m_FontSize = cfg->Read(wxT("hcFontSize"), m_FontSize); { int i; int cnt; wxString val, s; - cnt = cfg -> Read(wxT("hcBookmarksCnt"), 0L); - if (cnt != 0) { + cnt = cfg->Read(wxT("hcBookmarksCnt"), 0L); + if (cnt != 0) + { m_BookmarksNames.Clear(); m_BookmarksPages.Clear(); - if (m_Bookmarks) { - m_Bookmarks -> Clear(); - m_Bookmarks -> Append(_("(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); + s = cfg->Read(val); m_BookmarksNames.Add(s); - if (m_Bookmarks) m_Bookmarks -> Append(s); + if (m_Bookmarks) m_Bookmarks->Append(s); val.Printf(wxT("hcBookmark_%i_url"), i); - s = cfg -> Read(val); + s = cfg->Read(val); m_BookmarksPages.Add(s); } } @@ -798,7 +830,7 @@ void wxHtmlHelpFrame::ReadCustomization(wxConfigBase *cfg, const wxString& path) m_HtmlWin->ReadCustomization(cfg); if (path != wxEmptyString) - cfg -> SetPath(oldpath); + cfg->SetPath(oldpath); } void wxHtmlHelpFrame::WriteCustomization(wxConfigBase *cfg, const wxString& path) @@ -806,32 +838,35 @@ void wxHtmlHelpFrame::WriteCustomization(wxConfigBase *cfg, const wxString& path wxString oldpath; wxString tmp; - if (path != wxEmptyString) { - oldpath = cfg -> GetPath(); - cfg -> SetPath(_T("/") + path); + if (path != wxEmptyString) + { + oldpath = cfg->GetPath(); + cfg->SetPath(_T("/") + path); } - cfg -> Write(wxT("hcNavigPanel"), m_Cfg.navig_on); - cfg -> Write(wxT("hcSashPos"), (long)m_Cfg.sashpos); - cfg -> Write(wxT("hcX"), (long)m_Cfg.x); - cfg -> Write(wxT("hcY"), (long)m_Cfg.y); - cfg -> Write(wxT("hcW"), (long)m_Cfg.w); - cfg -> Write(wxT("hcH"), (long)m_Cfg.h); - cfg -> Write(wxT("hcFixedFace"), m_FixedFace); - cfg -> Write(wxT("hcNormalFace"), m_NormalFace); - cfg -> Write(wxT("hcFontSize"), (long)m_FontSize); - - if (m_Bookmarks) { + cfg->Write(wxT("hcNavigPanel"), m_Cfg.navig_on); + cfg->Write(wxT("hcSashPos"), (long)m_Cfg.sashpos); + cfg->Write(wxT("hcX"), (long)m_Cfg.x); + cfg->Write(wxT("hcY"), (long)m_Cfg.y); + cfg->Write(wxT("hcW"), (long)m_Cfg.w); + cfg->Write(wxT("hcH"), (long)m_Cfg.h); + cfg->Write(wxT("hcFixedFace"), m_FixedFace); + cfg->Write(wxT("hcNormalFace"), m_NormalFace); + cfg->Write(wxT("hcFontSize"), (long)m_FontSize); + + if (m_Bookmarks) + { int i; int cnt = m_BookmarksNames.GetCount(); wxString val; - cfg -> Write(wxT("hcBookmarksCnt"), (long)cnt); - for (i = 0; i < cnt; i++) { + cfg->Write(wxT("hcBookmarksCnt"), (long)cnt); + for (i = 0; i < cnt; i++) + { val.Printf(wxT("hcBookmark_%i"), i); - cfg -> Write(val, m_BookmarksNames[i]); + cfg->Write(val, m_BookmarksNames[i]); val.Printf(wxT("hcBookmark_%i_url"), i); - cfg -> Write(val, m_BookmarksPages[i]); + cfg->Write(val, m_BookmarksPages[i]); } } @@ -839,7 +874,7 @@ void wxHtmlHelpFrame::WriteCustomization(wxConfigBase *cfg, const wxString& path m_HtmlWin->WriteCustomization(cfg); if (path != wxEmptyString) - cfg -> SetPath(oldpath); + cfg->SetPath(oldpath); } @@ -857,7 +892,7 @@ static void SetFontsToHtmlWin(wxHtmlWindow *win, wxString scalf, wxString fixf, {16, 20, 24, 32, 38, 45, 50} }; - win -> SetFonts(scalf, fixf, f_sizes[size]); + win->SetFonts(scalf, fixf, f_sizes[size]); } @@ -878,40 +913,40 @@ class wxHtmlHelpFrameOptionsDialog : public wxDialog sizer = new wxBoxSizer(wxHORIZONTAL); sizer2 = new wxStaticBoxSizer( new wxStaticBox(this, -1, _("Normal font:")), wxVERTICAL); - sizer2 -> Add(NormalFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, + sizer2->Add(NormalFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, wxSize(200, 200), 0, NULL, wxCB_DROPDOWN | wxCB_READONLY), 1, wxEXPAND | wxLEFT | wxRIGHT, 10); - sizer -> Add(sizer2, 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10); + sizer->Add(sizer2, 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10); sizer2 = new wxStaticBoxSizer( new wxStaticBox(this, -1, _("Fixed font:")), wxVERTICAL); - sizer2 -> Add(FixedFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, + sizer2->Add(FixedFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, wxSize(200, 200), 0, NULL, wxCB_DROPDOWN | wxCB_READONLY), 1, wxEXPAND | wxLEFT | wxRIGHT, 10); - sizer -> Add(sizer2, 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10); + sizer->Add(sizer2, 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10); - topsizer -> Add(sizer); + topsizer->Add(sizer); - topsizer -> Add(RadioBox = new wxRadioBox(this, -1, _("Font size:"), + topsizer->Add(RadioBox = new wxRadioBox(this, -1, _("Font size:"), wxDefaultPosition, wxDefaultSize, 5, choices, 5), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10); - topsizer -> Add(new wxStaticText(this, -1, _("Preview:")), + topsizer->Add(new wxStaticText(this, -1, _("Preview:")), 0, wxLEFT | wxTOP, 10); - topsizer -> Add(TestWin = new wxHtmlWindow(this, -1, wxDefaultPosition, wxSize(-1, 150)), + topsizer->Add(TestWin = new wxHtmlWindow(this, -1, wxDefaultPosition, wxSize(-1, 150)), 1, wxEXPAND | wxLEFT|wxTOP|wxRIGHT, 10); sizer = new wxBoxSizer(wxHORIZONTAL); - sizer -> Add(new wxButton(this, wxID_OK, _("OK")), 0, wxALL, 10); - sizer -> Add(new wxButton(this, wxID_CANCEL, _("Cancel")), 0, wxALL, 10); - topsizer -> Add(sizer, 0, wxALIGN_RIGHT); + sizer->Add(new wxButton(this, wxID_OK, _("OK")), 0, wxALL, 10); + sizer->Add(new wxButton(this, wxID_CANCEL, _("Cancel")), 0, wxALL, 10); + topsizer->Add(sizer, 0, wxALIGN_RIGHT); SetAutoLayout(TRUE); SetSizer(topsizer); - topsizer -> Fit(this); + topsizer->Fit(this); Centre(wxBOTH); } @@ -920,10 +955,10 @@ class wxHtmlHelpFrameOptionsDialog : public wxDialog { wxBusyCursor bcur; SetFontsToHtmlWin(TestWin, - NormalFont -> GetStringSelection(), - FixedFont -> GetStringSelection(), - RadioBox -> GetSelection()); - TestWin -> SetPage(_( + NormalFont->GetStringSelection(), + FixedFont->GetStringSelection(), + RadioBox->GetSelection()); + TestWin->SetPage(_( "\ Normal face
(and underlined. Italic face. \ Bold face. Bold italic face.
\ @@ -967,36 +1002,39 @@ 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(); + m_NormalFonts->Sort(); } - if (m_FixedFonts == NULL) { + if (m_FixedFonts == NULL) + { wxFontEnumerator enu; enu.EnumerateFacenames(wxFONTENCODING_SYSTEM, TRUE); m_FixedFonts = new wxArrayString; *m_FixedFonts = *enu.GetFacenames(); - m_FixedFonts -> Sort(); + m_FixedFonts->Sort(); } - for (i = 0; i < m_NormalFonts -> GetCount(); i++) - dlg.NormalFont -> Append((*m_NormalFonts)[i]); - for (i = 0; i < m_FixedFonts -> GetCount(); i++) - dlg.FixedFont -> Append((*m_FixedFonts)[i]); - if (!m_NormalFace.IsEmpty()) dlg.NormalFont -> SetStringSelection(m_NormalFace); - else dlg.NormalFont -> SetSelection(0); - if (!m_FixedFace.IsEmpty()) dlg.FixedFont -> SetStringSelection(m_FixedFace); - else dlg.FixedFont -> SetSelection(0); - dlg.RadioBox -> SetSelection(m_FontSize); + for (i = 0; i < m_NormalFonts->GetCount(); i++) + dlg.NormalFont->Append((*m_NormalFonts)[i]); + for (i = 0; i < m_FixedFonts->GetCount(); i++) + dlg.FixedFont->Append((*m_FixedFonts)[i]); + if (!m_NormalFace.IsEmpty()) dlg.NormalFont->SetStringSelection(m_NormalFace); + else dlg.NormalFont->SetSelection(0); + if (!m_FixedFace.IsEmpty()) dlg.FixedFont->SetStringSelection(m_FixedFace); + else dlg.FixedFont->SetSelection(0); + dlg.RadioBox->SetSelection(m_FontSize); dlg.UpdateTestWin(); - if (dlg.ShowModal() == wxID_OK) { - m_NormalFace = dlg.NormalFont -> GetStringSelection(); - m_FixedFace = dlg.FixedFont -> GetStringSelection(); - m_FontSize = dlg.RadioBox -> GetSelection(); + if (dlg.ShowModal() == wxID_OK) + { + m_NormalFace = dlg.NormalFont->GetStringSelection(); + m_FixedFace = dlg.FixedFont->GetStringSelection(); + m_FontSize = dlg.RadioBox->GetSelection(); SetFontsToHtmlWin(m_HtmlWin, m_NormalFace, m_FixedFace, m_FontSize); } } @@ -1007,18 +1045,18 @@ void wxHtmlHelpFrame::NotifyPageChanged() { if (m_UpdateContents && m_PagesHash) { - wxString an = m_HtmlWin -> GetOpenedAnchor(); + wxString an = m_HtmlWin->GetOpenedAnchor(); wxHtmlHelpHashData *ha; if (an.IsEmpty()) - ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage()); + ha = (wxHtmlHelpHashData*) m_PagesHash->Get(m_HtmlWin->GetOpenedPage()); else - ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage() + wxT("#") + an); + ha = (wxHtmlHelpHashData*) m_PagesHash->Get(m_HtmlWin->GetOpenedPage() + wxT("#") + an); if (ha) { bool olduc = m_UpdateContents; m_UpdateContents = FALSE; - m_ContentsBox -> SelectItem(ha -> m_Id); - m_ContentsBox -> EnsureVisible(ha -> m_Id); + m_ContentsBox->SelectItem(ha->m_Id); + m_ContentsBox->EnsureVisible(ha->m_Id); m_UpdateContents = olduc; } } @@ -1033,31 +1071,31 @@ EVENT HANDLING : void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) { - switch (event.GetId()) { - + switch (event.GetId()) + { case wxID_HTML_BACK : - m_HtmlWin -> HistoryBack(); + m_HtmlWin->HistoryBack(); NotifyPageChanged(); break; case wxID_HTML_FORWARD : - m_HtmlWin -> HistoryForward(); + m_HtmlWin->HistoryForward(); NotifyPageChanged(); break; case wxID_HTML_UP : if (m_PagesHash) { - wxString an = m_HtmlWin -> GetOpenedAnchor(); + wxString an = m_HtmlWin->GetOpenedAnchor(); wxHtmlHelpHashData *ha; if (an.IsEmpty()) - ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage()); + ha = (wxHtmlHelpHashData*) m_PagesHash->Get(m_HtmlWin->GetOpenedPage()); else - ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage() + wxT("#") + an); - if (ha && ha -> m_Index > 0) + ha = (wxHtmlHelpHashData*) m_PagesHash->Get(m_HtmlWin->GetOpenedPage() + wxT("#") + an); + if (ha && ha->m_Index > 0) { - wxHtmlContentsItem *it = m_Data -> GetContents() + (ha -> m_Index - 1); - m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); + wxHtmlContentsItem *it = m_Data->GetContents() + (ha->m_Index - 1); + m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page); NotifyPageChanged(); } } @@ -1066,23 +1104,23 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) case wxID_HTML_UPNODE : if (m_PagesHash) { - wxString an = m_HtmlWin -> GetOpenedAnchor(); + wxString an = m_HtmlWin->GetOpenedAnchor(); wxHtmlHelpHashData *ha; if (an.IsEmpty()) - ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage()); + ha = (wxHtmlHelpHashData*) m_PagesHash->Get(m_HtmlWin->GetOpenedPage()); else - ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage() + wxT("#") + an); - if (ha && ha -> m_Index > 0) + ha = (wxHtmlHelpHashData*) m_PagesHash->Get(m_HtmlWin->GetOpenedPage() + wxT("#") + an); + if (ha && ha->m_Index > 0) { - int level = m_Data -> GetContents()[ha -> m_Index].m_Level - 1; + int level = m_Data->GetContents()[ha->m_Index].m_Level - 1; wxHtmlContentsItem *it; - int ind = ha -> m_Index - 1; + int ind = ha->m_Index - 1; - it = m_Data -> GetContents() + ind; - while (ind >= 0 && it -> m_Level != level) ind--, it--; + it = m_Data->GetContents() + ind; + while (ind >= 0 && it->m_Level != level) ind--, it--; if (ind >= 0) { - m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); + m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page); NotifyPageChanged(); } } @@ -1092,21 +1130,21 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) case wxID_HTML_DOWN : if (m_PagesHash) { - wxString an = m_HtmlWin -> GetOpenedAnchor(); + wxString an = m_HtmlWin->GetOpenedAnchor(); wxString adr; wxHtmlHelpHashData *ha; - if (an.IsEmpty()) adr = m_HtmlWin -> GetOpenedPage(); - else adr = m_HtmlWin -> GetOpenedPage() + wxT("#") + an; + if (an.IsEmpty()) adr = m_HtmlWin->GetOpenedPage(); + else adr = m_HtmlWin->GetOpenedPage() + wxT("#") + an; - ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(adr); + ha = (wxHtmlHelpHashData*) m_PagesHash->Get(adr); - if (ha && ha -> m_Index < m_Data -> GetContentsCnt() - 1) + if (ha && ha->m_Index < m_Data->GetContentsCnt() - 1) { - wxHtmlContentsItem *it = m_Data -> GetContents() + (ha -> m_Index + 1); + wxHtmlContentsItem *it = m_Data->GetContents() + (ha->m_Index + 1); - while (it -> m_Book -> GetBasePath() + it -> m_Page == adr) it++; - m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); + while (it->m_Book->GetBasePath() + it->m_Page == adr) it++; + m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page); NotifyPageChanged(); } } @@ -1116,14 +1154,17 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) { if (! (m_Splitter && m_NavigPan)) return ; - if (m_Splitter -> IsSplit()) { - m_Cfg.sashpos = m_Splitter -> GetSashPosition(); - m_Splitter -> Unsplit(m_NavigPan); + if (m_Splitter->IsSplit()) + { + m_Cfg.sashpos = m_Splitter->GetSashPosition(); + m_Splitter->Unsplit(m_NavigPan); m_Cfg.navig_on = FALSE; - } else { - m_NavigPan -> Show(TRUE); - m_HtmlWin -> Show(TRUE); - m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); + } + else + { + m_NavigPan->Show(TRUE); + m_HtmlWin->Show(TRUE); + m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos); m_Cfg.navig_on = TRUE; } } @@ -1138,11 +1179,13 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) wxString item; wxString url; - item = m_HtmlWin -> GetOpenedPageTitle(); - url = m_HtmlWin -> GetOpenedPage(); - if (item == wxEmptyString) item = url.AfterLast(wxT('/')); - if (m_BookmarksPages.Index(url) == wxNOT_FOUND) { - m_Bookmarks -> Append(item); + item = m_HtmlWin->GetOpenedPageTitle(); + url = m_HtmlWin->GetOpenedPage(); + 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); } @@ -1154,12 +1197,13 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) wxString item; int pos; - item = m_Bookmarks -> GetStringSelection(); + 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()); + m_Bookmarks->Delete(m_Bookmarks->GetSelection()); } } break; @@ -1169,10 +1213,10 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) { if (m_Printer == NULL) m_Printer = new wxHtmlEasyPrinting(_("Help Printing"), this); - if (!m_HtmlWin -> GetOpenedPage()) + if (!m_HtmlWin->GetOpenedPage()) wxLogWarning(_("Cannot print empty page.")); else - m_Printer -> PrintFile(m_HtmlWin -> GetOpenedPage()); + m_Printer->PrintFile(m_HtmlWin->GetOpenedPage()); } break; #endif @@ -1197,11 +1241,11 @@ All files (*.*)|*" if (ext == _T(".zip") || ext == _T(".htb") || ext == _T(".hhp")) { wxBusyCursor bcur; - m_Data -> AddBook(s); + m_Data->AddBook(s); RefreshLists(); } else - m_HtmlWin -> LoadPage(s); + m_HtmlWin->LoadPage(s); } } break; @@ -1215,13 +1259,13 @@ void wxHtmlHelpFrame::OnContentsSel(wxTreeEvent& event) wxHtmlHelpTreeItemData *pg; wxHtmlContentsItem *it; - pg = (wxHtmlHelpTreeItemData*) m_ContentsBox -> GetItemData(event.GetItem()); + pg = (wxHtmlHelpTreeItemData*) m_ContentsBox->GetItemData(event.GetItem()); if (pg && m_UpdateContents) { - it = m_Data -> GetContents() + (pg -> m_Id); + it = m_Data->GetContents() + (pg->m_Id); m_UpdateContents = FALSE; - m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); + m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page); m_UpdateContents = TRUE; } } @@ -1230,20 +1274,22 @@ void wxHtmlHelpFrame::OnContentsSel(wxTreeEvent& event) void wxHtmlHelpFrame::OnIndexSel(wxCommandEvent& WXUNUSED(event)) { - wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_IndexList -> GetClientData(m_IndexList -> GetSelection()); - m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); + wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_IndexList->GetClientData(m_IndexList->GetSelection()); + m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page); NotifyPageChanged(); } void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event) { - wxString sr = m_IndexText -> GetLineText(0); + 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,11 +1307,13 @@ 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) { - m_IndexList -> Append(index[i].m_Name, (char*)(index + i)); + if (wxStrstr(mybuff, cstr) != NULL) + { + m_IndexList->Append(index[i].m_Name, (char*)(index + i)); displ++; - if (first) { - m_HtmlWin -> LoadPage(index[i].m_Book -> GetBasePath() + index[i].m_Page); + if (first) + { + m_HtmlWin->LoadPage(index[i].m_Book->GetBasePath() + index[i].m_Page); NotifyPageChanged(); first = FALSE; } @@ -1274,10 +1322,10 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event) wxString cnttext; cnttext.Printf(_("%i of %i"), displ, cnt); - m_IndexCountInfo -> SetLabel(cnttext); + m_IndexCountInfo->SetLabel(cnttext); - m_IndexText -> SetSelection(0, sr.Length()); - m_IndexText -> SetFocus(); + m_IndexText->SetSelection(0, sr.Length()); + m_IndexText->SetFocus(); } } @@ -1290,10 +1338,12 @@ void wxHtmlHelpFrame::OnIndexAll(wxCommandEvent& WXUNUSED(event)) bool first = TRUE; wxHtmlContentsItem* index = m_Data->GetIndex(); - for (int i = 0; i < cnt; i++) { - m_IndexList -> Append(index[i].m_Name, (char*)(index + i)); - if (first) { - m_HtmlWin -> LoadPage(index[i].m_Book -> GetBasePath() + index[i].m_Page); + for (int i = 0; i < cnt; i++) + { + m_IndexList->Append(index[i].m_Name, (char*)(index + i)); + if (first) + { + m_HtmlWin->LoadPage(index[i].m_Book->GetBasePath() + index[i].m_Page); NotifyPageChanged(); first = FALSE; } @@ -1301,34 +1351,34 @@ void wxHtmlHelpFrame::OnIndexAll(wxCommandEvent& WXUNUSED(event)) wxString cnttext; cnttext.Printf(_("%i of %i"), cnt, cnt); - m_IndexCountInfo -> SetLabel(cnttext); + m_IndexCountInfo->SetLabel(cnttext); } void wxHtmlHelpFrame::OnSearchSel(wxCommandEvent& WXUNUSED(event)) { - wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList -> GetClientData(m_SearchList -> GetSelection()); + wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList->GetClientData(m_SearchList->GetSelection()); if (it) { - m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); + m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page); NotifyPageChanged(); } } void wxHtmlHelpFrame::OnSearch(wxCommandEvent& WXUNUSED(event)) { - wxString sr = m_SearchText -> GetLineText(0); + wxString sr = m_SearchText->GetLineText(0); if (sr != wxEmptyString) KeywordSearch(sr); } void wxHtmlHelpFrame::OnBookmarksSel(wxCommandEvent& WXUNUSED(event)) { - wxString sr = m_Bookmarks -> GetStringSelection(); + wxString sr = m_Bookmarks->GetStringSelection(); if (sr != wxEmptyString && sr != _("(bookmarks)")) { - m_HtmlWin -> LoadPage(m_BookmarksPages[m_BookmarksNames.Index(sr)]); + m_HtmlWin->LoadPage(m_BookmarksPages[m_BookmarksNames.Index(sr)]); NotifyPageChanged(); } } @@ -1338,7 +1388,7 @@ void wxHtmlHelpFrame::OnCloseWindow(wxCloseEvent& evt) GetSize(&m_Cfg.w, &m_Cfg.h); GetPosition(&m_Cfg.x, &m_Cfg.y); - if (m_Splitter && m_Cfg.navig_on) m_Cfg.sashpos = m_Splitter -> GetSashPosition(); + if (m_Splitter && m_Cfg.navig_on) m_Cfg.sashpos = m_Splitter->GetSashPosition(); if (m_Config) WriteCustomization(m_Config, m_ConfigRoot); diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index 820fdd9cc0..ce88a8c569 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -59,7 +59,7 @@ void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y, wxHtmlLinkInfo lnk2(*lnk); lnk2.SetEvent(&event); lnk2.SetHtmlCell(this); - ((wxHtmlWindow*)parent) -> OnLinkClicked(lnk2); + ((wxHtmlWindow*)parent)->OnLinkClicked(lnk2); // note : this overcasting is legal because parent is *always* wxHtmlWindow } } @@ -69,14 +69,16 @@ 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); + if (m_Next != NULL) m_Next->AdjustPagebreak(pagebreak); return TRUE; } - else { - if (m_Next != NULL) return m_Next -> AdjustPagebreak(pagebreak); + else + { + if (m_Next != NULL) return m_Next->AdjustPagebreak(pagebreak); else return FALSE; } } @@ -96,27 +98,27 @@ void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link) void wxHtmlCell::Layout(int w) { SetPos(0, 0); - if (m_Next) m_Next -> Layout(w); + if (m_Next) m_Next->Layout(w); } void wxHtmlCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2) { - if (m_Next) m_Next -> Draw(dc, x, y, view_y1, view_y2); + if (m_Next) m_Next->Draw(dc, x, y, view_y1, view_y2); } void wxHtmlCell::DrawInvisible(wxDC& dc, int x, int y) { - if (m_Next) m_Next -> DrawInvisible(dc, x, y); + if (m_Next) m_Next->DrawInvisible(dc, x, y); } const wxHtmlCell* wxHtmlCell::Find(int condition, const void* param) const { - if (m_Next) return m_Next -> Find(condition, param); + if (m_Next) return m_Next->Find(condition, param); else return NULL; } @@ -266,7 +268,7 @@ wxHtmlContainerCell::wxHtmlContainerCell(wxHtmlContainerCell *parent) : wxHtmlCe { m_Cells = m_LastCell = NULL; m_Parent = parent; - if (m_Parent) m_Parent -> InsertCell(this); + if (m_Parent) m_Parent->InsertCell(this); m_AlignHor = wxHTML_ALIGN_LEFT; m_AlignVer = wxHTML_ALIGN_BOTTOM; m_IndentLeft = m_IndentRight = m_IndentTop = m_IndentBottom = 0; @@ -327,14 +329,16 @@ 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) { - if (c -> AdjustPagebreak(&pbrk)) rt = TRUE; - c = c -> GetNext(); + while (c) + { + if (c->AdjustPagebreak(&pbrk)) rt = TRUE; + c = c->GetNext(); } if (rt) *pagebreak = pbrk + m_PosY; return rt; @@ -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,19 +370,22 @@ 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)); + m_Cells->Layout(m_Width - (l + r)); } /* @@ -391,24 +399,27 @@ 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; + case wxHTML_ALIGN_BOTTOM : ybasicpos = - cell->GetHeight(); break; + case wxHTML_ALIGN_CENTER : ybasicpos = - cell->GetHeight() / 2; break; } - ydiff = cell -> GetHeight() + ybasicpos; + ydiff = cell->GetHeight() + ybasicpos; - if (cell -> GetDescent() + ydiff > ysizedown) ysizedown = cell -> GetDescent() + ydiff; - if (ybasicpos + cell -> GetDescent() < -ysizeup) ysizeup = - (ybasicpos + cell -> GetDescent()); + if (cell->GetDescent() + ydiff > ysizedown) ysizedown = cell->GetDescent() + ydiff; + if (ybasicpos + cell->GetDescent() < -ysizeup) ysizeup = - (ybasicpos + cell->GetDescent()); - cell -> SetPos(xpos, ybasicpos + cell -> GetDescent()); - xpos += cell -> GetWidth(); - cell = cell -> GetNext(); + cell->SetPos(xpos, ybasicpos + cell->GetDescent()); + xpos += cell->GetWidth(); + cell = cell->GetNext(); 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,10 +441,11 @@ void wxHtmlContainerCell::Layout(int w) ypos += ysizeup; if (m_AlignHor != wxHTML_ALIGN_JUSTIFY || cell == NULL) - while (line != cell) { - line -> SetPos(line -> GetPosX() + xdelta, - ypos + line -> GetPosY()); - line = line -> GetNext(); + while (line != cell) + { + line->SetPos(line->GetPosX() + xdelta, + ypos + line->GetPosY()); + line = line->GetNext(); } else { @@ -441,11 +453,12 @@ void wxHtmlContainerCell::Layout(int w) int step = (s_width - xpos); if (step < 0) step = 0; xcnt--; - if (xcnt > 0) while (line != cell) { - line -> SetPos(line -> GetPosX() + s_indent + + if (xcnt > 0) while (line != cell) + { + line->SetPos(line->GetPosX() + s_indent + (counter++ * step / xcnt), - ypos + line -> GetPosY()); - line = line -> GetNext(); + ypos + line->GetPosY()); + line = line->GetNext(); } xcnt++; } @@ -460,14 +473,17 @@ 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) { - cell -> SetPos(cell -> GetPosX(), cell -> GetPosY() + diff); - cell = cell -> GetNext(); + while (cell) + { + cell->SetPos(cell->GetPosX(), cell->GetPosY() + diff); + cell = cell->GetNext(); } } m_Height = m_MinHeight; @@ -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); @@ -513,11 +532,12 @@ void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2) dc.DrawLine(x + m_PosX, y + m_PosY + m_Height - 1, x + m_PosX + m_Width - 1, y + m_PosY + m_Height - 1); } - if (m_Cells) m_Cells -> Draw(dc, x + m_PosX, y + m_PosY, view_y1, 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 { - if (m_Cells) m_Cells -> DrawInvisible(dc, x + m_PosX, y + m_PosY); + else + { + if (m_Cells) m_Cells->DrawInvisible(dc, x + m_PosX, y + m_PosY); } wxHtmlCell::Draw(dc, x, y, view_y1, view_y2); @@ -527,7 +547,7 @@ void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2) void wxHtmlContainerCell::DrawInvisible(wxDC& dc, int x, int y) { - if (m_Cells) m_Cells -> DrawInvisible(dc, x + m_PosX, y + m_PosY); + if (m_Cells) m_Cells->DrawInvisible(dc, x + m_PosX, y + m_PosY); wxHtmlCell::DrawInvisible(dc, x, y); } @@ -538,12 +558,13 @@ wxHtmlLinkInfo *wxHtmlContainerCell::GetLink(int x, int y) const wxHtmlCell *c = m_Cells; int cx, cy, cw, ch; - while (c) { - cx = c -> GetPosX(), cy = c -> GetPosY(); - cw = c -> GetWidth(), ch = c -> GetHeight(); + 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)) - return c -> GetLink(x - cx, y - cy); - c = c -> GetNext(); + return c->GetLink(x - cx, y - cy); + c = c->GetNext(); } return NULL; } @@ -553,12 +574,13 @@ wxHtmlLinkInfo *wxHtmlContainerCell::GetLink(int x, int y) const void wxHtmlContainerCell::InsertCell(wxHtmlCell *f) { if (!m_Cells) m_Cells = m_LastCell = f; - else { - m_LastCell -> SetNext(f); + else + { + m_LastCell->SetNext(f); m_LastCell = f; - if (m_LastCell) while (m_LastCell -> GetNext()) m_LastCell = m_LastCell -> GetNext(); + if (m_LastCell) while (m_LastCell->GetNext()) m_LastCell = m_LastCell->GetNext(); } - f -> SetParent(this); + f->SetParent(this); m_LastLayout = -1; } @@ -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,8 +633,9 @@ const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) co { const wxHtmlCell *r = NULL; - if (m_Cells) { - r = m_Cells -> Find(condition, param); + if (m_Cells) + { + r = m_Cells->Find(condition, param); if (r) return r; } @@ -619,17 +646,20 @@ 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) { - if ( (c -> GetPosX() <= x) && - (c -> GetPosY() <= y) && - (c -> GetPosX() + c -> GetWidth() > x) && - (c -> GetPosY() + c -> GetHeight() > y)) { - c -> OnMouseClick(parent, x - c -> GetPosX(), y - c -> GetPosY(), event); + while (c) + { + if ( (c->GetPosX() <= x) && + (c->GetPosY() <= y) && + (c->GetPosX() + c->GetWidth() > x) && + (c->GetPosY() + c->GetHeight() > y)) + { + c->OnMouseClick(parent, x - c->GetPosX(), y - c->GetPosY(), event); break; } - c = c -> GetNext(); + c = c->GetNext(); } } } @@ -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); } @@ -698,7 +730,7 @@ wxHtmlWidgetCell::wxHtmlWidgetCell(wxWindow *wnd, int w) { int sx, sy; m_Wnd = wnd; - m_Wnd -> GetSize(&sx, &sy); + m_Wnd->GetSize(&sx, &sy); m_Width = sx, m_Height = sy; m_WidthFloat = w; } @@ -709,14 +741,15 @@ 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) { - absx += c -> GetPosX(); - absy += c -> GetPosY(); - c = c -> GetParent(); + while (c) + { + absx += c->GetPosX(); + absy += c->GetPosY(); + c = c->GetParent(); } - ((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty); - m_Wnd -> SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height); + ((wxScrolledWindow*)(m_Wnd->GetParent()))->ViewStart(&stx, &sty); + m_Wnd->SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height); wxHtmlCell::Draw(dc, x, y, view_y1, view_y2); } @@ -728,14 +761,15 @@ void wxHtmlWidgetCell::DrawInvisible(wxDC& dc, int x, int y) int absx = 0, absy = 0, stx, sty; wxHtmlCell *c = this; - while (c) { - absx += c -> GetPosX(); - absy += c -> GetPosY(); - c = c -> GetParent(); + while (c) + { + absx += c->GetPosX(); + absy += c->GetPosY(); + c = c->GetParent(); } - ((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty); - m_Wnd -> SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height); + ((wxScrolledWindow*)(m_Wnd->GetParent()))->ViewStart(&stx, &sty); + m_Wnd->SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height); wxHtmlCell::DrawInvisible(dc, x, y); } @@ -744,9 +778,10 @@ 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); + m_Wnd->SetSize(m_Width, m_Height); } wxHtmlCell::Layout(w); diff --git a/src/html/htmlfilt.cpp b/src/html/htmlfilt.cpp index 874ccaf991..6f30086b60 100644 --- a/src/html/htmlfilt.cpp +++ b/src/html/htmlfilt.cpp @@ -58,9 +58,9 @@ wxString wxHtmlFilterPlainText::ReadFile(const wxFSFile& file) const wxString doc, doc2; if (s == NULL) return wxEmptyString; - src = new char[s -> GetSize()+1]; - src[s -> GetSize()] = 0; - s -> Read(src, s -> GetSize()); + src = new char[s->GetSize()+1]; + src[s->GetSize()] = 0; + s->Read(src, s->GetSize()); doc = src; delete [] src; @@ -146,9 +146,9 @@ wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const wxLogError(_("Cannot open HTML document: %s"), file.GetLocation().c_str()); return wxEmptyString; } - src = new char[s -> GetSize() + 1]; - src[s -> GetSize()] = 0; - s -> Read(src, s -> GetSize()); + src = new char[s->GetSize() + 1]; + src[s->GetSize()] = 0; + s->Read(src, s->GetSize()); doc = src; delete[] src; diff --git a/src/html/htmlpars.cpp b/src/html/htmlpars.cpp index 65066aeddc..17fb0afb1c 100644 --- a/src/html/htmlpars.cpp +++ b/src/html/htmlpars.cpp @@ -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); } @@ -121,8 +126,9 @@ void wxHtmlParser::AddTag(const wxHtmlTag& tag) h = (wxHtmlTagHandler*) m_HandlersHash.Get(tag.GetName()); if (h) - inner = h -> HandleTag(tag); - if (!inner) { + inner = h->HandleTag(tag); + if (!inner) + { if (tag.HasEnding()) DoParsing(tag.GetBeginPos(), tag.GetEndPos1()); } @@ -132,7 +138,7 @@ void wxHtmlParser::AddTag(const wxHtmlTag& tag) void wxHtmlParser::AddTagHandler(wxHtmlTagHandler *handler) { - wxString s(handler -> GetSupportedTags()); + wxString s(handler->GetSupportedTags()); wxStringTokenizer tokenizer(s, ", "); while (tokenizer.HasMoreTokens()) @@ -141,7 +147,7 @@ void wxHtmlParser::AddTagHandler(wxHtmlTagHandler *handler) if (m_HandlersList.IndexOf(handler) == wxNOT_FOUND) m_HandlersList.Append(handler); - handler -> SetParser(this); + handler->SetParser(this); } @@ -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->DeleteContents(TRUE); } - m_HandlersStack -> Insert(new wxHashTable(m_HandlersHash)); + 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); @@ -172,13 +180,13 @@ void wxHtmlParser::PopTagHandler() wxNode *first; if (m_HandlersStack == NULL || - (first = m_HandlersStack -> GetFirst()) == NULL) + (first = m_HandlersStack->GetFirst()) == NULL) { wxLogWarning(_("Warning: attempt to remove HTML tag handler from empty stack.")); return; } - m_HandlersHash = *((wxHashTable*) first -> GetData()); - m_HandlersStack -> DeleteNode(first); + m_HandlersHash = *((wxHashTable*) first->GetData()); + m_HandlersStack->DeleteNode(first); } diff --git a/src/html/htmltag.cpp b/src/html/htmltag.cpp index 577728d50a..7b6e9755b3 100644 --- a/src/html/htmltag.cpp +++ b/src/html/htmltag.cpp @@ -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); } @@ -128,33 +136,37 @@ wxHtmlTag::wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCac // fill-in name, params and begin pos: m_Name = m_Params = wxEmptyString; i = pos+1; - if (source[i] == '/') {m_Ending = TRUE; i++;} + if (source[i] == '/') { m_Ending = TRUE; i++; } else m_Ending = FALSE; 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; } } m_Begin = i; - cache -> QueryTag(pos, &m_End1, &m_End2); + cache->QueryTag(pos, &m_End1, &m_End2); if (m_End1 > end_pos) m_End1 = end_pos; if (m_End2 > end_pos) m_End2 = end_pos; } @@ -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) == '"')) { - st2++; - comma = TRUE; - comma_char = '"'; - } - else if (!with_commas && (*(st2) == '\'')) { - st2++; - comma = TRUE; - comma_char = '\''; - } - while (*st2 != 0) { + comma_char = '\0'; + if (!with_commas && (*(st2) == '"')) + { + st2++; + comma = TRUE; + comma_char = '"'; + } + else if (!with_commas && (*(st2) == '\'')) + { + st2++; + comma = TRUE; + comma_char = '\''; + } + + 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++; } diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index 9316bf7019..393b47565d 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -53,12 +53,12 @@ wxHtmlWindow::wxHtmlWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos, m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString; m_Cell = NULL; m_Parser = new wxHtmlWinParser(this); - m_Parser -> SetFS(m_FS); + m_Parser->SetFS(m_FS); SetBorders(10); m_HistoryPos = -1; m_HistoryOn = TRUE; m_Style = style; - SetPage(""); + SetPage(wxT("")); } @@ -94,7 +94,7 @@ void wxHtmlWindow::SetFonts(wxString normal_face, wxString fixed_face, const int { wxString op = m_OpenedPage; - m_Parser -> SetFonts(normal_face, fixed_face, sizes); + m_Parser->SetFonts(normal_face, fixed_face, sizes); SetPage(wxT("")); // fonts changed => contents invalid if (!op.IsEmpty()) LoadPage(op); } @@ -105,18 +105,19 @@ bool wxHtmlWindow::SetPage(const wxString& source) { wxClientDC *dc = new wxClientDC(this); - dc -> SetMapMode(wxMM_TEXT); + dc->SetMapMode(wxMM_TEXT); SetBackgroundColour(wxColour(0xFF, 0xFF, 0xFF)); m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString; - m_Parser -> SetDC(dc); - if (m_Cell) { + m_Parser->SetDC(dc); + if (m_Cell) + { delete m_Cell; m_Cell = NULL; } - m_Cell = (wxHtmlContainerCell*) m_Parser -> Parse(source); + m_Cell = (wxHtmlContainerCell*) m_Parser->Parse(source); delete dc; - m_Cell -> SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS); - m_Cell -> SetAlignHor(wxHTML_ALIGN_CENTER); + m_Cell->SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS); + m_Cell->SetAlignHor(wxHTML_ALIGN_CENTER); CreateLayout(); if (m_tmpCanDrawLocks == 0) Refresh(); return TRUE; @@ -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) { - m_RelatedFrame -> SetStatusText(_("Connecting..."), m_RelatedStatusBar); + if (m_RelatedStatusBar != -1) + { + m_RelatedFrame->SetStatusText(_("Connecting..."), m_RelatedStatusBar); Refresh(FALSE); } - f = m_FS -> OpenFile(location); + 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,45 +187,52 @@ 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); + m_RelatedFrame->SetStatusText(msg, m_RelatedStatusBar); Refresh(FALSE); } node = m_Filters.GetFirst(); - while (node){ - wxHtmlFilter *h = (wxHtmlFilter*) node -> GetData(); - if (h -> CanRead(*f)) { - src = h -> ReadFile(*f); + while (node) + { + wxHtmlFilter *h = (wxHtmlFilter*) node->GetData(); + if (h->CanRead(*f)) + { + src = h->ReadFile(*f); break; } - node = node -> GetNext(); + node = node->GetNext(); } - if (src == wxEmptyString) { + if (src == wxEmptyString) + { if (m_DefaultFilter == NULL) m_DefaultFilter = GetDefaultFilter(); - src = m_DefaultFilter -> ReadFile(*f); + src = m_DefaultFilter->ReadFile(*f); } - m_FS -> ChangePathTo(f -> GetLocation()); + m_FS->ChangePathTo(f->GetLocation()); rt_val = SetPage(src); - m_OpenedPage = f -> GetLocation(); - if (f -> GetAnchor() != wxEmptyString) { + m_OpenedPage = f->GetLocation(); + if (f->GetAnchor() != wxEmptyString) + { wxYield(); - ScrollToAnchor(f -> GetAnchor()); + ScrollToAnchor(f->GetAnchor()); } delete f; - if (m_RelatedStatusBar != -1) m_RelatedFrame -> SetStatusText(_("Done"), m_RelatedStatusBar); + if (m_RelatedStatusBar != -1) m_RelatedFrame->SetStatusText(_("Done"), m_RelatedStatusBar); } } - 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(); @@ -245,16 +261,17 @@ bool wxHtmlWindow::LoadPage(const wxString& location) bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor) { - const wxHtmlCell *c = m_Cell -> Find(wxHTML_COND_ISANCHOR, &anchor); + const wxHtmlCell *c = m_Cell->Find(wxHTML_COND_ISANCHOR, &anchor); if (!c) { 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(); + for (y = 0; c != NULL; c = c->GetParent()) y += c->GetPosY(); Scroll(-1, y / wxHTML_SCROLL_STEP); m_OpenedAnchor = anchor; return TRUE; @@ -264,10 +281,11 @@ 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); + m_RelatedFrame->SetTitle(tit); } m_OpenedPageTitle = title; } @@ -282,26 +300,29 @@ void wxHtmlWindow::CreateLayout() if (!m_Cell) return; - if (m_Style & wxHW_SCROLLBAR_NEVER) { - SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell -> GetWidth() / wxHTML_SCROLL_STEP, 0); // always off + 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); + m_Cell->Layout(ClientWidth); } else { GetClientSize(&ClientWidth, &ClientHeight); - m_Cell -> Layout(ClientWidth); - if (ClientHeight < m_Cell -> GetHeight() + GetCharHeight()) { + m_Cell->Layout(ClientWidth); + 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 + 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 */ - SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell -> GetWidth() / wxHTML_SCROLL_STEP, 0); // disable... + 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 + m_Cell->Layout(ClientWidth); // ...and relayout } } } @@ -315,22 +336,24 @@ void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path) int p_fontsizes[7]; wxString p_fff, p_ffn; - if (path != wxEmptyString) { - oldpath = cfg -> GetPath(); - cfg -> SetPath(path); + if (path != wxEmptyString) + { + oldpath = cfg->GetPath(); + cfg->SetPath(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++) { + 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++) + { tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i); - p_fontsizes[i] = cfg -> Read(tmp, m_Parser -> m_FontsSizes[i]); + p_fontsizes[i] = cfg->Read(tmp, m_Parser->m_FontsSizes[i]); } SetFonts(p_ffn, p_fff, p_fontsizes); if (path != wxEmptyString) - cfg -> SetPath(oldpath); + cfg->SetPath(oldpath); } @@ -340,21 +363,23 @@ void wxHtmlWindow::WriteCustomization(wxConfigBase *cfg, wxString path) wxString oldpath; wxString tmp; - if (path != wxEmptyString) { - oldpath = cfg -> GetPath(); - cfg -> SetPath(path); + if (path != wxEmptyString) + { + oldpath = cfg->GetPath(); + cfg->SetPath(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++) { + 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++) + { tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i); - cfg -> Write(tmp, (long) m_Parser -> m_FontsSizes[i]); + cfg->Write(tmp, (long) m_Parser->m_FontsSizes[i]); } if (path != wxEmptyString) - cfg -> SetPath(oldpath); + cfg->SetPath(oldpath); } @@ -485,10 +510,11 @@ 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); + if (m_Cell) m_Cell->Draw(dc, 0, 0, y * wxHTML_SCROLL_STEP + v_y, y * wxHTML_SCROLL_STEP + v_h + v_y); upd++; } } @@ -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; @@ -517,7 +544,7 @@ void wxHtmlWindow::OnMouseEvent(wxMouseEvent& event) pos = event.GetPosition(); if (m_Cell) - m_Cell -> OnMouseClick(this, sx + pos.x, sy + pos.y, event); + m_Cell->OnMouseClick(this, sx + pos.x, sy + pos.y, event); } } @@ -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; @@ -539,17 +567,20 @@ void wxHtmlWindow::OnIdle(wxIdleEvent& event) ViewStart(&sx, &sy); sx *= wxHTML_SCROLL_STEP; sy *= wxHTML_SCROLL_STEP; wxGetMousePosition(&x, &y); ScreenToClient(&x, &y); - lnk = m_Cell -> GetLink(sx + x, sy + 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); + 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); + m_RelatedFrame->SetStatusText(lnk->GetHref(), m_RelatedStatusBar); } m_tmpLastLink = lnk; } diff --git a/src/html/htmprint.cpp b/src/html/htmprint.cpp index df55a076eb..f79156b31a 100644 --- a/src/html/htmprint.cpp +++ b/src/html/htmprint.cpp @@ -47,7 +47,7 @@ wxHtmlDCRenderer::wxHtmlDCRenderer() : wxObject() m_Cells = NULL; m_Parser = new wxHtmlWinParser(NULL); m_FS = new wxFileSystem(); - m_Parser -> SetFS(m_FS); + m_Parser->SetFS(m_FS); } @@ -64,7 +64,7 @@ wxHtmlDCRenderer::~wxHtmlDCRenderer() void wxHtmlDCRenderer::SetDC(wxDC *dc, double pixel_scale) { m_DC = dc; - m_Parser -> SetDC(m_DC, pixel_scale); + m_Parser->SetDC(m_DC, pixel_scale); } @@ -83,10 +83,10 @@ void wxHtmlDCRenderer::SetHtmlText(const wxString& html, const wxString& basepat if (m_Cells != NULL) delete m_Cells; - m_FS -> ChangePathTo(basepath, isdir); - m_Cells = (wxHtmlContainerCell*) m_Parser -> Parse(html); - m_Cells -> SetIndent(0, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS); - m_Cells -> Layout(m_Width); + m_FS->ChangePathTo(basepath, isdir); + m_Cells = (wxHtmlContainerCell*) m_Parser->Parse(html); + m_Cells->SetIndent(0, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS); + m_Cells->Layout(m_Width); } @@ -98,20 +98,21 @@ int wxHtmlDCRenderer::Render(int x, int y, int from, int dont_render) if (m_Cells == NULL || m_DC == NULL) return 0; pbreak = (int)(from + m_Height); - while (m_Cells -> AdjustPagebreak(&pbreak)) {} + while (m_Cells->AdjustPagebreak(&pbreak)) {} hght = pbreak - from; - if (!dont_render) { - m_DC -> SetBrush(*wxWHITE_BRUSH); + if (!dont_render) + { + m_DC->SetBrush(*wxWHITE_BRUSH); - m_DC -> SetClippingRegion(x, y, m_Width, hght); - m_Cells -> Draw(*m_DC, + m_DC->SetClippingRegion(x, y, m_Width, hght); + m_Cells->Draw(*m_DC, x, (y - from), y, pbreak + (y /*- from*/)); - m_DC -> DestroyClippingRegion(); + m_DC->DestroyClippingRegion(); } - if (pbreak < m_Cells -> GetHeight()) return pbreak; + if (pbreak < m_Cells->GetHeight()) return pbreak; else return GetTotalHeight(); } @@ -119,7 +120,7 @@ int wxHtmlDCRenderer::Render(int x, int y, int from, int dont_render) int wxHtmlDCRenderer::GetTotalHeight() { - if (m_Cells) return m_Cells -> GetHeight(); + if (m_Cells) return m_Cells->GetHeight(); else return 0; } @@ -184,41 +185,45 @@ bool wxHtmlPrintout::OnBeginDocument(int startPage, int endPage) GetPPIScreen(&ppiScreenX, &ppiScreenY); wxDisplaySize(&scr_w, &scr_h); - GetDC() -> GetSize(&dc_w, &dc_h); + GetDC()->GetSize(&dc_w, &dc_h); - GetDC() -> SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth); + GetDC()->SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth); /* prepare headers/footers renderer: */ - m_RendererHdr -> SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY); - m_RendererHdr -> SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginTop)), + 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) { - m_RendererHdr -> SetHtmlText(TranslateHeader(m_Headers[0], 1)); - m_HeaderHeight = m_RendererHdr -> GetTotalHeight(); + if (m_Headers[0] != wxEmptyString) + { + m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[0], 1)); + m_HeaderHeight = m_RendererHdr->GetTotalHeight(); } - else if (m_Headers[1] != wxEmptyString) { - m_RendererHdr -> SetHtmlText(TranslateHeader(m_Headers[1], 1)); - m_HeaderHeight = m_RendererHdr -> GetTotalHeight(); + else if (m_Headers[1] != wxEmptyString) + { + m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[1], 1)); + m_HeaderHeight = m_RendererHdr->GetTotalHeight(); } - if (m_Footers[0] != wxEmptyString) { - m_RendererHdr -> SetHtmlText(TranslateHeader(m_Footers[0], 1)); - m_FooterHeight = m_RendererHdr -> GetTotalHeight(); + if (m_Footers[0] != wxEmptyString) + { + m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[0], 1)); + m_FooterHeight = m_RendererHdr->GetTotalHeight(); } - else if (m_Footers[1] != wxEmptyString) { - m_RendererHdr -> SetHtmlText(TranslateHeader(m_Footers[1], 1)); - m_FooterHeight = m_RendererHdr -> GetTotalHeight(); + else if (m_Footers[1] != wxEmptyString) + { + m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[1], 1)); + m_FooterHeight = m_RendererHdr->GetTotalHeight(); } /* prepare main renderer: */ - m_Renderer -> SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY); - m_Renderer -> SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginTop)), + m_Renderer->SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY); + m_Renderer->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginTop)), (int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom) - m_FooterHeight - m_HeaderHeight - ((m_HeaderHeight == 0) ? 0 : m_MarginSpace * ppmm_v) - ((m_FooterHeight == 0) ? 0 : m_MarginSpace * ppmm_v) )); - m_Renderer -> SetHtmlText(m_Document, m_BasePath, m_BasePathIsDir); + m_Renderer->SetHtmlText(m_Document, m_BasePath, m_BasePathIsDir); CountPages(); return TRUE; } @@ -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; } @@ -273,10 +279,10 @@ void wxHtmlPrintout::SetHtmlFile(const wxString& htmlfile) return; } - wxInputStream *st = ff -> GetStream(); - char *t = new char[st -> GetSize() + 1]; - st -> Read(t, st -> GetSize()); - t[st -> GetSize()] = 0; + wxInputStream *st = ff->GetStream(); + char *t = new char[st->GetSize() + 1]; + st->Read(t, st->GetSize()); + t[st->GetSize()] = 0; wxString doc = wxString(t); delete t; @@ -323,12 +329,13 @@ void wxHtmlPrintout::CountPages() m_NumPages = 0; m_PageBreaks[0] = 0; - do { - pos = m_Renderer -> Render((int)( ppmm_h * m_MarginLeft), + 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); m_PageBreaks[++m_NumPages] = pos; - } while (pos < m_Renderer -> GetTotalHeight()); + } while (pos < m_Renderer->GetTotalHeight()); } @@ -345,31 +352,33 @@ void wxHtmlPrintout::RenderPage(wxDC *dc, int page) ppmm_h = (float)pageWidth / mm_w; ppmm_v = (float)pageHeight / mm_h; wxDisplaySize(&scr_w, &scr_h); - dc -> GetSize(&dc_w, &dc_h); + dc->GetSize(&dc_w, &dc_h); int ppiPrinterX, ppiPrinterY; GetPPIPrinter(&ppiPrinterX, &ppiPrinterY); int ppiScreenX, ppiScreenY; GetPPIScreen(&ppiScreenX, &ppiScreenY); - dc -> SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth); + dc->SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth); - m_Renderer -> SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY); + m_Renderer->SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY); - dc -> SetBackgroundMode(wxTRANSPARENT); + dc->SetBackgroundMode(wxTRANSPARENT); - m_Renderer -> Render((int) (ppmm_h * m_MarginLeft), + m_Renderer->Render((int) (ppmm_h * m_MarginLeft), (int) (ppmm_v * (m_MarginTop + (m_HeaderHeight == 0 ? 0 : m_MarginSpace)) + m_HeaderHeight), m_PageBreaks[page-1]); - m_RendererHdr -> SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY); - 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)); + m_RendererHdr->SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY); + 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) { - 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)); + 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)); } } @@ -421,9 +430,9 @@ wxHtmlEasyPrinting::wxHtmlEasyPrinting(const wxString& name, wxFrame *parent_fra m_PageSetupData = new wxPageSetupDialogData; m_Headers[0] = m_Headers[1] = m_Footers[0] = m_Footers[1] = wxEmptyString; - m_PageSetupData -> EnableMargins(TRUE); - m_PageSetupData -> SetMarginTopLeft(wxPoint(25, 25)); - m_PageSetupData -> SetMarginBottomRight(wxPoint(25, 25)); + m_PageSetupData->EnableMargins(TRUE); + m_PageSetupData->SetMarginTopLeft(wxPoint(25, 25)); + m_PageSetupData->SetMarginBottomRight(wxPoint(25, 25)); } @@ -439,9 +448,9 @@ wxHtmlEasyPrinting::~wxHtmlEasyPrinting() bool wxHtmlEasyPrinting::PreviewFile(const wxString &htmlfile) { wxHtmlPrintout *p1 = CreatePrintout(); - p1 -> SetHtmlFile(htmlfile); + p1->SetHtmlFile(htmlfile); wxHtmlPrintout *p2 = CreatePrintout(); - p2 -> SetHtmlFile(htmlfile); + p2->SetHtmlFile(htmlfile); return DoPreview(p1, p2); } @@ -450,9 +459,9 @@ bool wxHtmlEasyPrinting::PreviewFile(const wxString &htmlfile) bool wxHtmlEasyPrinting::PreviewText(const wxString &htmltext, const wxString &basepath) { wxHtmlPrintout *p1 = CreatePrintout(); - p1 -> SetHtmlText(htmltext, basepath, TRUE); + p1->SetHtmlText(htmltext, basepath, TRUE); wxHtmlPrintout *p2 = CreatePrintout(); - p2 -> SetHtmlText(htmltext, basepath, TRUE); + p2->SetHtmlText(htmltext, basepath, TRUE); return DoPreview(p1, p2); } @@ -461,7 +470,7 @@ bool wxHtmlEasyPrinting::PreviewText(const wxString &htmltext, const wxString &b bool wxHtmlEasyPrinting::PrintFile(const wxString &htmlfile) { wxHtmlPrintout *p = CreatePrintout(); - p -> SetHtmlFile(htmlfile); + p->SetHtmlFile(htmlfile); return DoPrint(p); } @@ -470,7 +479,7 @@ bool wxHtmlEasyPrinting::PrintFile(const wxString &htmlfile) bool wxHtmlEasyPrinting::PrintText(const wxString &htmltext, const wxString &basepath) { wxHtmlPrintout *p = CreatePrintout(); - p -> SetHtmlText(htmltext, basepath, TRUE); + p->SetHtmlText(htmltext, basepath, TRUE); return DoPrint(p); } @@ -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; } @@ -489,9 +499,9 @@ bool wxHtmlEasyPrinting::DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *pr wxPreviewFrame *frame = new wxPreviewFrame(preview, m_Frame, m_Name + _(" Preview"), wxPoint(100, 100), wxSize(650, 500)); - frame -> Centre(wxBOTH); - frame -> Initialize(); - frame -> Show(TRUE); + frame->Centre(wxBOTH); + frame->Initialize(); + frame->Show(TRUE); return TRUE; } @@ -528,10 +538,11 @@ void wxHtmlEasyPrinting::PrinterSetup() void wxHtmlEasyPrinting::PageSetup() { - m_PageSetupData -> SetPrintData(*m_PrintData); + 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(); } @@ -563,15 +574,15 @@ wxHtmlPrintout *wxHtmlEasyPrinting::CreatePrintout() { wxHtmlPrintout *p = new wxHtmlPrintout(m_Name); - p -> SetHeader(m_Headers[0], wxPAGE_EVEN); - p -> SetHeader(m_Headers[1], wxPAGE_ODD); - p -> SetFooter(m_Footers[0], wxPAGE_EVEN); - p -> SetFooter(m_Footers[1], wxPAGE_ODD); - - p -> SetMargins(m_PageSetupData -> GetMarginTopLeft().y, - m_PageSetupData -> GetMarginBottomRight().y, - m_PageSetupData -> GetMarginTopLeft().x, - m_PageSetupData -> GetMarginBottomRight().x); + p->SetHeader(m_Headers[0], wxPAGE_EVEN); + p->SetHeader(m_Headers[1], wxPAGE_ODD); + p->SetFooter(m_Footers[0], wxPAGE_EVEN); + p->SetFooter(m_Footers[1], wxPAGE_ODD); + + p->SetMargins(m_PageSetupData->GetMarginTopLeft().y, + m_PageSetupData->GetMarginBottomRight().y, + m_PageSetupData->GetMarginTopLeft().x, + m_PageSetupData->GetMarginBottomRight().x); return p; } diff --git a/src/html/m_dflist.cpp b/src/html/m_dflist.cpp index 3625e1adfb..28c34616c9 100644 --- a/src/html/m_dflist.cpp +++ b/src/html/m_dflist.cpp @@ -43,38 +43,44 @@ TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD") wxHtmlContainerCell *c; - if (tag.GetName() == wxT("DL")) { - if (m_WParser -> GetContainer() -> GetFirstCell() != NULL) { - m_WParser -> CloseContainer(); - m_WParser -> OpenContainer(); + if (tag.GetName() == wxT("DL")) + { + if (m_WParser->GetContainer()->GetFirstCell() != NULL) + { + m_WParser->CloseContainer(); + m_WParser->OpenContainer(); } - m_WParser -> GetContainer() -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_TOP); + m_WParser->GetContainer()->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP); ParseInner(tag); - if (m_WParser -> GetContainer() -> GetFirstCell() != NULL) { - m_WParser -> CloseContainer(); - m_WParser -> OpenContainer(); + if (m_WParser->GetContainer()->GetFirstCell() != NULL) + { + m_WParser->CloseContainer(); + m_WParser->OpenContainer(); } - m_WParser -> GetContainer() -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_TOP); + m_WParser->GetContainer()->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP); return TRUE; } - else if (tag.GetName() == wxT("DT")) { - if (!tag.IsEnding()) { - m_WParser -> CloseContainer(); - c = m_WParser -> OpenContainer(); - c -> SetAlignHor(wxHTML_ALIGN_LEFT); - c -> SetMinHeight(m_WParser -> GetCharHeight()); + else if (tag.GetName() == wxT("DT")) + { + if (!tag.IsEnding()) + { + m_WParser->CloseContainer(); + c = m_WParser->OpenContainer(); + c->SetAlignHor(wxHTML_ALIGN_LEFT); + c->SetMinHeight(m_WParser->GetCharHeight()); } return FALSE; } - else if (!tag.IsEnding()) { // "DD" - m_WParser -> CloseContainer(); - c = m_WParser -> OpenContainer(); - c -> SetIndent(5 * m_WParser -> GetCharWidth(), wxHTML_INDENT_LEFT); + else if (!tag.IsEnding()) // "DD" + { + m_WParser->CloseContainer(); + c = m_WParser->OpenContainer(); + c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_LEFT); return FALSE; } diff --git a/src/html/m_fonts.cpp b/src/html/m_fonts.cpp index 4f7471622e..b183ffaa33 100644 --- a/src/html/m_fonts.cpp +++ b/src/html/m_fonts.cpp @@ -39,34 +39,40 @@ TAG_HANDLER_BEGIN(FONT, "FONT") TAG_HANDLER_PROC(tag) { - wxColour oldclr = m_WParser -> GetActualColor(); - int oldsize = m_WParser -> GetFontSize(); - wxString oldface = m_WParser -> GetFontFace(); + wxColour oldclr = m_WParser->GetActualColor(); + 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)); + 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); + m_WParser->SetFontSize(oldsize+tmp); else - m_WParser -> SetFontSize(tmp); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetFontSize(tmp); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); } } - 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,26 +81,32 @@ TAG_HANDLER_BEGIN(FONT, "FONT") int index; while (tk.HasMoreTokens()) - if ((index = m_Faces.Index(tk.GetNextToken())) != wxNOT_FOUND) { - m_WParser -> SetFontFace(m_Faces[index]); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + { + 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()) { - m_WParser -> SetFontFace(oldface); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + if (oldface != m_WParser->GetFontFace()) + { + m_WParser->SetFontFace(oldface); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); } - if (oldsize != m_WParser -> GetFontSize()) { - m_WParser -> SetFontSize(oldsize); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + if (oldsize != m_WParser->GetFontSize()) + { + m_WParser->SetFontSize(oldsize); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); } - if (oldclr != m_WParser -> GetActualColor()) { - m_WParser -> SetActualColor(oldclr); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(oldclr)); + if (oldclr != m_WParser->GetActualColor()) + { + m_WParser->SetActualColor(oldclr); + m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(oldclr)); } return TRUE; } @@ -106,15 +118,15 @@ TAG_HANDLER_BEGIN(FACES_U, "U,STRIKE") TAG_HANDLER_PROC(tag) { - int underlined = m_WParser -> GetFontUnderlined(); + int underlined = m_WParser->GetFontUnderlined(); - m_WParser -> SetFontUnderlined(TRUE); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetFontUnderlined(TRUE); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); ParseInner(tag); - m_WParser -> SetFontUnderlined(underlined); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetFontUnderlined(underlined); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); return TRUE; } @@ -127,15 +139,15 @@ TAG_HANDLER_BEGIN(FACES_B, "B,STRONG") TAG_HANDLER_PROC(tag) { - int bold = m_WParser -> GetFontBold(); + int bold = m_WParser->GetFontBold(); - m_WParser -> SetFontBold(TRUE); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetFontBold(TRUE); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); ParseInner(tag); - m_WParser -> SetFontBold(bold); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetFontBold(bold); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); return TRUE; } @@ -148,15 +160,15 @@ TAG_HANDLER_BEGIN(FACES_I, "I,EM,CITE,ADDRESS") TAG_HANDLER_PROC(tag) { - int italic = m_WParser -> GetFontItalic(); + int italic = m_WParser->GetFontItalic(); - m_WParser -> SetFontItalic(TRUE); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetFontItalic(TRUE); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); ParseInner(tag); - m_WParser -> SetFontItalic(italic); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetFontItalic(italic); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); return TRUE; } @@ -169,15 +181,15 @@ TAG_HANDLER_BEGIN(FACES_TT, "TT,CODE,KBD,SAMP") TAG_HANDLER_PROC(tag) { - int fixed = m_WParser -> GetFontFixed(); + int fixed = m_WParser->GetFontFixed(); - m_WParser -> SetFontFixed(TRUE); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetFontFixed(TRUE); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); ParseInner(tag); - m_WParser -> SetFontFixed(fixed); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetFontFixed(fixed); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); return TRUE; } @@ -194,64 +206,67 @@ TAG_HANDLER_BEGIN(Hx, "H1,H2,H3,H4,H5,H6") int old_size, old_b, old_i, old_u, old_f, old_al; wxHtmlContainerCell *c; - old_size = m_WParser -> GetFontSize(); - old_b = m_WParser -> GetFontBold(); - old_i = m_WParser -> GetFontItalic(); - old_u = m_WParser -> GetFontUnderlined(); - old_f = m_WParser -> GetFontFixed(); - old_al = m_WParser -> GetAlign(); + old_size = m_WParser->GetFontSize(); + old_b = m_WParser->GetFontBold(); + old_i = m_WParser->GetFontItalic(); + old_u = m_WParser->GetFontUnderlined(); + old_f = m_WParser->GetFontFixed(); + old_al = m_WParser->GetAlign(); - m_WParser -> SetFontBold(TRUE); - m_WParser -> SetFontItalic(FALSE); - m_WParser -> SetFontUnderlined(FALSE); - m_WParser -> SetFontFixed(FALSE); + m_WParser->SetFontBold(TRUE); + m_WParser->SetFontItalic(FALSE); + m_WParser->SetFontUnderlined(FALSE); + m_WParser->SetFontFixed(FALSE); if (tag.GetName() == wxT("H1")) - m_WParser -> SetFontSize(7); + m_WParser->SetFontSize(7); else if (tag.GetName() == wxT("H2")) - m_WParser -> SetFontSize(6); + m_WParser->SetFontSize(6); else if (tag.GetName() == wxT("H3")) - m_WParser -> SetFontSize(5); - else if (tag.GetName() == wxT("H4")) { - m_WParser -> SetFontSize(5); - m_WParser -> SetFontItalic(TRUE); - m_WParser -> SetFontBold(FALSE); + m_WParser->SetFontSize(5); + 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")) { - m_WParser -> SetFontSize(4); - m_WParser -> SetFontItalic(TRUE); - m_WParser -> SetFontBold(FALSE); + m_WParser->SetFontSize(4); + 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()) { - m_WParser -> CloseContainer(); - m_WParser -> OpenContainer(); - c = m_WParser -> GetContainer(); + c = m_WParser->GetContainer(); + if (c->GetFirstCell()) + { + m_WParser->CloseContainer(); + m_WParser->OpenContainer(); + c = m_WParser->GetContainer(); } - c = m_WParser -> GetContainer(); + c = m_WParser->GetContainer(); - c -> SetAlign(tag); - c -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); - c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_TOP); - m_WParser -> SetAlign(c -> GetAlignHor()); + c->SetAlign(tag); + c->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); + c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP); + m_WParser->SetAlign(c->GetAlignHor()); ParseInner(tag); - m_WParser -> SetFontSize(old_size); - m_WParser -> SetFontBold(old_b); - m_WParser -> SetFontItalic(old_i); - m_WParser -> SetFontUnderlined(old_u); - m_WParser -> SetFontFixed(old_f); - m_WParser -> SetAlign(old_al); + m_WParser->SetFontSize(old_size); + m_WParser->SetFontBold(old_b); + m_WParser->SetFontItalic(old_i); + m_WParser->SetFontUnderlined(old_u); + m_WParser->SetFontFixed(old_f); + m_WParser->SetAlign(old_al); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); - m_WParser -> CloseContainer(); - m_WParser -> OpenContainer(); - c = m_WParser -> GetContainer(); - c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_TOP); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); + m_WParser->CloseContainer(); + m_WParser->OpenContainer(); + c = m_WParser->GetContainer(); + c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP); return TRUE; } @@ -263,16 +278,16 @@ TAG_HANDLER_BEGIN(BIGSMALL, "BIG,SMALL") TAG_HANDLER_PROC(tag) { - int oldsize = m_WParser -> GetFontSize(); + int oldsize = m_WParser->GetFontSize(); int sz = (tag.GetName() == wxT("BIG")) ? +1 : -1; - m_WParser -> SetFontSize(sz); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetFontSize(sz); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); ParseInner(tag); - m_WParser -> SetFontSize(oldsize); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetFontSize(oldsize); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); return TRUE; } diff --git a/src/html/m_hline.cpp b/src/html/m_hline.cpp index ba68587175..3eee42e318 100644 --- a/src/html/m_hline.cpp +++ b/src/html/m_hline.cpp @@ -43,7 +43,7 @@ class wxHtmlLineCell : public wxHtmlCell public: wxHtmlLineCell(int size) : wxHtmlCell() {m_Height = size;} void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2); - void Layout(int w) {m_Width = w; if (m_Next) m_Next -> Layout(w);} + void Layout(int w) {m_Width = w; if (m_Next) m_Next->Layout(w);} }; @@ -72,19 +72,19 @@ TAG_HANDLER_BEGIN(HR, "HR") wxHtmlContainerCell *c; int sz; - m_WParser -> CloseContainer(); - c = m_WParser -> OpenContainer(); + m_WParser->CloseContainer(); + c = m_WParser->OpenContainer(); - c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_VERTICAL); - c -> SetAlignHor(wxHTML_ALIGN_CENTER); - c -> SetAlign(tag); - c -> SetWidthFloat(tag); + c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_VERTICAL); + c->SetAlignHor(wxHTML_ALIGN_CENTER); + c->SetAlign(tag); + c->SetWidthFloat(tag); sz = 1; if (tag.HasParam(wxT("SIZE")) && tag.ScanParam(wxT("SIZE"), wxT("%i"), &sz) == 1) {} - c -> InsertCell(new wxHtmlLineCell((int)((double)sz * m_WParser -> GetPixelScale()))); + c->InsertCell(new wxHtmlLineCell((int)((double)sz * m_WParser->GetPixelScale()))); - m_WParser -> CloseContainer(); - m_WParser -> OpenContainer(); + m_WParser->CloseContainer(); + m_WParser->OpenContainer(); return FALSE; } diff --git a/src/html/m_image.cpp b/src/html/m_image.cpp index 09396542cb..4534d61719 100644 --- a/src/html/m_image.cpp +++ b/src/html/m_image.cpp @@ -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; } @@ -266,28 +292,32 @@ wxHtmlImageCell::wxHtmlImageCell(wxFSFile *input, int w, int h, double scale, in { wxImage *img; int ww, hh; - wxInputStream *s = input -> GetStream(); + wxInputStream *s = input->GetStream(); img = new wxImage(*s, wxBITMAP_TYPE_ANY); m_Image = NULL; - if (img && (img -> Ok())) { - ww = img -> GetWidth(); - hh = img -> GetHeight(); + if (img && (img->Ok())) + { + ww = img->GetWidth(); + hh = img->GetHeight(); if (w != -1) m_Width = w; else m_Width = ww; if (h != -1) m_Height = h; else m_Height = hh; m_Width = (int)(scale * (double)m_Width); m_Height = (int)(scale * (double)m_Height); - if ((m_Width != ww) || (m_Height != hh)) { - wxImage img2 = img -> Scale(m_Width, m_Height); + if ((m_Width != ww) || (m_Height != hh)) + { + wxImage img2 = img->Scale(m_Width, m_Height); m_Image = new wxBitmap(img2.ConvertToBitmap()); - } else - m_Image = new wxBitmap(img -> ConvertToBitmap()); + } + else + m_Image = new wxBitmap(img->ConvertToBitmap()); delete img; } - switch (align) { + switch (align) + { case wxHTML_ALIGN_TOP : m_Descent = m_Height; break; @@ -319,20 +349,23 @@ 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 ); } - { // dirty hack, ask Joel why he fills m_ImageMap in this place + { // dirty hack, ask Joel why he fills m_ImageMap in this place // THE problem is that we're in const method and we can't modify m_ImageMap wxHtmlImageMapCell **cx = (wxHtmlImageMapCell**)(&m_ImageMap); *cx = (wxHtmlImageMapCell*)cell; @@ -351,43 +384,51 @@ 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; wxString tmp = tag.GetParam(wxT("SRC")); wxString mn = wxEmptyString; - str = m_WParser -> GetFS() -> OpenFile(tmp); + str = m_WParser->GetFS()->OpenFile(tmp); 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) { - cel = new wxHtmlImageCell(str, w, h, m_WParser -> GetPixelScale(), al, mn); - cel -> SetLink(m_WParser -> GetLink()); - m_WParser -> GetContainer() -> InsertCell(cel); + if (str) + { + cel = new wxHtmlImageCell(str, w, h, m_WParser->GetPixelScale(), al, mn); + cel->SetLink(m_WParser->GetLink()); + m_WParser->GetContainer()->InsertCell(cel); delete str; } } } - 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")) { - cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::POLY, coords, m_WParser -> GetPixelScale() ); - } else if (tmp == wxT("CIRCLE")) { - cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::CIRCLE, coords, m_WParser -> GetPixelScale() ); - } else if (tmp == wxT("RECT")) { - cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::RECT, coords, m_WParser -> GetPixelScale() ); + if (tmp == wxT("POLY")) + { + cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::POLY, coords, m_WParser->GetPixelScale() ); + } + else if (tmp == wxT("CIRCLE")) + { + cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::CIRCLE, coords, m_WParser->GetPixelScale() ); + } + 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")); diff --git a/src/html/m_layout.cpp b/src/html/m_layout.cpp index 08157beaba..c026d8cabb 100644 --- a/src/html/m_layout.cpp +++ b/src/html/m_layout.cpp @@ -36,12 +36,13 @@ TAG_HANDLER_BEGIN(P, "P") TAG_HANDLER_PROC(tag) { - if (m_WParser -> GetContainer() -> GetFirstCell() != NULL) { - m_WParser -> CloseContainer(); - m_WParser -> OpenContainer(); + if (m_WParser->GetContainer()->GetFirstCell() != NULL) + { + m_WParser->CloseContainer(); + m_WParser->OpenContainer(); } - m_WParser -> GetContainer() -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_TOP); - m_WParser -> GetContainer() -> SetAlign(tag); + m_WParser->GetContainer()->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP); + m_WParser->GetContainer()->SetAlign(tag); return FALSE; } @@ -53,14 +54,14 @@ TAG_HANDLER_BEGIN(BR, "BR") TAG_HANDLER_PROC(tag) { - int al = m_WParser -> GetContainer() -> GetAlignHor(); + int al = m_WParser->GetContainer()->GetAlignHor(); wxHtmlContainerCell *c; - m_WParser -> CloseContainer(); - c = m_WParser -> OpenContainer(); - c -> SetAlignHor(al); - c -> SetAlign(tag); - c -> SetMinHeight(m_WParser -> GetCharHeight()); + m_WParser->CloseContainer(); + c = m_WParser->OpenContainer(); + c->SetAlignHor(al); + c->SetAlign(tag); + c->SetMinHeight(m_WParser->GetCharHeight()); return FALSE; } @@ -72,27 +73,30 @@ TAG_HANDLER_BEGIN(CENTER, "CENTER") TAG_HANDLER_PROC(tag) { - int old = m_WParser -> GetAlign(); - wxHtmlContainerCell *c = m_WParser -> GetContainer(); - - m_WParser -> SetAlign(wxHTML_ALIGN_CENTER); - if (c -> GetFirstCell() != NULL) { - m_WParser -> CloseContainer(); - m_WParser -> OpenContainer(); + int old = m_WParser->GetAlign(); + wxHtmlContainerCell *c = m_WParser->GetContainer(); + + m_WParser->SetAlign(wxHTML_ALIGN_CENTER); + if (c->GetFirstCell() != NULL) + { + m_WParser->CloseContainer(); + m_WParser->OpenContainer(); } else - c -> SetAlignHor(wxHTML_ALIGN_CENTER); + c->SetAlignHor(wxHTML_ALIGN_CENTER); - if (tag.HasEnding()) { + if (tag.HasEnding()) + { ParseInner(tag); - m_WParser -> SetAlign(old); - if (c -> GetFirstCell() != NULL) { - m_WParser -> CloseContainer(); - m_WParser -> OpenContainer(); + m_WParser->SetAlign(old); + if (c->GetFirstCell() != NULL) + { + m_WParser->CloseContainer(); + m_WParser->OpenContainer(); } else - c -> SetAlignHor(old); + c->SetAlignHor(old); return TRUE; } @@ -107,29 +111,32 @@ TAG_HANDLER_BEGIN(DIV, "DIV") TAG_HANDLER_PROC(tag) { - int old = m_WParser -> GetAlign(); - wxHtmlContainerCell *c = m_WParser -> GetContainer(); - if (c -> GetFirstCell() != NULL) { - m_WParser -> CloseContainer(); - m_WParser -> OpenContainer(); - c = m_WParser -> GetContainer(); - c -> SetAlign(tag); - m_WParser -> SetAlign(c -> GetAlignHor()); + int old = m_WParser->GetAlign(); + wxHtmlContainerCell *c = m_WParser->GetContainer(); + if (c->GetFirstCell() != NULL) + { + m_WParser->CloseContainer(); + m_WParser->OpenContainer(); + c = m_WParser->GetContainer(); + c->SetAlign(tag); + m_WParser->SetAlign(c->GetAlignHor()); } - else { - c -> SetAlign(tag); - m_WParser -> SetAlign(c -> GetAlignHor()); + else + { + c->SetAlign(tag); + m_WParser->SetAlign(c->GetAlignHor()); } ParseInner(tag); - m_WParser -> SetAlign(old); - if (c -> GetFirstCell() != NULL) { - m_WParser -> CloseContainer(); - m_WParser -> OpenContainer(); + m_WParser->SetAlign(old); + if (c->GetFirstCell() != NULL) + { + m_WParser->CloseContainer(); + m_WParser->OpenContainer(); } else - c -> SetAlignHor(old); + c->SetAlignHor(old); return TRUE; } @@ -143,14 +150,16 @@ TAG_HANDLER_BEGIN(TITLE, "TITLE") TAG_HANDLER_PROC(tag) { - if (m_WParser -> GetWindow()) { - wxHtmlWindow *wfr = (wxHtmlWindow*)(m_WParser -> GetWindow()); - if (wfr) { + if (m_WParser->GetWindow()) + { + wxHtmlWindow *wfr = (wxHtmlWindow*)(m_WParser->GetWindow()); + if (wfr) + { wxString title = ""; - wxString *src = m_WParser -> GetSource(); + wxString *src = m_WParser->GetSource(); for (int i = tag.GetBeginPos(); i < tag.GetEndPos1(); i++) title += (*src)[(unsigned int) i]; - wfr -> OnSetTitle(title); + wfr->OnSetTitle(title); } } return TRUE; @@ -168,28 +177,34 @@ 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)); + 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); - } + 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) - m_WParser -> GetWindow() -> SetBackgroundColour(clr); - } + m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr, wxHTML_CLR_BACKGROUND)); + if (m_WParser->GetWindow() != NULL) + m_WParser->GetWindow()->SetBackgroundColour(clr); + } } return FALSE; } @@ -204,19 +219,21 @@ TAG_HANDLER_BEGIN(BLOCKQUOTE, "BLOCKQUOTE") { wxHtmlContainerCell *c; - m_WParser -> CloseContainer(); - c = m_WParser -> OpenContainer(); - if (c -> GetAlignHor() == wxHTML_ALIGN_RIGHT) - c -> SetIndent(5 * m_WParser -> GetCharWidth(), wxHTML_INDENT_RIGHT); + 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(); + c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_LEFT); + + c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP); + m_WParser->OpenContainer(); ParseInner(tag); - c = m_WParser -> CloseContainer(); - c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_BOTTOM); - m_WParser -> CloseContainer(); - m_WParser -> OpenContainer(); + c = m_WParser->CloseContainer(); + c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_BOTTOM); + m_WParser->CloseContainer(); + m_WParser->OpenContainer(); return TRUE; } diff --git a/src/html/m_links.cpp b/src/html/m_links.cpp index e21c9e2f69..4ac7d3251c 100644 --- a/src/html/m_links.cpp +++ b/src/html/m_links.cpp @@ -54,30 +54,32 @@ TAG_HANDLER_BEGIN(A, "A") TAG_HANDLER_PROC(tag) { - if (tag.HasParam("NAME")) { - m_WParser -> GetContainer() -> InsertCell(new wxHtmlAnchorCell(tag.GetParam("NAME"))); + if (tag.HasParam("NAME")) + { + m_WParser->GetContainer()->InsertCell(new wxHtmlAnchorCell(tag.GetParam("NAME"))); } - if (tag.HasParam("HREF")) { - wxHtmlLinkInfo oldlnk = m_WParser -> GetLink(); - wxColour oldclr = m_WParser -> GetActualColor(); - int oldund = m_WParser -> GetFontUnderlined(); + if (tag.HasParam("HREF")) + { + wxHtmlLinkInfo oldlnk = m_WParser->GetLink(); + wxColour oldclr = m_WParser->GetActualColor(); + int oldund = m_WParser->GetFontUnderlined(); wxString name(tag.GetParam("HREF")), target; if (tag.HasParam("TARGET")) target = tag.GetParam("TARGET"); - m_WParser -> SetActualColor(m_WParser -> GetLinkColor()); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(m_WParser -> GetLinkColor())); - m_WParser -> SetFontUnderlined(TRUE); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); - m_WParser -> SetLink(wxHtmlLinkInfo(name, target)); + m_WParser->SetActualColor(m_WParser->GetLinkColor()); + m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(m_WParser->GetLinkColor())); + m_WParser->SetFontUnderlined(TRUE); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); + m_WParser->SetLink(wxHtmlLinkInfo(name, target)); ParseInner(tag); - m_WParser -> SetLink(oldlnk); - m_WParser -> SetFontUnderlined(oldund); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); - m_WParser -> SetActualColor(oldclr); - m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(oldclr)); + m_WParser->SetLink(oldlnk); + m_WParser->SetFontUnderlined(oldund); + m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); + m_WParser->SetActualColor(oldclr); + m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(oldclr)); return TRUE; } diff --git a/src/html/m_meta.cpp b/src/html/m_meta.cpp index bcb95e5840..50c100bc87 100644 --- a/src/html/m_meta.cpp +++ b/src/html/m_meta.cpp @@ -47,13 +47,13 @@ TAG_HANDLER_BEGIN(META, "META") if (content.Left(19) == _T("text/html; charset=")) { wxFontEncoding enc = - wxTheFontMapper -> CharsetToEncoding(content.Mid(19)); + wxTheFontMapper->CharsetToEncoding(content.Mid(19)); if (enc == wxFONTENCODING_SYSTEM) return FALSE; - if (enc == m_WParser -> GetInputEncoding()) return FALSE; + if (enc == m_WParser->GetInputEncoding()) return FALSE; - m_WParser -> SetInputEncoding(enc); - m_WParser -> GetContainer() -> InsertCell( - new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetInputEncoding(enc); + m_WParser->GetContainer()->InsertCell( + new wxHtmlFontCell(m_WParser->CreateCurrentFont())); } } return FALSE; diff --git a/src/html/m_pre.cpp b/src/html/m_pre.cpp index df51c4246a..2cf0d2142c 100644 --- a/src/html/m_pre.cpp +++ b/src/html/m_pre.cpp @@ -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("©"), wxT("(c)"), TRUE); @@ -119,46 +120,46 @@ TAG_HANDLER_BEGIN(PRE, "PRE") { wxHtmlContainerCell *c; - int fixed = m_WParser -> GetFontFixed(), - italic = m_WParser -> GetFontItalic(), - underlined = m_WParser -> GetFontUnderlined(), - bold = m_WParser -> GetFontBold(), - fsize = m_WParser -> GetFontSize(); + int fixed = m_WParser->GetFontFixed(), + italic = m_WParser->GetFontItalic(), + underlined = m_WParser->GetFontUnderlined(), + bold = m_WParser->GetFontBold(), + fsize = m_WParser->GetFontSize(); - m_WParser -> CloseContainer(); - c = m_WParser -> OpenContainer(); - c -> SetAlignHor(wxHTML_ALIGN_LEFT); - c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_VERTICAL); + m_WParser->CloseContainer(); + c = m_WParser->OpenContainer(); + c->SetAlignHor(wxHTML_ALIGN_LEFT); + c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_VERTICAL); - m_WParser -> SetFontUnderlined(FALSE); - m_WParser -> SetFontBold(FALSE); - m_WParser -> SetFontItalic(FALSE); - m_WParser -> SetFontFixed(TRUE); - m_WParser -> SetFontSize(3); - c -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetFontUnderlined(FALSE); + m_WParser->SetFontBold(FALSE); + m_WParser->SetFontItalic(FALSE); + m_WParser->SetFontFixed(TRUE); + m_WParser->SetFontSize(3); + c->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); { wxString cit; - wxEncodingConverter *encconv = m_WParser -> GetEncodingConverter(); - cit = m_WParser -> GetSource() -> Mid(tag.GetBeginPos(), + wxEncodingConverter *encconv = m_WParser->GetEncodingConverter(); + cit = m_WParser->GetSource()->Mid(tag.GetBeginPos(), tag.GetEndPos1() - tag.GetBeginPos()); if (encconv) - c -> InsertCell(new wxHtmlPRECell(encconv -> Convert(cit), - *(m_WParser -> GetDC()))); + c->InsertCell(new wxHtmlPRECell(encconv->Convert(cit), + *(m_WParser->GetDC()))); else - c -> InsertCell(new wxHtmlPRECell(cit, - *(m_WParser -> GetDC()))); + c->InsertCell(new wxHtmlPRECell(cit, + *(m_WParser->GetDC()))); } - m_WParser -> SetFontUnderlined(underlined); - m_WParser -> SetFontBold(bold); - m_WParser -> SetFontItalic(italic); - m_WParser -> SetFontFixed(fixed); - m_WParser -> SetFontSize(fsize); - c -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetFontUnderlined(underlined); + m_WParser->SetFontBold(bold); + m_WParser->SetFontItalic(italic); + m_WParser->SetFontFixed(fixed); + m_WParser->SetFontSize(fsize); + c->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); - m_WParser -> CloseContainer(); - m_WParser -> OpenContainer(); + m_WParser->CloseContainer(); + m_WParser->OpenContainer(); return TRUE; } diff --git a/src/html/m_tables.cpp b/src/html/m_tables.cpp index a651ba407d..0483871602 100644 --- a/src/html/m_tables.cpp +++ b/src/html/m_tables.cpp @@ -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,13 +270,14 @@ 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); + cell->SetBackgroundColour(clr); } } if (m_HasBorders) - cell -> SetBorder(TABLE_BORDER_CLR_2, TABLE_BORDER_CLR_1); + cell->SetBorder(TABLE_BORDER_CLR_2, TABLE_BORDER_CLR_1); // vertical alignment: { @@ -279,7 +289,7 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag) else m_CellInfo[r][c].valign = wxHTML_ALIGN_CENTER; } - cell -> SetIndent(m_Padding, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS); + cell->SetIndent(m_Padding, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS); } @@ -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: @@ -367,32 +381,34 @@ void wxHtmlTableCell::Layout(int w) for (int i = actcol; i < m_CellInfo[actrow][actcol].colspan + actcol; i++) fullwid += m_ColsInfo[i].pixwidth; fullwid += (m_CellInfo[actrow][actcol].colspan - 1) * m_Spacing; - actcell -> SetMinHeight(m_CellInfo[actrow][actcol].minheight, m_CellInfo[actrow][actcol].valign); - actcell -> Layout(fullwid); + actcell->SetMinHeight(m_CellInfo[actrow][actcol].minheight, m_CellInfo[actrow][actcol].valign); + actcell->Layout(fullwid); - if (ypos[actrow] + actcell -> GetHeight() + m_CellInfo[actrow][actcol].rowspan * m_Spacing > ypos[actrow + m_CellInfo[actrow][actcol].rowspan]) + if (ypos[actrow] + actcell->GetHeight() + m_CellInfo[actrow][actcol].rowspan * m_Spacing > ypos[actrow + m_CellInfo[actrow][actcol].rowspan]) ypos[actrow + m_CellInfo[actrow][actcol].rowspan] = - ypos[actrow] + actcell -> GetHeight() + m_CellInfo[actrow][actcol].rowspan * m_Spacing; + ypos[actrow] + actcell->GetHeight() + m_CellInfo[actrow][actcol].rowspan * m_Spacing; } } - 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( + actcell->SetMinHeight( ypos[actrow + m_CellInfo[actrow][actcol].rowspan] - ypos[actrow] - m_Spacing, m_CellInfo[actrow][actcol].valign); fullwid = 0; for (int i = actcol; i < m_CellInfo[actrow][actcol].colspan + actcol; i++) fullwid += m_ColsInfo[i].pixwidth; fullwid += (m_CellInfo[actrow][actcol].colspan - 1) * m_Spacing; - actcell -> Layout(fullwid); - actcell -> SetPos(m_ColsInfo[actcol].leftpos, ypos[actrow]); + actcell->Layout(fullwid); + actcell->SetPos(m_ColsInfo[actcol].leftpos, ypos[actrow]); } } @@ -431,47 +447,52 @@ 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; - oldcont = c = m_WParser -> OpenContainer(); + oldcont = c = m_WParser->OpenContainer(); - c -> SetWidthFloat(tag, m_WParser -> GetPixelScale()); - m_Table = new wxHtmlTableCell(c, tag, m_WParser -> GetPixelScale()); - m_OldAlign = m_WParser -> GetAlign(); + c->SetWidthFloat(tag, m_WParser->GetPixelScale()); + m_Table = new wxHtmlTableCell(c, tag, m_WParser->GetPixelScale()); + m_OldAlign = m_WParser->GetAlign(); m_tAlign = wxEmptyString; if (tag.HasParam(wxT("ALIGN"))) m_tAlign = tag.GetParam(wxT("ALIGN")); ParseInner(tag); - m_WParser -> SetAlign(m_OldAlign); - m_WParser -> SetContainer(oldcont); - m_WParser -> CloseContainer(); + m_WParser->SetAlign(m_OldAlign); + m_WParser->SetContainer(oldcont); + m_WParser->CloseContainer(); m_Table = oldt; return TRUE; } - else if (m_Table && !tag.IsEnding()) { + else if (m_Table && !tag.IsEnding()) + { // new row in table - if (tag.GetName() == wxT("TR")) { - m_Table -> AddRow(tag); + 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 { - m_WParser -> SetAlign(m_OldAlign); - c = m_WParser -> SetContainer(new wxHtmlContainerCell(m_Table)); - m_Table -> AddCell(c, tag); + else + { + m_WParser->SetAlign(m_OldAlign); + c = m_WParser->SetContainer(new wxHtmlContainerCell(m_Table)); + m_Table->AddCell(c, tag); - m_WParser -> OpenContainer(); + m_WParser->OpenContainer(); - if (tag.GetName() == wxT("TH")) /*header style*/ { - m_WParser -> SetAlign(wxHTML_ALIGN_CENTER); + if (tag.GetName() == wxT("TH")) /*header style*/ + { + m_WParser->SetAlign(wxHTML_ALIGN_CENTER); } { @@ -480,10 +501,10 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH") als = m_rAlign; if (tag.HasParam(wxT("ALIGN"))) als = tag.GetParam(wxT("ALIGN")); als.MakeUpper(); - if (als == wxT("RIGHT")) m_WParser -> SetAlign(wxHTML_ALIGN_RIGHT); - else if (als == wxT("CENTER")) m_WParser -> SetAlign(wxHTML_ALIGN_CENTER); + if (als == wxT("RIGHT")) m_WParser->SetAlign(wxHTML_ALIGN_RIGHT); + else if (als == wxT("CENTER")) m_WParser->SetAlign(wxHTML_ALIGN_CENTER); } - m_WParser -> OpenContainer(); + m_WParser->OpenContainer(); } } return FALSE; diff --git a/src/html/winpars.cpp b/src/html/winpars.cpp index ca7afc5fd5..b5f8b1ec68 100644 --- a/src/html/winpars.cpp +++ b/src/html/winpars.cpp @@ -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,10 +73,11 @@ wxHtmlWinParser::wxHtmlWinParser(wxWindow *wnd) : wxHtmlParser() // fill in wxHtmlParser's tables: wxNode *node = m_Modules.GetFirst(); - while (node) { - wxHtmlTagsModule *mod = (wxHtmlTagsModule*) node -> GetData(); - mod -> FillHandlersTable(this); - node = node -> GetNext(); + 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; } @@ -142,7 +146,7 @@ void wxHtmlWinParser::InitParser(const wxString& source) m_FontBold = m_FontItalic = m_FontUnderlined = m_FontFixed = FALSE; m_FontSize = 3; //default one CreateCurrentFont(); // we're selecting default font into - m_DC -> GetTextExtent("H", &m_CharWidth, &m_CharHeight); + m_DC->GetTextExtent("H", &m_CharWidth, &m_CharHeight); /* NOTE : we're not using GetCharWidth/Height() because of differences under X and win */ @@ -157,8 +161,8 @@ void wxHtmlWinParser::InitParser(const wxString& source) OpenContainer(); OpenContainer(); - m_Container -> InsertCell(new wxHtmlColourCell(m_ActualColor)); - m_Container -> InsertCell(new wxHtmlFontCell(CreateCurrentFont())); + m_Container->InsertCell(new wxHtmlColourCell(m_ActualColor)); + m_Container->InsertCell(new wxHtmlFontCell(CreateCurrentFont())); } @@ -180,7 +184,7 @@ wxObject* wxHtmlWinParser::GetProduct() OpenContainer(); top = m_Container; - while (top -> GetParent()) top = top -> GetParent(); + while (top->GetParent()) top = top->GetParent(); return top; } @@ -194,36 +198,41 @@ 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; - if (m_EncConv) m_EncConv -> Convert(temp); + if (m_EncConv) m_EncConv->Convert(temp); c = new wxHtmlWordCell(temp, *(GetDC())); - if (m_UseLink) c -> SetLink(m_Link); - m_Container -> InsertCell(c); + if (m_UseLink) c->SetLink(m_Link); + m_Container->InsertCell(c); m_tmpLastWasSpace = TRUE; } } - if (templen) { + if (templen) + { temp[templen] = 0; - if (m_EncConv) m_EncConv -> Convert(temp); + if (m_EncConv) m_EncConv->Convert(temp); c = new wxHtmlWordCell(temp, *(GetDC())); - if (m_UseLink) c -> SetLink(m_Link); - m_Container -> InsertCell(c); + if (m_UseLink) c->SetLink(m_Link); + m_Container->InsertCell(c); m_tmpLastWasSpace = FALSE; } } @@ -233,7 +242,7 @@ void wxHtmlWinParser::AddText(const char* txt) wxHtmlContainerCell* wxHtmlWinParser::OpenContainer() { m_Container = new wxHtmlContainerCell(m_Container); - m_Container -> SetAlignHor(m_Align); + m_Container->SetAlignHor(m_Align); m_tmpLastWasSpace = TRUE; /* to avoid space being first character in paragraph */ return m_Container; @@ -252,7 +261,7 @@ wxHtmlContainerCell* wxHtmlWinParser::SetContainer(wxHtmlContainerCell *c) wxHtmlContainerCell* wxHtmlWinParser::CloseContainer() { - m_Container = m_Container -> GetParent(); + m_Container = m_Container->GetParent(); return m_Container; } @@ -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( @@ -295,7 +306,7 @@ wxFont* wxHtmlWinParser::CreateCurrentFont() fu ? TRUE : FALSE, face, m_OutputEnc); } - m_DC -> SetFont(**fontptr); + m_DC->SetFont(**fontptr); return (*fontptr); } @@ -330,21 +341,21 @@ void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc) bool availfix, availnorm; // exact match? - availnorm = wxTheFontMapper -> IsEncodingAvailable(enc, m_FontFaceNormal); - availfix = wxTheFontMapper -> IsEncodingAvailable(enc, m_FontFaceFixed); + availnorm = wxTheFontMapper->IsEncodingAvailable(enc, m_FontFaceNormal); + availfix = wxTheFontMapper->IsEncodingAvailable(enc, m_FontFaceFixed); if (availnorm && availfix) m_OutputEnc = enc; // alternatives? - else if (wxTheFontMapper -> GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, FALSE) && - wxTheFontMapper -> GetAltForEncoding(enc, &altfix, m_FontFaceFixed, FALSE) && + else if (wxTheFontMapper->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, FALSE) && + wxTheFontMapper->GetAltForEncoding(enc, &altfix, m_FontFaceFixed, FALSE) && altnorm == altfix) m_OutputEnc = altnorm; // at least normal face? else if (availnorm) m_OutputEnc = enc; - else if (wxTheFontMapper -> GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, FALSE)) + else if (wxTheFontMapper->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, FALSE)) m_OutputEnc = altnorm; // okay, let convert to ISO_8859-1, available always @@ -356,7 +367,7 @@ void wxHtmlWinParser::SetInputEncoding(wxFontEncoding enc) if (m_InputEnc == m_OutputEnc) return; m_EncConv = new wxEncodingConverter(); - if (!m_EncConv -> Init(m_InputEnc, + if (!m_EncConv->Init(m_InputEnc, (m_OutputEnc == wxFONTENCODING_DEFAULT) ? wxFONTENCODING_ISO8859_1 : m_OutputEnc, wxCONVERT_SUBSTITUTE))