fixed wxHtmlWindow flicker
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4981 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -202,8 +202,8 @@ class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
|
|||||||
// (if TRUE we will try to change cursor in last call to OnIdle)
|
// (if TRUE we will try to change cursor in last call to OnIdle)
|
||||||
wxString m_tmpLastLink;
|
wxString m_tmpLastLink;
|
||||||
// contains last link name
|
// contains last link name
|
||||||
bool m_tmpCanDraw;
|
int m_tmpCanDrawLocks;
|
||||||
// if FALSE contents of the window is not redrawn
|
// if >0 contents of the window is not redrawn
|
||||||
// (in order to avoid ugly bliking)
|
// (in order to avoid ugly bliking)
|
||||||
|
|
||||||
static wxList m_Filters;
|
static wxList m_Filters;
|
||||||
|
@@ -45,7 +45,7 @@ wxHtmlWindow::wxHtmlWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos,
|
|||||||
{
|
{
|
||||||
m_tmpMouseMoved = FALSE;
|
m_tmpMouseMoved = FALSE;
|
||||||
m_tmpLastLink = wxEmptyString;
|
m_tmpLastLink = wxEmptyString;
|
||||||
m_tmpCanDraw = TRUE;
|
m_tmpCanDrawLocks = 0;
|
||||||
m_FS = new wxFileSystem();
|
m_FS = new wxFileSystem();
|
||||||
m_RelatedStatusBar = -1;
|
m_RelatedStatusBar = -1;
|
||||||
m_RelatedFrame = NULL;
|
m_RelatedFrame = NULL;
|
||||||
@@ -121,7 +121,7 @@ bool wxHtmlWindow::SetPage(const wxString& source)
|
|||||||
m_Cell -> SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
|
m_Cell -> SetIndent(m_Borders, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS);
|
||||||
m_Cell -> SetAlignHor(wxHTML_ALIGN_CENTER);
|
m_Cell -> SetAlignHor(wxHTML_ALIGN_CENTER);
|
||||||
CreateLayout();
|
CreateLayout();
|
||||||
Refresh();
|
if (m_tmpCanDrawLocks == 0) Refresh();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
|||||||
SetCursor(*wxHOURGLASS_CURSOR);
|
SetCursor(*wxHOURGLASS_CURSOR);
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
m_tmpCanDraw = 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;
|
int x, y;
|
||||||
ViewStart(&x, &y);
|
ViewStart(&x, &y);
|
||||||
@@ -143,7 +143,7 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
|||||||
|
|
||||||
if (location[0] == '#') { // local anchor
|
if (location[0] == '#') { // local anchor
|
||||||
wxString anch = location.Mid(1) /*1 to end*/;
|
wxString anch = location.Mid(1) /*1 to end*/;
|
||||||
m_tmpCanDraw = TRUE;
|
m_tmpCanDrawLocks--;
|
||||||
rt_val = ScrollToAnchor(anch);
|
rt_val = ScrollToAnchor(anch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
|||||||
wxString err;
|
wxString err;
|
||||||
|
|
||||||
err.Printf(_("The browser is unable to open requested location :\n\n%s"), WXSTRINGCAST location);
|
err.Printf(_("The browser is unable to open requested location :\n\n%s"), WXSTRINGCAST location);
|
||||||
m_tmpCanDraw = TRUE;
|
m_tmpCanDrawLocks--;
|
||||||
Refresh();
|
Refresh();
|
||||||
wxMessageBox(err, "Error");
|
wxMessageBox(err, "Error");
|
||||||
|
|
||||||
@@ -195,9 +195,9 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
|||||||
rt_val = SetPage(src);
|
rt_val = SetPage(src);
|
||||||
m_OpenedPage = f -> GetLocation();
|
m_OpenedPage = f -> GetLocation();
|
||||||
if (f -> GetAnchor() != wxEmptyString) {
|
if (f -> GetAnchor() != wxEmptyString) {
|
||||||
m_tmpCanDraw = TRUE;
|
// m_tmpCanDrawLocks--;
|
||||||
ScrollToAnchor(f -> GetAnchor());
|
ScrollToAnchor(f -> GetAnchor());
|
||||||
m_tmpCanDraw = FALSE;
|
// m_tmpCanDrawLocks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete f;
|
delete f;
|
||||||
@@ -217,7 +217,8 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
|
|||||||
|
|
||||||
SetCursor(*wxSTANDARD_CURSOR);
|
SetCursor(*wxSTANDARD_CURSOR);
|
||||||
|
|
||||||
m_tmpCanDraw = TRUE;
|
wxYield();
|
||||||
|
m_tmpCanDrawLocks--;
|
||||||
Refresh();
|
Refresh();
|
||||||
return rt_val;
|
return rt_val;
|
||||||
}
|
}
|
||||||
@@ -356,10 +357,13 @@ bool wxHtmlWindow::HistoryBack()
|
|||||||
l = m_History[m_HistoryPos].GetPage();
|
l = m_History[m_HistoryPos].GetPage();
|
||||||
a = m_History[m_HistoryPos].GetAnchor();
|
a = m_History[m_HistoryPos].GetAnchor();
|
||||||
m_HistoryOn = FALSE;
|
m_HistoryOn = FALSE;
|
||||||
|
m_tmpCanDrawLocks++;
|
||||||
if (a == wxEmptyString) LoadPage(l);
|
if (a == wxEmptyString) LoadPage(l);
|
||||||
else LoadPage(l + "#" + a);
|
else LoadPage(l + "#" + a);
|
||||||
m_HistoryOn = TRUE;
|
m_HistoryOn = TRUE;
|
||||||
Scroll(0, m_History[m_HistoryPos].GetPos());
|
Scroll(0, m_History[m_HistoryPos].GetPos());
|
||||||
|
// wxYield();
|
||||||
|
m_tmpCanDrawLocks--;
|
||||||
Refresh();
|
Refresh();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -379,10 +383,13 @@ bool wxHtmlWindow::HistoryForward()
|
|||||||
l = m_History[m_HistoryPos].GetPage();
|
l = m_History[m_HistoryPos].GetPage();
|
||||||
a = m_History[m_HistoryPos].GetAnchor();
|
a = m_History[m_HistoryPos].GetAnchor();
|
||||||
m_HistoryOn = FALSE;
|
m_HistoryOn = FALSE;
|
||||||
|
m_tmpCanDrawLocks++;
|
||||||
if (a == wxEmptyString) LoadPage(l);
|
if (a == wxEmptyString) LoadPage(l);
|
||||||
else LoadPage(l + "#" + a);
|
else LoadPage(l + "#" + a);
|
||||||
m_HistoryOn = TRUE;
|
m_HistoryOn = TRUE;
|
||||||
Scroll(0, m_History[m_HistoryPos].GetPos());
|
Scroll(0, m_History[m_HistoryPos].GetPos());
|
||||||
|
// wxYield();
|
||||||
|
m_tmpCanDrawLocks--;
|
||||||
Refresh();
|
Refresh();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -432,7 +439,7 @@ void wxHtmlWindow::OnDraw(wxDC& dc)
|
|||||||
wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
|
wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
|
||||||
int v_y, v_h;
|
int v_y, v_h;
|
||||||
|
|
||||||
if (!m_tmpCanDraw) return;
|
if (m_tmpCanDrawLocks > 0) return;
|
||||||
dc.SetMapMode(wxMM_TEXT);
|
dc.SetMapMode(wxMM_TEXT);
|
||||||
#if defined(_MSC_VER) && (_MSC_VER == 1200)
|
#if defined(_MSC_VER) && (_MSC_VER == 1200)
|
||||||
::SetMapMode((HDC)dc.GetHDC(), MM_TEXT);
|
::SetMapMode((HDC)dc.GetHDC(), MM_TEXT);
|
||||||
|
Reference in New Issue
Block a user