Code enhancement: remove obsolete code

The removed code in this commit were added for working around Microsoft ReadDirectoryChanges notification issue:
1a97d3c854
Apparently the issue has been fixed. The following issue has been tested with this commit, no issue found:
https://github.com/notepad-plus-plus/notepad-plus-plus/pull/5591#issuecomment-487313886

This commit could remedy #15819 partially.

Close #15967
This commit is contained in:
Don Ho 2024-12-19 05:44:30 +01:00
parent de1a04038b
commit f535087e5d
27 changed files with 73 additions and 30 deletions

View File

@ -165,6 +165,7 @@ bool IsColorSchemeChangeMessage(LPARAM lParam)
_RefreshImmersiveColorPolicyState(); _RefreshImmersiveColorPolicyState();
is = true; is = true;
} }
if (_GetIsImmersiveColorUsingHighContrast) if (_GetIsImmersiveColorUsingHighContrast)
_GetIsImmersiveColorUsingHighContrast(IHCM_REFRESH); _GetIsImmersiveColorUsingHighContrast(IHCM_REFRESH);
return is; return is;
@ -209,10 +210,13 @@ bool IsWindowOrParentUsingDarkScrollBar(HWND hwnd)
HWND hwndRoot = GetAncestor(hwnd, GA_ROOT); HWND hwndRoot = GetAncestor(hwnd, GA_ROOT);
std::lock_guard<std::mutex> lock(g_darkScrollBarMutex); std::lock_guard<std::mutex> lock(g_darkScrollBarMutex);
if (g_darkScrollBarWindows.count(hwnd)) { if (g_darkScrollBarWindows.count(hwnd))
{
return true; return true;
} }
if (hwnd != hwndRoot && g_darkScrollBarWindows.count(hwndRoot)) {
if (hwnd != hwndRoot && g_darkScrollBarWindows.count(hwndRoot))
{
return true; return true;
} }
@ -233,7 +237,8 @@ void FixDarkScrollBar()
auto MyOpenThemeData = [](HWND hWnd, LPCWSTR classList) WINAPI_LAMBDA_RETURN(HTHEME) { auto MyOpenThemeData = [](HWND hWnd, LPCWSTR classList) WINAPI_LAMBDA_RETURN(HTHEME) {
if (wcscmp(classList, L"ScrollBar") == 0) if (wcscmp(classList, L"ScrollBar") == 0)
{ {
if (IsWindowOrParentUsingDarkScrollBar(hWnd)) { if (IsWindowOrParentUsingDarkScrollBar(hWnd))
{
hWnd = nullptr; hWnd = nullptr;
classList = L"Explorer::ScrollBar"; classList = L"Explorer::ScrollBar";
} }

View File

@ -859,17 +859,20 @@ bool str2Clipboard(const wstring &str2cpy, HWND hwnd)
{ {
return false; return false;
} }
if (!::OpenClipboard(hwnd)) if (!::OpenClipboard(hwnd))
{ {
::GlobalFree(hglbCopy); ::GlobalFree(hglbCopy);
return false; return false;
} }
if (!::EmptyClipboard()) if (!::EmptyClipboard())
{ {
::GlobalFree(hglbCopy); ::GlobalFree(hglbCopy);
::CloseClipboard(); ::CloseClipboard();
return false; return false;
} }
// Lock the handle and copy the text to the buffer. // Lock the handle and copy the text to the buffer.
wchar_t *pStr = (wchar_t *)::GlobalLock(hglbCopy); wchar_t *pStr = (wchar_t *)::GlobalLock(hglbCopy);
if (!pStr) if (!pStr)
@ -878,6 +881,7 @@ bool str2Clipboard(const wstring &str2cpy, HWND hwnd)
::CloseClipboard(); ::CloseClipboard();
return false; return false;
} }
wcscpy_s(pStr, len2Allocate / sizeof(wchar_t), str2cpy.c_str()); wcscpy_s(pStr, len2Allocate / sizeof(wchar_t), str2cpy.c_str());
::GlobalUnlock(hglbCopy); ::GlobalUnlock(hglbCopy);
// Place the handle on the clipboard. // Place the handle on the clipboard.
@ -888,6 +892,7 @@ bool str2Clipboard(const wstring &str2cpy, HWND hwnd)
::CloseClipboard(); ::CloseClipboard();
return false; return false;
} }
if (!::CloseClipboard()) if (!::CloseClipboard())
{ {
return false; return false;
@ -907,9 +912,11 @@ bool buf2Clipboard(const std::vector<Buffer*>& buffers, bool isFullPath, HWND hw
if (fileName) if (fileName)
selection += fileName; selection += fileName;
} }
if (!selection.empty() && !selection.ends_with(crlf)) if (!selection.empty() && !selection.ends_with(crlf))
selection += crlf; selection += crlf;
} }
if (!selection.empty()) if (!selection.empty())
return str2Clipboard(selection, hwnd); return str2Clipboard(selection, hwnd);
return false; return false;

