wxHTML src code indentation now conforms (more) to wxWin coding style
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8694 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -79,7 +79,8 @@ bool wxHtmlHelpController::AddBook(const wxString& book, bool show_wait_msg)
|
|||||||
#if wxUSE_BUSYINFO
|
#if wxUSE_BUSYINFO
|
||||||
wxBusyInfo* busy = NULL;
|
wxBusyInfo* busy = NULL;
|
||||||
wxString info;
|
wxString info;
|
||||||
if (show_wait_msg) {
|
if (show_wait_msg)
|
||||||
|
{
|
||||||
info.Printf(_("Adding book %s"), book.c_str());
|
info.Printf(_("Adding book %s"), book.c_str());
|
||||||
busy = new wxBusyInfo(info);
|
busy = new wxBusyInfo(info);
|
||||||
}
|
}
|
||||||
@@ -102,7 +103,8 @@ wxHtmlHelpFrame *wxHtmlHelpController::CreateHelpFrame(wxHtmlHelpData *data)
|
|||||||
|
|
||||||
void wxHtmlHelpController::CreateHelpWindow()
|
void wxHtmlHelpController::CreateHelpWindow()
|
||||||
{
|
{
|
||||||
if (m_helpFrame) {
|
if (m_helpFrame)
|
||||||
|
{
|
||||||
m_helpFrame->Raise();
|
m_helpFrame->Raise();
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
@@ -93,7 +93,9 @@ class HP_TagHandler : public wxHtmlTagHandler
|
|||||||
wxHtmlBookRecord *m_Book;
|
wxHtmlBookRecord *m_Book;
|
||||||
|
|
||||||
public:
|
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"); }
|
wxString GetSupportedTags() { return wxT("UL,OBJECT,PARAM"); }
|
||||||
bool HandleTag(const wxHtmlTag& tag);
|
bool HandleTag(const wxHtmlTag& tag);
|
||||||
void WriteOut(wxHtmlContentsItem*& array, int& size);
|
void WriteOut(wxHtmlContentsItem*& array, int& size);
|
||||||
@@ -103,13 +105,15 @@ class HP_TagHandler : public wxHtmlTagHandler
|
|||||||
|
|
||||||
bool HP_TagHandler::HandleTag(const wxHtmlTag& tag)
|
bool HP_TagHandler::HandleTag(const wxHtmlTag& tag)
|
||||||
{
|
{
|
||||||
if (tag.GetName() == wxT("UL")) {
|
if (tag.GetName() == wxT("UL"))
|
||||||
|
{
|
||||||
m_Level++;
|
m_Level++;
|
||||||
ParseInner(tag);
|
ParseInner(tag);
|
||||||
m_Level--;
|
m_Level--;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (tag.GetName() == wxT("OBJECT")) {
|
else if (tag.GetName() == wxT("OBJECT"))
|
||||||
|
{
|
||||||
m_Name = m_Page = wxEmptyString;
|
m_Name = m_Page = wxEmptyString;
|
||||||
ParseInner(tag);
|
ParseInner(tag);
|
||||||
|
|
||||||
@@ -147,7 +151,8 @@ bool HP_TagHandler::HandleTag(const wxHtmlTag& tag)
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else { // "PARAM"
|
else
|
||||||
|
{ // "PARAM"
|
||||||
if (m_Name == wxEmptyString && tag.GetParam(wxT("NAME")) == wxT("Name"))
|
if (m_Name == wxEmptyString && tag.GetParam(wxT("NAME")) == wxT("Name"))
|
||||||
{
|
{
|
||||||
m_Name = tag.GetParam(wxT("VALUE"));
|
m_Name = tag.GetParam(wxT("VALUE"));
|
||||||
@@ -310,15 +315,19 @@ wxHtmlHelpData::~wxHtmlHelpData()
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
m_BookRecords.Empty();
|
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_Page;
|
||||||
delete[] m_Contents[i].m_Name;
|
delete[] m_Contents[i].m_Name;
|
||||||
}
|
}
|
||||||
free(m_Contents);
|
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_Page;
|
||||||
delete[] m_Index[i].m_Name;
|
delete[] m_Index[i].m_Name;
|
||||||
}
|
}
|
||||||
@@ -338,7 +347,8 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c
|
|||||||
parser.AddTagHandler(handler);
|
parser.AddTagHandler(handler);
|
||||||
|
|
||||||
f = ( contentsfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(contentsfile) );
|
f = ( contentsfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(contentsfile) );
|
||||||
if (f) {
|
if (f)
|
||||||
|
{
|
||||||
sz = f->GetStream()->GetSize();
|
sz = f->GetStream()->GetSize();
|
||||||
buf = new char[sz + 1];
|
buf = new char[sz + 1];
|
||||||
buf[sz] = 0;
|
buf[sz] = 0;
|
||||||
@@ -353,7 +363,8 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c
|
|||||||
wxLogError(_("Cannot open contents file: %s"), contentsfile.c_str());
|
wxLogError(_("Cannot open contents file: %s"), contentsfile.c_str());
|
||||||
|
|
||||||
f = ( indexfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(indexfile) );
|
f = ( indexfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(indexfile) );
|
||||||
if (f) {
|
if (f)
|
||||||
|
{
|
||||||
sz = f->GetStream()->GetSize();
|
sz = f->GetStream()->GetSize();
|
||||||
buf = new char[sz + 1];
|
buf = new char[sz + 1];
|
||||||
buf[sz] = 0;
|
buf[sz] = 0;
|
||||||
@@ -413,7 +424,8 @@ bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f)
|
|||||||
m_Contents = (wxHtmlContentsItem*) realloc(m_Contents,
|
m_Contents = (wxHtmlContentsItem*) realloc(m_Contents,
|
||||||
(m_ContentsCnt / wxHTML_REALLOC_STEP + 1) *
|
(m_ContentsCnt / wxHTML_REALLOC_STEP + 1) *
|
||||||
wxHTML_REALLOC_STEP * sizeof(wxHtmlContentsItem));
|
wxHTML_REALLOC_STEP * sizeof(wxHtmlContentsItem));
|
||||||
for (i = st; i < m_ContentsCnt; i++) {
|
for (i = st; i < m_ContentsCnt; i++)
|
||||||
|
{
|
||||||
f->Read(&x, sizeof(x));
|
f->Read(&x, sizeof(x));
|
||||||
m_Contents[i].m_Level = wxINT32_SWAP_ON_BE(x);
|
m_Contents[i].m_Level = wxINT32_SWAP_ON_BE(x);
|
||||||
f->Read(&x, sizeof(x));
|
f->Read(&x, sizeof(x));
|
||||||
@@ -434,7 +446,8 @@ bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f)
|
|||||||
m_IndexCnt += wxINT32_SWAP_ON_BE(x);
|
m_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));
|
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);
|
f->Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x);
|
||||||
m_Index[i].m_Name = new wxChar[x];
|
m_Index[i].m_Name = new wxChar[x];
|
||||||
READ_STRING(f, m_Index[i].m_Name, x);
|
READ_STRING(f, m_Index[i].m_Name, x);
|
||||||
@@ -463,7 +476,8 @@ bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f)
|
|||||||
for (i = 0; i < m_ContentsCnt; i++) if (m_Contents[i].m_Book == book && m_Contents[i].m_Level > 0) x++;
|
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);
|
x = wxINT32_SWAP_ON_BE(x);
|
||||||
f->Write(&x, sizeof(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;
|
if (m_Contents[i].m_Book != book || m_Contents[i].m_Level == 0) continue;
|
||||||
x = wxINT32_SWAP_ON_BE(m_Contents[i].m_Level);
|
x = wxINT32_SWAP_ON_BE(m_Contents[i].m_Level);
|
||||||
f->Write(&x, sizeof(x));
|
f->Write(&x, sizeof(x));
|
||||||
@@ -483,7 +497,8 @@ bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f)
|
|||||||
for (i = 0; i < m_IndexCnt; i++) if (m_Index[i].m_Book == book && m_Index[i].m_Level > 0) x++;
|
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);
|
x = wxINT32_SWAP_ON_BE(x);
|
||||||
f->Write(&x, sizeof(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;
|
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);
|
x = wxINT32_SWAP_ON_BE(wxStrlen(m_Index[i].m_Name) + 1);
|
||||||
f->Write(&x, sizeof(x));
|
f->Write(&x, sizeof(x));
|
||||||
@@ -499,7 +514,8 @@ bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f)
|
|||||||
void wxHtmlHelpData::SetTempDir(const wxString& path)
|
void wxHtmlHelpData::SetTempDir(const wxString& path)
|
||||||
{
|
{
|
||||||
if (path == wxEmptyString) m_TempPath = path;
|
if (path == wxEmptyString) m_TempPath = path;
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
if (wxIsAbsolutePath(path)) m_TempPath = path;
|
if (wxIsAbsolutePath(path)) m_TempPath = path;
|
||||||
else m_TempPath = wxGetCwd() + _T("/") + path;
|
else m_TempPath = wxGetCwd() + _T("/") + path;
|
||||||
|
|
||||||
@@ -702,9 +718,11 @@ wxString wxHtmlHelpData::FindPageByName(const wxString& x)
|
|||||||
/* 1. try to open given file: */
|
/* 1. try to open given file: */
|
||||||
|
|
||||||
cnt = m_BookRecords.GetCount();
|
cnt = m_BookRecords.GetCount();
|
||||||
for (i = 0; i < cnt; i++) {
|
for (i = 0; i < cnt; i++)
|
||||||
|
{
|
||||||
f = fsys.OpenFile(m_BookRecords[i].GetBasePath() + x);
|
f = fsys.OpenFile(m_BookRecords[i].GetBasePath() + x);
|
||||||
if (f) {
|
if (f)
|
||||||
|
{
|
||||||
url = m_BookRecords[i].GetBasePath() + x;
|
url = m_BookRecords[i].GetBasePath() + x;
|
||||||
delete f;
|
delete f;
|
||||||
return url;
|
return url;
|
||||||
@@ -714,8 +732,10 @@ wxString wxHtmlHelpData::FindPageByName(const wxString& x)
|
|||||||
|
|
||||||
/* 2. try to find a book: */
|
/* 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].GetBasePath() + m_BookRecords[i].GetStart();
|
url = m_BookRecords[i].GetBasePath() + m_BookRecords[i].GetStart();
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
@@ -724,8 +744,10 @@ wxString wxHtmlHelpData::FindPageByName(const wxString& x)
|
|||||||
/* 3. try to find in contents: */
|
/* 3. try to find in contents: */
|
||||||
|
|
||||||
cnt = m_ContentsCnt;
|
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].m_Book->GetBasePath() + m_Contents[i].m_Page;
|
url = m_Contents[i].m_Book->GetBasePath() + m_Contents[i].m_Page;
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
@@ -735,8 +757,10 @@ wxString wxHtmlHelpData::FindPageByName(const wxString& x)
|
|||||||
/* 4. try to find in index: */
|
/* 4. try to find in index: */
|
||||||
|
|
||||||
cnt = m_IndexCnt;
|
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].m_Book->GetBasePath() + m_Index[i].m_Page;
|
url = m_Index[i].m_Book->GetBasePath() + m_Index[i].m_Page;
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
@@ -750,8 +774,10 @@ wxString wxHtmlHelpData::FindPageById(int id)
|
|||||||
int i;
|
int i;
|
||||||
wxString url(wxEmptyString);
|
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].m_Book->GetBasePath() + m_Contents[i].m_Page;
|
url = m_Contents[i].m_Book->GetBasePath() + m_Contents[i].m_Page;
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
@@ -771,11 +797,13 @@ wxHtmlSearchStatus::wxHtmlSearchStatus(wxHtmlHelpData* data, const wxString& key
|
|||||||
m_Data = data;
|
m_Data = data;
|
||||||
m_Keyword = keyword;
|
m_Keyword = keyword;
|
||||||
wxHtmlBookRecord* bookr = NULL;
|
wxHtmlBookRecord* bookr = NULL;
|
||||||
if (book != wxEmptyString) {
|
if (book != wxEmptyString)
|
||||||
|
{
|
||||||
// we have to search in a specific book. Find it first
|
// we have to search in a specific book. Find it first
|
||||||
int i, cnt = data->m_BookRecords.GetCount();
|
int i, cnt = data->m_BookRecords.GetCount();
|
||||||
for (i = 0; i < cnt; i++)
|
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]);
|
bookr = &(data->m_BookRecords[i]);
|
||||||
m_CurIndex = bookr->GetContentsStart();
|
m_CurIndex = bookr->GetContentsStart();
|
||||||
m_MaxIndex = bookr->GetContentsEnd();
|
m_MaxIndex = bookr->GetContentsEnd();
|
||||||
@@ -784,7 +812,8 @@ wxHtmlSearchStatus::wxHtmlSearchStatus(wxHtmlHelpData* data, const wxString& key
|
|||||||
// check; we won't crash if the book doesn't exist, but it's Bad Anyway.
|
// check; we won't crash if the book doesn't exist, but it's Bad Anyway.
|
||||||
wxASSERT(bookr);
|
wxASSERT(bookr);
|
||||||
}
|
}
|
||||||
if (! bookr) {
|
if (! bookr)
|
||||||
|
{
|
||||||
// no book specified; search all books
|
// no book specified; search all books
|
||||||
m_CurIndex = 0;
|
m_CurIndex = 0;
|
||||||
m_MaxIndex = m_Data->m_ContentsCnt;
|
m_MaxIndex = m_Data->m_ContentsCnt;
|
||||||
@@ -801,7 +830,8 @@ bool wxHtmlSearchStatus::Search()
|
|||||||
bool found = FALSE;
|
bool found = FALSE;
|
||||||
wxChar *thepage;
|
wxChar *thepage;
|
||||||
|
|
||||||
if (!m_Active) {
|
if (!m_Active)
|
||||||
|
{
|
||||||
// sanity check. Illegal use, but we'll try to prevent a crash anyway
|
// sanity check. Illegal use, but we'll try to prevent a crash anyway
|
||||||
wxASSERT(m_Active);
|
wxASSERT(m_Active);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -860,10 +890,14 @@ void wxSearchEngine::LookFor(const wxString& keyword, bool case_sensitive, bool
|
|||||||
wxStrcpy(m_Keyword, keyword.c_str());
|
wxStrcpy(m_Keyword, keyword.c_str());
|
||||||
|
|
||||||
if (!m_CaseSensitive)
|
if (!m_CaseSensitive)
|
||||||
|
{
|
||||||
for (int i = wxStrlen(m_Keyword) - 1; i >= 0; i--)
|
for (int i = wxStrlen(m_Keyword) - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
if ((m_Keyword[i] >= wxT('A')) && (m_Keyword[i] <= wxT('Z')))
|
if ((m_Keyword[i] >= wxT('A')) && (m_Keyword[i] <= wxT('Z')))
|
||||||
m_Keyword[i] += wxT('a') - wxT('A');
|
m_Keyword[i] += wxT('a') - wxT('A');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -887,7 +921,8 @@ bool wxSearchEngine::Scan(wxInputStream *stream)
|
|||||||
|
|
||||||
if (m_WholeWords)
|
if (m_WholeWords)
|
||||||
{
|
{
|
||||||
for (i = 0; i < lng - wrd; i++) {
|
for (i = 0; i < lng - wrd; i++)
|
||||||
|
{
|
||||||
if (WHITESPACE(buf[i])) continue;
|
if (WHITESPACE(buf[i])) continue;
|
||||||
j = 0;
|
j = 0;
|
||||||
while ((j < wrd) && (buf[i + j] == m_Keyword[j])) j++;
|
while ((j < wrd) && (buf[i + j] == m_Keyword[j])) j++;
|
||||||
@@ -897,7 +932,8 @@ bool wxSearchEngine::Scan(wxInputStream *stream)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < lng - wrd; i++) {
|
for (i = 0; i < lng - wrd; i++)
|
||||||
|
{
|
||||||
j = 0;
|
j = 0;
|
||||||
while ((j < wrd) && (buf[i + j] == m_Keyword[j])) j++;
|
while ((j < wrd) && (buf[i + j] == m_Keyword[j])) j++;
|
||||||
if (j == wrd) { found = TRUE; break; }
|
if (j == wrd) { found = TRUE; break; }
|
||||||
|
@@ -135,10 +135,12 @@ wxHtmlHelpFrame::wxHtmlHelpFrame(wxWindow* parent, wxWindowID id, const wxString
|
|||||||
|
|
||||||
void wxHtmlHelpFrame::Init(wxHtmlHelpData* data)
|
void wxHtmlHelpFrame::Init(wxHtmlHelpData* data)
|
||||||
{
|
{
|
||||||
if (data) {
|
if (data)
|
||||||
|
{
|
||||||
m_Data = data;
|
m_Data = data;
|
||||||
m_DataCreated = FALSE;
|
m_DataCreated = FALSE;
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
m_Data = new wxHtmlHelpData();
|
m_Data = new wxHtmlHelpData();
|
||||||
m_DataCreated = TRUE;
|
m_DataCreated = TRUE;
|
||||||
}
|
}
|
||||||
@@ -216,7 +218,8 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti
|
|||||||
CreateStatusBar();
|
CreateStatusBar();
|
||||||
|
|
||||||
// toolbar?
|
// toolbar?
|
||||||
if (style & (wxHF_TOOLBAR | wxHF_FLATTOOLBAR)) {
|
if (style & (wxHF_TOOLBAR | wxHF_FLATTOOLBAR))
|
||||||
|
{
|
||||||
wxToolBar *toolBar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL |
|
wxToolBar *toolBar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL |
|
||||||
wxTB_DOCKABLE |
|
wxTB_DOCKABLE |
|
||||||
(style & wxHF_FLATTOOLBAR ? wxTB_FLAT : 0));
|
(style & wxHF_FLATTOOLBAR ? wxTB_FLAT : 0));
|
||||||
@@ -225,7 +228,8 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti
|
|||||||
toolBar->Realize();
|
toolBar->Realize();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style & (wxHF_CONTENTS | wxHF_INDEX | wxHF_SEARCH)) {
|
if (style & (wxHF_CONTENTS | wxHF_INDEX | wxHF_SEARCH))
|
||||||
|
{
|
||||||
// traditional help controller; splitter window with html page on the
|
// traditional help controller; splitter window with html page on the
|
||||||
// right and a notebook containing various pages on the left
|
// right and a notebook containing various pages on the left
|
||||||
m_Splitter = new wxSplitterWindow(this);
|
m_Splitter = new wxSplitterWindow(this);
|
||||||
@@ -233,7 +237,9 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti
|
|||||||
m_HtmlWin = new wxHtmlHelpHtmlWindow(this, m_Splitter);
|
m_HtmlWin = new wxHtmlHelpHtmlWindow(this, m_Splitter);
|
||||||
m_NavigPan = new wxNotebook(m_Splitter, wxID_HTML_NOTEBOOK,
|
m_NavigPan = new wxNotebook(m_Splitter, wxID_HTML_NOTEBOOK,
|
||||||
wxDefaultPosition, wxDefaultSize);
|
wxDefaultPosition, wxDefaultSize);
|
||||||
} else { // only html window, no notebook with index,contents etc
|
}
|
||||||
|
else
|
||||||
|
{ // only html window, no notebook with index,contents etc
|
||||||
m_HtmlWin = new wxHtmlWindow(this);
|
m_HtmlWin = new wxHtmlWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,10 +249,12 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti
|
|||||||
m_HtmlWin->ReadCustomization(m_Config, m_ConfigRoot);
|
m_HtmlWin->ReadCustomization(m_Config, m_ConfigRoot);
|
||||||
|
|
||||||
// contents tree panel?
|
// contents tree panel?
|
||||||
if (style & wxHF_CONTENTS) {
|
if (style & wxHF_CONTENTS)
|
||||||
|
{
|
||||||
wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE);
|
wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE);
|
||||||
|
|
||||||
if (style & wxHF_BOOKMARKS) {
|
if (style & wxHF_BOOKMARKS)
|
||||||
|
{
|
||||||
wxLayoutConstraints *b1 = new wxLayoutConstraints;
|
wxLayoutConstraints *b1 = new wxLayoutConstraints;
|
||||||
wxBitmapButton *bmpbt = new wxBitmapButton(dummy, wxID_HTML_BOOKMARKSREMOVE, wxBITMAP(wbkdel), wxDefaultPosition, wxSize(20,20));
|
wxBitmapButton *bmpbt = new wxBitmapButton(dummy, wxID_HTML_BOOKMARKSREMOVE, wxBITMAP(wbkdel), wxDefaultPosition, wxSize(20,20));
|
||||||
|
|
||||||
@@ -316,7 +324,8 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti
|
|||||||
}
|
}
|
||||||
|
|
||||||
// index listbox panel?
|
// index listbox panel?
|
||||||
if (style & wxHF_INDEX) {
|
if (style & wxHF_INDEX)
|
||||||
|
{
|
||||||
wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE);
|
wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE);
|
||||||
|
|
||||||
wxLayoutConstraints *b1 = new wxLayoutConstraints;
|
wxLayoutConstraints *b1 = new wxLayoutConstraints;
|
||||||
@@ -374,7 +383,8 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti
|
|||||||
}
|
}
|
||||||
|
|
||||||
// search list panel?
|
// search list panel?
|
||||||
if (style & wxHF_SEARCH) {
|
if (style & wxHF_SEARCH)
|
||||||
|
{
|
||||||
wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_SEARCHPAGE);
|
wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_SEARCHPAGE);
|
||||||
|
|
||||||
wxLayoutConstraints *b1 = new wxLayoutConstraints;
|
wxLayoutConstraints *b1 = new wxLayoutConstraints;
|
||||||
@@ -439,19 +449,24 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti
|
|||||||
RefreshLists();
|
RefreshLists();
|
||||||
|
|
||||||
// showtime
|
// showtime
|
||||||
if (m_NavigPan && m_Splitter) {
|
if (m_NavigPan && m_Splitter)
|
||||||
|
{
|
||||||
m_Splitter->SetMinimumPaneSize(20);
|
m_Splitter->SetMinimumPaneSize(20);
|
||||||
if (m_Cfg.navig_on)
|
if (m_Cfg.navig_on)
|
||||||
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
|
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
|
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
|
||||||
m_Splitter->Unsplit();
|
m_Splitter->Unsplit();
|
||||||
}
|
}
|
||||||
if (m_Cfg.navig_on) {
|
|
||||||
|
if (m_Cfg.navig_on)
|
||||||
|
{
|
||||||
m_NavigPan->Show(TRUE);
|
m_NavigPan->Show(TRUE);
|
||||||
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
|
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
m_NavigPan->Show(FALSE);
|
m_NavigPan->Show(FALSE);
|
||||||
m_Splitter->Initialize(m_HtmlWin);
|
m_Splitter->Initialize(m_HtmlWin);
|
||||||
}
|
}
|
||||||
@@ -546,7 +561,8 @@ void wxHtmlHelpFrame::SetTitleFormat(const wxString& format)
|
|||||||
bool wxHtmlHelpFrame::Display(const wxString& x)
|
bool wxHtmlHelpFrame::Display(const wxString& x)
|
||||||
{
|
{
|
||||||
wxString url = m_Data->FindPageByName(x);
|
wxString url = m_Data->FindPageByName(x);
|
||||||
if (! url.IsEmpty()) {
|
if (!url.IsEmpty())
|
||||||
|
{
|
||||||
m_HtmlWin->LoadPage(url);
|
m_HtmlWin->LoadPage(url);
|
||||||
NotifyPageChanged();
|
NotifyPageChanged();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -557,7 +573,8 @@ bool wxHtmlHelpFrame::Display(const wxString& x)
|
|||||||
bool wxHtmlHelpFrame::Display(const int id)
|
bool wxHtmlHelpFrame::Display(const int id)
|
||||||
{
|
{
|
||||||
wxString url = m_Data->FindPageById(id);
|
wxString url = m_Data->FindPageById(id);
|
||||||
if (! url.IsEmpty()) {
|
if (!url.IsEmpty())
|
||||||
|
{
|
||||||
m_HtmlWin->LoadPage(url);
|
m_HtmlWin->LoadPage(url);
|
||||||
NotifyPageChanged();
|
NotifyPageChanged();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -571,7 +588,8 @@ bool wxHtmlHelpFrame::DisplayContents()
|
|||||||
{
|
{
|
||||||
if (! m_ContentsBox)
|
if (! m_ContentsBox)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!m_Splitter -> IsSplit()) {
|
if (!m_Splitter->IsSplit())
|
||||||
|
{
|
||||||
m_NavigPan->Show(TRUE);
|
m_NavigPan->Show(TRUE);
|
||||||
m_HtmlWin->Show(TRUE);
|
m_HtmlWin->Show(TRUE);
|
||||||
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
|
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
|
||||||
@@ -587,7 +605,8 @@ bool wxHtmlHelpFrame::DisplayIndex()
|
|||||||
{
|
{
|
||||||
if (! m_IndexList)
|
if (! m_IndexList)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!m_Splitter -> IsSplit()) {
|
if (!m_Splitter->IsSplit())
|
||||||
|
{
|
||||||
m_NavigPan->Show(TRUE);
|
m_NavigPan->Show(TRUE);
|
||||||
m_HtmlWin->Show(TRUE);
|
m_HtmlWin->Show(TRUE);
|
||||||
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
|
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
|
||||||
@@ -607,7 +626,8 @@ bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword)
|
|||||||
wxString foundstr;
|
wxString foundstr;
|
||||||
wxString book = wxEmptyString;
|
wxString book = wxEmptyString;
|
||||||
|
|
||||||
if (!m_Splitter -> IsSplit()) {
|
if (!m_Splitter->IsSplit())
|
||||||
|
{
|
||||||
m_NavigPan->Show(TRUE);
|
m_NavigPan->Show(TRUE);
|
||||||
m_HtmlWin->Show(TRUE);
|
m_HtmlWin->Show(TRUE);
|
||||||
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
|
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
|
||||||
@@ -628,11 +648,13 @@ bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword)
|
|||||||
status.GetMaxIndex(), this,
|
status.GetMaxIndex(), this,
|
||||||
wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE);
|
wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE);
|
||||||
|
|
||||||
while (status.IsActive()) {
|
while (status.IsActive())
|
||||||
|
{
|
||||||
curi = status.GetCurIndex();
|
curi = status.GetCurIndex();
|
||||||
if (curi % 32 == 0 && progress.Update(curi) == FALSE)
|
if (curi % 32 == 0 && progress.Update(curi) == FALSE)
|
||||||
break;
|
break;
|
||||||
if (status.Search()) {
|
if (status.Search())
|
||||||
|
{
|
||||||
foundstr.Printf(_("Found %i matches"), ++foundcnt);
|
foundstr.Printf(_("Found %i matches"), ++foundcnt);
|
||||||
progress.Update(status.GetCurIndex(), foundstr);
|
progress.Update(status.GetCurIndex(), foundstr);
|
||||||
m_SearchList->Append(status.GetName(), status.GetContentsItem());
|
m_SearchList->Append(status.GetName(), status.GetContentsItem());
|
||||||
@@ -642,7 +664,8 @@ bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword)
|
|||||||
m_SearchButton->Enable(TRUE);
|
m_SearchButton->Enable(TRUE);
|
||||||
m_SearchText->SetSelection(0, keyword.Length());
|
m_SearchText->SetSelection(0, keyword.Length());
|
||||||
m_SearchText->SetFocus();
|
m_SearchText->SetFocus();
|
||||||
if (foundcnt) {
|
if (foundcnt)
|
||||||
|
{
|
||||||
wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList->GetClientData(0);
|
wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList->GetClientData(0);
|
||||||
if (it)
|
if (it)
|
||||||
{
|
{
|
||||||
@@ -680,21 +703,26 @@ void wxHtmlHelpFrame::CreateContents()
|
|||||||
m_ContentsBox->SetItemSelectedImage(roots[0], IMG_RootFolder);
|
m_ContentsBox->SetItemSelectedImage(roots[0], IMG_RootFolder);
|
||||||
imaged[0] = TRUE;
|
imaged[0] = TRUE;
|
||||||
|
|
||||||
for (it = m_Data->GetContents(), i = 0; i < cnt; i++, it++) {
|
for (it = m_Data->GetContents(), i = 0; i < cnt; i++, it++)
|
||||||
|
{
|
||||||
roots[it->m_Level + 1] = m_ContentsBox->AppendItem(
|
roots[it->m_Level + 1] = m_ContentsBox->AppendItem(
|
||||||
roots[it->m_Level], it->m_Name, IMG_Page, -1,
|
roots[it->m_Level], it->m_Name, IMG_Page, -1,
|
||||||
new wxHtmlHelpTreeItemData(i));
|
new wxHtmlHelpTreeItemData(i));
|
||||||
m_PagesHash->Put(it->m_Book->GetBasePath() + it->m_Page,
|
m_PagesHash->Put(it->m_Book->GetBasePath() + it->m_Page,
|
||||||
new wxHtmlHelpHashData(i, roots[it->m_Level + 1]));
|
new wxHtmlHelpHashData(i, roots[it->m_Level + 1]));
|
||||||
|
|
||||||
if (it -> m_Level == 0) {
|
if (it->m_Level == 0)
|
||||||
|
{
|
||||||
m_ContentsBox->SetItemBold(roots[1], TRUE);
|
m_ContentsBox->SetItemBold(roots[1], TRUE);
|
||||||
m_ContentsBox->SetItemImage(roots[1], IMG_Book);
|
m_ContentsBox->SetItemImage(roots[1], IMG_Book);
|
||||||
m_ContentsBox->SetItemSelectedImage(roots[1], IMG_Book);
|
m_ContentsBox->SetItemSelectedImage(roots[1], IMG_Book);
|
||||||
imaged[1] = TRUE;
|
imaged[1] = TRUE;
|
||||||
} else imaged[it -> m_Level + 1] = FALSE;
|
}
|
||||||
|
else
|
||||||
|
imaged[it->m_Level + 1] = FALSE;
|
||||||
|
|
||||||
if (!imaged[it -> m_Level]) {
|
if (!imaged[it->m_Level])
|
||||||
|
{
|
||||||
m_ContentsBox->SetItemImage(roots[it->m_Level], IMG_Folder);
|
m_ContentsBox->SetItemImage(roots[it->m_Level], IMG_Folder);
|
||||||
m_ContentsBox->SetItemSelectedImage(roots[it->m_Level], IMG_Folder);
|
m_ContentsBox->SetItemSelectedImage(roots[it->m_Level], IMG_Folder);
|
||||||
imaged[it->m_Level] = TRUE;
|
imaged[it->m_Level] = TRUE;
|
||||||
@@ -752,7 +780,8 @@ void wxHtmlHelpFrame::ReadCustomization(wxConfigBase *cfg, const wxString& path)
|
|||||||
wxString oldpath;
|
wxString oldpath;
|
||||||
wxString tmp;
|
wxString tmp;
|
||||||
|
|
||||||
if (path != wxEmptyString) {
|
if (path != wxEmptyString)
|
||||||
|
{
|
||||||
oldpath = cfg->GetPath();
|
oldpath = cfg->GetPath();
|
||||||
cfg->SetPath(_T("/") + path);
|
cfg->SetPath(_T("/") + path);
|
||||||
}
|
}
|
||||||
@@ -774,15 +803,18 @@ void wxHtmlHelpFrame::ReadCustomization(wxConfigBase *cfg, const wxString& path)
|
|||||||
wxString val, s;
|
wxString val, s;
|
||||||
|
|
||||||
cnt = cfg->Read(wxT("hcBookmarksCnt"), 0L);
|
cnt = cfg->Read(wxT("hcBookmarksCnt"), 0L);
|
||||||
if (cnt != 0) {
|
if (cnt != 0)
|
||||||
|
{
|
||||||
m_BookmarksNames.Clear();
|
m_BookmarksNames.Clear();
|
||||||
m_BookmarksPages.Clear();
|
m_BookmarksPages.Clear();
|
||||||
if (m_Bookmarks) {
|
if (m_Bookmarks)
|
||||||
|
{
|
||||||
m_Bookmarks->Clear();
|
m_Bookmarks->Clear();
|
||||||
m_Bookmarks->Append(_("(bookmarks)"));
|
m_Bookmarks->Append(_("(bookmarks)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < cnt; i++) {
|
for (i = 0; i < cnt; i++)
|
||||||
|
{
|
||||||
val.Printf(wxT("hcBookmark_%i"), i);
|
val.Printf(wxT("hcBookmark_%i"), i);
|
||||||
s = cfg->Read(val);
|
s = cfg->Read(val);
|
||||||
m_BookmarksNames.Add(s);
|
m_BookmarksNames.Add(s);
|
||||||
@@ -806,7 +838,8 @@ void wxHtmlHelpFrame::WriteCustomization(wxConfigBase *cfg, const wxString& path
|
|||||||
wxString oldpath;
|
wxString oldpath;
|
||||||
wxString tmp;
|
wxString tmp;
|
||||||
|
|
||||||
if (path != wxEmptyString) {
|
if (path != wxEmptyString)
|
||||||
|
{
|
||||||
oldpath = cfg->GetPath();
|
oldpath = cfg->GetPath();
|
||||||
cfg->SetPath(_T("/") + path);
|
cfg->SetPath(_T("/") + path);
|
||||||
}
|
}
|
||||||
@@ -821,13 +854,15 @@ void wxHtmlHelpFrame::WriteCustomization(wxConfigBase *cfg, const wxString& path
|
|||||||
cfg->Write(wxT("hcNormalFace"), m_NormalFace);
|
cfg->Write(wxT("hcNormalFace"), m_NormalFace);
|
||||||
cfg->Write(wxT("hcFontSize"), (long)m_FontSize);
|
cfg->Write(wxT("hcFontSize"), (long)m_FontSize);
|
||||||
|
|
||||||
if (m_Bookmarks) {
|
if (m_Bookmarks)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
int cnt = m_BookmarksNames.GetCount();
|
int cnt = m_BookmarksNames.GetCount();
|
||||||
wxString val;
|
wxString val;
|
||||||
|
|
||||||
cfg->Write(wxT("hcBookmarksCnt"), (long)cnt);
|
cfg->Write(wxT("hcBookmarksCnt"), (long)cnt);
|
||||||
for (i = 0; i < cnt; i++) {
|
for (i = 0; i < cnt; i++)
|
||||||
|
{
|
||||||
val.Printf(wxT("hcBookmark_%i"), i);
|
val.Printf(wxT("hcBookmark_%i"), i);
|
||||||
cfg->Write(val, m_BookmarksNames[i]);
|
cfg->Write(val, m_BookmarksNames[i]);
|
||||||
val.Printf(wxT("hcBookmark_%i_url"), i);
|
val.Printf(wxT("hcBookmark_%i_url"), i);
|
||||||
@@ -967,14 +1002,16 @@ void wxHtmlHelpFrame::OptionsDialog()
|
|||||||
wxHtmlHelpFrameOptionsDialog dlg(this);
|
wxHtmlHelpFrameOptionsDialog dlg(this);
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
if (m_NormalFonts == NULL) {
|
if (m_NormalFonts == NULL)
|
||||||
|
{
|
||||||
wxFontEnumerator enu;
|
wxFontEnumerator enu;
|
||||||
enu.EnumerateFacenames();
|
enu.EnumerateFacenames();
|
||||||
m_NormalFonts = new wxArrayString;
|
m_NormalFonts = new wxArrayString;
|
||||||
*m_NormalFonts = *enu.GetFacenames();
|
*m_NormalFonts = *enu.GetFacenames();
|
||||||
m_NormalFonts->Sort();
|
m_NormalFonts->Sort();
|
||||||
}
|
}
|
||||||
if (m_FixedFonts == NULL) {
|
if (m_FixedFonts == NULL)
|
||||||
|
{
|
||||||
wxFontEnumerator enu;
|
wxFontEnumerator enu;
|
||||||
enu.EnumerateFacenames(wxFONTENCODING_SYSTEM, TRUE);
|
enu.EnumerateFacenames(wxFONTENCODING_SYSTEM, TRUE);
|
||||||
m_FixedFonts = new wxArrayString;
|
m_FixedFonts = new wxArrayString;
|
||||||
@@ -993,7 +1030,8 @@ void wxHtmlHelpFrame::OptionsDialog()
|
|||||||
dlg.RadioBox->SetSelection(m_FontSize);
|
dlg.RadioBox->SetSelection(m_FontSize);
|
||||||
dlg.UpdateTestWin();
|
dlg.UpdateTestWin();
|
||||||
|
|
||||||
if (dlg.ShowModal() == wxID_OK) {
|
if (dlg.ShowModal() == wxID_OK)
|
||||||
|
{
|
||||||
m_NormalFace = dlg.NormalFont->GetStringSelection();
|
m_NormalFace = dlg.NormalFont->GetStringSelection();
|
||||||
m_FixedFace = dlg.FixedFont->GetStringSelection();
|
m_FixedFace = dlg.FixedFont->GetStringSelection();
|
||||||
m_FontSize = dlg.RadioBox->GetSelection();
|
m_FontSize = dlg.RadioBox->GetSelection();
|
||||||
@@ -1033,8 +1071,8 @@ EVENT HANDLING :
|
|||||||
|
|
||||||
void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event)
|
void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
switch (event.GetId()) {
|
switch (event.GetId())
|
||||||
|
{
|
||||||
case wxID_HTML_BACK :
|
case wxID_HTML_BACK :
|
||||||
m_HtmlWin->HistoryBack();
|
m_HtmlWin->HistoryBack();
|
||||||
NotifyPageChanged();
|
NotifyPageChanged();
|
||||||
@@ -1116,11 +1154,14 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
if (! (m_Splitter && m_NavigPan))
|
if (! (m_Splitter && m_NavigPan))
|
||||||
return ;
|
return ;
|
||||||
if (m_Splitter -> IsSplit()) {
|
if (m_Splitter->IsSplit())
|
||||||
|
{
|
||||||
m_Cfg.sashpos = m_Splitter->GetSashPosition();
|
m_Cfg.sashpos = m_Splitter->GetSashPosition();
|
||||||
m_Splitter->Unsplit(m_NavigPan);
|
m_Splitter->Unsplit(m_NavigPan);
|
||||||
m_Cfg.navig_on = FALSE;
|
m_Cfg.navig_on = FALSE;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_NavigPan->Show(TRUE);
|
m_NavigPan->Show(TRUE);
|
||||||
m_HtmlWin->Show(TRUE);
|
m_HtmlWin->Show(TRUE);
|
||||||
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
|
m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
|
||||||
@@ -1140,8 +1181,10 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event)
|
|||||||
|
|
||||||
item = m_HtmlWin->GetOpenedPageTitle();
|
item = m_HtmlWin->GetOpenedPageTitle();
|
||||||
url = m_HtmlWin->GetOpenedPage();
|
url = m_HtmlWin->GetOpenedPage();
|
||||||
if (item == wxEmptyString) item = url.AfterLast(wxT('/'));
|
if (item == wxEmptyString)
|
||||||
if (m_BookmarksPages.Index(url) == wxNOT_FOUND) {
|
item = url.AfterLast(wxT('/'));
|
||||||
|
if (m_BookmarksPages.Index(url) == wxNOT_FOUND)
|
||||||
|
{
|
||||||
m_Bookmarks->Append(item);
|
m_Bookmarks->Append(item);
|
||||||
m_BookmarksNames.Add(item);
|
m_BookmarksNames.Add(item);
|
||||||
m_BookmarksPages.Add(url);
|
m_BookmarksPages.Add(url);
|
||||||
@@ -1156,7 +1199,8 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event)
|
|||||||
|
|
||||||
item = m_Bookmarks->GetStringSelection();
|
item = m_Bookmarks->GetStringSelection();
|
||||||
pos = m_BookmarksNames.Index(item);
|
pos = m_BookmarksNames.Index(item);
|
||||||
if (pos != wxNOT_FOUND) {
|
if (pos != wxNOT_FOUND)
|
||||||
|
{
|
||||||
m_BookmarksNames.Remove(pos);
|
m_BookmarksNames.Remove(pos);
|
||||||
m_BookmarksPages.Remove(pos);
|
m_BookmarksPages.Remove(pos);
|
||||||
m_Bookmarks->Delete(m_Bookmarks->GetSelection());
|
m_Bookmarks->Delete(m_Bookmarks->GetSelection());
|
||||||
@@ -1241,9 +1285,11 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event)
|
|||||||
wxString sr = m_IndexText->GetLineText(0);
|
wxString sr = m_IndexText->GetLineText(0);
|
||||||
sr.MakeLower();
|
sr.MakeLower();
|
||||||
if (sr == wxEmptyString)
|
if (sr == wxEmptyString)
|
||||||
|
{
|
||||||
OnIndexAll(event);
|
OnIndexAll(event);
|
||||||
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
wxBusyCursor bcur;
|
wxBusyCursor bcur;
|
||||||
const wxChar *cstr = sr.c_str();
|
const wxChar *cstr = sr.c_str();
|
||||||
wxChar mybuff[512], *ptr;
|
wxChar mybuff[512], *ptr;
|
||||||
@@ -1261,10 +1307,12 @@ void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event)
|
|||||||
for (ptr = mybuff; *ptr != 0; ptr++)
|
for (ptr = mybuff; *ptr != 0; ptr++)
|
||||||
if (*ptr >= _T('A') && *ptr <= _T('Z'))
|
if (*ptr >= _T('A') && *ptr <= _T('Z'))
|
||||||
*ptr -= (wxChar)(_T('A') - _T('a'));
|
*ptr -= (wxChar)(_T('A') - _T('a'));
|
||||||
if (wxStrstr(mybuff, cstr) != NULL) {
|
if (wxStrstr(mybuff, cstr) != NULL)
|
||||||
|
{
|
||||||
m_IndexList->Append(index[i].m_Name, (char*)(index + i));
|
m_IndexList->Append(index[i].m_Name, (char*)(index + i));
|
||||||
displ++;
|
displ++;
|
||||||
if (first) {
|
if (first)
|
||||||
|
{
|
||||||
m_HtmlWin->LoadPage(index[i].m_Book->GetBasePath() + index[i].m_Page);
|
m_HtmlWin->LoadPage(index[i].m_Book->GetBasePath() + index[i].m_Page);
|
||||||
NotifyPageChanged();
|
NotifyPageChanged();
|
||||||
first = FALSE;
|
first = FALSE;
|
||||||
@@ -1290,9 +1338,11 @@ void wxHtmlHelpFrame::OnIndexAll(wxCommandEvent& WXUNUSED(event))
|
|||||||
bool first = TRUE;
|
bool first = TRUE;
|
||||||
wxHtmlContentsItem* index = m_Data->GetIndex();
|
wxHtmlContentsItem* index = m_Data->GetIndex();
|
||||||
|
|
||||||
for (int i = 0; i < cnt; i++) {
|
for (int i = 0; i < cnt; i++)
|
||||||
|
{
|
||||||
m_IndexList->Append(index[i].m_Name, (char*)(index + i));
|
m_IndexList->Append(index[i].m_Name, (char*)(index + i));
|
||||||
if (first) {
|
if (first)
|
||||||
|
{
|
||||||
m_HtmlWin->LoadPage(index[i].m_Book->GetBasePath() + index[i].m_Page);
|
m_HtmlWin->LoadPage(index[i].m_Book->GetBasePath() + index[i].m_Page);
|
||||||
NotifyPageChanged();
|
NotifyPageChanged();
|
||||||
first = FALSE;
|
first = FALSE;
|
||||||
|
@@ -69,13 +69,15 @@ void wxHtmlCell::OnMouseClick(wxWindow *parent, int x, int y,
|
|||||||
bool wxHtmlCell::AdjustPagebreak(int *pagebreak) const
|
bool wxHtmlCell::AdjustPagebreak(int *pagebreak) const
|
||||||
{
|
{
|
||||||
if ((!m_CanLiveOnPagebreak) &&
|
if ((!m_CanLiveOnPagebreak) &&
|
||||||
m_PosY < *pagebreak && m_PosY + m_Height > *pagebreak) {
|
m_PosY < *pagebreak && m_PosY + m_Height > *pagebreak)
|
||||||
|
{
|
||||||
*pagebreak = m_PosY;
|
*pagebreak = m_PosY;
|
||||||
if (m_Next != NULL) m_Next->AdjustPagebreak(pagebreak);
|
if (m_Next != NULL) m_Next->AdjustPagebreak(pagebreak);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
if (m_Next != NULL) return m_Next->AdjustPagebreak(pagebreak);
|
if (m_Next != NULL) return m_Next->AdjustPagebreak(pagebreak);
|
||||||
else return FALSE;
|
else return FALSE;
|
||||||
}
|
}
|
||||||
@@ -327,12 +329,14 @@ bool wxHtmlContainerCell::AdjustPagebreak(int *pagebreak) const
|
|||||||
if (!m_CanLiveOnPagebreak)
|
if (!m_CanLiveOnPagebreak)
|
||||||
return wxHtmlCell::AdjustPagebreak(pagebreak);
|
return wxHtmlCell::AdjustPagebreak(pagebreak);
|
||||||
|
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
wxHtmlCell *c = GetFirstCell();
|
wxHtmlCell *c = GetFirstCell();
|
||||||
bool rt = FALSE;
|
bool rt = FALSE;
|
||||||
int pbrk = *pagebreak - m_PosY;
|
int pbrk = *pagebreak - m_PosY;
|
||||||
|
|
||||||
while (c) {
|
while (c)
|
||||||
|
{
|
||||||
if (c->AdjustPagebreak(&pbrk)) rt = TRUE;
|
if (c->AdjustPagebreak(&pbrk)) rt = TRUE;
|
||||||
c = c->GetNext();
|
c = c->GetNext();
|
||||||
}
|
}
|
||||||
@@ -345,7 +349,8 @@ bool wxHtmlContainerCell::AdjustPagebreak(int *pagebreak) const
|
|||||||
|
|
||||||
void wxHtmlContainerCell::Layout(int w)
|
void wxHtmlContainerCell::Layout(int w)
|
||||||
{
|
{
|
||||||
if (m_LastLayout == w) {
|
if (m_LastLayout == w)
|
||||||
|
{
|
||||||
wxHtmlCell::Layout(w);
|
wxHtmlCell::Layout(w);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -365,16 +370,19 @@ void wxHtmlContainerCell::Layout(int w)
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (m_WidthFloatUnits == wxHTML_UNITS_PERCENT) {
|
if (m_WidthFloatUnits == wxHTML_UNITS_PERCENT)
|
||||||
|
{
|
||||||
if (m_WidthFloat < 0) m_Width = (100 + m_WidthFloat) * w / 100;
|
if (m_WidthFloat < 0) m_Width = (100 + m_WidthFloat) * w / 100;
|
||||||
else m_Width = m_WidthFloat * w / 100;
|
else m_Width = m_WidthFloat * w / 100;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
if (m_WidthFloat < 0) m_Width = w + m_WidthFloat;
|
if (m_WidthFloat < 0) m_Width = w + m_WidthFloat;
|
||||||
else m_Width = 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 l = (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
|
||||||
int r = (m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight;
|
int r = (m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight;
|
||||||
m_Cells->Layout(m_Width - (l + r));
|
m_Cells->Layout(m_Width - (l + r));
|
||||||
@@ -391,8 +399,10 @@ void wxHtmlContainerCell::Layout(int w)
|
|||||||
s_width = m_Width - s_indent - ((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:
|
// 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_TOP : ybasicpos = 0; break;
|
||||||
case wxHTML_ALIGN_BOTTOM : ybasicpos = - cell->GetHeight(); break;
|
case wxHTML_ALIGN_BOTTOM : ybasicpos = - cell->GetHeight(); break;
|
||||||
case wxHTML_ALIGN_CENTER : ybasicpos = - cell->GetHeight() / 2; break;
|
case wxHTML_ALIGN_CENTER : ybasicpos = - cell->GetHeight() / 2; break;
|
||||||
@@ -408,7 +418,8 @@ void wxHtmlContainerCell::Layout(int w)
|
|||||||
xcnt++;
|
xcnt++;
|
||||||
|
|
||||||
// force new line if occured:
|
// 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 (xpos > MaxLineWidth) MaxLineWidth = xpos;
|
||||||
if (ysizeup < 0) ysizeup = 0;
|
if (ysizeup < 0) ysizeup = 0;
|
||||||
if (ysizedown < 0) ysizedown = 0;
|
if (ysizedown < 0) ysizedown = 0;
|
||||||
@@ -430,7 +441,8 @@ void wxHtmlContainerCell::Layout(int w)
|
|||||||
ypos += ysizeup;
|
ypos += ysizeup;
|
||||||
|
|
||||||
if (m_AlignHor != wxHTML_ALIGN_JUSTIFY || cell == NULL)
|
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());
|
ypos + line->GetPosY());
|
||||||
line = line->GetNext();
|
line = line->GetNext();
|
||||||
@@ -441,7 +453,8 @@ void wxHtmlContainerCell::Layout(int w)
|
|||||||
int step = (s_width - xpos);
|
int step = (s_width - xpos);
|
||||||
if (step < 0) step = 0;
|
if (step < 0) step = 0;
|
||||||
xcnt--;
|
xcnt--;
|
||||||
if (xcnt > 0) while (line != cell) {
|
if (xcnt > 0) while (line != cell)
|
||||||
|
{
|
||||||
line->SetPos(line->GetPosX() + s_indent +
|
line->SetPos(line->GetPosX() + s_indent +
|
||||||
(counter++ * step / xcnt),
|
(counter++ * step / xcnt),
|
||||||
ypos + line->GetPosY());
|
ypos + line->GetPosY());
|
||||||
@@ -460,12 +473,15 @@ void wxHtmlContainerCell::Layout(int w)
|
|||||||
// setup height & width, depending on container layout:
|
// setup height & width, depending on container layout:
|
||||||
m_Height = ypos + (ysizedown + ysizeup) + m_IndentBottom;
|
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;
|
int diff = m_MinHeight - m_Height;
|
||||||
if (m_MinHeightAlign == wxHTML_ALIGN_CENTER) diff /= 2;
|
if (m_MinHeightAlign == wxHTML_ALIGN_CENTER) diff /= 2;
|
||||||
cell = m_Cells;
|
cell = m_Cells;
|
||||||
while (cell) {
|
while (cell)
|
||||||
|
{
|
||||||
cell->SetPos(cell->GetPosX(), cell->GetPosY() + diff);
|
cell->SetPos(cell->GetPosX(), cell->GetPosY() + diff);
|
||||||
cell = cell->GetNext();
|
cell = cell->GetNext();
|
||||||
}
|
}
|
||||||
@@ -488,9 +504,11 @@ void wxHtmlContainerCell::Layout(int w)
|
|||||||
void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
||||||
{
|
{
|
||||||
// container visible, draw it:
|
// 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);
|
wxBrush myb = wxBrush(m_BkColour, wxSOLID);
|
||||||
|
|
||||||
int real_y1 = mMax(y + m_PosY, view_y1);
|
int real_y1 = mMax(y + m_PosY, view_y1);
|
||||||
@@ -501,7 +519,8 @@ void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
|||||||
dc.DrawRectangle(x + m_PosX, real_y1, m_Width, real_y2 - real_y1 + 1);
|
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 mypen1(m_BorderColour1, 1, wxSOLID);
|
||||||
wxPen mypen2(m_BorderColour2, 1, wxSOLID);
|
wxPen mypen2(m_BorderColour2, 1, wxSOLID);
|
||||||
|
|
||||||
@@ -516,7 +535,8 @@ void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
|||||||
if (m_Cells) m_Cells->Draw(dc, x + m_PosX, y + m_PosY, view_y1, view_y2);
|
if (m_Cells) m_Cells->Draw(dc, x + m_PosX, y + m_PosY, view_y1, view_y2);
|
||||||
}
|
}
|
||||||
// container invisible, just proceed font+color changing:
|
// container invisible, just proceed font+color changing:
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
if (m_Cells) m_Cells->DrawInvisible(dc, x + m_PosX, y + m_PosY);
|
if (m_Cells) m_Cells->DrawInvisible(dc, x + m_PosX, y + m_PosY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -538,7 +558,8 @@ wxHtmlLinkInfo *wxHtmlContainerCell::GetLink(int x, int y) const
|
|||||||
wxHtmlCell *c = m_Cells;
|
wxHtmlCell *c = m_Cells;
|
||||||
int cx, cy, cw, ch;
|
int cx, cy, cw, ch;
|
||||||
|
|
||||||
while (c) {
|
while (c)
|
||||||
|
{
|
||||||
cx = c->GetPosX(), cy = c->GetPosY();
|
cx = c->GetPosX(), cy = c->GetPosY();
|
||||||
cw = c->GetWidth(), ch = c->GetHeight();
|
cw = c->GetWidth(), ch = c->GetHeight();
|
||||||
if ((x >= cx) && (x < cx + cw) && (y >= cy) && (y < cy + ch))
|
if ((x >= cx) && (x < cx + cw) && (y >= cy) && (y < cy + ch))
|
||||||
@@ -553,7 +574,8 @@ wxHtmlLinkInfo *wxHtmlContainerCell::GetLink(int x, int y) const
|
|||||||
void wxHtmlContainerCell::InsertCell(wxHtmlCell *f)
|
void wxHtmlContainerCell::InsertCell(wxHtmlCell *f)
|
||||||
{
|
{
|
||||||
if (!m_Cells) m_Cells = m_LastCell = f;
|
if (!m_Cells) m_Cells = m_LastCell = f;
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
m_LastCell->SetNext(f);
|
m_LastCell->SetNext(f);
|
||||||
m_LastCell = f;
|
m_LastCell = f;
|
||||||
if (m_LastCell) while (m_LastCell->GetNext()) m_LastCell = m_LastCell->GetNext();
|
if (m_LastCell) while (m_LastCell->GetNext()) m_LastCell = m_LastCell->GetNext();
|
||||||
@@ -566,7 +588,8 @@ void wxHtmlContainerCell::InsertCell(wxHtmlCell *f)
|
|||||||
|
|
||||||
void wxHtmlContainerCell::SetAlign(const wxHtmlTag& tag)
|
void wxHtmlContainerCell::SetAlign(const wxHtmlTag& tag)
|
||||||
{
|
{
|
||||||
if (tag.HasParam(wxT("ALIGN"))) {
|
if (tag.HasParam(wxT("ALIGN")))
|
||||||
|
{
|
||||||
wxString alg = tag.GetParam(wxT("ALIGN"));
|
wxString alg = tag.GetParam(wxT("ALIGN"));
|
||||||
alg.MakeUpper();
|
alg.MakeUpper();
|
||||||
if (alg == wxT("CENTER"))
|
if (alg == wxT("CENTER"))
|
||||||
@@ -585,15 +608,18 @@ void wxHtmlContainerCell::SetAlign(const wxHtmlTag& tag)
|
|||||||
|
|
||||||
void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag, double pixel_scale)
|
void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag, double pixel_scale)
|
||||||
{
|
{
|
||||||
if (tag.HasParam(wxT("WIDTH"))) {
|
if (tag.HasParam(wxT("WIDTH")))
|
||||||
|
{
|
||||||
int wdi;
|
int wdi;
|
||||||
wxString wd = tag.GetParam(wxT("WIDTH"));
|
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);
|
wxSscanf(wd.c_str(), wxT("%i%%"), &wdi);
|
||||||
SetWidthFloat(wdi, wxHTML_UNITS_PERCENT);
|
SetWidthFloat(wdi, wxHTML_UNITS_PERCENT);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
wxSscanf(wd.c_str(), wxT("%i"), &wdi);
|
wxSscanf(wd.c_str(), wxT("%i"), &wdi);
|
||||||
SetWidthFloat((int)(pixel_scale * (double)wdi), wxHTML_UNITS_PIXELS);
|
SetWidthFloat((int)(pixel_scale * (double)wdi), wxHTML_UNITS_PIXELS);
|
||||||
}
|
}
|
||||||
@@ -607,7 +633,8 @@ const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) co
|
|||||||
{
|
{
|
||||||
const wxHtmlCell *r = NULL;
|
const wxHtmlCell *r = NULL;
|
||||||
|
|
||||||
if (m_Cells) {
|
if (m_Cells)
|
||||||
|
{
|
||||||
r = m_Cells->Find(condition, param);
|
r = m_Cells->Find(condition, param);
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
}
|
}
|
||||||
@@ -619,13 +646,16 @@ const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) co
|
|||||||
|
|
||||||
void wxHtmlContainerCell::OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event)
|
void wxHtmlContainerCell::OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
if (m_Cells) {
|
if (m_Cells)
|
||||||
|
{
|
||||||
wxHtmlCell *c = m_Cells;
|
wxHtmlCell *c = m_Cells;
|
||||||
while (c) {
|
while (c)
|
||||||
|
{
|
||||||
if ( (c->GetPosX() <= x) &&
|
if ( (c->GetPosX() <= x) &&
|
||||||
(c->GetPosY() <= y) &&
|
(c->GetPosY() <= y) &&
|
||||||
(c->GetPosX() + c->GetWidth() > x) &&
|
(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);
|
c->OnMouseClick(parent, x - c->GetPosX(), y - c->GetPosY(), event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -646,7 +676,8 @@ void wxHtmlColourCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
|||||||
{
|
{
|
||||||
if (m_Flags & wxHTML_CLR_FOREGROUND)
|
if (m_Flags & wxHTML_CLR_FOREGROUND)
|
||||||
dc.SetTextForeground(m_Colour);
|
dc.SetTextForeground(m_Colour);
|
||||||
if (m_Flags & wxHTML_CLR_BACKGROUND) {
|
if (m_Flags & wxHTML_CLR_BACKGROUND)
|
||||||
|
{
|
||||||
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
|
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
|
||||||
dc.SetTextBackground(m_Colour);
|
dc.SetTextBackground(m_Colour);
|
||||||
}
|
}
|
||||||
@@ -657,7 +688,8 @@ void wxHtmlColourCell::DrawInvisible(wxDC& dc, int x, int y)
|
|||||||
{
|
{
|
||||||
if (m_Flags & wxHTML_CLR_FOREGROUND)
|
if (m_Flags & wxHTML_CLR_FOREGROUND)
|
||||||
dc.SetTextForeground(m_Colour);
|
dc.SetTextForeground(m_Colour);
|
||||||
if (m_Flags & wxHTML_CLR_BACKGROUND) {
|
if (m_Flags & wxHTML_CLR_BACKGROUND)
|
||||||
|
{
|
||||||
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
|
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
|
||||||
dc.SetTextBackground(m_Colour);
|
dc.SetTextBackground(m_Colour);
|
||||||
}
|
}
|
||||||
@@ -709,7 +741,8 @@ void wxHtmlWidgetCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
|||||||
int absx = 0, absy = 0, stx, sty;
|
int absx = 0, absy = 0, stx, sty;
|
||||||
wxHtmlCell *c = this;
|
wxHtmlCell *c = this;
|
||||||
|
|
||||||
while (c) {
|
while (c)
|
||||||
|
{
|
||||||
absx += c->GetPosX();
|
absx += c->GetPosX();
|
||||||
absy += c->GetPosY();
|
absy += c->GetPosY();
|
||||||
c = c->GetParent();
|
c = c->GetParent();
|
||||||
@@ -728,7 +761,8 @@ void wxHtmlWidgetCell::DrawInvisible(wxDC& dc, int x, int y)
|
|||||||
int absx = 0, absy = 0, stx, sty;
|
int absx = 0, absy = 0, stx, sty;
|
||||||
wxHtmlCell *c = this;
|
wxHtmlCell *c = this;
|
||||||
|
|
||||||
while (c) {
|
while (c)
|
||||||
|
{
|
||||||
absx += c->GetPosX();
|
absx += c->GetPosX();
|
||||||
absy += c->GetPosY();
|
absy += c->GetPosY();
|
||||||
c = c->GetParent();
|
c = c->GetParent();
|
||||||
@@ -744,7 +778,8 @@ void wxHtmlWidgetCell::DrawInvisible(wxDC& dc, int x, int y)
|
|||||||
|
|
||||||
void wxHtmlWidgetCell::Layout(int w)
|
void wxHtmlWidgetCell::Layout(int w)
|
||||||
{
|
{
|
||||||
if (m_WidthFloat != 0) {
|
if (m_WidthFloat != 0)
|
||||||
|
{
|
||||||
m_Width = (w * m_WidthFloat) / 100;
|
m_Width = (w * m_WidthFloat) / 100;
|
||||||
m_Wnd->SetSize(m_Width, m_Height);
|
m_Wnd->SetSize(m_Width, m_Height);
|
||||||
}
|
}
|
||||||
|
@@ -82,19 +82,23 @@ void wxHtmlParser::DoParsing(int begin_pos, int end_pos)
|
|||||||
templen = 0;
|
templen = 0;
|
||||||
i = begin_pos;
|
i = begin_pos;
|
||||||
|
|
||||||
while (i < end_pos) {
|
while (i < end_pos)
|
||||||
|
{
|
||||||
c = m_Source[(unsigned int) i];
|
c = m_Source[(unsigned int) i];
|
||||||
|
|
||||||
// continue building word:
|
// continue building word:
|
||||||
if (c != '<') {
|
if (c != '<')
|
||||||
|
{
|
||||||
temp[templen++] = c;
|
temp[templen++] = c;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (c == '<') {
|
else if (c == '<')
|
||||||
|
{
|
||||||
wxHtmlTag tag(m_Source, i, end_pos, m_Cache);
|
wxHtmlTag tag(m_Source, i, end_pos, m_Cache);
|
||||||
|
|
||||||
if (templen) {
|
if (templen)
|
||||||
|
{
|
||||||
temp[templen] = 0;
|
temp[templen] = 0;
|
||||||
AddText(temp);
|
AddText(temp);
|
||||||
templen = 0;
|
templen = 0;
|
||||||
@@ -105,7 +109,8 @@ void wxHtmlParser::DoParsing(int begin_pos, int end_pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (templen) { // last word of block :-(
|
if (templen)
|
||||||
|
{ // last word of block :-(
|
||||||
temp[templen] = 0;
|
temp[templen] = 0;
|
||||||
AddText(temp);
|
AddText(temp);
|
||||||
}
|
}
|
||||||
@@ -122,7 +127,8 @@ void wxHtmlParser::AddTag(const wxHtmlTag& tag)
|
|||||||
h = (wxHtmlTagHandler*) m_HandlersHash.Get(tag.GetName());
|
h = (wxHtmlTagHandler*) m_HandlersHash.Get(tag.GetName());
|
||||||
if (h)
|
if (h)
|
||||||
inner = h->HandleTag(tag);
|
inner = h->HandleTag(tag);
|
||||||
if (!inner) {
|
if (!inner)
|
||||||
|
{
|
||||||
if (tag.HasEnding())
|
if (tag.HasEnding())
|
||||||
DoParsing(tag.GetBeginPos(), tag.GetEndPos1());
|
DoParsing(tag.GetBeginPos(), tag.GetEndPos1());
|
||||||
}
|
}
|
||||||
@@ -151,14 +157,16 @@ void wxHtmlParser::PushTagHandler(wxHtmlTagHandler *handler, wxString tags)
|
|||||||
wxStringTokenizer tokenizer(tags, ", ");
|
wxStringTokenizer tokenizer(tags, ", ");
|
||||||
wxString key;
|
wxString key;
|
||||||
|
|
||||||
if (m_HandlersStack == NULL) {
|
if (m_HandlersStack == NULL)
|
||||||
|
{
|
||||||
m_HandlersStack = new wxList;
|
m_HandlersStack = new wxList;
|
||||||
m_HandlersStack->DeleteContents(TRUE);
|
m_HandlersStack->DeleteContents(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_HandlersStack->Insert(new wxHashTable(m_HandlersHash));
|
m_HandlersStack->Insert(new wxHashTable(m_HandlersHash));
|
||||||
|
|
||||||
while (tokenizer.HasMoreTokens()) {
|
while (tokenizer.HasMoreTokens())
|
||||||
|
{
|
||||||
key = tokenizer.NextToken();
|
key = tokenizer.NextToken();
|
||||||
m_HandlersHash.Delete(key);
|
m_HandlersHash.Delete(key);
|
||||||
m_HandlersHash.Put(key, handler);
|
m_HandlersHash.Put(key, handler);
|
||||||
|
@@ -52,8 +52,10 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
|
|||||||
m_CachePos = 0;
|
m_CachePos = 0;
|
||||||
|
|
||||||
pos = 0;
|
pos = 0;
|
||||||
while (pos < lng) {
|
while (pos < lng)
|
||||||
if (src[pos] == wxT('<')) { // tag found:
|
{
|
||||||
|
if (src[pos] == wxT('<')) // tag found:
|
||||||
|
{
|
||||||
if (m_CacheSize % CACHE_INCREMENT == 0)
|
if (m_CacheSize % CACHE_INCREMENT == 0)
|
||||||
m_Cache = (sCacheItem*) realloc(m_Cache, (m_CacheSize + CACHE_INCREMENT) * sizeof(sCacheItem));
|
m_Cache = (sCacheItem*) realloc(m_Cache, (m_CacheSize + CACHE_INCREMENT) * sizeof(sCacheItem));
|
||||||
tg = m_CacheSize++;
|
tg = m_CacheSize++;
|
||||||
@@ -62,7 +64,8 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
|
|||||||
while (pos < lng &&
|
while (pos < lng &&
|
||||||
src[pos] != wxT('>') &&
|
src[pos] != wxT('>') &&
|
||||||
src[pos] != wxT(' ') && src[pos] != wxT('\r') &&
|
src[pos] != wxT(' ') && src[pos] != wxT('\r') &&
|
||||||
src[pos] != wxT('\n') && src[pos] != wxT('\t')) {
|
src[pos] != wxT('\n') && src[pos] != wxT('\t'))
|
||||||
|
{
|
||||||
dummy[i] = src[pos++];
|
dummy[i] = src[pos++];
|
||||||
if ((dummy[i] >= wxT('a')) && (dummy[i] <= wxT('z'))) dummy[i] -= (wxT('a') - wxT('A'));
|
if ((dummy[i] >= wxT('a')) && (dummy[i] <= wxT('z'))) dummy[i] -= (wxT('a') - wxT('A'));
|
||||||
i++;
|
i++;
|
||||||
@@ -73,17 +76,20 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
|
|||||||
|
|
||||||
while (pos < lng && src[pos] != wxT('>')) pos++;
|
while (pos < lng && src[pos] != wxT('>')) pos++;
|
||||||
|
|
||||||
if (src[stpos+1] == wxT('/')) { // ending tag:
|
if (src[stpos+1] == wxT('/')) // ending tag:
|
||||||
|
{
|
||||||
m_Cache[tg].End1 = m_Cache[tg].End2 = -2;
|
m_Cache[tg].End1 = m_Cache[tg].End2 = -2;
|
||||||
// find matching begin tag:
|
// find matching begin tag:
|
||||||
for (i = tg; i >= 0; i--)
|
for (i = tg; i >= 0; i--)
|
||||||
if ((m_Cache[i].End1 == -1) && (wxStrcmp(m_Cache[i].Name, dummy+1) == 0)) {
|
if ((m_Cache[i].End1 == -1) && (wxStrcmp(m_Cache[i].Name, dummy+1) == 0))
|
||||||
|
{
|
||||||
m_Cache[i].End1 = stpos;
|
m_Cache[i].End1 = stpos;
|
||||||
m_Cache[i].End2 = pos + 1;
|
m_Cache[i].End2 = pos + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
m_Cache[tg].End1 = m_Cache[tg].End2 = -1;
|
m_Cache[tg].End1 = m_Cache[tg].End2 = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,7 +98,8 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ok, we're done, now we'll free .Name members of cache - we don't need it anymore:
|
// ok, we're done, now we'll free .Name members of cache - we don't need it anymore:
|
||||||
for (i = 0; i < m_CacheSize; i++) {
|
for (i = 0; i < m_CacheSize; i++)
|
||||||
|
{
|
||||||
delete[] m_Cache[i].Name;
|
delete[] m_Cache[i].Name;
|
||||||
m_Cache[i].Name = NULL;
|
m_Cache[i].Name = NULL;
|
||||||
}
|
}
|
||||||
@@ -103,7 +110,8 @@ wxHtmlTagsCache::wxHtmlTagsCache(const wxString& source)
|
|||||||
void wxHtmlTagsCache::QueryTag(int at, int* end1, int* end2)
|
void wxHtmlTagsCache::QueryTag(int at, int* end1, int* end2)
|
||||||
{
|
{
|
||||||
if (m_Cache == NULL) return;
|
if (m_Cache == NULL) return;
|
||||||
if (m_Cache[m_CachePos].Key != at) {
|
if (m_Cache[m_CachePos].Key != at)
|
||||||
|
{
|
||||||
int delta = (at < m_Cache[m_CachePos].Key) ? -1 : 1;
|
int delta = (at < m_Cache[m_CachePos].Key) ? -1 : 1;
|
||||||
do {m_CachePos += delta;} while (m_Cache[m_CachePos].Key != at);
|
do {m_CachePos += delta;} while (m_Cache[m_CachePos].Key != at);
|
||||||
}
|
}
|
||||||
@@ -133,21 +141,25 @@ wxHtmlTag::wxHtmlTag(const wxString& source, int pos, int end_pos, wxHtmlTagsCac
|
|||||||
|
|
||||||
while ((i < end_pos) &&
|
while ((i < end_pos) &&
|
||||||
((c = source[i++]) != ' ' && c != '\r' && c != '\n' && c != '\t' &&
|
((c = source[i++]) != ' ' && c != '\r' && c != '\n' && c != '\t' &&
|
||||||
c != '>')) {
|
c != '>'))
|
||||||
|
{
|
||||||
if ((c >= 'a') && (c <= 'z')) c -= ('a' - 'A');
|
if ((c >= 'a') && (c <= 'z')) c -= ('a' - 'A');
|
||||||
m_Name += c;
|
m_Name += c;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source[i-1] != '>')
|
if (source[i-1] != '>')
|
||||||
while ((i < end_pos) && ((c = source[i++]) != '>')) {
|
while ((i < end_pos) && ((c = source[i++]) != '>'))
|
||||||
|
{
|
||||||
if ((c >= 'a') && (c <= 'z')) c -= ('a' - 'A');
|
if ((c >= 'a') && (c <= 'z')) c -= ('a' - 'A');
|
||||||
if (c == '\r' || c == '\n' || c == '\t') c = ' '; // make future parsing a bit simpler
|
if (c == '\r' || c == '\n' || c == '\t') c = ' '; // make future parsing a bit simpler
|
||||||
m_Params += c;
|
m_Params += c;
|
||||||
if (c == '"') {
|
if (c == '"')
|
||||||
|
{
|
||||||
while ((i < end_pos) && ((c = source[i++]) != '"')) m_Params += c;
|
while ((i < end_pos) && ((c = source[i++]) != '"')) m_Params += c;
|
||||||
m_Params += c;
|
m_Params += c;
|
||||||
}
|
}
|
||||||
else if (c == '\'') {
|
else if (c == '\'')
|
||||||
|
{
|
||||||
while ((i < end_pos) && ((c = source[i++]) != '\'')) m_Params += c;
|
while ((i < end_pos) && ((c = source[i++]) != '\'')) m_Params += c;
|
||||||
m_Params += c;
|
m_Params += c;
|
||||||
}
|
}
|
||||||
@@ -168,16 +180,20 @@ bool wxHtmlTag::HasParam(const wxString& par) const
|
|||||||
|
|
||||||
if (*st == 0) return FALSE;
|
if (*st == 0) return FALSE;
|
||||||
if (*p == 0) return FALSE;
|
if (*p == 0) return FALSE;
|
||||||
for (st2 = st, p2 = p; ; st2++) {
|
for (st2 = st, p2 = p; ; st2++)
|
||||||
|
{
|
||||||
if (*p2 == 0) return TRUE;
|
if (*p2 == 0) return TRUE;
|
||||||
if (*st2 == 0) return FALSE;
|
if (*st2 == 0) return FALSE;
|
||||||
if (*p2 != *st2) p2 = p;
|
if (*p2 != *st2) p2 = p;
|
||||||
if (*p2 == *st2) p2++;
|
if (*p2 == *st2) p2++;
|
||||||
if (*st2 == ' ') p2 = p;
|
if (*st2 == ' ') p2 = p;
|
||||||
else if (*st2 == '=') {
|
else if (*st2 == '=')
|
||||||
|
{
|
||||||
p2 = p;
|
p2 = p;
|
||||||
while (*st2 != ' ') {
|
while (*st2 != ' ')
|
||||||
if (*st2 == '"') {
|
{
|
||||||
|
if (*st2 == '"')
|
||||||
|
{
|
||||||
st2++;
|
st2++;
|
||||||
while (*st2 != '"') st2++;
|
while (*st2 != '"') st2++;
|
||||||
}
|
}
|
||||||
@@ -199,23 +215,29 @@ wxString wxHtmlTag::GetParam(const wxString& par, bool with_commas) const
|
|||||||
|
|
||||||
if (*st == 0) return "";
|
if (*st == 0) return "";
|
||||||
if (*p == 0) return "";
|
if (*p == 0) return "";
|
||||||
for (st2 = st, p2 = p; ; st2++) {
|
for (st2 = st, p2 = p; ; st2++)
|
||||||
if (*p2 == 0) { // found
|
{
|
||||||
|
if (*p2 == 0) // found
|
||||||
|
{
|
||||||
wxString fnd = "";
|
wxString fnd = "";
|
||||||
st2++; // '=' character
|
st2++; // '=' character
|
||||||
comma = FALSE;
|
comma = FALSE;
|
||||||
comma_char = '\0';
|
comma_char = '\0';
|
||||||
if (!with_commas && (*(st2) == '"')) {
|
if (!with_commas && (*(st2) == '"'))
|
||||||
|
{
|
||||||
st2++;
|
st2++;
|
||||||
comma = TRUE;
|
comma = TRUE;
|
||||||
comma_char = '"';
|
comma_char = '"';
|
||||||
}
|
}
|
||||||
else if (!with_commas && (*(st2) == '\'')) {
|
else if (!with_commas && (*(st2) == '\''))
|
||||||
|
{
|
||||||
st2++;
|
st2++;
|
||||||
comma = TRUE;
|
comma = TRUE;
|
||||||
comma_char = '\'';
|
comma_char = '\'';
|
||||||
}
|
}
|
||||||
while (*st2 != 0) {
|
|
||||||
|
while (*st2 != 0)
|
||||||
|
{
|
||||||
if (comma && *st2 == comma_char) comma = FALSE;
|
if (comma && *st2 == comma_char) comma = FALSE;
|
||||||
else if ((*st2 == ' ') && (!comma)) break;
|
else if ((*st2 == ' ') && (!comma)) break;
|
||||||
fnd += (*(st2++));
|
fnd += (*(st2++));
|
||||||
@@ -227,14 +249,18 @@ wxString wxHtmlTag::GetParam(const wxString& par, bool with_commas) const
|
|||||||
if (*p2 != *st2) p2 = p;
|
if (*p2 != *st2) p2 = p;
|
||||||
if (*p2 == *st2) p2++;
|
if (*p2 == *st2) p2++;
|
||||||
if (*st2 == ' ') p2 = p;
|
if (*st2 == ' ') p2 = p;
|
||||||
else if (*st2 == '=') {
|
else if (*st2 == '=')
|
||||||
|
{
|
||||||
p2 = p;
|
p2 = p;
|
||||||
while (*st2 != ' ') {
|
while (*st2 != ' ')
|
||||||
if (*st2 == '"') {
|
{
|
||||||
|
if (*st2 == '"')
|
||||||
|
{
|
||||||
st2++;
|
st2++;
|
||||||
while (*st2 != '"') st2++;
|
while (*st2 != '"') st2++;
|
||||||
}
|
}
|
||||||
else if (*st2 == '\'') {
|
else if (*st2 == '\'')
|
||||||
|
{
|
||||||
st2++;
|
st2++;
|
||||||
while (*st2 != '\'') st2++;
|
while (*st2 != '\'') st2++;
|
||||||
}
|
}
|
||||||
|
@@ -58,7 +58,7 @@ wxHtmlWindow::wxHtmlWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos,
|
|||||||
m_HistoryPos = -1;
|
m_HistoryPos = -1;
|
||||||
m_HistoryOn = TRUE;
|
m_HistoryOn = TRUE;
|
||||||
m_Style = style;
|
m_Style = style;
|
||||||
SetPage("<html><body></body></html>");
|
SetPage(wxT("<html><body></body></html>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -109,7 +109,8 @@ bool wxHtmlWindow::SetPage(const wxString& source)
|
|||||||
SetBackgroundColour(wxColour(0xFF, 0xFF, 0xFF));
|
SetBackgroundColour(wxColour(0xFF, 0xFF, 0xFF));
|
||||||
m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString;
|
m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString;
|
||||||
m_Parser->SetDC(dc);
|
m_Parser->SetDC(dc);
|
||||||
if (m_Cell) {
|
if (m_Cell)
|
||||||
|
{
|
||||||
delete m_Cell;
|
delete m_Cell;
|
||||||
m_Cell = NULL;
|
m_Cell = NULL;
|
||||||
}
|
}
|
||||||
@@ -133,43 +134,50 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
|||||||
wxYield(); Refresh(FALSE);
|
wxYield(); Refresh(FALSE);
|
||||||
|
|
||||||
m_tmpCanDrawLocks++;
|
m_tmpCanDrawLocks++;
|
||||||
if (m_HistoryOn && (m_HistoryPos != -1)) { // store scroll position into history item
|
if (m_HistoryOn && (m_HistoryPos != -1)) // store scroll position into history item
|
||||||
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
ViewStart(&x, &y);
|
ViewStart(&x, &y);
|
||||||
m_History[m_HistoryPos].SetPos(y);
|
m_History[m_HistoryPos].SetPos(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location[0] == wxT('#')) { // local anchor
|
if (location[0] == wxT('#')) // local anchor
|
||||||
|
{
|
||||||
wxString anch = location.Mid(1) /*1 to end*/;
|
wxString anch = location.Mid(1) /*1 to end*/;
|
||||||
m_tmpCanDrawLocks--;
|
m_tmpCanDrawLocks--;
|
||||||
rt_val = ScrollToAnchor(anch);
|
rt_val = ScrollToAnchor(anch);
|
||||||
m_tmpCanDrawLocks++;
|
m_tmpCanDrawLocks++;
|
||||||
}
|
}
|
||||||
else if (location.Find(wxT('#')) != wxNOT_FOUND && location.BeforeFirst(wxT('#')) == m_OpenedPage) {
|
else if (location.Find(wxT('#')) != wxNOT_FOUND && location.BeforeFirst(wxT('#')) == m_OpenedPage)
|
||||||
|
{
|
||||||
wxString anch = location.AfterFirst(wxT('#'));
|
wxString anch = location.AfterFirst(wxT('#'));
|
||||||
m_tmpCanDrawLocks--;
|
m_tmpCanDrawLocks--;
|
||||||
rt_val = ScrollToAnchor(anch);
|
rt_val = ScrollToAnchor(anch);
|
||||||
m_tmpCanDrawLocks++;
|
m_tmpCanDrawLocks++;
|
||||||
}
|
}
|
||||||
else if (location.Find(wxT('#')) != wxNOT_FOUND &&
|
else if (location.Find(wxT('#')) != wxNOT_FOUND &&
|
||||||
(m_FS -> GetPath() + location.BeforeFirst(wxT('#'))) == m_OpenedPage) {
|
(m_FS->GetPath() + location.BeforeFirst(wxT('#'))) == m_OpenedPage)
|
||||||
|
{
|
||||||
wxString anch = location.AfterFirst(wxT('#'));
|
wxString anch = location.AfterFirst(wxT('#'));
|
||||||
m_tmpCanDrawLocks--;
|
m_tmpCanDrawLocks--;
|
||||||
rt_val = ScrollToAnchor(anch);
|
rt_val = ScrollToAnchor(anch);
|
||||||
m_tmpCanDrawLocks++;
|
m_tmpCanDrawLocks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
needs_refresh = TRUE;
|
needs_refresh = TRUE;
|
||||||
// load&display it:
|
// load&display it:
|
||||||
if (m_RelatedStatusBar != -1) {
|
if (m_RelatedStatusBar != -1)
|
||||||
|
{
|
||||||
m_RelatedFrame->SetStatusText(_("Connecting..."), m_RelatedStatusBar);
|
m_RelatedFrame->SetStatusText(_("Connecting..."), m_RelatedStatusBar);
|
||||||
Refresh(FALSE);
|
Refresh(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
f = m_FS->OpenFile(location);
|
f = m_FS->OpenFile(location);
|
||||||
|
|
||||||
if (f == NULL) {
|
if (f == NULL)
|
||||||
|
{
|
||||||
wxString err;
|
wxString err;
|
||||||
|
|
||||||
wxLogError(_("Unable to open requested HTML document: %s"), location.c_str());
|
wxLogError(_("Unable to open requested HTML document: %s"), location.c_str());
|
||||||
@@ -179,26 +187,31 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
wxNode *node;
|
wxNode *node;
|
||||||
wxString src = wxEmptyString;
|
wxString src = wxEmptyString;
|
||||||
|
|
||||||
if (m_RelatedStatusBar != -1) {
|
if (m_RelatedStatusBar != -1)
|
||||||
|
{
|
||||||
wxString msg = _("Loading : ") + location;
|
wxString msg = _("Loading : ") + location;
|
||||||
m_RelatedFrame->SetStatusText(msg, m_RelatedStatusBar);
|
m_RelatedFrame->SetStatusText(msg, m_RelatedStatusBar);
|
||||||
Refresh(FALSE);
|
Refresh(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
node = m_Filters.GetFirst();
|
node = m_Filters.GetFirst();
|
||||||
while (node){
|
while (node)
|
||||||
|
{
|
||||||
wxHtmlFilter *h = (wxHtmlFilter*) node->GetData();
|
wxHtmlFilter *h = (wxHtmlFilter*) node->GetData();
|
||||||
if (h -> CanRead(*f)) {
|
if (h->CanRead(*f))
|
||||||
|
{
|
||||||
src = h->ReadFile(*f);
|
src = h->ReadFile(*f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
if (src == wxEmptyString) {
|
if (src == wxEmptyString)
|
||||||
|
{
|
||||||
if (m_DefaultFilter == NULL) m_DefaultFilter = GetDefaultFilter();
|
if (m_DefaultFilter == NULL) m_DefaultFilter = GetDefaultFilter();
|
||||||
src = m_DefaultFilter->ReadFile(*f);
|
src = m_DefaultFilter->ReadFile(*f);
|
||||||
}
|
}
|
||||||
@@ -206,7 +219,8 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
|||||||
m_FS->ChangePathTo(f->GetLocation());
|
m_FS->ChangePathTo(f->GetLocation());
|
||||||
rt_val = SetPage(src);
|
rt_val = SetPage(src);
|
||||||
m_OpenedPage = f->GetLocation();
|
m_OpenedPage = f->GetLocation();
|
||||||
if (f -> GetAnchor() != wxEmptyString) {
|
if (f->GetAnchor() != wxEmptyString)
|
||||||
|
{
|
||||||
wxYield();
|
wxYield();
|
||||||
ScrollToAnchor(f->GetAnchor());
|
ScrollToAnchor(f->GetAnchor());
|
||||||
}
|
}
|
||||||
@@ -217,7 +231,8 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_HistoryOn) { // add this page to history there:
|
if (m_HistoryOn) // add this page to history there:
|
||||||
|
{
|
||||||
int c = m_History.GetCount() - (m_HistoryPos + 1);
|
int c = m_History.GetCount() - (m_HistoryPos + 1);
|
||||||
|
|
||||||
m_HistoryPos++;
|
m_HistoryPos++;
|
||||||
@@ -230,7 +245,8 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
|||||||
OnSetTitle(wxFileNameFromPath(m_OpenedPage));
|
OnSetTitle(wxFileNameFromPath(m_OpenedPage));
|
||||||
SetCursor(*wxSTANDARD_CURSOR);
|
SetCursor(*wxSTANDARD_CURSOR);
|
||||||
|
|
||||||
if (needs_refresh) {
|
if (needs_refresh)
|
||||||
|
{
|
||||||
wxYield();
|
wxYield();
|
||||||
m_tmpCanDrawLocks--;
|
m_tmpCanDrawLocks--;
|
||||||
Refresh();
|
Refresh();
|
||||||
@@ -251,7 +267,8 @@ bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor)
|
|||||||
wxLogWarning(_("HTML anchor %s does not exist."), anchor.c_str());
|
wxLogWarning(_("HTML anchor %s does not exist."), anchor.c_str());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
for (y = 0; c != NULL; c = c->GetParent()) y += c->GetPosY();
|
for (y = 0; c != NULL; c = c->GetParent()) y += c->GetPosY();
|
||||||
@@ -264,7 +281,8 @@ bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor)
|
|||||||
|
|
||||||
void wxHtmlWindow::OnSetTitle(const wxString& title)
|
void wxHtmlWindow::OnSetTitle(const wxString& title)
|
||||||
{
|
{
|
||||||
if (m_RelatedFrame) {
|
if (m_RelatedFrame)
|
||||||
|
{
|
||||||
wxString tit;
|
wxString tit;
|
||||||
tit.Printf(m_TitleFormat, title.c_str());
|
tit.Printf(m_TitleFormat, title.c_str());
|
||||||
m_RelatedFrame->SetTitle(tit);
|
m_RelatedFrame->SetTitle(tit);
|
||||||
@@ -282,7 +300,8 @@ void wxHtmlWindow::CreateLayout()
|
|||||||
|
|
||||||
if (!m_Cell) return;
|
if (!m_Cell) return;
|
||||||
|
|
||||||
if (m_Style & wxHW_SCROLLBAR_NEVER) {
|
if (m_Style & wxHW_SCROLLBAR_NEVER)
|
||||||
|
{
|
||||||
SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell->GetWidth() / wxHTML_SCROLL_STEP, 0); // always off
|
SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell->GetWidth() / wxHTML_SCROLL_STEP, 0); // always off
|
||||||
GetClientSize(&ClientWidth, &ClientHeight);
|
GetClientSize(&ClientWidth, &ClientHeight);
|
||||||
m_Cell->Layout(ClientWidth);
|
m_Cell->Layout(ClientWidth);
|
||||||
@@ -291,14 +310,16 @@ void wxHtmlWindow::CreateLayout()
|
|||||||
else {
|
else {
|
||||||
GetClientSize(&ClientWidth, &ClientHeight);
|
GetClientSize(&ClientWidth, &ClientHeight);
|
||||||
m_Cell->Layout(ClientWidth);
|
m_Cell->Layout(ClientWidth);
|
||||||
if (ClientHeight < m_Cell -> GetHeight() + GetCharHeight()) {
|
if (ClientHeight < m_Cell->GetHeight() + GetCharHeight())
|
||||||
|
{
|
||||||
SetScrollbars(
|
SetScrollbars(
|
||||||
wxHTML_SCROLL_STEP, wxHTML_SCROLL_STEP,
|
wxHTML_SCROLL_STEP, wxHTML_SCROLL_STEP,
|
||||||
m_Cell->GetWidth() / wxHTML_SCROLL_STEP,
|
m_Cell->GetWidth() / wxHTML_SCROLL_STEP,
|
||||||
(m_Cell->GetHeight() + GetCharHeight()) / wxHTML_SCROLL_STEP
|
(m_Cell->GetHeight() + GetCharHeight()) / wxHTML_SCROLL_STEP
|
||||||
/*cheat: top-level frag is always container*/);
|
/*cheat: top-level frag is always container*/);
|
||||||
}
|
}
|
||||||
else { /* we fit into window, no need for scrollbars */
|
else /* we fit into window, no need for scrollbars */
|
||||||
|
{
|
||||||
SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell->GetWidth() / wxHTML_SCROLL_STEP, 0); // disable...
|
SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell->GetWidth() / wxHTML_SCROLL_STEP, 0); // disable...
|
||||||
GetClientSize(&ClientWidth, &ClientHeight);
|
GetClientSize(&ClientWidth, &ClientHeight);
|
||||||
m_Cell->Layout(ClientWidth); // ...and relayout
|
m_Cell->Layout(ClientWidth); // ...and relayout
|
||||||
@@ -315,7 +336,8 @@ void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path)
|
|||||||
int p_fontsizes[7];
|
int p_fontsizes[7];
|
||||||
wxString p_fff, p_ffn;
|
wxString p_fff, p_ffn;
|
||||||
|
|
||||||
if (path != wxEmptyString) {
|
if (path != wxEmptyString)
|
||||||
|
{
|
||||||
oldpath = cfg->GetPath();
|
oldpath = cfg->GetPath();
|
||||||
cfg->SetPath(path);
|
cfg->SetPath(path);
|
||||||
}
|
}
|
||||||
@@ -323,7 +345,8 @@ void wxHtmlWindow::ReadCustomization(wxConfigBase *cfg, wxString path)
|
|||||||
m_Borders = cfg->Read("wxHtmlWindow/Borders", m_Borders);
|
m_Borders = cfg->Read("wxHtmlWindow/Borders", m_Borders);
|
||||||
p_fff = cfg->Read("wxHtmlWindow/FontFaceFixed", m_Parser->m_FontFaceFixed);
|
p_fff = cfg->Read("wxHtmlWindow/FontFaceFixed", m_Parser->m_FontFaceFixed);
|
||||||
p_ffn = cfg->Read("wxHtmlWindow/FontFaceNormal", m_Parser->m_FontFaceNormal);
|
p_ffn = cfg->Read("wxHtmlWindow/FontFaceNormal", m_Parser->m_FontFaceNormal);
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++)
|
||||||
|
{
|
||||||
tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i);
|
tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i);
|
||||||
p_fontsizes[i] = cfg->Read(tmp, m_Parser->m_FontsSizes[i]);
|
p_fontsizes[i] = cfg->Read(tmp, m_Parser->m_FontsSizes[i]);
|
||||||
}
|
}
|
||||||
@@ -340,7 +363,8 @@ void wxHtmlWindow::WriteCustomization(wxConfigBase *cfg, wxString path)
|
|||||||
wxString oldpath;
|
wxString oldpath;
|
||||||
wxString tmp;
|
wxString tmp;
|
||||||
|
|
||||||
if (path != wxEmptyString) {
|
if (path != wxEmptyString)
|
||||||
|
{
|
||||||
oldpath = cfg->GetPath();
|
oldpath = cfg->GetPath();
|
||||||
cfg->SetPath(path);
|
cfg->SetPath(path);
|
||||||
}
|
}
|
||||||
@@ -348,7 +372,8 @@ void wxHtmlWindow::WriteCustomization(wxConfigBase *cfg, wxString path)
|
|||||||
cfg->Write("wxHtmlWindow/Borders", (long) m_Borders);
|
cfg->Write("wxHtmlWindow/Borders", (long) m_Borders);
|
||||||
cfg->Write("wxHtmlWindow/FontFaceFixed", m_Parser->m_FontFaceFixed);
|
cfg->Write("wxHtmlWindow/FontFaceFixed", m_Parser->m_FontFaceFixed);
|
||||||
cfg->Write("wxHtmlWindow/FontFaceNormal", m_Parser->m_FontFaceNormal);
|
cfg->Write("wxHtmlWindow/FontFaceNormal", m_Parser->m_FontFaceNormal);
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++)
|
||||||
|
{
|
||||||
tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i);
|
tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i);
|
||||||
cfg->Write(tmp, (long) m_Parser->m_FontsSizes[i]);
|
cfg->Write(tmp, (long) m_Parser->m_FontsSizes[i]);
|
||||||
}
|
}
|
||||||
@@ -485,7 +510,8 @@ void wxHtmlWindow::OnDraw(wxDC& dc)
|
|||||||
dc.SetBackgroundMode(wxTRANSPARENT);
|
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||||
ViewStart(&x, &y);
|
ViewStart(&x, &y);
|
||||||
|
|
||||||
while (upd) {
|
while (upd)
|
||||||
|
{
|
||||||
v_y = upd.GetY();
|
v_y = upd.GetY();
|
||||||
v_h = upd.GetH();
|
v_h = upd.GetH();
|
||||||
if (m_Cell) m_Cell->Draw(dc, 0, 0, y * wxHTML_SCROLL_STEP + v_y, y * wxHTML_SCROLL_STEP + v_h + v_y);
|
if (m_Cell) m_Cell->Draw(dc, 0, 0, y * wxHTML_SCROLL_STEP + v_y, y * wxHTML_SCROLL_STEP + v_h + v_y);
|
||||||
@@ -508,7 +534,8 @@ void wxHtmlWindow::OnMouseEvent(wxMouseEvent& event)
|
|||||||
{
|
{
|
||||||
m_tmpMouseMoved = TRUE;
|
m_tmpMouseMoved = TRUE;
|
||||||
|
|
||||||
if (event.ButtonDown()) {
|
if (event.ButtonDown())
|
||||||
|
{
|
||||||
int sx, sy;
|
int sx, sy;
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
wxString lnk;
|
wxString lnk;
|
||||||
@@ -531,7 +558,8 @@ void wxHtmlWindow::OnIdle(wxIdleEvent& event)
|
|||||||
s_cur_arrow = new wxCursor(wxCURSOR_ARROW);
|
s_cur_arrow = new wxCursor(wxCURSOR_ARROW);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_tmpMouseMoved && (m_Cell != NULL)) {
|
if (m_tmpMouseMoved && (m_Cell != NULL))
|
||||||
|
{
|
||||||
int sx, sy;
|
int sx, sy;
|
||||||
int x, y;
|
int x, y;
|
||||||
wxHtmlLinkInfo *lnk;
|
wxHtmlLinkInfo *lnk;
|
||||||
@@ -541,12 +569,15 @@ void wxHtmlWindow::OnIdle(wxIdleEvent& event)
|
|||||||
ScreenToClient(&x, &y);
|
ScreenToClient(&x, &y);
|
||||||
lnk = m_Cell->GetLink(sx + x, sy + y);
|
lnk = m_Cell->GetLink(sx + x, sy + y);
|
||||||
|
|
||||||
if (lnk != m_tmpLastLink) {
|
if (lnk != m_tmpLastLink)
|
||||||
if (lnk == NULL) {
|
{
|
||||||
|
if (lnk == NULL)
|
||||||
|
{
|
||||||
SetCursor(*s_cur_arrow);
|
SetCursor(*s_cur_arrow);
|
||||||
if (m_RelatedStatusBar != -1) m_RelatedFrame->SetStatusText(wxEmptyString, m_RelatedStatusBar);
|
if (m_RelatedStatusBar != -1) m_RelatedFrame->SetStatusText(wxEmptyString, m_RelatedStatusBar);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
SetCursor(*s_cur_hand);
|
SetCursor(*s_cur_hand);
|
||||||
if (m_RelatedStatusBar != -1)
|
if (m_RelatedStatusBar != -1)
|
||||||
m_RelatedFrame->SetStatusText(lnk->GetHref(), m_RelatedStatusBar);
|
m_RelatedFrame->SetStatusText(lnk->GetHref(), m_RelatedStatusBar);
|
||||||
|
@@ -101,7 +101,8 @@ int wxHtmlDCRenderer::Render(int x, int y, int from, int dont_render)
|
|||||||
while (m_Cells->AdjustPagebreak(&pbreak)) {}
|
while (m_Cells->AdjustPagebreak(&pbreak)) {}
|
||||||
hght = pbreak - from;
|
hght = pbreak - from;
|
||||||
|
|
||||||
if (!dont_render) {
|
if (!dont_render)
|
||||||
|
{
|
||||||
m_DC->SetBrush(*wxWHITE_BRUSH);
|
m_DC->SetBrush(*wxWHITE_BRUSH);
|
||||||
|
|
||||||
m_DC->SetClippingRegion(x, y, m_Width, hght);
|
m_DC->SetClippingRegion(x, y, m_Width, hght);
|
||||||
@@ -193,19 +194,23 @@ bool wxHtmlPrintout::OnBeginDocument(int startPage, int endPage)
|
|||||||
m_RendererHdr->SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY);
|
m_RendererHdr->SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY);
|
||||||
m_RendererHdr->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginTop)),
|
m_RendererHdr->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginTop)),
|
||||||
(int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom)));
|
(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_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[0], 1));
|
||||||
m_HeaderHeight = m_RendererHdr->GetTotalHeight();
|
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_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[1], 1));
|
||||||
m_HeaderHeight = m_RendererHdr->GetTotalHeight();
|
m_HeaderHeight = m_RendererHdr->GetTotalHeight();
|
||||||
}
|
}
|
||||||
if (m_Footers[0] != wxEmptyString) {
|
if (m_Footers[0] != wxEmptyString)
|
||||||
|
{
|
||||||
m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[0], 1));
|
m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[0], 1));
|
||||||
m_FooterHeight = m_RendererHdr->GetTotalHeight();
|
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_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[1], 1));
|
||||||
m_FooterHeight = m_RendererHdr->GetTotalHeight();
|
m_FooterHeight = m_RendererHdr->GetTotalHeight();
|
||||||
}
|
}
|
||||||
@@ -227,12 +232,13 @@ bool wxHtmlPrintout::OnBeginDocument(int startPage, int endPage)
|
|||||||
bool wxHtmlPrintout::OnPrintPage(int page)
|
bool wxHtmlPrintout::OnPrintPage(int page)
|
||||||
{
|
{
|
||||||
wxDC *dc = GetDC();
|
wxDC *dc = GetDC();
|
||||||
if (dc) {
|
if (dc)
|
||||||
|
{
|
||||||
if (HasPage(page))
|
if (HasPage(page))
|
||||||
RenderPage(dc, page);
|
RenderPage(dc, page);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else
|
}
|
||||||
return FALSE;
|
else return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -323,7 +329,8 @@ void wxHtmlPrintout::CountPages()
|
|||||||
m_NumPages = 0;
|
m_NumPages = 0;
|
||||||
|
|
||||||
m_PageBreaks[0] = 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),
|
(int) (ppmm_v * (m_MarginTop + (m_HeaderHeight == 0 ? 0 : m_MarginSpace)) + m_HeaderHeight),
|
||||||
pos, TRUE);
|
pos, TRUE);
|
||||||
@@ -363,11 +370,13 @@ void wxHtmlPrintout::RenderPage(wxDC *dc, int page)
|
|||||||
m_PageBreaks[page-1]);
|
m_PageBreaks[page-1]);
|
||||||
|
|
||||||
m_RendererHdr->SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY);
|
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->SetHtmlText(TranslateHeader(m_Headers[page % 2], page));
|
||||||
m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (ppmm_v * m_MarginTop));
|
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->SetHtmlText(TranslateHeader(m_Footers[page % 2], page));
|
||||||
m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (pageHeight - ppmm_v * m_MarginBottom - m_FooterHeight));
|
m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (pageHeight - ppmm_v * m_MarginBottom - m_FooterHeight));
|
||||||
}
|
}
|
||||||
@@ -481,7 +490,8 @@ bool wxHtmlEasyPrinting::DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *pr
|
|||||||
// Pass two printout objects: for preview, and possible printing.
|
// Pass two printout objects: for preview, and possible printing.
|
||||||
wxPrintDialogData printDialogData(*m_PrintData);
|
wxPrintDialogData printDialogData(*m_PrintData);
|
||||||
wxPrintPreview *preview = new wxPrintPreview(printout1, printout2, &printDialogData);
|
wxPrintPreview *preview = new wxPrintPreview(printout1, printout2, &printDialogData);
|
||||||
if (!preview -> Ok()) {
|
if (!preview->Ok())
|
||||||
|
{
|
||||||
delete preview;
|
delete preview;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -531,7 +541,8 @@ void wxHtmlEasyPrinting::PageSetup()
|
|||||||
m_PageSetupData->SetPrintData(*m_PrintData);
|
m_PageSetupData->SetPrintData(*m_PrintData);
|
||||||
wxPageSetupDialog pageSetupDialog(m_Frame, m_PageSetupData);
|
wxPageSetupDialog pageSetupDialog(m_Frame, m_PageSetupData);
|
||||||
|
|
||||||
if (pageSetupDialog.ShowModal() == wxID_OK) {
|
if (pageSetupDialog.ShowModal() == wxID_OK)
|
||||||
|
{
|
||||||
(*m_PrintData) = pageSetupDialog.GetPageSetupData().GetPrintData();
|
(*m_PrintData) = pageSetupDialog.GetPageSetupData().GetPrintData();
|
||||||
(*m_PageSetupData) = pageSetupDialog.GetPageSetupData();
|
(*m_PageSetupData) = pageSetupDialog.GetPageSetupData();
|
||||||
}
|
}
|
||||||
|
@@ -43,8 +43,10 @@ TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD")
|
|||||||
wxHtmlContainerCell *c;
|
wxHtmlContainerCell *c;
|
||||||
|
|
||||||
|
|
||||||
if (tag.GetName() == wxT("DL")) {
|
if (tag.GetName() == wxT("DL"))
|
||||||
if (m_WParser -> GetContainer() -> GetFirstCell() != NULL) {
|
{
|
||||||
|
if (m_WParser->GetContainer()->GetFirstCell() != NULL)
|
||||||
|
{
|
||||||
m_WParser->CloseContainer();
|
m_WParser->CloseContainer();
|
||||||
m_WParser->OpenContainer();
|
m_WParser->OpenContainer();
|
||||||
}
|
}
|
||||||
@@ -52,7 +54,8 @@ TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD")
|
|||||||
|
|
||||||
ParseInner(tag);
|
ParseInner(tag);
|
||||||
|
|
||||||
if (m_WParser -> GetContainer() -> GetFirstCell() != NULL) {
|
if (m_WParser->GetContainer()->GetFirstCell() != NULL)
|
||||||
|
{
|
||||||
m_WParser->CloseContainer();
|
m_WParser->CloseContainer();
|
||||||
m_WParser->OpenContainer();
|
m_WParser->OpenContainer();
|
||||||
}
|
}
|
||||||
@@ -61,8 +64,10 @@ TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD")
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (tag.GetName() == wxT("DT")) {
|
else if (tag.GetName() == wxT("DT"))
|
||||||
if (!tag.IsEnding()) {
|
{
|
||||||
|
if (!tag.IsEnding())
|
||||||
|
{
|
||||||
m_WParser->CloseContainer();
|
m_WParser->CloseContainer();
|
||||||
c = m_WParser->OpenContainer();
|
c = m_WParser->OpenContainer();
|
||||||
c->SetAlignHor(wxHTML_ALIGN_LEFT);
|
c->SetAlignHor(wxHTML_ALIGN_LEFT);
|
||||||
@@ -71,7 +76,8 @@ TAG_HANDLER_BEGIN(DEFLIST, "DL,DT,DD")
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!tag.IsEnding()) { // "DD"
|
else if (!tag.IsEnding()) // "DD"
|
||||||
|
{
|
||||||
m_WParser->CloseContainer();
|
m_WParser->CloseContainer();
|
||||||
c = m_WParser->OpenContainer();
|
c = m_WParser->OpenContainer();
|
||||||
c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_LEFT);
|
c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_LEFT);
|
||||||
|
@@ -43,20 +43,24 @@ TAG_HANDLER_BEGIN(FONT, "FONT")
|
|||||||
int oldsize = m_WParser->GetFontSize();
|
int oldsize = m_WParser->GetFontSize();
|
||||||
wxString oldface = m_WParser->GetFontFace();
|
wxString oldface = m_WParser->GetFontFace();
|
||||||
|
|
||||||
if (tag.HasParam(wxT("COLOR"))) {
|
if (tag.HasParam(wxT("COLOR")))
|
||||||
|
{
|
||||||
unsigned long tmp = 0;
|
unsigned long tmp = 0;
|
||||||
wxColour clr;
|
wxColour clr;
|
||||||
if (tag.ScanParam(wxT("COLOR"), wxT("#%lX"), &tmp) == 1) {
|
if (tag.ScanParam(wxT("COLOR"), wxT("#%lX"), &tmp) == 1)
|
||||||
|
{
|
||||||
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
|
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
|
||||||
m_WParser->SetActualColor(clr);
|
m_WParser->SetActualColor(clr);
|
||||||
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr));
|
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.HasParam(wxT("SIZE"))) {
|
if (tag.HasParam(wxT("SIZE")))
|
||||||
|
{
|
||||||
long tmp = 0;
|
long tmp = 0;
|
||||||
wxChar c = tag.GetParam(wxT("SIZE"))[(unsigned int) 0];
|
wxChar c = tag.GetParam(wxT("SIZE"))[(unsigned int) 0];
|
||||||
if (tag.ScanParam(wxT("SIZE"), wxT("%li"), &tmp) == 1) {
|
if (tag.ScanParam(wxT("SIZE"), wxT("%li"), &tmp) == 1)
|
||||||
|
{
|
||||||
if (c == '+' || c == '-')
|
if (c == '+' || c == '-')
|
||||||
m_WParser->SetFontSize(oldsize+tmp);
|
m_WParser->SetFontSize(oldsize+tmp);
|
||||||
else
|
else
|
||||||
@@ -65,8 +69,10 @@ TAG_HANDLER_BEGIN(FONT, "FONT")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.HasParam(wxT("FACE"))) {
|
if (tag.HasParam(wxT("FACE")))
|
||||||
if (m_Faces.GetCount() == 0) {
|
{
|
||||||
|
if (m_Faces.GetCount() == 0)
|
||||||
|
{
|
||||||
wxFontEnumerator enu;
|
wxFontEnumerator enu;
|
||||||
enu.EnumerateFacenames();
|
enu.EnumerateFacenames();
|
||||||
m_Faces = *enu.GetFacenames();
|
m_Faces = *enu.GetFacenames();
|
||||||
@@ -75,24 +81,30 @@ TAG_HANDLER_BEGIN(FONT, "FONT")
|
|||||||
int index;
|
int index;
|
||||||
|
|
||||||
while (tk.HasMoreTokens())
|
while (tk.HasMoreTokens())
|
||||||
if ((index = m_Faces.Index(tk.GetNextToken())) != wxNOT_FOUND) {
|
{
|
||||||
|
if ((index = m_Faces.Index(tk.GetNextToken())) != wxNOT_FOUND)
|
||||||
|
{
|
||||||
m_WParser->SetFontFace(m_Faces[index]);
|
m_WParser->SetFontFace(m_Faces[index]);
|
||||||
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ParseInner(tag);
|
ParseInner(tag);
|
||||||
|
|
||||||
if (oldface != m_WParser -> GetFontFace()) {
|
if (oldface != m_WParser->GetFontFace())
|
||||||
|
{
|
||||||
m_WParser->SetFontFace(oldface);
|
m_WParser->SetFontFace(oldface);
|
||||||
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||||
}
|
}
|
||||||
if (oldsize != m_WParser -> GetFontSize()) {
|
if (oldsize != m_WParser->GetFontSize())
|
||||||
|
{
|
||||||
m_WParser->SetFontSize(oldsize);
|
m_WParser->SetFontSize(oldsize);
|
||||||
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||||
}
|
}
|
||||||
if (oldclr != m_WParser -> GetActualColor()) {
|
if (oldclr != m_WParser->GetActualColor())
|
||||||
|
{
|
||||||
m_WParser->SetActualColor(oldclr);
|
m_WParser->SetActualColor(oldclr);
|
||||||
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(oldclr));
|
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(oldclr));
|
||||||
}
|
}
|
||||||
@@ -212,21 +224,24 @@ TAG_HANDLER_BEGIN(Hx, "H1,H2,H3,H4,H5,H6")
|
|||||||
m_WParser->SetFontSize(6);
|
m_WParser->SetFontSize(6);
|
||||||
else if (tag.GetName() == wxT("H3"))
|
else if (tag.GetName() == wxT("H3"))
|
||||||
m_WParser->SetFontSize(5);
|
m_WParser->SetFontSize(5);
|
||||||
else if (tag.GetName() == wxT("H4")) {
|
else if (tag.GetName() == wxT("H4"))
|
||||||
|
{
|
||||||
m_WParser->SetFontSize(5);
|
m_WParser->SetFontSize(5);
|
||||||
m_WParser->SetFontItalic(TRUE);
|
m_WParser->SetFontItalic(TRUE);
|
||||||
m_WParser->SetFontBold(FALSE);
|
m_WParser->SetFontBold(FALSE);
|
||||||
}
|
}
|
||||||
else if (tag.GetName() == wxT("H5"))
|
else if (tag.GetName() == wxT("H5"))
|
||||||
m_WParser->SetFontSize(4);
|
m_WParser->SetFontSize(4);
|
||||||
else if (tag.GetName() == wxT("H6")) {
|
else if (tag.GetName() == wxT("H6"))
|
||||||
|
{
|
||||||
m_WParser->SetFontSize(4);
|
m_WParser->SetFontSize(4);
|
||||||
m_WParser->SetFontItalic(TRUE);
|
m_WParser->SetFontItalic(TRUE);
|
||||||
m_WParser->SetFontBold(FALSE);
|
m_WParser->SetFontBold(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
c = m_WParser->GetContainer();
|
c = m_WParser->GetContainer();
|
||||||
if (c -> GetFirstCell()) {
|
if (c->GetFirstCell())
|
||||||
|
{
|
||||||
m_WParser->CloseContainer();
|
m_WParser->CloseContainer();
|
||||||
m_WParser->OpenContainer();
|
m_WParser->OpenContainer();
|
||||||
c = m_WParser->GetContainer();
|
c = m_WParser->GetContainer();
|
||||||
|
@@ -73,7 +73,8 @@ wxHtmlImageMapAreaCell::wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::celltype
|
|||||||
wxString x = incoords, y;
|
wxString x = incoords, y;
|
||||||
|
|
||||||
type = t;
|
type = t;
|
||||||
while ((i = x.Find( ',' )) != -1) {
|
while ((i = x.Find( ',' )) != -1)
|
||||||
|
{
|
||||||
coords.Add( (int)(pixel_scale * (double)wxAtoi( x.Left( i ).c_str())) );
|
coords.Add( (int)(pixel_scale * (double)wxAtoi( x.Left( i ).c_str())) );
|
||||||
x = x.Mid( i + 1 );
|
x = x.Mid( i + 1 );
|
||||||
}
|
}
|
||||||
@@ -82,7 +83,8 @@ wxHtmlImageMapAreaCell::wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::celltype
|
|||||||
|
|
||||||
wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
|
wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type)
|
||||||
|
{
|
||||||
case RECT:
|
case RECT:
|
||||||
{
|
{
|
||||||
int l, t, r, b;
|
int l, t, r, b;
|
||||||
@@ -91,7 +93,8 @@ wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
|
|||||||
t = coords[ 1 ];
|
t = coords[ 1 ];
|
||||||
r = coords[ 2 ];
|
r = coords[ 2 ];
|
||||||
b = coords[ 3 ];
|
b = coords[ 3 ];
|
||||||
if (x >= l && x <= r && y >= t && y <= b) {
|
if (x >= l && x <= r && y >= t && y <= b)
|
||||||
|
{
|
||||||
return m_Link;
|
return m_Link;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -105,14 +108,16 @@ wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
|
|||||||
t = coords[ 1 ];
|
t = coords[ 1 ];
|
||||||
r = coords[ 2 ];
|
r = coords[ 2 ];
|
||||||
d = sqrt( (double) (((x - l) * (x - l)) + ((y - t) * (y - t))) );
|
d = sqrt( (double) (((x - l) * (x - l)) + ((y - t) * (y - t))) );
|
||||||
if (d < (double)r) {
|
if (d < (double)r)
|
||||||
|
{
|
||||||
return m_Link;
|
return m_Link;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case POLY:
|
case POLY:
|
||||||
{
|
{
|
||||||
if (coords.GetCount() >= 6) {
|
if (coords.GetCount() >= 6)
|
||||||
|
{
|
||||||
int intersects = 0;
|
int intersects = 0;
|
||||||
int wherex = x;
|
int wherex = x;
|
||||||
int wherey = y;
|
int wherey = y;
|
||||||
@@ -123,46 +128,63 @@ wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
|
|||||||
int end = totalc;
|
int end = totalc;
|
||||||
int pointer = 1;
|
int pointer = 1;
|
||||||
|
|
||||||
if ((yval >= wherey) != (coords[pointer] >= wherey)) {
|
if ((yval >= wherey) != (coords[pointer] >= wherey))
|
||||||
if ((xval >= wherex) == (coords[0] >= wherex)) {
|
{
|
||||||
|
if ((xval >= wherex) == (coords[0] >= wherex))
|
||||||
|
{
|
||||||
intersects += (xval >= wherex) ? 1 : 0;
|
intersects += (xval >= wherex) ? 1 : 0;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
intersects += ((xval - (yval - wherey) *
|
intersects += ((xval - (yval - wherey) *
|
||||||
(coords[0] - xval) /
|
(coords[0] - xval) /
|
||||||
(coords[pointer] - yval)) >= wherex) ? 1 : 0;
|
(coords[pointer] - yval)) >= wherex) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (pointer < end) {
|
while (pointer < end)
|
||||||
|
{
|
||||||
yval = coords[pointer];
|
yval = coords[pointer];
|
||||||
pointer += 2;
|
pointer += 2;
|
||||||
if (yval >= wherey) {
|
if (yval >= wherey)
|
||||||
while ((pointer < end) && (coords[pointer] >= wherey)) {
|
{
|
||||||
|
while ((pointer < end) && (coords[pointer] >= wherey))
|
||||||
|
{
|
||||||
pointer += 2;
|
pointer += 2;
|
||||||
}
|
}
|
||||||
if (pointer >= end) {
|
if (pointer >= end)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((coords[pointer - 3] >= wherex) ==
|
if ((coords[pointer - 3] >= wherex) ==
|
||||||
(coords[pointer - 1] >= wherex)) {
|
(coords[pointer - 1] >= wherex)) {
|
||||||
intersects += (coords[pointer - 3] >= wherex) ? 1 : 0;
|
intersects += (coords[pointer - 3] >= wherex) ? 1 : 0;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
intersects +=
|
intersects +=
|
||||||
((coords[pointer - 3] - (coords[pointer - 2] - wherey) *
|
((coords[pointer - 3] - (coords[pointer - 2] - wherey) *
|
||||||
(coords[pointer - 1] - coords[pointer - 3]) /
|
(coords[pointer - 1] - coords[pointer - 3]) /
|
||||||
(coords[pointer] - coords[pointer - 2])) >= wherex) ? 1 : 0;
|
(coords[pointer] - coords[pointer - 2])) >= wherex) ? 1 : 0;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
while ((pointer < end) && (coords[pointer] < wherey)) {
|
else
|
||||||
|
{
|
||||||
|
while ((pointer < end) && (coords[pointer] < wherey))
|
||||||
|
{
|
||||||
pointer += 2;
|
pointer += 2;
|
||||||
}
|
}
|
||||||
if (pointer >= end) {
|
if (pointer >= end)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((coords[pointer - 3] >= wherex) ==
|
if ((coords[pointer - 3] >= wherex) ==
|
||||||
(coords[pointer - 1] >= wherex)) {
|
(coords[pointer - 1] >= wherex))
|
||||||
|
{
|
||||||
intersects += (coords[pointer - 3] >= wherex) ? 1 : 0;
|
intersects += (coords[pointer - 3] >= wherex) ? 1 : 0;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
intersects +=
|
intersects +=
|
||||||
((coords[pointer - 3] - (coords[pointer - 2] - wherey) *
|
((coords[pointer - 3] - (coords[pointer - 2] - wherey) *
|
||||||
(coords[pointer - 1] - coords[pointer - 3]) /
|
(coords[pointer - 1] - coords[pointer - 3]) /
|
||||||
@@ -170,14 +192,17 @@ wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((intersects & 1) != 0) {
|
if ((intersects & 1) != 0)
|
||||||
|
{
|
||||||
return m_Link;
|
return m_Link;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (m_Next) {
|
|
||||||
|
if (m_Next)
|
||||||
|
{
|
||||||
wxHtmlImageMapAreaCell *a = (wxHtmlImageMapAreaCell*)m_Next;
|
wxHtmlImageMapAreaCell *a = (wxHtmlImageMapAreaCell*)m_Next;
|
||||||
return a->GetLink( x, y );
|
return a->GetLink( x, y );
|
||||||
}
|
}
|
||||||
@@ -226,7 +251,8 @@ wxHtmlLinkInfo *wxHtmlImageMapCell::GetLink( int x, int y ) const
|
|||||||
|
|
||||||
const wxHtmlCell *wxHtmlImageMapCell::Find( int cond, const void *param ) const
|
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)))
|
if (m_Name == *((wxString*)(param)))
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -271,7 +297,8 @@ wxHtmlImageCell::wxHtmlImageCell(wxFSFile *input, int w, int h, double scale, in
|
|||||||
img = new wxImage(*s, wxBITMAP_TYPE_ANY);
|
img = new wxImage(*s, wxBITMAP_TYPE_ANY);
|
||||||
|
|
||||||
m_Image = NULL;
|
m_Image = NULL;
|
||||||
if (img && (img -> Ok())) {
|
if (img && (img->Ok()))
|
||||||
|
{
|
||||||
ww = img->GetWidth();
|
ww = img->GetWidth();
|
||||||
hh = img->GetHeight();
|
hh = img->GetHeight();
|
||||||
if (w != -1) m_Width = w; else m_Width = ww;
|
if (w != -1) m_Width = w; else m_Width = ww;
|
||||||
@@ -280,14 +307,17 @@ wxHtmlImageCell::wxHtmlImageCell(wxFSFile *input, int w, int h, double scale, in
|
|||||||
m_Width = (int)(scale * (double)m_Width);
|
m_Width = (int)(scale * (double)m_Width);
|
||||||
m_Height = (int)(scale * (double)m_Height);
|
m_Height = (int)(scale * (double)m_Height);
|
||||||
|
|
||||||
if ((m_Width != ww) || (m_Height != hh)) {
|
if ((m_Width != ww) || (m_Height != hh))
|
||||||
|
{
|
||||||
wxImage img2 = img->Scale(m_Width, m_Height);
|
wxImage img2 = img->Scale(m_Width, m_Height);
|
||||||
m_Image = new wxBitmap(img2.ConvertToBitmap());
|
m_Image = new wxBitmap(img2.ConvertToBitmap());
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
m_Image = new wxBitmap(img->ConvertToBitmap());
|
m_Image = new wxBitmap(img->ConvertToBitmap());
|
||||||
delete img;
|
delete img;
|
||||||
}
|
}
|
||||||
switch (align) {
|
switch (align)
|
||||||
|
{
|
||||||
case wxHTML_ALIGN_TOP :
|
case wxHTML_ALIGN_TOP :
|
||||||
m_Descent = m_Height;
|
m_Descent = m_Height;
|
||||||
break;
|
break;
|
||||||
@@ -319,16 +349,19 @@ wxHtmlLinkInfo *wxHtmlImageCell::GetLink( int x, int y ) const
|
|||||||
{
|
{
|
||||||
if (m_MapName.IsEmpty())
|
if (m_MapName.IsEmpty())
|
||||||
return wxHtmlCell::GetLink( x, y );
|
return wxHtmlCell::GetLink( x, y );
|
||||||
if (!m_ImageMap) {
|
if (!m_ImageMap)
|
||||||
|
{
|
||||||
wxHtmlContainerCell *p, *op;
|
wxHtmlContainerCell *p, *op;
|
||||||
op = p = GetParent();
|
op = p = GetParent();
|
||||||
while (p) {
|
while (p)
|
||||||
|
{
|
||||||
op = p;
|
op = p;
|
||||||
p = p->GetParent();
|
p = p->GetParent();
|
||||||
}
|
}
|
||||||
p = op;
|
p = op;
|
||||||
wxHtmlCell *cell = (wxHtmlCell*)p->Find( wxHTML_COND_ISIMAGEMAP, (const void*)(&m_MapName));
|
wxHtmlCell *cell = (wxHtmlCell*)p->Find( wxHTML_COND_ISIMAGEMAP, (const void*)(&m_MapName));
|
||||||
if (!cell) {
|
if (!cell)
|
||||||
|
{
|
||||||
((wxString&)m_MapName).Clear();
|
((wxString&)m_MapName).Clear();
|
||||||
return wxHtmlCell::GetLink( x, y );
|
return wxHtmlCell::GetLink( x, y );
|
||||||
}
|
}
|
||||||
@@ -351,8 +384,10 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA")
|
|||||||
|
|
||||||
TAG_HANDLER_PROC(tag)
|
TAG_HANDLER_PROC(tag)
|
||||||
{
|
{
|
||||||
if (tag.GetName() == wxT("IMG")) {
|
if (tag.GetName() == wxT("IMG"))
|
||||||
if (tag.HasParam(wxT("SRC"))) {
|
{
|
||||||
|
if (tag.HasParam(wxT("SRC")))
|
||||||
|
{
|
||||||
int w = -1, h = -1;
|
int w = -1, h = -1;
|
||||||
int al;
|
int al;
|
||||||
wxFSFile *str;
|
wxFSFile *str;
|
||||||
@@ -363,20 +398,24 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA")
|
|||||||
if (tag.HasParam(wxT("WIDTH"))) tag.ScanParam(wxT("WIDTH"), wxT("%i"), &w);
|
if (tag.HasParam(wxT("WIDTH"))) tag.ScanParam(wxT("WIDTH"), wxT("%i"), &w);
|
||||||
if (tag.HasParam(wxT("HEIGHT"))) tag.ScanParam(wxT("HEIGHT"), wxT("%i"), &h);
|
if (tag.HasParam(wxT("HEIGHT"))) tag.ScanParam(wxT("HEIGHT"), wxT("%i"), &h);
|
||||||
al = wxHTML_ALIGN_BOTTOM;
|
al = wxHTML_ALIGN_BOTTOM;
|
||||||
if (tag.HasParam(wxT("ALIGN"))) {
|
if (tag.HasParam(wxT("ALIGN")))
|
||||||
|
{
|
||||||
wxString alstr = tag.GetParam(wxT("ALIGN"));
|
wxString alstr = tag.GetParam(wxT("ALIGN"));
|
||||||
alstr.MakeUpper(); // for the case alignment was in ".."
|
alstr.MakeUpper(); // for the case alignment was in ".."
|
||||||
if (alstr == wxT("TEXTTOP")) al = wxHTML_ALIGN_TOP;
|
if (alstr == wxT("TEXTTOP")) al = wxHTML_ALIGN_TOP;
|
||||||
else if ((alstr == wxT("CENTER")) || (alstr == wxT("ABSCENTER"))) al = wxHTML_ALIGN_CENTER;
|
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") );
|
mn = tag.GetParam( wxT("USEMAP") );
|
||||||
if (mn[ (unsigned int) 0 ] == wxT('#')) {
|
if (mn[ (unsigned int) 0 ] == wxT('#'))
|
||||||
|
{
|
||||||
mn = mn.Mid( 1 );
|
mn = mn.Mid( 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxHtmlImageCell *cel = NULL;
|
wxHtmlImageCell *cel = NULL;
|
||||||
if (str) {
|
if (str)
|
||||||
|
{
|
||||||
cel = new wxHtmlImageCell(str, w, h, m_WParser->GetPixelScale(), al, mn);
|
cel = new wxHtmlImageCell(str, w, h, m_WParser->GetPixelScale(), al, mn);
|
||||||
cel->SetLink(m_WParser->GetLink());
|
cel->SetLink(m_WParser->GetLink());
|
||||||
m_WParser->GetContainer()->InsertCell(cel);
|
m_WParser->GetContainer()->InsertCell(cel);
|
||||||
@@ -384,10 +423,12 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tag.GetName() == wxT("MAP")) {
|
if (tag.GetName() == wxT("MAP"))
|
||||||
|
{
|
||||||
m_WParser->CloseContainer();
|
m_WParser->CloseContainer();
|
||||||
m_WParser->OpenContainer();
|
m_WParser->OpenContainer();
|
||||||
if (tag.HasParam(wxT("NAME"))) {
|
if (tag.HasParam(wxT("NAME")))
|
||||||
|
{
|
||||||
wxString tmp = tag.GetParam(wxT("NAME"));
|
wxString tmp = tag.GetParam(wxT("NAME"));
|
||||||
wxHtmlImageMapCell *cel = new wxHtmlImageMapCell( tmp );
|
wxHtmlImageMapCell *cel = new wxHtmlImageMapCell( tmp );
|
||||||
m_WParser->GetContainer()->InsertCell( cel );
|
m_WParser->GetContainer()->InsertCell( cel );
|
||||||
@@ -396,23 +437,32 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA")
|
|||||||
m_WParser->CloseContainer();
|
m_WParser->CloseContainer();
|
||||||
m_WParser->OpenContainer();
|
m_WParser->OpenContainer();
|
||||||
}
|
}
|
||||||
if (tag.GetName() == wxT("AREA")) {
|
if (tag.GetName() == wxT("AREA"))
|
||||||
if (tag.HasParam(wxT("SHAPE"))) {
|
{
|
||||||
|
if (tag.HasParam(wxT("SHAPE")))
|
||||||
|
{
|
||||||
wxString tmp = tag.GetParam(wxT("SHAPE"));
|
wxString tmp = tag.GetParam(wxT("SHAPE"));
|
||||||
wxString coords = wxEmptyString;
|
wxString coords = wxEmptyString;
|
||||||
tmp.MakeUpper();
|
tmp.MakeUpper();
|
||||||
wxHtmlImageMapAreaCell *cel = NULL;
|
wxHtmlImageMapAreaCell *cel = NULL;
|
||||||
if (tag.HasParam(wxT("COORDS"))) {
|
if (tag.HasParam(wxT("COORDS")))
|
||||||
|
{
|
||||||
coords = tag.GetParam(wxT("COORDS"));
|
coords = tag.GetParam(wxT("COORDS"));
|
||||||
}
|
}
|
||||||
if (tmp == wxT("POLY")) {
|
if (tmp == wxT("POLY"))
|
||||||
|
{
|
||||||
cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::POLY, coords, m_WParser->GetPixelScale() );
|
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() );
|
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() );
|
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 tmp = tag.GetParam(wxT("HREF"));
|
||||||
wxString target = wxEmptyString;
|
wxString target = wxEmptyString;
|
||||||
if (tag.HasParam(wxT("TARGET"))) target = tag.GetParam(wxT("TARGET"));
|
if (tag.HasParam(wxT("TARGET"))) target = tag.GetParam(wxT("TARGET"));
|
||||||
|
@@ -36,7 +36,8 @@ TAG_HANDLER_BEGIN(P, "P")
|
|||||||
|
|
||||||
TAG_HANDLER_PROC(tag)
|
TAG_HANDLER_PROC(tag)
|
||||||
{
|
{
|
||||||
if (m_WParser -> GetContainer() -> GetFirstCell() != NULL) {
|
if (m_WParser->GetContainer()->GetFirstCell() != NULL)
|
||||||
|
{
|
||||||
m_WParser->CloseContainer();
|
m_WParser->CloseContainer();
|
||||||
m_WParser->OpenContainer();
|
m_WParser->OpenContainer();
|
||||||
}
|
}
|
||||||
@@ -76,18 +77,21 @@ TAG_HANDLER_BEGIN(CENTER, "CENTER")
|
|||||||
wxHtmlContainerCell *c = m_WParser->GetContainer();
|
wxHtmlContainerCell *c = m_WParser->GetContainer();
|
||||||
|
|
||||||
m_WParser->SetAlign(wxHTML_ALIGN_CENTER);
|
m_WParser->SetAlign(wxHTML_ALIGN_CENTER);
|
||||||
if (c -> GetFirstCell() != NULL) {
|
if (c->GetFirstCell() != NULL)
|
||||||
|
{
|
||||||
m_WParser->CloseContainer();
|
m_WParser->CloseContainer();
|
||||||
m_WParser->OpenContainer();
|
m_WParser->OpenContainer();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c->SetAlignHor(wxHTML_ALIGN_CENTER);
|
c->SetAlignHor(wxHTML_ALIGN_CENTER);
|
||||||
|
|
||||||
if (tag.HasEnding()) {
|
if (tag.HasEnding())
|
||||||
|
{
|
||||||
ParseInner(tag);
|
ParseInner(tag);
|
||||||
|
|
||||||
m_WParser->SetAlign(old);
|
m_WParser->SetAlign(old);
|
||||||
if (c -> GetFirstCell() != NULL) {
|
if (c->GetFirstCell() != NULL)
|
||||||
|
{
|
||||||
m_WParser->CloseContainer();
|
m_WParser->CloseContainer();
|
||||||
m_WParser->OpenContainer();
|
m_WParser->OpenContainer();
|
||||||
}
|
}
|
||||||
@@ -109,14 +113,16 @@ TAG_HANDLER_BEGIN(DIV, "DIV")
|
|||||||
{
|
{
|
||||||
int old = m_WParser->GetAlign();
|
int old = m_WParser->GetAlign();
|
||||||
wxHtmlContainerCell *c = m_WParser->GetContainer();
|
wxHtmlContainerCell *c = m_WParser->GetContainer();
|
||||||
if (c -> GetFirstCell() != NULL) {
|
if (c->GetFirstCell() != NULL)
|
||||||
|
{
|
||||||
m_WParser->CloseContainer();
|
m_WParser->CloseContainer();
|
||||||
m_WParser->OpenContainer();
|
m_WParser->OpenContainer();
|
||||||
c = m_WParser->GetContainer();
|
c = m_WParser->GetContainer();
|
||||||
c->SetAlign(tag);
|
c->SetAlign(tag);
|
||||||
m_WParser->SetAlign(c->GetAlignHor());
|
m_WParser->SetAlign(c->GetAlignHor());
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
c->SetAlign(tag);
|
c->SetAlign(tag);
|
||||||
m_WParser->SetAlign(c->GetAlignHor());
|
m_WParser->SetAlign(c->GetAlignHor());
|
||||||
}
|
}
|
||||||
@@ -124,7 +130,8 @@ TAG_HANDLER_BEGIN(DIV, "DIV")
|
|||||||
ParseInner(tag);
|
ParseInner(tag);
|
||||||
|
|
||||||
m_WParser->SetAlign(old);
|
m_WParser->SetAlign(old);
|
||||||
if (c -> GetFirstCell() != NULL) {
|
if (c->GetFirstCell() != NULL)
|
||||||
|
{
|
||||||
m_WParser->CloseContainer();
|
m_WParser->CloseContainer();
|
||||||
m_WParser->OpenContainer();
|
m_WParser->OpenContainer();
|
||||||
}
|
}
|
||||||
@@ -143,9 +150,11 @@ TAG_HANDLER_BEGIN(TITLE, "TITLE")
|
|||||||
|
|
||||||
TAG_HANDLER_PROC(tag)
|
TAG_HANDLER_PROC(tag)
|
||||||
{
|
{
|
||||||
if (m_WParser -> GetWindow()) {
|
if (m_WParser->GetWindow())
|
||||||
|
{
|
||||||
wxHtmlWindow *wfr = (wxHtmlWindow*)(m_WParser->GetWindow());
|
wxHtmlWindow *wfr = (wxHtmlWindow*)(m_WParser->GetWindow());
|
||||||
if (wfr) {
|
if (wfr)
|
||||||
|
{
|
||||||
wxString title = "";
|
wxString title = "";
|
||||||
wxString *src = m_WParser->GetSource();
|
wxString *src = m_WParser->GetSource();
|
||||||
|
|
||||||
@@ -168,23 +177,29 @@ TAG_HANDLER_BEGIN(BODY, "BODY")
|
|||||||
unsigned long tmp;
|
unsigned long tmp;
|
||||||
wxColour clr;
|
wxColour clr;
|
||||||
|
|
||||||
if (tag.HasParam(wxT("TEXT"))) {
|
if (tag.HasParam(wxT("TEXT")))
|
||||||
if (tag.ScanParam(wxT("TEXT"), wxT("#%lX"), &tmp) == 1) {
|
{
|
||||||
|
if (tag.ScanParam(wxT("TEXT"), wxT("#%lX"), &tmp) == 1)
|
||||||
|
{
|
||||||
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
|
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
|
||||||
m_WParser->SetActualColor(clr);
|
m_WParser->SetActualColor(clr);
|
||||||
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr));
|
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.HasParam(wxT("LINK"))) {
|
if (tag.HasParam(wxT("LINK")))
|
||||||
if (tag.ScanParam(wxT("LINK"), wxT("#%lX"), &tmp) == 1) {
|
{
|
||||||
|
if (tag.ScanParam(wxT("LINK"), wxT("#%lX"), &tmp) == 1)
|
||||||
|
{
|
||||||
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
|
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
|
||||||
m_WParser->SetLinkColor(clr);
|
m_WParser->SetLinkColor(clr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.HasParam(wxT("BGCOLOR"))) {
|
if (tag.HasParam(wxT("BGCOLOR")))
|
||||||
if (tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &tmp) == 1) {
|
{
|
||||||
|
if (tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &tmp) == 1)
|
||||||
|
{
|
||||||
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
|
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
|
||||||
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr, wxHTML_CLR_BACKGROUND));
|
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr, wxHTML_CLR_BACKGROUND));
|
||||||
if (m_WParser->GetWindow() != NULL)
|
if (m_WParser->GetWindow() != NULL)
|
||||||
@@ -206,10 +221,12 @@ TAG_HANDLER_BEGIN(BLOCKQUOTE, "BLOCKQUOTE")
|
|||||||
|
|
||||||
m_WParser->CloseContainer();
|
m_WParser->CloseContainer();
|
||||||
c = m_WParser->OpenContainer();
|
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);
|
c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_RIGHT);
|
||||||
else
|
else
|
||||||
c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_LEFT);
|
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();
|
m_WParser->OpenContainer();
|
||||||
ParseInner(tag);
|
ParseInner(tag);
|
||||||
|
@@ -54,11 +54,13 @@ TAG_HANDLER_BEGIN(A, "A")
|
|||||||
|
|
||||||
TAG_HANDLER_PROC(tag)
|
TAG_HANDLER_PROC(tag)
|
||||||
{
|
{
|
||||||
if (tag.HasParam("NAME")) {
|
if (tag.HasParam("NAME"))
|
||||||
|
{
|
||||||
m_WParser->GetContainer()->InsertCell(new wxHtmlAnchorCell(tag.GetParam("NAME")));
|
m_WParser->GetContainer()->InsertCell(new wxHtmlAnchorCell(tag.GetParam("NAME")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag.HasParam("HREF")) {
|
if (tag.HasParam("HREF"))
|
||||||
|
{
|
||||||
wxHtmlLinkInfo oldlnk = m_WParser->GetLink();
|
wxHtmlLinkInfo oldlnk = m_WParser->GetLink();
|
||||||
wxColour oldclr = m_WParser->GetActualColor();
|
wxColour oldclr = m_WParser->GetActualColor();
|
||||||
int oldund = m_WParser->GetFontUnderlined();
|
int oldund = m_WParser->GetFontUnderlined();
|
||||||
|
@@ -68,7 +68,8 @@ wxHtmlPRECell::wxHtmlPRECell(const wxString& s, wxDC& dc) : wxHtmlCell()
|
|||||||
m_Width = m_Height = 0;
|
m_Width = m_Height = 0;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (tokenizer.HasMoreTokens()) {
|
while (tokenizer.HasMoreTokens())
|
||||||
|
{
|
||||||
if (i % 10 == 0) m_Text = (wxString**) realloc(m_Text, sizeof(wxString*) * (i + 10));
|
if (i % 10 == 0) m_Text = (wxString**) realloc(m_Text, sizeof(wxString*) * (i + 10));
|
||||||
tmp = tokenizer.NextToken();
|
tmp = tokenizer.NextToken();
|
||||||
tmp.Replace(wxT("©"), wxT("(c)"), TRUE);
|
tmp.Replace(wxT("©"), wxT("(c)"), TRUE);
|
||||||
|
@@ -141,7 +141,8 @@ wxHtmlTableCell::wxHtmlTableCell(wxHtmlContainerCell *parent, const wxHtmlTag& t
|
|||||||
wxHtmlTableCell::~wxHtmlTableCell()
|
wxHtmlTableCell::~wxHtmlTableCell()
|
||||||
{
|
{
|
||||||
if (m_ColsInfo) free(m_ColsInfo);
|
if (m_ColsInfo) free(m_ColsInfo);
|
||||||
if (m_CellInfo) {
|
if (m_CellInfo)
|
||||||
|
{
|
||||||
for (int i = 0; i < m_NumRows; i++)
|
for (int i = 0; i < m_NumRows; i++)
|
||||||
free(m_CellInfo[i]);
|
free(m_CellInfo[i]);
|
||||||
free(m_CellInfo);
|
free(m_CellInfo);
|
||||||
@@ -154,14 +155,16 @@ void wxHtmlTableCell::ReallocCols(int cols)
|
|||||||
{
|
{
|
||||||
int i,j;
|
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);
|
m_CellInfo[i] = (cellStruct*) realloc(m_CellInfo[i], sizeof(cellStruct) * cols);
|
||||||
for (j = m_NumCols; j < cols; j++)
|
for (j = m_NumCols; j < cols; j++)
|
||||||
m_CellInfo[i][j].flag = cellFree;
|
m_CellInfo[i][j].flag = cellFree;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ColsInfo = (colStruct*) realloc(m_ColsInfo, sizeof(colStruct) * 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].width = 0;
|
||||||
m_ColsInfo[j].units = wxHTML_UNITS_PERCENT;
|
m_ColsInfo[j].units = wxHTML_UNITS_PERCENT;
|
||||||
}
|
}
|
||||||
@@ -206,9 +209,11 @@ void wxHtmlTableCell::AddRow(const wxHtmlTag& tag)
|
|||||||
|
|
||||||
void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
|
void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
|
||||||
{
|
{
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
m_ActualCol++;
|
m_ActualCol++;
|
||||||
} while ((m_ActualCol < m_NumCols) && (m_CellInfo[m_ActualRow][m_ActualCol].flag != cellFree));
|
} while ((m_ActualCol < m_NumCols) && (m_CellInfo[m_ActualRow][m_ActualCol].flag != cellFree));
|
||||||
|
|
||||||
if (m_ActualCol > m_NumCols - 1)
|
if (m_ActualCol > m_NumCols - 1)
|
||||||
ReallocCols(m_ActualCol + 1);
|
ReallocCols(m_ActualCol + 1);
|
||||||
|
|
||||||
@@ -225,14 +230,17 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
|
|||||||
|
|
||||||
// width:
|
// width:
|
||||||
{
|
{
|
||||||
if (tag.HasParam("WIDTH")) {
|
if (tag.HasParam("WIDTH"))
|
||||||
|
{
|
||||||
wxString wd = tag.GetParam("WIDTH");
|
wxString wd = tag.GetParam("WIDTH");
|
||||||
|
|
||||||
if (wd[wd.Length()-1] == '%') {
|
if (wd[wd.Length()-1] == '%')
|
||||||
|
{
|
||||||
wxSscanf(wd.c_str(), wxT("%i%%"), &m_ColsInfo[c].width);
|
wxSscanf(wd.c_str(), wxT("%i%%"), &m_ColsInfo[c].width);
|
||||||
m_ColsInfo[c].units = wxHTML_UNITS_PERCENT;
|
m_ColsInfo[c].units = wxHTML_UNITS_PERCENT;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
wxSscanf(wd.c_str(), wxT("%i"), &m_ColsInfo[c].width);
|
wxSscanf(wd.c_str(), wxT("%i"), &m_ColsInfo[c].width);
|
||||||
m_ColsInfo[c].width = (int)(m_PixelScale * (double)m_ColsInfo[c].width);
|
m_ColsInfo[c].width = (int)(m_PixelScale * (double)m_ColsInfo[c].width);
|
||||||
m_ColsInfo[c].units = wxHTML_UNITS_PIXELS;
|
m_ColsInfo[c].units = wxHTML_UNITS_PIXELS;
|
||||||
@@ -245,7 +253,8 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
|
|||||||
{
|
{
|
||||||
if (tag.HasParam(wxT("COLSPAN"))) tag.ScanParam(wxT("COLSPAN"), wxT("%i"), &m_CellInfo[r][c].colspan);
|
if (tag.HasParam(wxT("COLSPAN"))) tag.ScanParam(wxT("COLSPAN"), wxT("%i"), &m_CellInfo[r][c].colspan);
|
||||||
if (tag.HasParam(wxT("ROWSPAN"))) tag.ScanParam(wxT("ROWSPAN"), wxT("%i"), &m_CellInfo[r][c].rowspan);
|
if (tag.HasParam(wxT("ROWSPAN"))) tag.ScanParam(wxT("ROWSPAN"), wxT("%i"), &m_CellInfo[r][c].rowspan);
|
||||||
if ((m_CellInfo[r][c].colspan != 1) || (m_CellInfo[r][c].rowspan != 1)) {
|
if ((m_CellInfo[r][c].colspan != 1) || (m_CellInfo[r][c].rowspan != 1))
|
||||||
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
if (r + m_CellInfo[r][c].rowspan > m_NumRows) ReallocRows(r + m_CellInfo[r][c].rowspan);
|
if (r + m_CellInfo[r][c].rowspan > m_NumRows) ReallocRows(r + m_CellInfo[r][c].rowspan);
|
||||||
@@ -261,7 +270,8 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
|
|||||||
{
|
{
|
||||||
int bk = m_rBkg;
|
int bk = m_rBkg;
|
||||||
if (tag.HasParam(wxT("BGCOLOR"))) tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &bk);
|
if (tag.HasParam(wxT("BGCOLOR"))) tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &bk);
|
||||||
if (bk != -1) {
|
if (bk != -1)
|
||||||
|
{
|
||||||
wxColour clr = wxColour((bk & 0xFF0000) >> 16 , (bk & 0x00FF00) >> 8, (bk & 0x0000FF));
|
wxColour clr = wxColour((bk & 0xFF0000) >> 16 , (bk & 0x00FF00) >> 8, (bk & 0x0000FF));
|
||||||
cell->SetBackgroundColour(clr);
|
cell->SetBackgroundColour(clr);
|
||||||
}
|
}
|
||||||
@@ -294,11 +304,13 @@ void wxHtmlTableCell::Layout(int w)
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (m_WidthFloatUnits == wxHTML_UNITS_PERCENT) {
|
if (m_WidthFloatUnits == wxHTML_UNITS_PERCENT)
|
||||||
|
{
|
||||||
if (m_WidthFloat < 0) m_Width = (100 + m_WidthFloat) * w / 100;
|
if (m_WidthFloat < 0) m_Width = (100 + m_WidthFloat) * w / 100;
|
||||||
else m_Width = m_WidthFloat * w / 100;
|
else m_Width = m_WidthFloat * w / 100;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
if (m_WidthFloat < 0) m_Width = w + m_WidthFloat;
|
if (m_WidthFloat < 0) m_Width = w + m_WidthFloat;
|
||||||
else m_Width = m_WidthFloat;
|
else m_Width = m_WidthFloat;
|
||||||
}
|
}
|
||||||
@@ -340,7 +352,8 @@ void wxHtmlTableCell::Layout(int w)
|
|||||||
/* 2. compute positions of columns: */
|
/* 2. compute positions of columns: */
|
||||||
{
|
{
|
||||||
int wpos = m_Spacing;
|
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;
|
m_ColsInfo[i].leftpos = wpos;
|
||||||
wpos += m_ColsInfo[i].pixwidth + m_Spacing;
|
wpos += m_ColsInfo[i].pixwidth + m_Spacing;
|
||||||
}
|
}
|
||||||
@@ -356,7 +369,8 @@ void wxHtmlTableCell::Layout(int w)
|
|||||||
|
|
||||||
for (actrow = 0; actrow <= m_NumRows; actrow++) ypos[actrow] = m_Spacing;
|
for (actrow = 0; actrow <= m_NumRows; actrow++) ypos[actrow] = m_Spacing;
|
||||||
|
|
||||||
for (actrow = 0; actrow < m_NumRows; actrow++) {
|
for (actrow = 0; actrow < m_NumRows; actrow++)
|
||||||
|
{
|
||||||
|
|
||||||
// 3a. sub-layout and detect max height:
|
// 3a. sub-layout and detect max height:
|
||||||
|
|
||||||
@@ -377,11 +391,13 @@ void wxHtmlTableCell::Layout(int w)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (actrow = 0; actrow < m_NumRows; actrow++) {
|
for (actrow = 0; actrow < m_NumRows; actrow++)
|
||||||
|
{
|
||||||
|
|
||||||
// 3b. place cells in row & let'em all have same height:
|
// 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;
|
if (m_CellInfo[actrow][actcol].flag != cellUsed) continue;
|
||||||
actcell = m_CellInfo[actrow][actcol].cont;
|
actcell = m_CellInfo[actrow][actcol].cont;
|
||||||
actcell->SetMinHeight(
|
actcell->SetMinHeight(
|
||||||
@@ -431,7 +447,8 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH")
|
|||||||
wxHtmlContainerCell *c;
|
wxHtmlContainerCell *c;
|
||||||
|
|
||||||
// new table started, backup upper-level table (if any) and create new:
|
// 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;
|
wxHtmlTableCell *oldt = m_Table;
|
||||||
wxHtmlContainerCell *oldcont;
|
wxHtmlContainerCell *oldcont;
|
||||||
int m_OldAlign;
|
int m_OldAlign;
|
||||||
@@ -454,23 +471,27 @@ TAG_HANDLER_BEGIN(TABLE, "TABLE,TR,TD,TH")
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (m_Table && !tag.IsEnding()) {
|
else if (m_Table && !tag.IsEnding())
|
||||||
|
{
|
||||||
// new row in table
|
// new row in table
|
||||||
if (tag.GetName() == wxT("TR")) {
|
if (tag.GetName() == wxT("TR"))
|
||||||
|
{
|
||||||
m_Table->AddRow(tag);
|
m_Table->AddRow(tag);
|
||||||
m_rAlign = m_tAlign;
|
m_rAlign = m_tAlign;
|
||||||
if (tag.HasParam(wxT("ALIGN"))) m_rAlign = tag.GetParam(wxT("ALIGN"));
|
if (tag.HasParam(wxT("ALIGN"))) m_rAlign = tag.GetParam(wxT("ALIGN"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// new cell
|
// new cell
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
m_WParser->SetAlign(m_OldAlign);
|
m_WParser->SetAlign(m_OldAlign);
|
||||||
c = m_WParser->SetContainer(new wxHtmlContainerCell(m_Table));
|
c = m_WParser->SetContainer(new wxHtmlContainerCell(m_Table));
|
||||||
m_Table->AddCell(c, tag);
|
m_Table->AddCell(c, tag);
|
||||||
|
|
||||||
m_WParser->OpenContainer();
|
m_WParser->OpenContainer();
|
||||||
|
|
||||||
if (tag.GetName() == wxT("TH")) /*header style*/ {
|
if (tag.GetName() == wxT("TH")) /*header style*/
|
||||||
|
{
|
||||||
m_WParser->SetAlign(wxHTML_ALIGN_CENTER);
|
m_WParser->SetAlign(wxHTML_ALIGN_CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -55,7 +55,8 @@ wxHtmlWinParser::wxHtmlWinParser(wxWindow *wnd) : wxHtmlParser()
|
|||||||
for (j = 0; j < 2; j++)
|
for (j = 0; j < 2; j++)
|
||||||
for (k = 0; k < 2; k++)
|
for (k = 0; k < 2; k++)
|
||||||
for (l = 0; l < 2; l++)
|
for (l = 0; l < 2; l++)
|
||||||
for (m = 0; m < 7; m++) {
|
for (m = 0; m < 7; m++)
|
||||||
|
{
|
||||||
m_FontsTable[i][j][k][l][m] = NULL;
|
m_FontsTable[i][j][k][l][m] = NULL;
|
||||||
m_FontsFacesTable[i][j][k][l][m] = wxEmptyString;
|
m_FontsFacesTable[i][j][k][l][m] = wxEmptyString;
|
||||||
m_FontsEncTable[i][j][k][l][m] = wxFONTENCODING_DEFAULT;
|
m_FontsEncTable[i][j][k][l][m] = wxFONTENCODING_DEFAULT;
|
||||||
@@ -72,7 +73,8 @@ wxHtmlWinParser::wxHtmlWinParser(wxWindow *wnd) : wxHtmlParser()
|
|||||||
|
|
||||||
// fill in wxHtmlParser's tables:
|
// fill in wxHtmlParser's tables:
|
||||||
wxNode *node = m_Modules.GetFirst();
|
wxNode *node = m_Modules.GetFirst();
|
||||||
while (node) {
|
while (node)
|
||||||
|
{
|
||||||
wxHtmlTagsModule *mod = (wxHtmlTagsModule*) node->GetData();
|
wxHtmlTagsModule *mod = (wxHtmlTagsModule*) node->GetData();
|
||||||
mod->FillHandlersTable(this);
|
mod->FillHandlersTable(this);
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
@@ -88,7 +90,8 @@ wxHtmlWinParser::~wxHtmlWinParser()
|
|||||||
for (j = 0; j < 2; j++)
|
for (j = 0; j < 2; j++)
|
||||||
for (k = 0; k < 2; k++)
|
for (k = 0; k < 2; k++)
|
||||||
for (l = 0; l < 2; l++)
|
for (l = 0; l < 2; l++)
|
||||||
for (m = 0; m < 7; m++) {
|
for (m = 0; m < 7; m++)
|
||||||
|
{
|
||||||
if (m_FontsTable[i][j][k][l][m] != NULL)
|
if (m_FontsTable[i][j][k][l][m] != NULL)
|
||||||
delete m_FontsTable[i][j][k][l][m];
|
delete m_FontsTable[i][j][k][l][m];
|
||||||
}
|
}
|
||||||
@@ -125,7 +128,8 @@ void wxHtmlWinParser::SetFonts(wxString normal_face, wxString fixed_face, const
|
|||||||
for (k = 0; k < 2; k++)
|
for (k = 0; k < 2; k++)
|
||||||
for (l = 0; l < 2; l++)
|
for (l = 0; l < 2; l++)
|
||||||
for (m = 0; m < 7; m++) {
|
for (m = 0; m < 7; m++) {
|
||||||
if (m_FontsTable[i][j][k][l][m] != NULL) {
|
if (m_FontsTable[i][j][k][l][m] != NULL)
|
||||||
|
{
|
||||||
delete m_FontsTable[i][j][k][l][m];
|
delete m_FontsTable[i][j][k][l][m];
|
||||||
m_FontsTable[i][j][k][l][m] = NULL;
|
m_FontsTable[i][j][k][l][m] = NULL;
|
||||||
}
|
}
|
||||||
@@ -194,20 +198,24 @@ void wxHtmlWinParser::AddText(const char* txt)
|
|||||||
register char d;
|
register char d;
|
||||||
int templen = 0;
|
int templen = 0;
|
||||||
|
|
||||||
if (m_tmpLastWasSpace) {
|
if (m_tmpLastWasSpace)
|
||||||
|
{
|
||||||
while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') || (txt[i] == '\t'))) i++;
|
while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') || (txt[i] == '\t'))) i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (i < lng) {
|
while (i < lng)
|
||||||
|
{
|
||||||
x = 0;
|
x = 0;
|
||||||
d = temp[templen++] = txt[i];
|
d = temp[templen++] = txt[i];
|
||||||
if ((d == '\n') || (d == '\r') || (d == ' ') || (d == '\t')) {
|
if ((d == '\n') || (d == '\r') || (d == ' ') || (d == '\t'))
|
||||||
|
{
|
||||||
i++, x++;
|
i++, x++;
|
||||||
while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') || (txt[i] == '\t'))) i++, x++;
|
while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') || (txt[i] == '\t'))) i++, x++;
|
||||||
}
|
}
|
||||||
else i++;
|
else i++;
|
||||||
|
|
||||||
if (x) {
|
if (x)
|
||||||
|
{
|
||||||
temp[templen-1] = ' ';
|
temp[templen-1] = ' ';
|
||||||
temp[templen] = 0;
|
temp[templen] = 0;
|
||||||
templen = 0;
|
templen = 0;
|
||||||
@@ -218,7 +226,8 @@ void wxHtmlWinParser::AddText(const char* txt)
|
|||||||
m_tmpLastWasSpace = TRUE;
|
m_tmpLastWasSpace = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (templen) {
|
if (templen)
|
||||||
|
{
|
||||||
temp[templen] = 0;
|
temp[templen] = 0;
|
||||||
if (m_EncConv) m_EncConv->Convert(temp);
|
if (m_EncConv) m_EncConv->Convert(temp);
|
||||||
c = new wxHtmlWordCell(temp, *(GetDC()));
|
c = new wxHtmlWordCell(temp, *(GetDC()));
|
||||||
@@ -279,12 +288,14 @@ wxFont* wxHtmlWinParser::CreateCurrentFont()
|
|||||||
wxFont **fontptr = &(m_FontsTable[fb][fi][fu][ff][fs]);
|
wxFont **fontptr = &(m_FontsTable[fb][fi][fu][ff][fs]);
|
||||||
wxFontEncoding *encptr = &(m_FontsEncTable[fb][fi][fu][ff][fs]);
|
wxFontEncoding *encptr = &(m_FontsEncTable[fb][fi][fu][ff][fs]);
|
||||||
|
|
||||||
if (*fontptr != NULL && (*faceptr != face || *encptr != m_OutputEnc)) {
|
if (*fontptr != NULL && (*faceptr != face || *encptr != m_OutputEnc))
|
||||||
|
{
|
||||||
delete *fontptr;
|
delete *fontptr;
|
||||||
*fontptr = NULL;
|
*fontptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*fontptr == NULL) {
|
if (*fontptr == NULL)
|
||||||
|
{
|
||||||
*faceptr = face;
|
*faceptr = face;
|
||||||
*encptr = m_OutputEnc;
|
*encptr = m_OutputEnc;
|
||||||
*fontptr = new wxFont(
|
*fontptr = new wxFont(
|
||||||
|
Reference in New Issue
Block a user