diff options
| author | Neil <nyamatongwe@gmail.com> | 2017-06-12 13:49:46 +1000 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2017-06-12 13:49:46 +1000 | 
| commit | 1995e565ce6566fced7a383d8114319da57974d5 (patch) | |
| tree | abd53d2e1d51cabb86852e9999822e7957b3fce2 /src | |
| parent | e57183504381c137e851265b0083c429ac65246f (diff) | |
| download | scintilla-mirror-1995e565ce6566fced7a383d8114319da57974d5.tar.gz | |
Simplify mouse and keyboard handling by only retaining the 'WithModifiers" form.
All events include a set of keyboard modifier flags.
Older calls that passed individual parameters for each key were removed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Editor.cxx | 48 | ||||
| -rw-r--r-- | src/Editor.h | 13 | ||||
| -rw-r--r-- | src/ScintillaBase.cxx | 4 | ||||
| -rw-r--r-- | src/ScintillaBase.h | 1 | 
4 files changed, 8 insertions, 58 deletions
| diff --git a/src/Editor.cxx b/src/Editor.cxx index 771353654..82c63dfb8 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -2340,10 +2340,6 @@ void Editor::NotifyDoubleClick(Point pt, int modifiers) {  	NotifyParent(scn);  } -void Editor::NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt) { -	NotifyDoubleClick(pt, ModifierFlags(shift, ctrl, alt)); -} -  void Editor::NotifyHotSpotDoubleClicked(Sci::Position position, int modifiers) {  	SCNotification scn = {};  	scn.nmhdr.code = SCN_HOTSPOTDOUBLECLICK; @@ -2352,10 +2348,6 @@ void Editor::NotifyHotSpotDoubleClicked(Sci::Position position, int modifiers) {  	NotifyParent(scn);  } -void Editor::NotifyHotSpotDoubleClicked(Sci::Position position, bool shift, bool ctrl, bool alt) { -	NotifyHotSpotDoubleClicked(position, ModifierFlags(shift, ctrl, alt)); -} -  void Editor::NotifyHotSpotClicked(Sci::Position position, int modifiers) {  	SCNotification scn = {};  	scn.nmhdr.code = SCN_HOTSPOTCLICK; @@ -2364,10 +2356,6 @@ void Editor::NotifyHotSpotClicked(Sci::Position position, int modifiers) {  	NotifyParent(scn);  } -void Editor::NotifyHotSpotClicked(Sci::Position position, bool shift, bool ctrl, bool alt) { -	NotifyHotSpotClicked(position, ModifierFlags(shift, ctrl, alt)); -} -  void Editor::NotifyHotSpotReleaseClick(Sci::Position position, int modifiers) {  	SCNotification scn = {};  	scn.nmhdr.code = SCN_HOTSPOTRELEASECLICK; @@ -2376,10 +2364,6 @@ void Editor::NotifyHotSpotReleaseClick(Sci::Position position, int modifiers) {  	NotifyParent(scn);  } -void Editor::NotifyHotSpotReleaseClick(Sci::Position position, bool shift, bool ctrl, bool alt) { -	NotifyHotSpotReleaseClick(position, ModifierFlags(shift, ctrl, alt)); -} -  bool Editor::NotifyUpdateUI() {  	if (needUpdateUI) {  		SCNotification scn = {}; @@ -2410,10 +2394,6 @@ void Editor::NotifyIndicatorClick(bool click, Sci::Position position, int modifi  	}  } -void Editor::NotifyIndicatorClick(bool click, Sci::Position position, bool shift, bool ctrl, bool alt) { -	NotifyIndicatorClick(click, position, ModifierFlags(shift, ctrl, alt)); -} -  bool Editor::NotifyMarginClick(Point pt, int modifiers) {  	const int marginClicked = vs.MarginFromLocation(pt);  	if ((marginClicked >= 0) && vs.ms[marginClicked].sensitive) { @@ -2452,10 +2432,6 @@ bool Editor::NotifyMarginClick(Point pt, int modifiers) {  	}  } -bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) { -	return NotifyMarginClick(pt, ModifierFlags(shift, ctrl, alt)); -} -  bool Editor::NotifyMarginRightClick(Point pt, int modifiers) {  	int marginRightClicked = vs.MarginFromLocation(pt);  	if ((marginRightClicked >= 0) && vs.ms[marginRightClicked].sensitive) { @@ -3882,10 +3858,6 @@ int Editor::KeyDownWithModifiers(int key, int modifiers, bool *consumed) {  	}  } -int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) { -	return KeyDownWithModifiers(key, ModifierFlags(shift, ctrl, alt), consumed); -} -  void Editor::Indent(bool forwards) {  	UndoGroup ug(pdoc);  	for (size_t r=0; r<sel.Count(); r++) { @@ -4630,10 +4602,6 @@ void Editor::RightButtonDownWithModifiers(Point pt, unsigned int, int modifiers)  		return;  } -void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) { -	return ButtonDownWithModifiers(pt, curTime, ModifierFlags(shift, ctrl, alt)); -} -  bool Editor::PositionIsHotspot(Sci::Position position) const {  	return vs.styles[pdoc->StyleIndexAt(position)].hotspot;  } @@ -4703,7 +4671,7 @@ Range Editor::GetHotSpotRange() const {  	return hotspot;  } -void Editor::ButtonMoveWithModifiers(Point pt, int modifiers) { +void Editor::ButtonMoveWithModifiers(Point pt, unsigned int, int modifiers) {  	if ((ptMouseLast.x != pt.x) || (ptMouseLast.y != pt.y)) {  		DwellEnd(true);  	} @@ -4830,11 +4798,7 @@ void Editor::ButtonMoveWithModifiers(Point pt, int modifiers) {  	}  } -void Editor::ButtonMove(Point pt) { -	ButtonMoveWithModifiers(pt, 0); -} - -void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { +void Editor::ButtonUpWithModifiers(Point pt, unsigned int curTime, int modifiers) {  	//Platform::DebugPrintf("ButtonUp %d %d\n", HaveMouseCapture(), inDragDrop);  	SelectionPosition newPos = SPositionFromLocation(pt, false, false,  		AllowVirtualSpace(virtualSpaceOptions, sel.IsRectangular())); @@ -4851,7 +4815,7 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {  		hotSpotClickPos = INVALID_POSITION;  		SelectionPosition newCharPos = SPositionFromLocation(pt, false, true, false);  		newCharPos = MovePositionOutsideChar(newCharPos, -1); -		NotifyHotSpotReleaseClick(newCharPos.Position(), ctrl ? SCI_CTRL : 0); +		NotifyHotSpotReleaseClick(newCharPos.Position(), modifiers & SCI_CTRL);  	}  	if (HaveMouseCapture()) {  		if (PointInSelMargin(pt)) { @@ -4872,7 +4836,7 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {  			if (selStart < selEnd) {  				if (drag.Length()) {  					const int length = static_cast<int>(drag.Length()); -					if (ctrl) { +					if (modifiers & SCI_CTRL) {  						const Sci::Position lengthInserted = pdoc->InsertString(  							newPos.Position(), drag.Data(), length);  						if (lengthInserted > 0) { @@ -4929,7 +4893,7 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {  void Editor::Tick() {  	if (HaveMouseCapture()) {  		// Auto scroll -		ButtonMove(ptMouseLast); +		ButtonMoveWithModifiers(ptMouseLast, 0, 0);  	}  	if (caret.period > 0) {  		timer.ticksToWait -= timer.tickSize; @@ -4996,7 +4960,7 @@ void Editor::TickFor(TickReason reason) {  			break;  		case tickScroll:  			// Auto scroll -			ButtonMove(ptMouseLast); +			ButtonMoveWithModifiers(ptMouseLast, 0, 0);  			break;  		case tickWiden:  			SetScrollBars(); diff --git a/src/Editor.h b/src/Editor.h index 69c816270..8adcff769 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -425,19 +425,13 @@ protected:	// ScintillaBase subclass needs access to much of Editor  	void NotifySavePoint(bool isSavePoint);  	void NotifyModifyAttempt();  	virtual void NotifyDoubleClick(Point pt, int modifiers); -	virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt);  	void NotifyHotSpotClicked(Sci::Position position, int modifiers); -	void NotifyHotSpotClicked(Sci::Position position, bool shift, bool ctrl, bool alt);  	void NotifyHotSpotDoubleClicked(Sci::Position position, int modifiers); -	void NotifyHotSpotDoubleClicked(Sci::Position position, bool shift, bool ctrl, bool alt);  	void NotifyHotSpotReleaseClick(Sci::Position position, int modifiers); -	void NotifyHotSpotReleaseClick(Sci::Position position, bool shift, bool ctrl, bool alt);  	bool NotifyUpdateUI();  	void NotifyPainted();  	void NotifyIndicatorClick(bool click, Sci::Position position, int modifiers); -	void NotifyIndicatorClick(bool click, Sci::Position position, bool shift, bool ctrl, bool alt);  	bool NotifyMarginClick(Point pt, int modifiers); -	bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt);  	bool NotifyMarginRightClick(Point pt, int modifiers);  	void NotifyNeedShown(Sci::Position pos, Sci::Position len);  	void NotifyDwelling(Point pt, bool state); @@ -476,7 +470,6 @@ protected:	// ScintillaBase subclass needs access to much of Editor  	virtual int KeyCommand(unsigned int iMessage);  	virtual int KeyDefault(int /* key */, int /*modifiers*/);  	int KeyDownWithModifiers(int key, int modifiers, bool *consumed); -	int KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed=0);  	void Indent(bool forwards); @@ -510,10 +503,8 @@ protected:	// ScintillaBase subclass needs access to much of Editor  	void MouseLeave();  	virtual void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers);  	virtual void RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); -	virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); -	void ButtonMoveWithModifiers(Point pt, int modifiers); -	void ButtonMove(Point pt); -	void ButtonUp(Point pt, unsigned int curTime, bool ctrl); +	void ButtonMoveWithModifiers(Point pt, unsigned int curTime, int modifiers); +	void ButtonUpWithModifiers(Point pt, unsigned int curTime, int modifiers);  	void Tick();  	bool Idle(); diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 2da142462..0c7df04cb 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -537,10 +537,6 @@ void ScintillaBase::ButtonDownWithModifiers(Point pt, unsigned int curTime, int  	Editor::ButtonDownWithModifiers(pt, curTime, modifiers);  } -void ScintillaBase::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) { -	ButtonDownWithModifiers(pt, curTime, ModifierFlags(shift, ctrl, alt)); -} -  void ScintillaBase::RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) {  	CancelModes();  	Editor::RightButtonDownWithModifiers(pt, curTime, modifiers); diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h index 9b8f08ae3..f63cf192c 100644 --- a/src/ScintillaBase.h +++ b/src/ScintillaBase.h @@ -88,7 +88,6 @@ protected:  	void ContextMenu(Point pt);  	void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) override; -	void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) override;  	void RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) override;  	void NotifyStyleToNeeded(Sci::Position endStyleNeeded) override; | 
