Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: CodeEditor, Assist++, Topic++ » [Feature+Patch] CodeEditor: On mouse middle button click, paste selected or copied text.
[Feature+Patch] CodeEditor: On mouse middle button click, paste selected or copied text. [message #52910] Sat, 11 January 2020 17:48
omari is currently offline  omari
Messages: 264
Registered: March 2010
Experienced Member
CodeEditor.h
	virtual void  MouseLeave();
	virtual void  MouseWheel(Point p, int zdelta, dword keyFlags);
+	virtual void  MiddleDown(Point p, dword keyflags);



CodeEditor.cpp
void Upp::CodeEditor::MiddleDown(Point p, dword keyflags)
{
	auto ShowTip = [this](Point p, String txt)
	{
		static ToolTip tip;
		
		if(tip.IsOpen())
			tip.Close();
		
		tip.Set(txt);
		tip.PopUp(this, p + GetVisibleScreenView().TopLeft(), true);
		SetTimeCallback(700, [&]{GuiLock _;tip.Close();});
	};
	
	int64 l, h;
	if(GetSelection(l, h)) {
		int pos = GetMousePos32(p);
		Insert(pos, GetSelectionW());
		if(pos <= l){
			int d = h - l;
			l = h;
			h += d;
		}
		else if(pos < h){
			h += h - l;
		}
		
		SetSelection(l, h);
		Refresh();
		ShowTip(p, ".    Inserting Selected text   ");
	}
	else {
		WString s = ReadClipboardUnicodeText();
		if(s.GetCount()) {
			int pos = GetMousePos32(p);
			Insert(pos, s);
			Refresh();
			ShowTip(p, ".    Inserting Clipboard text   ");
		}
	}
}


regards
omari.
Previous Topic: Show privates methods differently
Next Topic: [Feature+Patch] CodeEditor: Text Highlighting
Goto Forum:
  


Current Time: Tue Apr 16 10:11:25 CEST 2024

Total time taken to generate the page: 0.02149 seconds