View File

@ -303,6 +303,7 @@ public:
{ {
aNumIndex++; aNumIndex++;
} }
if (b[bNumIndex] == L'-') if (b[bNumIndex] == L'-')
{ {
bNumIndex++; bNumIndex++;
@ -471,6 +472,7 @@ public:
{ {
aNumIndex++; aNumIndex++;
} }
if (b[bNumIndex] == L'-') if (b[bNumIndex] == L'-')
{ {
bNumIndex++; bNumIndex++;

View File

@ -513,8 +513,10 @@ bool PluginsManager::loadPlugins(const wchar_t* dir, const PluginViewList* plugi
} }
} }
if (hFindFolder && (hFindFolder != INVALID_HANDLE_VALUE)) if (hFindFolder && (hFindFolder != INVALID_HANDLE_VALUE))
::FindClose(hFindFolder); ::FindClose(hFindFolder);
if (hFindDll && (hFindDll != INVALID_HANDLE_VALUE)) if (hFindDll && (hFindDll != INVALID_HANDLE_VALUE))
::FindClose(hFindDll); ::FindClose(hFindDll);

View File

@ -2176,17 +2176,6 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_CHECKDOCSTATUS: case NPPM_INTERNAL_CHECKDOCSTATUS:
{ {
// This is an workaround to deal with Microsoft issue in ReadDirectoryChanges notification
// If command prompt is used to write file continuously (e.g. ping -t 8.8.8.8 > ping.log)
// Then ReadDirectoryChanges does not detect the change.
// Fortunately, notification is sent if right click or double click happens on that file
// Let's leverage this as workaround to enhance npp file monitoring functionality.
// So calling "doesFileExist" is a workaround here.
Buffer* currBuf = getCurrentBuffer();
if (currBuf && currBuf->isMonitoringOn())
doesFileExist(currBuf->getFullPathName());
const NppGUI & nppgui = nppParam.getNppGUI(); const NppGUI & nppgui = nppParam.getNppGUI();
if (nppgui._fileAutoDetection != cdDisabled) if (nppgui._fileAutoDetection != cdDisabled)
{ {

View File

@ -209,6 +209,7 @@ void Buffer::updateTimeStamp()
//sprintf_s(buf, _countof(buf) - 1, " in updateTimeStamp(): timeStampLive (%lu/%lu) > _timeStamp (%lu/%lu)", //sprintf_s(buf, _countof(buf) - 1, " in updateTimeStamp(): timeStampLive (%lu/%lu) > _timeStamp (%lu/%lu)",
// timeStampLive.dwLowDateTime, timeStampLive.dwHighDateTime, _timeStamp.dwLowDateTime, _timeStamp.dwHighDateTime); // timeStampLive.dwLowDateTime, timeStampLive.dwHighDateTime, _timeStamp.dwLowDateTime, _timeStamp.dwHighDateTime);
} }
if (buf[0] != '\0') if (buf[0] != '\0')
{ {
wstring issueFn = nppLogNetworkDriveIssue; wstring issueFn = nppLogNetworkDriveIssue;
@ -220,6 +221,7 @@ void Buffer::updateTimeStamp()
writeLog(nppIssueLog.c_str(), msg.c_str()); writeLog(nppIssueLog.c_str(), msg.c_str());
} }
} }
_timeStamp = timeStampLive; _timeStamp = timeStampLive;
doNotify(BufferChangeTimestamp); doNotify(BufferChangeTimestamp);
} }
@ -343,6 +345,7 @@ bool Buffer::checkFileState() // returns true if the status has been changed (it
{ {
msg += "FALSE"; msg += "FALSE";
} }
if (bWorkerThreadTerminated) if (bWorkerThreadTerminated)
{ {
msg += ", its worker thread had to be forcefully terminated due to timeout reached!"; msg += ", its worker thread had to be forcefully terminated due to timeout reached!";
@ -423,6 +426,7 @@ bool Buffer::checkFileState() // returns true if the status has been changed (it
//sprintf_s(buf, _countof(buf) - 1, " in checkFileState(): attributes.ftLastWriteTime (%lu/%lu) > _timeStamp (%lu/%lu)", //sprintf_s(buf, _countof(buf) - 1, " in checkFileState(): attributes.ftLastWriteTime (%lu/%lu) > _timeStamp (%lu/%lu)",
// attributes.ftLastWriteTime.dwLowDateTime, attributes.ftLastWriteTime.dwHighDateTime, _timeStamp.dwLowDateTime, _timeStamp.dwHighDateTime); // attributes.ftLastWriteTime.dwLowDateTime, attributes.ftLastWriteTime.dwHighDateTime, _timeStamp.dwLowDateTime, _timeStamp.dwHighDateTime);
} }
if (buf[0] != '\0') if (buf[0] != '\0')
{ {
wstring issueFn = nppLogNetworkDriveIssue; wstring issueFn = nppLogNetworkDriveIssue;
@ -1196,6 +1200,7 @@ bool FileManager::backupCurrentBuffer()
grabSize -= incompleteMultibyteChar; grabSize -= incompleteMultibyteChar;
isWrittenSuccessful = UnicodeConvertor.writeFile(newData, newDataLen); isWrittenSuccessful = UnicodeConvertor.writeFile(newData, newDataLen);
} }
if (lengthDoc == 0) if (lengthDoc == 0)
isWrittenSuccessful = true; isWrittenSuccessful = true;
} }
@ -1461,6 +1466,7 @@ size_t FileManager::nextUntitledNewNumber() const
break; break;
} }
} }
if (!numberAvailable) if (!numberAvailable)
newNumber++; newNumber++;
@ -1730,6 +1736,7 @@ bool FileManager::loadFileData(Document doc, int64_t fileSize, const wchar_t * f
PathRemoveFileSpec(dir); PathRemoveFileSpec(dir);
isNetworkDirDisconnected = !doesDirectoryExist(dir); isNetworkDirDisconnected = !doesDirectoryExist(dir);
} }
if (isNetworkDirDisconnected) if (isNetworkDirDisconnected)
return false; // If network ressource is not reachable, we stop here for not having hanging issue because of _wfopen return false; // If network ressource is not reachable, we stop here for not having hanging issue because of _wfopen
@ -1793,6 +1800,7 @@ bool FileManager::loadFileData(Document doc, int64_t fileSize, const wchar_t * f
success = false; success = false;
break; break;
} }
if (lenFile == 0) break; if (lenFile == 0) break;
if (isFirstTime) if (isFirstTime)
@ -1888,6 +1896,7 @@ bool FileManager::loadFileData(Document doc, int64_t fileSize, const wchar_t * f
_stprintf_s(szException, _countof(szException), L"%d (Scintilla)", sciStatus); _stprintf_s(szException, _countof(szException), L"%d (Scintilla)", sciStatus);
break; break;
} }
if (sciStatus != SC_STATUS_BADALLOC) if (sciStatus != SC_STATUS_BADALLOC)
{ {
pNativeSpeaker->messageBox("FileLoadingException", pNativeSpeaker->messageBox("FileLoadingException",

View File

@ -257,6 +257,7 @@ bool FunctionCallTip::getCursorFunction()
valueVec.pop_back(); valueVec.pop_back();
} }
} }
if (curValue.lastFunctionIdentifier > -1) if (curValue.lastFunctionIdentifier > -1)
{ {
Token funcToken = tokenVector.at(curValue.lastFunctionIdentifier); Token funcToken = tokenVector.at(curValue.lastFunctionIdentifier);
@ -271,6 +272,7 @@ bool FunctionCallTip::getCursorFunction()
else else
same = wcsncmp(_funcName, funcToken.token, lstrlen(_funcName)) == 0; same = wcsncmp(_funcName, funcToken.token, lstrlen(_funcName)) == 0;
} }
if (!same) if (!same)
{ //check if we need to reload data { //check if we need to reload data
delete [] _funcName; delete [] _funcName;

View File

@ -124,6 +124,7 @@ vector< pair<intptr_t, intptr_t> > XmlMatchedTagsHighlighter::getAttributesPos(i
state = attr_invalid; state = attr_invalid;
} }
} }
if (state == attr_value) if (state == attr_value)
attributes.push_back(pair<intptr_t, intptr_t>(start+startPos, start+i-1)); attributes.push_back(pair<intptr_t, intptr_t>(start+startPos, start+i-1));

