void ScintillaWX::DoHScroll(int type, int pos) {
int xPos = xOffset;
- switch (type) {
- case wxEVT_SCROLLWIN_LINEUP:
+ if (type == wxEVT_SCROLLWIN_LINEUP)
xPos -= H_SCROLL_STEP;
- break;
- case wxEVT_SCROLLWIN_LINEDOWN:
+ else if (type == wxEVT_SCROLLWIN_LINEDOWN)
xPos += H_SCROLL_STEP;
- break;
- case wxEVT_SCROLLWIN_PAGEUP:
+ else if (type == wxEVT_SCROLLWIN_PAGEUP)
xPos -= H_SCROLL_PAGE;
- break;
- case wxEVT_SCROLLWIN_PAGEDOWN:
+ else if (type == wxEVT_SCROLLWIN_PAGEDOWN)
xPos += H_SCROLL_PAGE;
- break;
- case wxEVT_SCROLLWIN_TOP:
+ else if (type == wxEVT_SCROLLWIN_TOP)
xPos = 0;
- break;
- case wxEVT_SCROLLWIN_BOTTOM:
+ else if (type == wxEVT_SCROLLWIN_BOTTOM)
xPos = H_SCROLL_MAX;
- break;
- case wxEVT_SCROLLWIN_THUMBTRACK:
+ else if (type == wxEVT_SCROLLWIN_THUMBTRACK)
xPos = pos;
- break;
- }
+
HorizontalScrollTo(xPos);
}
void ScintillaWX::DoVScroll(int type, int pos) {
int topLineNew = topLine;
- switch (type) {
- case wxEVT_SCROLLWIN_LINEUP:
+ if (type == wxEVT_SCROLLWIN_LINEUP)
topLineNew -= 1;
- break;
- case wxEVT_SCROLLWIN_LINEDOWN:
+ else if (type == wxEVT_SCROLLWIN_LINEDOWN)
topLineNew += 1;
- break;
- case wxEVT_SCROLLWIN_PAGEUP:
+ else if (type == wxEVT_SCROLLWIN_PAGEUP)
topLineNew -= LinesToScroll();
- break;
- case wxEVT_SCROLLWIN_PAGEDOWN:
+ else if (type == wxEVT_SCROLLWIN_PAGEDOWN)
topLineNew += LinesToScroll();
- break;
- case wxEVT_SCROLLWIN_TOP:
+ else if (type == wxEVT_SCROLLWIN_TOP)
topLineNew = 0;
- break;
- case wxEVT_SCROLLWIN_BOTTOM:
+ else if (type == wxEVT_SCROLLWIN_BOTTOM)
topLineNew = MaxScrollPos();
- break;
- case wxEVT_SCROLLWIN_THUMBTRACK:
+ else if (type == wxEVT_SCROLLWIN_THUMBTRACK)
topLineNew = pos;
- break;
- }
+
ScrollTo(topLineNew);
}
#if PLAT_WX || PLAT_GTK
#include "WinDefs.h"
-#endif
+#endif
#include "ContractionState.h"
#include "SVector.h"
#ifdef MACRO_SUPPORT
recordingMacro = 0;
-#endif
+#endif
foldFlags = 0;
}
}
void Editor::RedrawRect(PRectangle rc) {
- //Platform::DebugPrintf("Redraw %d %d - %d %d\n", rc.left, rc.top, rc.right, rc.bottom);
- wDraw.InvalidateRectangle(rc);
+ //Platform::DebugPrintf("Redraw %d %d - %d %d\n", rc.left, rc.top, rc.right, rc.bottom);
+
+ // 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() {
if (vs.ms[margin].symbol) {
/* alternate scheme:
if (vs.ms[margin].mask & SC_MASK_FOLDERS)
- surface->FillRectangle(rcSelMargin, vs.styles[STYLE_DEFAULT].back.allocated);
+ surface->FillRectangle(rcSelMargin, vs.styles[STYLE_DEFAULT].back.allocated);
else
// Required because of special way brush is created for selection margin
- surface->FillRectangle(rcSelMargin, pixmapSelPattern);
+ surface->FillRectangle(rcSelMargin, pixmapSelPattern);
*/
if (vs.ms[margin].mask & SC_MASK_FOLDERS)
// Required because of special way brush is created for selection margin
txt[1] = '\0';
NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<long>(txt));
}
-#endif
+#endif
}
void Editor::NotifySavePoint(bool isSavePoint) {
scn.lParam = lParam;
NotifyParent(scn);
}
-#endif
+#endif
// Force scroll and keep position relative to top of window
void Editor::PageMove(int direction, bool extend) {
#ifdef MACRO_SUPPORT
if (recordingMacro)
NotifyMacroRecord(iMessage, wParam, lParam);
-#endif
+#endif
switch (iMessage) {
return SEL_EMPTY;
else
return SEL_TEXT;
-#else
+#else
return 0;
-#endif
+#endif
case EM_HIDESELECTION:
hideSelection = wParam;
vs.rightMarginWidth = vs.aveCharWidth / 2;
}
InvalidateStyleRedraw();
-#endif
+#endif
break;
case SCI_SETMARGINLEFT:
case SCI_SETOVERTYPE:
inOverstrike = wParam;
break;
-
+
case SCI_GETOVERTYPE:
return inOverstrike ? TRUE : FALSE;
-
+
#ifdef MACRO_SUPPORT
case SCI_STARTRECORD:
recordingMacro = 1;
case SCI_STOPRECORD:
recordingMacro = 0;
return 0;
-#endif
+#endif
default:
return DefWndProc(iMessage, wParam, lParam);
m_swx->DoContextMenu(Point(pt.x, pt.y));
}
+
void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
long key = evt.KeyCode();
- if ((key > WXK_ESCAPE) &&
- (key != WXK_DELETE) && (key < 255) &&
- !evt.ControlDown() && !evt.AltDown()) {
-
- m_swx->DoAddChar(key);
- }
- else {
- evt.Skip();
+ switch (key) {
+ // Special handling for charcters that must be typed with AltGr down on
+ // 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 '¬':
+ case '[':
+ case ']':
+ case '{':
+ case '}':
+ case '?':
+ m_swx->DoAddChar(key);
+ break;
+
+ default:
+ if ((key > WXK_ESCAPE) && (key != WXK_DELETE) && (key < 255) &&
+ !evt.ControlDown() && !evt.AltDown()) {
+
+ m_swx->DoAddChar(key);
+ }
+ else {
+ evt.Skip();
+ }
}
}
evt.Skip();
}
+
void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
m_swx->DoLoseFocus();
}
void ScintillaWX::DoHScroll(int type, int pos) {
int xPos = xOffset;
- switch (type) {
- case wxEVT_SCROLLWIN_LINEUP:
+ if (type == wxEVT_SCROLLWIN_LINEUP)
xPos -= H_SCROLL_STEP;
- break;
- case wxEVT_SCROLLWIN_LINEDOWN:
+ else if (type == wxEVT_SCROLLWIN_LINEDOWN)
xPos += H_SCROLL_STEP;
- break;
- case wxEVT_SCROLLWIN_PAGEUP:
+ else if (type == wxEVT_SCROLLWIN_PAGEUP)
xPos -= H_SCROLL_PAGE;
- break;
- case wxEVT_SCROLLWIN_PAGEDOWN:
+ else if (type == wxEVT_SCROLLWIN_PAGEDOWN)
xPos += H_SCROLL_PAGE;
- break;
- case wxEVT_SCROLLWIN_TOP:
+ else if (type == wxEVT_SCROLLWIN_TOP)
xPos = 0;
- break;
- case wxEVT_SCROLLWIN_BOTTOM:
+ else if (type == wxEVT_SCROLLWIN_BOTTOM)
xPos = H_SCROLL_MAX;
- break;
- case wxEVT_SCROLLWIN_THUMBTRACK:
+ else if (type == wxEVT_SCROLLWIN_THUMBTRACK)
xPos = pos;
- break;
- }
+
HorizontalScrollTo(xPos);
}
void ScintillaWX::DoVScroll(int type, int pos) {
int topLineNew = topLine;
- switch (type) {
- case wxEVT_SCROLLWIN_LINEUP:
+ if (type == wxEVT_SCROLLWIN_LINEUP)
topLineNew -= 1;
- break;
- case wxEVT_SCROLLWIN_LINEDOWN:
+ else if (type == wxEVT_SCROLLWIN_LINEDOWN)
topLineNew += 1;
- break;
- case wxEVT_SCROLLWIN_PAGEUP:
+ else if (type == wxEVT_SCROLLWIN_PAGEUP)
topLineNew -= LinesToScroll();
- break;
- case wxEVT_SCROLLWIN_PAGEDOWN:
+ else if (type == wxEVT_SCROLLWIN_PAGEDOWN)
topLineNew += LinesToScroll();
- break;
- case wxEVT_SCROLLWIN_TOP:
+ else if (type == wxEVT_SCROLLWIN_TOP)
topLineNew = 0;
- break;
- case wxEVT_SCROLLWIN_BOTTOM:
+ else if (type == wxEVT_SCROLLWIN_BOTTOM)
topLineNew = MaxScrollPos();
- break;
- case wxEVT_SCROLLWIN_THUMBTRACK:
+ else if (type == wxEVT_SCROLLWIN_THUMBTRACK)
topLineNew = pos;
- break;
- }
+
ScrollTo(topLineNew);
}
#if PLAT_WX || PLAT_GTK
#include "WinDefs.h"
-#endif
+#endif
#include "ContractionState.h"
#include "SVector.h"
#ifdef MACRO_SUPPORT
recordingMacro = 0;
-#endif
+#endif
foldFlags = 0;
}
}
void Editor::RedrawRect(PRectangle rc) {
- //Platform::DebugPrintf("Redraw %d %d - %d %d\n", rc.left, rc.top, rc.right, rc.bottom);
- wDraw.InvalidateRectangle(rc);
+ //Platform::DebugPrintf("Redraw %d %d - %d %d\n", rc.left, rc.top, rc.right, rc.bottom);
+
+ // 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() {
if (vs.ms[margin].symbol) {
/* alternate scheme:
if (vs.ms[margin].mask & SC_MASK_FOLDERS)
- surface->FillRectangle(rcSelMargin, vs.styles[STYLE_DEFAULT].back.allocated);
+ surface->FillRectangle(rcSelMargin, vs.styles[STYLE_DEFAULT].back.allocated);
else
// Required because of special way brush is created for selection margin
- surface->FillRectangle(rcSelMargin, pixmapSelPattern);
+ surface->FillRectangle(rcSelMargin, pixmapSelPattern);
*/
if (vs.ms[margin].mask & SC_MASK_FOLDERS)
// Required because of special way brush is created for selection margin
txt[1] = '\0';
NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast<long>(txt));
}
-#endif
+#endif
}
void Editor::NotifySavePoint(bool isSavePoint) {
scn.lParam = lParam;
NotifyParent(scn);
}
-#endif
+#endif
// Force scroll and keep position relative to top of window
void Editor::PageMove(int direction, bool extend) {
#ifdef MACRO_SUPPORT
if (recordingMacro)
NotifyMacroRecord(iMessage, wParam, lParam);
-#endif
+#endif
switch (iMessage) {
return SEL_EMPTY;
else
return SEL_TEXT;
-#else
+#else
return 0;
-#endif
+#endif
case EM_HIDESELECTION:
hideSelection = wParam;
vs.rightMarginWidth = vs.aveCharWidth / 2;
}
InvalidateStyleRedraw();
-#endif
+#endif
break;
case SCI_SETMARGINLEFT:
case SCI_SETOVERTYPE:
inOverstrike = wParam;
break;
-
+
case SCI_GETOVERTYPE:
return inOverstrike ? TRUE : FALSE;
-
+
#ifdef MACRO_SUPPORT
case SCI_STARTRECORD:
recordingMacro = 1;
case SCI_STOPRECORD:
recordingMacro = 0;
return 0;
-#endif
+#endif
default:
return DefWndProc(iMessage, wParam, lParam);
m_swx->DoContextMenu(Point(pt.x, pt.y));
}
+
void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
long key = evt.KeyCode();
- if ((key > WXK_ESCAPE) &&
- (key != WXK_DELETE) && (key < 255) &&
- !evt.ControlDown() && !evt.AltDown()) {
-
- m_swx->DoAddChar(key);
- }
- else {
- evt.Skip();
+ switch (key) {
+ // Special handling for charcters that must be typed with AltGr down on
+ // 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 '¬':
+ case '[':
+ case ']':
+ case '{':
+ case '}':
+ case '?':
+ m_swx->DoAddChar(key);
+ break;
+
+ default:
+ if ((key > WXK_ESCAPE) && (key != WXK_DELETE) && (key < 255) &&
+ !evt.ControlDown() && !evt.AltDown()) {
+
+ m_swx->DoAddChar(key);
+ }
+ else {
+ evt.Skip();
+ }
}
}
evt.Skip();
}
+
void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
m_swx->DoLoseFocus();
}