Rewrite DoPaint, FullPaint and add FullPaintDC to help deal with flicker problems and to be more like how the other Scintilla ports are working now.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -733,25 +733,47 @@ sptr_t ScintillaWX::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam)
|
||||
void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
|
||||
|
||||
paintState = painting;
|
||||
Surface* surfaceWindow = Surface::Allocate();
|
||||
surfaceWindow->Init(dc, wMain.GetID());
|
||||
rcPaint = PRectangleFromwxRect(rect);
|
||||
PRectangle rcClient = GetClientRectangle();
|
||||
paintingAllText = rcPaint.Contains(rcClient);
|
||||
AutoSurface surfaceWindow(dc, this);
|
||||
if (surfaceWindow) {
|
||||
rcPaint = PRectangleFromwxRect(rect);
|
||||
PRectangle rcClient = GetClientRectangle();
|
||||
paintingAllText = rcPaint.Contains(rcClient);
|
||||
|
||||
ClipChildren(*dc, rcPaint);
|
||||
Paint(surfaceWindow, rcPaint);
|
||||
ClipChildren(*dc, rcPaint);
|
||||
Paint(surfaceWindow, rcPaint);
|
||||
surfaceWindow->Release();
|
||||
}
|
||||
|
||||
delete surfaceWindow;
|
||||
if (paintState == paintAbandoned) {
|
||||
// Painting area was insufficient to cover new styling or brace
|
||||
// highlight positions
|
||||
FullPaint();
|
||||
FullPaintDC(dc);
|
||||
}
|
||||
paintState = notPainting;
|
||||
}
|
||||
|
||||
|
||||
// Force the whole window to be repainted
|
||||
void ScintillaWX::FullPaint() {
|
||||
wxClientDC dc(stc);
|
||||
FullPaintDC(&dc);
|
||||
}
|
||||
|
||||
|
||||
void ScintillaWX::FullPaintDC(wxDC* dc) {
|
||||
paintState = painting;
|
||||
rcPaint = GetClientRectangle();
|
||||
paintingAllText = true;
|
||||
AutoSurface surfaceWindow(dc, this);
|
||||
if (surfaceWindow) {
|
||||
Paint(surfaceWindow, rcPaint);
|
||||
surfaceWindow->Release();
|
||||
}
|
||||
paintState = notPainting;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ScintillaWX::DoHScroll(int type, int pos) {
|
||||
int xPos = xOffset;
|
||||
PRectangle rcText = GetTextRectangle();
|
||||
@@ -1080,13 +1102,6 @@ void ScintillaWX::DoDragLeave() {
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Force the whole window to be repainted
|
||||
void ScintillaWX::FullPaint() {
|
||||
stc->Refresh(false);
|
||||
stc->Update();
|
||||
}
|
||||
|
||||
|
||||
void ScintillaWX::DoScrollToLine(int line) {
|
||||
ScrollTo(line);
|
||||
}
|
||||
|
@@ -166,6 +166,7 @@ public:
|
||||
|
||||
// helpers
|
||||
void FullPaint();
|
||||
void FullPaintDC(wxDC* dc);
|
||||
bool CanPaste();
|
||||
bool GetHideSelection() { return hideSelection; }
|
||||
void DoScrollToLine(int line);
|
||||
|
@@ -210,7 +210,7 @@ bool wxStyledTextCtrl::Create(wxWindow *parent,
|
||||
SetInitialSize(size);
|
||||
|
||||
// Reduces flicker on GTK+/X11
|
||||
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
|
||||
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
|
||||
// Make sure it can take the focus
|
||||
SetCanFocus(true);
|
||||
|
Reference in New Issue
Block a user