View File

@ -240,6 +240,7 @@ intptr_t CALLBACK ClipboardHistoryPanel::run_dlgProc(UINT message, WPARAM wParam
addToClipboadHistory(clipboardData); addToClipboadHistory(clipboardData);
} }
} }
if (_hwndNextCbViewer) if (_hwndNextCbViewer)
::SendMessage(_hwndNextCbViewer, message, wParam, lParam); ::SendMessage(_hwndNextCbViewer, message, wParam, lParam);
return TRUE; return TRUE;

View File

@ -780,6 +780,7 @@ LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l
{ {
dis.itemState |= ODS_FOCUS; dis.itemState |= ODS_FOCUS;
} }
if (i == nSelTab) if (i == nSelTab)
{ {
dis.itemState |= ODS_SELECTED; dis.itemState |= ODS_SELECTED;

View File

@ -594,6 +594,7 @@ void Gripper::drawRectangle(const POINT* pPt)
::PatBlt(hdcMem, rcOld.left , rcOld.top , rcOld.right , rcOld.bottom , PATINVERT); ::PatBlt(hdcMem, rcOld.left , rcOld.top , rcOld.right , rcOld.bottom , PATINVERT);
::PatBlt(hdcMem, rcOld.left+3, rcOld.top+3, rcOld.right-6, rcOld.bottom-6, PATINVERT); ::PatBlt(hdcMem, rcOld.left+3, rcOld.top+3, rcOld.right-6, rcOld.bottom-6, PATINVERT);
} }
if (pPt != NULL) if (pPt != NULL)
{ // draw the new drag-rectangle { // draw the new drag-rectangle
::PatBlt(hdcMem, rcNew.left , rcNew.top , rcNew.right , rcNew.bottom , PATINVERT); ::PatBlt(hdcMem, rcNew.left , rcNew.top , rcNew.right , rcNew.bottom , PATINVERT);

View File

@ -63,9 +63,11 @@ public:
#endif #endif
::ReleaseDC(0, _hdc); ::ReleaseDC(0, _hdc);
} }
if (_hbm) { if (_hbm) {
::DeleteObject(_hbm); ::DeleteObject(_hbm);
} }
if (_hbrush) { if (_hbrush) {
::DeleteObject(_hbrush); ::DeleteObject(_hbrush);
} }

