From 1ae22525d048995815c69fc63b8ef8ed8374252f Mon Sep 17 00:00:00 2001
From: nyamatongwe
Date: Sat, 18 Mar 2000 04:01:39 +0000
Subject: Can turn off context (wrong mouse button) menu with SCI_USEPOPUP.
Most signals return FALSE on GTK+.
---
doc/ScintillaDoc.html | 10 ++++++++++
gtk/ScintillaGTK.cxx | 20 ++++++++++----------
include/Scintilla.h | 1 +
src/Editor.cxx | 6 ++++++
src/Editor.h | 2 ++
win32/ScintillaWin.cxx | 4 +++-
6 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index fc86444af..fde329522 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -636,6 +636,16 @@ SCI_CLEARALLCMDKEYS
key code is from the VK_* enumeration, and the modifiers are a combination of zero or more of
SHIFT_PRESSED and LEFT_CTRL_PRESSED.
+
+ Popup edit menu
+
+
+SCI_USEPOPUP
+
+
+ Clicking the wrong button on the mouse pops up a short default editing menu.
+ This may be turned off with SCI_USEPOPUP(0).
+
Macro Recording
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 3bd3b0168..da3a98a75 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -668,7 +668,7 @@ void ScintillaGTK::Resize(int width, int height) {
gint ScintillaGTK::MoveResize(GtkWidget *, GtkAllocation *allocation, ScintillaGTK *sciThis) {
// Platform::DebugPrintf("sci move resize %d %d\n", allocation->width, allocation->height);
sciThis->Resize(allocation->width, allocation->height);
- return TRUE;
+ return FALSE;
}
gint ScintillaGTK::Press(GtkWidget *, GdkEventButton *event, ScintillaGTK *sciThis) {
@@ -694,7 +694,7 @@ gint ScintillaGTK::Press(GtkWidget *, GdkEventButton *event, ScintillaGTK *sciTh
gtk_selection_convert(GTK_WIDGET(sciThis->wDraw.GetID()),
GDK_SELECTION_PRIMARY,
gdk_atom_intern("STRING", FALSE), event->time);
- } else if (event->button == 3) {
+ } else if (event->button == 3 && sciThis->displayPopupMenu) {
// PopUp menu
// Convert to screen
int ox = 0;
@@ -719,7 +719,7 @@ gint ScintillaGTK::MouseRelease(GtkWidget *, GdkEventButton *event, ScintillaGTK
pt = sciThis->ptMouseLast;
sciThis->ButtonUp(pt, event->time, event->state & 4);
}
- return TRUE;
+ return FALSE;
}
gint ScintillaGTK::Motion(GtkWidget *, GdkEventMotion *event, ScintillaGTK *sciThis) {
@@ -742,7 +742,7 @@ gint ScintillaGTK::Motion(GtkWidget *, GdkEventMotion *event, ScintillaGTK *sciT
pt.y = y;
sciThis->ButtonMove(pt);
}
- return TRUE;
+ return FALSE;
}
// Map the keypad keys to their equivalent functions
@@ -779,19 +779,19 @@ gint ScintillaGTK::KeyPress(GtkWidget *, GdkEventKey *event, ScintillaGTK *sciTh
sciThis->KeyDown(key, shift, ctrl, alt);
//Platform::DebugPrintf("SK-key: %d %x %x\n",event->keyval, event->state, GTK_WIDGET_FLAGS(widget));
- return 1;
+ return TRUE;
}
gint ScintillaGTK::KeyRelease(GtkWidget *, GdkEventKey *event, ScintillaGTK *sciThis) {
//Platform::DebugPrintf("SC-keyrel: %d %x %3s\n",event->keyval, event->state, event->string);
- return TRUE;
+ return FALSE;
}
gint ScintillaGTK::DestroyWindow(GtkWidget *, ScintillaGTK *sciThis) {
//Platform::DebugPrintf("Destroying window %x %x\n", sciThis, widget);
sciThis->Finalise();
delete sciThis;
- return TRUE;
+ return FALSE;
}
gint ScintillaGTK::Expose(GtkWidget *, GdkEventExpose *ose, ScintillaGTK *sciThis) {
@@ -819,7 +819,7 @@ gint ScintillaGTK::Expose(GtkWidget *, GdkEventExpose *ose, ScintillaGTK *sciThi
}
sciThis->paintState = notPainting;
- return TRUE;
+ return FALSE;
}
void ScintillaGTK::ScrollSignal(GtkAdjustment *adj, ScintillaGTK *sciThis) {
@@ -857,7 +857,7 @@ gboolean ScintillaGTK::DragMotion(GtkWidget *, GdkDragContext *context,
sciThis->inDragDrop = true;
sciThis->SetDragPosition(sciThis->PositionFromLocation(npt));
gdk_drag_status(context, context->suggested_action, dragtime);
- return TRUE;
+ return FALSE;
}
void ScintillaGTK::DragLeave(GtkWidget *, GdkDragContext *context,
@@ -879,7 +879,7 @@ gboolean ScintillaGTK::Drop(GtkWidget *, GdkDragContext *context,
gint, gint, guint, ScintillaGTK *sciThis) {
//Platform::DebugPrintf("Drop %x\n", sciThis);
sciThis->SetDragPosition(invalidPosition);
- return TRUE;
+ return FALSE;
}
void ScintillaGTK::DragDataReceived(GtkWidget *, GdkDragContext *context,
diff --git a/include/Scintilla.h b/include/Scintilla.h
index e030aa859..a320fccbd 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -312,6 +312,7 @@ extern "C" {
#define SCI_SETCARETPOLICY SCI_START + 369
#define SCI_LINESONSCREEN SCI_START + 370
+#define SCI_USEPOPUP SCI_START + 371
// GTK+ Specific
#define SCI_GRABFOCUS SCI_START + 400
diff --git a/src/Editor.cxx b/src/Editor.cxx
index bcefa8aec..8550286ac 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -88,6 +88,8 @@ Editor::Editor() {
modEventMask = SC_MODEVENTMASKALL;
+ displayPopupMenu = true;
+
pdoc = new Document();
pdoc ->AddRef();
pdoc->AddWatcher(this, 0);
@@ -3523,6 +3525,10 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
case SCI_LINESONSCREEN:
return LinesOnScreen();
+ case SCI_USEPOPUP:
+ displayPopupMenu = wParam;
+ break;
+
#ifdef INCLUDE_DEPRECATED_FEATURES
case SCI_SETFORE:
vs.styles[STYLE_DEFAULT].fore.desired = Colour(wParam);
diff --git a/src/Editor.h b/src/Editor.h
index 46fc52d94..16bcd4b22 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -116,6 +116,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
int searchAnchor;
+ int displayPopupMenu;
+
#ifdef MACRO_SUPPORT
int recordingMacro;
#endif
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 4a23a4f03..2e3143054 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -448,7 +448,9 @@ LRESULT ScintillaWin::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {
case WM_CONTEXTMENU:
#ifdef TOTAL_CONTROL
- ContextMenu(Point::FromLong(lParam));
+ if (displayPopupMenu) {
+ ContextMenu(Point::FromLong(lParam));
+ }
#endif
break;
--
cgit v1.2.3