]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/stc/ScintillaWX.cpp
Don't set the longhelp in the statusbar if there isn't one.
[wxWidgets.git] / contrib / src / stc / ScintillaWX.cpp
index da83a4212ca6d890cfc40652ca30672c03026bf4..6cf99b341221b55d47308b66bfc274084c94abb6 100644 (file)
 // Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
 // Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
-#include <ctype.h>
 
 #include "ScintillaWX.h"
 #include "wx/stc/stc.h"
 
 #include "ScintillaWX.h"
 #include "wx/stc/stc.h"
+#include "PlatWX.h"
 
 
 //----------------------------------------------------------------------
 
 
 //----------------------------------------------------------------------
@@ -82,10 +82,10 @@ public:
 
     void OnPaint(wxPaintEvent& evt) {
         wxPaintDC dc(this);
 
     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
     }
 
 #if wxUSE_POPUPWIN
@@ -148,7 +148,7 @@ void ScintillaWX::Finalise() {
 
 void ScintillaWX::StartDrag() {
 #if wxUSE_DRAG_AND_DROP
 
 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());
 
     // 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);
         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();
         } else {
             steTimer = (wxSTCTimer*)timer.tickerID;
             steTimer->Stop();
@@ -296,7 +296,8 @@ void ScintillaWX::Copy() {
         SelectionText st;
         CopySelectionRange(&st);
         wxTheClipboard->Open();
         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();
     }
 }
         wxTheClipboard->Close();
     }
 }
@@ -313,9 +314,9 @@ void ScintillaWX::Paste() {
     gotData = wxTheClipboard->GetData(data);
     wxTheClipboard->Close();
     if (gotData) {
     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);
     }
 
         SetEmptySelection(currentPos + len);
     }
 
@@ -329,7 +330,7 @@ bool ScintillaWX::CanPaste() {
     bool canPaste;
 
     wxTheClipboard->Open();
     bool canPaste;
 
     wxTheClipboard->Open();
-    canPaste = wxTheClipboard->IsSupported( wxDF_TEXT );
+    canPaste = wxTheClipboard->IsSupported(wxUSE_UNICODE ? wxDF_UNICODETEXT : wxDF_TEXT);
     wxTheClipboard->Close();
 
     return canPaste;
     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])
 
 void ScintillaWX::AddToPopUp(const char *label, int cmd, bool enabled) {
     if (!label[0])
-        popup.GetID()->AppendSeparator();
+        ((wxMenu*)popup.GetID())->AppendSeparator();
     else
     else
-        popup.GetID()->Append(cmd, label);
+        ((wxMenu*)popup.GetID())->Append(cmd, wxString(label, *wxConvCurrent));
 
     if (!enabled)
 
     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;
 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();
     PRectangle rcPaint = PRectangleFromwxRect(rect);
     dc->BeginDrawing();
-    Paint(&surfaceWindow, rcPaint);
+    Paint(surfaceWindow, rcPaint);
     dc->EndDrawing();
     dc->EndDrawing();
-    surfaceWindow.Release();
+    delete surfaceWindow;
     if (paintState == paintAbandoned) {
         // Painting area was insufficient to cover new styling or brace highlight positions
         FullPaint();
     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) {
 
 
 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(){
 }
 
 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) {
 }
 
 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(),
     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;
                dragResult == wxDragMove,
                FALSE); // TODO: rectangular?
         return TRUE;
@@ -622,10 +624,10 @@ void ScintillaWX::FullPaint() {
     rcPaint = GetTextRectangle();
     paintingAllText = true;
     wxClientDC dc(stc);
     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);
 
 
 //     stc->Refresh(FALSE);