View File

@ -106,11 +106,13 @@ void DocumentPeeker::scrollSnapshotWith(const MapPosition & mapPos, int textZone
_rc.bottom = _rc.top + static_cast<LONG>(mapPos._height); _rc.bottom = _rc.top + static_cast<LONG>(mapPos._height);
hasBeenChanged = true; hasBeenChanged = true;
} }
if (mapPos._width != -1 && _rc.right != _rc.left + mapPos._width) if (mapPos._width != -1 && _rc.right != _rc.left + mapPos._width)
{ {
_rc.right = _rc.left + static_cast<LONG>(mapPos._width); _rc.right = _rc.left + static_cast<LONG>(mapPos._width);
hasBeenChanged = true; hasBeenChanged = true;
} }
if (hasBeenChanged) if (hasBeenChanged)
::MoveWindow(_pPeekerView->getHSelf(), 0, 0, _rc.right - _rc.left, _rc.bottom - _rc.top, TRUE); ::MoveWindow(_pPeekerView->getHSelf(), 0, 0, _rc.right - _rc.left, _rc.bottom - _rc.top, TRUE);
// //

View File

@ -235,6 +235,7 @@ bool FindCharsInRangeDlg::getRangeFromUI(unsigned char & startRange, unsigned ch
endRange = 255; endRange = 255;
return true; return true;
} }
if (isCheckedOrNot(IDC_ASCCI_RADIO)) if (isCheckedOrNot(IDC_ASCCI_RADIO))
{ {
startRange = 0; startRange = 0;

View File

@ -192,6 +192,7 @@ void FunctionListPanel::addInStateArray(TreeStateNode tree2Update, const wchar_t
found = true; found = true;
} }
} }
if (!found) if (!found)
{ {
TreeParams params; TreeParams params;

View File

@ -148,6 +148,7 @@ namespace // anonymous
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
shellItem = parentItem; shellItem = parentItem;
} }
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = dialog->SetFolder(shellItem); hr = dialog->SetFolder(shellItem);
return SUCCEEDED(hr); return SUCCEEDED(hr);
@ -421,6 +422,7 @@ private:
} }
} }
} }
if (_hwndNameEdit) if (_hwndNameEdit)
s_handleMap[_hwndNameEdit] = this; s_handleMap[_hwndNameEdit] = this;
} }

