X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/14941a1af765c1050d699baa6564e97028517c2f..c37b0f0907b07878551a00165b0ad323bd2ccdaf:/src/stc/ScintillaWX.cpp diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index 905bcec38c..503e05ea37 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -9,7 +9,6 @@ // Author: Robin Dunn // // Created: 13-Jan-2000 -// RCS-ID: $Id$ // Copyright: (c) 2000 by Total Control Software // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -132,7 +131,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(); @@ -244,7 +243,8 @@ ScintillaWX::ScintillaWX(wxStyledTextCtrl* win) { focusEvent = false; wMain = win; stc = win; - wheelRotation = 0; + wheelVRotation = 0; + wheelHRotation = 0; Initialise(); #ifdef __WXMSW__ sysCaretBitmap = 0; @@ -671,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. @@ -711,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: @@ -745,8 +748,16 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) { if (paintState == paintAbandoned) { // Painting area was insufficient to cover new styling or brace - // highlight positions + // highlight positions. So trigger a new paint event that will + // repaint the whole window. + stc->Refresh(false); + +#if defined(__WXOSX__) + // On Mac we also need to finish the current paint to make sure that + // everything is on the screen that needs to be there between now and + // when the next paint event arrives. FullPaintDC(dc); +#endif } paintState = notPainting; } @@ -754,8 +765,8 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) { // Force the whole window to be repainted void ScintillaWX::FullPaint() { - wxClientDC dc(stc); - FullPaintDC(&dc); + stc->Refresh(false); + stc->Update(); } @@ -819,13 +830,28 @@ void ScintillaWX::DoVScroll(int type, int pos) { ScrollTo(topLineNew); } -void ScintillaWX::DoMouseWheel(int rotation, int delta, - int linesPerAction, int ctrlDown, - bool isPageScroll ) { +void ScintillaWX::DoMouseWheel(wxMouseWheelAxis axis, int rotation, int delta, + int linesPerAction, int columnsPerAction, + bool ctrlDown, bool isPageScroll) { int topLineNew = topLine; int lines; - - if (ctrlDown) { // Zoom the fonts if Ctrl key down + int xPos = xOffset; + int pixels; + + if (axis == wxMOUSE_WHEEL_HORIZONTAL) { + wheelHRotation += rotation * (columnsPerAction * vs.spaceWidth); + pixels = wheelHRotation / delta; + wheelHRotation -= pixels * delta; + if (pixels != 0) { + xPos += pixels; + PRectangle rcText = GetTextRectangle(); + if (xPos > scrollWidth - rcText.Width()) { + xPos = scrollWidth - rcText.Width(); + } + HorizontalScrollTo(xPos); + } + } + else if (ctrlDown) { // Zoom the fonts if Ctrl key down if (rotation > 0) { KeyCommand(SCI_ZOOMIN); } @@ -836,9 +862,9 @@ void ScintillaWX::DoMouseWheel(int rotation, int delta, else { // otherwise just scroll the window if ( !delta ) delta = 120; - wheelRotation += rotation; - lines = wheelRotation / delta; - wheelRotation -= lines * delta; + wheelVRotation += rotation; + lines = wheelVRotation / delta; + wheelVRotation -= lines * delta; if (lines != 0) { if (isPageScroll) lines = lines * LinesOnScreen(); // lines is either +1 or -1