// This method returns pointer to the FIRST cell for that
// the condition
// is true. It first checks if the condition is true for this
- // cell and then calls m_Next -> Find(). (Note: it checks
+ // cell and then calls m_Next->Find(). (Note: it checks
// all subcells if the cell is container)
// Condition is unique condition identifier (see htmldefs.h)
// (user-defined condition IDs should start from 10000)
// and param is optional parameter
- // Example : m_Cell -> Find(wxHTML_COND_ISANCHOR, "news");
+ // Example : m_Cell->Find(wxHTML_COND_ISANCHOR, "news");
// returns pointer to anchor news
virtual void OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event);
// if w != 0 then the m_Wnd has 'floating' width - it adjust
// it's width according to parent container's width
// (w is percent of parent's width)
- ~wxHtmlWidgetCell() { m_Wnd -> Destroy(); }
+ ~wxHtmlWidgetCell() { m_Wnd->Destroy(); }
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
virtual void DrawInvisible(wxDC& dc, int x, int y);
virtual void Layout(int w);
// FALSE etherwise
protected:
- void ParseInner(const wxHtmlTag& tag) {m_Parser -> DoParsing(tag.GetBeginPos(), tag.GetEndPos1());}
+ void ParseInner(const wxHtmlTag& tag) {m_Parser->DoParsing(tag.GetBeginPos(), tag.GetEndPos1());}
// parses input between beginning and ending tag.
// m_Parser must be set.
};
#define TAGS_MODULE_ADD(handler) \
- parser -> AddTagHandler(new HTML_Handler_##handler);
+ parser->AddTagHandler(new HTML_Handler_##handler);
// NOTE : these functions do _not_ return _actual_
// height/width. They return h/w of default font
// for this DC. If you want actual values, call
- // GetDC() -> GetChar...()
+ // GetDC()->GetChar...()
wxWindow *GetWindow() {return m_Window;}
// returns associated wxWindow
// parsing-related methods. These methods are called by tag handlers:
wxHtmlContainerCell *GetContainer() const {return m_Container;}
// Returns pointer to actual container. Common use in tag handler is :
- // m_WParser -> GetContainer() -> InsertCell(new ...);
+ // m_WParser->GetContainer()->InsertCell(new ...);
wxHtmlContainerCell *OpenContainer();
// opens new container. This container is sub-container of opened
// container. Sets GetContainer to newly created container
#if wxUSE_BUSYINFO
wxBusyInfo* busy = NULL;
wxString info;
- if (show_wait_msg) {
+ if (show_wait_msg)
+ {
info.Printf(_("Adding book %s"), book.c_str());
busy = new wxBusyInfo(info);
}
void wxHtmlHelpController::CreateHelpWindow()
{
- if (m_helpFrame) {
+ if (m_helpFrame)
+ {
m_helpFrame->Raise();
return ;
}
{
m_Config = config;
m_ConfigRoot = rootpath;
- if (m_helpFrame) m_helpFrame -> UseConfig(config, rootpath);
+ if (m_helpFrame) m_helpFrame->UseConfig(config, rootpath);
ReadCustomization(config, rootpath);
}
static int LINKAGEMODE IndexCompareFunc(const void *a, const void *b)
{
- return wxStrcmp(((wxHtmlContentsItem*)a) -> m_Name, ((wxHtmlContentsItem*)b) -> m_Name);
+ return wxStrcmp(((wxHtmlContentsItem*)a)->m_Name, ((wxHtmlContentsItem*)b)->m_Name);
}
wxHtmlBookRecord *m_Book;
public:
- HP_TagHandler(wxHtmlBookRecord *b) : wxHtmlTagHandler() {m_Book = b; m_Items = NULL; m_ItemsCnt = 0; m_Name = m_Page = wxEmptyString; m_Level = 0; m_ID = -1; }
+ HP_TagHandler(wxHtmlBookRecord *b) : wxHtmlTagHandler()
+ { m_Book = b; m_Items = NULL; m_ItemsCnt = 0; m_Name = m_Page = wxEmptyString;
+ m_Level = 0; m_ID = -1; }
wxString GetSupportedTags() { return wxT("UL,OBJECT,PARAM"); }
bool HandleTag(const wxHtmlTag& tag);
void WriteOut(wxHtmlContentsItem*& array, int& size);
bool HP_TagHandler::HandleTag(const wxHtmlTag& tag)
{
- if (tag.GetName() == wxT("UL")) {
+ if (tag.GetName() == wxT("UL"))
+ {
m_Level++;
ParseInner(tag);
m_Level--;
return TRUE;
}
- else if (tag.GetName() == wxT("OBJECT")) {
+ else if (tag.GetName() == wxT("OBJECT"))
+ {
m_Name = m_Page = wxEmptyString;
ParseInner(tag);
return TRUE;
}
- else { // "PARAM"
+ else
+ { // "PARAM"
if (m_Name == wxEmptyString && tag.GetParam(wxT("NAME")) == wxT("Name"))
{
m_Name = tag.GetParam(wxT("VALUE"));
int i;
m_BookRecords.Empty();
- if (m_Contents) {
- for (i = 0; i < m_ContentsCnt; i++) {
+ if (m_Contents)
+ {
+ for (i = 0; i < m_ContentsCnt; i++)
+ {
delete[] m_Contents[i].m_Page;
delete[] m_Contents[i].m_Name;
}
free(m_Contents);
}
- if (m_Index) {
- for (i = 0; i < m_IndexCnt; i++) {
+ if (m_Index)
+ {
+ for (i = 0; i < m_IndexCnt; i++)
+ {
delete[] m_Index[i].m_Page;
delete[] m_Index[i].m_Name;
}
parser.AddTagHandler(handler);
f = ( contentsfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(contentsfile) );
- if (f) {
- sz = f -> GetStream() -> GetSize();
+ if (f)
+ {
+ sz = f->GetStream()->GetSize();
buf = new char[sz + 1];
buf[sz] = 0;
- f -> GetStream() -> Read(buf, sz);
+ f->GetStream()->Read(buf, sz);
delete f;
- handler -> ReadIn(m_Contents, m_ContentsCnt);
+ handler->ReadIn(m_Contents, m_ContentsCnt);
parser.Parse(buf);
- handler -> WriteOut(m_Contents, m_ContentsCnt);
+ handler->WriteOut(m_Contents, m_ContentsCnt);
delete[] buf;
}
else
wxLogError(_("Cannot open contents file: %s"), contentsfile.c_str());
f = ( indexfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(indexfile) );
- if (f) {
- sz = f -> GetStream() -> GetSize();
+ if (f)
+ {
+ sz = f->GetStream()->GetSize();
buf = new char[sz + 1];
buf[sz] = 0;
- f -> GetStream() -> Read(buf, sz);
+ f->GetStream()->Read(buf, sz);
delete f;
- handler -> ReadIn(m_Index, m_IndexCnt);
+ handler->ReadIn(m_Index, m_IndexCnt);
parser.Parse(buf);
- handler -> WriteOut(m_Index, m_IndexCnt);
+ handler->WriteOut(m_Index, m_IndexCnt);
delete[] buf;
}
else if (!indexfile.IsEmpty())
#if wxUSE_UNICODE
-#define READ_STRING(f, s, lng) { char tmpc; for (int i = 0; i < lng; i++) { f -> Read(&tmpc, 1); s[i] = (wxChar)tmpc;} }
-#define WRITE_STRING(f, s, lng) { char tmpc; for (int i = 0; i < lng; i++) { tmpc = (char)s[i]; f -> Write(&tmpc, 1);} }
+#define READ_STRING(f, s, lng) { char tmpc; for (int i = 0; i < lng; i++) { f->Read(&tmpc, 1); s[i] = (wxChar)tmpc;} }
+#define WRITE_STRING(f, s, lng) { char tmpc; for (int i = 0; i < lng; i++) { tmpc = (char)s[i]; f->Write(&tmpc, 1);} }
#else
-#define READ_STRING(f, s, lng) f -> Read(s, lng * sizeof(char));
-#define WRITE_STRING(f, s, lng) f -> Write(s, lng * sizeof(char));
+#define READ_STRING(f, s, lng) f->Read(s, lng * sizeof(char));
+#define WRITE_STRING(f, s, lng) f->Write(s, lng * sizeof(char));
#endif
/* load header - version info : */
- f -> Read(&x, sizeof(x));
+ f->Read(&x, sizeof(x));
version = wxINT32_SWAP_ON_BE(x);
if (version != CURRENT_CACHED_BOOK_VERSION)
/* load contents : */
- f -> Read(&x, sizeof(x));
+ f->Read(&x, sizeof(x));
st = m_ContentsCnt;
m_ContentsCnt += wxINT32_SWAP_ON_BE(x);
m_Contents = (wxHtmlContentsItem*) realloc(m_Contents,
(m_ContentsCnt / wxHTML_REALLOC_STEP + 1) *
wxHTML_REALLOC_STEP * sizeof(wxHtmlContentsItem));
- for (i = st; i < m_ContentsCnt; i++) {
- f -> Read(&x, sizeof(x));
+ for (i = st; i < m_ContentsCnt; i++)
+ {
+ f->Read(&x, sizeof(x));
m_Contents[i].m_Level = wxINT32_SWAP_ON_BE(x);
- f -> Read(&x, sizeof(x));
+ f->Read(&x, sizeof(x));
m_Contents[i].m_ID = wxINT32_SWAP_ON_BE(x);
- f -> Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x);
+ f->Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x);
m_Contents[i].m_Name = new wxChar[x];
READ_STRING(f, m_Contents[i].m_Name, x);
- f -> Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x);
+ f->Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x);
m_Contents[i].m_Page = new wxChar[x];
READ_STRING(f, m_Contents[i].m_Page, x);
m_Contents[i].m_Book = book;
/* load index : */
- f -> Read(&x, sizeof(x));
+ f->Read(&x, sizeof(x));
st = m_IndexCnt;
m_IndexCnt += wxINT32_SWAP_ON_BE(x);
m_Index = (wxHtmlContentsItem*) realloc(m_Index, (m_IndexCnt / wxHTML_REALLOC_STEP + 1) *
wxHTML_REALLOC_STEP * sizeof(wxHtmlContentsItem));
- for (i = st; i < m_IndexCnt; i++) {
- f -> Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x);
+ for (i = st; i < m_IndexCnt; i++)
+ {
+ f->Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x);
m_Index[i].m_Name = new wxChar[x];
READ_STRING(f, m_Index[i].m_Name, x);
- f -> Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x);
+ f->Read(&x, sizeof(x)); x = wxINT32_SWAP_ON_BE(x);
m_Index[i].m_Page = new wxChar[x];
READ_STRING(f, m_Index[i].m_Page, x);
m_Index[i].m_Book = book;
/* save header - version info : */
x = wxINT32_SWAP_ON_BE(CURRENT_CACHED_BOOK_VERSION);
- f -> Write(&x, sizeof(x));
+ f->Write(&x, sizeof(x));
/* save contents : */
x = 0;
for (i = 0; i < m_ContentsCnt; i++) if (m_Contents[i].m_Book == book && m_Contents[i].m_Level > 0) x++;
x = wxINT32_SWAP_ON_BE(x);
- f -> Write(&x, sizeof(x));
- for (i = 0; i < m_ContentsCnt; i++) {
+ f->Write(&x, sizeof(x));
+ for (i = 0; i < m_ContentsCnt; i++)
+ {
if (m_Contents[i].m_Book != book || m_Contents[i].m_Level == 0) continue;
x = wxINT32_SWAP_ON_BE(m_Contents[i].m_Level);
- f -> Write(&x, sizeof(x));
+ f->Write(&x, sizeof(x));
x = wxINT32_SWAP_ON_BE(m_Contents[i].m_ID);
- f -> Write(&x, sizeof(x));
+ f->Write(&x, sizeof(x));
x = wxINT32_SWAP_ON_BE(wxStrlen(m_Contents[i].m_Name) + 1);
- f -> Write(&x, sizeof(x));
+ f->Write(&x, sizeof(x));
WRITE_STRING(f, m_Contents[i].m_Name, x);
x = wxINT32_SWAP_ON_BE(wxStrlen(m_Contents[i].m_Page) + 1);
- f -> Write(&x, sizeof(x));
+ f->Write(&x, sizeof(x));
WRITE_STRING(f, m_Contents[i].m_Page, x);
}
x = 0;
for (i = 0; i < m_IndexCnt; i++) if (m_Index[i].m_Book == book && m_Index[i].m_Level > 0) x++;
x = wxINT32_SWAP_ON_BE(x);
- f -> Write(&x, sizeof(x));
- for (i = 0; i < m_IndexCnt; i++) {
+ f->Write(&x, sizeof(x));
+ for (i = 0; i < m_IndexCnt; i++)
+ {
if (m_Index[i].m_Book != book || m_Index[i].m_Level == 0) continue;
x = wxINT32_SWAP_ON_BE(wxStrlen(m_Index[i].m_Name) + 1);
- f -> Write(&x, sizeof(x));
+ f->Write(&x, sizeof(x));
WRITE_STRING(f, m_Index[i].m_Name, x);
x = wxINT32_SWAP_ON_BE(wxStrlen(m_Index[i].m_Page) + 1);
- f -> Write(&x, sizeof(x));
+ f->Write(&x, sizeof(x));
WRITE_STRING(f, m_Index[i].m_Page, x);
}
return TRUE;
void wxHtmlHelpData::SetTempDir(const wxString& path)
{
if (path == wxEmptyString) m_TempPath = path;
- else {
+ else
+ {
if (wxIsAbsolutePath(path)) m_TempPath = path;
else m_TempPath = wxGetCwd() + _T("/") + path;
fi = fsys.OpenFile(bookfile.GetLocation() + wxT(".cached"));
if (fi == NULL ||
- fi -> GetModificationTime() < bookfile.GetModificationTime() ||
- !LoadCachedBook(bookr, fi -> GetStream()))
+ fi->GetModificationTime() < bookfile.GetModificationTime() ||
+ !LoadCachedBook(bookr, fi->GetStream()))
{
if (fi != NULL) delete fi;
fi = fsys.OpenFile(m_TempPath + wxFileNameFromPath(bookfile.GetLocation()) + wxT(".cached"));
if (m_TempPath == wxEmptyString || fi == NULL ||
- fi -> GetModificationTime() < bookfile.GetModificationTime() ||
- !LoadCachedBook(bookr, fi -> GetStream()))
+ fi->GetModificationTime() < bookfile.GetModificationTime() ||
+ !LoadCachedBook(bookr, fi->GetStream()))
{
LoadMSProject(bookr, fsys, indexfile, contfile);
if (m_TempPath != wxEmptyString)
return FALSE;
}
fsys.ChangePathTo(bookFull);
- s = fi -> GetStream();
- sz = s -> GetSize();
+ s = fi->GetStream();
+ sz = s->GetSize();
buff = new char[sz + 1];
buff[sz] = 0;
- s -> Read(buff, sz);
+ s->Read(buff, sz);
lineptr = buff;
do {
wxFontEncoding enc;
if (charset == wxEmptyString) enc = wxFONTENCODING_SYSTEM;
- else enc = wxTheFontMapper -> CharsetToEncoding(charset);
+ else enc = wxTheFontMapper->CharsetToEncoding(charset);
bool rtval = AddBookParam(*fi, enc,
title, contents, index, start, fsys.GetPath());
delete fi;
/* 1. try to open given file: */
cnt = m_BookRecords.GetCount();
- for (i = 0; i < cnt; i++) {
+ for (i = 0; i < cnt; i++)
+ {
f = fsys.OpenFile(m_BookRecords[i].GetBasePath() + x);
- if (f) {
+ if (f)
+ {
url = m_BookRecords[i].GetBasePath() + x;
delete f;
return url;
/* 2. try to find a book: */
- for (i = 0; i < cnt; i++) {
- if (m_BookRecords[i].GetTitle() == x) {
+ for (i = 0; i < cnt; i++)
+ {
+ if (m_BookRecords[i].GetTitle() == x)
+ {
url = m_BookRecords[i].GetBasePath() + m_BookRecords[i].GetStart();
return url;
}
/* 3. try to find in contents: */
cnt = m_ContentsCnt;
- for (i = 0; i < cnt; i++) {
- if (wxStrcmp(m_Contents[i].m_Name, x) == 0) {
- url = m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page;
+ for (i = 0; i < cnt; i++)
+ {
+ if (wxStrcmp(m_Contents[i].m_Name, x) == 0)
+ {
+ url = m_Contents[i].m_Book->GetBasePath() + m_Contents[i].m_Page;
return url;
}
}
/* 4. try to find in index: */
cnt = m_IndexCnt;
- for (i = 0; i < cnt; i++) {
- if (wxStrcmp(m_Index[i].m_Name, x) == 0) {
- url = m_Index[i].m_Book -> GetBasePath() + m_Index[i].m_Page;
+ for (i = 0; i < cnt; i++)
+ {
+ if (wxStrcmp(m_Index[i].m_Name, x) == 0)
+ {
+ url = m_Index[i].m_Book->GetBasePath() + m_Index[i].m_Page;
return url;
}
}
int i;
wxString url(wxEmptyString);
- for (i = 0; i < m_ContentsCnt; i++) {
- if (m_Contents[i].m_ID == id) {
- url = m_Contents[i].m_Book -> GetBasePath() + m_Contents[i].m_Page;
+ for (i = 0; i < m_ContentsCnt; i++)
+ {
+ if (m_Contents[i].m_ID == id)
+ {
+ url = m_Contents[i].m_Book->GetBasePath() + m_Contents[i].m_Page;
return url;
}
}
m_Data = data;
m_Keyword = keyword;
wxHtmlBookRecord* bookr = NULL;
- if (book != wxEmptyString) {
+ if (book != wxEmptyString)
+ {
// we have to search in a specific book. Find it first
int i, cnt = data->m_BookRecords.GetCount();
for (i = 0; i < cnt; i++)
- if (data->m_BookRecords[i].GetTitle() == book) {
+ if (data->m_BookRecords[i].GetTitle() == book)
+ {
bookr = &(data->m_BookRecords[i]);
m_CurIndex = bookr->GetContentsStart();
m_MaxIndex = bookr->GetContentsEnd();
// check; we won't crash if the book doesn't exist, but it's Bad Anyway.
wxASSERT(bookr);
}
- if (! bookr) {
+ if (! bookr)
+ {
// no book specified; search all books
m_CurIndex = 0;
m_MaxIndex = m_Data->m_ContentsCnt;
bool found = FALSE;
wxChar *thepage;
- if (!m_Active) {
+ if (!m_Active)
+ {
// sanity check. Illegal use, but we'll try to prevent a crash anyway
wxASSERT(m_Active);
return FALSE;
else m_LastPage = thepage;
wxFileSystem fsys;
- file = fsys.OpenFile(m_Data->m_Contents[i].m_Book -> GetBasePath() + thepage);
+ file = fsys.OpenFile(m_Data->m_Contents[i].m_Book->GetBasePath() + thepage);
if (file)
{
- if (m_Engine.Scan(file -> GetStream())) {
+ if (m_Engine.Scan(file->GetStream())) {
m_Name = m_Data->m_Contents[i].m_Name;
m_ContentsItem = m_Data->m_Contents + i;
found = TRUE;
wxStrcpy(m_Keyword, keyword.c_str());
if (!m_CaseSensitive)
+ {
for (int i = wxStrlen(m_Keyword) - 1; i >= 0; i--)
+ {
if ((m_Keyword[i] >= wxT('A')) && (m_Keyword[i] <= wxT('Z')))
m_Keyword[i] += wxT('a') - wxT('A');
+ }
+ }
}
int wrd = wxStrlen(m_Keyword);
bool found = FALSE;
char *buf = new char[lng + 1];
- stream -> Read(buf, lng);
+ stream->Read(buf, lng);
buf[lng] = 0;
if (!m_CaseSensitive)
if (m_WholeWords)
{
- for (i = 0; i < lng - wrd; i++) {
+ for (i = 0; i < lng - wrd; i++)
+ {
if (WHITESPACE(buf[i])) continue;
j = 0;
while ((j < wrd) && (buf[i + j] == m_Keyword[j])) j++;
- if (j == wrd && WHITESPACE(buf[i + j])) {found = TRUE; break; }
+ if (j == wrd && WHITESPACE(buf[i + j])) { found = TRUE; break; }
}
}
else
{
- for (i = 0; i < lng - wrd; i++) {
+ for (i = 0; i < lng - wrd; i++)
+ {
j = 0;
while ((j < wrd) && (buf[i + j] == m_Keyword[j])) j++;
- if (j == wrd) {found = TRUE; break; }
+ if (j == wrd) { found = TRUE; break; }
}
}
virtual void OnLinkClicked(const wxHtmlLinkInfo& link)
{
wxHtmlWindow::OnLinkClicked(link);
- m_Frame -> NotifyPageChanged();
+ m_Frame->NotifyPageChanged();
}
private:
void wxHtmlHelpFrame::Init(wxHtmlHelpData* data)
{
- if (data) {
+ if (data)
+ {
m_Data = data;
m_DataCreated = FALSE;
- } else {
+ } else
+ {
m_Data = new wxHtmlHelpData();
m_DataCreated = TRUE;
}
CreateStatusBar();
// toolbar?
- if (style & (wxHF_TOOLBAR | wxHF_FLATTOOLBAR)) {
+ if (style & (wxHF_TOOLBAR | wxHF_FLATTOOLBAR))
+ {
wxToolBar *toolBar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL |
wxTB_DOCKABLE |
(style & wxHF_FLATTOOLBAR ? wxTB_FLAT : 0));
toolBar->SetMargins( 2, 2 );
AddToolbarButtons(toolBar, style);
- toolBar -> Realize();
+ toolBar->Realize();
}
- if (style & (wxHF_CONTENTS | wxHF_INDEX | wxHF_SEARCH)) {
+ if (style & (wxHF_CONTENTS | wxHF_INDEX | wxHF_SEARCH))
+ {
// traditional help controller; splitter window with html page on the
// right and a notebook containing various pages on the left
m_Splitter = new wxSplitterWindow(this);
m_HtmlWin = new wxHtmlHelpHtmlWindow(this, m_Splitter);
m_NavigPan = new wxNotebook(m_Splitter, wxID_HTML_NOTEBOOK,
wxDefaultPosition, wxDefaultSize);
- } else { // only html window, no notebook with index,contents etc
+ }
+ else
+ { // only html window, no notebook with index,contents etc
m_HtmlWin = new wxHtmlWindow(this);
}
- m_HtmlWin -> SetRelatedFrame(this, m_TitleFormat);
- m_HtmlWin -> SetRelatedStatusBar(0);
+ m_HtmlWin->SetRelatedFrame(this, m_TitleFormat);
+ m_HtmlWin->SetRelatedStatusBar(0);
if (m_Config)
- m_HtmlWin -> ReadCustomization(m_Config, m_ConfigRoot);
+ m_HtmlWin->ReadCustomization(m_Config, m_ConfigRoot);
// contents tree panel?
- if (style & wxHF_CONTENTS) {
+ if (style & wxHF_CONTENTS)
+ {
wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE);
- if (style & wxHF_BOOKMARKS) {
+ if (style & wxHF_BOOKMARKS)
+ {
wxLayoutConstraints *b1 = new wxLayoutConstraints;
wxBitmapButton *bmpbt = new wxBitmapButton(dummy, wxID_HTML_BOOKMARKSREMOVE, wxBITMAP(wbkdel), wxDefaultPosition, wxSize(20,20));
- b1 -> top.SameAs (dummy, wxTop, 10);
- b1 -> right.SameAs (dummy, wxRight, 10);
- b1 -> height.AsIs();
- b1 -> width.AsIs();
- bmpbt -> SetConstraints(b1);
+ b1->top.SameAs (dummy, wxTop, 10);
+ b1->right.SameAs (dummy, wxRight, 10);
+ b1->height.AsIs();
+ b1->width.AsIs();
+ bmpbt->SetConstraints(b1);
wxLayoutConstraints *b2 = new wxLayoutConstraints;
wxBitmapButton *bmpbt2 = new wxBitmapButton(dummy, wxID_HTML_BOOKMARKSADD, wxBITMAP(wbkadd), wxDefaultPosition, wxSize(20,20));
- b2 -> top.SameAs (dummy, wxTop, 10);
- b2 -> right.LeftOf (bmpbt, 2);
- b2 -> height.AsIs();
- b2 -> width.AsIs();
- bmpbt2 -> SetConstraints(b2);
+ b2->top.SameAs (dummy, wxTop, 10);
+ b2->right.LeftOf (bmpbt, 2);
+ b2->height.AsIs();
+ b2->width.AsIs();
+ bmpbt2->SetConstraints(b2);
#if wxUSE_TOOLTIPS
- bmpbt -> SetToolTip(_("Remove current page from bookmarks"));
- bmpbt2 -> SetToolTip(_("Add current page to bookmarks"));
+ bmpbt->SetToolTip(_("Remove current page from bookmarks"));
+ bmpbt2->SetToolTip(_("Add current page to bookmarks"));
#endif //wxUSE_TOOLTIPS
wxLayoutConstraints *b3 = new wxLayoutConstraints;
m_Bookmarks = new wxComboBox(dummy, wxID_HTML_BOOKMARKSLIST, wxEmptyString,
wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY | wxCB_SORT);
- m_Bookmarks -> Append(_("(bookmarks)"));
+ m_Bookmarks->Append(_("(bookmarks)"));
for (unsigned i = 0; i < m_BookmarksNames.GetCount(); i++)
- m_Bookmarks -> Append(m_BookmarksNames[i]);
- m_Bookmarks -> SetSelection(0);
+ m_Bookmarks->Append(m_BookmarksNames[i]);
+ m_Bookmarks->SetSelection(0);
- b3 -> centreY.SameAs (bmpbt2, wxCentreY);
- b3 -> left.SameAs (dummy, wxLeft, 10);
- b3 -> right.LeftOf (bmpbt2, 5);
- b3 -> height.AsIs();
- m_Bookmarks -> SetConstraints(b3);
+ b3->centreY.SameAs (bmpbt2, wxCentreY);
+ b3->left.SameAs (dummy, wxLeft, 10);
+ b3->right.LeftOf (bmpbt2, 5);
+ b3->height.AsIs();
+ m_Bookmarks->SetConstraints(b3);
wxLayoutConstraints *b4 = new wxLayoutConstraints;
m_ContentsBox = new wxTreeCtrl(dummy, wxID_HTML_TREECTRL,
wxDefaultPosition, wxDefaultSize,
wxTR_HAS_BUTTONS | wxSUNKEN_BORDER);
- m_ContentsBox -> AssignImageList(ContentsImageList);
+ m_ContentsBox->AssignImageList(ContentsImageList);
- b4 -> top.Below (m_Bookmarks, 10);
- b4 -> left.SameAs (dummy, wxLeft, 0);
- b4 -> right.SameAs (dummy, wxRight, 0);
- b4 -> bottom.SameAs (dummy, wxBottom, 0);
- m_ContentsBox -> SetConstraints(b4);
+ b4->top.Below (m_Bookmarks, 10);
+ b4->left.SameAs (dummy, wxLeft, 0);
+ b4->right.SameAs (dummy, wxRight, 0);
+ b4->bottom.SameAs (dummy, wxBottom, 0);
+ m_ContentsBox->SetConstraints(b4);
- dummy -> SetAutoLayout(TRUE);
- dummy -> Layout();
+ dummy->SetAutoLayout(TRUE);
+ dummy->Layout();
- m_NavigPan -> AddPage(dummy, _("Contents"));
+ m_NavigPan->AddPage(dummy, _("Contents"));
}
else
m_ContentsBox = new wxTreeCtrl(m_NavigPan, wxID_HTML_TREECTRL,
wxDefaultPosition, wxDefaultSize,
wxTR_HAS_BUTTONS | wxSUNKEN_BORDER);
- m_ContentsBox -> AssignImageList(ContentsImageList);
- m_NavigPan -> AddPage(m_ContentsBox, _("Contents"));
+ m_ContentsBox->AssignImageList(ContentsImageList);
+ m_NavigPan->AddPage(m_ContentsBox, _("Contents"));
}
m_ContentsPage = notebook_page++;
}
// index listbox panel?
- if (style & wxHF_INDEX) {
+ if (style & wxHF_INDEX)
+ {
wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_INDEXPAGE);
wxLayoutConstraints *b1 = new wxLayoutConstraints;
m_IndexText = new wxTextCtrl(dummy, wxID_HTML_INDEXTEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
- b1 -> top.SameAs (dummy, wxTop, 10);
- b1 -> left.SameAs (dummy, wxLeft, 10);
- b1 -> right.SameAs (dummy, wxRight, 10);
- b1 -> height.AsIs();
- m_IndexText -> SetConstraints(b1);
+ b1->top.SameAs (dummy, wxTop, 10);
+ b1->left.SameAs (dummy, wxLeft, 10);
+ b1->right.SameAs (dummy, wxRight, 10);
+ b1->height.AsIs();
+ m_IndexText->SetConstraints(b1);
wxLayoutConstraints *b4 = new wxLayoutConstraints;
m_IndexButtonAll = new wxButton(dummy, wxID_HTML_INDEXBUTTONALL, _("Show all"));
- b4 -> top.Below (m_IndexText, 10);
- b4 -> right.SameAs (dummy, wxRight, 10);
- b4 -> width.AsIs();
- b4 -> height.AsIs();
- m_IndexButtonAll -> SetConstraints(b4);
+ b4->top.Below (m_IndexText, 10);
+ b4->right.SameAs (dummy, wxRight, 10);
+ b4->width.AsIs();
+ b4->height.AsIs();
+ m_IndexButtonAll->SetConstraints(b4);
wxLayoutConstraints *b2 = new wxLayoutConstraints;
m_IndexButton = new wxButton(dummy, wxID_HTML_INDEXBUTTON, _("Find"));
- b2 -> top.Below (m_IndexText, 10);
- b2 -> right.LeftOf (m_IndexButtonAll, 10);
- b2 -> width.AsIs();
- b2 -> height.AsIs();
- m_IndexButton -> SetConstraints(b2);
+ b2->top.Below (m_IndexText, 10);
+ b2->right.LeftOf (m_IndexButtonAll, 10);
+ b2->width.AsIs();
+ b2->height.AsIs();
+ m_IndexButton->SetConstraints(b2);
wxLayoutConstraints *b5 = new wxLayoutConstraints;
m_IndexCountInfo = new wxStaticText(dummy, wxID_HTML_COUNTINFO, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT | wxST_NO_AUTORESIZE);
- b5 -> top.Below (m_IndexButton, 5);
- b5 -> right.SameAs (dummy, wxRight, 10);
- b5 -> left.SameAs (dummy, wxLeft, 10);
- b5 -> height.AsIs();
- m_IndexCountInfo -> SetConstraints(b5);
+ b5->top.Below (m_IndexButton, 5);
+ b5->right.SameAs (dummy, wxRight, 10);
+ b5->left.SameAs (dummy, wxLeft, 10);
+ b5->height.AsIs();
+ m_IndexCountInfo->SetConstraints(b5);
wxLayoutConstraints *b3 = new wxLayoutConstraints;
m_IndexList = new wxListBox(dummy, wxID_HTML_INDEXLIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE);
- b3 -> top.Below (m_IndexCountInfo, 5);
- b3 -> left.SameAs (dummy, wxLeft, 0);
- b3 -> right.SameAs (dummy, wxRight, 0);
- b3 -> bottom.SameAs (dummy, wxBottom, 0);
- m_IndexList -> SetConstraints(b3);
+ b3->top.Below (m_IndexCountInfo, 5);
+ b3->left.SameAs (dummy, wxLeft, 0);
+ b3->right.SameAs (dummy, wxRight, 0);
+ b3->bottom.SameAs (dummy, wxBottom, 0);
+ m_IndexList->SetConstraints(b3);
#if wxUSE_TOOLTIPS
- m_IndexButtonAll -> SetToolTip(_("Show all items in index"));
- m_IndexButton -> SetToolTip(_("Display all index items that contain given substring. Search is case insensitive."));
+ m_IndexButtonAll->SetToolTip(_("Show all items in index"));
+ m_IndexButton->SetToolTip(_("Display all index items that contain given substring. Search is case insensitive."));
#endif //wxUSE_TOOLTIPS
- dummy -> SetAutoLayout(TRUE);
- dummy -> Layout();
+ dummy->SetAutoLayout(TRUE);
+ dummy->Layout();
- m_NavigPan -> AddPage(dummy, _("Index"));
+ m_NavigPan->AddPage(dummy, _("Index"));
m_IndexPage = notebook_page++;
}
// search list panel?
- if (style & wxHF_SEARCH) {
+ if (style & wxHF_SEARCH)
+ {
wxWindow *dummy = new wxPanel(m_NavigPan, wxID_HTML_SEARCHPAGE);
wxLayoutConstraints *b1 = new wxLayoutConstraints;
m_SearchText = new wxTextCtrl(dummy, wxID_HTML_SEARCHTEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
- b1 -> top.SameAs (dummy, wxTop, 10);
- b1 -> left.SameAs (dummy, wxLeft, 10);
- b1 -> right.SameAs (dummy, wxRight, 10);
- b1 -> height.AsIs();
- m_SearchText -> SetConstraints(b1);
+ b1->top.SameAs (dummy, wxTop, 10);
+ b1->left.SameAs (dummy, wxLeft, 10);
+ b1->right.SameAs (dummy, wxRight, 10);
+ b1->height.AsIs();
+ m_SearchText->SetConstraints(b1);
wxLayoutConstraints *b4 = new wxLayoutConstraints;
m_SearchChoice = new wxChoice(dummy, wxID_HTML_SEARCHCHOICE, wxDefaultPosition,
wxDefaultSize);
- b4 -> top.Below (m_SearchText, 10);
- b4 -> left.SameAs (dummy, wxLeft, 10);
- b4 -> right.SameAs (dummy, wxRight, 10);
- b4 -> height.AsIs();
- m_SearchChoice -> SetConstraints(b4);
+ b4->top.Below (m_SearchText, 10);
+ b4->left.SameAs (dummy, wxLeft, 10);
+ b4->right.SameAs (dummy, wxRight, 10);
+ b4->height.AsIs();
+ m_SearchChoice->SetConstraints(b4);
wxLayoutConstraints *b5 = new wxLayoutConstraints;
m_SearchCaseSensitive = new wxCheckBox(dummy, -1, _("Case sensitive"));
- b5 -> top.Below (m_SearchChoice, 10);
- b5 -> left.SameAs (dummy, wxLeft, 10);
- b5 -> width.AsIs();
- b5 -> height.AsIs ();
- m_SearchCaseSensitive -> SetConstraints(b5);
+ b5->top.Below (m_SearchChoice, 10);
+ b5->left.SameAs (dummy, wxLeft, 10);
+ b5->width.AsIs();
+ b5->height.AsIs ();
+ m_SearchCaseSensitive->SetConstraints(b5);
wxLayoutConstraints *b6 = new wxLayoutConstraints;
m_SearchWholeWords = new wxCheckBox(dummy, -1, _("Whole words only"));
- b6 -> top.Below (m_SearchCaseSensitive, 0);
- b6 -> left.SameAs (dummy, wxLeft, 10);
- b6 -> width.AsIs();
- b6 -> height.AsIs ();
- m_SearchWholeWords -> SetConstraints(b6);
+ b6->top.Below (m_SearchCaseSensitive, 0);
+ b6->left.SameAs (dummy, wxLeft, 10);
+ b6->width.AsIs();
+ b6->height.AsIs ();
+ m_SearchWholeWords->SetConstraints(b6);
wxLayoutConstraints *b2 = new wxLayoutConstraints;
m_SearchButton = new wxButton(dummy, wxID_HTML_SEARCHBUTTON, _("Search"));
#if wxUSE_TOOLTIPS
- m_SearchButton -> SetToolTip(_("Search contents of help book(s) for all occurences of the text you typed above"));
+ m_SearchButton->SetToolTip(_("Search contents of help book(s) for all occurences of the text you typed above"));
#endif //wxUSE_TOOLTIPS
- b2 -> top.Below (m_SearchWholeWords, 0);
- b2 -> right.SameAs (dummy, wxRight, 10);
- b2 -> width.AsIs();
- b2 -> height.AsIs();
- m_SearchButton -> SetConstraints(b2);
+ b2->top.Below (m_SearchWholeWords, 0);
+ b2->right.SameAs (dummy, wxRight, 10);
+ b2->width.AsIs();
+ b2->height.AsIs();
+ m_SearchButton->SetConstraints(b2);
wxLayoutConstraints *b3 = new wxLayoutConstraints;
m_SearchList = new wxListBox(dummy, wxID_HTML_SEARCHLIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE);
- b3 -> top.Below (m_SearchButton, 10);
- b3 -> left.SameAs (dummy, wxLeft, 0);
- b3 -> right.SameAs (dummy, wxRight, 0);
- b3 -> bottom.SameAs (dummy, wxBottom, 0);
- m_SearchList -> SetConstraints(b3);
-
- dummy -> SetAutoLayout(TRUE);
- dummy -> Layout();
- m_NavigPan -> AddPage(dummy, _("Search"));
+ b3->top.Below (m_SearchButton, 10);
+ b3->left.SameAs (dummy, wxLeft, 0);
+ b3->right.SameAs (dummy, wxRight, 0);
+ b3->bottom.SameAs (dummy, wxBottom, 0);
+ m_SearchList->SetConstraints(b3);
+
+ dummy->SetAutoLayout(TRUE);
+ dummy->Layout();
+ m_NavigPan->AddPage(dummy, _("Search"));
m_SearchPage = notebook_page++;
}
- m_HtmlWin -> Show(TRUE);
+ m_HtmlWin->Show(TRUE);
RefreshLists();
// showtime
- if (m_NavigPan && m_Splitter) {
- m_Splitter -> SetMinimumPaneSize(20);
+ if (m_NavigPan && m_Splitter)
+ {
+ m_Splitter->SetMinimumPaneSize(20);
if (m_Cfg.navig_on)
- m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
- else {
- m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
- m_Splitter -> Unsplit();
+ m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
+ else
+ {
+ m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
+ m_Splitter->Unsplit();
}
- if (m_Cfg.navig_on) {
- m_NavigPan -> Show(TRUE);
- m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
+
+ if (m_Cfg.navig_on)
+ {
+ m_NavigPan->Show(TRUE);
+ m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
}
- else {
- m_NavigPan -> Show(FALSE);
- m_Splitter -> Initialize(m_HtmlWin);
+ else
+ {
+ m_NavigPan->Show(FALSE);
+ m_Splitter->Initialize(m_HtmlWin);
}
}
return TRUE;
wxT("One or more HTML help frame toolbar bitmap could not be loaded.")) ;
- toolBar -> AddTool(wxID_HTML_PANEL, wpanelBitmap, wxNullBitmap,
+ toolBar->AddTool(wxID_HTML_PANEL, wpanelBitmap, wxNullBitmap,
FALSE, -1, -1, (wxObject *) NULL,
_("Show/hide navigation panel"));
- toolBar -> AddSeparator();
- toolBar -> AddTool(wxID_HTML_BACK, wbackBitmap, wxNullBitmap,
+ toolBar->AddSeparator();
+ toolBar->AddTool(wxID_HTML_BACK, wbackBitmap, wxNullBitmap,
FALSE, -1, -1, (wxObject *) NULL,
_("Go back"));
- toolBar -> AddTool(wxID_HTML_FORWARD, wforwardBitmap, wxNullBitmap,
+ toolBar->AddTool(wxID_HTML_FORWARD, wforwardBitmap, wxNullBitmap,
FALSE, -1, -1, (wxObject *) NULL,
_("Go forward"));
- toolBar -> AddSeparator();
+ toolBar->AddSeparator();
- toolBar -> AddTool(wxID_HTML_UPNODE, wupnodeBitmap, wxNullBitmap,
+ toolBar->AddTool(wxID_HTML_UPNODE, wupnodeBitmap, wxNullBitmap,
FALSE, -1, -1, (wxObject *) NULL,
_("Go one level up in document hierarchy"));
- toolBar -> AddTool(wxID_HTML_UP, wupBitmap, wxNullBitmap,
+ toolBar->AddTool(wxID_HTML_UP, wupBitmap, wxNullBitmap,
FALSE, -1, -1, (wxObject *) NULL,
_("Previous page"));
- toolBar -> AddTool(wxID_HTML_DOWN, wdownBitmap, wxNullBitmap,
+ toolBar->AddTool(wxID_HTML_DOWN, wdownBitmap, wxNullBitmap,
FALSE, -1, -1, (wxObject *) NULL,
_("Next page"));
if ((style & wxHF_PRINT) || (style & wxHF_OPENFILES))
- toolBar -> AddSeparator();
+ toolBar->AddSeparator();
if (style & wxHF_OPENFILES)
- toolBar -> AddTool(wxID_HTML_OPENFILE, wopenBitmap, wxNullBitmap,
+ toolBar->AddTool(wxID_HTML_OPENFILE, wopenBitmap, wxNullBitmap,
FALSE, -1, -1, (wxObject *) NULL,
_("Open HTML document"));
#if wxUSE_PRINTING_ARCHITECTURE
if (style & wxHF_PRINT)
- toolBar -> AddTool(wxID_HTML_PRINT, wprintBitmap, wxNullBitmap,
+ toolBar->AddTool(wxID_HTML_PRINT, wprintBitmap, wxNullBitmap,
FALSE, -1, -1, (wxObject *) NULL,
_("Print this page"));
#endif
- toolBar -> AddSeparator();
- toolBar -> AddTool(wxID_HTML_OPTIONS, woptionsBitmap, wxNullBitmap,
+ toolBar->AddSeparator();
+ toolBar->AddTool(wxID_HTML_OPTIONS, woptionsBitmap, wxNullBitmap,
FALSE, -1, -1, (wxObject *) NULL,
_("Display options dialog"));
}
bool wxHtmlHelpFrame::Display(const wxString& x)
{
wxString url = m_Data->FindPageByName(x);
- if (! url.IsEmpty()) {
+ if (!url.IsEmpty())
+ {
m_HtmlWin->LoadPage(url);
NotifyPageChanged();
return TRUE;
bool wxHtmlHelpFrame::Display(const int id)
{
wxString url = m_Data->FindPageById(id);
- if (! url.IsEmpty()) {
+ if (!url.IsEmpty())
+ {
m_HtmlWin->LoadPage(url);
NotifyPageChanged();
return TRUE;
{
if (! m_ContentsBox)
return FALSE;
- if (!m_Splitter -> IsSplit()) {
- m_NavigPan -> Show(TRUE);
- m_HtmlWin -> Show(TRUE);
- m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
+ if (!m_Splitter->IsSplit())
+ {
+ m_NavigPan->Show(TRUE);
+ m_HtmlWin->Show(TRUE);
+ m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
m_Cfg.navig_on = TRUE;
}
- m_NavigPan -> SetSelection(0);
+ m_NavigPan->SetSelection(0);
return TRUE;
}
{
if (! m_IndexList)
return FALSE;
- if (!m_Splitter -> IsSplit()) {
- m_NavigPan -> Show(TRUE);
- m_HtmlWin -> Show(TRUE);
- m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
+ if (!m_Splitter->IsSplit())
+ {
+ m_NavigPan->Show(TRUE);
+ m_HtmlWin->Show(TRUE);
+ m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
}
- m_NavigPan -> SetSelection(1);
+ m_NavigPan->SetSelection(1);
return TRUE;
}
wxString foundstr;
wxString book = wxEmptyString;
- if (!m_Splitter -> IsSplit()) {
- m_NavigPan -> Show(TRUE);
- m_HtmlWin -> Show(TRUE);
- m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
+ if (!m_Splitter->IsSplit())
+ {
+ m_NavigPan->Show(TRUE);
+ m_HtmlWin->Show(TRUE);
+ m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
}
- m_NavigPan -> SetSelection(m_SearchPage);
- m_SearchList -> Clear();
- m_SearchText -> SetValue(keyword);
- m_SearchButton -> Enable(FALSE);
+ m_NavigPan->SetSelection(m_SearchPage);
+ m_SearchList->Clear();
+ m_SearchText->SetValue(keyword);
+ m_SearchButton->Enable(FALSE);
if (m_SearchChoice->GetSelection() != 0)
book = m_SearchChoice->GetStringSelection();
wxHtmlSearchStatus status(m_Data, keyword,
- m_SearchCaseSensitive -> GetValue(), m_SearchWholeWords -> GetValue(),
+ m_SearchCaseSensitive->GetValue(), m_SearchWholeWords->GetValue(),
book);
wxProgressDialog progress(_("Searching..."), _("No matching page found yet"),
status.GetMaxIndex(), this,
wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE);
- while (status.IsActive()) {
+ while (status.IsActive())
+ {
curi = status.GetCurIndex();
if (curi % 32 == 0 && progress.Update(curi) == FALSE)
break;
- if (status.Search()) {
+ if (status.Search())
+ {
foundstr.Printf(_("Found %i matches"), ++foundcnt);
progress.Update(status.GetCurIndex(), foundstr);
- m_SearchList -> Append(status.GetName(), status.GetContentsItem());
+ m_SearchList->Append(status.GetName(), status.GetContentsItem());
}
}
- m_SearchButton -> Enable(TRUE);
- m_SearchText -> SetSelection(0, keyword.Length());
- m_SearchText -> SetFocus();
- if (foundcnt) {
- wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList -> GetClientData(0);
+ m_SearchButton->Enable(TRUE);
+ m_SearchText->SetSelection(0, keyword.Length());
+ m_SearchText->SetFocus();
+ if (foundcnt)
+ {
+ wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList->GetClientData(0);
if (it)
{
- m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page);
+ m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page);
NotifyPageChanged();
}
}
m_ContentsBox->Clear();
if (m_PagesHash) delete m_PagesHash;
- m_PagesHash = new wxHashTable(wxKEY_STRING, 2 * m_Data -> GetContentsCnt());
- m_PagesHash -> DeleteContents(TRUE);
+ m_PagesHash = new wxHashTable(wxKEY_STRING, 2 * m_Data->GetContentsCnt());
+ m_PagesHash->DeleteContents(TRUE);
int cnt = m_Data->GetContentsCnt();
int i;
wxTreeItemId roots[MAX_ROOTS];
bool imaged[MAX_ROOTS];
- m_ContentsBox -> DeleteAllItems();
- roots[0] = m_ContentsBox -> AddRoot(_("(Help)"));
- m_ContentsBox -> SetItemImage(roots[0], IMG_RootFolder);
- m_ContentsBox -> SetItemSelectedImage(roots[0], IMG_RootFolder);
+ m_ContentsBox->DeleteAllItems();
+ roots[0] = m_ContentsBox->AddRoot(_("(Help)"));
+ m_ContentsBox->SetItemImage(roots[0], IMG_RootFolder);
+ m_ContentsBox->SetItemSelectedImage(roots[0], IMG_RootFolder);
imaged[0] = TRUE;
- for (it = m_Data->GetContents(), i = 0; i < cnt; i++, it++) {
- roots[it -> m_Level + 1] = m_ContentsBox -> AppendItem(
- roots[it -> m_Level], it -> m_Name, IMG_Page, -1,
+ for (it = m_Data->GetContents(), i = 0; i < cnt; i++, it++)
+ {
+ roots[it->m_Level + 1] = m_ContentsBox->AppendItem(
+ roots[it->m_Level], it->m_Name, IMG_Page, -1,
new wxHtmlHelpTreeItemData(i));
- m_PagesHash -> Put(it -> m_Book -> GetBasePath() + it -> m_Page,
- new wxHtmlHelpHashData(i, roots[it -> m_Level + 1]));
-
- if (it -> m_Level == 0) {
- m_ContentsBox -> SetItemBold(roots[1], TRUE);
- m_ContentsBox -> SetItemImage(roots[1], IMG_Book);
- m_ContentsBox -> SetItemSelectedImage(roots[1], IMG_Book);
+ m_PagesHash->Put(it->m_Book->GetBasePath() + it->m_Page,
+ new wxHtmlHelpHashData(i, roots[it->m_Level + 1]));
+
+ if (it->m_Level == 0)
+ {
+ m_ContentsBox->SetItemBold(roots[1], TRUE);
+ m_ContentsBox->SetItemImage(roots[1], IMG_Book);
+ m_ContentsBox->SetItemSelectedImage(roots[1], IMG_Book);
imaged[1] = TRUE;
- } else imaged[it -> m_Level + 1] = FALSE;
-
- if (!imaged[it -> m_Level]) {
- m_ContentsBox -> SetItemImage(roots[it -> m_Level], IMG_Folder);
- m_ContentsBox -> SetItemSelectedImage(roots[it -> m_Level], IMG_Folder);
- imaged[it -> m_Level] = TRUE;
+ }
+ else
+ imaged[it->m_Level + 1] = FALSE;
+
+ if (!imaged[it->m_Level])
+ {
+ m_ContentsBox->SetItemImage(roots[it->m_Level], IMG_Folder);
+ m_ContentsBox->SetItemSelectedImage(roots[it->m_Level], IMG_Folder);
+ imaged[it->m_Level] = TRUE;
}
}
- m_ContentsBox -> Expand(roots[0]);
+ m_ContentsBox->Expand(roots[0]);
}
wxString cnttext;
if (cnt > INDEX_IS_SMALL) cnttext.Printf(_("%i of %i"), 0, cnt);
else cnttext.Printf(_("%i of %i"), cnt, cnt);
- m_IndexCountInfo -> SetLabel(cnttext);
+ m_IndexCountInfo->SetLabel(cnttext);
if (cnt > INDEX_IS_SMALL) return;
wxHtmlContentsItem* index = m_Data->GetIndex();
for (int i = 0; i < cnt; i++)
- m_IndexList -> Append(index[i].m_Name, (char*)(index + i));
+ m_IndexList->Append(index[i].m_Name, (char*)(index + i));
}
void wxHtmlHelpFrame::CreateSearch()
{
if (! (m_SearchList && m_SearchChoice))
return ;
- m_SearchList -> Clear();
- m_SearchChoice -> Clear();
- m_SearchChoice -> Append(_("Search in all books"));
+ m_SearchList->Clear();
+ m_SearchChoice->Clear();
+ m_SearchChoice->Append(_("Search in all books"));
const wxHtmlBookRecArray& bookrec = m_Data->GetBookRecArray();
int i, cnt = bookrec.GetCount();
for (i = 0; i < cnt; i++)
wxString oldpath;
wxString tmp;
- if (path != wxEmptyString) {
- oldpath = cfg -> GetPath();
- cfg -> SetPath(_T("/") + path);
+ if (path != wxEmptyString)
+ {
+ oldpath = cfg->GetPath();
+ cfg->SetPath(_T("/") + path);
}
- m_Cfg.navig_on = cfg -> Read(wxT("hcNavigPanel"), m_Cfg.navig_on) != 0;
- m_Cfg.sashpos = cfg -> Read(wxT("hcSashPos"), m_Cfg.sashpos);
- m_Cfg.x = cfg -> Read(wxT("hcX"), m_Cfg.x);
- m_Cfg.y = cfg -> Read(wxT("hcY"), m_Cfg.y);
- m_Cfg.w = cfg -> Read(wxT("hcW"), m_Cfg.w);
- m_Cfg.h = cfg -> Read(wxT("hcH"), m_Cfg.h);
+ m_Cfg.navig_on = cfg->Read(wxT("hcNavigPanel"), m_Cfg.navig_on) != 0;
+ m_Cfg.sashpos = cfg->Read(wxT("hcSashPos"), m_Cfg.sashpos);
+ m_Cfg.x = cfg->Read(wxT("hcX"), m_Cfg.x);
+ m_Cfg.y = cfg->Read(wxT("hcY"), m_Cfg.y);
+ m_Cfg.w = cfg->Read(wxT("hcW"), m_Cfg.w);
+ m_Cfg.h = cfg->Read(wxT("hcH"), m_Cfg.h);
- m_FixedFace = cfg -> Read(wxT("hcFixedFace"), m_FixedFace);
- m_NormalFace = cfg -> Read(wxT("hcNormalFace"), m_NormalFace);
- m_FontSize = cfg -> Read(wxT("hcFontSize"), m_FontSize);
+ m_FixedFace = cfg->Read(wxT("hcFixedFace"), m_FixedFace);
+ m_NormalFace = cfg->Read(wxT("hcNormalFace"), m_NormalFace);
+ m_FontSize = cfg->Read(wxT("hcFontSize"), m_FontSize);
{
int i;
int cnt;
wxString val, s;
- cnt = cfg -> Read(wxT("hcBookmarksCnt"), 0L);
- if (cnt != 0) {
+ cnt = cfg->Read(wxT("hcBookmarksCnt"), 0L);
+ if (cnt != 0)
+ {
m_BookmarksNames.Clear();
m_BookmarksPages.Clear();
- if (m_Bookmarks) {
- m_Bookmarks -> Clear();
- m_Bookmarks -> Append(_("(bookmarks)"));
+ if (m_Bookmarks)
+ {
+ m_Bookmarks->Clear();
+ m_Bookmarks->Append(_("(bookmarks)"));
}
- for (i = 0; i < cnt; i++) {
+ for (i = 0; i < cnt; i++)
+ {
val.Printf(wxT("hcBookmark_%i"), i);
- s = cfg -> Read(val);
+ s = cfg->Read(val);
m_BookmarksNames.Add(s);
- if (m_Bookmarks) m_Bookmarks -> Append(s);
+ if (m_Bookmarks) m_Bookmarks->Append(s);
val.Printf(wxT("hcBookmark_%i_url"), i);
- s = cfg -> Read(val);
+ s = cfg->Read(val);
m_BookmarksPages.Add(s);
}
}
m_HtmlWin->ReadCustomization(cfg);
if (path != wxEmptyString)
- cfg -> SetPath(oldpath);
+ cfg->SetPath(oldpath);
}
void wxHtmlHelpFrame::WriteCustomization(wxConfigBase *cfg, const wxString& path)
wxString oldpath;
wxString tmp;
- if (path != wxEmptyString) {
- oldpath = cfg -> GetPath();
- cfg -> SetPath(_T("/") + path);
+ if (path != wxEmptyString)
+ {
+ oldpath = cfg->GetPath();
+ cfg->SetPath(_T("/") + path);
}
- cfg -> Write(wxT("hcNavigPanel"), m_Cfg.navig_on);
- cfg -> Write(wxT("hcSashPos"), (long)m_Cfg.sashpos);
- cfg -> Write(wxT("hcX"), (long)m_Cfg.x);
- cfg -> Write(wxT("hcY"), (long)m_Cfg.y);
- cfg -> Write(wxT("hcW"), (long)m_Cfg.w);
- cfg -> Write(wxT("hcH"), (long)m_Cfg.h);
- cfg -> Write(wxT("hcFixedFace"), m_FixedFace);
- cfg -> Write(wxT("hcNormalFace"), m_NormalFace);
- cfg -> Write(wxT("hcFontSize"), (long)m_FontSize);
-
- if (m_Bookmarks) {
+ cfg->Write(wxT("hcNavigPanel"), m_Cfg.navig_on);
+ cfg->Write(wxT("hcSashPos"), (long)m_Cfg.sashpos);
+ cfg->Write(wxT("hcX"), (long)m_Cfg.x);
+ cfg->Write(wxT("hcY"), (long)m_Cfg.y);
+ cfg->Write(wxT("hcW"), (long)m_Cfg.w);
+ cfg->Write(wxT("hcH"), (long)m_Cfg.h);
+ cfg->Write(wxT("hcFixedFace"), m_FixedFace);
+ cfg->Write(wxT("hcNormalFace"), m_NormalFace);
+ cfg->Write(wxT("hcFontSize"), (long)m_FontSize);
+
+ if (m_Bookmarks)
+ {
int i;
int cnt = m_BookmarksNames.GetCount();
wxString val;
- cfg -> Write(wxT("hcBookmarksCnt"), (long)cnt);
- for (i = 0; i < cnt; i++) {
+ cfg->Write(wxT("hcBookmarksCnt"), (long)cnt);
+ for (i = 0; i < cnt; i++)
+ {
val.Printf(wxT("hcBookmark_%i"), i);
- cfg -> Write(val, m_BookmarksNames[i]);
+ cfg->Write(val, m_BookmarksNames[i]);
val.Printf(wxT("hcBookmark_%i_url"), i);
- cfg -> Write(val, m_BookmarksPages[i]);
+ cfg->Write(val, m_BookmarksPages[i]);
}
}
m_HtmlWin->WriteCustomization(cfg);
if (path != wxEmptyString)
- cfg -> SetPath(oldpath);
+ cfg->SetPath(oldpath);
}
{16, 20, 24, 32, 38, 45, 50}
};
- win -> SetFonts(scalf, fixf, f_sizes[size]);
+ win->SetFonts(scalf, fixf, f_sizes[size]);
}
sizer = new wxBoxSizer(wxHORIZONTAL);
sizer2 = new wxStaticBoxSizer( new wxStaticBox(this, -1, _("Normal font:")), wxVERTICAL);
- sizer2 -> Add(NormalFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition,
+ sizer2->Add(NormalFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition,
wxSize(200, 200),
0, NULL, wxCB_DROPDOWN | wxCB_READONLY),
1, wxEXPAND | wxLEFT | wxRIGHT, 10);
- sizer -> Add(sizer2, 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10);
+ sizer->Add(sizer2, 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10);
sizer2 = new wxStaticBoxSizer( new wxStaticBox(this, -1, _("Fixed font:")), wxVERTICAL);
- sizer2 -> Add(FixedFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition,
+ sizer2->Add(FixedFont = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition,
wxSize(200, 200),
0, NULL, wxCB_DROPDOWN | wxCB_READONLY),
1, wxEXPAND | wxLEFT | wxRIGHT, 10);
- sizer -> Add(sizer2, 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10);
+ sizer->Add(sizer2, 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10);
- topsizer -> Add(sizer);
+ topsizer->Add(sizer);
- topsizer -> Add(RadioBox = new wxRadioBox(this, -1, _("Font size:"),
+ topsizer->Add(RadioBox = new wxRadioBox(this, -1, _("Font size:"),
wxDefaultPosition, wxDefaultSize, 5, choices, 5),
0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10);
- topsizer -> Add(new wxStaticText(this, -1, _("Preview:")),
+ topsizer->Add(new wxStaticText(this, -1, _("Preview:")),
0, wxLEFT | wxTOP, 10);
- topsizer -> Add(TestWin = new wxHtmlWindow(this, -1, wxDefaultPosition, wxSize(-1, 150)),
+ topsizer->Add(TestWin = new wxHtmlWindow(this, -1, wxDefaultPosition, wxSize(-1, 150)),
1, wxEXPAND | wxLEFT|wxTOP|wxRIGHT, 10);
sizer = new wxBoxSizer(wxHORIZONTAL);
- sizer -> Add(new wxButton(this, wxID_OK, _("OK")), 0, wxALL, 10);
- sizer -> Add(new wxButton(this, wxID_CANCEL, _("Cancel")), 0, wxALL, 10);
- topsizer -> Add(sizer, 0, wxALIGN_RIGHT);
+ sizer->Add(new wxButton(this, wxID_OK, _("OK")), 0, wxALL, 10);
+ sizer->Add(new wxButton(this, wxID_CANCEL, _("Cancel")), 0, wxALL, 10);
+ topsizer->Add(sizer, 0, wxALIGN_RIGHT);
SetAutoLayout(TRUE);
SetSizer(topsizer);
- topsizer -> Fit(this);
+ topsizer->Fit(this);
Centre(wxBOTH);
}
{
wxBusyCursor bcur;
SetFontsToHtmlWin(TestWin,
- NormalFont -> GetStringSelection(),
- FixedFont -> GetStringSelection(),
- RadioBox -> GetSelection());
- TestWin -> SetPage(_(
+ NormalFont->GetStringSelection(),
+ FixedFont->GetStringSelection(),
+ RadioBox->GetSelection());
+ TestWin->SetPage(_(
"<html><body>\
Normal face<br>(and <u>underlined</u>. <i>Italic face.</i> \
<b>Bold face.</b> <b><i>Bold italic face.</i></b><br>\
wxHtmlHelpFrameOptionsDialog dlg(this);
unsigned i;
- if (m_NormalFonts == NULL) {
+ if (m_NormalFonts == NULL)
+ {
wxFontEnumerator enu;
enu.EnumerateFacenames();
m_NormalFonts = new wxArrayString;
*m_NormalFonts = *enu.GetFacenames();
- m_NormalFonts -> Sort();
+ m_NormalFonts->Sort();
}
- if (m_FixedFonts == NULL) {
+ if (m_FixedFonts == NULL)
+ {
wxFontEnumerator enu;
enu.EnumerateFacenames(wxFONTENCODING_SYSTEM, TRUE);
m_FixedFonts = new wxArrayString;
*m_FixedFonts = *enu.GetFacenames();
- m_FixedFonts -> Sort();
+ m_FixedFonts->Sort();
}
- for (i = 0; i < m_NormalFonts -> GetCount(); i++)
- dlg.NormalFont -> Append((*m_NormalFonts)[i]);
- for (i = 0; i < m_FixedFonts -> GetCount(); i++)
- dlg.FixedFont -> Append((*m_FixedFonts)[i]);
- if (!m_NormalFace.IsEmpty()) dlg.NormalFont -> SetStringSelection(m_NormalFace);
- else dlg.NormalFont -> SetSelection(0);
- if (!m_FixedFace.IsEmpty()) dlg.FixedFont -> SetStringSelection(m_FixedFace);
- else dlg.FixedFont -> SetSelection(0);
- dlg.RadioBox -> SetSelection(m_FontSize);
+ for (i = 0; i < m_NormalFonts->GetCount(); i++)
+ dlg.NormalFont->Append((*m_NormalFonts)[i]);
+ for (i = 0; i < m_FixedFonts->GetCount(); i++)
+ dlg.FixedFont->Append((*m_FixedFonts)[i]);
+ if (!m_NormalFace.IsEmpty()) dlg.NormalFont->SetStringSelection(m_NormalFace);
+ else dlg.NormalFont->SetSelection(0);
+ if (!m_FixedFace.IsEmpty()) dlg.FixedFont->SetStringSelection(m_FixedFace);
+ else dlg.FixedFont->SetSelection(0);
+ dlg.RadioBox->SetSelection(m_FontSize);
dlg.UpdateTestWin();
- if (dlg.ShowModal() == wxID_OK) {
- m_NormalFace = dlg.NormalFont -> GetStringSelection();
- m_FixedFace = dlg.FixedFont -> GetStringSelection();
- m_FontSize = dlg.RadioBox -> GetSelection();
+ if (dlg.ShowModal() == wxID_OK)
+ {
+ m_NormalFace = dlg.NormalFont->GetStringSelection();
+ m_FixedFace = dlg.FixedFont->GetStringSelection();
+ m_FontSize = dlg.RadioBox->GetSelection();
SetFontsToHtmlWin(m_HtmlWin, m_NormalFace, m_FixedFace, m_FontSize);
}
}
{
if (m_UpdateContents && m_PagesHash)
{
- wxString an = m_HtmlWin -> GetOpenedAnchor();
+ wxString an = m_HtmlWin->GetOpenedAnchor();
wxHtmlHelpHashData *ha;
if (an.IsEmpty())
- ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage());
+ ha = (wxHtmlHelpHashData*) m_PagesHash->Get(m_HtmlWin->GetOpenedPage());
else
- ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage() + wxT("#") + an);
+ ha = (wxHtmlHelpHashData*) m_PagesHash->Get(m_HtmlWin->GetOpenedPage() + wxT("#") + an);
if (ha)
{
bool olduc = m_UpdateContents;
m_UpdateContents = FALSE;
- m_ContentsBox -> SelectItem(ha -> m_Id);
- m_ContentsBox -> EnsureVisible(ha -> m_Id);
+ m_ContentsBox->SelectItem(ha->m_Id);
+ m_ContentsBox->EnsureVisible(ha->m_Id);
m_UpdateContents = olduc;
}
}
void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event)
{
- switch (event.GetId()) {
-
+ switch (event.GetId())
+ {
case wxID_HTML_BACK :
- m_HtmlWin -> HistoryBack();
+ m_HtmlWin->HistoryBack();
NotifyPageChanged();
break;
case wxID_HTML_FORWARD :
- m_HtmlWin -> HistoryForward();
+ m_HtmlWin->HistoryForward();
NotifyPageChanged();
break;
case wxID_HTML_UP :
if (m_PagesHash)
{
- wxString an = m_HtmlWin -> GetOpenedAnchor();
+ wxString an = m_HtmlWin->GetOpenedAnchor();
wxHtmlHelpHashData *ha;
if (an.IsEmpty())
- ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage());
+ ha = (wxHtmlHelpHashData*) m_PagesHash->Get(m_HtmlWin->GetOpenedPage());
else
- ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage() + wxT("#") + an);
- if (ha && ha -> m_Index > 0)
+ ha = (wxHtmlHelpHashData*) m_PagesHash->Get(m_HtmlWin->GetOpenedPage() + wxT("#") + an);
+ if (ha && ha->m_Index > 0)
{
- wxHtmlContentsItem *it = m_Data -> GetContents() + (ha -> m_Index - 1);
- m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page);
+ wxHtmlContentsItem *it = m_Data->GetContents() + (ha->m_Index - 1);
+ m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page);
NotifyPageChanged();
}
}
case wxID_HTML_UPNODE :
if (m_PagesHash)
{
- wxString an = m_HtmlWin -> GetOpenedAnchor();
+ wxString an = m_HtmlWin->GetOpenedAnchor();
wxHtmlHelpHashData *ha;
if (an.IsEmpty())
- ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage());
+ ha = (wxHtmlHelpHashData*) m_PagesHash->Get(m_HtmlWin->GetOpenedPage());
else
- ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage() + wxT("#") + an);
- if (ha && ha -> m_Index > 0)
+ ha = (wxHtmlHelpHashData*) m_PagesHash->Get(m_HtmlWin->GetOpenedPage() + wxT("#") + an);
+ if (ha && ha->m_Index > 0)
{
- int level = m_Data -> GetContents()[ha -> m_Index].m_Level - 1;
+ int level = m_Data->GetContents()[ha->m_Index].m_Level - 1;
wxHtmlContentsItem *it;
- int ind = ha -> m_Index - 1;
+ int ind = ha->m_Index - 1;
- it = m_Data -> GetContents() + ind;
- while (ind >= 0 && it -> m_Level != level) ind--, it--;
+ it = m_Data->GetContents() + ind;
+ while (ind >= 0 && it->m_Level != level) ind--, it--;
if (ind >= 0)
{
- m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page);
+ m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page);
NotifyPageChanged();
}
}
case wxID_HTML_DOWN :
if (m_PagesHash)
{
- wxString an = m_HtmlWin -> GetOpenedAnchor();
+ wxString an = m_HtmlWin->GetOpenedAnchor();
wxString adr;
wxHtmlHelpHashData *ha;
- if (an.IsEmpty()) adr = m_HtmlWin -> GetOpenedPage();
- else adr = m_HtmlWin -> GetOpenedPage() + wxT("#") + an;
+ if (an.IsEmpty()) adr = m_HtmlWin->GetOpenedPage();
+ else adr = m_HtmlWin->GetOpenedPage() + wxT("#") + an;
- ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(adr);
+ ha = (wxHtmlHelpHashData*) m_PagesHash->Get(adr);
- if (ha && ha -> m_Index < m_Data -> GetContentsCnt() - 1)
+ if (ha && ha->m_Index < m_Data->GetContentsCnt() - 1)
{
- wxHtmlContentsItem *it = m_Data -> GetContents() + (ha -> m_Index + 1);
+ wxHtmlContentsItem *it = m_Data->GetContents() + (ha->m_Index + 1);
- while (it -> m_Book -> GetBasePath() + it -> m_Page == adr) it++;
- m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page);
+ while (it->m_Book->GetBasePath() + it->m_Page == adr) it++;
+ m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page);
NotifyPageChanged();
}
}
{
if (! (m_Splitter && m_NavigPan))
return ;
- if (m_Splitter -> IsSplit()) {
- m_Cfg.sashpos = m_Splitter -> GetSashPosition();
- m_Splitter -> Unsplit(m_NavigPan);
+ if (m_Splitter->IsSplit())
+ {
+ m_Cfg.sashpos = m_Splitter->GetSashPosition();
+ m_Splitter->Unsplit(m_NavigPan);
m_Cfg.navig_on = FALSE;
- } else {
- m_NavigPan -> Show(TRUE);
- m_HtmlWin -> Show(TRUE);
- m_Splitter -> SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
+ }
+ else
+ {
+ m_NavigPan->Show(TRUE);
+ m_HtmlWin->Show(TRUE);
+ m_Splitter->SplitVertically(m_NavigPan, m_HtmlWin, m_Cfg.sashpos);
m_Cfg.navig_on = TRUE;
}
}
wxString item;
wxString url;
- item = m_HtmlWin -> GetOpenedPageTitle();
- url = m_HtmlWin -> GetOpenedPage();
- if (item == wxEmptyString) item = url.AfterLast(wxT('/'));
- if (m_BookmarksPages.Index(url) == wxNOT_FOUND) {
- m_Bookmarks -> Append(item);
+ item = m_HtmlWin->GetOpenedPageTitle();
+ url = m_HtmlWin->GetOpenedPage();
+ if (item == wxEmptyString)
+ item = url.AfterLast(wxT('/'));
+ if (m_BookmarksPages.Index(url) == wxNOT_FOUND)
+ {
+ m_Bookmarks->Append(item);
m_BookmarksNames.Add(item);
m_BookmarksPages.Add(url);
}
wxString item;
int pos;
- item = m_Bookmarks -> GetStringSelection();
+ item = m_Bookmarks->GetStringSelection();
pos = m_BookmarksNames.Index(item);
- if (pos != wxNOT_FOUND) {
+ if (pos != wxNOT_FOUND)
+ {
m_BookmarksNames.Remove(pos);
m_BookmarksPages.Remove(pos);
- m_Bookmarks -> Delete(m_Bookmarks -> GetSelection());
+ m_Bookmarks->Delete(m_Bookmarks->GetSelection());
}
}
break;
{
if (m_Printer == NULL)
m_Printer = new wxHtmlEasyPrinting(_("Help Printing"), this);
- if (!m_HtmlWin -> GetOpenedPage())
+ if (!m_HtmlWin->GetOpenedPage())
wxLogWarning(_("Cannot print empty page."));
else
- m_Printer -> PrintFile(m_HtmlWin -> GetOpenedPage());
+ m_Printer->PrintFile(m_HtmlWin->GetOpenedPage());
}
break;
#endif
if (ext == _T(".zip") || ext == _T(".htb") || ext == _T(".hhp"))
{
wxBusyCursor bcur;
- m_Data -> AddBook(s);
+ m_Data->AddBook(s);
RefreshLists();
}
else
- m_HtmlWin -> LoadPage(s);
+ m_HtmlWin->LoadPage(s);
}
}
break;
wxHtmlHelpTreeItemData *pg;
wxHtmlContentsItem *it;
- pg = (wxHtmlHelpTreeItemData*) m_ContentsBox -> GetItemData(event.GetItem());
+ pg = (wxHtmlHelpTreeItemData*) m_ContentsBox->GetItemData(event.GetItem());
if (pg && m_UpdateContents)
{
- it = m_Data -> GetContents() + (pg -> m_Id);
+ it = m_Data->GetContents() + (pg->m_Id);
m_UpdateContents = FALSE;
- m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page);
+ m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page);
m_UpdateContents = TRUE;
}
}
void wxHtmlHelpFrame::OnIndexSel(wxCommandEvent& WXUNUSED(event))
{
- wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_IndexList -> GetClientData(m_IndexList -> GetSelection());
- m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page);
+ wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_IndexList->GetClientData(m_IndexList->GetSelection());
+ m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page);
NotifyPageChanged();
}
void wxHtmlHelpFrame::OnIndexFind(wxCommandEvent& event)
{
- wxString sr = m_IndexText -> GetLineText(0);
+ wxString sr = m_IndexText->GetLineText(0);
sr.MakeLower();
if (sr == wxEmptyString)
+ {
OnIndexAll(event);
-
- else {
+ }
+ else
+ {
wxBusyCursor bcur;
const wxChar *cstr = sr.c_str();
wxChar mybuff[512], *ptr;
for (ptr = mybuff; *ptr != 0; ptr++)
if (*ptr >= _T('A') && *ptr <= _T('Z'))
*ptr -= (wxChar)(_T('A') - _T('a'));
- if (wxStrstr(mybuff, cstr) != NULL) {
- m_IndexList -> Append(index[i].m_Name, (char*)(index + i));
+ if (wxStrstr(mybuff, cstr) != NULL)
+ {
+ m_IndexList->Append(index[i].m_Name, (char*)(index + i));
displ++;
- if (first) {
- m_HtmlWin -> LoadPage(index[i].m_Book -> GetBasePath() + index[i].m_Page);
+ if (first)
+ {
+ m_HtmlWin->LoadPage(index[i].m_Book->GetBasePath() + index[i].m_Page);
NotifyPageChanged();
first = FALSE;
}
wxString cnttext;
cnttext.Printf(_("%i of %i"), displ, cnt);
- m_IndexCountInfo -> SetLabel(cnttext);
+ m_IndexCountInfo->SetLabel(cnttext);
- m_IndexText -> SetSelection(0, sr.Length());
- m_IndexText -> SetFocus();
+ m_IndexText->SetSelection(0, sr.Length());
+ m_IndexText->SetFocus();
}
}
bool first = TRUE;
wxHtmlContentsItem* index = m_Data->GetIndex();
- for (int i = 0; i < cnt; i++) {
- m_IndexList -> Append(index[i].m_Name, (char*)(index + i));
- if (first) {
- m_HtmlWin -> LoadPage(index[i].m_Book -> GetBasePath() + index[i].m_Page);
+ for (int i = 0; i < cnt; i++)
+ {
+ m_IndexList->Append(index[i].m_Name, (char*)(index + i));
+ if (first)
+ {
+ m_HtmlWin->LoadPage(index[i].m_Book->GetBasePath() + index[i].m_Page);
NotifyPageChanged();
first = FALSE;
}
wxString cnttext;
cnttext.Printf(_("%i of %i"), cnt, cnt);
- m_IndexCountInfo -> SetLabel(cnttext);
+ m_IndexCountInfo->SetLabel(cnttext);
}
void wxHtmlHelpFrame::OnSearchSel(wxCommandEvent& WXUNUSED(event))
{
- wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList -> GetClientData(m_SearchList -> GetSelection());
+ wxHtmlContentsItem *it = (wxHtmlContentsItem*) m_SearchList->GetClientData(m_SearchList->GetSelection());
if (it)
{
- m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page);
+ m_HtmlWin->LoadPage(it->m_Book->GetBasePath() + it->m_Page);
NotifyPageChanged();
}
}
void wxHtmlHelpFrame::OnSearch(wxCommandEvent& WXUNUSED(event))
{
- wxString sr = m_SearchText -> GetLineText(0);
+ wxString sr = m_SearchText->GetLineText(0);
if (sr != wxEmptyString) KeywordSearch(sr);
}
void wxHtmlHelpFrame::OnBookmarksSel(wxCommandEvent& WXUNUSED(event))
{
- wxString sr = m_Bookmarks -> GetStringSelection();
+ wxString sr = m_Bookmarks->GetStringSelection();
if (sr != wxEmptyString && sr != _("(bookmarks)"))
{
- m_HtmlWin -> LoadPage(m_BookmarksPages[m_BookmarksNames.Index(sr)]);
+ m_HtmlWin->LoadPage(m_BookmarksPages[m_BookmarksNames.Index(sr)]);
NotifyPageChanged();
}
}
GetSize(&m_Cfg.w, &m_Cfg.h);
GetPosition(&m_Cfg.x, &m_Cfg.y);
- if (m_Splitter && m_Cfg.navig_on) m_Cfg.sashpos = m_Splitter -> GetSashPosition();
+ if (m_Splitter && m_Cfg.navig_on) m_Cfg.sashpos = m_Splitter->GetSashPosition();
if (m_Config)
WriteCustomization(m_Config, m_ConfigRoot);
wxHtmlLinkInfo lnk2(*lnk);
lnk2.SetEvent(&event);
lnk2.SetHtmlCell(this);
- ((wxHtmlWindow*)parent) -> OnLinkClicked(lnk2);
+ ((wxHtmlWindow*)parent)->OnLinkClicked(lnk2);
// note : this overcasting is legal because parent is *always* wxHtmlWindow
}
}
bool wxHtmlCell::AdjustPagebreak(int *pagebreak) const
{
if ((!m_CanLiveOnPagebreak) &&
- m_PosY < *pagebreak && m_PosY + m_Height > *pagebreak) {
+ m_PosY < *pagebreak && m_PosY + m_Height > *pagebreak)
+ {
*pagebreak = m_PosY;
- if (m_Next != NULL) m_Next -> AdjustPagebreak(pagebreak);
+ if (m_Next != NULL) m_Next->AdjustPagebreak(pagebreak);
return TRUE;
}
- else {
- if (m_Next != NULL) return m_Next -> AdjustPagebreak(pagebreak);
+ else
+ {
+ if (m_Next != NULL) return m_Next->AdjustPagebreak(pagebreak);
else return FALSE;
}
}
void wxHtmlCell::Layout(int w)
{
SetPos(0, 0);
- if (m_Next) m_Next -> Layout(w);
+ if (m_Next) m_Next->Layout(w);
}
void wxHtmlCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
{
- if (m_Next) m_Next -> Draw(dc, x, y, view_y1, view_y2);
+ if (m_Next) m_Next->Draw(dc, x, y, view_y1, view_y2);
}
void wxHtmlCell::DrawInvisible(wxDC& dc, int x, int y)
{
- if (m_Next) m_Next -> DrawInvisible(dc, x, y);
+ if (m_Next) m_Next->DrawInvisible(dc, x, y);
}
const wxHtmlCell* wxHtmlCell::Find(int condition, const void* param) const
{
- if (m_Next) return m_Next -> Find(condition, param);
+ if (m_Next) return m_Next->Find(condition, param);
else return NULL;
}
{
m_Cells = m_LastCell = NULL;
m_Parent = parent;
- if (m_Parent) m_Parent -> InsertCell(this);
+ if (m_Parent) m_Parent->InsertCell(this);
m_AlignHor = wxHTML_ALIGN_LEFT;
m_AlignVer = wxHTML_ALIGN_BOTTOM;
m_IndentLeft = m_IndentRight = m_IndentTop = m_IndentBottom = 0;
if (!m_CanLiveOnPagebreak)
return wxHtmlCell::AdjustPagebreak(pagebreak);
- else {
+ else
+ {
wxHtmlCell *c = GetFirstCell();
bool rt = FALSE;
int pbrk = *pagebreak - m_PosY;
- while (c) {
- if (c -> AdjustPagebreak(&pbrk)) rt = TRUE;
- c = c -> GetNext();
+ while (c)
+ {
+ if (c->AdjustPagebreak(&pbrk)) rt = TRUE;
+ c = c->GetNext();
}
if (rt) *pagebreak = pbrk + m_PosY;
return rt;
void wxHtmlContainerCell::Layout(int w)
{
- if (m_LastLayout == w) {
+ if (m_LastLayout == w)
+ {
wxHtmlCell::Layout(w);
return;
}
*/
- if (m_WidthFloatUnits == wxHTML_UNITS_PERCENT) {
+ if (m_WidthFloatUnits == wxHTML_UNITS_PERCENT)
+ {
if (m_WidthFloat < 0) m_Width = (100 + m_WidthFloat) * w / 100;
else m_Width = m_WidthFloat * w / 100;
}
- else {
+ else
+ {
if (m_WidthFloat < 0) m_Width = w + m_WidthFloat;
else m_Width = m_WidthFloat;
}
- if (m_Cells) {
+ if (m_Cells)
+ {
int l = (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
int r = (m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight;
- m_Cells -> Layout(m_Width - (l + r));
+ m_Cells->Layout(m_Width - (l + r));
}
/*
s_width = m_Width - s_indent - ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
// my own layouting:
- while (cell != NULL) {
- switch (m_AlignVer) {
+ while (cell != NULL)
+ {
+ switch (m_AlignVer)
+ {
case wxHTML_ALIGN_TOP : ybasicpos = 0; break;
- case wxHTML_ALIGN_BOTTOM : ybasicpos = - cell -> GetHeight(); break;
- case wxHTML_ALIGN_CENTER : ybasicpos = - cell -> GetHeight() / 2; break;
+ case wxHTML_ALIGN_BOTTOM : ybasicpos = - cell->GetHeight(); break;
+ case wxHTML_ALIGN_CENTER : ybasicpos = - cell->GetHeight() / 2; break;
}
- ydiff = cell -> GetHeight() + ybasicpos;
+ ydiff = cell->GetHeight() + ybasicpos;
- if (cell -> GetDescent() + ydiff > ysizedown) ysizedown = cell -> GetDescent() + ydiff;
- if (ybasicpos + cell -> GetDescent() < -ysizeup) ysizeup = - (ybasicpos + cell -> GetDescent());
+ if (cell->GetDescent() + ydiff > ysizedown) ysizedown = cell->GetDescent() + ydiff;
+ if (ybasicpos + cell->GetDescent() < -ysizeup) ysizeup = - (ybasicpos + cell->GetDescent());
- cell -> SetPos(xpos, ybasicpos + cell -> GetDescent());
- xpos += cell -> GetWidth();
- cell = cell -> GetNext();
+ cell->SetPos(xpos, ybasicpos + cell->GetDescent());
+ xpos += cell->GetWidth();
+ cell = cell->GetNext();
xcnt++;
// force new line if occured:
- if ((cell == NULL) || (xpos + cell -> GetWidth() > s_width)) {
+ if ((cell == NULL) || (xpos + cell->GetWidth() > s_width))
+ {
if (xpos > MaxLineWidth) MaxLineWidth = xpos;
if (ysizeup < 0) ysizeup = 0;
if (ysizedown < 0) ysizedown = 0;
ypos += ysizeup;
if (m_AlignHor != wxHTML_ALIGN_JUSTIFY || cell == NULL)
- while (line != cell) {
- line -> SetPos(line -> GetPosX() + xdelta,
- ypos + line -> GetPosY());
- line = line -> GetNext();
+ while (line != cell)
+ {
+ line->SetPos(line->GetPosX() + xdelta,
+ ypos + line->GetPosY());
+ line = line->GetNext();
}
else
{
int step = (s_width - xpos);
if (step < 0) step = 0;
xcnt--;
- if (xcnt > 0) while (line != cell) {
- line -> SetPos(line -> GetPosX() + s_indent +
+ if (xcnt > 0) while (line != cell)
+ {
+ line->SetPos(line->GetPosX() + s_indent +
(counter++ * step / xcnt),
- ypos + line -> GetPosY());
- line = line -> GetNext();
+ ypos + line->GetPosY());
+ line = line->GetNext();
}
xcnt++;
}
// setup height & width, depending on container layout:
m_Height = ypos + (ysizedown + ysizeup) + m_IndentBottom;
- if (m_Height < m_MinHeight) {
- if (m_MinHeightAlign != wxHTML_ALIGN_TOP) {
+ if (m_Height < m_MinHeight)
+ {
+ if (m_MinHeightAlign != wxHTML_ALIGN_TOP)
+ {
int diff = m_MinHeight - m_Height;
if (m_MinHeightAlign == wxHTML_ALIGN_CENTER) diff /= 2;
cell = m_Cells;
- while (cell) {
- cell -> SetPos(cell -> GetPosX(), cell -> GetPosY() + diff);
- cell = cell -> GetNext();
+ while (cell)
+ {
+ cell->SetPos(cell->GetPosX(), cell->GetPosY() + diff);
+ cell = cell->GetNext();
}
}
m_Height = m_MinHeight;
void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
{
// container visible, draw it:
- if ((y + m_PosY < view_y2) && (y + m_PosY + m_Height > view_y1)) {
+ if ((y + m_PosY < view_y2) && (y + m_PosY + m_Height > view_y1))
+ {
- if (m_UseBkColour) {
+ if (m_UseBkColour)
+ {
wxBrush myb = wxBrush(m_BkColour, wxSOLID);
int real_y1 = mMax(y + m_PosY, view_y1);
dc.DrawRectangle(x + m_PosX, real_y1, m_Width, real_y2 - real_y1 + 1);
}
- if (m_UseBorder) {
+ if (m_UseBorder)
+ {
wxPen mypen1(m_BorderColour1, 1, wxSOLID);
wxPen mypen2(m_BorderColour2, 1, wxSOLID);
dc.DrawLine(x + m_PosX, y + m_PosY + m_Height - 1, x + m_PosX + m_Width - 1, y + m_PosY + m_Height - 1);
}
- if (m_Cells) m_Cells -> Draw(dc, x + m_PosX, y + m_PosY, view_y1, view_y2);
+ if (m_Cells) m_Cells->Draw(dc, x + m_PosX, y + m_PosY, view_y1, view_y2);
}
// container invisible, just proceed font+color changing:
- else {
- if (m_Cells) m_Cells -> DrawInvisible(dc, x + m_PosX, y + m_PosY);
+ else
+ {
+ if (m_Cells) m_Cells->DrawInvisible(dc, x + m_PosX, y + m_PosY);
}
wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
void wxHtmlContainerCell::DrawInvisible(wxDC& dc, int x, int y)
{
- if (m_Cells) m_Cells -> DrawInvisible(dc, x + m_PosX, y + m_PosY);
+ if (m_Cells) m_Cells->DrawInvisible(dc, x + m_PosX, y + m_PosY);
wxHtmlCell::DrawInvisible(dc, x, y);
}
wxHtmlCell *c = m_Cells;
int cx, cy, cw, ch;
- while (c) {
- cx = c -> GetPosX(), cy = c -> GetPosY();
- cw = c -> GetWidth(), ch = c -> GetHeight();
+ while (c)
+ {
+ cx = c->GetPosX(), cy = c->GetPosY();
+ cw = c->GetWidth(), ch = c->GetHeight();
if ((x >= cx) && (x < cx + cw) && (y >= cy) && (y < cy + ch))
- return c -> GetLink(x - cx, y - cy);
- c = c -> GetNext();
+ return c->GetLink(x - cx, y - cy);
+ c = c->GetNext();
}
return NULL;
}
void wxHtmlContainerCell::InsertCell(wxHtmlCell *f)
{
if (!m_Cells) m_Cells = m_LastCell = f;
- else {
- m_LastCell -> SetNext(f);
+ else
+ {
+ m_LastCell->SetNext(f);
m_LastCell = f;
- if (m_LastCell) while (m_LastCell -> GetNext()) m_LastCell = m_LastCell -> GetNext();
+ if (m_LastCell) while (m_LastCell->GetNext()) m_LastCell = m_LastCell->GetNext();
}
- f -> SetParent(this);
+ f->SetParent(this);
m_LastLayout = -1;
}
void wxHtmlContainerCell::SetAlign(const wxHtmlTag& tag)
{
- if (tag.HasParam(wxT("ALIGN"))) {
+ if (tag.HasParam(wxT("ALIGN")))
+ {
wxString alg = tag.GetParam(wxT("ALIGN"));
alg.MakeUpper();
if (alg == wxT("CENTER"))
void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag, double pixel_scale)
{
- if (tag.HasParam(wxT("WIDTH"))) {
+ if (tag.HasParam(wxT("WIDTH")))
+ {
int wdi;
wxString wd = tag.GetParam(wxT("WIDTH"));
- if (wd[wd.Length()-1] == wxT('%')) {
+ if (wd[wd.Length()-1] == wxT('%'))
+ {
wxSscanf(wd.c_str(), wxT("%i%%"), &wdi);
SetWidthFloat(wdi, wxHTML_UNITS_PERCENT);
}
- else {
+ else
+ {
wxSscanf(wd.c_str(), wxT("%i"), &wdi);
SetWidthFloat((int)(pixel_scale * (double)wdi), wxHTML_UNITS_PIXELS);
}
{
const wxHtmlCell *r = NULL;
- if (m_Cells) {
- r = m_Cells -> Find(condition, param);
+ if (m_Cells)
+ {
+ r = m_Cells->Find(condition, param);
if (r) return r;
}
void wxHtmlContainerCell::OnMouseClick(wxWindow *parent, int x, int y, const wxMouseEvent& event)
{
- if (m_Cells) {
+ if (m_Cells)
+ {
wxHtmlCell *c = m_Cells;
- while (c) {
- if ( (c -> GetPosX() <= x) &&
- (c -> GetPosY() <= y) &&
- (c -> GetPosX() + c -> GetWidth() > x) &&
- (c -> GetPosY() + c -> GetHeight() > y)) {
- c -> OnMouseClick(parent, x - c -> GetPosX(), y - c -> GetPosY(), event);
+ while (c)
+ {
+ if ( (c->GetPosX() <= x) &&
+ (c->GetPosY() <= y) &&
+ (c->GetPosX() + c->GetWidth() > x) &&
+ (c->GetPosY() + c->GetHeight() > y))
+ {
+ c->OnMouseClick(parent, x - c->GetPosX(), y - c->GetPosY(), event);
break;
}
- c = c -> GetNext();
+ c = c->GetNext();
}
}
}
{
if (m_Flags & wxHTML_CLR_FOREGROUND)
dc.SetTextForeground(m_Colour);
- if (m_Flags & wxHTML_CLR_BACKGROUND) {
+ if (m_Flags & wxHTML_CLR_BACKGROUND)
+ {
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
dc.SetTextBackground(m_Colour);
}
{
if (m_Flags & wxHTML_CLR_FOREGROUND)
dc.SetTextForeground(m_Colour);
- if (m_Flags & wxHTML_CLR_BACKGROUND) {
+ if (m_Flags & wxHTML_CLR_BACKGROUND)
+ {
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
dc.SetTextBackground(m_Colour);
}
{
int sx, sy;
m_Wnd = wnd;
- m_Wnd -> GetSize(&sx, &sy);
+ m_Wnd->GetSize(&sx, &sy);
m_Width = sx, m_Height = sy;
m_WidthFloat = w;
}
int absx = 0, absy = 0, stx, sty;
wxHtmlCell *c = this;
- while (c) {
- absx += c -> GetPosX();
- absy += c -> GetPosY();
- c = c -> GetParent();
+ while (c)
+ {
+ absx += c->GetPosX();
+ absy += c->GetPosY();
+ c = c->GetParent();
}
- ((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty);
- m_Wnd -> SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
+ ((wxScrolledWindow*)(m_Wnd->GetParent()))->ViewStart(&stx, &sty);
+ m_Wnd->SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
}
int absx = 0, absy = 0, stx, sty;
wxHtmlCell *c = this;
- while (c) {
- absx += c -> GetPosX();
- absy += c -> GetPosY();
- c = c -> GetParent();
+ while (c)
+ {
+ absx += c->GetPosX();
+ absy += c->GetPosY();
+ c = c->GetParent();
}
- ((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty);
- m_Wnd -> SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
+ ((wxScrolledWindow*)(m_Wnd->GetParent()))->ViewStart(&stx, &sty);
+ m_Wnd->SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
wxHtmlCell::DrawInvisible(dc, x, y);
}
void wxHtmlWidgetCell::Layout(int w)
{
- if (m_WidthFloat != 0) {
+ if (m_WidthFloat != 0)
+ {
m_Width = (w * m_WidthFloat) / 100;
- m_Wnd -> SetSize(m_Width, m_Height);
+ m_Wnd->SetSize(m_Width, m_Height);
}
wxHtmlCell::Layout(w);
wxString doc, doc2;
if (s == NULL) return wxEmptyString;
- src = new char[s -> GetSize()+1];
- src[s -> GetSize()] = 0;
- s -> Read(src, s -> GetSize());
+ src = new char[s->GetSize()+1];
+ src[s->GetSize()] = 0;
+ s->Read(src, s->GetSize());
doc = src;
delete [] src;
wxLogError(_("Cannot open HTML document: %s"), file.GetLocation().c_str());
return wxEmptyString;
}
- src = new char[s -> GetSize() + 1];
- src[s -> GetSize()] = 0;
- s -> Read(src, s -> GetSize());
+ src = new char[s->GetSize() + 1];
+ src[s->GetSize()] = 0;
+ s->Read(src, s->GetSize());
doc = src;
delete[] src;
templen = 0;
i = begin_pos;
- while (i < end_pos) {
+ while (i < end_pos)
+ {
c = m_Source[(unsigned int) i];
// continue building word:
- if (c != '<') {
+ if (c != '<')
+ {
temp[templen++] = c;
i++;
}
- else if (c == '<') {
+ else if (c == '<')
+ {
wxHtmlTag tag(m_Source, i, end_pos, m_Cache);
- if (templen) {
+ if (templen)
+ {
temp[templen] = 0;
AddText(temp);
templen = 0;
}
}
- if (templen) { // last word of block :-(
+ if (templen)
+ { // last word of block :-(
temp[templen] = 0;
AddText(temp);
}
h = (wxHtmlTagHandler*) m_HandlersHash.Get(tag.GetName());
if (h)
- inner = h -> HandleTag(tag);
- if (!inner) {
+ inner = h->HandleTag(tag);
+ if (!inner)
+ {
if (tag.HasEnding())
DoParsing(tag.GetBeginPos(), tag.GetEndPos1());
}
void wxHtmlParser::AddTagHandler(wxHtmlTagHandler *handler)
{
- wxString s(handler -> GetSupportedTags());
+ wxString s(handler->GetSupportedTags());
wxStringTokenizer tokenizer(s, ", ");
while (tokenizer.HasMoreTokens())
if (m_HandlersList.IndexOf(handler) == wxNOT_FOUND)
m_HandlersList.Append(handler);
- handler -> SetParser(this);
+ handler->SetParser(this);
}
wxStringTokenizer tokenizer(tags, ", ");
wxString key;
- if (m_HandlersStack == NULL) {
+ if (m_HandlersStack == NULL)
+ {
m_HandlersStack = new wxList;
- m_HandlersStack -> DeleteContents(TRUE);
+ m_HandlersStack->DeleteContents(TRUE);
}
- m_HandlersStack -> Insert(new wxHashTable(m_HandlersHash));
+ m_HandlersStack->Insert(new wxHashTable(m_HandlersHash));
- while (tokenizer.HasMoreTokens()) {
+ while (tokenizer.HasMoreTokens())
+ {
key = tokenizer.NextToken();
m_HandlersHash.Delete(key);
m_HandlersHash.Put(key, handler);
wxNode *first;
if (m_HandlersStack == NULL ||
- (first = m_HandlersStack -> GetFirst()) == NULL)
+ (first = m_HandlersStack->GetFirst()) == NULL)
{
wxLogWarning(_("Warning: attempt to remove HTML tag handler from empty stack."));
return;
}
- m_HandlersHash = *((wxHashTable*) first -> GetData());
- m_HandlersStack -> DeleteNode(first);
+ m_HandlersHash = *((wxHashTable*) first->GetData());
+ m_HandlersStack->DeleteNode(first);
}
m_CachePos = 0;
pos = 0;
- while (pos < lng) {
- if (src[pos] == wxT('<')) { // tag found:
+ while (pos < lng)
+ {
+ if (src[pos] == wxT('<')) // tag found:
+ {
if (m_CacheSize % CACHE_INCREMENT == 0)
m_Cache = (sCacheItem*) realloc(m_Cache, (m_CacheSize + CACHE_INCREMENT) * sizeof(sCacheItem));
tg = m_CacheSize++;
while (pos < lng &&
src[pos] != wxT('>') &&
src[pos] != wxT(' ') && src[pos] != wxT('\r') &&
- src[pos] != wxT('\n') && src[pos] != wxT('\t')) {
+ src[pos] != wxT('\n') && src[pos] != wxT('\t'))
+ {
dummy[i] = src[pos++];
if ((dummy[i] >= wxT('a')) && (dummy[i] <= wxT('z'))) dummy[i] -= (wxT('a') - wxT('A'));
i++;
while (pos < lng && src[pos] != wxT('>')) pos++;
- if (src[stpos+1] == wxT('/')) { // ending tag:
+ if (src[stpos+1] == wxT('/')) // ending tag:
+ {
m_Cache[tg].End1 = m_Cache[tg].End2 = -2;
// find matching begin tag:
for (i = tg; i >= 0; i--)
- if ((m_Cache[i].End1 == -1) && (wxStrcmp(m_Cache[i].Name, dummy+1) == 0)) {
+ if ((m_Cache[i].End1 == -1) && (wxStrcmp(m_Cache[i].Name, dummy+1) == 0))
+ {
m_Cache[i].End1 = stpos;
m_Cache[i].End2 = pos + 1;
break;
}
}
- else {
+ else
+ {
m_Cache[tg].End1 = m_Cache[tg].End2 = -1;
}
}
}
// ok, we're done, now we'll free .Name members of cache - we don't need it anymore:
- for (i = 0; i < m_CacheSize; i++) {
+ for (i = 0; i < m_CacheSize; i++)
+ {
delete[] m_Cache[i].Name;
m_Cache[i].Name = NULL;
}
void wxHtmlTagsCache::QueryTag(int at, int* end1, int* end2)
{
if (m_Cache == NULL) return;
- if (m_Cache[m_CachePos].Key != at) {
+ if (m_Cache[m_CachePos].Key != at)
+ {
int delta = (at < m_Cache[m_CachePos].Key) ? -1 : 1;
do {m_CachePos += delta;} while (m_Cache[m_CachePos].Key != at);
}
// fill-in name, params and begin pos:
m_Name = m_Params = wxEmptyString;
i = pos+1;
- if (source[i] == '/') {m_Ending = TRUE; i++;}
+ if (source[i] == '/') { m_Ending = TRUE; i++; }
else m_Ending = FALSE;
while ((i < end_pos) &&
((c = source[i++]) != ' ' && c != '\r' && c != '\n' && c != '\t' &&
- c != '>')) {
+ c != '>'))
+ {
if ((c >= 'a') && (c <= 'z')) c -= ('a' - 'A');
m_Name += c;
}
if (source[i-1] != '>')
- while ((i < end_pos) && ((c = source[i++]) != '>')) {
+ while ((i < end_pos) && ((c = source[i++]) != '>'))
+ {
if ((c >= 'a') && (c <= 'z')) c -= ('a' - 'A');
if (c == '\r' || c == '\n' || c == '\t') c = ' '; // make future parsing a bit simpler
m_Params += c;
- if (c == '"') {
+ if (c == '"')
+ {
while ((i < end_pos) && ((c = source[i++]) != '"')) m_Params += c;
m_Params += c;
}
- else if (c == '\'') {
+ else if (c == '\'')
+ {
while ((i < end_pos) && ((c = source[i++]) != '\'')) m_Params += c;
m_Params += c;
}
}
m_Begin = i;
- cache -> QueryTag(pos, &m_End1, &m_End2);
+ cache->QueryTag(pos, &m_End1, &m_End2);
if (m_End1 > end_pos) m_End1 = end_pos;
if (m_End2 > end_pos) m_End2 = end_pos;
}
if (*st == 0) return FALSE;
if (*p == 0) return FALSE;
- for (st2 = st, p2 = p; ; st2++) {
+ for (st2 = st, p2 = p; ; st2++)
+ {
if (*p2 == 0) return TRUE;
if (*st2 == 0) return FALSE;
if (*p2 != *st2) p2 = p;
if (*p2 == *st2) p2++;
if (*st2 == ' ') p2 = p;
- else if (*st2 == '=') {
+ else if (*st2 == '=')
+ {
p2 = p;
- while (*st2 != ' ') {
- if (*st2 == '"') {
+ while (*st2 != ' ')
+ {
+ if (*st2 == '"')
+ {
st2++;
while (*st2 != '"') st2++;
}
if (*st == 0) return "";
if (*p == 0) return "";
- for (st2 = st, p2 = p; ; st2++) {
- if (*p2 == 0) { // found
+ for (st2 = st, p2 = p; ; st2++)
+ {
+ if (*p2 == 0) // found
+ {
wxString fnd = "";
st2++; // '=' character
comma = FALSE;
- comma_char = '\0';
- if (!with_commas && (*(st2) == '"')) {
- st2++;
- comma = TRUE;
- comma_char = '"';
- }
- else if (!with_commas && (*(st2) == '\'')) {
- st2++;
- comma = TRUE;
- comma_char = '\'';
- }
- while (*st2 != 0) {
+ comma_char = '\0';
+ if (!with_commas && (*(st2) == '"'))
+ {
+ st2++;
+ comma = TRUE;
+ comma_char = '"';
+ }
+ else if (!with_commas && (*(st2) == '\''))
+ {
+ st2++;
+ comma = TRUE;
+ comma_char = '\'';
+ }
+
+ while (*st2 != 0)
+ {
if (comma && *st2 == comma_char) comma = FALSE;
else if ((*st2 == ' ') && (!comma)) break;
fnd += (*(st2++));
if (*p2 != *st2) p2 = p;
if (*p2 == *st2) p2++;
if (*st2 == ' ') p2 = p;
- else if (*st2 == '=') {
+ else if (*st2 == '=')
+ {
p2 = p;
- while (*st2 != ' ') {
- if (*st2 == '"') {
+ while (*st2 != ' ')
+ {
+ if (*st2 == '"')
+ {
st2++;
while (*st2 != '"') st2++;
}
- else if (*st2 == '\'') {
+ else if (*st2 == '\'')
+ {
st2++;
while (*st2 != '\'') st2++;
}
m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString;
m_Cell = NULL;
m_Parser = new wxHtmlWinParser(this);
- m_Parser -> SetFS(m_FS);
+ m_Parser->SetFS(m_FS);
SetBorders(10);
m_HistoryPos = -1;
m_HistoryOn = TRUE;
m_Style = style;
- SetPage("<html><body></body></html>");
+ SetPage(wxT("<html><body></body></html>"));
}
{
wxString op = m_OpenedPage;
- m_Parser -> SetFonts(normal_face, fixed_face, sizes);
+ m_Parser->SetFonts(normal_face, fixed_face, sizes);
SetPage(wxT("<html><body></body></html>")); // fonts changed => contents invalid
if (!op.IsEmpty()) LoadPage(op);
}
{
wxClientDC *dc = new wxClientDC(this);
- dc -> SetMapMode(wxMM_TEXT);
+ dc->SetMapMode(wxMM_TEXT);
SetBackgroundColour(wxColour(0xFF, 0xFF, 0xFF));
m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString;
- m_Parser -> SetDC(dc);
- if (m_Cell) {
+ m_Parser->SetDC(dc);
+ if (m_Cell)
+ {
delete m_Cell;
m_Cell = NULL;
}
- m_Cell = (wxHtmlContainerCell*) m_Parser -> Parse(source);
+ m_Cell = (wxHtmlContainerCell*) m_Parser->Parse(source);
delete dc;
- m_Cell -> SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
- m_Cell -> SetAlignHor(wxHTML_ALIGN_CENTER);
+ m_Cell->SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
+ m_Cell->SetAlignHor(wxHTML_ALIGN_CENTER);
CreateLayout();
if (m_tmpCanDrawLocks == 0) Refresh();
return TRUE;
wxYield(); Refresh(FALSE);
m_tmpCanDrawLocks++;
- if (m_HistoryOn && (m_HistoryPos != -1)) { // store scroll position into history item
+ if (m_HistoryOn && (m_HistoryPos != -1)) // store scroll position into history item
+ {
int x, y;
ViewStart(&x, &y);
m_History[m_HistoryPos].SetPos(y);
}
- if (location[0] == wxT('#')) { // local anchor
+ if (location[0] == wxT('#')) // local anchor
+ {
wxString anch = location.Mid(1) /*1 to end*/;
m_tmpCanDrawLocks--;
rt_val = ScrollToAnchor(anch);
m_tmpCanDrawLocks++;
}
- else if (location.Find(wxT('#')) != wxNOT_FOUND && location.BeforeFirst(wxT('#')) == m_OpenedPage) {
+ else if (location.Find(wxT('#')) != wxNOT_FOUND && location.BeforeFirst(wxT('#')) == m_OpenedPage)
+ {
wxString anch = location.AfterFirst(wxT('#'));
m_tmpCanDrawLocks--;
rt_val = ScrollToAnchor(anch);
m_tmpCanDrawLocks++;
}
else if (location.Find(wxT('#')) != wxNOT_FOUND &&
- (m_FS -> GetPath() + location.BeforeFirst(wxT('#'))) == m_OpenedPage) {
+ (m_FS->GetPath() + location.BeforeFirst(wxT('#'))) == m_OpenedPage)
+ {
wxString anch = location.AfterFirst(wxT('#'));
m_tmpCanDrawLocks--;
rt_val = ScrollToAnchor(anch);
m_tmpCanDrawLocks++;
}
- else {
+ else
+ {
needs_refresh = TRUE;
// load&display it:
- if (m_RelatedStatusBar != -1) {
- m_RelatedFrame -> SetStatusText(_("Connecting..."), m_RelatedStatusBar);
+ if (m_RelatedStatusBar != -1)
+ {
+ m_RelatedFrame->SetStatusText(_("Connecting..."), m_RelatedStatusBar);
Refresh(FALSE);
}
- f = m_FS -> OpenFile(location);
+ f = m_FS->OpenFile(location);
- if (f == NULL) {
+ if (f == NULL)
+ {
wxString err;
wxLogError(_("Unable to open requested HTML document: %s"), location.c_str());
return FALSE;
}
- else {
+ else
+ {
wxNode *node;
wxString src = wxEmptyString;
- if (m_RelatedStatusBar != -1) {
+ if (m_RelatedStatusBar != -1)
+ {
wxString msg = _("Loading : ") + location;
- m_RelatedFrame -> SetStatusText(msg, m_RelatedStatusBar);
+ m_RelatedFrame->SetStatusText(msg, m_RelatedStatusBar);
Refresh(FALSE);
}
node = m_Filters.GetFirst();
- while (node){
- wxHtmlFilter *h = (wxHtmlFilter*) node -> GetData();
- if (h -> CanRead(*f)) {
- src = h -> ReadFile(*f);
+ while (node)
+ {
+ wxHtmlFilter *h = (wxHtmlFilter*) node->GetData();
+ if (h->CanRead(*f))
+ {
+ src = h->ReadFile(*f);
break;
}
- node = node -> GetNext();
+ node = node->GetNext();
}
- if (src == wxEmptyString) {
+ if (src == wxEmptyString)
+ {
if (m_DefaultFilter == NULL) m_DefaultFilter = GetDefaultFilter();
- src = m_DefaultFilter -> ReadFile(*f);
+ src = m_DefaultFilter->ReadFile(*f);
}
- m_FS -> ChangePathTo(f -> GetLocation());
+ m_FS->ChangePathTo(f->GetLocation());
rt_val = SetPage(src);
- m_OpenedPage = f -> GetLocation();
- if (f -> GetAnchor() != wxEmptyString) {
+ m_OpenedPage = f->GetLocation();
+ if (f->GetAnchor() != wxEmptyString)
+ {
wxYield();
- ScrollToAnchor(f -> GetAnchor());
+ ScrollToAnchor(f->GetAnchor());
}
delete f;
- if (m_RelatedStatusBar != -1) m_RelatedFrame -> SetStatusText(_("Done"), m_RelatedStatusBar);
+ if (m_RelatedStatusBar != -1) m_RelatedFrame->SetStatusText(_("Done"), m_RelatedStatusBar);
}
}
- if (m_HistoryOn) { // add this page to history there:
+ if (m_HistoryOn) // add this page to history there:
+ {
int c = m_History.GetCount() - (m_HistoryPos + 1);
m_HistoryPos++;
OnSetTitle(wxFileNameFromPath(m_OpenedPage));
SetCursor(*wxSTANDARD_CURSOR);
- if (needs_refresh) {
+ if (needs_refresh)
+ {
wxYield();
m_tmpCanDrawLocks--;
Refresh();
bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor)
{
- const wxHtmlCell *c = m_Cell -> Find(wxHTML_COND_ISANCHOR, &anchor);
+ const wxHtmlCell *c = m_Cell->Find(wxHTML_COND_ISANCHOR, &anchor);
if (!c)
{
wxLogWarning(_("HTML anchor %s does not exist."), anchor.c_str());
return FALSE;
}
- else {
+ else
+ {
int y;
- for (y = 0; c != NULL; c = c -> GetParent()) y += c -> GetPosY();
+ for (y = 0; c != NULL; c = c->GetParent()) y += c->GetPosY();
Scroll(-1, y / wxHTML_SCROLL_STEP);
m_OpenedAnchor = anchor;
return TRUE;
void wxHtmlWindow::OnSetTitle(const wxString& title)
{
- if (m_RelatedFrame) {
+ if (m_RelatedFrame)
+ {
wxString tit;
tit.Printf(m_TitleFormat, title.c_str());
- m_RelatedFrame -> SetTitle(tit);
+ m_RelatedFrame->SetTitle(tit);
}
m_OpenedPageTitle = title;
}
if (!m_Cell) return;
- if (m_Style & wxHW_SCROLLBAR_NEVER) {
- SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell -> GetWidth() / wxHTML_SCROLL_STEP, 0); // always off
+ if (m_Style & wxHW_SCROLLBAR_NEVER)
+ {
+ SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell->GetWidth() / wxHTML_SCROLL_STEP, 0); // always off
GetClientSize(&ClientWidth, &ClientHeight);
- m_Cell -> Layout(ClientWidth);
+ m_Cell->Layout(ClientWidth);
}
else {
GetClientSize(&ClientWidth, &ClientHeight);
- m_Cell -> Layout(ClientWidth);
- if (ClientHeight < m_Cell -> GetHeight() + GetCharHeight()) {
+ m_Cell->Layout(ClientWidth);
+ if (ClientHeight < m_Cell->GetHeight() + GetCharHeight())
+ {
SetScrollbars(
wxHTML_SCROLL_STEP, wxHTML_SCROLL_STEP,
- m_Cell -> GetWidth() / wxHTML_SCROLL_STEP,
- (m_Cell -> GetHeight() + GetCharHeight()) / wxHTML_SCROLL_STEP
+ m_Cell->GetWidth() / wxHTML_SCROLL_STEP,
+ (m_Cell->GetHeight() + GetCharHeight()) / wxHTML_SCROLL_STEP
/*cheat: top-level frag is always container*/);
}
- else { /* we fit into window, no need for scrollbars */
- SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell -> GetWidth() / wxHTML_SCROLL_STEP, 0); // disable...
+ else /* we fit into window, no need for scrollbars */
+ {
+ SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell->GetWidth() / wxHTML_SCROLL_STEP, 0); // disable...
GetClientSize(&ClientWidth, &ClientHeight);
- m_Cell -> Layout(ClientWidth); // ...and relayout
+ m_Cell->Layout(ClientWidth); // ...and relayout
}
}
}
int p_fontsizes[7];
wxString p_fff, p_ffn;
- if (path != wxEmptyString) {
- oldpath = cfg -> GetPath();
- cfg -> SetPath(path);
+ if (path != wxEmptyString)
+ {
+ oldpath = cfg->GetPath();
+ cfg->SetPath(path);
}
- m_Borders = cfg -> Read("wxHtmlWindow/Borders", m_Borders);
- p_fff = cfg -> Read("wxHtmlWindow/FontFaceFixed", m_Parser -> m_FontFaceFixed);
- p_ffn = cfg -> Read("wxHtmlWindow/FontFaceNormal", m_Parser -> m_FontFaceNormal);
- for (int i = 0; i < 7; i++) {
+ m_Borders = cfg->Read("wxHtmlWindow/Borders", m_Borders);
+ p_fff = cfg->Read("wxHtmlWindow/FontFaceFixed", m_Parser->m_FontFaceFixed);
+ p_ffn = cfg->Read("wxHtmlWindow/FontFaceNormal", m_Parser->m_FontFaceNormal);
+ for (int i = 0; i < 7; i++)
+ {
tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i);
- p_fontsizes[i] = cfg -> Read(tmp, m_Parser -> m_FontsSizes[i]);
+ p_fontsizes[i] = cfg->Read(tmp, m_Parser->m_FontsSizes[i]);
}
SetFonts(p_ffn, p_fff, p_fontsizes);
if (path != wxEmptyString)
- cfg -> SetPath(oldpath);
+ cfg->SetPath(oldpath);
}
wxString oldpath;
wxString tmp;
- if (path != wxEmptyString) {
- oldpath = cfg -> GetPath();
- cfg -> SetPath(path);
+ if (path != wxEmptyString)
+ {
+ oldpath = cfg->GetPath();
+ cfg->SetPath(path);
}
- cfg -> Write("wxHtmlWindow/Borders", (long) m_Borders);
- cfg -> Write("wxHtmlWindow/FontFaceFixed", m_Parser -> m_FontFaceFixed);
- cfg -> Write("wxHtmlWindow/FontFaceNormal", m_Parser -> m_FontFaceNormal);
- for (int i = 0; i < 7; i++) {
+ cfg->Write("wxHtmlWindow/Borders", (long) m_Borders);
+ cfg->Write("wxHtmlWindow/FontFaceFixed", m_Parser->m_FontFaceFixed);
+ cfg->Write("wxHtmlWindow/FontFaceNormal", m_Parser->m_FontFaceNormal);
+ for (int i = 0; i < 7; i++)
+ {
tmp.Printf(wxT("wxHtmlWindow/FontsSize%i"), i);
- cfg -> Write(tmp, (long) m_Parser -> m_FontsSizes[i]);
+ cfg->Write(tmp, (long) m_Parser->m_FontsSizes[i]);
}
if (path != wxEmptyString)
- cfg -> SetPath(oldpath);
+ cfg->SetPath(oldpath);
}
dc.SetBackgroundMode(wxTRANSPARENT);
ViewStart(&x, &y);
- while (upd) {
+ while (upd)
+ {
v_y = upd.GetY();
v_h = upd.GetH();
- if (m_Cell) m_Cell -> Draw(dc, 0, 0, y * wxHTML_SCROLL_STEP + v_y, y * wxHTML_SCROLL_STEP + v_h + v_y);
+ if (m_Cell) m_Cell->Draw(dc, 0, 0, y * wxHTML_SCROLL_STEP + v_y, y * wxHTML_SCROLL_STEP + v_h + v_y);
upd++;
}
}
{
m_tmpMouseMoved = TRUE;
- if (event.ButtonDown()) {
+ if (event.ButtonDown())
+ {
int sx, sy;
wxPoint pos;
wxString lnk;
pos = event.GetPosition();
if (m_Cell)
- m_Cell -> OnMouseClick(this, sx + pos.x, sy + pos.y, event);
+ m_Cell->OnMouseClick(this, sx + pos.x, sy + pos.y, event);
}
}
s_cur_arrow = new wxCursor(wxCURSOR_ARROW);
}
- if (m_tmpMouseMoved && (m_Cell != NULL)) {
+ if (m_tmpMouseMoved && (m_Cell != NULL))
+ {
int sx, sy;
int x, y;
wxHtmlLinkInfo *lnk;
ViewStart(&sx, &sy); sx *= wxHTML_SCROLL_STEP; sy *= wxHTML_SCROLL_STEP;
wxGetMousePosition(&x, &y);
ScreenToClient(&x, &y);
- lnk = m_Cell -> GetLink(sx + x, sy + y);
+ lnk = m_Cell->GetLink(sx + x, sy + y);
- if (lnk != m_tmpLastLink) {
- if (lnk == NULL) {
+ if (lnk != m_tmpLastLink)
+ {
+ if (lnk == NULL)
+ {
SetCursor(*s_cur_arrow);
- if (m_RelatedStatusBar != -1) m_RelatedFrame -> SetStatusText(wxEmptyString, m_RelatedStatusBar);
+ if (m_RelatedStatusBar != -1) m_RelatedFrame->SetStatusText(wxEmptyString, m_RelatedStatusBar);
}
- else {
+ else
+ {
SetCursor(*s_cur_hand);
if (m_RelatedStatusBar != -1)
- m_RelatedFrame -> SetStatusText(lnk -> GetHref(), m_RelatedStatusBar);
+ m_RelatedFrame->SetStatusText(lnk->GetHref(), m_RelatedStatusBar);
}
m_tmpLastLink = lnk;
}
m_Cells = NULL;
m_Parser = new wxHtmlWinParser(NULL);
m_FS = new wxFileSystem();
- m_Parser -> SetFS(m_FS);
+ m_Parser->SetFS(m_FS);
}
void wxHtmlDCRenderer::SetDC(wxDC *dc, double pixel_scale)
{
m_DC = dc;
- m_Parser -> SetDC(m_DC, pixel_scale);
+ m_Parser->SetDC(m_DC, pixel_scale);
}
if (m_Cells != NULL) delete m_Cells;
- m_FS -> ChangePathTo(basepath, isdir);
- m_Cells = (wxHtmlContainerCell*) m_Parser -> Parse(html);
- m_Cells -> SetIndent(0, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
- m_Cells -> Layout(m_Width);
+ m_FS->ChangePathTo(basepath, isdir);
+ m_Cells = (wxHtmlContainerCell*) m_Parser->Parse(html);
+ m_Cells->SetIndent(0, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
+ m_Cells->Layout(m_Width);
}
if (m_Cells == NULL || m_DC == NULL) return 0;
pbreak = (int)(from + m_Height);
- while (m_Cells -> AdjustPagebreak(&pbreak)) {}
+ while (m_Cells->AdjustPagebreak(&pbreak)) {}
hght = pbreak - from;
- if (!dont_render) {
- m_DC -> SetBrush(*wxWHITE_BRUSH);
+ if (!dont_render)
+ {
+ m_DC->SetBrush(*wxWHITE_BRUSH);
- m_DC -> SetClippingRegion(x, y, m_Width, hght);
- m_Cells -> Draw(*m_DC,
+ m_DC->SetClippingRegion(x, y, m_Width, hght);
+ m_Cells->Draw(*m_DC,
x, (y - from),
y, pbreak + (y /*- from*/));
- m_DC -> DestroyClippingRegion();
+ m_DC->DestroyClippingRegion();
}
- if (pbreak < m_Cells -> GetHeight()) return pbreak;
+ if (pbreak < m_Cells->GetHeight()) return pbreak;
else return GetTotalHeight();
}
int wxHtmlDCRenderer::GetTotalHeight()
{
- if (m_Cells) return m_Cells -> GetHeight();
+ if (m_Cells) return m_Cells->GetHeight();
else return 0;
}
GetPPIScreen(&ppiScreenX, &ppiScreenY);
wxDisplaySize(&scr_w, &scr_h);
- GetDC() -> GetSize(&dc_w, &dc_h);
+ GetDC()->GetSize(&dc_w, &dc_h);
- GetDC() -> SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth);
+ GetDC()->SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth);
/* prepare headers/footers renderer: */
- m_RendererHdr -> SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY);
- m_RendererHdr -> SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginTop)),
+ m_RendererHdr->SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY);
+ m_RendererHdr->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginTop)),
(int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom)));
- if (m_Headers[0] != wxEmptyString) {
- m_RendererHdr -> SetHtmlText(TranslateHeader(m_Headers[0], 1));
- m_HeaderHeight = m_RendererHdr -> GetTotalHeight();
+ if (m_Headers[0] != wxEmptyString)
+ {
+ m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[0], 1));
+ m_HeaderHeight = m_RendererHdr->GetTotalHeight();
}
- else if (m_Headers[1] != wxEmptyString) {
- m_RendererHdr -> SetHtmlText(TranslateHeader(m_Headers[1], 1));
- m_HeaderHeight = m_RendererHdr -> GetTotalHeight();
+ else if (m_Headers[1] != wxEmptyString)
+ {
+ m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[1], 1));
+ m_HeaderHeight = m_RendererHdr->GetTotalHeight();
}
- if (m_Footers[0] != wxEmptyString) {
- m_RendererHdr -> SetHtmlText(TranslateHeader(m_Footers[0], 1));
- m_FooterHeight = m_RendererHdr -> GetTotalHeight();
+ if (m_Footers[0] != wxEmptyString)
+ {
+ m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[0], 1));
+ m_FooterHeight = m_RendererHdr->GetTotalHeight();
}
- else if (m_Footers[1] != wxEmptyString) {
- m_RendererHdr -> SetHtmlText(TranslateHeader(m_Footers[1], 1));
- m_FooterHeight = m_RendererHdr -> GetTotalHeight();
+ else if (m_Footers[1] != wxEmptyString)
+ {
+ m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[1], 1));
+ m_FooterHeight = m_RendererHdr->GetTotalHeight();
}
/* prepare main renderer: */
- m_Renderer -> SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY);
- m_Renderer -> SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginTop)),
+ m_Renderer->SetDC(GetDC(), (double)ppiPrinterY / (double)ppiScreenY);
+ m_Renderer->SetSize((int) (ppmm_h * (mm_w - m_MarginLeft - m_MarginTop)),
(int) (ppmm_v * (mm_h - m_MarginTop - m_MarginBottom) -
m_FooterHeight - m_HeaderHeight -
((m_HeaderHeight == 0) ? 0 : m_MarginSpace * ppmm_v) -
((m_FooterHeight == 0) ? 0 : m_MarginSpace * ppmm_v)
));
- m_Renderer -> SetHtmlText(m_Document, m_BasePath, m_BasePathIsDir);
+ m_Renderer->SetHtmlText(m_Document, m_BasePath, m_BasePathIsDir);
CountPages();
return TRUE;
}
bool wxHtmlPrintout::OnPrintPage(int page)
{
wxDC *dc = GetDC();
- if (dc) {
+ if (dc)
+ {
if (HasPage(page))
RenderPage(dc, page);
return TRUE;
- } else
- return FALSE;
+ }
+ else return FALSE;
}
return;
}
- wxInputStream *st = ff -> GetStream();
- char *t = new char[st -> GetSize() + 1];
- st -> Read(t, st -> GetSize());
- t[st -> GetSize()] = 0;
+ wxInputStream *st = ff->GetStream();
+ char *t = new char[st->GetSize() + 1];
+ st->Read(t, st->GetSize());
+ t[st->GetSize()] = 0;
wxString doc = wxString(t);
delete t;
m_NumPages = 0;
m_PageBreaks[0] = 0;
- do {
- pos = m_Renderer -> Render((int)( ppmm_h * m_MarginLeft),
+ do
+ {
+ pos = m_Renderer->Render((int)( ppmm_h * m_MarginLeft),
(int) (ppmm_v * (m_MarginTop + (m_HeaderHeight == 0 ? 0 : m_MarginSpace)) + m_HeaderHeight),
pos, TRUE);
m_PageBreaks[++m_NumPages] = pos;
- } while (pos < m_Renderer -> GetTotalHeight());
+ } while (pos < m_Renderer->GetTotalHeight());
}
ppmm_h = (float)pageWidth / mm_w;
ppmm_v = (float)pageHeight / mm_h;
wxDisplaySize(&scr_w, &scr_h);
- dc -> GetSize(&dc_w, &dc_h);
+ dc->GetSize(&dc_w, &dc_h);
int ppiPrinterX, ppiPrinterY;
GetPPIPrinter(&ppiPrinterX, &ppiPrinterY);
int ppiScreenX, ppiScreenY;
GetPPIScreen(&ppiScreenX, &ppiScreenY);
- dc -> SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth);
+ dc->SetUserScale((double)dc_w / (double)pageWidth, (double)dc_w / (double)pageWidth);
- m_Renderer -> SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY);
+ m_Renderer->SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY);
- dc -> SetBackgroundMode(wxTRANSPARENT);
+ dc->SetBackgroundMode(wxTRANSPARENT);
- m_Renderer -> Render((int) (ppmm_h * m_MarginLeft),
+ m_Renderer->Render((int) (ppmm_h * m_MarginLeft),
(int) (ppmm_v * (m_MarginTop + (m_HeaderHeight == 0 ? 0 : m_MarginSpace)) + m_HeaderHeight),
m_PageBreaks[page-1]);
- m_RendererHdr -> SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY);
- if (m_Headers[page % 2] != wxEmptyString) {
- m_RendererHdr -> SetHtmlText(TranslateHeader(m_Headers[page % 2], page));
- m_RendererHdr -> Render((int) (ppmm_h * m_MarginLeft), (int) (ppmm_v * m_MarginTop));
+ m_RendererHdr->SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY);
+ if (m_Headers[page % 2] != wxEmptyString)
+ {
+ m_RendererHdr->SetHtmlText(TranslateHeader(m_Headers[page % 2], page));
+ m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (ppmm_v * m_MarginTop));
}
- if (m_Footers[page % 2] != wxEmptyString) {
- m_RendererHdr -> SetHtmlText(TranslateHeader(m_Footers[page % 2], page));
- m_RendererHdr -> Render((int) (ppmm_h * m_MarginLeft), (int) (pageHeight - ppmm_v * m_MarginBottom - m_FooterHeight));
+ if (m_Footers[page % 2] != wxEmptyString)
+ {
+ m_RendererHdr->SetHtmlText(TranslateHeader(m_Footers[page % 2], page));
+ m_RendererHdr->Render((int) (ppmm_h * m_MarginLeft), (int) (pageHeight - ppmm_v * m_MarginBottom - m_FooterHeight));
}
}
m_PageSetupData = new wxPageSetupDialogData;
m_Headers[0] = m_Headers[1] = m_Footers[0] = m_Footers[1] = wxEmptyString;
- m_PageSetupData -> EnableMargins(TRUE);
- m_PageSetupData -> SetMarginTopLeft(wxPoint(25, 25));
- m_PageSetupData -> SetMarginBottomRight(wxPoint(25, 25));
+ m_PageSetupData->EnableMargins(TRUE);
+ m_PageSetupData->SetMarginTopLeft(wxPoint(25, 25));
+ m_PageSetupData->SetMarginBottomRight(wxPoint(25, 25));
}
bool wxHtmlEasyPrinting::PreviewFile(const wxString &htmlfile)
{
wxHtmlPrintout *p1 = CreatePrintout();
- p1 -> SetHtmlFile(htmlfile);
+ p1->SetHtmlFile(htmlfile);
wxHtmlPrintout *p2 = CreatePrintout();
- p2 -> SetHtmlFile(htmlfile);
+ p2->SetHtmlFile(htmlfile);
return DoPreview(p1, p2);
}
bool wxHtmlEasyPrinting::PreviewText(const wxString &htmltext, const wxString &basepath)
{
wxHtmlPrintout *p1 = CreatePrintout();
- p1 -> SetHtmlText(htmltext, basepath, TRUE);
+ p1->SetHtmlText(htmltext, basepath, TRUE);
wxHtmlPrintout *p2 = CreatePrintout();
- p2 -> SetHtmlText(htmltext, basepath, TRUE);
+ p2->SetHtmlText(htmltext, basepath, TRUE);
return DoPreview(p1, p2);
}
bool wxHtmlEasyPrinting::PrintFile(const wxString &htmlfile)
{
wxHtmlPrintout *p = CreatePrintout();
- p -> SetHtmlFile(htmlfile);
+ p->SetHtmlFile(htmlfile);
return DoPrint(p);
}
bool wxHtmlEasyPrinting::PrintText(const wxString &htmltext, const wxString &basepath)
{
wxHtmlPrintout *p = CreatePrintout();
- p -> SetHtmlText(htmltext, basepath, TRUE);
+ p->SetHtmlText(htmltext, basepath, TRUE);
return DoPrint(p);
}
// Pass two printout objects: for preview, and possible printing.
wxPrintDialogData printDialogData(*m_PrintData);
wxPrintPreview *preview = new wxPrintPreview(printout1, printout2, &printDialogData);
- if (!preview -> Ok()) {
+ if (!preview->Ok())
+ {
delete preview;
return FALSE;
}
wxPreviewFrame *frame = new wxPreviewFrame(preview, m_Frame,
m_Name + _(" Preview"),
wxPoint(100, 100), wxSize(650, 500));
- frame -> Centre(wxBOTH);
- frame -> Initialize();
- frame -> Show(TRUE);
+ frame->Centre(wxBOTH);
+ frame->Initialize();
+ frame->Show(TRUE);
return TRUE;
}
void wxHtmlEasyPrinting::PageSetup()
{
- m_PageSetupData -> SetPrintData(*m_PrintData);
+ m_PageSetupData->SetPrintData(*m_PrintData);
wxPageSetupDialog pageSetupDialog(m_Frame, m_PageSetupData);
- if (pageSetupDialog.ShowModal() == wxID_OK) {
+ if (pageSetupDialog.ShowModal() == wxID_OK)
+ {
(*m_PrintData) = pageSetupDialog.GetPageSetupData().GetPrintData();
(*m_PageSetupData) = pageSetupDialog.GetPageSetupData();
}
{
wxHtmlPrintout *p = new wxHtmlPrintout(m_Name);
- p -> SetHeader(m_Headers[0], wxPAGE_EVEN);
- p -> SetHeader(m_Headers[1], wxPAGE_ODD);
- p -> SetFooter(m_Footers[0], wxPAGE_EVEN);
- p -> SetFooter(m_Footers[1], wxPAGE_ODD);
-
- p -> SetMargins(m_PageSetupData -> GetMarginTopLeft().y,
- m_PageSetupData -> GetMarginBottomRight().y,
- m_PageSetupData -> GetMarginTopLeft().x,
- m_PageSetupData -> GetMarginBottomRight().x);
+ p->SetHeader(m_Headers[0], wxPAGE_EVEN);
+ p->SetHeader(m_Headers[1], wxPAGE_ODD);
+ p->SetFooter(m_Footers[0], wxPAGE_EVEN);
+ p->SetFooter(m_Footers[1], wxPAGE_ODD);
+
+ p->SetMargins(m_PageSetupData->GetMarginTopLeft().y,
+ m_PageSetupData->GetMarginBottomRight().y,
+ m_PageSetupData->GetMarginTopLeft().x,
+ m_PageSetupData->GetMarginBottomRight().x);
return p;
}
wxHtmlContainerCell *c;
- if (tag.GetName() == wxT("DL")) {
- if (m_WParser -> GetContainer() -> GetFirstCell() != NULL) {
- m_WParser -> CloseContainer();
- m_WParser -> OpenContainer();
+ if (tag.GetName() == wxT("DL"))
+ {
+ if (m_WParser->GetContainer()->GetFirstCell() != NULL)
+ {
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
}
- m_WParser -> GetContainer() -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_TOP);
+ m_WParser->GetContainer()->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
ParseInner(tag);
- if (m_WParser -> GetContainer() -> GetFirstCell() != NULL) {
- m_WParser -> CloseContainer();
- m_WParser -> OpenContainer();
+ if (m_WParser->GetContainer()->GetFirstCell() != NULL)
+ {
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
}
- m_WParser -> GetContainer() -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_TOP);
+ m_WParser->GetContainer()->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
return TRUE;
}
- else if (tag.GetName() == wxT("DT")) {
- if (!tag.IsEnding()) {
- m_WParser -> CloseContainer();
- c = m_WParser -> OpenContainer();
- c -> SetAlignHor(wxHTML_ALIGN_LEFT);
- c -> SetMinHeight(m_WParser -> GetCharHeight());
+ else if (tag.GetName() == wxT("DT"))
+ {
+ if (!tag.IsEnding())
+ {
+ m_WParser->CloseContainer();
+ c = m_WParser->OpenContainer();
+ c->SetAlignHor(wxHTML_ALIGN_LEFT);
+ c->SetMinHeight(m_WParser->GetCharHeight());
}
return FALSE;
}
- else if (!tag.IsEnding()) { // "DD"
- m_WParser -> CloseContainer();
- c = m_WParser -> OpenContainer();
- c -> SetIndent(5 * m_WParser -> GetCharWidth(), wxHTML_INDENT_LEFT);
+ else if (!tag.IsEnding()) // "DD"
+ {
+ m_WParser->CloseContainer();
+ c = m_WParser->OpenContainer();
+ c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_LEFT);
return FALSE;
}
TAG_HANDLER_PROC(tag)
{
- wxColour oldclr = m_WParser -> GetActualColor();
- int oldsize = m_WParser -> GetFontSize();
- wxString oldface = m_WParser -> GetFontFace();
+ wxColour oldclr = m_WParser->GetActualColor();
+ int oldsize = m_WParser->GetFontSize();
+ wxString oldface = m_WParser->GetFontFace();
- if (tag.HasParam(wxT("COLOR"))) {
+ if (tag.HasParam(wxT("COLOR")))
+ {
unsigned long tmp = 0;
wxColour clr;
- if (tag.ScanParam(wxT("COLOR"), wxT("#%lX"), &tmp) == 1) {
+ if (tag.ScanParam(wxT("COLOR"), wxT("#%lX"), &tmp) == 1)
+ {
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
- m_WParser -> SetActualColor(clr);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(clr));
+ m_WParser->SetActualColor(clr);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr));
}
}
- if (tag.HasParam(wxT("SIZE"))) {
+ if (tag.HasParam(wxT("SIZE")))
+ {
long tmp = 0;
wxChar c = tag.GetParam(wxT("SIZE"))[(unsigned int) 0];
- if (tag.ScanParam(wxT("SIZE"), wxT("%li"), &tmp) == 1) {
+ if (tag.ScanParam(wxT("SIZE"), wxT("%li"), &tmp) == 1)
+ {
if (c == '+' || c == '-')
- m_WParser -> SetFontSize(oldsize+tmp);
+ m_WParser->SetFontSize(oldsize+tmp);
else
- m_WParser -> SetFontSize(tmp);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser->SetFontSize(tmp);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
}
}
- if (tag.HasParam(wxT("FACE"))) {
- if (m_Faces.GetCount() == 0) {
+ if (tag.HasParam(wxT("FACE")))
+ {
+ if (m_Faces.GetCount() == 0)
+ {
wxFontEnumerator enu;
enu.EnumerateFacenames();
m_Faces = *enu.GetFacenames();
int index;
while (tk.HasMoreTokens())
- if ((index = m_Faces.Index(tk.GetNextToken())) != wxNOT_FOUND) {
- m_WParser -> SetFontFace(m_Faces[index]);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ {
+ if ((index = m_Faces.Index(tk.GetNextToken())) != wxNOT_FOUND)
+ {
+ m_WParser->SetFontFace(m_Faces[index]);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
break;
}
+ }
}
ParseInner(tag);
- if (oldface != m_WParser -> GetFontFace()) {
- m_WParser -> SetFontFace(oldface);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ if (oldface != m_WParser->GetFontFace())
+ {
+ m_WParser->SetFontFace(oldface);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
}
- if (oldsize != m_WParser -> GetFontSize()) {
- m_WParser -> SetFontSize(oldsize);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ if (oldsize != m_WParser->GetFontSize())
+ {
+ m_WParser->SetFontSize(oldsize);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
}
- if (oldclr != m_WParser -> GetActualColor()) {
- m_WParser -> SetActualColor(oldclr);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(oldclr));
+ if (oldclr != m_WParser->GetActualColor())
+ {
+ m_WParser->SetActualColor(oldclr);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(oldclr));
}
return TRUE;
}
TAG_HANDLER_PROC(tag)
{
- int underlined = m_WParser -> GetFontUnderlined();
+ int underlined = m_WParser->GetFontUnderlined();
- m_WParser -> SetFontUnderlined(TRUE);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser->SetFontUnderlined(TRUE);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
ParseInner(tag);
- m_WParser -> SetFontUnderlined(underlined);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser->SetFontUnderlined(underlined);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
return TRUE;
}
TAG_HANDLER_PROC(tag)
{
- int bold = m_WParser -> GetFontBold();
+ int bold = m_WParser->GetFontBold();
- m_WParser -> SetFontBold(TRUE);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser->SetFontBold(TRUE);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
ParseInner(tag);
- m_WParser -> SetFontBold(bold);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser->SetFontBold(bold);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
return TRUE;
}
TAG_HANDLER_PROC(tag)
{
- int italic = m_WParser -> GetFontItalic();
+ int italic = m_WParser->GetFontItalic();
- m_WParser -> SetFontItalic(TRUE);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser->SetFontItalic(TRUE);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
ParseInner(tag);
- m_WParser -> SetFontItalic(italic);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser->SetFontItalic(italic);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
return TRUE;
}
TAG_HANDLER_PROC(tag)
{
- int fixed = m_WParser -> GetFontFixed();
+ int fixed = m_WParser->GetFontFixed();
- m_WParser -> SetFontFixed(TRUE);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser->SetFontFixed(TRUE);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
ParseInner(tag);
- m_WParser -> SetFontFixed(fixed);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser->SetFontFixed(fixed);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
return TRUE;
}
int old_size, old_b, old_i, old_u, old_f, old_al;
wxHtmlContainerCell *c;
- old_size = m_WParser -> GetFontSize();
- old_b = m_WParser -> GetFontBold();
- old_i = m_WParser -> GetFontItalic();
- old_u = m_WParser -> GetFontUnderlined();
- old_f = m_WParser -> GetFontFixed();
- old_al = m_WParser -> GetAlign();
+ old_size = m_WParser->GetFontSize();
+ old_b = m_WParser->GetFontBold();
+ old_i = m_WParser->GetFontItalic();
+ old_u = m_WParser->GetFontUnderlined();
+ old_f = m_WParser->GetFontFixed();
+ old_al = m_WParser->GetAlign();
- m_WParser -> SetFontBold(TRUE);
- m_WParser -> SetFontItalic(FALSE);
- m_WParser -> SetFontUnderlined(FALSE);
- m_WParser -> SetFontFixed(FALSE);
+ m_WParser->SetFontBold(TRUE);
+ m_WParser->SetFontItalic(FALSE);
+ m_WParser->SetFontUnderlined(FALSE);
+ m_WParser->SetFontFixed(FALSE);
if (tag.GetName() == wxT("H1"))
- m_WParser -> SetFontSize(7);
+ m_WParser->SetFontSize(7);
else if (tag.GetName() == wxT("H2"))
- m_WParser -> SetFontSize(6);
+ m_WParser->SetFontSize(6);
else if (tag.GetName() == wxT("H3"))
- m_WParser -> SetFontSize(5);
- else if (tag.GetName() == wxT("H4")) {
- m_WParser -> SetFontSize(5);
- m_WParser -> SetFontItalic(TRUE);
- m_WParser -> SetFontBold(FALSE);
+ m_WParser->SetFontSize(5);
+ else if (tag.GetName() == wxT("H4"))
+ {
+ m_WParser->SetFontSize(5);
+ m_WParser->SetFontItalic(TRUE);
+ m_WParser->SetFontBold(FALSE);
}
else if (tag.GetName() == wxT("H5"))
- m_WParser -> SetFontSize(4);
- else if (tag.GetName() == wxT("H6")) {
- m_WParser -> SetFontSize(4);
- m_WParser -> SetFontItalic(TRUE);
- m_WParser -> SetFontBold(FALSE);
+ m_WParser->SetFontSize(4);
+ else if (tag.GetName() == wxT("H6"))
+ {
+ m_WParser->SetFontSize(4);
+ m_WParser->SetFontItalic(TRUE);
+ m_WParser->SetFontBold(FALSE);
}
- c = m_WParser -> GetContainer();
- if (c -> GetFirstCell()) {
- m_WParser -> CloseContainer();
- m_WParser -> OpenContainer();
- c = m_WParser -> GetContainer();
+ c = m_WParser->GetContainer();
+ if (c->GetFirstCell())
+ {
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
+ c = m_WParser->GetContainer();
}
- c = m_WParser -> GetContainer();
+ c = m_WParser->GetContainer();
- c -> SetAlign(tag);
- c -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
- c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_TOP);
- m_WParser -> SetAlign(c -> GetAlignHor());
+ c->SetAlign(tag);
+ c->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
+ c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
+ m_WParser->SetAlign(c->GetAlignHor());
ParseInner(tag);
- m_WParser -> SetFontSize(old_size);
- m_WParser -> SetFontBold(old_b);
- m_WParser -> SetFontItalic(old_i);
- m_WParser -> SetFontUnderlined(old_u);
- m_WParser -> SetFontFixed(old_f);
- m_WParser -> SetAlign(old_al);
+ m_WParser->SetFontSize(old_size);
+ m_WParser->SetFontBold(old_b);
+ m_WParser->SetFontItalic(old_i);
+ m_WParser->SetFontUnderlined(old_u);
+ m_WParser->SetFontFixed(old_f);
+ m_WParser->SetAlign(old_al);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
- m_WParser -> CloseContainer();
- m_WParser -> OpenContainer();
- c = m_WParser -> GetContainer();
- c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_TOP);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
+ c = m_WParser->GetContainer();
+ c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
return TRUE;
}
TAG_HANDLER_PROC(tag)
{
- int oldsize = m_WParser -> GetFontSize();
+ int oldsize = m_WParser->GetFontSize();
int sz = (tag.GetName() == wxT("BIG")) ? +1 : -1;
- m_WParser -> SetFontSize(sz);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser->SetFontSize(sz);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
ParseInner(tag);
- m_WParser -> SetFontSize(oldsize);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser->SetFontSize(oldsize);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
return TRUE;
}
public:
wxHtmlLineCell(int size) : wxHtmlCell() {m_Height = size;}
void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
- void Layout(int w) {m_Width = w; if (m_Next) m_Next -> Layout(w);}
+ void Layout(int w) {m_Width = w; if (m_Next) m_Next->Layout(w);}
};
wxHtmlContainerCell *c;
int sz;
- m_WParser -> CloseContainer();
- c = m_WParser -> OpenContainer();
+ m_WParser->CloseContainer();
+ c = m_WParser->OpenContainer();
- c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_VERTICAL);
- c -> SetAlignHor(wxHTML_ALIGN_CENTER);
- c -> SetAlign(tag);
- c -> SetWidthFloat(tag);
+ c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_VERTICAL);
+ c->SetAlignHor(wxHTML_ALIGN_CENTER);
+ c->SetAlign(tag);
+ c->SetWidthFloat(tag);
sz = 1;
if (tag.HasParam(wxT("SIZE")) && tag.ScanParam(wxT("SIZE"), wxT("%i"), &sz) == 1) {}
- c -> InsertCell(new wxHtmlLineCell((int)((double)sz * m_WParser -> GetPixelScale())));
+ c->InsertCell(new wxHtmlLineCell((int)((double)sz * m_WParser->GetPixelScale())));
- m_WParser -> CloseContainer();
- m_WParser -> OpenContainer();
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
return FALSE;
}
wxString x = incoords, y;
type = t;
- while ((i = x.Find( ',' )) != -1) {
+ while ((i = x.Find( ',' )) != -1)
+ {
coords.Add( (int)(pixel_scale * (double)wxAtoi( x.Left( i ).c_str())) );
x = x.Mid( i + 1 );
}
wxHtmlLinkInfo *wxHtmlImageMapAreaCell::GetLink( int x, int y ) const
{
- switch (type) {
+ switch (type)
+ {
case RECT:
{
int l, t, r, b;
t = coords[ 1 ];
r = coords[ 2 ];
b = coords[ 3 ];
- if (x >= l && x <= r && y >= t && y <= b) {
+ if (x >= l && x <= r && y >= t && y <= b)
+ {
return m_Link;
}
break;
t = coords[ 1 ];
r = coords[ 2 ];
d = sqrt( (double) (((x - l) * (x - l)) + ((y - t) * (y - t))) );
- if (d < (double)r) {
+ if (d < (double)r)
+ {
return m_Link;
}
}
break;
case POLY:
{
- if (coords.GetCount() >= 6) {
+ if (coords.GetCount() >= 6)
+ {
int intersects = 0;
int wherex = x;
int wherey = y;
int end = totalc;
int pointer = 1;
- if ((yval >= wherey) != (coords[pointer] >= wherey)) {
- if ((xval >= wherex) == (coords[0] >= wherex)) {
+ if ((yval >= wherey) != (coords[pointer] >= wherey))
+ {
+ if ((xval >= wherex) == (coords[0] >= wherex))
+ {
intersects += (xval >= wherex) ? 1 : 0;
- } else {
+ }
+ else
+ {
intersects += ((xval - (yval - wherey) *
(coords[0] - xval) /
(coords[pointer] - yval)) >= wherex) ? 1 : 0;
}
}
- while (pointer < end) {
+ while (pointer < end)
+ {
yval = coords[pointer];
pointer += 2;
- if (yval >= wherey) {
- while ((pointer < end) && (coords[pointer] >= wherey)) {
+ if (yval >= wherey)
+ {
+ while ((pointer < end) && (coords[pointer] >= wherey))
+ {
pointer += 2;
}
- if (pointer >= end) {
+ if (pointer >= end)
+ {
break;
}
if ((coords[pointer - 3] >= wherex) ==
(coords[pointer - 1] >= wherex)) {
intersects += (coords[pointer - 3] >= wherex) ? 1 : 0;
- } else {
+ }
+ else
+ {
intersects +=
((coords[pointer - 3] - (coords[pointer - 2] - wherey) *
(coords[pointer - 1] - coords[pointer - 3]) /
(coords[pointer] - coords[pointer - 2])) >= wherex) ? 1 : 0;
}
- } else {
- while ((pointer < end) && (coords[pointer] < wherey)) {
+ }
+ else
+ {
+ while ((pointer < end) && (coords[pointer] < wherey))
+ {
pointer += 2;
}
- if (pointer >= end) {
+ if (pointer >= end)
+ {
break;
}
if ((coords[pointer - 3] >= wherex) ==
- (coords[pointer - 1] >= wherex)) {
+ (coords[pointer - 1] >= wherex))
+ {
intersects += (coords[pointer - 3] >= wherex) ? 1 : 0;
- } else {
+ }
+ else
+ {
intersects +=
((coords[pointer - 3] - (coords[pointer - 2] - wherey) *
(coords[pointer - 1] - coords[pointer - 3]) /
}
}
}
- if ((intersects & 1) != 0) {
+ if ((intersects & 1) != 0)
+ {
return m_Link;
}
}
}
break;
}
- if (m_Next) {
+
+ if (m_Next)
+ {
wxHtmlImageMapAreaCell *a = (wxHtmlImageMapAreaCell*)m_Next;
return a->GetLink( x, y );
}
const wxHtmlCell *wxHtmlImageMapCell::Find( int cond, const void *param ) const
{
- if (cond == wxHTML_COND_ISIMAGEMAP) {
+ if (cond == wxHTML_COND_ISIMAGEMAP)
+ {
if (m_Name == *((wxString*)(param)))
return this;
}
{
wxImage *img;
int ww, hh;
- wxInputStream *s = input -> GetStream();
+ wxInputStream *s = input->GetStream();
img = new wxImage(*s, wxBITMAP_TYPE_ANY);
m_Image = NULL;
- if (img && (img -> Ok())) {
- ww = img -> GetWidth();
- hh = img -> GetHeight();
+ if (img && (img->Ok()))
+ {
+ ww = img->GetWidth();
+ hh = img->GetHeight();
if (w != -1) m_Width = w; else m_Width = ww;
if (h != -1) m_Height = h; else m_Height = hh;
m_Width = (int)(scale * (double)m_Width);
m_Height = (int)(scale * (double)m_Height);
- if ((m_Width != ww) || (m_Height != hh)) {
- wxImage img2 = img -> Scale(m_Width, m_Height);
+ if ((m_Width != ww) || (m_Height != hh))
+ {
+ wxImage img2 = img->Scale(m_Width, m_Height);
m_Image = new wxBitmap(img2.ConvertToBitmap());
- } else
- m_Image = new wxBitmap(img -> ConvertToBitmap());
+ }
+ else
+ m_Image = new wxBitmap(img->ConvertToBitmap());
delete img;
}
- switch (align) {
+ switch (align)
+ {
case wxHTML_ALIGN_TOP :
m_Descent = m_Height;
break;
{
if (m_MapName.IsEmpty())
return wxHtmlCell::GetLink( x, y );
- if (!m_ImageMap) {
+ if (!m_ImageMap)
+ {
wxHtmlContainerCell *p, *op;
op = p = GetParent();
- while (p) {
+ while (p)
+ {
op = p;
p = p->GetParent();
}
p = op;
wxHtmlCell *cell = (wxHtmlCell*)p->Find( wxHTML_COND_ISIMAGEMAP, (const void*)(&m_MapName));
- if (!cell) {
+ if (!cell)
+ {
((wxString&)m_MapName).Clear();
return wxHtmlCell::GetLink( x, y );
}
- { // dirty hack, ask Joel why he fills m_ImageMap in this place
+ { // dirty hack, ask Joel why he fills m_ImageMap in this place
// THE problem is that we're in const method and we can't modify m_ImageMap
wxHtmlImageMapCell **cx = (wxHtmlImageMapCell**)(&m_ImageMap);
*cx = (wxHtmlImageMapCell*)cell;
TAG_HANDLER_PROC(tag)
{
- if (tag.GetName() == wxT("IMG")) {
- if (tag.HasParam(wxT("SRC"))) {
+ if (tag.GetName() == wxT("IMG"))
+ {
+ if (tag.HasParam(wxT("SRC")))
+ {
int w = -1, h = -1;
int al;
wxFSFile *str;
wxString tmp = tag.GetParam(wxT("SRC"));
wxString mn = wxEmptyString;
- str = m_WParser -> GetFS() -> OpenFile(tmp);
+ str = m_WParser->GetFS()->OpenFile(tmp);
if (tag.HasParam(wxT("WIDTH"))) tag.ScanParam(wxT("WIDTH"), wxT("%i"), &w);
if (tag.HasParam(wxT("HEIGHT"))) tag.ScanParam(wxT("HEIGHT"), wxT("%i"), &h);
al = wxHTML_ALIGN_BOTTOM;
- if (tag.HasParam(wxT("ALIGN"))) {
+ if (tag.HasParam(wxT("ALIGN")))
+ {
wxString alstr = tag.GetParam(wxT("ALIGN"));
alstr.MakeUpper(); // for the case alignment was in ".."
if (alstr == wxT("TEXTTOP")) al = wxHTML_ALIGN_TOP;
else if ((alstr == wxT("CENTER")) || (alstr == wxT("ABSCENTER"))) al = wxHTML_ALIGN_CENTER;
}
- if (tag.HasParam(wxT("USEMAP"))) {
+ if (tag.HasParam(wxT("USEMAP")))
+ {
mn = tag.GetParam( wxT("USEMAP") );
- if (mn[ (unsigned int) 0 ] == wxT('#')) {
+ if (mn[ (unsigned int) 0 ] == wxT('#'))
+ {
mn = mn.Mid( 1 );
}
}
wxHtmlImageCell *cel = NULL;
- if (str) {
- cel = new wxHtmlImageCell(str, w, h, m_WParser -> GetPixelScale(), al, mn);
- cel -> SetLink(m_WParser -> GetLink());
- m_WParser -> GetContainer() -> InsertCell(cel);
+ if (str)
+ {
+ cel = new wxHtmlImageCell(str, w, h, m_WParser->GetPixelScale(), al, mn);
+ cel->SetLink(m_WParser->GetLink());
+ m_WParser->GetContainer()->InsertCell(cel);
delete str;
}
}
}
- if (tag.GetName() == wxT("MAP")) {
+ if (tag.GetName() == wxT("MAP"))
+ {
m_WParser->CloseContainer();
m_WParser->OpenContainer();
- if (tag.HasParam(wxT("NAME"))) {
+ if (tag.HasParam(wxT("NAME")))
+ {
wxString tmp = tag.GetParam(wxT("NAME"));
wxHtmlImageMapCell *cel = new wxHtmlImageMapCell( tmp );
m_WParser->GetContainer()->InsertCell( cel );
m_WParser->CloseContainer();
m_WParser->OpenContainer();
}
- if (tag.GetName() == wxT("AREA")) {
- if (tag.HasParam(wxT("SHAPE"))) {
+ if (tag.GetName() == wxT("AREA"))
+ {
+ if (tag.HasParam(wxT("SHAPE")))
+ {
wxString tmp = tag.GetParam(wxT("SHAPE"));
wxString coords = wxEmptyString;
tmp.MakeUpper();
wxHtmlImageMapAreaCell *cel = NULL;
- if (tag.HasParam(wxT("COORDS"))) {
+ if (tag.HasParam(wxT("COORDS")))
+ {
coords = tag.GetParam(wxT("COORDS"));
}
- if (tmp == wxT("POLY")) {
- cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::POLY, coords, m_WParser -> GetPixelScale() );
- } else if (tmp == wxT("CIRCLE")) {
- cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::CIRCLE, coords, m_WParser -> GetPixelScale() );
- } else if (tmp == wxT("RECT")) {
- cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::RECT, coords, m_WParser -> GetPixelScale() );
+ if (tmp == wxT("POLY"))
+ {
+ cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::POLY, coords, m_WParser->GetPixelScale() );
+ }
+ else if (tmp == wxT("CIRCLE"))
+ {
+ cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::CIRCLE, coords, m_WParser->GetPixelScale() );
+ }
+ else if (tmp == wxT("RECT"))
+ {
+ cel = new wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::RECT, coords, m_WParser->GetPixelScale() );
}
- if (cel != NULL && tag.HasParam(wxT("HREF"))) {
+ if (cel != NULL && tag.HasParam(wxT("HREF")))
+ {
wxString tmp = tag.GetParam(wxT("HREF"));
wxString target = wxEmptyString;
if (tag.HasParam(wxT("TARGET"))) target = tag.GetParam(wxT("TARGET"));
TAG_HANDLER_PROC(tag)
{
- if (m_WParser -> GetContainer() -> GetFirstCell() != NULL) {
- m_WParser -> CloseContainer();
- m_WParser -> OpenContainer();
+ if (m_WParser->GetContainer()->GetFirstCell() != NULL)
+ {
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
}
- m_WParser -> GetContainer() -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_TOP);
- m_WParser -> GetContainer() -> SetAlign(tag);
+ m_WParser->GetContainer()->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
+ m_WParser->GetContainer()->SetAlign(tag);
return FALSE;
}
TAG_HANDLER_PROC(tag)
{
- int al = m_WParser -> GetContainer() -> GetAlignHor();
+ int al = m_WParser->GetContainer()->GetAlignHor();
wxHtmlContainerCell *c;
- m_WParser -> CloseContainer();
- c = m_WParser -> OpenContainer();
- c -> SetAlignHor(al);
- c -> SetAlign(tag);
- c -> SetMinHeight(m_WParser -> GetCharHeight());
+ m_WParser->CloseContainer();
+ c = m_WParser->OpenContainer();
+ c->SetAlignHor(al);
+ c->SetAlign(tag);
+ c->SetMinHeight(m_WParser->GetCharHeight());
return FALSE;
}
TAG_HANDLER_PROC(tag)
{
- int old = m_WParser -> GetAlign();
- wxHtmlContainerCell *c = m_WParser -> GetContainer();
-
- m_WParser -> SetAlign(wxHTML_ALIGN_CENTER);
- if (c -> GetFirstCell() != NULL) {
- m_WParser -> CloseContainer();
- m_WParser -> OpenContainer();
+ int old = m_WParser->GetAlign();
+ wxHtmlContainerCell *c = m_WParser->GetContainer();
+
+ m_WParser->SetAlign(wxHTML_ALIGN_CENTER);
+ if (c->GetFirstCell() != NULL)
+ {
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
}
else
- c -> SetAlignHor(wxHTML_ALIGN_CENTER);
+ c->SetAlignHor(wxHTML_ALIGN_CENTER);
- if (tag.HasEnding()) {
+ if (tag.HasEnding())
+ {
ParseInner(tag);
- m_WParser -> SetAlign(old);
- if (c -> GetFirstCell() != NULL) {
- m_WParser -> CloseContainer();
- m_WParser -> OpenContainer();
+ m_WParser->SetAlign(old);
+ if (c->GetFirstCell() != NULL)
+ {
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
}
else
- c -> SetAlignHor(old);
+ c->SetAlignHor(old);
return TRUE;
}
TAG_HANDLER_PROC(tag)
{
- int old = m_WParser -> GetAlign();
- wxHtmlContainerCell *c = m_WParser -> GetContainer();
- if (c -> GetFirstCell() != NULL) {
- m_WParser -> CloseContainer();
- m_WParser -> OpenContainer();
- c = m_WParser -> GetContainer();
- c -> SetAlign(tag);
- m_WParser -> SetAlign(c -> GetAlignHor());
+ int old = m_WParser->GetAlign();
+ wxHtmlContainerCell *c = m_WParser->GetContainer();
+ if (c->GetFirstCell() != NULL)
+ {
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
+ c = m_WParser->GetContainer();
+ c->SetAlign(tag);
+ m_WParser->SetAlign(c->GetAlignHor());
}
- else {
- c -> SetAlign(tag);
- m_WParser -> SetAlign(c -> GetAlignHor());
+ else
+ {
+ c->SetAlign(tag);
+ m_WParser->SetAlign(c->GetAlignHor());
}
ParseInner(tag);
- m_WParser -> SetAlign(old);
- if (c -> GetFirstCell() != NULL) {
- m_WParser -> CloseContainer();
- m_WParser -> OpenContainer();
+ m_WParser->SetAlign(old);
+ if (c->GetFirstCell() != NULL)
+ {
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
}
else
- c -> SetAlignHor(old);
+ c->SetAlignHor(old);
return TRUE;
}
TAG_HANDLER_PROC(tag)
{
- if (m_WParser -> GetWindow()) {
- wxHtmlWindow *wfr = (wxHtmlWindow*)(m_WParser -> GetWindow());
- if (wfr) {
+ if (m_WParser->GetWindow())
+ {
+ wxHtmlWindow *wfr = (wxHtmlWindow*)(m_WParser->GetWindow());
+ if (wfr)
+ {
wxString title = "";
- wxString *src = m_WParser -> GetSource();
+ wxString *src = m_WParser->GetSource();
for (int i = tag.GetBeginPos(); i < tag.GetEndPos1(); i++) title += (*src)[(unsigned int) i];
- wfr -> OnSetTitle(title);
+ wfr->OnSetTitle(title);
}
}
return TRUE;
unsigned long tmp;
wxColour clr;
- if (tag.HasParam(wxT("TEXT"))) {
- if (tag.ScanParam(wxT("TEXT"), wxT("#%lX"), &tmp) == 1) {
+ if (tag.HasParam(wxT("TEXT")))
+ {
+ if (tag.ScanParam(wxT("TEXT"), wxT("#%lX"), &tmp) == 1)
+ {
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
- m_WParser -> SetActualColor(clr);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(clr));
+ m_WParser->SetActualColor(clr);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr));
}
- }
+ }
- if (tag.HasParam(wxT("LINK"))) {
- if (tag.ScanParam(wxT("LINK"), wxT("#%lX"), &tmp) == 1) {
+ if (tag.HasParam(wxT("LINK")))
+ {
+ if (tag.ScanParam(wxT("LINK"), wxT("#%lX"), &tmp) == 1)
+ {
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
- m_WParser -> SetLinkColor(clr);
- }
+ m_WParser->SetLinkColor(clr);
+ }
}
- if (tag.HasParam(wxT("BGCOLOR"))) {
- if (tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &tmp) == 1) {
+ if (tag.HasParam(wxT("BGCOLOR")))
+ {
+ if (tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &tmp) == 1)
+ {
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(clr, wxHTML_CLR_BACKGROUND));
- if (m_WParser -> GetWindow() != NULL)
- m_WParser -> GetWindow() -> SetBackgroundColour(clr);
- }
+ m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(clr, wxHTML_CLR_BACKGROUND));
+ if (m_WParser->GetWindow() != NULL)
+ m_WParser->GetWindow()->SetBackgroundColour(clr);
+ }
}
return FALSE;
}
{
wxHtmlContainerCell *c;
- m_WParser -> CloseContainer();
- c = m_WParser -> OpenContainer();
- if (c -> GetAlignHor() == wxHTML_ALIGN_RIGHT)
- c -> SetIndent(5 * m_WParser -> GetCharWidth(), wxHTML_INDENT_RIGHT);
+ m_WParser->CloseContainer();
+ c = m_WParser->OpenContainer();
+
+ if (c->GetAlignHor() == wxHTML_ALIGN_RIGHT)
+ c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_RIGHT);
else
- c -> SetIndent(5 * m_WParser -> GetCharWidth(), wxHTML_INDENT_LEFT);
- c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_TOP);
- m_WParser -> OpenContainer();
+ c->SetIndent(5 * m_WParser->GetCharWidth(), wxHTML_INDENT_LEFT);
+
+ c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_TOP);
+ m_WParser->OpenContainer();
ParseInner(tag);
- c = m_WParser -> CloseContainer();
- c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_BOTTOM);
- m_WParser -> CloseContainer();
- m_WParser -> OpenContainer();
+ c = m_WParser->CloseContainer();
+ c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_BOTTOM);
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
return TRUE;
}
TAG_HANDLER_PROC(tag)
{
- if (tag.HasParam("NAME")) {
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlAnchorCell(tag.GetParam("NAME")));
+ if (tag.HasParam("NAME"))
+ {
+ m_WParser->GetContainer()->InsertCell(new wxHtmlAnchorCell(tag.GetParam("NAME")));
}
- if (tag.HasParam("HREF")) {
- wxHtmlLinkInfo oldlnk = m_WParser -> GetLink();
- wxColour oldclr = m_WParser -> GetActualColor();
- int oldund = m_WParser -> GetFontUnderlined();
+ if (tag.HasParam("HREF"))
+ {
+ wxHtmlLinkInfo oldlnk = m_WParser->GetLink();
+ wxColour oldclr = m_WParser->GetActualColor();
+ int oldund = m_WParser->GetFontUnderlined();
wxString name(tag.GetParam("HREF")), target;
if (tag.HasParam("TARGET")) target = tag.GetParam("TARGET");
- m_WParser -> SetActualColor(m_WParser -> GetLinkColor());
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(m_WParser -> GetLinkColor()));
- m_WParser -> SetFontUnderlined(TRUE);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
- m_WParser -> SetLink(wxHtmlLinkInfo(name, target));
+ m_WParser->SetActualColor(m_WParser->GetLinkColor());
+ m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(m_WParser->GetLinkColor()));
+ m_WParser->SetFontUnderlined(TRUE);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
+ m_WParser->SetLink(wxHtmlLinkInfo(name, target));
ParseInner(tag);
- m_WParser -> SetLink(oldlnk);
- m_WParser -> SetFontUnderlined(oldund);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
- m_WParser -> SetActualColor(oldclr);
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(oldclr));
+ m_WParser->SetLink(oldlnk);
+ m_WParser->SetFontUnderlined(oldund);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
+ m_WParser->SetActualColor(oldclr);
+ m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(oldclr));
return TRUE;
}
if (content.Left(19) == _T("text/html; charset="))
{
wxFontEncoding enc =
- wxTheFontMapper -> CharsetToEncoding(content.Mid(19));
+ wxTheFontMapper->CharsetToEncoding(content.Mid(19));
if (enc == wxFONTENCODING_SYSTEM) return FALSE;
- if (enc == m_WParser -> GetInputEncoding()) return FALSE;
+ if (enc == m_WParser->GetInputEncoding()) return FALSE;
- m_WParser -> SetInputEncoding(enc);
- m_WParser -> GetContainer() -> InsertCell(
- new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser->SetInputEncoding(enc);
+ m_WParser->GetContainer()->InsertCell(
+ new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
}
}
return FALSE;
m_Width = m_Height = 0;
i = 0;
- while (tokenizer.HasMoreTokens()) {
+ while (tokenizer.HasMoreTokens())
+ {
if (i % 10 == 0) m_Text = (wxString**) realloc(m_Text, sizeof(wxString*) * (i + 10));
tmp = tokenizer.NextToken();
tmp.Replace(wxT("©"), wxT("(c)"), TRUE);
{
wxHtmlContainerCell *c;
- int fixed = m_WParser -> GetFontFixed(),
- italic = m_WParser -> GetFontItalic(),
- underlined = m_WParser -> GetFontUnderlined(),
- bold = m_WParser -> GetFontBold(),
- fsize = m_WParser -> GetFontSize();
+ int fixed = m_WParser->GetFontFixed(),
+ italic = m_WParser->GetFontItalic(),
+ underlined = m_WParser->GetFontUnderlined(),
+ bold = m_WParser->GetFontBold(),
+ fsize = m_WParser->GetFontSize();
- m_WParser -> CloseContainer();
- c = m_WParser -> OpenContainer();
- c -> SetAlignHor(wxHTML_ALIGN_LEFT);
- c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_VERTICAL);
+ m_WParser->CloseContainer();
+ c = m_WParser->OpenContainer();
+ c->SetAlignHor(wxHTML_ALIGN_LEFT);
+ c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_VERTICAL);
- m_WParser -> SetFontUnderlined(FALSE);
- m_WParser -> SetFontBold(FALSE);
- m_WParser -> SetFontItalic(FALSE);
- m_WParser -> SetFontFixed(TRUE);
- m_WParser -> SetFontSize(3);
- c -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser->SetFontUnderlined(FALSE);
+ m_WParser->SetFontBold(FALSE);
+ m_WParser->SetFontItalic(FALSE);
+ m_WParser->SetFontFixed(TRUE);
+ m_WParser->SetFontSize(3);
+ c->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
{
wxString cit;
- wxEncodingConverter *encconv = m_WParser -> GetEncodingConverter();
- cit = m_WParser -> GetSource() -> Mid(tag.GetBeginPos(),
+ wxEncodingConverter *encconv = m_WParser->GetEncodingConverter();
+ cit = m_WParser->GetSource()->Mid(tag.GetBeginPos(),
tag.GetEndPos1() - tag.GetBeginPos());
if (encconv)
- c -> InsertCell(new wxHtmlPRECell(encconv -> Convert(cit),
- *(m_WParser -> GetDC())));
+ c->InsertCell(new wxHtmlPRECell(encconv->Convert(cit),
+ *(m_WParser->GetDC())));
else
- c -> InsertCell(new wxHtmlPRECell(cit,
- *(m_WParser -> GetDC())));
+ c->InsertCell(new wxHtmlPRECell(cit,
+ *(m_WParser->GetDC())));
}
- m_WParser -> SetFontUnderlined(underlined);
- m_WParser -> SetFontBold(bold);
- m_WParser -> SetFontItalic(italic);
- m_WParser -> SetFontFixed(fixed);
- m_WParser -> SetFontSize(fsize);
- c -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
+ m_WParser->SetFontUnderlined(underlined);
+ m_WParser->SetFontBold(bold);
+ m_WParser->SetFontItalic(italic);
+ m_WParser->SetFontFixed(fixed);
+ m_WParser->SetFontSize(fsize);
+ c->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
- m_WParser -> CloseContainer();
- m_WParser -> OpenContainer();
+ m_WParser->CloseContainer();
+ m_WParser->OpenContainer();
return TRUE;
}
wxHtmlTableCell::~wxHtmlTableCell()
{
if (m_ColsInfo) free(m_ColsInfo);
- if (m_CellInfo) {
+ if (m_CellInfo)
+ {
for (int i = 0; i < m_NumRows; i++)
free(m_CellInfo[i]);
free(m_CellInfo);
{
int i,j;
- for (i = 0; i < m_NumRows; i++) {
+ for (i = 0; i < m_NumRows; i++)
+ {
m_CellInfo[i] = (cellStruct*) realloc(m_CellInfo[i], sizeof(cellStruct) * cols);
for (j = m_NumCols; j < cols; j++)
m_CellInfo[i][j].flag = cellFree;
}
m_ColsInfo = (colStruct*) realloc(m_ColsInfo, sizeof(colStruct) * cols);
- for (j = m_NumCols; j < cols; j++) {
+ for (j = m_NumCols; j < cols; j++)
+ {
m_ColsInfo[j].width = 0;
m_ColsInfo[j].units = wxHTML_UNITS_PERCENT;
}
void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
{
- do {
+ do
+ {
m_ActualCol++;
} while ((m_ActualCol < m_NumCols) && (m_CellInfo[m_ActualRow][m_ActualCol].flag != cellFree));
+
if (m_ActualCol > m_NumCols - 1)
ReallocCols(m_ActualCol + 1);
// width:
{
- if (tag.HasParam("WIDTH")) {
+ if (tag.HasParam("WIDTH"))
+ {
wxString wd = tag.GetParam("WIDTH");
- if (wd[wd.Length()-1] == '%') {
+ if (wd[wd.Length()-1] == '%')
+ {
wxSscanf(wd.c_str(), wxT("%i%%"), &m_ColsInfo[c].width);
m_ColsInfo[c].units = wxHTML_UNITS_PERCENT;
}
- else {
+ else
+ {
wxSscanf(wd.c_str(), wxT("%i"), &m_ColsInfo[c].width);
m_ColsInfo[c].width = (int)(m_PixelScale * (double)m_ColsInfo[c].width);
m_ColsInfo[c].units = wxHTML_UNITS_PIXELS;
{
if (tag.HasParam(wxT("COLSPAN"))) tag.ScanParam(wxT("COLSPAN"), wxT("%i"), &m_CellInfo[r][c].colspan);
if (tag.HasParam(wxT("ROWSPAN"))) tag.ScanParam(wxT("ROWSPAN"), wxT("%i"), &m_CellInfo[r][c].rowspan);
- if ((m_CellInfo[r][c].colspan != 1) || (m_CellInfo[r][c].rowspan != 1)) {
+ if ((m_CellInfo[r][c].colspan != 1) || (m_CellInfo[r][c].rowspan != 1))
+ {
int i, j;
if (r + m_CellInfo[r][c].rowspan > m_NumRows) ReallocRows(r + m_CellInfo[r][c].rowspan);
{
int bk = m_rBkg;
if (tag.HasParam(wxT("BGCOLOR"))) tag.ScanParam(wxT("BGCOLOR"), wxT("#%lX"), &bk);
- if (bk != -1) {
+ if (bk != -1)
+ {
wxColour clr = wxColour((bk & 0xFF0000) >> 16 , (bk & 0x00FF00) >> 8, (bk & 0x0000FF));
- cell -> SetBackgroundColour(clr);
+ cell->SetBackgroundColour(clr);
}
}
if (m_HasBorders)
- cell -> SetBorder(TABLE_BORDER_CLR_2, TABLE_BORDER_CLR_1);
+ cell->SetBorder(TABLE_BORDER_CLR_2, TABLE_BORDER_CLR_1);
// vertical alignment:
{
else m_CellInfo[r][c].valign = wxHTML_ALIGN_CENTER;
}
- cell -> SetIndent(m_Padding, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
+ cell->SetIndent(m_Padding, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
}
*/
- if (m_WidthFloatUnits == wxHTML_UNITS_PERCENT) {
+ if (m_WidthFloatUnits == wxHTML_UNITS_PERCENT)
+ {
if (m_WidthFloat < 0) m_Width = (100 + m_WidthFloat) * w / 100;
else m_Width = m_WidthFloat * w / 100;
}
- else {
+ else
+ {
if (m_WidthFloat < 0) m_Width = w + m_WidthFloat;
else m_Width = m_WidthFloat;
}
/* 2. compute positions of columns: */
{
int wpos = m_Spacing;
- for (int i = 0; i < m_NumCols; i++) {
+ for (int i = 0; i < m_NumCols; i++)
+ {
m_ColsInfo[i].leftpos = wpos;
wpos += m_ColsInfo[i].pixwidth + m_Spacing;
}
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:
for (int i = actcol; i < m_CellInfo[actrow][actcol].colspan + actcol; i++)
fullwid += m_ColsInfo[i].pixwidth;
fullwid += (m_CellInfo[actrow][actcol].colspan - 1) * m_Spacing;
- actcell -> SetMinHeight(m_CellInfo[actrow][actcol].minheight, m_CellInfo[actrow][actcol].valign);
- actcell -> Layout(fullwid);
+ actcell->SetMinHeight(m_CellInfo[actrow][actcol].minheight, m_CellInfo[actrow][actcol].valign);
+ actcell->Layout(fullwid);
- if (ypos[actrow] + actcell -> GetHeight() + m_CellInfo[actrow][actcol].rowspan * m_Spacing > ypos[actrow + m_CellInfo[actrow][actcol].rowspan])
+ if (ypos[actrow] + actcell->GetHeight() + m_CellInfo[actrow][actcol].rowspan * m_Spacing > ypos[actrow + m_CellInfo[actrow][actcol].rowspan])
ypos[actrow + m_CellInfo[actrow][actcol].rowspan] =
- ypos[actrow] + actcell -> GetHeight() + m_CellInfo[actrow][actcol].rowspan * m_Spacing;
+ ypos[actrow] + actcell->GetHeight() + m_CellInfo[actrow][actcol].rowspan * m_Spacing;
}
}
- for (actrow = 0; actrow < m_NumRows; actrow++) {
+ for (actrow = 0; actrow < m_NumRows; actrow++)
+ {
// 3b. place cells in row & let'em all have same height:
- for (actcol = 0; actcol < m_NumCols; actcol++) {
+ for (actcol = 0; actcol < m_NumCols; actcol++)
+ {
if (m_CellInfo[actrow][actcol].flag != cellUsed) continue;
actcell = m_CellInfo[actrow][actcol].cont;
- actcell -> SetMinHeight(
+ actcell->SetMinHeight(
ypos[actrow + m_CellInfo[actrow][actcol].rowspan] - ypos[actrow] - m_Spacing,
m_CellInfo[actrow][actcol].valign);
fullwid = 0;
for (int i = actcol; i < m_CellInfo[actrow][actcol].colspan + actcol; i++)
fullwid += m_ColsInfo[i].pixwidth;
fullwid += (m_CellInfo[actrow][actcol].colspan - 1) * m_Spacing;
- actcell -> Layout(fullwid);
- actcell -> SetPos(m_ColsInfo[actcol].leftpos, ypos[actrow]);
+ actcell->Layout(fullwid);
+ actcell->SetPos(m_ColsInfo[actcol].leftpos, ypos[actrow]);
}
}
wxHtmlContainerCell *c;
// new table started, backup upper-level table (if any) and create new:
- if (tag.GetName() == wxT("TABLE")) {
+ if (tag.GetName() == wxT("TABLE"))
+ {
wxHtmlTableCell *oldt = m_Table;
wxHtmlContainerCell *oldcont;
int m_OldAlign;
- oldcont = c = m_WParser -> OpenContainer();
+ oldcont = c = m_WParser->OpenContainer();
- c -> SetWidthFloat(tag, m_WParser -> GetPixelScale());
- m_Table = new wxHtmlTableCell(c, tag, m_WParser -> GetPixelScale());
- m_OldAlign = m_WParser -> GetAlign();
+ c->SetWidthFloat(tag, m_WParser->GetPixelScale());
+ m_Table = new wxHtmlTableCell(c, tag, m_WParser->GetPixelScale());
+ m_OldAlign = m_WParser->GetAlign();
m_tAlign = wxEmptyString;
if (tag.HasParam(wxT("ALIGN"))) m_tAlign = tag.GetParam(wxT("ALIGN"));
ParseInner(tag);
- m_WParser -> SetAlign(m_OldAlign);
- m_WParser -> SetContainer(oldcont);
- m_WParser -> CloseContainer();
+ m_WParser->SetAlign(m_OldAlign);
+ m_WParser->SetContainer(oldcont);
+ m_WParser->CloseContainer();
m_Table = oldt;
return TRUE;
}
- else if (m_Table && !tag.IsEnding()) {
+ else if (m_Table && !tag.IsEnding())
+ {
// new row in table
- if (tag.GetName() == wxT("TR")) {
- m_Table -> AddRow(tag);
+ if (tag.GetName() == wxT("TR"))
+ {
+ m_Table->AddRow(tag);
m_rAlign = m_tAlign;
if (tag.HasParam(wxT("ALIGN"))) m_rAlign = tag.GetParam(wxT("ALIGN"));
}
// new cell
- else {
- m_WParser -> SetAlign(m_OldAlign);
- c = m_WParser -> SetContainer(new wxHtmlContainerCell(m_Table));
- m_Table -> AddCell(c, tag);
+ else
+ {
+ m_WParser->SetAlign(m_OldAlign);
+ c = m_WParser->SetContainer(new wxHtmlContainerCell(m_Table));
+ m_Table->AddCell(c, tag);
- m_WParser -> OpenContainer();
+ m_WParser->OpenContainer();
- if (tag.GetName() == wxT("TH")) /*header style*/ {
- m_WParser -> SetAlign(wxHTML_ALIGN_CENTER);
+ if (tag.GetName() == wxT("TH")) /*header style*/
+ {
+ m_WParser->SetAlign(wxHTML_ALIGN_CENTER);
}
{
als = m_rAlign;
if (tag.HasParam(wxT("ALIGN"))) als = tag.GetParam(wxT("ALIGN"));
als.MakeUpper();
- if (als == wxT("RIGHT")) m_WParser -> SetAlign(wxHTML_ALIGN_RIGHT);
- else if (als == wxT("CENTER")) m_WParser -> SetAlign(wxHTML_ALIGN_CENTER);
+ if (als == wxT("RIGHT")) m_WParser->SetAlign(wxHTML_ALIGN_RIGHT);
+ else if (als == wxT("CENTER")) m_WParser->SetAlign(wxHTML_ALIGN_CENTER);
}
- m_WParser -> OpenContainer();
+ m_WParser->OpenContainer();
}
}
return FALSE;
for (j = 0; j < 2; j++)
for (k = 0; k < 2; k++)
for (l = 0; l < 2; l++)
- for (m = 0; m < 7; m++) {
+ for (m = 0; m < 7; m++)
+ {
m_FontsTable[i][j][k][l][m] = NULL;
m_FontsFacesTable[i][j][k][l][m] = wxEmptyString;
m_FontsEncTable[i][j][k][l][m] = wxFONTENCODING_DEFAULT;
// fill in wxHtmlParser's tables:
wxNode *node = m_Modules.GetFirst();
- while (node) {
- wxHtmlTagsModule *mod = (wxHtmlTagsModule*) node -> GetData();
- mod -> FillHandlersTable(this);
- node = node -> GetNext();
+ while (node)
+ {
+ wxHtmlTagsModule *mod = (wxHtmlTagsModule*) node->GetData();
+ mod->FillHandlersTable(this);
+ node = node->GetNext();
}
}
for (j = 0; j < 2; j++)
for (k = 0; k < 2; k++)
for (l = 0; l < 2; l++)
- for (m = 0; m < 7; m++) {
+ for (m = 0; m < 7; m++)
+ {
if (m_FontsTable[i][j][k][l][m] != NULL)
delete m_FontsTable[i][j][k][l][m];
}
for (k = 0; k < 2; k++)
for (l = 0; l < 2; l++)
for (m = 0; m < 7; m++) {
- if (m_FontsTable[i][j][k][l][m] != NULL) {
+ if (m_FontsTable[i][j][k][l][m] != NULL)
+ {
delete m_FontsTable[i][j][k][l][m];
m_FontsTable[i][j][k][l][m] = NULL;
}
m_FontBold = m_FontItalic = m_FontUnderlined = m_FontFixed = FALSE;
m_FontSize = 3; //default one
CreateCurrentFont(); // we're selecting default font into
- m_DC -> GetTextExtent("H", &m_CharWidth, &m_CharHeight);
+ m_DC->GetTextExtent("H", &m_CharWidth, &m_CharHeight);
/* NOTE : we're not using GetCharWidth/Height() because
of differences under X and win
*/
OpenContainer();
OpenContainer();
- m_Container -> InsertCell(new wxHtmlColourCell(m_ActualColor));
- m_Container -> InsertCell(new wxHtmlFontCell(CreateCurrentFont()));
+ m_Container->InsertCell(new wxHtmlColourCell(m_ActualColor));
+ m_Container->InsertCell(new wxHtmlFontCell(CreateCurrentFont()));
}
OpenContainer();
top = m_Container;
- while (top -> GetParent()) top = top -> GetParent();
+ while (top->GetParent()) top = top->GetParent();
return top;
}
register char d;
int templen = 0;
- if (m_tmpLastWasSpace) {
+ if (m_tmpLastWasSpace)
+ {
while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') || (txt[i] == '\t'))) i++;
}
- while (i < lng) {
+ while (i < lng)
+ {
x = 0;
d = temp[templen++] = txt[i];
- if ((d == '\n') || (d == '\r') || (d == ' ') || (d == '\t')) {
+ if ((d == '\n') || (d == '\r') || (d == ' ') || (d == '\t'))
+ {
i++, x++;
while ((i < lng) && ((txt[i] == '\n') || (txt[i] == '\r') || (txt[i] == ' ') || (txt[i] == '\t'))) i++, x++;
}
else i++;
- if (x) {
+ if (x)
+ {
temp[templen-1] = ' ';
temp[templen] = 0;
templen = 0;
- if (m_EncConv) m_EncConv -> Convert(temp);
+ if (m_EncConv) m_EncConv->Convert(temp);
c = new wxHtmlWordCell(temp, *(GetDC()));
- if (m_UseLink) c -> SetLink(m_Link);
- m_Container -> InsertCell(c);
+ if (m_UseLink) c->SetLink(m_Link);
+ m_Container->InsertCell(c);
m_tmpLastWasSpace = TRUE;
}
}
- if (templen) {
+ if (templen)
+ {
temp[templen] = 0;
- if (m_EncConv) m_EncConv -> Convert(temp);
+ if (m_EncConv) m_EncConv->Convert(temp);
c = new wxHtmlWordCell(temp, *(GetDC()));
- if (m_UseLink) c -> SetLink(m_Link);
- m_Container -> InsertCell(c);
+ if (m_UseLink) c->SetLink(m_Link);
+ m_Container->InsertCell(c);
m_tmpLastWasSpace = FALSE;
}
}
wxHtmlContainerCell* wxHtmlWinParser::OpenContainer()
{
m_Container = new wxHtmlContainerCell(m_Container);
- m_Container -> SetAlignHor(m_Align);
+ m_Container->SetAlignHor(m_Align);
m_tmpLastWasSpace = TRUE;
/* to avoid space being first character in paragraph */
return m_Container;
wxHtmlContainerCell* wxHtmlWinParser::CloseContainer()
{
- m_Container = m_Container -> GetParent();
+ m_Container = m_Container->GetParent();
return m_Container;
}
wxFont **fontptr = &(m_FontsTable[fb][fi][fu][ff][fs]);
wxFontEncoding *encptr = &(m_FontsEncTable[fb][fi][fu][ff][fs]);
- if (*fontptr != NULL && (*faceptr != face || *encptr != m_OutputEnc)) {
+ if (*fontptr != NULL && (*faceptr != face || *encptr != m_OutputEnc))
+ {
delete *fontptr;
*fontptr = NULL;
}
- if (*fontptr == NULL) {
+ if (*fontptr == NULL)
+ {
*faceptr = face;
*encptr = m_OutputEnc;
*fontptr = new wxFont(
fu ? TRUE : FALSE, face,
m_OutputEnc);
}
- m_DC -> SetFont(**fontptr);
+ m_DC->SetFont(**fontptr);
return (*fontptr);
}
bool availfix, availnorm;
// exact match?
- availnorm = wxTheFontMapper -> IsEncodingAvailable(enc, m_FontFaceNormal);
- availfix = wxTheFontMapper -> IsEncodingAvailable(enc, m_FontFaceFixed);
+ availnorm = wxTheFontMapper->IsEncodingAvailable(enc, m_FontFaceNormal);
+ availfix = wxTheFontMapper->IsEncodingAvailable(enc, m_FontFaceFixed);
if (availnorm && availfix)
m_OutputEnc = enc;
// alternatives?
- else if (wxTheFontMapper -> GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, FALSE) &&
- wxTheFontMapper -> GetAltForEncoding(enc, &altfix, m_FontFaceFixed, FALSE) &&
+ else if (wxTheFontMapper->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, FALSE) &&
+ wxTheFontMapper->GetAltForEncoding(enc, &altfix, m_FontFaceFixed, FALSE) &&
altnorm == altfix)
m_OutputEnc = altnorm;
// at least normal face?
else if (availnorm)
m_OutputEnc = enc;
- else if (wxTheFontMapper -> GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, FALSE))
+ else if (wxTheFontMapper->GetAltForEncoding(enc, &altnorm, m_FontFaceNormal, FALSE))
m_OutputEnc = altnorm;
// okay, let convert to ISO_8859-1, available always
if (m_InputEnc == m_OutputEnc) return;
m_EncConv = new wxEncodingConverter();
- if (!m_EncConv -> Init(m_InputEnc,
+ if (!m_EncConv->Init(m_InputEnc,
(m_OutputEnc == wxFONTENCODING_DEFAULT) ?
wxFONTENCODING_ISO8859_1 : m_OutputEnc,
wxCONVERT_SUBSTITUTE))