/*
-REMARKS :
+REMARKS :
This FS creates local cache (in /tmp directory). The cache is freed
on program exit.
#if wxUSE_FILESYSTEM && wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS
-#ifndef WXPRECOMP
-#include "wx/wx.h"
-#endif
-
#include "wx/filesys.h"
-
//--------------------------------------------------------------------------------
// wxInternetFSHandler
//--------------------------------------------------------------------------------
#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
//--------------------------------------------------------------------------------
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
#if wxUSE_FILESYSTEM && wxUSE_FS_ZIP && wxUSE_STREAMS
-
-#ifndef WXPRECOMP
-#include "wx/wx.h"
-#endif
-
#include "wx/filesys.h"
class WXDLLEXPORT wxHashTableLong;
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();
};
#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
// 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
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);
#pragma interface "helpxlp.h"
#endif
-#include <stdio.h>
-#include "wx/wx.h"
+#include "wx/defs.h"
#if wxUSE_HELP
// 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);
#endif
#include "wx/defs.h"
+
#if wxUSE_HTML
+#include "wx/object.h"
+
+class WXDLLEXPORT wxColour;
class WXDLLEXPORT wxHtmlEntitiesParser;
//-----------------------------------------------------------------------------
// 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);
// (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;
#define _WX_M_TEMPL_H_
#include "wx/defs.h"
-#if wxUSE_HTML
-
-
-#ifdef __GNUG__
-#pragma interface "m_templ.h"
-#pragma implementation
-#endif
-
-#include <wx/wxprec.h>
-
-#ifdef __BORDLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WXPRECOMP
-#include <wx/wx.h>
-#endif
-
-
+#if wxUSE_HTML
#include "wx/html/winpars.h"
-
#define TAG_HANDLER_BEGIN(name,tags) \
class HTML_Handler_##name : public wxHtmlWinTagHandler \
{ \
#if wxUSE_FILESYSTEM && wxUSE_FS_INET
#ifndef WXPRECOMP
-#include "wx/wx.h"
#endif
#include "wx/wfstream.h"
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;
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);
if (info == NULL)
{
wxURL url(right);
- if (url.GetError() == wxURL_NOERR)
+ if (url.GetError() == wxURL_NOERR)
{
s = url.GetInputStream();
content = url.GetProtocol().GetContentType();
#if wxUSE_FILESYSTEM && wxUSE_STREAMS
#ifndef WXPRECOMP
-#include "wx/wx.h"
+ #include "wx/intl.h"
+ #include "wx/log.h"
#endif
#include "wx/filesys.h"
class MemFSHashObj : public wxObject
{
public:
-
+
MemFSHashObj(const void *data, size_t len)
{
m_Data = new char[len];
m_Len = len;
m_Time = wxDateTime::Now();
}
-
+
MemFSHashObj(wxMemoryOutputStream& stream)
{
m_Len = stream.GetSize();
stream.CopyTo(m_Data, m_Len);
m_Time = wxDateTime::Now();
}
-
+
~MemFSHashObj()
{
delete[] m_Data;
}
-
+
char *m_Data;
size_t m_Len;
wxDateTime m_Time;
// 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;
}
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;
{
if (!CheckHash(filename)) return;
-
+
wxMemoryOutputStream mems;
if (image.Ok() && image.SaveFile(mems, (int)type))
m_Hash -> Put(filename, new MemFSHashObj(mems));
#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"
#if wxUSE_TOOLBAR
#ifndef WX_PRECOMP
- #include "wx/wx.h"
#endif
#include "wx/frame.h"
#endif
#ifndef WX_PRECOMP
- #include "wx/setup.h"
- #include "wx/defs.h"
#endif // WX_PRECOMP
#if wxUSE_PRINTING_ARCHITECTURE
#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"
#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
// ----------------------------------------------------------------------------
#endif
#ifndef WX_PRECOMP
-#include "wx/mdi.h"
+ #include "wx/frame.h"
+ #include "wx/mdi.h"
#endif
#include "wx/laywin.h"
#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)
{
#pragma hdrstop
#endif
-#include "wx/defs.h"
-
#if wxUSE_PRINTING_ARCHITECTURE
#ifndef WX_PRECOMP
#if wxUSE_PROPSHEET
#ifndef WX_PRECOMP
-#include "wx/wx.h"
#endif
#include "wx/debug.h"
#if wxUSE_PROPSHEET
#ifndef WX_PRECOMP
-#include "wx/wx.h"
#endif
#include "wx/propform.h"
#if wxUSE_SASH
#ifndef WX_PRECOMP
-#include "wx/wx.h"
+ #include "wx/dialog.h"
+ #include "wx/frame.h"
+ #include "wx/settings.h"
#endif
#include <math.h>
#include <stdlib.h>
-#include "wx/string.h"
#include "wx/dcscreen.h"
#include "wx/sashwin.h"
#include "wx/laywin.h"
// Created: 28/6/2000
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#if wxUSE_SPLASH
#ifndef WX_PRECOMP
-#include "wx/wx.h"
#endif
#include "wx/splash.h"
#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"
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);
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);
#if 0
if (!m_Page.IsEmpty())
/* Valid HHW's file may contain only two object tags:
-
+
<OBJECT type="text/site properties">
<param name="ImageType" value="Folder">
</OBJECT>
-
+
or
-
- <OBJECT type="text/sitemap">
- <param name="Name" value="main page">
- <param name="Local" value="another.htm">
- </OBJECT>
-
+
+ <OBJECT type="text/sitemap">
+ <param name="Name" value="main page">
+ <param name="Local" value="another.htm">
+ </OBJECT>
+
We're interested in the latter. !m_Page.IsEmpty() is valid
condition because text/site properties does not contain Local param
*/
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;
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;
}
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;
}
parser.AddTagHandler(handler);
f = ( contentsfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(contentsfile) );
- if (f)
+ if (f)
{
sz = f->GetStream()->GetSize();
buf = new char[sz + 1];
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];
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);
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];
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);
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);
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;
wxFileSystem fsys;
wxFSFile *fi;
wxHtmlBookRecord *bookr;
-
+
int IndexOld = m_IndexCnt,
ContentsOld = m_ContentsCnt;
// 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)
{
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++)
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;
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;
wxString title = _("noname"),
safetitle,
start = wxEmptyString,
- contents = wxEmptyString,
+ contents = wxEmptyString,
index = wxEmptyString,
charset = wxEmptyString;
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;
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;
/* 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;
/* 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;
}
/* 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;
}
/* 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;
}
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;
}
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();
// 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;
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);
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;
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;
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');
- }
- }
+ }
+ }
}
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; }
#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"
// 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);
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;
-void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link)
+void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link)
{
if (m_Link) delete m_Link;
m_Link = NULL;
-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;
}
m_LastLayout = -1;
}
-wxHtmlContainerCell::~wxHtmlContainerCell()
+wxHtmlContainerCell::~wxHtmlContainerCell()
{
if (m_Cells) delete m_Cells;
}
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();
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;
*/
- 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;
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;
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),
// 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();
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);
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);
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);
}
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();
void wxHtmlContainerCell::InsertCell(wxHtmlCell *f)
{
if (!m_Cells) m_Cells = m_LastCell = f;
- else
+ else
{
m_LastCell->SetNext(f);
m_LastCell = 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();
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);
{
const wxHtmlCell *r = NULL;
- if (m_Cells)
+ if (m_Cells)
{
r = m_Cells->Find(condition, param);
if (r) return r;
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;
{
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);
{
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);
int absx = 0, absy = 0, stx, sty;
wxHtmlCell *c = this;
- while (c)
+ while (c)
{
absx += c->GetPosX();
absy += c->GetPosY();
int absx = 0, absy = 0, stx, sty;
wxHtmlCell *c = this;
- while (c)
+ while (c)
{
absx += c->GetPosX();
absy += c->GetPosY();
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);
#endif
#ifndef WXPRECOMP
-#include "wx/wx.h"
+ #include "wx/log.h"
+ #include "wx/intl.h"
#endif
#include "wx/html/htmlfilt.h"
char *src;
wxString doc;
- if (s == NULL)
+ if (s == NULL)
{
wxLogError(_("Cannot open HTML document: %s"), file.GetLocation().c_str());
return wxEmptyString;
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("<meta http-equiv=\"Content-Type\" content=\""));
#endif
#ifndef WXPRECOMP
-#include "wx/wx.h"
#endif
#include "wx/html/htmlfilter.h"
#endif
#ifndef WXPRECOMP
-#include <wx/wx.h>
#endif
-
#include <wx/notebook.h>
#include <wx/imaglist.h>
#include <wx/treectrl.h>
#endif
#ifndef WXPRECOMP
-#include "wx/wx.h"
+ #include "wx/log.h"
+ #include "wx/intl.h"
#endif
#include "wx/tokenzr.h"
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;
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);
}
}
- if (templen)
+ if (templen)
{ // last word of block :-(
temp[templen] = 0;
AddText(temp);
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());
wxStringTokenizer tokenizer(tags, ", ");
wxString key;
- if (m_HandlersStack == NULL)
+ if (m_HandlersStack == NULL)
{
m_HandlersStack = new wxList;
m_HandlersStack->DeleteContents(TRUE);
m_HandlersStack->Insert(new wxHashTable(m_HandlersHash));
- while (tokenizer.HasMoreTokens())
+ while (tokenizer.HasMoreTokens())
{
key = tokenizer.NextToken();
m_HandlersHash.Delete(key);
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;
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('&'))
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");
{ 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
#endif
#ifndef WXPRECOMP
-#include "wx/wx.h"
#endif
#include "wx/html/htmltag.h"
#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"
//-----------------------------------------------------------------------------
#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
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);
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();
}
{
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);
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)
bool wxHtmlPrintout::OnPrintPage(int page)
{
wxDC *dc = GetDC();
- if (dc)
+ if (dc)
{
if (HasPage(page))
RenderPage(dc, page);
return TRUE;
- }
+ }
else return FALSE;
}
{
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);
}
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;
}
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;
}
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;
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));
{
wxString r = instr;
wxString num;
-
+
num.Printf(wxT("%i"), page);
r.Replace(wxT("@PAGENUM@"), num);
#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));
}
// 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();
{
wxPrintDialogData printDialogData(*m_PrintData);
wxPrintDialog printerDialog(m_Frame, &printDialogData);
-
+
printerDialog.GetPrintDialogData().SetSetupDialog(TRUE);
if (printerDialog.ShowModal() == wxID_OK)
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();
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;
}
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;
}
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);
m_PageSetupData->GetMarginBottomRight().y,
m_PageSetupData->GetMarginTopLeft().x,
m_PageSetupData->GetMarginBottomRight().x);
-
+
return p;
}
#endif
#ifndef WXPRECOMP
-#include "wx/wx.h"
#endif
-
#include "wx/html/forcelnk.h"
#include "wx/html/m_templ.h"
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();
}
ParseInner(tag);
- if (m_WParser->GetContainer()->GetFirstCell() != NULL)
- {
+ if (m_WParser->GetContainer()->GetFirstCell() != NULL)
+ {
m_WParser->CloseContainer();
m_WParser->OpenContainer();
}
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);
}
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;
}
#endif
#ifndef WXPRECOMP
-#include "wx/wx.h"
#endif
#include "wx/html/forcelnk.h"
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
}
if (tag.HasParam(wxT("FACE")))
- {
+ {
if (m_Faces.GetCount() == 0)
- {
+ {
wxFontEnumerator enu;
enu.EnumerateFacenames();
m_Faces = *enu.GetFacenames();
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));
}
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);
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);
c = m_WParser->GetContainer();
if (c->GetFirstCell())
- {
+ {
m_WParser->CloseContainer();
m_WParser->OpenContainer();
c = m_WParser->GetContainer();
#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"
#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"
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 );
wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
{
- switch (type)
+ switch (type)
{
case RECT:
{
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;
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;
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]) /
}
}
}
- 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 );
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;
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();
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;
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);
}
{
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 );
}
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 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);
}
}
}
- 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 );
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"));
#endif
#ifndef WXPRECOMP
-#include "wx/wx.h"
#endif
TAG_HANDLER_PROC(tag)
{
if (m_WParser->GetContainer()->GetFirstCell() != NULL)
- {
+ {
m_WParser->CloseContainer();
m_WParser->OpenContainer();
}
m_WParser->SetAlign(wxHTML_ALIGN_CENTER);
if (c->GetFirstCell() != NULL)
- {
+ {
m_WParser->CloseContainer();
m_WParser->OpenContainer();
}
c->SetAlignHor(wxHTML_ALIGN_CENTER);
if (tag.HasEnding())
- {
+ {
ParseInner(tag);
m_WParser->SetAlign(old);
if (c->GetFirstCell() != NULL)
- {
+ {
m_WParser->CloseContainer();
m_WParser->OpenContainer();
}
int old = m_WParser->GetAlign();
wxHtmlContainerCell *c = m_WParser->GetContainer();
if (c->GetFirstCell() != NULL)
- {
+ {
m_WParser->CloseContainer();
m_WParser->OpenContainer();
c = m_WParser->GetContainer();
m_WParser->SetAlign(c->GetAlignHor());
}
else
- {
+ {
c->SetAlign(tag);
m_WParser->SetAlign(c->GetAlignHor());
}
m_WParser->SetAlign(old);
if (c->GetFirstCell() != NULL)
- {
+ {
m_WParser->CloseContainer();
m_WParser->OpenContainer();
}
TAG_HANDLER_PROC(tag)
{
if (m_WParser->GetWindow())
- {
+ {
wxHtmlWindow *wfr = (wxHtmlWindow*)(m_WParser->GetWindow());
if (wfr)
- {
+ {
wxString title = "";
wxString *src = m_WParser->GetSource();
wxColour clr;
if (tag.GetParamAsColour(wxT("TEXT"), &clr))
- {
+ {
m_WParser->SetActualColor(clr);
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr));
}
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)
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();
#endif
#ifndef WXPRECOMP
-#include "wx/wx.h"
#endif
-
#include "wx/html/forcelnk.h"
#include "wx/html/m_templ.h"
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();
#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"
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 <li><p> case
m_WParser->CloseContainer();
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())));
}
// 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();
#endif
#ifndef WXPRECOMP
-#include "wx/wx.h"
#endif
#include "wx/fontmap.h"
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;
#endif
#ifndef WXPRECOMP
-#include "wx/wx.h"
#endif
-
#include "wx/html/forcelnk.h"
#include "wx/html/m_templ.h"
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(" "));
m_Parser->SetSource(srcMid);
m_Parser->DoParsing();
m_Parser->SetSource(src);
-
+
m_WParser->CloseContainer();
c = m_WParser->OpenContainer();
#endif
#ifndef WXPRECOMP
-#include "wx/wx.h"
#endif
typedef struct {
- int width, units;
+ int width, units;
// universal
- int leftpos, pixwidth, maxrealwidth;
+ int leftpos, pixwidth, maxrealwidth;
// temporary (depends on width of table)
} colStruct;
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;
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]);
{
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_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;
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++)
// 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;
}
}
// 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);
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);
{
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++)
//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);
// 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;
}
*/
- 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;
/* 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;
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:
}
}
- 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;
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;
}
- 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));
m_WParser->OpenContainer();
- if (tag.GetName() == wxT("TH")) /*header style*/
+ if (tag.GetName() == wxT("TH")) /*header style*/
{
m_WParser->SetAlign(wxHTML_ALIGN_CENTER);
}
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();
#endif
#ifndef WXPRECOMP
-#include <wx/wx.h>
#endif
#include "wx/html/helpdata.h"
-
//--------------------------------------------------------------------------------
// wxSearchEngine
//--------------------------------------------------------------------------------
#endif
#ifndef WXPRECOMP
-#include "wx/wx.h"
+ #include "wx/intl.h"
+ #include "wx/dc.h"
#endif
#include "wx/html/htmldefs.h"