1
/***************************************************************
3
* Purpose: Code::Blocks plugin
7
**************************************************************/
8
// This plugin emulates Linux GPM functions within the editors in linux and msWindows.
9
// If selected text, paste selected text at current cursor position
10
// If selected text, and user middle-clicks inside selection, copy to clipboard
11
// If no selected text, paste clipboard data at cursor position
12
// If selected text, and user switches editors, copy selection to clipboard
14
#if defined(__GNUG__) && !defined(__APPLE__)
15
#pragma implementation "MouseSap.h"
22
#include <wx/listctrl.h>
24
#include "configmanager.h"
25
#include "editormanager.h"
27
#include "personalitymanager.h"
28
#include "sdk_events.h" // EVT_APP_STARTUP_DONE
31
#include <wx/fileconf.h> // wxFileConfig
32
#include <wx/clipbrd.h>
33
#include <wx/strconv.h>
34
#include "cbstyledtextctrl.h"
37
#if defined(__WXGTK__)
38
// hack to avoid name-conflict between wxWidgets GSocket and the one defined
39
// in newer glib-headers
40
#define GSocket GLibSocket
45
// Register the plugin
48
PluginRegistrant<MouseSap> reg(_T("MouseSap"));
51
int ID_DLG_DONE = wxNewId();
53
// ----------------------------------------------------------------------------
54
BEGIN_EVENT_TABLE(MouseSap, cbPlugin)
57
// ----------------------------------------------------------------------------
59
// ----------------------------------------------------------------------------
60
// global used by mouse events to get user configuration settings
61
// and plugin routine support
62
MouseSap* MouseSap::pMouseSap;
64
// ----------------------------------------------------------------------------
66
// ----------------------------------------------------------------------------
69
// anchor to this one and only object
72
// ----------------------------------------------------------------------------
74
// ----------------------------------------------------------------------------
79
// ----------------------------------------------------------------------------
80
void MouseSap::OnAttach()
81
// ----------------------------------------------------------------------------
83
// do whatever initialization you need for your plugin
84
// NOTE: after this function, the inherited member variable
85
// IsAttached() will be TRUE...
86
// You should check for it in other functions, because if it
87
// is FALSE, it means that the application did *not* "load"
88
// (see: does not need) this plugin...
93
wxWindow* pcbWindow = Manager::Get()->GetAppWindow();
94
m_pMS_Window = pcbWindow;
96
wxLog::EnableLogging(true);
97
/*wxLogWindow**/ m_pMyLog = new wxLogWindow(pcbWindow, wxT("MouseSap"), true, false);
98
wxLog::SetActiveTarget(m_pMyLog);
100
m_pMyLog->GetFrame()->Move(20,20);
101
wxLogMessage(_T("Logging MouseSap version %s"),wxString(wxT(VERSION)).c_str());
104
// names of windows we're allowed to attach
105
m_UsableWindows.Add(_T("sciwindow"));
107
m_bMouseSapEnabled = true;
109
// Create filename like MouseSap.ini
110
//memorize the key file name as {%HOME%}\MouseSap.ini
111
m_ConfigFolder = ConfigManager::GetConfigFolder();
112
m_DataFolder = ConfigManager::GetDataFolder();
113
m_ExecuteFolder = FindAppPath(wxTheApp->argv[0], ::wxGetCwd(), wxEmptyString);
115
//GTK GetConfigFolder is returning double "//?, eg, "/home/pecan//.codeblocks"
116
// remove the double //s from filename //+v0.4.11
117
m_ConfigFolder.Replace(_T("//"),_T("/"));
118
m_ExecuteFolder.Replace(_T("//"),_T("/"));
120
// get the CodeBlocks "personality" argument
121
wxString m_Personality = Manager::Get()->GetPersonalityManager()->GetPersonality();
122
if (m_Personality == wxT("default")) m_Personality = wxEmptyString;
123
LOGIT( _T("Personality is[%s]"), m_Personality.GetData() );
125
// if MouseSap.ini is in the executable folder, use it
126
// else use the default config folder
127
m_CfgFilenameStr = m_ExecuteFolder + wxFILE_SEP_PATH;
128
if (not m_Personality.IsEmpty()) m_CfgFilenameStr << m_Personality + wxT(".") ;
129
m_CfgFilenameStr << _T("MouseSap.ini");
131
if (::wxFileExists(m_CfgFilenameStr)) {;/*OK Use exe path*/}
132
else //use the default.conf folder
133
{ m_CfgFilenameStr = m_ConfigFolder + wxFILE_SEP_PATH;
134
if (not m_Personality.IsEmpty()) m_CfgFilenameStr << m_Personality + wxT(".") ;
135
m_CfgFilenameStr << _T("MouseSap.ini");
137
//LOGIT(_T("MouseSap Config Filename:[%s]"), m_CfgFilenameStr.GetData());
138
// read configuaton file
139
//wxFileConfig cfgFile(wxEmptyString, // appname
140
// wxEmptyString, // vendor
141
// m_CfgFilenameStr, // local filename
142
// wxEmptyString, // global file
143
// wxCONFIG_USE_LOCAL_FILE);
145
//cfgFile.Read(_T("MouseSapEnabled"), &MouseSapEnabled ) ;
147
// Pointer to "Search Results" Window (first listCtrl window)
149
// Catch creation of windows
150
Connect( wxEVT_CREATE,
151
(wxObjectEventFunction) (wxEventFunction)
152
(wxCommandEventFunction) &MouseSap::OnWindowOpen);
154
// Catch Destroyed windows
155
Connect( wxEVT_DESTROY,
156
(wxObjectEventFunction) (wxEventFunction)
157
(wxCommandEventFunction) &MouseSap::OnWindowClose);
159
// Set current plugin version
160
PluginInfo* pInfo = (PluginInfo*)(Manager::Get()->GetPluginManager()->GetPluginInfo(this));
161
pInfo->version = wxT(VERSION);
163
// register event sink AppStartupDone
164
Manager::Get()->RegisterEventSink(cbEVT_APP_STARTUP_DONE, new cbEventFunctor<MouseSap, CodeBlocksEvent>(this, &MouseSap::OnAppStartupDone));
168
// ----------------------------------------------------------------------------
169
void MouseSap::OnRelease(bool appShutDown)
170
// ----------------------------------------------------------------------------
172
// do de-initialization for your plugin
173
// if appShutDown is false, the plugin is unloaded because Code::Blocks is being shut down,
174
// which means you must not use any of the SDK Managers
175
// NOTE: after this function, the inherited member variable
176
// IsAttached() will be FALSE...
178
// Remove all Mouse event handlers
181
// deleting the log crashes CB on exit
186
delete m_pMMSapEvents;
188
m_bMouseSapEnabled = false;
190
// ----------------------------------------------------------------------------
191
cbConfigurationPanel* MouseSap::GetConfigurationPanel(wxWindow* parent)
192
// ----------------------------------------------------------------------------
194
//create and display the configuration dialog for your plugin
197
// ----------------------------------------------------------------------------
198
bool MouseSap::IsAttachedTo(wxWindow* p)
199
// ----------------------------------------------------------------------------
201
if ( wxNOT_FOUND == m_EditorPtrs.Index(p))
206
// ----------------------------------------------------------------------------
207
void MouseSap::Attach(wxWindow *p)
208
// ----------------------------------------------------------------------------{
210
if (!p || IsAttachedTo(p))
211
return; // already attached !!!
213
// allow only static windows to be attached by codeblocks
214
// Disappearing frames/windows cause crashes
215
// eg., wxArrayString m_UsableWindows = "sciwindow notebook";
217
wxString windowName = p->GetName().MakeLower();
219
if (wxNOT_FOUND == m_UsableWindows.Index(windowName,false))
222
LOGIT(wxT("MMSap::Attach skipping [%s]"), p->GetName().c_str());
228
LOGIT(wxT("MMSap::Attach - attaching to [%s] %p"), p->GetName().c_str(),p);
231
//add window to our array, attach a mouse event handler
233
if ( not m_pMMSapEvents ) m_pMMSapEvents = new MMSapEvents(p);
234
MMSapEvents* thisEvtHndlr = m_pMMSapEvents;
236
p->Connect(wxEVT_MIDDLE_DOWN,
237
(wxObjectEventFunction)(wxEventFunction)
238
(wxMouseEventFunction)&MMSapEvents::OnMouseEvent,
240
p->Connect(wxEVT_MIDDLE_UP,
241
(wxObjectEventFunction)(wxEventFunction)
242
(wxMouseEventFunction)&MMSapEvents::OnMouseEvent,
244
p->Connect(wxEVT_KILL_FOCUS ,
245
(wxObjectEventFunction)(wxEventFunction)
246
(wxFocusEventFunction)&MMSapEvents::OnKillFocusEvent,
249
LOGIT(_T("MMSap:Attach Window:%p Handler:%p"), p,thisEvtHndlr);
253
// ----------------------------------------------------------------------------
254
void MouseSap::AttachRecursively(wxWindow *p)
255
// ----------------------------------------------------------------------------{
262
// this is the standard way wxWidgets uses to iterate through children...
263
for (wxWindowList::compatibility_iterator node = p->GetChildren().GetFirst();
265
node = node->GetNext())
267
// recursively attach each child
268
wxWindow *win = (wxWindow *)node->GetData();
271
AttachRecursively(win);
274
// ----------------------------------------------------------------------------
275
wxWindow* MouseSap::FindWindowRecursively(const wxWindow* parent, const wxWindow* handle)
276
// ----------------------------------------------------------------------------{
280
// see if this is the one we're looking for
281
if ( parent == handle )
282
return (wxWindow *)parent;
284
// It wasn't, so check all its children
285
for ( wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst();
287
node = node->GetNext() )
289
// recursively check each child
290
wxWindow *win = (wxWindow *)node->GetData();
291
wxWindow *retwin = FindWindowRecursively(win, handle);
300
// ----------------------------------------------------------------------------
301
wxWindow* MouseSap::winExists(wxWindow *parent)
302
// ----------------------------------------------------------------------------{
310
// start at very top of wx's windows
311
for ( wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
313
node = node->GetNext() )
315
// recursively check each window & its children
316
wxWindow* win = node->GetData();
317
wxWindow* retwin = FindWindowRecursively(win, parent);
324
// ----------------------------------------------------------------------------
325
void MouseSap::Detach(wxWindow* thisEditor)
326
// ----------------------------------------------------------------------------
328
if ( (thisEditor) && (m_EditorPtrs.Index(thisEditor) != wxNOT_FOUND))
331
LOGIT(_T("MMSap:Detaching %p"), thisEditor);
334
MMSapEvents* thisEvtHandler = m_pMMSapEvents;
335
m_EditorPtrs.Remove(thisEditor);
337
// If win already deleted, dont worry about receiving events
338
if ( not winExists(thisEditor) )
341
LOGIT(_T("MMSap:DetachAll window NOT found %p"), thisEditor);
344
thisEditor->Disconnect(wxEVT_MIDDLE_DOWN,
345
(wxObjectEventFunction)(wxEventFunction)
346
(wxMouseEventFunction)&MMSapEvents::OnMouseEvent,
347
NULL, thisEvtHandler);
348
thisEditor->Disconnect(wxEVT_MIDDLE_UP,
349
(wxObjectEventFunction)(wxEventFunction)
350
(wxMouseEventFunction)&MMSapEvents::OnMouseEvent,
351
NULL, thisEvtHandler);
352
thisEditor->Disconnect(wxEVT_KILL_FOCUS ,
353
(wxObjectEventFunction)(wxEventFunction)
354
(wxFocusEventFunction)&MMSapEvents::OnKillFocusEvent,
355
NULL, thisEvtHandler);
360
LOGIT(_T("Detach: Editor:%p EvtHndlr: %p"),thisEditor,thisEvtHandler);
364
// ----------------------------------------------------------------------------
365
void MouseSap::DetachAll()
366
// ----------------------------------------------------------------------------
368
// delete all handlers
370
LOGIT(wxT("MMSap:DetachAll - detaching all [%d] targets"),m_EditorPtrs.GetCount() );
373
// Detach from memorized windows and remove event handlers
374
while( m_EditorPtrs.GetCount() )
376
wxWindow* pw = (wxWindow*)m_EditorPtrs.Item(0);
380
m_EditorPtrs.Empty();
382
// say no windows attached
383
m_bEditorsAttached = false;
387
// ----------------------------------------------------------------------------
388
wxString MouseSap::FindAppPath(const wxString& argv0, const wxString& cwd, const wxString& appVariableName)
389
// ----------------------------------------------------------------------------
391
// Find the absolute path where this application has been run from.
392
// argv0 is wxTheApp->argv[0]
393
// cwd is the current working directory (at startup)
394
// appVariableName is the name of a variable containing the directory for this app, e.g.
395
// MYAPPDIR. This is checked first.
399
// Try appVariableName
400
if (!appVariableName.IsEmpty())
402
str = wxGetenv(appVariableName);
407
#if defined(__WXMAC__) && !defined(__DARWIN__)
408
// On Mac, the current directory is the relevant one when
409
// the application starts.
413
if (wxIsAbsolutePath(argv0))
414
return wxPathOnly(argv0);
417
// Is it a relative path?
418
wxString currentDir(cwd);
419
if (currentDir.Last() != wxFILE_SEP_PATH)
420
currentDir += wxFILE_SEP_PATH;
422
str = currentDir + argv0;
423
if (wxFileExists(str))
424
return wxPathOnly(str);
427
// OK, it's neither an absolute path nor a relative path.
431
pathList.AddEnvList(wxT("PATH"));
432
str = pathList.FindAbsoluteValidPath(argv0);
434
return wxPathOnly(str);
437
return wxEmptyString;
439
// ----------------------------------------------------------------------------
440
// MouseSap Routines to push/remove mouse event handlers
441
// ----------------------------------------------------------------------------
442
void MouseSap::OnAppStartupDone(CodeBlocksEvent& event)
443
// ----------------------------------------------------------------------------
445
// EVT_APP_STARTUP_DONE
448
LOGIT(_T("MouseSap::AppStartupDone"));
451
OnAppStartupDoneInit();
456
// ----------------------------------------------------------------------------
457
void MouseSap::OnAppStartupDoneInit()
458
// ----------------------------------------------------------------------------
460
if (not GetMouseSapEnabled() ) //v04.14
463
if (! m_bEditorsAttached)
465
AttachRecursively(Manager::Get()->GetAppWindow());
466
m_bEditorsAttached = true;
469
// ----------------------------------------------------------------------------
470
void MouseSap::OnWindowOpen(wxEvent& event)
471
// ----------------------------------------------------------------------------
473
// wxEVT_CREATE entry
474
// Have to do this especially for split windows since CodeBlocks does not have
475
// events when opening/closing split windows
477
wxWindow* pWindow = (wxWindow*)(event.GetEventObject());
479
// Some code (at times) is not issuing event EVT_APP_STARTUP_DONE
480
// so here we do it ourselves. If not initialized and this is the first
481
// scintilla window, initialize now.
482
if ( (not m_bEditorsAttached)
483
&& ( pWindow->GetName().Lower() == wxT("sciwindow")) )
484
OnAppStartupDoneInit();
486
// Attach a split window (or any other window)
487
if ( m_bEditorsAttached )
489
wxWindow* pWindow = (wxWindow*)(event.GetEventObject());
491
ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
494
if (pWindow->GetParent() == ed)
497
LOGIT( _T("OnWindowOpen Attached:%p name: %s"),
498
pWindow, pWindow->GetName().GetData() );
506
// ----------------------------------------------------------------------------
507
void MouseSap::OnWindowClose(wxEvent& event)
508
// ----------------------------------------------------------------------------
510
// wxEVT_DESTROY entry
512
wxWindow* pWindow = (wxWindow*)(event.GetEventObject());
514
if ( (pWindow) && (m_EditorPtrs.Index(pWindow) != wxNOT_FOUND))
515
{ // window is one of ours
518
LOGIT( _T("OnWindowClose Detached %p"), pWindow);
523
////////////////////////////////////////////////////////////////////////////////
524
// ----------------------------------------------------------------------------
525
// MOUSE Select and Paste Events
526
// ----------------------------------------------------------------------------
527
///////////////////////////////////////////////////////////////////////////////
528
BEGIN_EVENT_TABLE(MMSapEvents, wxEvtHandler)
529
//-Deprecated- EVT_MOUSE_EVENTS( MMSapEvents::OnMouseEvent)
530
// Using Connect/Disconnect events and EVT_CREATE/EVT_DESTROY
531
// wxWidgets events since split-windows were
532
// introduced without providing codeblocks events to plugins.
533
// Without CB events, event handlers were being leaked for each split
536
// ----------------------------------------------------------------------------
537
MMSapEvents::~MMSapEvents()
538
// ----------------------------------------------------------------------------
541
LOGIT(_T("MMSapEvents dtor"));
546
// ----------------------------------------------------------------------------
547
void MMSapEvents::OnMouseEvent(wxMouseEvent& event) //MSW
548
// ----------------------------------------------------------------------------
551
//remember event window pointer
552
//-wxObject* pEvtObject = event.GetEventObject();
553
int eventType = event.GetEventType();
555
#if defined(__WXMSW__)
556
// Why is an event getting in here when this window doesnt have the OS focus
557
MouseSap* pMMSap = MouseSap::pMouseSap;
558
if (::wxGetActiveWindow() != pMMSap->m_pMS_Window)
559
{event.Skip(); return;}
562
// differentiate window, left, right split window
564
cbStyledTextCtrl* pControl = 0;
565
cbStyledTextCtrl* pLeftSplitWin = 0;
566
cbStyledTextCtrl* pRightSplitWin = 0;
568
ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
569
if ( not ed ) { event.Skip(); return; }
571
pControl = ed->GetControl();
572
// editor must have the current focus
573
if ( pControl not_eq wxWindow::FindFocus() )
574
{ event.Skip(); return; }
576
pLeftSplitWin = ed->GetLeftSplitViewControl();
577
pRightSplitWin = ed->GetRightSplitViewControl();
580
//LOGIT(_T("OnMouseSap[%d]"), eventType);
583
if ( eventType == wxEVT_MIDDLE_DOWN)
585
OnMiddleMouseDown( event, pControl );
589
else if ( eventType == wxEVT_MIDDLE_UP )
590
{ // We have to return so we can preserve the selection on gtk
594
// pass the event onward
598
// ----------------------------------------------------------------------------
599
void MMSapEvents::OnMiddleMouseDown(wxMouseEvent& event, cbStyledTextCtrl* ed)
600
// ----------------------------------------------------------------------------
602
// If selected text, paste selected text at current cursor position
603
// If selected text, and user middle-clicks inside selection, copy to clipboard
604
// If no selected text, paste clipboard data at cursor position
606
int pos = ed->PositionFromPoint(wxPoint(event.GetX(), event.GetY()));
608
if(pos == wxSCI_INVALID_POSITION)
611
int start = ed->GetSelectionStart();
612
int end = ed->GetSelectionEnd();
614
const wxString selectedText = ed->GetSelectedText();
616
// If no current selection, or shift key is down, use paste from the clipboard
617
bool shiftKeyState = ::wxGetKeyState(WXK_SHIFT);
619
if ( shiftKeyState || selectedText.IsEmpty() )
621
PasteFromClipboard( event, ed, shiftKeyState );
625
//if user middle-clicked inside the selection, copy to clipboard
626
if ( (pos >= start) && (pos <= end) )
628
#if defined(__WXGTK__)
629
gtk_clipboard_set_text(
630
gtk_clipboard_get(GDK_SELECTION_PRIMARY),
631
selectedText.mb_str(wxConvUTF8),
632
selectedText.Length() );
634
if (wxTheClipboard->Open())
636
wxTheClipboard->AddData(new wxTextDataObject(selectedText));
637
wxTheClipboard->Close();
643
if(pos < ed->GetCurrentPos())
645
start += selectedText.length();
646
end += selectedText.length();
650
//LOGIT( _T("pos,start,end[%d][%d][%d]"), pos, start, end);
653
// paste selected text at current cursor position
654
ed->InsertText(pos, selectedText);
655
//-SetSelection(start, end);
657
ed->SetSelectionVoid(pos, pos+selectedText.length());
659
LOGIT( _T("OnMiddleMouseDown[%s]"), selectedText.c_str());
663
// ----------------------------------------------------------------------------
664
void MMSapEvents::PasteFromClipboard( wxMouseEvent& event, cbStyledTextCtrl* ed, bool shiftKeyState )
665
// ----------------------------------------------------------------------------
667
// Set the current position to the mouse click point and
668
// then paste in the PRIMARY selection, if any.
671
LOGIT( _T("MMSapEvents pasting from Clipboard"));
674
int pos = ed->PositionFromPoint(wxPoint(event.GetX(), event.GetY()));
675
if(pos == wxSCI_INVALID_POSITION)
678
int start = ed->GetSelectionStart();
679
int end = ed->GetSelectionEnd();
681
wxTextDataObject data;
682
bool gotData = false;
683
if (wxTheClipboard->Open())
685
wxTheClipboard->UsePrimarySelection(true);
686
gotData = wxTheClipboard->GetData(data);
687
wxTheClipboard->UsePrimarySelection(false);
688
wxTheClipboard->Close();
692
wxString text = data.GetText() ;
695
&& ((pos >= start) && (pos <= end) ) )
697
//-ed->Paste(); does not work on linux
698
ed->SetTargetStart(start);
699
ed->SetTargetEnd(end);
700
ed->ReplaceTarget(text);
705
ed->InsertText(pos, text);
706
ed->SetSelectionVoid(pos, pos + text.Length());
711
// ----------------------------------------------------------------------------
712
void MMSapEvents::OnKillFocusEvent( wxFocusEvent& event )
713
// ----------------------------------------------------------------------------
715
//For GTK, we copy the selected text to the PRIMARY clipboard
716
// when we lose the focus
718
#if not defined(__WXGTK__)
719
event.Skip(); return;
722
// If selected text, copy to clipboard
724
//remember event window pointer
725
wxObject* pEvtObject = event.GetEventObject();
727
cbStyledTextCtrl* pControl = 0;
729
wxString selectedText = wxEmptyString;
730
if ( ((wxWindow*)pEvtObject)->GetName().Lower() == _T("sciwindow") )
731
{ ed = (cbEditor*)((wxWindow*)pEvtObject)->GetParent();
732
pControl = (cbStyledTextCtrl*)pEvtObject;
737
if ( not MouseSap::pMouseSap->IsAttachedTo( pControl ) )
740
selectedText = pControl->GetSelectedText();
741
if ( selectedText.IsEmpty() )
744
#if defined(__WXGTK__)
745
gtk_clipboard_set_text(
746
gtk_clipboard_get(GDK_SELECTION_PRIMARY),
747
selectedText.mb_str(wxConvUTF8),
748
selectedText.Length() );
749
#else //__WXMSW__ //testing
750
if (wxTheClipboard->Open())
752
wxTheClipboard->AddData(new wxTextDataObject(selectedText));
753
wxTheClipboard->Close();
759
if (ed && pControl && (not selectedText.IsEmpty()))
760
LOGIT( _T("OnKillFocus[%s][%s]"), ed->GetTitle().c_str(),selectedText.c_str());
767
// ----------------------------------------------------------------------------
768
void MMSapEvents::DumpClipboard()
769
// ----------------------------------------------------------------------------
772
wxTextDataObject primaryData;
773
wxTextDataObject normalData;
774
bool gotPrimaryData = false;
775
bool gotNormalData = false;
776
wxString primaryText = wxEmptyString;
777
wxString normalText = wxEmptyString;
779
if (wxTheClipboard->Open())
781
wxTheClipboard->UsePrimarySelection(true);
782
gotPrimaryData = wxTheClipboard->GetData(primaryData);
783
wxTheClipboard->UsePrimarySelection(false);
784
gotNormalData = wxTheClipboard->GetData(normalData);
785
wxTheClipboard->Close();
788
LOGIT(wxT("DumpClipboard: failed to open"));
793
primaryText = primaryData.GetText() ;
795
normalText = normalData.GetText() ;
796
LOGIT(wxT("Clipboard Primary[%s]"), primaryText.c_str() );
797
LOGIT(wxT("Clipboard Normal[%s]"), normalText.c_str() );
798
#endif //defined(LOGGING)
800
///////////////////////////////////////////////////////////////////////////////////
801
// The way Scintilla does GPM
802
///////////////////////////////////////////////////////////////////////////////////
804
////void ScintillaWX::DoMiddleButtonUp(Point pt) {
805
//// // Set the current position to the mouse click point and
806
//// // then paste in the PRIMARY selection, if any. wxGTK only.
807
//// int newPos = PositionFromLocation(pt);
808
//// MovePositionTo(newPos, noSel, true);
810
//// pdoc->BeginUndoAction();
811
//// wxTextDataObject data;
812
//// bool gotData = false;
813
//// if (wxTheClipboard->Open()) {
814
//// wxTheClipboard->UsePrimarySelection(true);
815
//// gotData = wxTheClipboard->GetData(data);
816
//// wxTheClipboard->UsePrimarySelection(false);
817
//// wxTheClipboard->Close();
820
//// wxString text = wxTextBuffer::Translate(data.GetText(),
821
//// wxConvertEOLMode(pdoc->eolMode));
822
//// wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
823
//// int len = strlen(buf);
824
//// pdoc->InsertString(currentPos, buf, len);
825
//// SetEmptySelection(currentPos + len);
827
//// pdoc->EndUndoAction();
831
//// ShowCaretAtCurrentPosition();
832
//// EnsureCaretVisible();
835
////void ScintillaWX::DoMiddleButtonUp(Point WXUNUSED(pt)) {