X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f32204b0c4c4cc5069ff41088dcbb5bc23a85b34..d01ca1e4d1078c854e3a354a9536c230525afdcc:/src/stc/ScintillaWX.cpp diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index 4c45692de7..153329c124 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -132,7 +132,7 @@ public: void OnPaint(wxPaintEvent& WXUNUSED(evt)) { wxAutoBufferedPaintDC dc(this); - Surface* surfaceWindow = Surface::Allocate(); + Surface* surfaceWindow = Surface::Allocate(0); surfaceWindow->Init(&dc, m_ct->wDraw.GetID()); m_ct->PaintCT(surfaceWindow); surfaceWindow->Release(); @@ -364,7 +364,6 @@ bool ScintillaWX::HaveMouseCapture() { void ScintillaWX::ScrollText(int linesToMove) { int dy = vs.lineHeight * (linesToMove); stc->ScrollWindow(0, dy); - stc->Update(); } void ScintillaWX::SetVerticalScrollPos() { @@ -672,6 +671,8 @@ sptr_t ScintillaWX::DefWndProc(unsigned int /*iMessage*/, uptr_t /*wParam*/, spt sptr_t ScintillaWX::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { switch (iMessage) { +#if 0 // TODO: check this + case SCI_CALLTIPSHOW: { // NOTE: This is copied here from scintilla/src/ScintillaBase.cxx // because of the little tweak that needs done below for wxGTK. @@ -712,6 +713,7 @@ sptr_t ScintillaWX::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) ct.wCallTip.Show(); break; } +#endif #ifdef SCI_LEXER case SCI_LOADLEXERLIBRARY: @@ -733,25 +735,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); - - ClipChildren(*dc, rcPaint); - Paint(surfaceWindow, rcPaint); + AutoSurface surfaceWindow(dc, this); + if (surfaceWindow) { + rcPaint = PRectangleFromwxRect(rect); + PRectangle rcClient = GetClientRectangle(); + paintingAllText = rcPaint.Contains(rcClient); + + 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(); @@ -805,7 +829,7 @@ void ScintillaWX::DoMouseWheel(int rotation, int delta, int lines; if (ctrlDown) { // Zoom the fonts if Ctrl key down - if (rotation < 0) { + if (rotation > 0) { KeyCommand(SCI_ZOOMIN); } else { @@ -919,6 +943,14 @@ void ScintillaWX::DoAddChar(int key) { int ScintillaWX::DoKeyDown(const wxKeyEvent& evt, bool* consumed) { int key = evt.GetKeyCode(); + if (key == WXK_NONE) { + // This is a Unicode character not representable in Latin-1 or some key + // without key code at all (e.g. dead key or VK_PROCESSKEY under MSW). + if ( consumed ) + *consumed = false; + return 0; + } + bool shift = evt.ShiftDown(), ctrl = evt.ControlDown(), alt = evt.AltDown(); @@ -961,7 +993,7 @@ int ScintillaWX::DoKeyDown(const wxKeyEvent& evt, bool* consumed) case WXK_CONTROL: key = 0; break; case WXK_ALT: key = 0; break; case WXK_SHIFT: key = 0; break; - case WXK_MENU: key = 0; break; + case WXK_MENU: key = SCK_MENU; break; } #ifdef __WXMAC__ @@ -1072,15 +1104,6 @@ void ScintillaWX::DoDragLeave() { #endif // wxUSE_DRAG_AND_DROP //---------------------------------------------------------------------- -// Force the whole window to be repainted -void ScintillaWX::FullPaint() { -#ifndef __WXMAC__ - stc->Refresh(false); -#endif - stc->Update(); -} - - void ScintillaWX::DoScrollToLine(int line) { ScrollTo(line); }