From 04dbb6467be8f564f380bd9a1106fbdecbd26a98 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 5 Jul 2001 18:48:48 +0000 Subject: [PATCH] removed/replaced include 'wx/wx.h' git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10850 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/fs_inet.h | 7 +- include/wx/fs_mem.h | 21 ++-- include/wx/fs_zip.h | 9 +- include/wx/generic/filedlgg.h | 97 ++---------------- include/wx/generic/helpxlp.h | 3 +- include/wx/generic/laywin.h | 5 +- include/wx/html/htmltag.h | 8 +- include/wx/html/m_templ.h | 21 +--- src/common/fs_inet.cpp | 7 +- src/common/fs_mem.cpp | 21 ++-- src/common/fs_zip.cpp | 3 +- src/common/tbarbase.cpp | 1 - src/generic/dcpsg.cpp | 2 - src/generic/filedlgg.cpp | 88 ++++++++++++++++ src/generic/laywin.cpp | 8 +- src/generic/prntdlgg.cpp | 2 - src/generic/prop.cpp | 1 - src/generic/propform.cpp | 1 - src/generic/sashwin.cpp | 5 +- src/generic/splash.cpp | 3 +- src/html/helpdata.cpp | 185 ++++++++++++++++----------------- src/html/htmlcell.cpp | 132 ++++++++++++------------ src/html/htmlfilt.cpp | 7 +- src/html/htmlfilter.cpp | 1 - src/html/htmlhelp.cpp | 2 - src/html/htmlpars.cpp | 41 ++++---- src/html/htmltag.cpp | 1 - src/html/htmlwin.cpp | 9 +- src/html/htmprint.cpp | 105 +++++++++---------- src/html/m_dflist.cpp | 28 +++-- src/html/m_fonts.cpp | 31 +++--- src/html/m_hline.cpp | 6 +- src/html/m_image.cpp | 187 +++++++++++++++++----------------- src/html/m_layout.cpp | 27 +++-- src/html/m_links.cpp | 8 +- src/html/m_list.cpp | 24 ++--- src/html/m_meta.cpp | 5 +- src/html/m_pre.cpp | 6 +- src/html/m_tables.cpp | 89 ++++++++-------- src/html/search.cpp | 2 - src/html/winpars.cpp | 3 +- 41 files changed, 587 insertions(+), 625 deletions(-) diff --git a/include/wx/fs_inet.h b/include/wx/fs_inet.h index 3480e98cce..4f4205ccc1 100644 --- a/include/wx/fs_inet.h +++ b/include/wx/fs_inet.h @@ -8,7 +8,7 @@ /* -REMARKS : +REMARKS : This FS creates local cache (in /tmp directory). The cache is freed on program exit. @@ -31,13 +31,8 @@ limitation) #if wxUSE_FILESYSTEM && wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS -#ifndef WXPRECOMP -#include "wx/wx.h" -#endif - #include "wx/filesys.h" - //-------------------------------------------------------------------------------- // wxInternetFSHandler //-------------------------------------------------------------------------------- diff --git a/include/wx/fs_mem.h b/include/wx/fs_mem.h index 7195025136..96946d350f 100644 --- a/include/wx/fs_mem.h +++ b/include/wx/fs_mem.h @@ -19,14 +19,11 @@ #if wxUSE_FILESYSTEM -#ifndef WXPRECOMP -#include "wx/wx.h" -#endif - #include "wx/filesys.h" + #if wxUSE_GUI -#include "wx/image.h" -#include "wx/bitmap.h" + #include "wx/image.h" + #include "wx/bitmap.h" #endif //-------------------------------------------------------------------------------- @@ -45,24 +42,24 @@ class WXDLLEXPORT wxMemoryFSHandler : public wxFileSystemHandler static void AddFile(const wxString& filename, wxImage& image, long type); static void AddFile(const wxString& filename, const wxBitmap& bitmap, long type); #endif - static void AddFile(const wxString& filename, const wxString& textdata); + static void AddFile(const wxString& filename, const wxString& textdata); static void AddFile(const wxString& filename, const void *binarydata, size_t size); - + // Remove file from memory FS and free occupied memory static void RemoveFile(const wxString& filename); - + virtual bool CanOpen(const wxString& location); virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location); virtual wxString FindFirst(const wxString& spec, int flags = 0); virtual wxString FindNext(); - + private: static wxHashTable *m_Hash; - + static bool CheckHash(const wxString& filename); }; -#endif +#endif // wxUSE_FILESYSTEM diff --git a/include/wx/fs_zip.h b/include/wx/fs_zip.h index 27ccee6f1a..fa1ddab430 100644 --- a/include/wx/fs_zip.h +++ b/include/wx/fs_zip.h @@ -20,11 +20,6 @@ #if wxUSE_FILESYSTEM && wxUSE_FS_ZIP && wxUSE_STREAMS - -#ifndef WXPRECOMP -#include "wx/wx.h" -#endif - #include "wx/filesys.h" class WXDLLEXPORT wxHashTableLong; @@ -42,14 +37,14 @@ class WXDLLEXPORT wxZipFSHandler : public wxFileSystemHandler virtual wxString FindFirst(const wxString& spec, int flags = 0); virtual wxString FindNext(); ~wxZipFSHandler(); - + private: // these vars are used by FindFirst/Next: void *m_Archive; wxString m_Pattern, m_BaseDir, m_ZipFile; bool m_AllowDirs, m_AllowFiles; wxHashTableLong *m_DirsFound; - + wxString DoFind(); }; diff --git a/include/wx/generic/filedlgg.h b/include/wx/generic/filedlgg.h index 9d39b679f9..80aa37e41b 100644 --- a/include/wx/generic/filedlgg.h +++ b/include/wx/generic/filedlgg.h @@ -16,15 +16,7 @@ #pragma interface "filedlgg.h" #endif -#include "wx/defs.h" - #include "wx/dialog.h" -#include "wx/checkbox.h" -#include "wx/listctrl.h" -#include "wx/textctrl.h" -#include "wx/choice.h" -#include "wx/checkbox.h" -#include "wx/stattext.h" //----------------------------------------------------------------------------- // data @@ -37,91 +29,14 @@ WXDLLEXPORT_DATA(extern const wxChar *)wxFileSelectorDefaultWildcardStr; // classes //----------------------------------------------------------------------------- +class wxCheckBox; +class wxChoice; class wxFileData; class wxFileCtrl; class wxFileDialog; - -//----------------------------------------------------------------------------- -// wxFileData -//----------------------------------------------------------------------------- - -class wxFileData : public wxObject -{ -private: - wxString m_name; - wxString m_fileName; - long m_size; - int m_hour; - int m_minute; - int m_year; - int m_month; - int m_day; - wxString m_permissions; - bool m_isDir; - bool m_isLink; - bool m_isExe; - -public: - wxFileData() { } - wxFileData( const wxString &name, const wxString &fname ); - wxString GetName() const; - wxString GetFullName() const; - wxString GetHint() const; - wxString GetEntry( int num ); - bool IsDir(); - bool IsLink(); - bool IsExe(); - long GetSize(); - void MakeItem( wxListItem &item ); - void SetNewName( const wxString &name, const wxString &fname ); - -private: - DECLARE_DYNAMIC_CLASS(wxFileData); -}; - -//----------------------------------------------------------------------------- -// wxFileCtrl -//----------------------------------------------------------------------------- - -class wxFileCtrl : public wxListCtrl -{ -private: - wxString m_dirName; - bool m_showHidden; - wxString m_wild; - -public: - wxFileCtrl(); - wxFileCtrl( wxWindow *win, - wxWindowID id, - const wxString &dirName, - const wxString &wild, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxLC_LIST, - const wxValidator &validator = wxDefaultValidator, - const wxString &name = wxT("filelist") ); - void ChangeToListMode(); - void ChangeToReportMode(); - void ChangeToIconMode(); - void ShowHidden( bool show = TRUE ); - long Add( wxFileData *fd, wxListItem &item ); - void Update(); - virtual void StatusbarText( wxChar *WXUNUSED(text) ) {}; - void MakeDir(); - void GoToParentDir(); - void GoToHomeDir(); - void GoToDir( const wxString &dir ); - void SetWild( const wxString &wild ); - void GetDir( wxString &dir ); - void OnListDeleteItem( wxListEvent &event ); - void OnListDeleteAllItems( wxListEvent &event ); - void OnListEndLabelEdit( wxListEvent &event ); - -private: - DECLARE_DYNAMIC_CLASS(wxFileCtrl); - DECLARE_EVENT_TABLE() -}; +class wxListEvent; +class wxStaticText; +class wxTextCtrl; //------------------------------------------------------------------------- // File selector @@ -139,7 +54,7 @@ public: const wxString& wildCard = wxFileSelectorDefaultWildcardStr, long style = 0, const wxPoint& pos = wxDefaultPosition); - ~wxFileDialog(); + virtual ~wxFileDialog(); void SetMessage(const wxString& message) { m_message = message; } void SetPath(const wxString& path); diff --git a/include/wx/generic/helpxlp.h b/include/wx/generic/helpxlp.h index 2452d92910..ee074e7f2b 100644 --- a/include/wx/generic/helpxlp.h +++ b/include/wx/generic/helpxlp.h @@ -16,8 +16,7 @@ #pragma interface "helpxlp.h" #endif -#include -#include "wx/wx.h" +#include "wx/defs.h" #if wxUSE_HELP diff --git a/include/wx/generic/laywin.h b/include/wx/generic/laywin.h index 81785a3d6d..7c241c701d 100644 --- a/include/wx/generic/laywin.h +++ b/include/wx/generic/laywin.h @@ -205,10 +205,7 @@ public: // mainWindow is sized to whatever's left over. This function for backward // compatibility; use LayoutWindow. - bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = (wxWindow*) NULL) - { - return LayoutWindow(frame, mainWindow); - } + bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = (wxWindow*) NULL); // mainWindow is sized to whatever's left over. bool LayoutWindow(wxWindow* frame, wxWindow* mainWindow = (wxWindow*) NULL); diff --git a/include/wx/html/htmltag.h b/include/wx/html/htmltag.h index b438039cd5..3d549e09cd 100644 --- a/include/wx/html/htmltag.h +++ b/include/wx/html/htmltag.h @@ -16,8 +16,12 @@ #endif #include "wx/defs.h" + #if wxUSE_HTML +#include "wx/object.h" + +class WXDLLEXPORT wxColour; class WXDLLEXPORT wxHtmlEntitiesParser; //----------------------------------------------------------------------------- @@ -60,7 +64,7 @@ public: // constructs wxHtmlTag object based on HTML tag. // The tag begins (with '<' character) at position pos in source // end_pos is position where parsing ends (usually end of document) - wxHtmlTag(const wxString& source, int pos, int end_pos, + wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCache *cache, wxHtmlEntitiesParser *entParser = NULL); @@ -79,7 +83,7 @@ public: // (or ("WhaT.jpg") if with_commas == TRUE) wxString GetParam(const wxString& par, bool with_commas = FALSE) const; - // Convenience functions: + // Convenience functions: bool GetParamAsColour(const wxString& par, wxColour *clr) const; bool GetParamAsInt(const wxString& par, int *clr) const; diff --git a/include/wx/html/m_templ.h b/include/wx/html/m_templ.h index 63d29000bb..9d9174772d 100644 --- a/include/wx/html/m_templ.h +++ b/include/wx/html/m_templ.h @@ -23,30 +23,11 @@ I STRONGLY recommend reading and understanding these macros!! #define _WX_M_TEMPL_H_ #include "wx/defs.h" -#if wxUSE_HTML - - -#ifdef __GNUG__ -#pragma interface "m_templ.h" -#pragma implementation -#endif - -#include - -#ifdef __BORDLANDC__ -#pragma hdrstop -#endif - -#ifndef WXPRECOMP -#include -#endif - - +#if wxUSE_HTML #include "wx/html/winpars.h" - #define TAG_HANDLER_BEGIN(name,tags) \ class HTML_Handler_##name : public wxHtmlWinTagHandler \ { \ diff --git a/src/common/fs_inet.cpp b/src/common/fs_inet.cpp index 31e26d60e9..cba29271dc 100644 --- a/src/common/fs_inet.cpp +++ b/src/common/fs_inet.cpp @@ -37,7 +37,6 @@ limitation) #if wxUSE_FILESYSTEM && wxUSE_FS_INET #ifndef WXPRECOMP -#include "wx/wx.h" #endif #include "wx/wfstream.h" @@ -74,7 +73,7 @@ static wxString StripProtocolAnchor(const wxString& location) else myloc = myloc.AfterFirst(wxT(':')); // fix malformed url: - if (myloc.Left(2) != wxT("//")) + if (myloc.Left(2) != wxT("//")) { if (myloc.GetChar(0) != wxT('/')) myloc = wxT("//") + myloc; else myloc = wxT("/") + myloc; @@ -89,7 +88,7 @@ static wxString StripProtocolAnchor(const wxString& location) bool wxInternetFSHandler::CanOpen(const wxString& location) { wxString p = GetProtocol(location); - if ((p == wxT("http")) || (p == wxT("ftp"))) + if ((p == wxT("http")) || (p == wxT("ftp"))) { wxURL url(p + wxT(":") + StripProtocolAnchor(location)); return (url.GetError() == wxURL_NOERR); @@ -112,7 +111,7 @@ wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs), const wxStri if (info == NULL) { wxURL url(right); - if (url.GetError() == wxURL_NOERR) + if (url.GetError() == wxURL_NOERR) { s = url.GetInputStream(); content = url.GetProtocol().GetContentType(); diff --git a/src/common/fs_mem.cpp b/src/common/fs_mem.cpp index 4f8f84d4eb..c3f05cc6f5 100644 --- a/src/common/fs_mem.cpp +++ b/src/common/fs_mem.cpp @@ -20,7 +20,8 @@ #if wxUSE_FILESYSTEM && wxUSE_STREAMS #ifndef WXPRECOMP -#include "wx/wx.h" + #include "wx/intl.h" + #include "wx/log.h" #endif #include "wx/filesys.h" @@ -30,7 +31,7 @@ class MemFSHashObj : public wxObject { public: - + MemFSHashObj(const void *data, size_t len) { m_Data = new char[len]; @@ -38,7 +39,7 @@ class MemFSHashObj : public wxObject m_Len = len; m_Time = wxDateTime::Now(); } - + MemFSHashObj(wxMemoryOutputStream& stream) { m_Len = stream.GetSize(); @@ -46,12 +47,12 @@ class MemFSHashObj : public wxObject stream.CopyTo(m_Data, m_Len); m_Time = wxDateTime::Now(); } - + ~MemFSHashObj() { delete[] m_Data; } - + char *m_Data; size_t m_Len; wxDateTime m_Time; @@ -78,8 +79,8 @@ wxMemoryFSHandler::~wxMemoryFSHandler() // as only one copy of FS handler is supposed to exist, we may silently // delete static data here. (There is no way how to remove FS handler from // wxFileSystem other than releasing _all_ handlers.) - - if (m_Hash) delete m_Hash; + + if (m_Hash) delete m_Hash; m_Hash = NULL; } @@ -131,12 +132,12 @@ wxString wxMemoryFSHandler::FindNext() bool wxMemoryFSHandler::CheckHash(const wxString& filename) { - if (m_Hash == NULL) + if (m_Hash == NULL) { m_Hash = new wxHashTable(wxKEY_STRING); m_Hash -> DeleteContents(TRUE); } - + if (m_Hash -> Get(filename) != NULL) { wxString s; @@ -156,7 +157,7 @@ bool wxMemoryFSHandler::CheckHash(const wxString& filename) { if (!CheckHash(filename)) return; - + wxMemoryOutputStream mems; if (image.Ok() && image.SaveFile(mems, (int)type)) m_Hash -> Put(filename, new MemFSHashObj(mems)); diff --git a/src/common/fs_zip.cpp b/src/common/fs_zip.cpp index 16da95be50..cbef9152dd 100644 --- a/src/common/fs_zip.cpp +++ b/src/common/fs_zip.cpp @@ -22,7 +22,8 @@ #if wxUSE_FILESYSTEM && wxUSE_FS_ZIP && wxUSE_ZIPSTREAM #ifndef WXPRECOMP -#include "wx/wx.h" + #include "wx/intl.h" + #include "wx/log.h" #endif #include "wx/hash.h" diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index 04b15b075d..dbce9ffff6 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -31,7 +31,6 @@ #if wxUSE_TOOLBAR #ifndef WX_PRECOMP - #include "wx/wx.h" #endif #include "wx/frame.h" diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index a6b2e0a168..c4b04b0656 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -21,8 +21,6 @@ #endif #ifndef WX_PRECOMP - #include "wx/setup.h" - #include "wx/defs.h" #endif // WX_PRECOMP #if wxUSE_PRINTING_ARCHITECTURE diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index 2d418f1064..838e152bbf 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -26,10 +26,16 @@ #error wxFileDialog currently only supports unix #endif +#include "wx/checkbox.h" +#include "wx/textctrl.h" +#include "wx/choice.h" +#include "wx/checkbox.h" +#include "wx/stattext.h" #include "wx/filedlg.h" #include "wx/debug.h" #include "wx/log.h" #include "wx/intl.h" +#include "wx/listctrl.h" #include "wx/msgdlg.h" #include "wx/sizer.h" #include "wx/bmpbuttn.h" @@ -63,6 +69,88 @@ #include "wx/generic/deffile.xpm" #include "wx/generic/exefile.xpm" +//----------------------------------------------------------------------------- +// wxFileData +//----------------------------------------------------------------------------- + +class wxFileData : public wxObject +{ +private: + wxString m_name; + wxString m_fileName; + long m_size; + int m_hour; + int m_minute; + int m_year; + int m_month; + int m_day; + wxString m_permissions; + bool m_isDir; + bool m_isLink; + bool m_isExe; + +public: + wxFileData() { } + wxFileData( const wxString &name, const wxString &fname ); + wxString GetName() const; + wxString GetFullName() const; + wxString GetHint() const; + wxString GetEntry( int num ); + bool IsDir(); + bool IsLink(); + bool IsExe(); + long GetSize(); + void MakeItem( wxListItem &item ); + void SetNewName( const wxString &name, const wxString &fname ); + +private: + DECLARE_DYNAMIC_CLASS(wxFileData); +}; + +//----------------------------------------------------------------------------- +// wxFileCtrl +//----------------------------------------------------------------------------- + +class wxFileCtrl : public wxListCtrl +{ +private: + wxString m_dirName; + bool m_showHidden; + wxString m_wild; + +public: + wxFileCtrl(); + wxFileCtrl( wxWindow *win, + wxWindowID id, + const wxString &dirName, + const wxString &wild, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLC_LIST, + const wxValidator &validator = wxDefaultValidator, + const wxString &name = wxT("filelist") ); + void ChangeToListMode(); + void ChangeToReportMode(); + void ChangeToIconMode(); + void ShowHidden( bool show = TRUE ); + long Add( wxFileData *fd, wxListItem &item ); + void Update(); + virtual void StatusbarText( wxChar *WXUNUSED(text) ) {}; + void MakeDir(); + void GoToParentDir(); + void GoToHomeDir(); + void GoToDir( const wxString &dir ); + void SetWild( const wxString &wild ); + void GetDir( wxString &dir ); + void OnListDeleteItem( wxListEvent &event ); + void OnListDeleteAllItems( wxListEvent &event ); + void OnListEndLabelEdit( wxListEvent &event ); + +private: + DECLARE_DYNAMIC_CLASS(wxFileCtrl); + DECLARE_EVENT_TABLE() +}; + // ---------------------------------------------------------------------------- // private classes - icons list management // ---------------------------------------------------------------------------- diff --git a/src/generic/laywin.cpp b/src/generic/laywin.cpp index ea613698ec..8d33f42ccf 100644 --- a/src/generic/laywin.cpp +++ b/src/generic/laywin.cpp @@ -24,7 +24,8 @@ #endif #ifndef WX_PRECOMP -#include "wx/mdi.h" + #include "wx/frame.h" + #include "wx/mdi.h" #endif #include "wx/laywin.h" @@ -219,6 +220,11 @@ bool wxLayoutAlgorithm::LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* r) #endif // wxUSE_MDI_ARCHITECTURE +bool wxLayoutAlgorithm::LayoutFrame(wxFrame* frame, wxWindow* mainWindow) +{ + return LayoutWindow(frame, mainWindow); +} + // Layout algorithm for any window. mainWindow gets what's left over. bool wxLayoutAlgorithm::LayoutWindow(wxWindow* parent, wxWindow* mainWindow) { diff --git a/src/generic/prntdlgg.cpp b/src/generic/prntdlgg.cpp index 2458e8729a..28d1252159 100644 --- a/src/generic/prntdlgg.cpp +++ b/src/generic/prntdlgg.cpp @@ -28,8 +28,6 @@ #pragma hdrstop #endif -#include "wx/defs.h" - #if wxUSE_PRINTING_ARCHITECTURE #ifndef WX_PRECOMP diff --git a/src/generic/prop.cpp b/src/generic/prop.cpp index 9b3792b717..028427d935 100644 --- a/src/generic/prop.cpp +++ b/src/generic/prop.cpp @@ -23,7 +23,6 @@ #if wxUSE_PROPSHEET #ifndef WX_PRECOMP -#include "wx/wx.h" #endif #include "wx/debug.h" diff --git a/src/generic/propform.cpp b/src/generic/propform.cpp index 5086d818c3..bfd528acc3 100644 --- a/src/generic/propform.cpp +++ b/src/generic/propform.cpp @@ -23,7 +23,6 @@ #if wxUSE_PROPSHEET #ifndef WX_PRECOMP -#include "wx/wx.h" #endif #include "wx/propform.h" diff --git a/src/generic/sashwin.cpp b/src/generic/sashwin.cpp index 693e74f1a4..8d679953df 100644 --- a/src/generic/sashwin.cpp +++ b/src/generic/sashwin.cpp @@ -25,13 +25,14 @@ #if wxUSE_SASH #ifndef WX_PRECOMP -#include "wx/wx.h" + #include "wx/dialog.h" + #include "wx/frame.h" + #include "wx/settings.h" #endif #include #include -#include "wx/string.h" #include "wx/dcscreen.h" #include "wx/sashwin.h" #include "wx/laywin.h" diff --git a/src/generic/splash.cpp b/src/generic/splash.cpp index d4103aeba0..3498795c50 100644 --- a/src/generic/splash.cpp +++ b/src/generic/splash.cpp @@ -6,7 +6,7 @@ // Created: 28/6/2000 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -23,7 +23,6 @@ #if wxUSE_SPLASH #ifndef WX_PRECOMP -#include "wx/wx.h" #endif #include "wx/splash.h" diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index 6d5d92ea0a..97dd46a709 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -25,7 +25,8 @@ #if wxUSE_HTML && wxUSE_STREAMS #ifndef WXPRECOMP -#include "wx/wx.h" + #include "wx/intl.h" + #include "wx/log.h" #endif #include "wx/html/helpdata.h" @@ -93,9 +94,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); @@ -105,14 +106,14 @@ 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); @@ -120,18 +121,18 @@ bool HP_TagHandler::HandleTag(const wxHtmlTag& tag) #if 0 if (!m_Page.IsEmpty()) /* Valid HHW's file may contain only two object tags: - + - + or - - - - - - + + + + + + We're interested in the latter. !m_Page.IsEmpty() is valid condition because text/site properties does not contain Local param */ @@ -139,8 +140,8 @@ bool HP_TagHandler::HandleTag(const wxHtmlTag& tag) if (tag.GetParam(wxT("TYPE")) == wxT("text/sitemap")) { if (m_ItemsCnt % wxHTML_REALLOC_STEP == 0) - m_Items = (wxHtmlContentsItem*) realloc(m_Items, - (m_ItemsCnt + wxHTML_REALLOC_STEP) * + m_Items = (wxHtmlContentsItem*) realloc(m_Items, + (m_ItemsCnt + wxHTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem)); m_Items[m_ItemsCnt].m_Level = m_Level; @@ -155,13 +156,13 @@ bool HP_TagHandler::HandleTag(const wxHtmlTag& tag) return TRUE; } - else + else { // "PARAM" if (m_Name == wxEmptyString && tag.GetParam(wxT("NAME")) == wxT("Name")) m_Name = tag.GetParam(wxT("VALUE")); - if (tag.GetParam(wxT("NAME")) == wxT("Local")) + if (tag.GetParam(wxT("NAME")) == wxT("Local")) m_Page = tag.GetParam(wxT("VALUE")); - if (tag.GetParam(wxT("NAME")) == wxT("ID")) + if (tag.GetParam(wxT("NAME")) == wxT("ID")) tag.GetParamAsInt(wxT("VALUE"), &m_ID); return FALSE; } @@ -217,19 +218,19 @@ wxHtmlHelpData::~wxHtmlHelpData() int i; m_BookRecords.Empty(); - if (m_Contents) + if (m_Contents) { - for (i = 0; i < m_ContentsCnt; i++) - { + 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) + if (m_Index) { - for (i = 0; i < m_IndexCnt; i++) - { + for (i = 0; i < m_IndexCnt; i++) + { delete[] m_Index[i].m_Page; delete[] m_Index[i].m_Name; } @@ -249,7 +250,7 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c parser.AddTagHandler(handler); f = ( contentsfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(contentsfile) ); - if (f) + if (f) { sz = f->GetStream()->GetSize(); buf = new char[sz + 1]; @@ -265,7 +266,7 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c wxLogError(_("Cannot open contents file: %s"), contentsfile.c_str()); f = ( indexfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(indexfile) ); - if (f) + if (f) { sz = f->GetStream()->GetSize(); buf = new char[sz + 1]; @@ -310,23 +311,23 @@ bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f) f->Read(&x, sizeof(x)); version = wxINT32_SWAP_ON_BE(x); - - if (version != CURRENT_CACHED_BOOK_VERSION) + + if (version != CURRENT_CACHED_BOOK_VERSION) { wxLogError(_("Incorrect version of HTML help book")); return FALSE; // NOTE: when adding new version, please ensure backward compatibility! } - + /* load contents : */ 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) * + m_Contents = (wxHtmlContentsItem*) realloc(m_Contents, + (m_ContentsCnt / wxHTML_REALLOC_STEP + 1) * wxHTML_REALLOC_STEP * sizeof(wxHtmlContentsItem)); - for (i = st; i < m_ContentsCnt; i++) + for (i = st; i < m_ContentsCnt; i++) { f->Read(&x, sizeof(x)); m_Contents[i].m_Level = wxINT32_SWAP_ON_BE(x); @@ -346,9 +347,9 @@ bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f) 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) * + m_Index = (wxHtmlContentsItem*) realloc(m_Index, (m_IndexCnt / wxHTML_REALLOC_STEP + 1) * wxHTML_REALLOC_STEP * sizeof(wxHtmlContentsItem)); - for (i = st; i < m_IndexCnt; i++) + for (i = st; i < m_IndexCnt; i++) { f->Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x); m_Index[i].m_Name = new wxChar[x]; @@ -378,7 +379,7 @@ bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f) for (i = 0; i < m_ContentsCnt; i++) if (m_Contents[i].m_Book == book && m_Contents[i].m_Level > 0) x++; x = wxINT32_SWAP_ON_BE(x); f->Write(&x, sizeof(x)); - for (i = 0; i < m_ContentsCnt; i++) + for (i = 0; i < m_ContentsCnt; i++) { if (m_Contents[i].m_Book != book || m_Contents[i].m_Level == 0) continue; x = wxINT32_SWAP_ON_BE(m_Contents[i].m_Level); @@ -399,7 +400,7 @@ bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f) for (i = 0; i < m_IndexCnt; i++) if (m_Index[i].m_Book == book && m_Index[i].m_Level > 0) x++; x = wxINT32_SWAP_ON_BE(x); f->Write(&x, sizeof(x)); - for (i = 0; i < m_IndexCnt; i++) + for (i = 0; i < m_IndexCnt; i++) { if (m_Index[i].m_Book != book || m_Index[i].m_Level == 0) continue; x = wxINT32_SWAP_ON_BE(wxStrlen(m_Index[i].m_Name) + 1); @@ -416,7 +417,7 @@ 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; @@ -447,7 +448,7 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile, wxFileSystem fsys; wxFSFile *fi; wxHtmlBookRecord *bookr; - + int IndexOld = m_IndexCnt, ContentsOld = m_ContentsCnt; @@ -473,35 +474,35 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile, // 1. save file as book, but with .hhp.cached extension // 2. same as 1. but in temp path // 3. otherwise or if cache load failed, load it from MS. - + fi = fsys.OpenFile(bookfile.GetLocation() + wxT(".cached")); - - if (fi == NULL || - fi->GetModificationTime() < bookfile.GetModificationTime() || + + if (fi == NULL || + 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() || + if (m_TempPath == wxEmptyString || fi == NULL || + fi->GetModificationTime() < bookfile.GetModificationTime() || !LoadCachedBook(bookr, fi->GetStream())) { LoadMSProject(bookr, fsys, indexfile, contfile); - if (m_TempPath != wxEmptyString) + if (m_TempPath != wxEmptyString) { - wxFileOutputStream *outs = new wxFileOutputStream(m_TempPath + + wxFileOutputStream *outs = new wxFileOutputStream(m_TempPath + SafeFileName(wxFileNameFromPath(bookfile.GetLocation())) + wxT(".cached")); SaveCachedBook(bookr, outs); delete outs; } } } - + if (fi != NULL) delete fi; // Now store the contents range bookr->SetContentsRange(cont_start, m_ContentsCnt); - + // Convert encoding, if neccessary: if (encoding != wxFONTENCODING_SYSTEM) { @@ -511,7 +512,7 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile, int i; wxEncodingConverter conv; conv.Init(encoding, a[0]); - + for (i = IndexOld; i < m_IndexCnt; i++) conv.Convert(m_Index[i].m_Name); for (i = ContentsOld; i < m_ContentsCnt; i++) @@ -530,7 +531,7 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile, bool wxHtmlHelpData::AddBook(const wxString& book) { if (book.Right(4).Lower() == wxT(".zip") || - book.Right(4).Lower() == wxT(".htb") /*html book*/) + book.Right(4).Lower() == wxT(".htb") /*html book*/) { wxFileSystem fsys; @@ -538,18 +539,18 @@ bool wxHtmlHelpData::AddBook(const wxString& book) bool rt = FALSE; s = fsys.FindFirst(book + wxT("#zip:") + wxT("*.hhp"), wxFILE); - while (!s.IsEmpty()) + while (!s.IsEmpty()) { if (AddBook(s)) rt = TRUE; s = fsys.FindNext(); } - + return rt; } - else - { + else + { wxFSFile *fi; wxFileSystem fsys; wxInputStream *s; @@ -562,7 +563,7 @@ bool wxHtmlHelpData::AddBook(const wxString& book) wxString title = _("noname"), safetitle, start = wxEmptyString, - contents = wxEmptyString, + contents = wxEmptyString, index = wxEmptyString, charset = wxEmptyString; @@ -570,7 +571,7 @@ bool wxHtmlHelpData::AddBook(const wxString& book) else bookFull = wxGetCwd() + "/" + book; fi = fsys.OpenFile(bookFull); - if (fi == NULL) + if (fi == NULL) { wxLogError(_("Cannot open HTML help book: %s"), bookFull.c_str()); return FALSE; @@ -598,11 +599,11 @@ bool wxHtmlHelpData::AddBook(const wxString& book) charset = linebuf + strlen("Charset="); } while (lineptr != NULL); delete[] buff; - + wxFontEncoding enc; if (charset == wxEmptyString) enc = wxFONTENCODING_SYSTEM; else enc = wxTheFontMapper->CharsetToEncoding(charset); - bool rtval = AddBookParam(*fi, enc, + bool rtval = AddBookParam(*fi, enc, title, contents, index, start, fsys.GetPath()); delete fi; return rtval; @@ -620,11 +621,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].GetFullPath(x)); - if (f) - { + if (f) + { url = m_BookRecords[i].GetFullPath(x); delete f; return url; @@ -634,10 +635,10 @@ wxString wxHtmlHelpData::FindPageByName(const wxString& x) /* 2. try to find a book: */ - for (i = 0; i < cnt; i++) + for (i = 0; i < cnt; i++) { - if (m_BookRecords[i].GetTitle() == x) - { + if (m_BookRecords[i].GetTitle() == x) + { url = m_BookRecords[i].GetFullPath(m_BookRecords[i].GetStart()); return url; } @@ -646,10 +647,10 @@ wxString wxHtmlHelpData::FindPageByName(const wxString& x) /* 3. try to find in contents: */ cnt = m_ContentsCnt; - for (i = 0; i < cnt; i++) + for (i = 0; i < cnt; i++) { - if (wxStrcmp(m_Contents[i].m_Name, x) == 0) - { + if (wxStrcmp(m_Contents[i].m_Name, x) == 0) + { url = m_Contents[i].GetFullPath(); return url; } @@ -659,10 +660,10 @@ wxString wxHtmlHelpData::FindPageByName(const wxString& x) /* 4. try to find in index: */ cnt = m_IndexCnt; - for (i = 0; i < cnt; i++) + for (i = 0; i < cnt; i++) { - if (wxStrcmp(m_Index[i].m_Name, x) == 0) - { + if (wxStrcmp(m_Index[i].m_Name, x) == 0) + { url = m_Index[i].GetFullPath(); return url; } @@ -676,10 +677,10 @@ wxString wxHtmlHelpData::FindPageById(int id) int i; wxString url(wxEmptyString); - for (i = 0; i < m_ContentsCnt; i++) + for (i = 0; i < m_ContentsCnt; i++) { - if (m_Contents[i].m_ID == id) - { + if (m_Contents[i].m_ID == id) + { url = m_Contents[i].GetFullPath(); return url; } @@ -699,13 +700,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(); @@ -714,7 +715,7 @@ 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; @@ -732,7 +733,7 @@ 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); @@ -748,7 +749,7 @@ bool wxHtmlSearchStatus::Search() if (m_LastPage != NULL) { wxChar *p1, *p2; - for (p1 = thepage, p2 = m_LastPage; + for (p1 = thepage, p2 = m_LastPage; *p1 != 0 && *p1 != _T('#') && *p1 == *p2; p1++, p2++) {} m_LastPage = thepage; @@ -757,12 +758,12 @@ bool wxHtmlSearchStatus::Search() return FALSE; } else m_LastPage = thepage; - + wxFileSystem fsys; file = fsys.OpenFile(m_Data->m_Contents[i].m_Book->GetFullPath(thepage)); - if (file) + 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; @@ -791,15 +792,15 @@ void wxSearchEngine::LookFor(const wxString& keyword, bool case_sensitive, bool if (m_Keyword) delete[] m_Keyword; m_Keyword = new wxChar[keyword.Length() + 1]; 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'); - } - } + } + } } @@ -824,19 +825,19 @@ 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; } } } - + 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; } diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index cd927aa55c..99935751ca 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -22,7 +22,9 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" + #include "wx/brush.h" + #include "wx/colour.h" + #include "wx/dc.h" #endif #include "wx/html/htmlcell.h" @@ -34,23 +36,23 @@ // wxHtmlCell //----------------------------------------------------------------------------- -wxHtmlCell::wxHtmlCell() : wxObject() +wxHtmlCell::wxHtmlCell() : wxObject() { - m_Next = NULL; - m_Parent = NULL; - m_Width = m_Height = m_Descent = 0; + m_Next = NULL; + m_Parent = NULL; + m_Width = m_Height = m_Descent = 0; m_CanLiveOnPagebreak = TRUE; m_Link = NULL; } -wxHtmlCell::~wxHtmlCell() +wxHtmlCell::~wxHtmlCell() { - if (m_Link) delete m_Link; + if (m_Link) delete m_Link; if (m_Next) delete m_Next; } -void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y, +void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event) { wxHtmlLinkInfo *lnk = GetLink(x, y); @@ -68,15 +70,15 @@ void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y, bool wxHtmlCell::AdjustPagebreak(int *pagebreak) const { - if ((!m_CanLiveOnPagebreak) && - m_PosY < *pagebreak && m_PosY + m_Height > *pagebreak) + if ((!m_CanLiveOnPagebreak) && + m_PosY < *pagebreak && m_PosY + m_Height > *pagebreak) { *pagebreak = m_PosY; if (m_Next != NULL) m_Next->AdjustPagebreak(pagebreak); return TRUE; } - - else + + else { if (m_Next != NULL) return m_Next->AdjustPagebreak(pagebreak); else return FALSE; @@ -85,7 +87,7 @@ bool wxHtmlCell::AdjustPagebreak(int *pagebreak) const -void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link) +void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link) { if (m_Link) delete m_Link; m_Link = NULL; @@ -95,30 +97,30 @@ void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link) -void wxHtmlCell::Layout(int w) +void wxHtmlCell::Layout(int w) { - SetPos(0, 0); + SetPos(0, 0); if (m_Next) m_Next->Layout(w); } -void wxHtmlCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2) +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); } -void wxHtmlCell::DrawInvisible(wxDC& dc, int x, int y) +void wxHtmlCell::DrawInvisible(wxDC& dc, int x, int y) { if (m_Next) m_Next->DrawInvisible(dc, x, y); } -const wxHtmlCell* wxHtmlCell::Find(int condition, const void* param) const +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; } @@ -166,7 +168,7 @@ wxHtmlContainerCell::wxHtmlContainerCell(wxHtmlContainerCell *parent) : wxHtmlCe m_LastLayout = -1; } -wxHtmlContainerCell::~wxHtmlContainerCell() +wxHtmlContainerCell::~wxHtmlContainerCell() { if (m_Cells) delete m_Cells; } @@ -212,16 +214,16 @@ int wxHtmlContainerCell::GetIndentUnits(int ind) const bool wxHtmlContainerCell::AdjustPagebreak(int *pagebreak) const { - if (!m_CanLiveOnPagebreak) + if (!m_CanLiveOnPagebreak) return wxHtmlCell::AdjustPagebreak(pagebreak); - else + else { wxHtmlCell *c = GetFirstCell(); bool rt = FALSE; int pbrk = *pagebreak - m_PosY; - while (c) + while (c) { if (c->AdjustPagebreak(&pbrk)) rt = TRUE; c = c->GetNext(); @@ -235,11 +237,11 @@ bool wxHtmlContainerCell::AdjustPagebreak(int *pagebreak) const void wxHtmlContainerCell::Layout(int w) { - if (m_LastLayout == w) + if (m_LastLayout == w) { wxHtmlCell::Layout(w); return; - } + } wxHtmlCell *cell = m_Cells, *line = m_Cells; long xpos = 0, ypos = m_IndentTop; @@ -256,18 +258,18 @@ 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; @@ -285,9 +287,9 @@ 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) + while (cell != NULL) { - switch (m_AlignVer) + switch (m_AlignVer) { case wxHTML_ALIGN_TOP : ybasicpos = 0; break; case wxHTML_ALIGN_BOTTOM : ybasicpos = - cell->GetHeight(); break; @@ -304,42 +306,42 @@ void wxHtmlContainerCell::Layout(int w) xcnt++; // force new line if occured: - if ((cell == NULL) || (xpos + cell->GetWidth() > s_width)) + if ((cell == NULL) || (xpos + cell->GetWidth() > s_width)) { if (xpos > MaxLineWidth) MaxLineWidth = xpos; if (ysizeup < 0) ysizeup = 0; if (ysizedown < 0) ysizedown = 0; switch (m_AlignHor) { - case wxHTML_ALIGN_LEFT : - case wxHTML_ALIGN_JUSTIFY : - xdelta = 0; + case wxHTML_ALIGN_LEFT : + case wxHTML_ALIGN_JUSTIFY : + xdelta = 0; break; - case wxHTML_ALIGN_RIGHT : - xdelta = 0 + (s_width - xpos); + case wxHTML_ALIGN_RIGHT : + xdelta = 0 + (s_width - xpos); break; - case wxHTML_ALIGN_CENTER : - xdelta = 0 + (s_width - xpos) / 2; + case wxHTML_ALIGN_CENTER : + xdelta = 0 + (s_width - xpos) / 2; break; } if (xdelta < 0) xdelta = 0; xdelta += s_indent; ypos += ysizeup; - + if (m_AlignHor != wxHTML_ALIGN_JUSTIFY || cell == NULL) - while (line != cell) + while (line != cell) { - line->SetPos(line->GetPosX() + xdelta, + line->SetPos(line->GetPosX() + xdelta, ypos + line->GetPosY()); line = line->GetNext(); } else - { + { int counter = 0; int step = (s_width - xpos); if (step < 0) step = 0; xcnt--; - if (xcnt > 0) while (line != cell) + if (xcnt > 0) while (line != cell) { line->SetPos(line->GetPosX() + s_indent + (counter++ * step / xcnt), @@ -359,14 +361,14 @@ 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_Height < m_MinHeight) { - if (m_MinHeightAlign != wxHTML_ALIGN_TOP) + if (m_MinHeightAlign != wxHTML_ALIGN_TOP) { int diff = m_MinHeight - m_Height; if (m_MinHeightAlign == wxHTML_ALIGN_CENTER) diff /= 2; cell = m_Cells; - while (cell) + while (cell) { cell->SetPos(cell->GetPosX(), cell->GetPosY() + diff); cell = cell->GetNext(); @@ -390,10 +392,10 @@ 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); @@ -405,7 +407,7 @@ 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); @@ -421,7 +423,7 @@ void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2) if (m_Cells) m_Cells->Draw(dc, x + m_PosX, y + m_PosY, view_y1, view_y2); } // container invisible, just proceed font+color changing: - else + else { if (m_Cells) m_Cells->DrawInvisible(dc, x + m_PosX, y + m_PosY); } @@ -444,7 +446,7 @@ wxHtmlLinkInfo *wxHtmlContainerCell::GetLink(int x, int y) const wxHtmlCell *c = m_Cells; int cx, cy, cw, ch; - while (c) + while (c) { cx = c->GetPosX(), cy = c->GetPosY(); cw = c->GetWidth(), ch = c->GetHeight(); @@ -460,7 +462,7 @@ wxHtmlLinkInfo *wxHtmlContainerCell::GetLink(int x, int y) const void wxHtmlContainerCell::InsertCell(wxHtmlCell *f) { if (!m_Cells) m_Cells = m_LastCell = f; - else + else { m_LastCell->SetNext(f); m_LastCell = f; @@ -474,7 +476,7 @@ 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(); @@ -494,17 +496,17 @@ 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); @@ -519,7 +521,7 @@ const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) co { const wxHtmlCell *r = NULL; - if (m_Cells) + if (m_Cells) { r = m_Cells->Find(condition, param); if (r) return r; @@ -532,15 +534,15 @@ const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) co void wxHtmlContainerCell::OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event) { - if (m_Cells) + if (m_Cells) { wxHtmlCell *c = m_Cells; - while (c) + while (c) { if ( (c->GetPosX() <= x) && (c->GetPosY() <= y) && (c->GetPosX() + c->GetWidth() > x) && - (c->GetPosY() + c->GetHeight() > y)) + (c->GetPosY() + c->GetHeight() > y)) { c->OnMouseClick(parent, x - c->GetPosX(), y - c->GetPosY(), event); break; @@ -562,7 +564,7 @@ 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); @@ -574,7 +576,7 @@ 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); @@ -627,7 +629,7 @@ void wxHtmlWidgetCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2) int absx = 0, absy = 0, stx, sty; wxHtmlCell *c = this; - while (c) + while (c) { absx += c->GetPosX(); absy += c->GetPosY(); @@ -647,7 +649,7 @@ void wxHtmlWidgetCell::DrawInvisible(wxDC& dc, int x, int y) int absx = 0, absy = 0, stx, sty; wxHtmlCell *c = this; - while (c) + while (c) { absx += c->GetPosX(); absy += c->GetPosY(); @@ -664,7 +666,7 @@ 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); diff --git a/src/html/htmlfilt.cpp b/src/html/htmlfilt.cpp index 6f30086b60..b28da27368 100644 --- a/src/html/htmlfilt.cpp +++ b/src/html/htmlfilt.cpp @@ -22,7 +22,8 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" + #include "wx/log.h" + #include "wx/intl.h" #endif #include "wx/html/htmlfilt.h" @@ -141,7 +142,7 @@ wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const char *src; wxString doc; - if (s == NULL) + if (s == NULL) { wxLogError(_("Cannot open HTML document: %s"), file.GetLocation().c_str()); return wxEmptyString; @@ -152,7 +153,7 @@ wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const doc = src; delete[] src; - // add meta tag if we obtained this through http: + // add meta tag if we obtained this through http: if (file.GetMimeType().Find(_T("; charset=")) == 0) { wxString s(_T(" #endif - #include #include #include diff --git a/src/html/htmlpars.cpp b/src/html/htmlpars.cpp index 1b9c06726d..6a69f9e0b9 100644 --- a/src/html/htmlpars.cpp +++ b/src/html/htmlpars.cpp @@ -22,7 +22,8 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" + #include "wx/log.h" + #include "wx/intl.h" #endif #include "wx/tokenzr.h" @@ -40,8 +41,8 @@ IMPLEMENT_ABSTRACT_CLASS(wxHtmlParser,wxObject) -wxHtmlParser::wxHtmlParser() - : wxObject(), m_Cache(NULL), m_HandlersHash(wxKEY_STRING), +wxHtmlParser::wxHtmlParser() + : wxObject(), m_Cache(NULL), m_HandlersHash(wxKEY_STRING), m_FS(NULL), m_HandlersStack(NULL) { m_entitiesParser = new wxHtmlEntitiesParser; @@ -97,22 +98,22 @@ 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, m_entitiesParser); - if (templen) + if (templen) { temp[templen] = 0; AddText(temp); @@ -124,7 +125,7 @@ void wxHtmlParser::DoParsing(int begin_pos, int end_pos) } } - if (templen) + if (templen) { // last word of block :-( temp[templen] = 0; AddText(temp); @@ -140,7 +141,7 @@ void wxHtmlParser::AddTag(const wxHtmlTag& tag) h = (wxHtmlTagHandler*) m_HandlersHash.Get(tag.GetName()); if (h) inner = h->HandleTag(tag); - if (!inner) + if (!inner) { if (tag.HasEnding()) DoParsing(tag.GetBeginPos(), tag.GetEndPos1()); @@ -166,7 +167,7 @@ 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); @@ -174,7 +175,7 @@ void wxHtmlParser::PushTagHandler(wxHtmlTagHandler *handler, wxString tags) m_HandlersStack->Insert(new wxHashTable(m_HandlersHash)); - while (tokenizer.HasMoreTokens()) + while (tokenizer.HasMoreTokens()) { key = tokenizer.NextToken(); m_HandlersHash.Delete(key); @@ -185,9 +186,9 @@ void wxHtmlParser::PushTagHandler(wxHtmlTagHandler *handler, wxString tags) void wxHtmlParser::PopTagHandler() { wxNode *first; - - if (m_HandlersStack == NULL || - (first = m_HandlersStack->GetFirst()) == NULL) + + if (m_HandlersStack == NULL || + (first = m_HandlersStack->GetFirst()) == NULL) { wxLogWarning(_("Warning: attempt to remove HTML tag handler from empty stack.")); return; @@ -238,7 +239,7 @@ wxString wxHtmlEntitiesParser::Parse(const wxString& input) const wxChar *c, *last; const wxChar *in_str = input.c_str(); wxString output; - + for (c = in_str, last = in_str; *c != wxT('\0'); c++) { if (*c == wxT('&')) @@ -295,12 +296,12 @@ wxChar wxHtmlEntitiesParser::GetCharForCode(unsigned code) wxChar wxHtmlEntitiesParser::GetEntityChar(const wxString& entity) { unsigned code = 0; - + if (entity[0] == wxT('#')) { const wxChar *ent_s = entity.c_str(); const wxChar *format; - + if (ent_s[1] == wxT('x') || ent_s[1] == wxT('X')) { format = wxT("%x"); @@ -570,20 +571,20 @@ wxChar wxHtmlEntitiesParser::GetEntityChar(const wxString& entity) { wxT("zwnj"),8204 }, {NULL, 0}}; static size_t substitutions_cnt = 0; - + if (substitutions_cnt == 0) while (substitutions[substitutions_cnt].code != 0) substitutions_cnt++; wxHtmlEntityInfo *info; - info = (wxHtmlEntityInfo*) bsearch(entity.c_str(), substitutions, + info = (wxHtmlEntityInfo*) bsearch(entity.c_str(), substitutions, substitutions_cnt, sizeof(wxHtmlEntityInfo), compar_entity); if (info) code = info->code; } - + if (code == 0) return wxT('?'); else diff --git a/src/html/htmltag.cpp b/src/html/htmltag.cpp index 52e0c1b8f8..05cdc2aba5 100644 --- a/src/html/htmltag.cpp +++ b/src/html/htmltag.cpp @@ -22,7 +22,6 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" #endif #include "wx/html/htmltag.h" diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index 00c0fb7377..aef5ec23b0 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -23,15 +23,18 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" + #include "wx/log.h" + #include "wx/intl.h" + #include "wx/dcclient.h" + #include "wx/frame.h" #endif #include "wx/html/htmlwin.h" #include "wx/html/forcelnk.h" #include "wx/html/htmlproc.h" -#include "wx/log.h" -#include "wx/arrimpl.cpp" #include "wx/list.h" + +#include "wx/arrimpl.cpp" #include "wx/listimpl.cpp" //----------------------------------------------------------------------------- diff --git a/src/html/htmprint.cpp b/src/html/htmprint.cpp index 4000a2e719..4c6c3e688d 100644 --- a/src/html/htmprint.cpp +++ b/src/html/htmprint.cpp @@ -23,7 +23,8 @@ #endif #ifndef WX_PRECOMP -#include "wx/wx.h" + #include "wx/log.h" + #include "wx/intl.h" #endif #if wxUSE_HTML && wxUSE_PRINTING_ARCHITECTURE && wxUSE_STREAMS @@ -82,7 +83,7 @@ void wxHtmlDCRenderer::SetHtmlText(const wxString& html, const wxString& basepat if (m_DC == NULL) return; 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); @@ -94,24 +95,24 @@ void wxHtmlDCRenderer::SetHtmlText(const wxString& html, const wxString& basepat int wxHtmlDCRenderer::Render(int x, int y, int from, int dont_render) { int pbreak, hght; - + if (m_Cells == NULL || m_DC == NULL) return 0; - + pbreak = (int)(from + m_Height); while (m_Cells->AdjustPagebreak(&pbreak)) {} hght = pbreak - from; - - if (!dont_render) + + if (!dont_render) { m_DC->SetBrush(*wxWHITE_BRUSH); - + m_DC->SetClippingRegion(x, y, m_Width, hght); - m_Cells->Draw(*m_DC, + m_Cells->Draw(*m_DC, x, (y - from), y, pbreak + (y /*- from*/)); m_DC->DestroyClippingRegion(); } - + if (pbreak < m_Cells->GetHeight()) return pbreak; else return GetTotalHeight(); } @@ -171,7 +172,7 @@ bool wxHtmlPrintout::OnBeginDocument(int startPage, int endPage) { int pageWidth, pageHeight, mm_w, mm_h, scr_w, scr_h, dc_w, dc_h; float ppmm_h, ppmm_v; - + if (!wxPrintout::OnBeginDocument(startPage, endPage)) return FALSE; GetPageSizePixels(&pageWidth, &pageHeight); @@ -190,35 +191,35 @@ bool wxHtmlPrintout::OnBeginDocument(int startPage, int endPage) 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_MarginRight)), + m_RendererHdr->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginRight)), (int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom))); - if (m_Headers[0] != wxEmptyString) + if (m_Headers[0] != wxEmptyString) { m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[0], 1)); m_HeaderHeight = m_RendererHdr->GetTotalHeight(); } - else if (m_Headers[1] != wxEmptyString) + else if (m_Headers[1] != wxEmptyString) { m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[1], 1)); m_HeaderHeight = m_RendererHdr->GetTotalHeight(); } - if (m_Footers[0] != wxEmptyString) + if (m_Footers[0] != wxEmptyString) { m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[0], 1)); m_FooterHeight = m_RendererHdr->GetTotalHeight(); } - else if (m_Footers[1] != wxEmptyString) + else if (m_Footers[1] != wxEmptyString) { m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[1], 1)); m_FooterHeight = m_RendererHdr->GetTotalHeight(); } - + /* prepare main renderer: */ m_Renderer->SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY); m_Renderer->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginRight)), - (int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom) - + (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) @@ -232,12 +233,12 @@ 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; } @@ -272,22 +273,22 @@ void wxHtmlPrintout::SetHtmlFile(const wxString& htmlfile) { wxFileSystem fs; wxFSFile *ff = fs.OpenFile(htmlfile); - + if (ff == NULL) - { + { wxLogError(htmlfile + _(": file does not exist!")); return; } - + 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; delete ff; - + SetHtmlText(doc, htmlfile, FALSE); } @@ -295,9 +296,9 @@ void wxHtmlPrintout::SetHtmlFile(const wxString& htmlfile) void wxHtmlPrintout::SetHeader(const wxString& header, int pg) { - if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN) + if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN) m_Headers[0] = header; - if (pg == wxPAGE_ALL || pg == wxPAGE_ODD) + if (pg == wxPAGE_ALL || pg == wxPAGE_ODD) m_Headers[1] = header; } @@ -305,9 +306,9 @@ void wxHtmlPrintout::SetHeader(const wxString& header, int pg) void wxHtmlPrintout::SetFooter(const wxString& footer, int pg) { - if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN) + if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN) m_Footers[0] = footer; - if (pg == wxPAGE_ALL || pg == wxPAGE_ODD) + if (pg == wxPAGE_ALL || pg == wxPAGE_ODD) m_Footers[1] = footer; } @@ -327,11 +328,11 @@ void wxHtmlPrintout::CountPages() int pos = 0; m_NumPages = 0; - + m_PageBreaks[0] = 0; - do + do { - pos = m_Renderer->Render((int)( ppmm_h * m_MarginLeft), + 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; @@ -360,22 +361,22 @@ void wxHtmlPrintout::RenderPage(wxDC *dc, int page) GetPPIScreen(&ppiScreenX, &ppiScreenY); dc->SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth); - + m_Renderer->SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY); - + 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) + if (m_Headers[page % 2] != wxEmptyString) { m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[page % 2], page)); m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (ppmm_v * m_MarginTop)); } - if (m_Footers[page % 2] != wxEmptyString) + if (m_Footers[page % 2] != wxEmptyString) { m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[page % 2], page)); m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (pageHeight - ppmm_v * m_MarginBottom - m_FooterHeight)); @@ -388,7 +389,7 @@ wxString wxHtmlPrintout::TranslateHeader(const wxString& instr, int page) { wxString r = instr; wxString num; - + num.Printf(wxT("%i"), page); r.Replace(wxT("@PAGENUM@"), num); @@ -429,9 +430,9 @@ wxHtmlEasyPrinting::wxHtmlEasyPrinting(const wxString& name, wxFrame *parent_fra #endif 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->SetMarginTopLeft(wxPoint(25, 25)); m_PageSetupData->SetMarginBottomRight(wxPoint(25, 25)); } @@ -494,14 +495,14 @@ 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; } - wxPreviewFrame *frame = new wxPreviewFrame(preview, m_Frame, - m_Name + _(" Preview"), + wxPreviewFrame *frame = new wxPreviewFrame(preview, m_Frame, + m_Name + _(" Preview"), wxPoint(100, 100), wxSize(650, 500)); frame->Centre(wxBOTH); frame->Initialize(); @@ -531,7 +532,7 @@ void wxHtmlEasyPrinting::PrinterSetup() { wxPrintDialogData printDialogData(*m_PrintData); wxPrintDialog printerDialog(m_Frame, &printDialogData); - + printerDialog.GetPrintDialogData().SetSetupDialog(TRUE); if (printerDialog.ShowModal() == wxID_OK) @@ -545,7 +546,7 @@ void wxHtmlEasyPrinting::PageSetup() m_PageSetupData->SetPrintData(*m_PrintData); wxPageSetupDialog pageSetupDialog(m_Frame, m_PageSetupData); - if (pageSetupDialog.ShowModal() == wxID_OK) + if (pageSetupDialog.ShowModal() == wxID_OK) { (*m_PrintData) = pageSetupDialog.GetPageSetupData().GetPrintData(); (*m_PageSetupData) = pageSetupDialog.GetPageSetupData(); @@ -556,9 +557,9 @@ void wxHtmlEasyPrinting::PageSetup() void wxHtmlEasyPrinting::SetHeader(const wxString& header, int pg) { - if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN) + if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN) m_Headers[0] = header; - if (pg == wxPAGE_ALL || pg == wxPAGE_ODD) + if (pg == wxPAGE_ALL || pg == wxPAGE_ODD) m_Headers[1] = header; } @@ -566,9 +567,9 @@ void wxHtmlEasyPrinting::SetHeader(const wxString& header, int pg) void wxHtmlEasyPrinting::SetFooter(const wxString& footer, int pg) { - if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN) + if (pg == wxPAGE_ALL || pg == wxPAGE_EVEN) m_Footers[0] = footer; - if (pg == wxPAGE_ALL || pg == wxPAGE_ODD) + if (pg == wxPAGE_ALL || pg == wxPAGE_ODD) m_Footers[1] = footer; } @@ -577,7 +578,7 @@ void wxHtmlEasyPrinting::SetFooter(const wxString& footer, int pg) 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); @@ -587,7 +588,7 @@ wxHtmlPrintout *wxHtmlEasyPrinting::CreatePrintout() 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 28c34616c9..b6ec386043 100644 --- a/src/html/m_dflist.cpp +++ b/src/html/m_dflist.cpp @@ -22,10 +22,8 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" #endif - #include "wx/html/forcelnk.h" #include "wx/html/m_templ.h" @@ -43,10 +41,10 @@ TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD") wxHtmlContainerCell *c; - if (tag.GetName() == wxT("DL")) - { - if (m_WParser->GetContainer()->GetFirstCell() != NULL) - { + if (tag.GetName() == wxT("DL")) + { + if (m_WParser->GetContainer()->GetFirstCell() != NULL) + { m_WParser->CloseContainer(); m_WParser->OpenContainer(); } @@ -54,8 +52,8 @@ TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD") ParseInner(tag); - if (m_WParser->GetContainer()->GetFirstCell() != NULL) - { + if (m_WParser->GetContainer()->GetFirstCell() != NULL) + { m_WParser->CloseContainer(); m_WParser->OpenContainer(); } @@ -63,11 +61,10 @@ TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD") return TRUE; } - - else if (tag.GetName() == wxT("DT")) - { - if (!tag.IsEnding()) - { + else if (tag.GetName() == wxT("DT")) + { + if (!tag.IsEnding()) + { m_WParser->CloseContainer(); c = m_WParser->OpenContainer(); c->SetAlignHor(wxHTML_ALIGN_LEFT); @@ -75,15 +72,14 @@ TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD") } return FALSE; } - else if (!tag.IsEnding()) // "DD" - { + { m_WParser->CloseContainer(); c = m_WParser->OpenContainer(); c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_LEFT); return FALSE; } - + else return FALSE; } diff --git a/src/html/m_fonts.cpp b/src/html/m_fonts.cpp index d5391350e6..61e59f86c3 100644 --- a/src/html/m_fonts.cpp +++ b/src/html/m_fonts.cpp @@ -21,7 +21,6 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" #endif #include "wx/html/forcelnk.h" @@ -44,21 +43,21 @@ TAG_HANDLER_BEGIN(FONT, "FONT") wxString oldface = m_WParser->GetFontFace(); if (tag.HasParam(wxT("COLOR"))) - { + { wxColour clr; if (tag.GetParamAsColour(wxT("COLOR"), &clr)) - { + { m_WParser->SetActualColor(clr); m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr)); } } if (tag.HasParam(wxT("SIZE"))) - { + { int tmp = 0; wxChar c = tag.GetParam(wxT("SIZE")).GetChar(0); if (tag.GetParamAsInt(wxT("SIZE"), &tmp)) - { + { if (c == wxT('+') || c == wxT('-')) m_WParser->SetFontSize(oldsize+tmp); else @@ -69,9 +68,9 @@ TAG_HANDLER_BEGIN(FONT, "FONT") } if (tag.HasParam(wxT("FACE"))) - { + { if (m_Faces.GetCount() == 0) - { + { wxFontEnumerator enu; enu.EnumerateFacenames(); m_Faces = *enu.GetFacenames(); @@ -80,30 +79,30 @@ 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())); break; } - } + } } ParseInner(tag); 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 (oldclr != m_WParser->GetActualColor()) - { + { m_WParser->SetActualColor(oldclr); m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(oldclr)); } @@ -232,7 +231,7 @@ TAG_HANDLER_BEGIN(Hx, "H1,H2,H3,H4,H5,H6") 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); @@ -240,7 +239,7 @@ TAG_HANDLER_BEGIN(Hx, "H1,H2,H3,H4,H5,H6") 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); @@ -248,7 +247,7 @@ TAG_HANDLER_BEGIN(Hx, "H1,H2,H3,H4,H5,H6") c = m_WParser->GetContainer(); if (c->GetFirstCell()) - { + { m_WParser->CloseContainer(); m_WParser->OpenContainer(); c = m_WParser->GetContainer(); diff --git a/src/html/m_hline.cpp b/src/html/m_hline.cpp index 77f4abcb64..87b4e384c5 100644 --- a/src/html/m_hline.cpp +++ b/src/html/m_hline.cpp @@ -21,11 +21,11 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" + #include "wx/brush.h" + #include "wx/pen.h" + #include "wx/dc.h" #endif - - #include "wx/html/forcelnk.h" #include "wx/html/m_templ.h" diff --git a/src/html/m_image.cpp b/src/html/m_image.cpp index 8edf713086..85e8f274d7 100644 --- a/src/html/m_image.cpp +++ b/src/html/m_image.cpp @@ -21,13 +21,12 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" + #include "wx/dc.h" #endif #include "wx/html/forcelnk.h" #include "wx/html/m_templ.h" - #include "wx/image.h" #include "wx/dynarray.h" @@ -73,7 +72,7 @@ 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 ); @@ -83,7 +82,7 @@ wxHtmlImageMapAreaCell::wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::celltype wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const { - switch (type) + switch (type) { case RECT: { @@ -93,8 +92,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; @@ -108,16 +107,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; @@ -128,63 +127,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]) / @@ -192,8 +191,8 @@ wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const } } } - if ((intersects & 1) != 0) - { + if ((intersects & 1) != 0) + { return m_Link; } } @@ -201,7 +200,7 @@ wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const break; } - if (m_Next) + if (m_Next) { wxHtmlImageMapAreaCell *a = (wxHtmlImageMapAreaCell*)m_Next; return a->GetLink( x, y ); @@ -251,7 +250,7 @@ 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; @@ -294,11 +293,11 @@ wxHtmlImageCell::wxHtmlImageCell(wxFSFile *input, int w, int h, double scale, in wxImage *img; int ww, hh, bw, bh; wxInputStream *s = input->GetStream(); - + m_Scale = scale; img = new wxImage(*s, wxBITMAP_TYPE_ANY); m_Image = NULL; - if (img && (img->Ok())) + if (img && (img->Ok())) { ww = img->GetWidth(); hh = img->GetHeight(); @@ -308,16 +307,16 @@ wxHtmlImageCell::wxHtmlImageCell(wxFSFile *input, int w, int h, double scale, in m_Width = (int)(scale * (double)bw); m_Height = (int)(scale * (double)bh); - if ((bw != ww) || (bh != hh)) - { + if ((bw != ww) || (bh != hh)) + { wxImage img2 = img->Scale(bw, bh); m_Image = new wxBitmap(img2.ConvertToBitmap()); - } - else + } + else m_Image = new wxBitmap(img->ConvertToBitmap()); delete img; } - switch (align) + switch (align) { case wxHTML_ALIGN_TOP : m_Descent = m_Height; @@ -345,9 +344,9 @@ void wxHtmlImageCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2) double us_x, us_y; dc.GetUserScale(&us_x, &us_y); dc.SetUserScale(us_x * m_Scale, us_y * m_Scale); - + // dc.DrawBitmap(*m_Image, x + m_PosX, y + m_PosY, (m_Image->GetMask() != (wxMask*) 0)); - dc.DrawBitmap(*m_Image, (int) ((x + m_PosX) / m_Scale), + dc.DrawBitmap(*m_Image, (int) ((x + m_PosX) / m_Scale), (int) ((y + m_PosY) / m_Scale), TRUE); dc.SetUserScale(us_x, us_y); } @@ -358,19 +357,19 @@ wxHtmlLinkInfo *wxHtmlImageCell::GetLink( int x, int y ) const { if (m_MapName.IsEmpty()) return wxHtmlCell::GetLink( x, y ); - if (!m_ImageMap) + if (!m_ImageMap) { wxHtmlContainerCell *p, *op; op = p = GetParent(); - while (p) - { + while (p) + { op = p; p = p->GetParent(); } p = op; wxHtmlCell *cell = (wxHtmlCell*)p->Find( wxHTML_COND_ISIMAGEMAP, (const void*)(&m_MapName)); - if (!cell) - { + if (!cell) + { ((wxString&)m_MapName).Clear(); return wxHtmlCell::GetLink( x, y ); } @@ -393,10 +392,10 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA") TAG_HANDLER_PROC(tag) { - if (tag.GetName() == wxT("IMG")) - { - if (tag.HasParam(wxT("SRC"))) - { + if (tag.GetName() == wxT("IMG")) + { + if (tag.HasParam(wxT("SRC"))) + { int w = -1, h = -1; int al; wxFSFile *str; @@ -404,31 +403,31 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA") wxString mn = wxEmptyString; str = m_WParser->GetFS()->OpenFile(tmp); - if (tag.HasParam(wxT("WIDTH"))) + if (tag.HasParam(wxT("WIDTH"))) tag.GetParamAsInt(wxT("WIDTH"), &w); - if (tag.HasParam(wxT("HEIGHT"))) + if (tag.HasParam(wxT("HEIGHT"))) tag.GetParamAsInt(wxT("HEIGHT"), &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")) + if (alstr == wxT("TEXTTOP")) al = wxHTML_ALIGN_TOP; - else if ((alstr == wxT("CENTER")) || (alstr == wxT("ABSCENTER"))) + 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.GetChar(0) == wxT('#')) - { + if (mn.GetChar(0) == wxT('#')) + { mn = mn.Mid( 1 ); } } wxHtmlImageCell *cel = NULL; - if (str) - { + if (str) + { cel = new wxHtmlImageCell(str, w, h, m_WParser->GetPixelScale(), al, mn); cel->SetLink(m_WParser->GetLink()); m_WParser->GetContainer()->InsertCell(cel); @@ -436,12 +435,12 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA") } } } - if (tag.GetName() == wxT("MAP")) - { + if (tag.GetName() == wxT("MAP")) + { m_WParser->CloseContainer(); m_WParser->OpenContainer(); - if (tag.HasParam(wxT("NAME"))) - { + if (tag.HasParam(wxT("NAME"))) + { wxString tmp = tag.GetParam(wxT("NAME")); wxHtmlImageMapCell *cel = new wxHtmlImageMapCell( tmp ); m_WParser->GetContainer()->InsertCell( cel ); @@ -450,32 +449,32 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA") m_WParser->CloseContainer(); m_WParser->OpenContainer(); } - if (tag.GetName() == wxT("AREA")) - { - if (tag.HasParam(wxT("SHAPE"))) - { + if (tag.GetName() == wxT("AREA")) + { + if (tag.HasParam(wxT("SHAPE"))) + { wxString tmp = tag.GetParam(wxT("SHAPE")); wxString coords = wxEmptyString; tmp.MakeUpper(); wxHtmlImageMapAreaCell *cel = NULL; - if (tag.HasParam(wxT("COORDS"))) - { + if (tag.HasParam(wxT("COORDS"))) + { coords = tag.GetParam(wxT("COORDS")); } - if (tmp == wxT("POLY")) - { + if (tmp == wxT("POLY")) + { cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::POLY, coords, m_WParser->GetPixelScale() ); - } - else if (tmp == wxT("CIRCLE")) - { + } + else if (tmp == wxT("CIRCLE")) + { cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::CIRCLE, coords, m_WParser->GetPixelScale() ); - } - else if (tmp == wxT("RECT")) - { + } + else if (tmp == wxT("RECT")) + { cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::RECT, coords, m_WParser->GetPixelScale() ); } - if (cel != NULL && tag.HasParam(wxT("HREF"))) - { + if (cel != NULL && tag.HasParam(wxT("HREF"))) + { wxString tmp = tag.GetParam(wxT("HREF")); wxString target = wxEmptyString; if (tag.HasParam(wxT("TARGET"))) target = tag.GetParam(wxT("TARGET")); diff --git a/src/html/m_layout.cpp b/src/html/m_layout.cpp index c8fe7096be..edb2bd28f4 100644 --- a/src/html/m_layout.cpp +++ b/src/html/m_layout.cpp @@ -20,7 +20,6 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" #endif @@ -37,7 +36,7 @@ TAG_HANDLER_BEGIN(P, "P") TAG_HANDLER_PROC(tag) { if (m_WParser->GetContainer()->GetFirstCell() != NULL) - { + { m_WParser->CloseContainer(); m_WParser->OpenContainer(); } @@ -78,7 +77,7 @@ TAG_HANDLER_BEGIN(CENTER, "CENTER") m_WParser->SetAlign(wxHTML_ALIGN_CENTER); if (c->GetFirstCell() != NULL) - { + { m_WParser->CloseContainer(); m_WParser->OpenContainer(); } @@ -86,12 +85,12 @@ TAG_HANDLER_BEGIN(CENTER, "CENTER") c->SetAlignHor(wxHTML_ALIGN_CENTER); if (tag.HasEnding()) - { + { ParseInner(tag); m_WParser->SetAlign(old); if (c->GetFirstCell() != NULL) - { + { m_WParser->CloseContainer(); m_WParser->OpenContainer(); } @@ -114,7 +113,7 @@ TAG_HANDLER_BEGIN(DIV, "DIV") int old = m_WParser->GetAlign(); wxHtmlContainerCell *c = m_WParser->GetContainer(); if (c->GetFirstCell() != NULL) - { + { m_WParser->CloseContainer(); m_WParser->OpenContainer(); c = m_WParser->GetContainer(); @@ -122,7 +121,7 @@ TAG_HANDLER_BEGIN(DIV, "DIV") m_WParser->SetAlign(c->GetAlignHor()); } else - { + { c->SetAlign(tag); m_WParser->SetAlign(c->GetAlignHor()); } @@ -131,7 +130,7 @@ TAG_HANDLER_BEGIN(DIV, "DIV") m_WParser->SetAlign(old); if (c->GetFirstCell() != NULL) - { + { m_WParser->CloseContainer(); m_WParser->OpenContainer(); } @@ -151,10 +150,10 @@ TAG_HANDLER_BEGIN(TITLE, "TITLE") TAG_HANDLER_PROC(tag) { if (m_WParser->GetWindow()) - { + { wxHtmlWindow *wfr = (wxHtmlWindow*)(m_WParser->GetWindow()); if (wfr) - { + { wxString title = ""; wxString *src = m_WParser->GetSource(); @@ -177,7 +176,7 @@ TAG_HANDLER_BEGIN(BODY, "BODY") wxColour clr; if (tag.GetParamAsColour(wxT("TEXT"), &clr)) - { + { m_WParser->SetActualColor(clr); m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr)); } @@ -186,7 +185,7 @@ TAG_HANDLER_BEGIN(BODY, "BODY") m_WParser->SetLinkColor(clr); if (tag.GetParamAsColour(wxT("BGCOLOR"), &clr)) - { + { m_WParser->GetContainer()->InsertCell( new wxHtmlColourCell(clr, wxHTML_CLR_BACKGROUND)); if (m_WParser->GetWindow() != NULL) @@ -208,12 +207,12 @@ TAG_HANDLER_BEGIN(BLOCKQUOTE, "BLOCKQUOTE") m_WParser->CloseContainer(); c = m_WParser->OpenContainer(); - if (c->GetAlignHor() == wxHTML_ALIGN_RIGHT) + 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); + c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP); m_WParser->OpenContainer(); ParseInner(tag); c = m_WParser->CloseContainer(); diff --git a/src/html/m_links.cpp b/src/html/m_links.cpp index 4ac7d3251c..588180f01e 100644 --- a/src/html/m_links.cpp +++ b/src/html/m_links.cpp @@ -21,10 +21,8 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" #endif - #include "wx/html/forcelnk.h" #include "wx/html/m_templ.h" @@ -55,12 +53,12 @@ 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("HREF")) - { + if (tag.HasParam("HREF")) + { wxHtmlLinkInfo oldlnk = m_WParser->GetLink(); wxColour oldclr = m_WParser->GetActualColor(); int oldund = m_WParser->GetFontUnderlined(); diff --git a/src/html/m_list.cpp b/src/html/m_list.cpp index 292e8ccde0..cf6b010fae 100644 --- a/src/html/m_list.cpp +++ b/src/html/m_list.cpp @@ -21,10 +21,10 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" + #include "wx/brush.h" + #include "wx/dc.h" #endif - #include "wx/html/forcelnk.h" #include "wx/html/m_templ.h" @@ -86,10 +86,10 @@ TAG_HANDLER_BEGIN(OLULLI, "OL,UL,LI") wxHtmlContainerCell *c; // List Item: - if (tag.GetName() == wxT("LI")) - { - if (!tag.IsEnding()) - { + if (tag.GetName() == wxT("LI")) + { + if (!tag.IsEnding()) + { m_WParser->GetContainer()->SetIndent(0, wxHTML_INDENT_TOP); // this is to prevent indetation in
  • case m_WParser->CloseContainer(); @@ -100,8 +100,8 @@ TAG_HANDLER_BEGIN(OLULLI, "OL,UL,LI") c->SetAlignHor(wxHTML_ALIGN_RIGHT); if (m_Numbering == 0) c->InsertCell(new wxHtmlListmarkCell(m_WParser->GetDC(), m_WParser->GetActualColor())); - else - { + else + { wxString mark; mark.Printf(wxT("%i."), m_Numbering); c->InsertCell(new wxHtmlWordCell(mark, *(m_WParser->GetDC()))); @@ -120,16 +120,16 @@ TAG_HANDLER_BEGIN(OLULLI, "OL,UL,LI") } // Begin of List (not-numbered): "UL", "OL" - else - { + else + { int oldnum = m_Numbering; if (tag.GetName() == wxT("UL")) m_Numbering = 0; else m_Numbering = 1; c = m_WParser->GetContainer(); - if (c->GetFirstCell() != NULL) - { + if (c->GetFirstCell() != NULL) + { m_WParser->CloseContainer(); m_WParser->OpenContainer(); c = m_WParser->GetContainer(); diff --git a/src/html/m_meta.cpp b/src/html/m_meta.cpp index 50c100bc87..2c707c6c82 100644 --- a/src/html/m_meta.cpp +++ b/src/html/m_meta.cpp @@ -22,7 +22,6 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" #endif #include "wx/fontmap.h" @@ -39,14 +38,14 @@ TAG_HANDLER_BEGIN(META, "META") TAG_HANDLER_PROC(tag) { - if (tag.HasParam(_T("HTTP-EQUIV")) && + if (tag.HasParam(_T("HTTP-EQUIV")) && tag.GetParam(_T("HTTP-EQUIV")) == _T("Content-Type") && tag.HasParam(_T("CONTENT"))) { wxString content = tag.GetParam(_T("CONTENT")); if (content.Left(19) == _T("text/html; charset=")) { - wxFontEncoding enc = + wxFontEncoding enc = wxTheFontMapper->CharsetToEncoding(content.Mid(19)); if (enc == wxFONTENCODING_SYSTEM) return FALSE; if (enc == m_WParser->GetInputEncoding()) return FALSE; diff --git a/src/html/m_pre.cpp b/src/html/m_pre.cpp index a474a1ec38..f87983853a 100644 --- a/src/html/m_pre.cpp +++ b/src/html/m_pre.cpp @@ -20,10 +20,8 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" #endif - #include "wx/html/forcelnk.h" #include "wx/html/m_templ.h" @@ -65,7 +63,7 @@ TAG_HANDLER_BEGIN(PRE, "PRE") wxString src, srcMid; src = *m_WParser->GetSource(); - srcMid = src.Mid(tag.GetBeginPos(), + srcMid = src.Mid(tag.GetBeginPos(), tag.GetEndPos1() - tag.GetBeginPos()); srcMid.Replace(wxT("\t"), wxT(" ")); srcMid.Replace(wxT(" "), wxT(" ")); @@ -76,7 +74,7 @@ TAG_HANDLER_BEGIN(PRE, "PRE") m_Parser->SetSource(srcMid); m_Parser->DoParsing(); m_Parser->SetSource(src); - + m_WParser->CloseContainer(); c = m_WParser->OpenContainer(); diff --git a/src/html/m_tables.cpp b/src/html/m_tables.cpp index c4a0c6fe31..e6505e6898 100644 --- a/src/html/m_tables.cpp +++ b/src/html/m_tables.cpp @@ -20,7 +20,6 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" #endif @@ -49,9 +48,9 @@ FORCE_LINK_ME(m_tables) typedef struct { - int width, units; + int width, units; // universal - int leftpos, pixwidth, maxrealwidth; + int leftpos, pixwidth, maxrealwidth; // temporary (depends on width of table) } colStruct; @@ -126,11 +125,11 @@ wxHtmlTableCell::wxHtmlTableCell(wxHtmlContainerCell *parent, const wxHtmlTag& t m_ActualCol = m_ActualRow = -1; /* scan params: */ - if (tag.HasParam(wxT("BGCOLOR"))) + if (tag.HasParam(wxT("BGCOLOR"))) tag.GetParamAsColour(wxT("BGCOLOR"), &m_tBkg); - if (tag.HasParam(wxT("VALIGN"))) - m_tValign = tag.GetParam(wxT("VALIGN")); - else + if (tag.HasParam(wxT("VALIGN"))) + m_tValign = tag.GetParam(wxT("VALIGN")); + else m_tValign = wxEmptyString; if (!tag.GetParamAsInt(wxT("CELLSPACING"), &m_Spacing)) m_Spacing = 2; @@ -148,7 +147,7 @@ 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]); @@ -162,7 +161,7 @@ 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++) @@ -170,7 +169,7 @@ void wxHtmlTableCell::ReallocCols(int cols) } 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; @@ -184,11 +183,11 @@ void wxHtmlTableCell::ReallocCols(int cols) void wxHtmlTableCell::ReallocRows(int rows) { m_CellInfo = (cellStruct**) realloc(m_CellInfo, sizeof(cellStruct*) * rows); - for (int row = m_NumRows; row < rows ; row++) + for (int row = m_NumRows; row < rows ; row++) { - if (m_NumCols == 0) + if (m_NumCols == 0) m_CellInfo[row] = NULL; - else + else { m_CellInfo[row] = (cellStruct*) malloc(sizeof(cellStruct) * m_NumCols); for (int col = 0; col < m_NumCols; col++) @@ -208,11 +207,11 @@ void wxHtmlTableCell::AddRow(const wxHtmlTag& tag) // scan params: m_rBkg = m_tBkg; - if (tag.HasParam(wxT("BGCOLOR"))) + if (tag.HasParam(wxT("BGCOLOR"))) tag.GetParamAsColour(wxT("BGCOLOR"), &m_rBkg); - if (tag.HasParam(wxT("VALIGN"))) - m_rValign = tag.GetParam(wxT("VALIGN")); - else + if (tag.HasParam(wxT("VALIGN"))) + m_rValign = tag.GetParam(wxT("VALIGN")); + else m_rValign = m_tValign; } @@ -230,12 +229,12 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag) } // cells & columns: - do + do { m_ActualCol++; - } while ((m_ActualCol < m_NumCols) && + } while ((m_ActualCol < m_NumCols) && (m_CellInfo[m_ActualRow][m_ActualCol].flag != cellFree)); - + if (m_ActualCol > m_NumCols - 1) ReallocCols(m_ActualCol + 1); @@ -261,7 +260,7 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag) 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); @@ -275,13 +274,13 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag) { tag.GetParamAsInt(wxT("COLSPAN"), &m_CellInfo[r][c].colspan); tag.GetParamAsInt(wxT("ROWSPAN"), &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) + if (r + m_CellInfo[r][c].rowspan > m_NumRows) ReallocRows(r + m_CellInfo[r][c].rowspan); - if (c + m_CellInfo[r][c].colspan > m_NumCols) + if (c + m_CellInfo[r][c].colspan > m_NumCols) ReallocCols(c + m_CellInfo[r][c].colspan); for (i = r; i < r + m_CellInfo[r][c].rowspan; i++) for (j = c; j < c + m_CellInfo[r][c].colspan; j++) @@ -293,7 +292,7 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag) //background color: { wxColour bk = m_rBkg; - if (tag.HasParam(wxT("BGCOLOR"))) + if (tag.HasParam(wxT("BGCOLOR"))) tag.GetParamAsColour(wxT("BGCOLOR"), &bk); if (bk.Ok()) cell->SetBackgroundColour(bk); @@ -304,14 +303,14 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag) // vertical alignment: { wxString valign; - if (tag.HasParam(wxT("VALIGN"))) - valign = tag.GetParam(wxT("VALIGN")); - else + if (tag.HasParam(wxT("VALIGN"))) + valign = tag.GetParam(wxT("VALIGN")); + else valign = m_tValign; valign.MakeUpper(); - if (valign == wxT("TOP")) + if (valign == wxT("TOP")) m_CellInfo[r][c].valign = wxHTML_ALIGN_TOP; - else if (valign == wxT("BOTTOM")) + else if (valign == wxT("BOTTOM")) m_CellInfo[r][c].valign = wxHTML_ALIGN_BOTTOM; else m_CellInfo[r][c].valign = wxHTML_ALIGN_CENTER; } @@ -331,12 +330,12 @@ 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; @@ -379,7 +378,7 @@ 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; @@ -396,7 +395,7 @@ void wxHtmlTableCell::Layout(int w) ypos[0] = m_Spacing; for (actrow = 1; actrow <= m_NumRows; actrow++) ypos[actrow] = -1; - for (actrow = 0; actrow < m_NumRows; actrow++) + for (actrow = 0; actrow < m_NumRows; actrow++) { if (ypos[actrow] == -1) ypos[actrow] = ypos[actrow-1]; // 3a. sub-layout and detect max height: @@ -417,11 +416,11 @@ void wxHtmlTableCell::Layout(int w) } } - for (actrow = 0; actrow < m_NumRows; actrow++) + for (actrow = 0; actrow < m_NumRows; actrow++) { // 3b. place cells in row & let'em all have same height: - for (actcol = 0; actcol < m_NumCols; actcol++) + for (actcol = 0; actcol < m_NumCols; actcol++) { if (m_CellInfo[actrow][actcol].flag != cellUsed) continue; actcell = m_CellInfo[actrow][actcol].cont; @@ -471,7 +470,7 @@ 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; @@ -496,19 +495,19 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH") } - else if (m_Table && !tag.IsEnding()) + else if (m_Table && !tag.IsEnding()) { // new row in table - if (tag.GetName() == wxT("TR")) + if (tag.GetName() == wxT("TR")) { m_Table->AddRow(tag); m_rAlign = m_tAlign; - if (tag.HasParam(wxT("ALIGN"))) + if (tag.HasParam(wxT("ALIGN"))) m_rAlign = tag.GetParam(wxT("ALIGN")); } // new cell - else + else { m_WParser->SetAlign(m_OldAlign); c = m_WParser->SetContainer(new wxHtmlContainerCell(m_Table)); @@ -516,7 +515,7 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH") m_WParser->OpenContainer(); - if (tag.GetName() == wxT("TH")) /*header style*/ + if (tag.GetName() == wxT("TH")) /*header style*/ { m_WParser->SetAlign(wxHTML_ALIGN_CENTER); } @@ -525,12 +524,12 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH") wxString als; als = m_rAlign; - if (tag.HasParam(wxT("ALIGN"))) + if (tag.HasParam(wxT("ALIGN"))) als = tag.GetParam(wxT("ALIGN")); als.MakeUpper(); - if (als == wxT("RIGHT")) + if (als == wxT("RIGHT")) m_WParser->SetAlign(wxHTML_ALIGN_RIGHT); - else if (als == wxT("CENTER")) + else if (als == wxT("CENTER")) m_WParser->SetAlign(wxHTML_ALIGN_CENTER); } m_WParser->OpenContainer(); diff --git a/src/html/search.cpp b/src/html/search.cpp index bd7b156944..85a59a2b2e 100644 --- a/src/html/search.cpp +++ b/src/html/search.cpp @@ -23,13 +23,11 @@ #endif #ifndef WXPRECOMP -#include #endif #include "wx/html/helpdata.h" - //-------------------------------------------------------------------------------- // wxSearchEngine //-------------------------------------------------------------------------------- diff --git a/src/html/winpars.cpp b/src/html/winpars.cpp index e90c35f723..ce9bd29032 100644 --- a/src/html/winpars.cpp +++ b/src/html/winpars.cpp @@ -22,7 +22,8 @@ #endif #ifndef WXPRECOMP -#include "wx/wx.h" + #include "wx/intl.h" + #include "wx/dc.h" #endif #include "wx/html/htmldefs.h" -- 2.45.2