From b0e19a786e1c8699df5b3e51e74c9d0d35dccfe3 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 16 Jan 2022 23:58:27 +0100 Subject: [PATCH] Remove more conversion from Scintilla --- PowerEditor/src/Notepad_plus.cpp | 4 +-- PowerEditor/src/Notepad_plus.h | 4 +-- PowerEditor/src/NppNotification.cpp | 2 +- PowerEditor/src/Parameters.cpp | 18 ++++++------ PowerEditor/src/Parameters.h | 20 ++++++------- .../src/ScintillaComponent/AutoCompletion.cpp | 18 ++++++------ .../src/ScintillaComponent/FindReplaceDlg.cpp | 12 ++++---- .../src/ScintillaComponent/FindReplaceDlg.h | 4 +-- .../ScintillaComponent/FunctionCallTip.cpp | 12 ++++---- .../src/ScintillaComponent/FunctionCallTip.h | 4 +-- .../src/ScintillaComponent/GoToLineDlg.cpp | 16 +++++------ .../src/ScintillaComponent/Printer.cpp | 2 +- .../ScintillaComponent/ScintillaEditView.cpp | 2 +- .../ScintillaComponent/ScintillaEditView.h | 2 +- .../WinControls/DocumentMap/documentMap.cpp | 12 ++++---- .../src/WinControls/DocumentMap/documentMap.h | 4 +-- .../DocumentMap/documentSnapshot.cpp | 28 +++++++++---------- .../FindCharsInRange/FindCharsInRange.cpp | 2 +- .../FunctionList/functionParser.cpp | 2 +- 19 files changed, 84 insertions(+), 84 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index e2f82fc7e..9232a592a 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2582,8 +2582,8 @@ bool Notepad_plus::braceMatch() if (_pEditView->isShownIndentGuide()) { - int columnAtCaret = int(_pEditView->execute(SCI_GETCOLUMN, braceAtCaret)); - int columnOpposite = int(_pEditView->execute(SCI_GETCOLUMN, braceOpposite)); + INT_PTR columnAtCaret = _pEditView->execute(SCI_GETCOLUMN, braceAtCaret); + INT_PTR columnOpposite = _pEditView->execute(SCI_GETCOLUMN, braceOpposite); _pEditView->execute(SCI_SETHIGHLIGHTGUIDE, (columnAtCaret < columnOpposite)?columnAtCaret:columnOpposite); } } diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index 1bdf3f91a..9630656ac 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -502,7 +502,7 @@ private: void addHotSpot(ScintillaEditView* view = NULL); - void bookmarkAdd(int lineno) const { + void bookmarkAdd(INT_PTR lineno) const { if (lineno == -1) lineno = static_cast(_pEditView->getCurrentLineNumber()); if (!bookmarkPresent(lineno)) @@ -523,7 +523,7 @@ private: return ((state & (1 << MARK_BOOKMARK)) != 0); } - void bookmarkToggle(int lineno) const { + void bookmarkToggle(INT_PTR lineno) const { if (lineno == -1) lineno = static_cast(_pEditView->getCurrentLineNumber()); diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index 04b693526..e309a4977 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -589,7 +589,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) else if (notification->nmhdr.hwndFrom == _subEditView.getHSelf()) switchEditViewTo(SUB_VIEW); - int lineClick = int(_pEditView->execute(SCI_LINEFROMPOSITION, notification->position)); + INT_PTR lineClick = _pEditView->execute(SCI_LINEFROMPOSITION, notification->position); if (notification->margin == ScintillaEditView::_SC_MARGE_FOLDER) { diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 125bb5982..008a4f5c2 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -3290,15 +3290,15 @@ void NppParameters::writeSession(const Session & session, const TCHAR *fileName) (fileNameNode->ToElement())->SetAttribute(TEXT("originalFileLastModifTimestampHigh"), static_cast(viewSessionFiles[i]._originalFileLastModifTimestamp.dwHighDateTime)); // docMap - (fileNameNode->ToElement())->SetAttribute(TEXT("mapFirstVisibleDisplayLine"), viewSessionFiles[i]._mapPos._firstVisibleDisplayLine); - (fileNameNode->ToElement())->SetAttribute(TEXT("mapFirstVisibleDocLine"), viewSessionFiles[i]._mapPos._firstVisibleDocLine); - (fileNameNode->ToElement())->SetAttribute(TEXT("mapLastVisibleDocLine"), viewSessionFiles[i]._mapPos._lastVisibleDocLine); - (fileNameNode->ToElement())->SetAttribute(TEXT("mapNbLine"), viewSessionFiles[i]._mapPos._nbLine); - (fileNameNode->ToElement())->SetAttribute(TEXT("mapHigherPos"), viewSessionFiles[i]._mapPos._higherPos); - (fileNameNode->ToElement())->SetAttribute(TEXT("mapWidth"), viewSessionFiles[i]._mapPos._width); - (fileNameNode->ToElement())->SetAttribute(TEXT("mapHeight"), viewSessionFiles[i]._mapPos._height); - (fileNameNode->ToElement())->SetAttribute(TEXT("mapKByteInDoc"), static_cast(viewSessionFiles[i]._mapPos._KByteInDoc)); - (fileNameNode->ToElement())->SetAttribute(TEXT("mapWrapIndentMode"), viewSessionFiles[i]._mapPos._wrapIndentMode); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapFirstVisibleDisplayLine"), (int)viewSessionFiles[i]._mapPos._firstVisibleDisplayLine); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapFirstVisibleDocLine"), (int)viewSessionFiles[i]._mapPos._firstVisibleDocLine); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapLastVisibleDocLine"), (int)viewSessionFiles[i]._mapPos._lastVisibleDocLine); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapNbLine"), (int)viewSessionFiles[i]._mapPos._nbLine); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapHigherPos"), (int)viewSessionFiles[i]._mapPos._higherPos); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapWidth"), (int)viewSessionFiles[i]._mapPos._width); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapHeight"), (int)viewSessionFiles[i]._mapPos._height); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapKByteInDoc"), (int)viewSessionFiles[i]._mapPos._KByteInDoc); + (fileNameNode->ToElement())->SetAttribute(TEXT("mapWrapIndentMode"), (int)viewSessionFiles[i]._mapPos._wrapIndentMode); fileNameNode->ToElement()->SetAttribute(TEXT("mapIsWrap"), viewSessionFiles[i]._mapPos._isWrap ? TEXT("yes") : TEXT("no")); for (size_t j = 0, len = viewSessionFiles[i]._marks.size() ; j < len ; ++j) diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index f1e5a92f2..7df2f1ca6 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -156,24 +156,24 @@ struct Position struct MapPosition { - int32_t _firstVisibleDisplayLine = -1; + INT_PTR _firstVisibleDisplayLine = -1; - int32_t _firstVisibleDocLine = -1; // map - int32_t _lastVisibleDocLine = -1; // map - int32_t _nbLine = -1; // map - int32_t _higherPos = -1; // map - int32_t _width = -1; - int32_t _height = -1; - int32_t _wrapIndentMode = -1; + INT_PTR _firstVisibleDocLine = -1; // map + INT_PTR _lastVisibleDocLine = -1; // map + INT_PTR _nbLine = -1; // map + INT_PTR _higherPos = -1; // map + INT_PTR _width = -1; + INT_PTR _height = -1; + INT_PTR _wrapIndentMode = -1; - int64_t _KByteInDoc = _maxPeekLenInKB; + INT_PTR _KByteInDoc = _maxPeekLenInKB; bool _isWrap = false; bool isValid() const { return (_firstVisibleDisplayLine != -1); }; bool canScroll() const { return (_KByteInDoc < _maxPeekLenInKB); }; // _nbCharInDoc < _maxPeekLen : Don't scroll the document for the performance issue private: - int64_t _maxPeekLenInKB = 512; // 512 KB + INT_PTR _maxPeekLenInKB = 512; // 512 KB }; diff --git a/PowerEditor/src/ScintillaComponent/AutoCompletion.cpp b/PowerEditor/src/ScintillaComponent/AutoCompletion.cpp index 9e24165ab..6950113af 100644 --- a/PowerEditor/src/ScintillaComponent/AutoCompletion.cpp +++ b/PowerEditor/src/ScintillaComponent/AutoCompletion.cpp @@ -47,8 +47,8 @@ bool AutoCompletion::showApiComplete() return false; // calculate entered word's length - int curPos = int(_pEditView->execute(SCI_GETCURRENTPOS)); - int startPos = int(_pEditView->execute(SCI_WORDSTARTPOSITION, curPos, true)); + INT_PTR curPos = _pEditView->execute(SCI_GETCURRENTPOS); + INT_PTR startPos = _pEditView->execute(SCI_WORDSTARTPOSITION, curPos, true); if (curPos == startPos) return false; @@ -160,7 +160,7 @@ void AutoCompletion::getWordArray(vector & wordArray, TCHAR *beg expr += beginChars; expr += TEXT("[^ \\t\\n\\r.,;:\"(){}=<>'+!?\\[\\]]+"); - int docLength = int(_pEditView->execute(SCI_GETLENGTH)); + size_t docLength = _pEditView->execute(SCI_GETLENGTH); int flags = SCFIND_WORDSTART | SCFIND_MATCHCASE | SCFIND_REGEXP | SCFIND_POSIX; @@ -169,8 +169,8 @@ void AutoCompletion::getWordArray(vector & wordArray, TCHAR *beg while (posFind >= 0) { - int wordStart = int(_pEditView->execute(SCI_GETTARGETSTART)); - int wordEnd = int(_pEditView->execute(SCI_GETTARGETEND)); + INT_PTR wordStart = _pEditView->execute(SCI_GETTARGETSTART); + INT_PTR wordEnd = _pEditView->execute(SCI_GETTARGETEND); size_t foundTextLen = wordEnd - wordStart; if (foundTextLen < bufSize) @@ -280,7 +280,7 @@ void AutoCompletion::showPathCompletion() { const size_t bufSize = MAX_PATH; TCHAR buf[bufSize + 1]; - const size_t currentPos = static_cast(_pEditView->execute(SCI_GETCURRENTPOS)); + const size_t currentPos = _pEditView->execute(SCI_GETCURRENTPOS); const auto startPos = max(0, currentPos - bufSize); _pEditView->getGenericText(buf, bufSize + 1, startPos, currentPos); currentLine = buf; @@ -346,9 +346,9 @@ bool AutoCompletion::showWordComplete(bool autoInsert) { // Get beginning of word and complete word - int curPos = int(_pEditView->execute(SCI_GETCURRENTPOS)); - int startPos = int(_pEditView->execute(SCI_WORDSTARTPOSITION, curPos, true)); - int endPos = int(_pEditView->execute(SCI_WORDENDPOSITION, curPos, true)); + INT_PTR curPos = _pEditView->execute(SCI_GETCURRENTPOS); + INT_PTR startPos = _pEditView->execute(SCI_WORDSTARTPOSITION, curPos, true); + INT_PTR endPos = _pEditView->execute(SCI_WORDENDPOSITION, curPos, true); if (curPos == startPos) return false; diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 7d0e554f3..79cf377c2 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -1894,13 +1894,13 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op stringSizeFind = Searching::convertExtendedToString(txt2find, pText, stringSizeFind); } - int docLength = int((*_ppEditView)->execute(SCI_GETLENGTH)); + INT_PTR docLength = (*_ppEditView)->execute(SCI_GETLENGTH); Sci_CharacterRange cr = (*_ppEditView)->getSelection(); //The search "zone" is relative to the selection, so search happens 'outside' - int startPosition = cr.cpMax; - int endPosition = docLength; + INT_PTR startPosition = cr.cpMax; + INT_PTR endPosition = docLength; if (pOptions->_whichDirection == DIR_UP) @@ -2038,7 +2038,7 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op } start = posFind; - end = int((*_ppEditView)->execute(SCI_GETTARGETEND)); + end = (*_ppEditView)->execute(SCI_GETTARGETEND); setStatusbarMessage(TEXT(""), FSNoMessage); @@ -3972,7 +3972,7 @@ void Finder::addSearchLine(const TCHAR *searchName) setFinderReadOnly(false); _scintView.addGenericText(str.c_str()); setFinderReadOnly(true); - _lastSearchHeaderPos = static_cast(_scintView.execute(SCI_GETCURRENTPOS) - 2); + _lastSearchHeaderPos = _scintView.execute(SCI_GETCURRENTPOS) - 2; _pMainFoundInfos->push_back(EmptyFoundInfo); _pMainMarkings->push_back(EmptySearchResultMarking); @@ -3987,7 +3987,7 @@ void Finder::addFileNameTitle(const TCHAR * fileName) setFinderReadOnly(false); _scintView.addGenericText(str.c_str()); setFinderReadOnly(true); - _lastFileHeaderPos = static_cast(_scintView.execute(SCI_GETCURRENTPOS) - 2); + _lastFileHeaderPos = _scintView.execute(SCI_GETCURRENTPOS) - 2; _pMainFoundInfos->push_back(EmptyFoundInfo); _pMainMarkings->push_back(EmptySearchResultMarking); diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h index 07cff5a62..a96b57bb9 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h @@ -157,8 +157,8 @@ private: ScintillaEditView _scintView; unsigned int _nbFoundFiles = 0; - int _lastFileHeaderPos = 0; - int _lastSearchHeaderPos = 0; + INT_PTR _lastFileHeaderPos = 0; + INT_PTR _lastSearchHeaderPos = 0; bool _canBeVolatiled = true; bool _longLinesAreWrapped = false; diff --git a/PowerEditor/src/ScintillaComponent/FunctionCallTip.cpp b/PowerEditor/src/ScintillaComponent/FunctionCallTip.cpp index 7ec97e304..9b590dbfd 100644 --- a/PowerEditor/src/ScintillaComponent/FunctionCallTip.cpp +++ b/PowerEditor/src/ScintillaComponent/FunctionCallTip.cpp @@ -89,7 +89,7 @@ bool FunctionCallTip::updateCalltip(int ch, bool needShown) if (!needShown && ch != _start && ch != _param && !isVisible()) //must be already visible return false; - _curPos = static_cast(_pEditView->execute(SCI_GETCURRENTPOS)); + _curPos = _pEditView->execute(SCI_GETCURRENTPOS); //recalculate everything if (!getCursorFunction()) @@ -130,11 +130,11 @@ void FunctionCallTip::close() bool FunctionCallTip::getCursorFunction() { auto line = _pEditView->execute(SCI_LINEFROMPOSITION, _curPos); - int startpos = static_cast(_pEditView->execute(SCI_POSITIONFROMLINE, line)); - int endpos = static_cast(_pEditView->execute(SCI_GETLINEENDPOSITION, line)); - int len = endpos - startpos + 3; //also take CRLF in account, even if not there - int offset = _curPos - startpos; //offset is cursor location, only stuff before cursor has influence - const int maxLen = 256; + INT_PTR startpos = _pEditView->execute(SCI_POSITIONFROMLINE, line); + INT_PTR endpos = _pEditView->execute(SCI_GETLINEENDPOSITION, line); + INT_PTR len = endpos - startpos + 3; //also take CRLF in account, even if not there + INT_PTR offset = _curPos - startpos; //offset is cursor location, only stuff before cursor has influence + const INT_PTR maxLen = 256; if ((offset < 2) || (len >= maxLen)) { diff --git a/PowerEditor/src/ScintillaComponent/FunctionCallTip.h b/PowerEditor/src/ScintillaComponent/FunctionCallTip.h index 659b3e18c..db520b266 100644 --- a/PowerEditor/src/ScintillaComponent/FunctionCallTip.h +++ b/PowerEditor/src/ScintillaComponent/FunctionCallTip.h @@ -36,8 +36,8 @@ private: ScintillaEditView * _pEditView = nullptr; //Scintilla to display calltip in TiXmlElement * _pXmlKeyword = nullptr; //current keyword node (first one) - int _curPos = 0; //cursor position - int _startPos = 0; //display start position + INT_PTR _curPos = 0; //cursor position + INT_PTR _startPos = 0; //display start position TiXmlElement * _curFunction = nullptr; //current function element //cache some XML values n stuff diff --git a/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp b/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp index 352f712be..324304cd8 100644 --- a/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp @@ -171,20 +171,20 @@ INT_PTR CALLBACK GoToLineDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) void GoToLineDlg::updateLinesNumbers() const { - unsigned int current = 0; - unsigned int limit = 0; + size_t current = 0; + size_t limit = 0; if (_mode == go2line) { - current = static_cast((*_ppEditView)->getCurrentLineNumber() + 1); - limit = static_cast((*_ppEditView)->execute(SCI_GETLINECOUNT)); + current = (*_ppEditView)->getCurrentLineNumber() + 1; + limit = (*_ppEditView)->execute(SCI_GETLINECOUNT); } else { - current = static_cast((*_ppEditView)->execute(SCI_GETCURRENTPOS)); + current = (*_ppEditView)->execute(SCI_GETCURRENTPOS); size_t currentDocLength = (*_ppEditView)->getCurrentDocLen(); - limit = static_cast(currentDocLength > 0 ? currentDocLength - 1 : 0); + limit = (currentDocLength > 0 ? currentDocLength - 1 : 0); } - ::SetDlgItemInt(_hSelf, ID_CURRLINE, current, FALSE); - ::SetDlgItemInt(_hSelf, ID_LASTLINE, limit, FALSE); + ::SetDlgItemInt(_hSelf, ID_CURRLINE, (UINT)current, FALSE); + ::SetDlgItemInt(_hSelf, ID_LASTLINE, (UINT)limit, FALSE); } diff --git a/PowerEditor/src/ScintillaComponent/Printer.cpp b/PowerEditor/src/ScintillaComponent/Printer.cpp index 419b64fe3..61b3399a0 100644 --- a/PowerEditor/src/ScintillaComponent/Printer.cpp +++ b/PowerEditor/src/ScintillaComponent/Printer.cpp @@ -406,7 +406,7 @@ size_t Printer::doPrint(bool justDoIt) frPrint.chrg.cpMin = static_cast(lengthPrinted); frPrint.chrg.cpMax = static_cast(lengthDoc); - lengthPrinted = long(_pSEView->execute(SCI_FORMATRANGE, printPage, reinterpret_cast(&frPrint))); + lengthPrinted = _pSEView->execute(SCI_FORMATRANGE, printPage, reinterpret_cast(&frPrint)); if (printPage) { diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index 33dc01632..be3389334 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -3383,7 +3383,7 @@ void ScintillaEditView::hideLines() _currentBuffer->setHideLineChanged(true, startLine-1); } -bool ScintillaEditView::markerMarginClick(int lineNumber) +bool ScintillaEditView::markerMarginClick(size_t lineNumber) { auto state = execute(SCI_MARKERGET, lineNumber); bool openPresent = ((state & (1 << MARK_HIDELINESBEGIN | 1 << MARK_HIDELINESUNDERLINE)) != 0); diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h index 733ca8997..066fad427 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h @@ -551,7 +551,7 @@ public: void hideLines(); - bool markerMarginClick(int lineNumber); //true if it did something + bool markerMarginClick(size_t lineNumber); //true if it did something void notifyMarkers(Buffer * buf, bool isHide, size_t location, bool del); void runMarkers(bool doHide, size_t searchStart, bool endOfDoc, bool doDelete); diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp index c0873a960..c8704fb89 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp @@ -167,7 +167,7 @@ void DocumentMap::wrapMap(const ScintillaEditView *editView) // update the wrap needed data _displayWidth = editZoneWidth; - _displayZoom = static_cast(pEditView->execute(SCI_GETZOOM)); + _displayZoom = pEditView->execute(SCI_GETZOOM); double zr = zoomRatio[_displayZoom + 10]; // compute doc map width: dzw/ezw = 1/zoomRatio @@ -183,8 +183,8 @@ void DocumentMap::wrapMap(const ScintillaEditView *editView) if (svp._paddingLeft || svp._paddingRight) { - int paddingMapLeft = static_cast(svp._paddingLeft / (editZoneWidth / docMapWidth)); - int paddingMapRight = static_cast(svp._paddingRight / (editZoneWidth / docMapWidth)); + INT_PTR paddingMapLeft = static_cast(svp._paddingLeft / (editZoneWidth / docMapWidth)); + INT_PTR paddingMapRight = static_cast(svp._paddingRight / (editZoneWidth / docMapWidth)); _pMapView->execute(SCI_SETMARGINLEFT, 0, paddingMapLeft); _pMapView->execute(SCI_SETMARGINRIGHT, 0, paddingMapRight); } @@ -424,9 +424,9 @@ INT_PTR CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP { int newPosY = HIWORD(lParam); int currentCenterPosY = _vzDlg.getCurrentCenterPosY(); - int pixelPerLine = static_cast(_pMapView->execute(SCI_TEXTHEIGHT, 0)); - int jumpDistance = newPosY - currentCenterPosY; - int nbLine2jump = jumpDistance/pixelPerLine; + INT_PTR pixelPerLine = _pMapView->execute(SCI_TEXTHEIGHT, 0); + INT_PTR jumpDistance = newPosY - currentCenterPosY; + INT_PTR nbLine2jump = jumpDistance/pixelPerLine; (*_ppEditView)->execute(SCI_LINESCROLL, 0, nbLine2jump); scrollMap(); diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.h b/PowerEditor/src/WinControls/DocumentMap/documentMap.h index fe060d477..b86be7c67 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.h +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.h @@ -148,7 +148,7 @@ private: bool _isTemporarilyShowing = false; // for needToRecomputeWith function - int _displayZoom = -1; - int _displayWidth = 0; + INT_PTR _displayZoom = -1; + INT_PTR _displayWidth = 0; generic_string id4dockingCont = DM_NOFOCUSWHILECLICKINGCAPTION; }; diff --git a/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.cpp b/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.cpp index 93d6c98d5..bbe217aef 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.cpp +++ b/PowerEditor/src/WinControls/DocumentMap/documentSnapshot.cpp @@ -104,12 +104,12 @@ void DocumentPeeker::scrollSnapshotWith(const MapPosition & mapPos, int textZone // if (mapPos._height != -1 && _rc.bottom != _rc.top + mapPos._height) { - _rc.bottom = _rc.top + mapPos._height; + _rc.bottom = _rc.top + static_cast(mapPos._height); hasBeenChanged = true; } if (mapPos._width != -1 && _rc.right != _rc.left + mapPos._width) { - _rc.right = _rc.left + mapPos._width; + _rc.right = _rc.left + static_cast(mapPos._width); hasBeenChanged = true; } if (hasBeenChanged) @@ -156,31 +156,31 @@ void DocumentPeeker::saveCurrentSnapshot(ScintillaEditView & editView) MapPosition mapPos = buffer->getMapPosition(); // First visible document line for scrolling to this line - mapPos._firstVisibleDisplayLine = static_cast(editView.execute(SCI_GETFIRSTVISIBLELINE)); - mapPos._firstVisibleDocLine = static_cast(editView.execute(SCI_DOCLINEFROMVISIBLE, mapPos._firstVisibleDisplayLine)); - mapPos._nbLine = static_cast(editView.execute(SCI_LINESONSCREEN, mapPos._firstVisibleDisplayLine)); - mapPos._lastVisibleDocLine = static_cast(editView.execute(SCI_DOCLINEFROMVISIBLE, mapPos._firstVisibleDisplayLine + mapPos._nbLine)); + mapPos._firstVisibleDisplayLine = editView.execute(SCI_GETFIRSTVISIBLELINE); + mapPos._firstVisibleDocLine = editView.execute(SCI_DOCLINEFROMVISIBLE, mapPos._firstVisibleDisplayLine); + mapPos._nbLine = editView.execute(SCI_LINESONSCREEN, mapPos._firstVisibleDisplayLine); + mapPos._lastVisibleDocLine = editView.execute(SCI_DOCLINEFROMVISIBLE, mapPos._firstVisibleDisplayLine + mapPos._nbLine); auto lineHeight = _pPeekerView->execute(SCI_TEXTHEIGHT, mapPos._firstVisibleDocLine); - mapPos._height = static_cast(mapPos._nbLine * lineHeight); + mapPos._height = mapPos._nbLine * lineHeight; // Width RECT editorRect; editView.getClientRect(editorRect); - int marginWidths = 0; + INT_PTR marginWidths = 0; for (int m = 0; m < 4; ++m) { - marginWidths += static_cast(editView.execute(SCI_GETMARGINWIDTHN, m)); + marginWidths += editView.execute(SCI_GETMARGINWIDTHN, m); } - double editViewWidth = editorRect.right - editorRect.left - marginWidths; + double editViewWidth = editorRect.right - editorRect.left - static_cast(marginWidths); double editViewHeight = editorRect.bottom - editorRect.top; - mapPos._width = static_cast((editViewWidth / editViewHeight) * static_cast(mapPos._height)); + mapPos._width = static_cast((editViewWidth / editViewHeight) * static_cast(mapPos._height)); - mapPos._wrapIndentMode = static_cast(editView.execute(SCI_GETWRAPINDENTMODE)); - mapPos._isWrap = static_cast(editView.isWrap()); + mapPos._wrapIndentMode = editView.execute(SCI_GETWRAPINDENTMODE); + mapPos._isWrap = editView.isWrap(); if (editView.isWrap()) { - mapPos._higherPos = static_cast(editView.execute(SCI_POSITIONFROMPOINT, 0, 0)); + mapPos._higherPos = editView.execute(SCI_POSITIONFROMPOINT, 0, 0); } // Length of document diff --git a/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.cpp b/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.cpp index 9664bc2fd..cd690dba2 100644 --- a/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.cpp +++ b/PowerEditor/src/WinControls/FindCharsInRange/FindCharsInRange.cpp @@ -92,7 +92,7 @@ INT_PTR CALLBACK FindCharsInRangeDlg::run_dlgProc(UINT message, WPARAM wParam, L case ID_FINDCHAR_NEXT: { - int currentPos = static_cast((*_ppEditView)->execute(SCI_GETCURRENTPOS)); + INT_PTR currentPos = (*_ppEditView)->execute(SCI_GETCURRENTPOS); unsigned char startRange = 0; unsigned char endRange = 255; bool direction = dirDown; diff --git a/PowerEditor/src/WinControls/FunctionList/functionParser.cpp b/PowerEditor/src/WinControls/FunctionList/functionParser.cpp index 7c2cd24a2..a66e12d98 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionParser.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionParser.cpp @@ -476,7 +476,7 @@ generic_string FunctionParser::parseSubLevel(size_t begin, size_t end, std::vect foundPos = -1; return generic_string(); } - int targetEnd = int((*ppEditView)->execute(SCI_GETTARGETEND)); + INT_PTR targetEnd = (*ppEditView)->execute(SCI_GETTARGETEND); if (dataToSearch.size() >= 2) {