X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/769a9cb2b8cca8e098a43fab7793cfbb5e987374..f33d6788d71891f91e392d33971dd93a2d231dbc:/contrib/src/stc/ScintillaWX.cpp?ds=inline diff --git a/contrib/src/stc/ScintillaWX.cpp b/contrib/src/stc/ScintillaWX.cpp index da83a4212c..6cf99b3412 100644 --- a/contrib/src/stc/ScintillaWX.cpp +++ b/contrib/src/stc/ScintillaWX.cpp @@ -14,10 +14,10 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// -#include #include "ScintillaWX.h" #include "wx/stc/stc.h" +#include "PlatWX.h" //---------------------------------------------------------------------- @@ -82,10 +82,10 @@ public: void OnPaint(wxPaintEvent& evt) { wxPaintDC dc(this); - Surface surfaceWindow; - surfaceWindow.Init(&dc); - m_ct->PaintCT(&surfaceWindow); - surfaceWindow.Release(); + Surface* surfaceWindow = Surface::Allocate(); + surfaceWindow->Init(&dc); + m_ct->PaintCT(surfaceWindow); + delete surfaceWindow; } #if wxUSE_POPUPWIN @@ -148,7 +148,7 @@ void ScintillaWX::Finalise() { void ScintillaWX::StartDrag() { #if wxUSE_DRAG_AND_DROP - wxString dragText(drag.s, drag.len); + wxString dragText(drag.s, wxConvUTF8, drag.len); // Send an event to allow the drag text to be changed wxStyledTextEvent evt(wxEVT_STC_START_DRAG, stc->GetId()); @@ -184,7 +184,7 @@ void ScintillaWX::SetTicking(bool on) { if (timer.ticking) { steTimer = new wxSTCTimer(this); steTimer->Start(timer.tickSize); - timer.tickerID = (int)steTimer; + timer.tickerID = steTimer; } else { steTimer = (wxSTCTimer*)timer.tickerID; steTimer->Stop(); @@ -296,7 +296,8 @@ void ScintillaWX::Copy() { SelectionText st; CopySelectionRange(&st); wxTheClipboard->Open(); - wxTheClipboard->SetData(new wxTextDataObject(wxString(st.s, st.len))); + wxString text(st.s, wxConvUTF8, st.len); + wxTheClipboard->SetData(new wxTextDataObject(text)); wxTheClipboard->Close(); } } @@ -313,9 +314,9 @@ void ScintillaWX::Paste() { gotData = wxTheClipboard->GetData(data); wxTheClipboard->Close(); if (gotData) { - wxString str = data.GetText(); - int len = str.Length(); - pdoc->InsertString(currentPos, str.c_str(), len); + wxWX2MBbuf buf = (wxWX2MBbuf)data.GetText().mb_str(wxConvUTF8); + int len = strlen(buf); + pdoc->InsertString(currentPos, buf, len); SetEmptySelection(currentPos + len); } @@ -329,7 +330,7 @@ bool ScintillaWX::CanPaste() { bool canPaste; wxTheClipboard->Open(); - canPaste = wxTheClipboard->IsSupported( wxDF_TEXT ); + canPaste = wxTheClipboard->IsSupported(wxUSE_UNICODE ? wxDF_UNICODETEXT : wxDF_TEXT); wxTheClipboard->Close(); return canPaste; @@ -343,12 +344,12 @@ void ScintillaWX::CreateCallTipWindow(PRectangle) { void ScintillaWX::AddToPopUp(const char *label, int cmd, bool enabled) { if (!label[0]) - popup.GetID()->AppendSeparator(); + ((wxMenu*)popup.GetID())->AppendSeparator(); else - popup.GetID()->Append(cmd, label); + ((wxMenu*)popup.GetID())->Append(cmd, wxString(label, *wxConvCurrent)); if (!enabled) - popup.GetID()->Enable(cmd, enabled); + ((wxMenu*)popup.GetID())->Enable(cmd, enabled); } @@ -379,13 +380,13 @@ long ScintillaWX::WndProc(unsigned int iMessage, unsigned long wParam, long lPar void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) { paintState = painting; - Surface surfaceWindow; - surfaceWindow.Init(dc); + Surface* surfaceWindow = Surface::Allocate(); + surfaceWindow->Init(dc); PRectangle rcPaint = PRectangleFromwxRect(rect); dc->BeginDrawing(); - Paint(&surfaceWindow, rcPaint); + Paint(surfaceWindow, rcPaint); dc->EndDrawing(); - surfaceWindow.Release(); + delete surfaceWindow; if (paintState == paintAbandoned) { // Painting area was insufficient to cover new styling or brace highlight positions FullPaint(); @@ -466,9 +467,10 @@ void ScintillaWX::DoMouseWheel(int rotation, int delta, int linesPerAction, int void ScintillaWX::DoSize(int width, int height) { - PRectangle rcClient(0,0,width,height); - SetScrollBarsTo(rcClient); - DropGraphics(); +// PRectangle rcClient(0,0,width,height); +// SetScrollBarsTo(rcClient); +// DropGraphics(); + ChangeSize(); } void ScintillaWX::DoLoseFocus(){ @@ -496,8 +498,8 @@ void ScintillaWX::DoButtonMove(Point pt) { } -void ScintillaWX::DoAddChar(char ch) { - AddChar(ch); +void ScintillaWX::DoAddChar(int key) { + AddChar(key); } int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed) { @@ -578,7 +580,7 @@ bool ScintillaWX::DoDropText(long x, long y, const wxString& data) { dragResult = evt.GetDragResult(); if (dragResult == wxDragMove || dragResult == wxDragCopy) { DropAt(evt.GetPosition(), - evt.GetDragText(), + evt.GetDragText().mb_str(wxConvUTF8), dragResult == wxDragMove, FALSE); // TODO: rectangular? return TRUE; @@ -622,10 +624,10 @@ void ScintillaWX::FullPaint() { rcPaint = GetTextRectangle(); paintingAllText = true; wxClientDC dc(stc); - Surface surfaceWindow; - surfaceWindow.Init(&dc); - Paint(&surfaceWindow, rcPaint); - surfaceWindow.Release(); + Surface* surfaceWindow = Surface::Allocate(); + surfaceWindow->Init(&dc); + Paint(surfaceWindow, rcPaint); + delete surfaceWindow; // stc->Refresh(FALSE);