WX_DECLARE_EXPORTED_OBJARRAY(wxHtmlBookRecord, wxHtmlBookRecArray);
-
typedef struct
{
short int m_Level;
// 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(HTML_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, bool left, bool middle, bool right);
void SetAlignVer(int al) {m_AlignVer = al;}
// sets horizontal/vertical alignment
int GetAlignVer() const {return m_AlignVer;}
- void SetIndent(int i, int what, int units = HTML_UNITS_PIXELS);
- // sets left-border indentation. units is one of HTML_UNITS_* constants
- // what is combination of HTML_INDENT_*
+ void SetIndent(int i, int what, int units = wxHTML_UNITS_PIXELS);
+ // sets left-border indentation. units is one of wxHTML_UNITS_* constants
+ // what is combination of wxHTML_INDENT_*
int GetIndent(int ind) const;
- // returns the indentation. ind is one of HTML_INDENT_* constants
+ // returns the indentation. ind is one of wxHTML_INDENT_* constants
int GetIndentUnits(int ind) const;
// returns type of value returned by GetIndent(ind)
void SetAlign(const wxHtmlTag& tag);
// sets floating width adjustment
// (examples : 32 percent of parent container,
// -15 pixels percent (this means 100 % - 15 pixels)
- void SetMinHeight(int h, int align = HTML_ALIGN_TOP) {m_MinHeight = h; m_MinHeightAlign = align;}
+ void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP) {m_MinHeight = h; m_MinHeightAlign = align;}
// sets minimal height of this container.
int GetMaxLineWidth() const {return m_MaxLineWidth;}
// returns maximal line width in this container.
wxColour m_Colour;
unsigned m_Flags;
- wxHtmlColourCell(wxColour clr, int flags = HTML_CLR_FOREGROUND) : wxHtmlCell() {m_Colour = clr; m_Flags = flags;}
+ wxHtmlColourCell(wxColour clr, int flags = wxHTML_CLR_FOREGROUND) : wxHtmlCell() {m_Colour = clr; m_Flags = flags;}
virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
virtual void DrawInvisible(wxDC& dc, int x, int y);
};
// Describes alignment of text etc. in containers
//--------------------------------------------------------------------------------
-#define HTML_ALIGN_LEFT 0x0000
-#define HTML_ALIGN_RIGHT 0x0002
+#define wxHTML_ALIGN_LEFT 0x0000
+#define wxHTML_ALIGN_RIGHT 0x0002
-#define HTML_ALIGN_TOP 0x0004
-#define HTML_ALIGN_BOTTOM 0x0008
+#define wxHTML_ALIGN_TOP 0x0004
+#define wxHTML_ALIGN_BOTTOM 0x0008
-#define HTML_ALIGN_CENTER 0x0001
+#define wxHTML_ALIGN_CENTER 0x0001
// Used by wxHtmlColourCell to determine clr of what is changing
//--------------------------------------------------------------------------------
-#define HTML_CLR_FOREGROUND 0x0001
-#define HTML_CLR_BACKGROUND 0x0002
+#define wxHTML_CLR_FOREGROUND 0x0001
+#define wxHTML_CLR_BACKGROUND 0x0002
// Used to specify units
//--------------------------------------------------------------------------------
-#define HTML_UNITS_PIXELS 0x0001
-#define HTML_UNITS_PERCENT 0x0002
+#define wxHTML_UNITS_PIXELS 0x0001
+#define wxHTML_UNITS_PERCENT 0x0002
// Used to specify indetation relatives
//--------------------------------------------------------------------------------
-#define HTML_INDENT_LEFT 0x0010
-#define HTML_INDENT_RIGHT 0x0020
-#define HTML_INDENT_TOP 0x0040
-#define HTML_INDENT_BOTTOM 0x0080
+#define wxHTML_INDENT_LEFT 0x0010
+#define wxHTML_INDENT_RIGHT 0x0020
+#define wxHTML_INDENT_TOP 0x0040
+#define wxHTML_INDENT_BOTTOM 0x0080
-#define HTML_INDENT_HORIZONTAL HTML_INDENT_LEFT | HTML_INDENT_RIGHT
-#define HTML_INDENT_VERTICAL HTML_INDENT_TOP | HTML_INDENT_BOTTOM
-#define HTML_INDENT_ALL HTML_INDENT_VERTICAL | HTML_INDENT_HORIZONTAL
+#define wxHTML_INDENT_HORIZONTAL wxHTML_INDENT_LEFT | wxHTML_INDENT_RIGHT
+#define wxHTML_INDENT_VERTICAL wxHTML_INDENT_TOP | wxHTML_INDENT_BOTTOM
+#define wxHTML_INDENT_ALL wxHTML_INDENT_VERTICAL | wxHTML_INDENT_HORIZONTAL
// Identifiers of wxHtmlCell's Find() conditions
//--------------------------------------------------------------------------------
-#define HTML_COND_ISANCHOR 1
+#define wxHTML_COND_ISANCHOR 1
// Finds the anchor of 'param' name (pointer to wxString).
-#define HTML_COND_ISIMAGEMAP 2
+#define wxHTML_COND_ISIMAGEMAP 2
// Finds imagemap of 'param' name (pointer to wxString).
// (used exclusively by m_image.cpp)
-#define HTML_COND_USER 10000
+#define wxHTML_COND_USER 10000
// User-defined conditions should start from this number
// wxHTML internal constants
//--------------------------------------------------------------------------------
-#define HTML_SCROLL_STEP 16
+#define wxHTML_SCROLL_STEP 16
/* size of one scroll step of wxHtmlWindow in pixels */
-#define HTML_BUFLEN 1024
+#define wxHTML_BUFLEN 1024
/* size of temporary buffer used during parsing */
-#define HTML_REALLOC_STEP 32
+#define wxHTML_REALLOC_STEP 32
/* steps of array reallocation */
-#define HTML_PRINT_MAX_PAGES 999
+#define wxHTML_PRINT_MAX_PAGES 999
/* maximum number of pages printable via html printing */
+
+
+
+
+
+
+
+#if WXWIN_COMPATIBILITY_2
+
+#define HTML_ALIGN_LEFT wxHTML_ALIGN_LEFT
+#define HTML_ALIGN_RIGHT wxHTML_ALIGN_RIGHT
+#define HTML_ALIGN_TOP wxHTML_ALIGN_TOP
+#define HTML_ALIGN_BOTTOM wxHTML_ALIGN_BOTTOM
+#define HTML_ALIGN_CENTER wxHTML_ALIGN_CENTER
+#define HTML_CLR_FOREGROUND wxHTML_CLR_FOREGROUND
+#define HTML_CLR_BACKGROUND wxHTML_CLR_BACKGROUND
+#define HTML_UNITS_PIXELS wxHTML_UNITS_PIXELS
+#define HTML_UNITS_PERCENT wxHTML_UNITS_PERCENT
+#define HTML_INDENT_LEFT wxHTML_INDENT_LEFT
+#define HTML_INDENT_RIGHT wxHTML_INDENT_RIGHT
+#define HTML_INDENT_TOP wxHTML_INDENT_TOP
+#define HTML_INDENT_BOTTOM wxHTML_INDENT_BOTTOM
+#define HTML_INDENT_HORIZONTAL wxHTML_INDENT_HORIZONTAL
+#define HTML_INDENT_VERTICAL wxHTML_INDENT_VERTICAL
+#define HTML_INDENT_ALL wxHTML_INDENT_ALL
+#define HTML_COND_ISANCHOR wxHTML_COND_ISANCHOR
+#define HTML_COND_ISIMAGEMAP wxHTML_COND_ISIMAGEMAP
+#define HTML_COND_USER wxHTML_COND_USER
+
+#endif
+
+
+
#endif
#endif
bool OnPrintPage(int page);
bool HasPage(int page);
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
- bool OnBeginDocument(int start, int end);
+ void OnBeginPrinting();
private:
private:
int m_NumPages;
- int m_PageBreaks[HTML_PRINT_MAX_PAGES];
+ int m_PageBreaks[wxHTML_PRINT_MAX_PAGES];
wxString m_Document, m_BasePath;
bool m_BasePathIsDir;
m_Name = m_Page = wxEmptyString;
ParseInner(tag);
if (m_Page != wxEmptyString) {
- if (m_ItemsCnt % HTML_REALLOC_STEP == 0)
- m_Items = (wxHtmlContentsItem*) realloc(m_Items, (m_ItemsCnt + HTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem));
+ if (m_ItemsCnt % wxHTML_REALLOC_STEP == 0)
+ m_Items = (wxHtmlContentsItem*) realloc(m_Items, (m_ItemsCnt + wxHTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem));
m_Items[m_ItemsCnt].m_Level = m_Level;
m_Items[m_ItemsCnt].m_ID = m_ID;
m_Items[m_ItemsCnt].m_Page = new char[m_Page.Length() + 1];
f -> Read(&x, sizeof(x));
st = m_ContentsCnt;
m_ContentsCnt += x;
- m_Contents = (wxHtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt / HTML_REALLOC_STEP + 1) * HTML_REALLOC_STEP * sizeof(wxHtmlContentsItem));
+ 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));
m_Contents[i].m_Level = x;
f -> Read(&x, sizeof(x));
st = m_IndexCnt;
m_IndexCnt += x;
- m_Index = (wxHtmlContentsItem*) realloc(m_Index, (m_IndexCnt / HTML_REALLOC_STEP + 1) * HTML_REALLOC_STEP * sizeof(wxHtmlContentsItem));
+ 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));
m_Index[i].m_Name = new char[x];
bookr = new wxHtmlBookRecord(path+'/', title, deftopic);
- if (m_ContentsCnt % HTML_REALLOC_STEP == 0)
- m_Contents = (wxHtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt + HTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem));
+ if (m_ContentsCnt % wxHTML_REALLOC_STEP == 0)
+ m_Contents = (wxHtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt + wxHTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem));
m_Contents[m_ContentsCnt].m_Level = 0;
m_Contents[m_ContentsCnt].m_ID = 0;
m_Contents[m_ContentsCnt].m_Page = new char[deftopic.Length() + 1];
m_Cells = m_LastCell = NULL;
m_Parent = parent;
if (m_Parent) m_Parent -> InsertCell(this);
- m_AlignHor = HTML_ALIGN_LEFT;
- m_AlignVer = HTML_ALIGN_BOTTOM;
+ m_AlignHor = wxHTML_ALIGN_LEFT;
+ m_AlignVer = wxHTML_ALIGN_BOTTOM;
m_IndentLeft = m_IndentRight = m_IndentTop = m_IndentBottom = 0;
- m_WidthFloat = 100; m_WidthFloatUnits = HTML_UNITS_PERCENT;
+ m_WidthFloat = 100; m_WidthFloatUnits = wxHTML_UNITS_PERCENT;
m_UseBkColour = FALSE;
m_UseBorder = FALSE;
m_MinHeight = m_MaxLineWidth = 0;
- m_MinHeightAlign = HTML_ALIGN_TOP;
+ m_MinHeightAlign = wxHTML_ALIGN_TOP;
}
void wxHtmlContainerCell::SetIndent(int i, int what, int units)
{
- int val = (units == HTML_UNITS_PIXELS) ? i : -i;
- if (what & HTML_INDENT_LEFT) m_IndentLeft = val;
- if (what & HTML_INDENT_RIGHT) m_IndentRight = val;
- if (what & HTML_INDENT_TOP) m_IndentTop = val;
- if (what & HTML_INDENT_BOTTOM) m_IndentBottom = val;
+ int val = (units == wxHTML_UNITS_PIXELS) ? i : -i;
+ if (what & wxHTML_INDENT_LEFT) m_IndentLeft = val;
+ if (what & wxHTML_INDENT_RIGHT) m_IndentRight = val;
+ if (what & wxHTML_INDENT_TOP) m_IndentTop = val;
+ if (what & wxHTML_INDENT_BOTTOM) m_IndentBottom = val;
}
int wxHtmlContainerCell::GetIndent(int ind) const
{
- if (ind & HTML_INDENT_LEFT) return m_IndentLeft;
- else if (ind & HTML_INDENT_RIGHT) return m_IndentRight;
- else if (ind & HTML_INDENT_TOP) return m_IndentTop;
- else if (ind & HTML_INDENT_BOTTOM) return m_IndentBottom;
+ if (ind & wxHTML_INDENT_LEFT) return m_IndentLeft;
+ else if (ind & wxHTML_INDENT_RIGHT) return m_IndentRight;
+ else if (ind & wxHTML_INDENT_TOP) return m_IndentTop;
+ else if (ind & wxHTML_INDENT_BOTTOM) return m_IndentBottom;
else return -1; /* BUG! Should not be called... */
}
int wxHtmlContainerCell::GetIndentUnits(int ind) const
{
bool p = FALSE;
- if (ind & HTML_INDENT_LEFT) p = m_IndentLeft < 0;
- else if (ind & HTML_INDENT_RIGHT) p = m_IndentRight < 0;
- else if (ind & HTML_INDENT_TOP) p = m_IndentTop < 0;
- else if (ind & HTML_INDENT_BOTTOM) p = m_IndentBottom < 0;
- if (p) return HTML_UNITS_PERCENT;
- else return HTML_UNITS_PIXELS;
+ if (ind & wxHTML_INDENT_LEFT) p = m_IndentLeft < 0;
+ else if (ind & wxHTML_INDENT_RIGHT) p = m_IndentRight < 0;
+ else if (ind & wxHTML_INDENT_TOP) p = m_IndentTop < 0;
+ else if (ind & wxHTML_INDENT_BOTTOM) p = m_IndentBottom < 0;
+ if (p) return wxHTML_UNITS_PERCENT;
+ else return wxHTML_UNITS_PIXELS;
}
*/
- if (m_WidthFloatUnits == HTML_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;
}
// my own layouting:
while (cell != NULL) {
switch (m_AlignVer) {
- case HTML_ALIGN_TOP : ybasicpos = 0; break;
- case HTML_ALIGN_BOTTOM : ybasicpos = - cell -> GetHeight(); break;
- case HTML_ALIGN_CENTER : ybasicpos = - cell -> GetHeight() / 2; break;
+ case wxHTML_ALIGN_TOP : ybasicpos = 0; break;
+ case wxHTML_ALIGN_BOTTOM : ybasicpos = - cell -> GetHeight(); break;
+ case wxHTML_ALIGN_CENTER : ybasicpos = - cell -> GetHeight() / 2; break;
}
ydiff = cell -> GetHeight() + ybasicpos;
if (ysizeup < 0) ysizeup = 0;
if (ysizedown < 0) ysizedown = 0;
switch (m_AlignHor) {
- case HTML_ALIGN_LEFT : xdelta = 0; break;
- case HTML_ALIGN_RIGHT : xdelta = 0 + (s_width - xpos); break;
- case HTML_ALIGN_CENTER : xdelta = 0 + (s_width - xpos) / 2; break;
+ case wxHTML_ALIGN_LEFT : xdelta = 0; break;
+ case wxHTML_ALIGN_RIGHT : xdelta = 0 + (s_width - xpos); break;
+ case wxHTML_ALIGN_CENTER : xdelta = 0 + (s_width - xpos) / 2; break;
}
if (xdelta < 0) xdelta = 0;
xdelta += s_indent;
m_Height = ypos + (ysizedown + ysizeup) + m_IndentBottom;
if (m_Height < m_MinHeight) {
- if (m_MinHeightAlign != HTML_ALIGN_TOP) {
+ if (m_MinHeightAlign != wxHTML_ALIGN_TOP) {
int diff = m_MinHeight - m_Height;
- if (m_MinHeightAlign == HTML_ALIGN_CENTER) diff /= 2;
+ if (m_MinHeightAlign == wxHTML_ALIGN_CENTER) diff /= 2;
cell = m_Cells;
while (cell) {
cell -> SetPos(cell -> GetPosX(), cell -> GetPosY() + diff);
wxString alg = tag.GetParam("ALIGN");
alg.MakeUpper();
if (alg == "CENTER")
- SetAlignHor(HTML_ALIGN_CENTER);
+ SetAlignHor(wxHTML_ALIGN_CENTER);
else if (alg == "LEFT")
- SetAlignHor(HTML_ALIGN_LEFT);
+ SetAlignHor(wxHTML_ALIGN_LEFT);
else if (alg == "RIGHT")
- SetAlignHor(HTML_ALIGN_RIGHT);
+ SetAlignHor(wxHTML_ALIGN_RIGHT);
}
}
if (wd[wd.Length()-1] == '%') {
sscanf(wd.c_str(), "%i%%", &wdi);
- SetWidthFloat(wdi, HTML_UNITS_PERCENT);
+ SetWidthFloat(wdi, wxHTML_UNITS_PERCENT);
}
else {
sscanf(wd.c_str(), "%i", &wdi);
- SetWidthFloat(wdi, HTML_UNITS_PIXELS);
+ SetWidthFloat(wdi, wxHTML_UNITS_PIXELS);
}
}
}
void wxHtmlColourCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
{
- if (m_Flags & HTML_CLR_FOREGROUND)
+ if (m_Flags & wxHTML_CLR_FOREGROUND)
dc.SetTextForeground(m_Colour);
- if (m_Flags & HTML_CLR_BACKGROUND) {
+ if (m_Flags & wxHTML_CLR_BACKGROUND) {
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
dc.SetTextBackground(m_Colour);
}
void wxHtmlColourCell::DrawInvisible(wxDC& dc, int x, int y)
{
- if (m_Flags & HTML_CLR_FOREGROUND)
+ if (m_Flags & wxHTML_CLR_FOREGROUND)
dc.SetTextForeground(m_Colour);
- if (m_Flags & HTML_CLR_BACKGROUND) {
+ if (m_Flags & wxHTML_CLR_BACKGROUND) {
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
dc.SetTextBackground(m_Colour);
}
}
((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty);
- m_Wnd -> SetSize(absx - HTML_SCROLL_STEP * stx, absy - HTML_SCROLL_STEP * sty, m_Width, m_Height);
+ 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);
}
}
((wxScrolledWindow*)(m_Wnd -> GetParent())) -> ViewStart(&stx, &sty);
- m_Wnd -> SetSize(absx - HTML_SCROLL_STEP * stx, absy - HTML_SCROLL_STEP * sty, m_Width, m_Height);
+ m_Wnd -> SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
wxHtmlCell::DrawInvisible(dc, x, y);
}
-#define HTML_MAX_BUFLEN 1024
+#define wxHTML_MAX_BUFLEN 1024
void wxHtmlParser::DoParsing(int begin_pos, int end_pos)
{
- char temp[HTML_BUFLEN], c;
+ char temp[wxHTML_BUFLEN], c;
int i;
int templen;
// continue building word:
if (c != '<') {
temp[templen++] = c;
- if (templen == HTML_BUFLEN-1) {
+ if (templen == wxHTML_BUFLEN-1) {
temp[templen] = 0;
AddText(temp);
templen = 0;
}
m_Cell = (wxHtmlContainerCell*) m_Parser -> Parse(source);
delete dc;
- m_Cell -> SetIndent(m_Borders, HTML_INDENT_ALL, HTML_UNITS_PIXELS);
- m_Cell -> SetAlignHor(HTML_ALIGN_CENTER);
+ m_Cell -> SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
+ m_Cell -> SetAlignHor(wxHTML_ALIGN_CENTER);
CreateLayout();
Refresh();
return TRUE;
bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor)
{
- const wxHtmlCell *c = m_Cell -> Find(HTML_COND_ISANCHOR, &anchor);
+ const wxHtmlCell *c = m_Cell -> Find(wxHTML_COND_ISANCHOR, &anchor);
if (!c) return FALSE;
else {
int y;
for (y = 0; c != NULL; c = c -> GetParent()) y += c -> GetPosY();
- Scroll(-1, y / HTML_SCROLL_STEP);
+ Scroll(-1, y / wxHTML_SCROLL_STEP);
m_OpenedAnchor = anchor;
return TRUE;
}
GetClientSize(&ClientWidth, &ClientHeight);
m_Cell -> Layout(ClientWidth);
if (ClientHeight < m_Cell -> GetHeight()) {
- SetScrollbars(HTML_SCROLL_STEP, HTML_SCROLL_STEP,
- m_Cell -> GetWidth() / HTML_SCROLL_STEP,
- m_Cell -> GetHeight() / HTML_SCROLL_STEP
+ SetScrollbars(wxHTML_SCROLL_STEP, wxHTML_SCROLL_STEP,
+ m_Cell -> GetWidth() / wxHTML_SCROLL_STEP,
+ m_Cell -> GetHeight() / wxHTML_SCROLL_STEP
/*cheat: top-level frag is always container*/);
}
else { /* we fit into window, no need for scrollbars */
while (upd) {
v_y = upd.GetY();
v_h = upd.GetH();
- if (m_Cell) m_Cell -> Draw(dc, 0, 0, y * HTML_SCROLL_STEP + v_y, y * HTML_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++;
}
}
int sty, szy, cliy;
ViewStart(&dummy, &sty);
- GetClientSize(&dummy, &cliy); cliy /= HTML_SCROLL_STEP;
- GetVirtualSize(&dummy, &szy); szy /= HTML_SCROLL_STEP;
+ GetClientSize(&dummy, &cliy); cliy /= wxHTML_SCROLL_STEP;
+ GetVirtualSize(&dummy, &szy); szy /= wxHTML_SCROLL_STEP;
switch (event.KeyCode()) {
case WXK_PAGEUP :
wxPoint pos;
wxString lnk;
- ViewStart(&sx, &sy); sx *= HTML_SCROLL_STEP; sy *= HTML_SCROLL_STEP;
+ ViewStart(&sx, &sy); sx *= wxHTML_SCROLL_STEP; sy *= wxHTML_SCROLL_STEP;
pos = event.GetPosition();
if (m_Cell)
int x, y;
wxString lnk;
- ViewStart(&sx, &sy); sx *= HTML_SCROLL_STEP; sy *= HTML_SCROLL_STEP;
+ 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);
m_FS -> ChangePathTo(basepath, isdir);
m_DC -> SetUserScale(1.0, 1.0);
m_Cells = (wxHtmlContainerCell*) m_Parser -> Parse(html);
- m_Cells -> SetIndent(0, HTML_INDENT_ALL, HTML_UNITS_PIXELS);
+ m_Cells -> SetIndent(0, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
m_Cells -> Layout(m_Width);
}
{
m_Renderer = new wxHtmlDCRenderer;
m_RendererHdr = new wxHtmlDCRenderer;
- m_NumPages = HTML_PRINT_MAX_PAGES;
+ m_NumPages = wxHTML_PRINT_MAX_PAGES;
m_Document = m_BasePath = wxEmptyString; m_BasePathIsDir = TRUE;
m_Headers[0] = m_Headers[1] = wxEmptyString;
m_Footers[0] = m_Footers[1] = wxEmptyString;
-bool wxHtmlPrintout::OnBeginDocument(int start, int end)
+void wxHtmlPrintout::OnBeginPrinting()
{
int pageWidth, pageHeight, mm_w, mm_h;
float ppmm_h, ppmm_v;
- if (!wxPrintout::OnBeginDocument(start, end)) return FALSE;
+ wxPrintout::OnBeginPrinting();
GetPageSizePixels(&pageWidth, &pageHeight);
GetPageSizeMM(&mm_w, &mm_h);
);
m_Renderer -> SetHtmlText(m_Document, m_BasePath, m_BasePathIsDir);
CountPages();
-
- return TRUE;
}
void wxHtmlPrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo)
{
*minPage = 1;
- *maxPage = HTML_PRINT_MAX_PAGES;
+ *maxPage = wxHTML_PRINT_MAX_PAGES;
*selPageFrom = 1;
- *selPageTo = 1;
+ *selPageTo = wxHTML_PRINT_MAX_PAGES;
}
else {
wxPreviewFrame *frame = new wxPreviewFrame(preview, m_Frame,
m_Name + _(" Preview"),
- wxPoint(100, 100), wxSize(500, 500));
+ wxPoint(100, 100), wxSize(650, 500));
frame -> Centre(wxBOTH);
frame -> Initialize();
frame -> Show(TRUE);
c -> SetAlign(tag);
c -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont()));
- c -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_TOP);
+ c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_TOP);
m_WParser -> SetAlign(c -> GetAlignHor());
ParseInner(tag);
m_WParser -> CloseContainer();
m_WParser -> OpenContainer();
c = m_WParser -> GetContainer();
- c -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_TOP);
+ c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_TOP);
return TRUE;
}
m_WParser -> CloseContainer();
c = m_WParser -> OpenContainer();
- c -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_VERTICAL);
- c -> SetAlignHor(HTML_ALIGN_CENTER);
+ c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_VERTICAL);
+ c -> SetAlignHor(wxHTML_ALIGN_CENTER);
c -> SetAlign(tag);
c -> SetWidthFloat(tag);
if (tag.HasParam("SIZE") && tag.ScanParam("SIZE", "%i", &sz) == 1) {}
// wxHtmlImageMapCell
// 0-width, 0-height cell that represents map from imagemaps
// it is always placed before wxHtmlImageMapAreaCells
-// It responds to Find(HTML_COND_ISIMAGEMAP)
+// It responds to Find(wxHTML_COND_ISIMAGEMAP)
//--------------------------------------------------------------------------------
const wxHtmlCell *wxHtmlImageMapCell::Find( int cond, const void *param ) const
{
- if (cond == HTML_COND_ISIMAGEMAP)
+ if (cond == wxHTML_COND_ISIMAGEMAP)
{
if (m_Name == *((wxString*)(param)))
return this;
wxHtmlImageMapCell *m_ImageMap;
wxString m_MapName;
- wxHtmlImageCell(wxFSFile *input, int w = -1, int h = -1, int align = HTML_ALIGN_BOTTOM, wxString mapname = wxEmptyString);
+ wxHtmlImageCell(wxFSFile *input, int w = -1, int h = -1, int align = wxHTML_ALIGN_BOTTOM, wxString mapname = wxEmptyString);
~wxHtmlImageCell() {if (m_Image) delete m_Image;}
void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
virtual wxString GetLink( int x = 0, int y = 0 ) const;
delete img;
}
switch (align) {
- case HTML_ALIGN_TOP :
+ case wxHTML_ALIGN_TOP :
m_Descent = m_Height; break;
- case HTML_ALIGN_CENTER :
+ case wxHTML_ALIGN_CENTER :
m_Descent = m_Height / 2; break;
- case HTML_ALIGN_BOTTOM : default :
+ case wxHTML_ALIGN_BOTTOM : default :
m_Descent = 0; break;
}
p = p->GetParent();
}
p = op;
- wxHtmlCell *cell = (wxHtmlCell*)p->Find( HTML_COND_ISIMAGEMAP, (const void*)(&m_MapName));
+ wxHtmlCell *cell = (wxHtmlCell*)p->Find( wxHTML_COND_ISIMAGEMAP, (const void*)(&m_MapName));
if (!cell)
{
((wxString&)m_MapName).Clear();
str = m_WParser -> GetFS() -> OpenFile(tmp);
if (tag.HasParam("WIDTH")) tag.ScanParam("WIDTH", "%i", &w);
if (tag.HasParam("HEIGHT")) tag.ScanParam("HEIGHT", "%i", &h);
- al = HTML_ALIGN_BOTTOM;
+ al = wxHTML_ALIGN_BOTTOM;
if (tag.HasParam("ALIGN")) {
wxString alstr = tag.GetParam("ALIGN");
alstr.MakeUpper(); // for the case alignment was in ".."
- if (alstr == "TEXTTOP") al = HTML_ALIGN_TOP;
- else if ((alstr == "CENTER") || (alstr == "ABSCENTER")) al = HTML_ALIGN_CENTER;
+ if (alstr == "TEXTTOP") al = wxHTML_ALIGN_TOP;
+ else if ((alstr == "CENTER") || (alstr == "ABSCENTER")) al = wxHTML_ALIGN_CENTER;
}
if (tag.HasParam("USEMAP"))
{
m_WParser -> CloseContainer();
m_WParser -> OpenContainer();
}
- m_WParser -> GetContainer() -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_TOP);
+ m_WParser -> GetContainer() -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_TOP);
m_WParser -> GetContainer() -> SetAlign(tag);
return FALSE;
}
int old = m_WParser -> GetAlign();
wxHtmlContainerCell *c = m_WParser -> GetContainer();
- m_WParser -> SetAlign(HTML_ALIGN_CENTER);
+ m_WParser -> SetAlign(wxHTML_ALIGN_CENTER);
if (c -> GetFirstCell() != NULL) {
m_WParser -> CloseContainer();
m_WParser -> OpenContainer();
}
else
- c -> SetAlignHor(HTML_ALIGN_CENTER);
+ c -> SetAlignHor(wxHTML_ALIGN_CENTER);
if (tag.HasEnding()) {
ParseInner(tag);
if (tag.HasParam("BGCOLOR")) {
if (tag.ScanParam("BGCOLOR", "#%lX", &tmp) == 1) {
clr = wxColour((tmp & 0xFF0000) >> 16 , (tmp & 0x00FF00) >> 8, (tmp & 0x0000FF));
- m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(clr, HTML_CLR_BACKGROUND));
+ m_WParser -> GetContainer() -> InsertCell(new wxHtmlColourCell(clr, wxHTML_CLR_BACKGROUND));
if (m_WParser -> GetWindow() != NULL)
m_WParser -> GetWindow() -> SetBackgroundColour(clr);
}
m_WParser -> CloseContainer();
c = m_WParser -> OpenContainer();
- if (c -> GetAlignHor() == HTML_ALIGN_RIGHT)
- c -> SetIndent(5 * m_WParser -> GetCharWidth(), HTML_INDENT_RIGHT);
+ if (c -> GetAlignHor() == wxHTML_ALIGN_RIGHT)
+ c -> SetIndent(5 * m_WParser -> GetCharWidth(), wxHTML_INDENT_RIGHT);
else
- c -> SetIndent(5 * m_WParser -> GetCharWidth(), HTML_INDENT_LEFT);
- c -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_TOP);
+ 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(), HTML_INDENT_BOTTOM);
+ c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_BOTTOM);
m_WParser -> CloseContainer();
m_WParser -> OpenContainer();
return TRUE;
wxHtmlAnchorCell(const wxString& name) : wxHtmlCell() {m_AnchorName = name;}
virtual const wxHtmlCell* Find(int condition, const void* param) const
{
- if ((condition == HTML_COND_ISANCHOR) && (m_AnchorName == (*((const wxString*)param))))
+ if ((condition == wxHTML_COND_ISANCHOR) && (m_AnchorName == (*((const wxString*)param))))
return this;
else
return wxHtmlCell::Find(condition, param);
m_WParser -> CloseContainer();
c = m_WParser -> OpenContainer();
- c -> SetWidthFloat(2 * m_WParser -> GetCharWidth(), HTML_UNITS_PIXELS);
- c -> SetAlignHor(HTML_ALIGN_RIGHT);
+ c -> SetWidthFloat(2 * m_WParser -> GetCharWidth(), wxHTML_UNITS_PIXELS);
+ c -> SetAlignHor(wxHTML_ALIGN_RIGHT);
if (m_Numbering == 0)
c -> InsertCell(new wxHtmlListmarkCell(m_WParser -> GetDC(), m_WParser -> GetActualColor()));
else {
m_WParser -> CloseContainer();
c = m_WParser -> OpenContainer();
- c -> SetIndent(m_WParser -> GetCharWidth() / 4, HTML_INDENT_LEFT);
- c -> SetWidthFloat(-2 * m_WParser -> GetCharWidth(), HTML_UNITS_PIXELS);
+ c -> SetIndent(m_WParser -> GetCharWidth() / 4, wxHTML_INDENT_LEFT);
+ c -> SetWidthFloat(-2 * m_WParser -> GetCharWidth(), wxHTML_UNITS_PIXELS);
m_WParser -> OpenContainer();
m_WParser -> OpenContainer();
c = m_WParser -> GetContainer();
}
- c -> SetAlignHor(HTML_ALIGN_LEFT);
- c -> SetIndent(2 * m_WParser -> GetCharWidth(), HTML_INDENT_LEFT);
- m_WParser -> OpenContainer() -> SetAlignVer(HTML_ALIGN_TOP);
+ c -> SetAlignHor(wxHTML_ALIGN_LEFT);
+ c -> SetIndent(2 * m_WParser -> GetCharWidth(), wxHTML_INDENT_LEFT);
+ m_WParser -> OpenContainer() -> SetAlignVer(wxHTML_ALIGN_TOP);
m_WParser -> OpenContainer();
m_WParser -> OpenContainer();
m_WParser -> CloseContainer();
c = m_WParser -> OpenContainer();
- c -> SetAlignHor(HTML_ALIGN_LEFT);
- c -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_VERTICAL);
+ c -> SetAlignHor(wxHTML_ALIGN_LEFT);
+ c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_VERTICAL);
m_WParser -> SetFontUnderlined(FALSE);
m_WParser -> SetFontBold(FALSE);
m_ColsInfo = (colStruct*) realloc(m_ColsInfo, sizeof(colStruct) * cols);
for (j = m_NumCols; j < cols; j++) {
m_ColsInfo[j].width = 0;
- m_ColsInfo[j].units = HTML_UNITS_PERCENT;
+ m_ColsInfo[j].units = wxHTML_UNITS_PERCENT;
}
m_NumCols = cols;
m_CellInfo[r][c].rowspan = 1;
m_CellInfo[r][c].flag = cellUsed;
m_CellInfo[r][c].minheight = 0;
- m_CellInfo[r][c].valign = HTML_ALIGN_TOP;
+ m_CellInfo[r][c].valign = wxHTML_ALIGN_TOP;
/* scan for parameters: */
if (wd[wd.Length()-1] == '%') {
sscanf(wd.c_str(), "%i%%", &m_ColsInfo[c].width);
- m_ColsInfo[c].units = HTML_UNITS_PERCENT;
+ m_ColsInfo[c].units = wxHTML_UNITS_PERCENT;
}
else {
sscanf(wd.c_str(), "%i", &m_ColsInfo[c].width);
- m_ColsInfo[c].units = HTML_UNITS_PIXELS;
+ m_ColsInfo[c].units = wxHTML_UNITS_PIXELS;
}
}
}
wxString valign;
if (tag.HasParam("VALIGN")) valign = tag.GetParam("VALIGN"); else valign = m_tValign;
valign.MakeUpper();
- if (valign == "TOP") m_CellInfo[r][c].valign = HTML_ALIGN_TOP;
- else if (valign == "BOTTOM") m_CellInfo[r][c].valign = HTML_ALIGN_BOTTOM;
- else m_CellInfo[r][c].valign = HTML_ALIGN_CENTER;
+ if (valign == "TOP") m_CellInfo[r][c].valign = wxHTML_ALIGN_TOP;
+ else if (valign == "BOTTOM") m_CellInfo[r][c].valign = wxHTML_ALIGN_BOTTOM;
+ else m_CellInfo[r][c].valign = wxHTML_ALIGN_CENTER;
}
- cell -> SetIndent(m_Padding, HTML_INDENT_ALL, HTML_UNITS_PIXELS);
+ cell -> SetIndent(m_Padding, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
}
*/
- if (m_WidthFloatUnits == HTML_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;
}
// 1a. setup fixed-width columns:
for (i = 0; i < m_NumCols; i++)
- if (m_ColsInfo[i].units == HTML_UNITS_PIXELS)
+ if (m_ColsInfo[i].units == wxHTML_UNITS_PIXELS)
wpix -= (m_ColsInfo[i].pixwidth = m_ColsInfo[i].width);
// 1b. setup floating-width columns:
for (i = 0; i < m_NumCols; i++)
- if ((m_ColsInfo[i].units == HTML_UNITS_PERCENT) && (m_ColsInfo[i].width != 0))
+ if ((m_ColsInfo[i].units == wxHTML_UNITS_PERCENT) && (m_ColsInfo[i].width != 0))
wtemp += (m_ColsInfo[i].pixwidth = m_ColsInfo[i].width * wpix / 100);
wpix -= wtemp;
{
m_Table = NULL;
m_tAlign = m_rAlign = wxEmptyString;
- m_OldAlign = HTML_ALIGN_LEFT;
+ m_OldAlign = wxHTML_ALIGN_LEFT;
}
m_WParser -> OpenContainer();
if (tag.GetName() == "TH") /*header style*/ {
- m_WParser -> SetAlign(HTML_ALIGN_CENTER);
+ m_WParser -> SetAlign(wxHTML_ALIGN_CENTER);
}
{
als = m_rAlign;
if (tag.HasParam("ALIGN")) als = tag.GetParam("ALIGN");
als.MakeUpper();
- if (als == "RIGHT") m_WParser -> SetAlign(HTML_ALIGN_RIGHT);
- else if (als == "CENTER") m_WParser -> SetAlign(HTML_ALIGN_CENTER);
+ if (als == "RIGHT") m_WParser -> SetAlign(wxHTML_ALIGN_RIGHT);
+ else if (als == "CENTER") m_WParser -> SetAlign(wxHTML_ALIGN_CENTER);
}
m_WParser -> OpenContainer();
}
m_Link = "";
m_LinkColor.Set(0, 0, 0xFF);
m_ActualColor.Set(0, 0, 0);
- m_Align = HTML_ALIGN_LEFT;
+ m_Align = wxHTML_ALIGN_LEFT;
m_tmpLastWasSpace = FALSE;
OpenContainer();
CloseContainer();
OpenContainer();
- GetContainer() -> SetIndent(m_CharHeight, HTML_INDENT_TOP);
+ GetContainer() -> SetIndent(m_CharHeight, wxHTML_INDENT_TOP);
top = m_Container;
while (top -> GetParent()) top = top -> GetParent();
return top;
{
wxHtmlCell *c;
int i = 0, x, lng = strlen(txt);
- char temp[HTML_BUFLEN];
+ char temp[wxHTML_BUFLEN];
register char d;
int templen = 0;