]> git.saurik.com Git - wxWidgets.git/blobdiff - src/stc/ScintillaWX.cpp
a better fix for notebook page not being refreshed after Delete()
[wxWidgets.git] / src / stc / ScintillaWX.cpp
index ec2297af18a9f9cc95ac7703d3787a8b04b579b4..10859100d6bd296dd46329734e0a115fa9e7520a 100644 (file)
@@ -110,7 +110,7 @@ public:
             CaptureMouse();
         }
         else {
-            ReleaseMouse();
+            if (HasCapture()) ReleaseMouse();
         }
         return retval;
     }
@@ -320,6 +320,7 @@ void ScintillaWX::Copy() {
         SelectionText st;
         CopySelectionRange(&st);
         wxTheClipboard->Open();
+        wxTheClipboard->UsePrimarySelection();
         wxString text = stc2wx(st.s, st.len);
         wxTheClipboard->SetData(new wxTextDataObject(text));
         wxTheClipboard->Close();
@@ -335,6 +336,7 @@ void ScintillaWX::Paste() {
     bool gotData;
 
     wxTheClipboard->Open();
+    wxTheClipboard->UsePrimarySelection();
     gotData = wxTheClipboard->GetData(data);
     wxTheClipboard->Close();
     if (gotData) {
@@ -354,6 +356,7 @@ bool ScintillaWX::CanPaste() {
     bool canPaste;
 
     wxTheClipboard->Open();
+    wxTheClipboard->UsePrimarySelection();
     canPaste = wxTheClipboard->IsSupported(wxUSE_UNICODE ? wxDF_UNICODETEXT : wxDF_TEXT);
     wxTheClipboard->Close();
 
@@ -464,8 +467,9 @@ void ScintillaWX::DoVScroll(int type, int pos) {
     ScrollTo(topLineNew);
 }
 
-
-void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown) {
+void ScintillaWX::DoMouseWheel(int rotation, int delta,
+                               int linesPerAction, int ctrlDown,
+                               bool isPageScroll ) {
     int topLineNew = topLine;
     int lines;
 
@@ -482,7 +486,10 @@ void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction, int
         lines = wheelRotation / delta;
         wheelRotation -= lines * delta;
         if (lines != 0) {
-            lines *= linesPerAction;
+            if (isPageScroll)
+                lines = lines * LinesOnScreen();  // lines is either +1 or -1
+            else
+                lines *= linesPerAction;
             topLineNew -= lines;
             ScrollTo(topLineNew);
         }
@@ -575,7 +582,8 @@ void ScintillaWX::DoCommand(int ID) {
 
 
 void ScintillaWX::DoContextMenu(Point pt) {
-    ContextMenu(pt);
+    if (displayPopupMenu)
+        ContextMenu(pt);
 }
 
 void ScintillaWX::DoOnListBox() {