View File

@ -1142,6 +1142,7 @@ void ProjectPanel::popupMenuCmd(int cmdID)
_treeView.removeItem(hTreeItem); _treeView.removeItem(hTreeItem);
setWorkSpaceDirty(true); setWorkSpaceDirty(true);
} }
if (getNodeType(parent) == nodeType_folder) if (getNodeType(parent) == nodeType_folder)
_treeView.setItemImage(parent, INDEX_CLOSED_NODE, INDEX_CLOSED_NODE); _treeView.setItemImage(parent, INDEX_CLOSED_NODE, INDEX_CLOSED_NODE);
} }

View File

@ -42,6 +42,7 @@ void SplitterContainer::create(Window *pWin0, Window *pWin1, int splitterSize, S
_dwSplitterStyle |= SV_FIXED; _dwSplitterStyle |= SV_FIXED;
_dwSplitterStyle &= ~SV_RESIZEWTHPERCNT; _dwSplitterStyle &= ~SV_RESIZEWTHPERCNT;
} }
if (!_isRegistered) if (!_isRegistered)
{ {
WNDCLASS splitterContainerClass{}; WNDCLASS splitterContainerClass{};
@ -133,6 +134,7 @@ void SplitterContainer::rotateTo(DIRECTION direction)
_dwSplitterStyle |= SV_VERTICAL; _dwSplitterStyle |= SV_VERTICAL;
doSwitchWindow = (direction == DIRECTION::RIGHT); doSwitchWindow = (direction == DIRECTION::RIGHT);
} }
if (doSwitchWindow) if (doSwitchWindow)
{ {
Window *tmp = _pWin0; Window *tmp = _pWin0;

View File

@ -123,6 +123,7 @@ void expandNppEnvironmentStrs(const wchar_t *strSrc, wchar_t *stringDest, size_t
} }
} }
} }
if (iBegin != -1) if (iBegin != -1)
{ {
if (iEnd != -1) if (iEnd != -1)

View File

@ -74,6 +74,7 @@ bool ControlsTab::renameTab(const wchar_t *internalName, const wchar_t *newName)
break; break;
} }
} }
if (!foundIt) if (!foundIt)
return false; return false;

View File

