Copied/merged from the 2.2 branch.
Changes needed to build with new event system git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9375 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -325,57 +325,41 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
|
|||||||
|
|
||||||
void ScintillaWX::DoHScroll(int type, int pos) {
|
void ScintillaWX::DoHScroll(int type, int pos) {
|
||||||
int xPos = xOffset;
|
int xPos = xOffset;
|
||||||
switch (type) {
|
if (type == wxEVT_SCROLLWIN_LINEUP)
|
||||||
case wxEVT_SCROLLWIN_LINEUP:
|
|
||||||
xPos -= H_SCROLL_STEP;
|
xPos -= H_SCROLL_STEP;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_LINEDOWN)
|
||||||
case wxEVT_SCROLLWIN_LINEDOWN:
|
|
||||||
xPos += H_SCROLL_STEP;
|
xPos += H_SCROLL_STEP;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_PAGEUP)
|
||||||
case wxEVT_SCROLLWIN_PAGEUP:
|
|
||||||
xPos -= H_SCROLL_PAGE;
|
xPos -= H_SCROLL_PAGE;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_PAGEDOWN)
|
||||||
case wxEVT_SCROLLWIN_PAGEDOWN:
|
|
||||||
xPos += H_SCROLL_PAGE;
|
xPos += H_SCROLL_PAGE;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_TOP)
|
||||||
case wxEVT_SCROLLWIN_TOP:
|
|
||||||
xPos = 0;
|
xPos = 0;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_BOTTOM)
|
||||||
case wxEVT_SCROLLWIN_BOTTOM:
|
|
||||||
xPos = H_SCROLL_MAX;
|
xPos = H_SCROLL_MAX;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_THUMBTRACK)
|
||||||
case wxEVT_SCROLLWIN_THUMBTRACK:
|
|
||||||
xPos = pos;
|
xPos = pos;
|
||||||
break;
|
|
||||||
}
|
|
||||||
HorizontalScrollTo(xPos);
|
HorizontalScrollTo(xPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScintillaWX::DoVScroll(int type, int pos) {
|
void ScintillaWX::DoVScroll(int type, int pos) {
|
||||||
int topLineNew = topLine;
|
int topLineNew = topLine;
|
||||||
switch (type) {
|
if (type == wxEVT_SCROLLWIN_LINEUP)
|
||||||
case wxEVT_SCROLLWIN_LINEUP:
|
|
||||||
topLineNew -= 1;
|
topLineNew -= 1;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_LINEDOWN)
|
||||||
case wxEVT_SCROLLWIN_LINEDOWN:
|
|
||||||
topLineNew += 1;
|
topLineNew += 1;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_PAGEUP)
|
||||||
case wxEVT_SCROLLWIN_PAGEUP:
|
|
||||||
topLineNew -= LinesToScroll();
|
topLineNew -= LinesToScroll();
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_PAGEDOWN)
|
||||||
case wxEVT_SCROLLWIN_PAGEDOWN:
|
|
||||||
topLineNew += LinesToScroll();
|
topLineNew += LinesToScroll();
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_TOP)
|
||||||
case wxEVT_SCROLLWIN_TOP:
|
|
||||||
topLineNew = 0;
|
topLineNew = 0;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_BOTTOM)
|
||||||
case wxEVT_SCROLLWIN_BOTTOM:
|
|
||||||
topLineNew = MaxScrollPos();
|
topLineNew = MaxScrollPos();
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_THUMBTRACK)
|
||||||
case wxEVT_SCROLLWIN_THUMBTRACK:
|
|
||||||
topLineNew = pos;
|
topLineNew = pos;
|
||||||
break;
|
|
||||||
}
|
|
||||||
ScrollTo(topLineNew);
|
ScrollTo(topLineNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -303,8 +303,22 @@ int Editor::PositionFromLineX(int line, int x) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Editor::RedrawRect(PRectangle rc) {
|
void Editor::RedrawRect(PRectangle rc) {
|
||||||
//Platform::DebugPrintf("Redraw %d %d - %d %d\n", rc.left, rc.top, rc.right, rc.bottom);
|
//Platform::DebugPrintf("Redraw %d %d - %d %d\n", rc.left, rc.top, rc.right, rc.bottom);
|
||||||
wDraw.InvalidateRectangle(rc);
|
|
||||||
|
// Clip the redraw rectangle into the client area
|
||||||
|
PRectangle rcClient = GetClientRectangle();
|
||||||
|
if (rc.top < rcClient.top)
|
||||||
|
rc.top = rcClient.top;
|
||||||
|
if (rc.bottom > rcClient.bottom)
|
||||||
|
rc.bottom = rcClient.bottom;
|
||||||
|
if (rc.left < rcClient.left)
|
||||||
|
rc.left = rcClient.left;
|
||||||
|
if (rc.right > rcClient.right)
|
||||||
|
rc.right = rcClient.right;
|
||||||
|
|
||||||
|
if ((rc.bottom > rc.top) && (rc.right > rc.left)) {
|
||||||
|
wDraw.InvalidateRectangle(rc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::Redraw() {
|
void Editor::Redraw() {
|
||||||
|
@@ -1539,16 +1539,38 @@ void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
|
|||||||
m_swx->DoContextMenu(Point(pt.x, pt.y));
|
m_swx->DoContextMenu(Point(pt.x, pt.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
|
void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
|
||||||
long key = evt.KeyCode();
|
long key = evt.KeyCode();
|
||||||
if ((key > WXK_ESCAPE) &&
|
switch (key) {
|
||||||
(key != WXK_DELETE) && (key < 255) &&
|
// Special handling for charcters that must be typed with AltGr down on
|
||||||
!evt.ControlDown() && !evt.AltDown()) {
|
// foreign keyboards. (Comes to us as Ctrl+Alt, and so would get
|
||||||
|
// filtered out by the default case below.)
|
||||||
|
//
|
||||||
|
// There should be a better way to do this...
|
||||||
|
//
|
||||||
|
case '\\':
|
||||||
|
case '|':
|
||||||
|
case '@':
|
||||||
|
case '#':
|
||||||
|
case '<EFBFBD>':
|
||||||
|
case '[':
|
||||||
|
case ']':
|
||||||
|
case '{':
|
||||||
|
case '}':
|
||||||
|
case '?':
|
||||||
|
m_swx->DoAddChar(key);
|
||||||
|
break;
|
||||||
|
|
||||||
m_swx->DoAddChar(key);
|
default:
|
||||||
}
|
if ((key > WXK_ESCAPE) && (key != WXK_DELETE) && (key < 255) &&
|
||||||
else {
|
!evt.ControlDown() && !evt.AltDown()) {
|
||||||
evt.Skip();
|
|
||||||
|
m_swx->DoAddChar(key);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
evt.Skip();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1561,6 +1583,7 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
|
|||||||
evt.Skip();
|
evt.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
|
void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
|
||||||
m_swx->DoLoseFocus();
|
m_swx->DoLoseFocus();
|
||||||
}
|
}
|
||||||
|
@@ -325,57 +325,41 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
|
|||||||
|
|
||||||
void ScintillaWX::DoHScroll(int type, int pos) {
|
void ScintillaWX::DoHScroll(int type, int pos) {
|
||||||
int xPos = xOffset;
|
int xPos = xOffset;
|
||||||
switch (type) {
|
if (type == wxEVT_SCROLLWIN_LINEUP)
|
||||||
case wxEVT_SCROLLWIN_LINEUP:
|
|
||||||
xPos -= H_SCROLL_STEP;
|
xPos -= H_SCROLL_STEP;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_LINEDOWN)
|
||||||
case wxEVT_SCROLLWIN_LINEDOWN:
|
|
||||||
xPos += H_SCROLL_STEP;
|
xPos += H_SCROLL_STEP;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_PAGEUP)
|
||||||
case wxEVT_SCROLLWIN_PAGEUP:
|
|
||||||
xPos -= H_SCROLL_PAGE;
|
xPos -= H_SCROLL_PAGE;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_PAGEDOWN)
|
||||||
case wxEVT_SCROLLWIN_PAGEDOWN:
|
|
||||||
xPos += H_SCROLL_PAGE;
|
xPos += H_SCROLL_PAGE;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_TOP)
|
||||||
case wxEVT_SCROLLWIN_TOP:
|
|
||||||
xPos = 0;
|
xPos = 0;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_BOTTOM)
|
||||||
case wxEVT_SCROLLWIN_BOTTOM:
|
|
||||||
xPos = H_SCROLL_MAX;
|
xPos = H_SCROLL_MAX;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_THUMBTRACK)
|
||||||
case wxEVT_SCROLLWIN_THUMBTRACK:
|
|
||||||
xPos = pos;
|
xPos = pos;
|
||||||
break;
|
|
||||||
}
|
|
||||||
HorizontalScrollTo(xPos);
|
HorizontalScrollTo(xPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScintillaWX::DoVScroll(int type, int pos) {
|
void ScintillaWX::DoVScroll(int type, int pos) {
|
||||||
int topLineNew = topLine;
|
int topLineNew = topLine;
|
||||||
switch (type) {
|
if (type == wxEVT_SCROLLWIN_LINEUP)
|
||||||
case wxEVT_SCROLLWIN_LINEUP:
|
|
||||||
topLineNew -= 1;
|
topLineNew -= 1;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_LINEDOWN)
|
||||||
case wxEVT_SCROLLWIN_LINEDOWN:
|
|
||||||
topLineNew += 1;
|
topLineNew += 1;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_PAGEUP)
|
||||||
case wxEVT_SCROLLWIN_PAGEUP:
|
|
||||||
topLineNew -= LinesToScroll();
|
topLineNew -= LinesToScroll();
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_PAGEDOWN)
|
||||||
case wxEVT_SCROLLWIN_PAGEDOWN:
|
|
||||||
topLineNew += LinesToScroll();
|
topLineNew += LinesToScroll();
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_TOP)
|
||||||
case wxEVT_SCROLLWIN_TOP:
|
|
||||||
topLineNew = 0;
|
topLineNew = 0;
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_BOTTOM)
|
||||||
case wxEVT_SCROLLWIN_BOTTOM:
|
|
||||||
topLineNew = MaxScrollPos();
|
topLineNew = MaxScrollPos();
|
||||||
break;
|
else if (type == wxEVT_SCROLLWIN_THUMBTRACK)
|
||||||
case wxEVT_SCROLLWIN_THUMBTRACK:
|
|
||||||
topLineNew = pos;
|
topLineNew = pos;
|
||||||
break;
|
|
||||||
}
|
|
||||||
ScrollTo(topLineNew);
|
ScrollTo(topLineNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -303,8 +303,22 @@ int Editor::PositionFromLineX(int line, int x) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Editor::RedrawRect(PRectangle rc) {
|
void Editor::RedrawRect(PRectangle rc) {
|
||||||
//Platform::DebugPrintf("Redraw %d %d - %d %d\n", rc.left, rc.top, rc.right, rc.bottom);
|
//Platform::DebugPrintf("Redraw %d %d - %d %d\n", rc.left, rc.top, rc.right, rc.bottom);
|
||||||
wDraw.InvalidateRectangle(rc);
|
|
||||||
|
// Clip the redraw rectangle into the client area
|
||||||
|
PRectangle rcClient = GetClientRectangle();
|
||||||
|
if (rc.top < rcClient.top)
|
||||||
|
rc.top = rcClient.top;
|
||||||
|
if (rc.bottom > rcClient.bottom)
|
||||||
|
rc.bottom = rcClient.bottom;
|
||||||
|
if (rc.left < rcClient.left)
|
||||||
|
rc.left = rcClient.left;
|
||||||
|
if (rc.right > rcClient.right)
|
||||||
|
rc.right = rcClient.right;
|
||||||
|
|
||||||
|
if ((rc.bottom > rc.top) && (rc.right > rc.left)) {
|
||||||
|
wDraw.InvalidateRectangle(rc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::Redraw() {
|
void Editor::Redraw() {
|
||||||
|
@@ -1539,16 +1539,38 @@ void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
|
|||||||
m_swx->DoContextMenu(Point(pt.x, pt.y));
|
m_swx->DoContextMenu(Point(pt.x, pt.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
|
void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
|
||||||
long key = evt.KeyCode();
|
long key = evt.KeyCode();
|
||||||
if ((key > WXK_ESCAPE) &&
|
switch (key) {
|
||||||
(key != WXK_DELETE) && (key < 255) &&
|
// Special handling for charcters that must be typed with AltGr down on
|
||||||
!evt.ControlDown() && !evt.AltDown()) {
|
// foreign keyboards. (Comes to us as Ctrl+Alt, and so would get
|
||||||
|
// filtered out by the default case below.)
|
||||||
|
//
|
||||||
|
// There should be a better way to do this...
|
||||||
|
//
|
||||||
|
case '\\':
|
||||||
|
case '|':
|
||||||
|
case '@':
|
||||||
|
case '#':
|
||||||
|
case '<EFBFBD>':
|
||||||
|
case '[':
|
||||||
|
case ']':
|
||||||
|
case '{':
|
||||||
|
case '}':
|
||||||
|
case '?':
|
||||||
|
m_swx->DoAddChar(key);
|
||||||
|
break;
|
||||||
|
|
||||||
m_swx->DoAddChar(key);
|
default:
|
||||||
}
|
if ((key > WXK_ESCAPE) && (key != WXK_DELETE) && (key < 255) &&
|
||||||
else {
|
!evt.ControlDown() && !evt.AltDown()) {
|
||||||
evt.Skip();
|
|
||||||
|
m_swx->DoAddChar(key);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
evt.Skip();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1561,6 +1583,7 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
|
|||||||
evt.Skip();
|
evt.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
|
void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
|
||||||
m_swx->DoLoseFocus();
|
m_swx->DoLoseFocus();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user