aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/PlatWin.cxx26
-rw-r--r--win32/ScintillaWin.cxx58
2 files changed, 43 insertions, 41 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 5fb2b16d3..180d2d1a7 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -2158,7 +2158,7 @@ class ListBoxX : public ListBox {
void OnDoubleClick();
void ResizeToCursor();
void StartResize(WPARAM);
- int NcHitTest(WPARAM, LPARAM) const;
+ LRESULT NcHitTest(WPARAM, LPARAM) const;
void CentreItem(int n);
void Paint(HDC);
static LRESULT PASCAL ControlWndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam);
@@ -2344,7 +2344,7 @@ void ListBoxX::Select(int n) {
}
int ListBoxX::GetSelection() {
- return ::SendMessage(lb, LB_GETCURSEL, 0, 0);
+ return static_cast<int>(::SendMessage(lb, LB_GETCURSEL, 0, 0));
}
// This is not actually called at present
@@ -2414,7 +2414,7 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) {
if (surfaceItem) {
if (technology == SCWIN_TECH_GDI) {
surfaceItem->Init(pDrawItem->hDC, pDrawItem->hwndItem);
- int left = pDrawItem->rcItem.left + static_cast<int>(ItemInset.x + ImageInset.x);
+ long left = pDrawItem->rcItem.left + static_cast<int>(ItemInset.x + ImageInset.x);
PRectangle rcImage(left, pDrawItem->rcItem.top,
left + images.GetWidth(), pDrawItem->rcItem.bottom);
surfaceItem->DrawRGBAImage(rcImage,
@@ -2442,7 +2442,7 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) {
if (SUCCEEDED(hr)) {
surfaceItem->Init(pDCRT, pDrawItem->hwndItem);
pDCRT->BeginDraw();
- int left = pDrawItem->rcItem.left + static_cast<int>(ItemInset.x + ImageInset.x);
+ long left = pDrawItem->rcItem.left + static_cast<long>(ItemInset.x + ImageInset.x);
PRectangle rcImage(left, pDrawItem->rcItem.top,
left + images.GetWidth(), pDrawItem->rcItem.bottom);
surfaceItem->DrawRGBAImage(rcImage,
@@ -2660,11 +2660,11 @@ void ListBoxX::StartResize(WPARAM hitCode) {
}
::SetCapture(GetHWND());
- resizeHit = hitCode;
+ resizeHit = static_cast<int>(hitCode);
}
-int ListBoxX::NcHitTest(WPARAM wParam, LPARAM lParam) const {
- int hit = ::DefWindowProc(GetHWND(), WM_NCHITTEST, wParam, lParam);
+LRESULT ListBoxX::NcHitTest(WPARAM wParam, LPARAM lParam) const {
+ LRESULT hit = ::DefWindowProc(GetHWND(), WM_NCHITTEST, wParam, lParam);
// There is an apparent bug in the DefWindowProc hit test code whereby it will
// return HTTOPXXX if the window in question is shorter than the default
// window caption height + frame, even if one is hovering over the bottom edge of
@@ -2730,7 +2730,7 @@ void ListBoxX::CentreItem(int n) {
POINT extent = GetClientExtent();
int visible = extent.y/ItemHeight();
if (visible < Length()) {
- int top = ::SendMessage(lb, LB_GETTOPINDEX, 0, 0);
+ LRESULT top = ::SendMessage(lb, LB_GETTOPINDEX, 0, 0);
int half = (visible - 1) / 2;
if (n > (top + half))
::SendMessage(lb, LB_SETTOPINDEX, n - half , 0);
@@ -2927,7 +2927,7 @@ LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam
linesToScroll = 3;
}
linesToScroll *= (wheelDelta / WHEEL_DELTA);
- int top = ::SendMessage(lb, LB_GETTOPINDEX, 0, 0) + linesToScroll;
+ LRESULT top = ::SendMessage(lb, LB_GETTOPINDEX, 0, 0) + linesToScroll;
if (top < 0) {
top = 0;
}
@@ -3126,12 +3126,14 @@ bool Platform::IsKeyDown(int key) {
}
long Platform::SendScintilla(WindowID w, unsigned int msg, unsigned long wParam, long lParam) {
- return ::SendMessage(reinterpret_cast<HWND>(w), msg, wParam, lParam);
+ // This should never be called - its here to satisfy an old interface
+ return static_cast<long>(::SendMessage(reinterpret_cast<HWND>(w), msg, wParam, lParam));
}
long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long wParam, void *lParam) {
- return ::SendMessage(reinterpret_cast<HWND>(w), msg, wParam,
- reinterpret_cast<LPARAM>(lParam));
+ // This should never be called - its here to satisfy an old interface
+ return static_cast<long>(::SendMessage(reinterpret_cast<HWND>(w), msg, wParam,
+ reinterpret_cast<LPARAM>(lParam)));
}
bool Platform::IsDBCSLeadByte(int codePage, char ch) {
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index db79cf33c..9288eb21b 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -465,8 +465,8 @@ HWND ScintillaWin::MainHWND() {
}
bool ScintillaWin::DragThreshold(Point ptStart, Point ptNow) {
- int xMove = abs(ptStart.x - ptNow.x);
- int yMove = abs(ptStart.y - ptNow.y);
+ int xMove = static_cast<int>(abs(ptStart.x - ptNow.x));
+ int yMove = static_cast<int>(abs(ptStart.y - ptNow.y));
return (xMove > ::GetSystemMetrics(SM_CXDRAG)) ||
(yMove > ::GetSystemMetrics(SM_CYDRAG));
}
@@ -494,11 +494,11 @@ void ScintillaWin::StartDrag() {
}
// Avoid warnings everywhere for old style casts by concentrating them here
-static WORD LoWord(DWORD l) {
+static WORD LoWord(uptr_t l) {
return LOWORD(l);
}
-static WORD HiWord(DWORD l) {
+static WORD HiWord(uptr_t l) {
return HIWORD(l);
}
@@ -643,8 +643,8 @@ sptr_t ScintillaWin::HandleComposition(uptr_t wParam, sptr_t lParam) {
Point pos = PointMainCaret();
COMPOSITIONFORM CompForm;
CompForm.dwStyle = CFS_POINT;
- CompForm.ptCurrentPos.x = pos.x;
- CompForm.ptCurrentPos.y = pos.y;
+ CompForm.ptCurrentPos.x = static_cast<int>(pos.x);
+ CompForm.ptCurrentPos.y = static_cast<int>(pos.y);
::ImmSetCompositionWindow(hIMC, &CompForm);
::ImmReleaseContext(MainHWND(), hIMC);
}
@@ -837,7 +837,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
// the low priority events have a turn (after which the timer will fire again).
DWORD dwCurrent = GetTickCount();
- DWORD dwStart = wParam ? wParam : dwCurrent;
+ DWORD dwStart = wParam ? static_cast<DWORD>(wParam) : dwCurrent;
const DWORD maxWorkTime = 50;
if (dwCurrent >= dwStart && dwCurrent > maxWorkTime && dwCurrent - maxWorkTime < dwStart)
@@ -863,7 +863,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
// Platform::IsKeyDown(VK_CONTROL),
// Platform::IsKeyDown(VK_MENU));
::SetFocus(MainHWND());
- ButtonDown(Point::FromLong(lParam), ::GetMessageTime(),
+ ButtonDown(Point::FromLong(static_cast<long>(lParam)), ::GetMessageTime(),
(wParam & MK_SHIFT) != 0,
(wParam & MK_CONTROL) != 0,
Platform::IsKeyDown(VK_MENU));
@@ -872,7 +872,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
case WM_MOUSEMOVE:
SetTrackMouseLeaveEvent(true);
- ButtonMoveWithModifiers(Point::FromLong(lParam),
+ ButtonMoveWithModifiers(Point::FromLong(static_cast<long>(lParam)),
((wParam & MK_SHIFT) != 0 ? SCI_SHIFT : 0) |
((wParam & MK_CONTROL) != 0 ? SCI_CTRL : 0) |
(Platform::IsKeyDown(VK_MENU) ? SCI_ALT : 0));
@@ -884,16 +884,16 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam);
case WM_LBUTTONUP:
- ButtonUp(Point::FromLong(lParam),
+ ButtonUp(Point::FromLong(static_cast<long>(lParam)),
::GetMessageTime(),
(wParam & MK_CONTROL) != 0);
break;
case WM_RBUTTONDOWN:
::SetFocus(MainHWND());
- if (!PointInSelection(Point::FromLong(lParam))) {
+ if (!PointInSelection(Point::FromLong(static_cast<long>(lParam)))) {
CancelModes();
- SetEmptySelection(PositionFromLocation(Point::FromLong(lParam)));
+ SetEmptySelection(PositionFromLocation(Point::FromLong(static_cast<long>(lParam))));
}
break;
@@ -923,7 +923,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
}
case WM_CHAR:
- if (((wParam >= 128) || !iscntrl(wParam)) || !lastKeyDownConsumed) {
+ if (((wParam >= 128) || !iscntrl(static_cast<int>(wParam))) || !lastKeyDownConsumed) {
if (::IsWindowUnicode(MainHWND()) || keysAlwaysUnicode) {
wchar_t wcs[2] = {static_cast<wchar_t>(wParam), 0};
if (IsUnicodeMode()) {
@@ -972,7 +972,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
case WM_KEYDOWN: {
//Platform::DebugPrintf("S keydown %d %x %x %x %x\n",iMessage, wParam, lParam, ::IsKeyDown(VK_SHIFT), ::IsKeyDown(VK_CONTROL));
lastKeyDownConsumed = false;
- int ret = KeyDown(KeyTranslate(wParam),
+ int ret = KeyDown(KeyTranslate(static_cast<int>(wParam)),
Platform::IsKeyDown(VK_SHIFT),
Platform::IsKeyDown(VK_CONTROL),
Platform::IsKeyDown(VK_MENU),
@@ -1041,7 +1041,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
case WM_CONTEXTMENU:
if (displayPopupMenu) {
- Point pt = Point::FromLong(lParam);
+ Point pt = Point::FromLong(static_cast<long>(lParam));
if ((pt.x == -1) && (pt.y == -1)) {
// Caused by keyboard so display menu near caret
pt = PointMainCaret();
@@ -1089,10 +1089,10 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
if (static_cast<int>(wParam) < 0) {
wParam = SelectionStart().Position();
}
- return pdoc->LineFromPosition(wParam);
+ return pdoc->LineFromPosition(static_cast<int>(wParam));
case EM_EXLINEFROMCHAR:
- return pdoc->LineFromPosition(lParam);
+ return pdoc->LineFromPosition(static_cast<int>(lParam));
case EM_GETSEL:
if (wParam) {
@@ -1175,7 +1175,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
return 0;
#endif
}
- technology = wParam;
+ technology = static_cast<int>(wParam);
// Invalidate all cached information including layout.
DropGraphics(true);
InvalidateStyleRedraw();
@@ -1276,7 +1276,7 @@ bool ScintillaWin::PaintContains(PRectangle rc) {
contains = false;
} else {
// In bounding rectangle so check more accurately using region
- HRGN hRgnRange = ::CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
+ HRGN hRgnRange = ::CreateRectRgn(static_cast<int>(rc.left), static_cast<int>(rc.top), static_cast<int>(rc.right), static_cast<int>(rc.bottom));
if (hRgnRange) {
HRGN hRgnDest = ::CreateRectRgn(0, 0, 0, 0);
if (hRgnDest) {
@@ -1309,7 +1309,7 @@ void ScintillaWin::UpdateSystemCaret() {
CreateSystemCaret();
}
Point pos = PointMainCaret();
- ::SetCaretPos(pos.x, pos.y);
+ ::SetCaretPos(static_cast<int>(pos.x), static_cast<int>(pos.y));
}
}
@@ -1371,7 +1371,7 @@ bool ScintillaWin::ModifyScrollBars(int nMax, int nPage) {
int horizEndPreferred = scrollWidth;
if (horizEndPreferred < 0)
horizEndPreferred = 0;
- unsigned int pageWidth = rcText.Width();
+ unsigned int pageWidth = static_cast<unsigned int>(rcText.Width());
if (!horizontalScrollBarVisible || Wrapping())
pageWidth = horizEndPreferred + 1;
sci.fMask = SIF_PAGE | SIF_RANGE;
@@ -1673,7 +1673,7 @@ void ScintillaWin::Paste() {
std::vector<char> putf;
// Default Scintilla behaviour in Unicode mode
if (IsUnicodeMode()) {
- unsigned int bytes = memUSelection.Size();
+ unsigned int bytes = static_cast<unsigned int>(memUSelection.Size());
len = UTF8Length(uptr, bytes / 2);
putf.resize(len + 1);
UTF8FromUTF16(uptr, bytes / 2, &putf[0], len);
@@ -1697,7 +1697,7 @@ void ScintillaWin::Paste() {
if (memSelection) {
char *ptr = static_cast<char *>(memSelection.ptr);
if (ptr) {
- unsigned int bytes = memSelection.Size();
+ unsigned int bytes = static_cast<unsigned int>(memSelection.Size());
unsigned int len = bytes;
for (unsigned int i = 0; i < bytes; i++) {
if ((len == bytes) && (0 == ptr[i]))
@@ -2069,8 +2069,8 @@ void ScintillaWin::ImeStartComposition() {
Point pos = PointMainCaret();
COMPOSITIONFORM CompForm;
CompForm.dwStyle = CFS_POINT;
- CompForm.ptCurrentPos.x = pos.x;
- CompForm.ptCurrentPos.y = pos.y;
+ CompForm.ptCurrentPos.x = static_cast<int>(pos.x);
+ CompForm.ptCurrentPos.y = static_cast<int>(pos.y);
::ImmSetCompositionWindow(hIMC, &CompForm);
@@ -2257,7 +2257,7 @@ void ScintillaWin::ScrollMessage(WPARAM wParam) {
void ScintillaWin::HorizontalScrollMessage(WPARAM wParam) {
int xPos = xOffset;
PRectangle rcText = GetTextRectangle();
- int pageWidth = rcText.Width() * 2 / 3;
+ int pageWidth = static_cast<int>(rcText.Width() * 2 / 3);
switch (LoWord(wParam)) {
case SB_LINEUP:
xPos -= 20;
@@ -2271,7 +2271,7 @@ void ScintillaWin::HorizontalScrollMessage(WPARAM wParam) {
case SB_PAGEDOWN:
xPos += pageWidth;
if (xPos > scrollWidth - rcText.Width()) { // Hit the end exactly
- xPos = scrollWidth - rcText.Width();
+ xPos = scrollWidth - static_cast<int>(rcText.Width());
}
break;
case SB_TOP:
@@ -2469,7 +2469,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState,
wchar_t *udata = static_cast<wchar_t *>(memUDrop.ptr);
if (udata) {
if (IsUnicodeMode()) {
- int tlen = memUDrop.Size();
+ int tlen = static_cast<int>(memUDrop.Size());
// Convert UTF-16 to UTF-8
int dataLen = UTF8Length(udata, tlen/2);
data.resize(dataLen+1);
@@ -2756,7 +2756,7 @@ sptr_t PASCAL ScintillaWin::CTWndProc(
return 0;
} else if (iMessage == WM_LBUTTONDOWN) {
// This does not fire due to the hit test code
- sciThis->ct.MouseClick(Point::FromLong(lParam));
+ sciThis->ct.MouseClick(Point::FromLong(static_cast<long>(lParam)));
sciThis->CallTipClick();
return 0;
} else if (iMessage == WM_SETCURSOR) {