@ -1192,6 +1192,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
{ {
dis.itemState |= ODS_FOCUS; dis.itemState |= ODS_FOCUS;
} }
if (i == nSelTab) if (i == nSelTab)
{ {
dis.itemState |= ODS_SELECTED; dis.itemState |= ODS_SELECTED;

View File

@ -394,6 +394,7 @@ void ToolBar::reset(bool create)
addbmp.nID = reinterpret_cast<UINT_PTR>(hBmp); addbmp.nID = reinterpret_cast<UINT_PTR>(hBmp);
::SendMessage(_hSelf, TB_ADDBITMAP, 1, reinterpret_cast<LPARAM>(&addbmp)); ::SendMessage(_hSelf, TB_ADDBITMAP, 1, reinterpret_cast<LPARAM>(&addbmp));
} }
if (_nbDynButtons > 0) if (_nbDynButtons > 0)
{ {
for (size_t j = 0; j < _nbDynButtons; ++j) for (size_t j = 0; j < _nbDynButtons; ++j)

View File

@ -190,6 +190,7 @@ LRESULT VerticalFileSwitcher::listViewNotifyCustomDraw(HWND hWnd, UINT uMsg, WPA
{ {
::FillRect(lplvcd->nmcd.hdc, &rcSubItem2, hBrush); ::FillRect(lplvcd->nmcd.hdc, &rcSubItem2, hBrush);
} }
if (colCount == 3) if (colCount == 3)
{ {
::FillRect(lplvcd->nmcd.hdc, &rcSubItem3, hBrush); ::FillRect(lplvcd->nmcd.hdc, &rcSubItem3, hBrush);

View File

@ -69,8 +69,7 @@ void CWinMgr::GetWindowPositions(HWND hWnd)
////////////////// //////////////////
// Move all the windows. Use DeferWindowPos for speed. // Move all the windows. Use DeferWindowPos for speed.
// //
void void CWinMgr::SetWindowPositions(HWND hWnd)
CWinMgr::SetWindowPositions(HWND hWnd)
{ {
int nWindows = CountWindows(); int nWindows = CountWindows();
if (m_map && hWnd && nWindows>0) { if (m_map && hWnd && nWindows>0) {
@ -132,8 +131,7 @@ WINRECT* CWinMgr::FindRect(int nID)
// algorithm. If a window is given, it's used to get the min/max size and // algorithm. If a window is given, it's used to get the min/max size and
// desired size for TOFIT types. // desired size for TOFIT types.
// //
void void CWinMgr::CalcGroup(WINRECT* pGroup, HWND hWnd)
CWinMgr::CalcGroup(WINRECT* pGroup, HWND hWnd)
{ {
// If this bombs, most likely the first entry in your map is not a group! // If this bombs, most likely the first entry in your map is not a group!
assert(pGroup && pGroup->IsGroup()); assert(pGroup && pGroup->IsGroup());
@ -203,8 +201,7 @@ CWinMgr::CalcGroup(WINRECT* pGroup, HWND hWnd)
// Adjust the size of a single entry upwards to its desired size. // Adjust the size of a single entry upwards to its desired size.
// Decrement hwRemaining by amount increased. // Decrement hwRemaining by amount increased.
// //
void void CWinMgr::AdjustSize(WINRECT* wrc, BOOL bRow,
CWinMgr::AdjustSize(WINRECT* wrc, BOOL bRow,
int& hwRemaining, HWND hWnd) int& hwRemaining, HWND hWnd)
{ {
SIZEINFO szi; SIZEINFO szi;
@ -236,8 +233,7 @@ CWinMgr::AdjustSize(WINRECT* wrc, BOOL bRow,
// one below the other; for columns, set each column as tall as rcTotal and // one below the other; for columns, set each column as tall as rcTotal and
// each to the right of the previous. // each to the right of the previous.
// //
void void CWinMgr::PositionRects(WINRECT* pGroup, const RECT& rcTotal, BOOL bRow)
CWinMgr::PositionRects(WINRECT* pGroup, const RECT& rcTotal, BOOL bRow)
{ {
LONG xoryPos = bRow ? rcTotal.top : rcTotal.left; LONG xoryPos = bRow ? rcTotal.top : rcTotal.left;
@ -269,8 +265,7 @@ CWinMgr::PositionRects(WINRECT* pGroup, const RECT& rcTotal, BOOL bRow)
// the SIZEINFO argument. For a group, calculate size info as aggregate of // the SIZEINFO argument. For a group, calculate size info as aggregate of
// subentries. // subentries.
// //
void void CWinMgr::OnGetSizeInfo(SIZEINFO& szi, WINRECT* wrc, HWND hWnd)
CWinMgr::OnGetSizeInfo(SIZEINFO& szi, WINRECT* wrc, HWND hWnd)
{ {
szi.szMin = SIZEZERO; // default min size = zero szi.szMin = SIZEZERO; // default min size = zero
szi.szMax = SIZEMAX; // default max size = infinite szi.szMax = SIZEMAX; // default max size = infinite
@ -321,17 +316,23 @@ CWinMgr::OnGetSizeInfo(SIZEINFO& szi, WINRECT* wrc, HWND hWnd)
BOOL bRow = parent->IsRowGroup(); BOOL bRow = parent->IsRowGroup();
int hw, hwMin, hwTotal, pct; int hw, hwMin, hwTotal, pct;
switch (wrc->Type()) { switch (wrc->Type())
{
case WRCT_FIXED: case WRCT_FIXED:
hw = hwMin = wrc->GetParam(); // ht/wid is parameter hw = hwMin = wrc->GetParam(); // ht/wid is parameter
if (hw<0) { // if fixed val is negative: if (hw<0) // if fixed val is negative:
{
hw = -hw; // use absolute val for desired.. hw = -hw; // use absolute val for desired..
hwMin = 0; // ..and zero for minimum hwMin = 0; // ..and zero for minimum
} }
if (bRow) {
if (bRow)
{
szi.szMax.cy = szi.szDesired.cy = hw; szi.szMax.cy = szi.szDesired.cy = hw;
szi.szMin.cy = hwMin; szi.szMin.cy = hwMin;
} else { }
else
{
szi.szMax.cx = szi.szDesired.cx = hw; szi.szMax.cx = szi.szDesired.cx = hw;
szi.szMin.cx = hwMin; szi.szMin.cx = hwMin;
} }
@ -401,8 +402,7 @@ BOOL CWinMgr::SendGetSizeInfo(SIZEINFO& szi, HWND hWnd, UINT nID)
////////////////// //////////////////
// Get min/max info. // Get min/max info.
// //
void void CWinMgr::GetMinMaxInfo(HWND hWnd, MINMAXINFO* lpMMI)
CWinMgr::GetMinMaxInfo(HWND hWnd, MINMAXINFO* lpMMI)
{ {
SIZEINFO szi; SIZEINFO szi;
GetMinMaxInfo(hWnd, szi); // call overloaded version GetMinMaxInfo(hWnd, szi); // call overloaded version
@ -486,6 +486,7 @@ void CWinMgr::MoveRect(WINRECT* pwrcMove, POINT ptMove, HWND pParentWnd)
OffsetRect(pwrcMove->GetRect(), ptMove); OffsetRect(pwrcMove->GetRect(), ptMove);
if (prev->IsGroup()) if (prev->IsGroup())
CalcGroup(prev, pParentWnd); CalcGroup(prev, pParentWnd);
if (next->IsGroup()) if (next->IsGroup())
CalcGroup(next, pParentWnd); CalcGroup(next, pParentWnd);
} }

View File

@ -101,6 +101,7 @@ struct NumericStringEquivalence
lcmp = *str1 - *str2; lcmp = *str1 - *str2;
break; break;
} }
if (_istdigit(*str1) && _istdigit(*str2)) if (_istdigit(*str1) && _istdigit(*str2))
{ {
lcmp = wcstol(str1, &p1, 10) - wcstol(str2, &p2, 10); lcmp = wcstol(str1, &p1, 10) - wcstol(str2, &p2, 10);
@ -417,6 +418,7 @@ intptr_t CALLBACK WindowsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
string docSizeText = to_string(docSize); string docSizeText = to_string(docSize);
text = wstring(docSizeText.begin(), docSizeText.end()); text = wstring(docSizeText.begin(), docSizeText.end());
} }
if (static_cast<int>(text.length()) < pLvdi->item.cchTextMax) if (static_cast<int>(text.length()) < pLvdi->item.cchTextMax)
{ {
// Copy the resulting text to destination with a null terminator. // Copy the resulting text to destination with a null terminator.

View File

@ -231,8 +231,10 @@ wstring & LastRecentFileList::getItem(int id)
if (_lrfl.at(i)._id == id) if (_lrfl.at(i)._id == id)
break; break;
} }
if (i == _size) if (i == _size)
i = 0; i = 0;
return _lrfl.at(i)._name; //if not found, return first return _lrfl.at(i)._name; //if not found, return first
} }
@ -256,6 +258,7 @@ void LastRecentFileList::setUserMaxNbLRF(int size)
toPop--; toPop--;
_size--; _size--;
} }
updateMenu(); updateMenu();
_size = _userMax; _size = _userMax;
} }

View File

@ -621,6 +621,7 @@ void NativeLangSpeaker::changeLangTabDropContextMenu(HMENU hCM)
int cmdID = ::GetMenuItemID(hCM, POS_GO2VIEW); int cmdID = ::GetMenuItemID(hCM, POS_GO2VIEW);
::ModifyMenu(hCM, POS_GO2VIEW, MF_BYPOSITION|MF_STRING, cmdID, goToViewG); ::ModifyMenu(hCM, POS_GO2VIEW, MF_BYPOSITION|MF_STRING, cmdID, goToViewG);
} }
if (cloneToViewA && cloneToViewA[0]) if (cloneToViewA && cloneToViewA[0])
{ {
const wchar_t *cloneToViewG = wmc.char2wchar(cloneToViewA, _nativeLangEncoding); const wchar_t *cloneToViewG = wmc.char2wchar(cloneToViewA, _nativeLangEncoding);